mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update package.json and relative files
This commit is contained in:
parent
5fc75f0b3a
commit
043650a3e5
15
node_modules/.bin/markdown-it
generated
vendored
Normal file
15
node_modules/.bin/markdown-it
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../markdown-it/bin/markdown-it.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../markdown-it/bin/markdown-it.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
17
node_modules/.bin/markdown-it.cmd
generated
vendored
Normal file
17
node_modules/.bin/markdown-it.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\markdown-it\bin\markdown-it.js" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
18
node_modules/.bin/markdown-it.ps1
generated
vendored
Normal file
18
node_modules/.bin/markdown-it.ps1
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../markdown-it/bin/markdown-it.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../markdown-it/bin/markdown-it.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
15
node_modules/.bin/mkdirp
generated
vendored
Normal file
15
node_modules/.bin/mkdirp
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
17
node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
17
node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
18
node_modules/.bin/mkdirp.ps1
generated
vendored
Normal file
18
node_modules/.bin/mkdirp.ps1
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
15
node_modules/.bin/modernizr
generated
vendored
Normal file
15
node_modules/.bin/modernizr
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../modernizr/bin/modernizr" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../modernizr/bin/modernizr" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
17
node_modules/.bin/modernizr.cmd
generated
vendored
Normal file
17
node_modules/.bin/modernizr.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\modernizr\bin\modernizr" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
18
node_modules/.bin/modernizr.ps1
generated
vendored
Normal file
18
node_modules/.bin/modernizr.ps1
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../modernizr/bin/modernizr" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../modernizr/bin/modernizr" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
15
node_modules/.bin/r.js
generated
vendored
Normal file
15
node_modules/.bin/r.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../requirejs/bin/r.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../requirejs/bin/r.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
17
node_modules/.bin/r.js.cmd
generated
vendored
Normal file
17
node_modules/.bin/r.js.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\requirejs\bin\r.js" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
18
node_modules/.bin/r.js.ps1
generated
vendored
Normal file
18
node_modules/.bin/r.js.ps1
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../requirejs/bin/r.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../requirejs/bin/r.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
15
node_modules/.bin/r_js
generated
vendored
Normal file
15
node_modules/.bin/r_js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../requirejs/bin/r.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../requirejs/bin/r.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
17
node_modules/.bin/r_js.cmd
generated
vendored
Normal file
17
node_modules/.bin/r_js.cmd
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
@ECHO off
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
"%_prog%" "%dp0%\..\requirejs\bin\r.js" %*
|
||||||
|
ENDLOCAL
|
||||||
|
EXIT /b %errorlevel%
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
18
node_modules/.bin/r_js.ps1
generated
vendored
Normal file
18
node_modules/.bin/r_js.ps1
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
& "$basedir/node$exe" "$basedir/../requirejs/bin/r.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../requirejs/bin/r.js" $args
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
21
node_modules/@types/color-name/LICENSE
generated
vendored
Normal file
21
node_modules/@types/color-name/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. 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
|
16
node_modules/@types/color-name/README.md
generated
vendored
Normal file
16
node_modules/@types/color-name/README.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/color-name`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for color-name ( https://github.com/colorjs/color-name ).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-name
|
||||||
|
|
||||||
|
Additional Details
|
||||||
|
* Last updated: Wed, 13 Feb 2019 16:16:48 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by Junyoung Clare Jang <https://github.com/Ailrun>.
|
161
node_modules/@types/color-name/index.d.ts
generated
vendored
Normal file
161
node_modules/@types/color-name/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
// Type definitions for color-name 1.1
|
||||||
|
// Project: https://github.com/colorjs/color-name
|
||||||
|
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tuple of Red, Green, and Blue
|
||||||
|
* @example
|
||||||
|
* // Red = 55, Green = 70, Blue = 0
|
||||||
|
* const rgb: RGB = [55, 70, 0];
|
||||||
|
*/
|
||||||
|
export type RGB = [number, number, number];
|
||||||
|
|
||||||
|
export const aliceblue: RGB;
|
||||||
|
export const antiquewhite: RGB;
|
||||||
|
export const aqua: RGB;
|
||||||
|
export const aquamarine: RGB;
|
||||||
|
export const azure: RGB;
|
||||||
|
export const beige: RGB;
|
||||||
|
export const bisque: RGB;
|
||||||
|
export const black: RGB;
|
||||||
|
export const blanchedalmond: RGB;
|
||||||
|
export const blue: RGB;
|
||||||
|
export const blueviolet: RGB;
|
||||||
|
export const brown: RGB;
|
||||||
|
export const burlywood: RGB;
|
||||||
|
export const cadetblue: RGB;
|
||||||
|
export const chartreuse: RGB;
|
||||||
|
export const chocolate: RGB;
|
||||||
|
export const coral: RGB;
|
||||||
|
export const cornflowerblue: RGB;
|
||||||
|
export const cornsilk: RGB;
|
||||||
|
export const crimson: RGB;
|
||||||
|
export const cyan: RGB;
|
||||||
|
export const darkblue: RGB;
|
||||||
|
export const darkcyan: RGB;
|
||||||
|
export const darkgoldenrod: RGB;
|
||||||
|
export const darkgray: RGB;
|
||||||
|
export const darkgreen: RGB;
|
||||||
|
export const darkgrey: RGB;
|
||||||
|
export const darkkhaki: RGB;
|
||||||
|
export const darkmagenta: RGB;
|
||||||
|
export const darkolivegreen: RGB;
|
||||||
|
export const darkorange: RGB;
|
||||||
|
export const darkorchid: RGB;
|
||||||
|
export const darkred: RGB;
|
||||||
|
export const darksalmon: RGB;
|
||||||
|
export const darkseagreen: RGB;
|
||||||
|
export const darkslateblue: RGB;
|
||||||
|
export const darkslategray: RGB;
|
||||||
|
export const darkslategrey: RGB;
|
||||||
|
export const darkturquoise: RGB;
|
||||||
|
export const darkviolet: RGB;
|
||||||
|
export const deeppink: RGB;
|
||||||
|
export const deepskyblue: RGB;
|
||||||
|
export const dimgray: RGB;
|
||||||
|
export const dimgrey: RGB;
|
||||||
|
export const dodgerblue: RGB;
|
||||||
|
export const firebrick: RGB;
|
||||||
|
export const floralwhite: RGB;
|
||||||
|
export const forestgreen: RGB;
|
||||||
|
export const fuchsia: RGB;
|
||||||
|
export const gainsboro: RGB;
|
||||||
|
export const ghostwhite: RGB;
|
||||||
|
export const gold: RGB;
|
||||||
|
export const goldenrod: RGB;
|
||||||
|
export const gray: RGB;
|
||||||
|
export const green: RGB;
|
||||||
|
export const greenyellow: RGB;
|
||||||
|
export const grey: RGB;
|
||||||
|
export const honeydew: RGB;
|
||||||
|
export const hotpink: RGB;
|
||||||
|
export const indianred: RGB;
|
||||||
|
export const indigo: RGB;
|
||||||
|
export const ivory: RGB;
|
||||||
|
export const khaki: RGB;
|
||||||
|
export const lavender: RGB;
|
||||||
|
export const lavenderblush: RGB;
|
||||||
|
export const lawngreen: RGB;
|
||||||
|
export const lemonchiffon: RGB;
|
||||||
|
export const lightblue: RGB;
|
||||||
|
export const lightcoral: RGB;
|
||||||
|
export const lightcyan: RGB;
|
||||||
|
export const lightgoldenrodyellow: RGB;
|
||||||
|
export const lightgray: RGB;
|
||||||
|
export const lightgreen: RGB;
|
||||||
|
export const lightgrey: RGB;
|
||||||
|
export const lightpink: RGB;
|
||||||
|
export const lightsalmon: RGB;
|
||||||
|
export const lightseagreen: RGB;
|
||||||
|
export const lightskyblue: RGB;
|
||||||
|
export const lightslategray: RGB;
|
||||||
|
export const lightslategrey: RGB;
|
||||||
|
export const lightsteelblue: RGB;
|
||||||
|
export const lightyellow: RGB;
|
||||||
|
export const lime: RGB;
|
||||||
|
export const limegreen: RGB;
|
||||||
|
export const linen: RGB;
|
||||||
|
export const magenta: RGB;
|
||||||
|
export const maroon: RGB;
|
||||||
|
export const mediumaquamarine: RGB;
|
||||||
|
export const mediumblue: RGB;
|
||||||
|
export const mediumorchid: RGB;
|
||||||
|
export const mediumpurple: RGB;
|
||||||
|
export const mediumseagreen: RGB;
|
||||||
|
export const mediumslateblue: RGB;
|
||||||
|
export const mediumspringgreen: RGB;
|
||||||
|
export const mediumturquoise: RGB;
|
||||||
|
export const mediumvioletred: RGB;
|
||||||
|
export const midnightblue: RGB;
|
||||||
|
export const mintcream: RGB;
|
||||||
|
export const mistyrose: RGB;
|
||||||
|
export const moccasin: RGB;
|
||||||
|
export const navajowhite: RGB;
|
||||||
|
export const navy: RGB;
|
||||||
|
export const oldlace: RGB;
|
||||||
|
export const olive: RGB;
|
||||||
|
export const olivedrab: RGB;
|
||||||
|
export const orange: RGB;
|
||||||
|
export const orangered: RGB;
|
||||||
|
export const orchid: RGB;
|
||||||
|
export const palegoldenrod: RGB;
|
||||||
|
export const palegreen: RGB;
|
||||||
|
export const paleturquoise: RGB;
|
||||||
|
export const palevioletred: RGB;
|
||||||
|
export const papayawhip: RGB;
|
||||||
|
export const peachpuff: RGB;
|
||||||
|
export const peru: RGB;
|
||||||
|
export const pink: RGB;
|
||||||
|
export const plum: RGB;
|
||||||
|
export const powderblue: RGB;
|
||||||
|
export const purple: RGB;
|
||||||
|
export const rebeccapurple: RGB;
|
||||||
|
export const red: RGB;
|
||||||
|
export const rosybrown: RGB;
|
||||||
|
export const royalblue: RGB;
|
||||||
|
export const saddlebrown: RGB;
|
||||||
|
export const salmon: RGB;
|
||||||
|
export const sandybrown: RGB;
|
||||||
|
export const seagreen: RGB;
|
||||||
|
export const seashell: RGB;
|
||||||
|
export const sienna: RGB;
|
||||||
|
export const silver: RGB;
|
||||||
|
export const skyblue: RGB;
|
||||||
|
export const slateblue: RGB;
|
||||||
|
export const slategray: RGB;
|
||||||
|
export const slategrey: RGB;
|
||||||
|
export const snow: RGB;
|
||||||
|
export const springgreen: RGB;
|
||||||
|
export const steelblue: RGB;
|
||||||
|
export const tan: RGB;
|
||||||
|
export const teal: RGB;
|
||||||
|
export const thistle: RGB;
|
||||||
|
export const tomato: RGB;
|
||||||
|
export const turquoise: RGB;
|
||||||
|
export const violet: RGB;
|
||||||
|
export const wheat: RGB;
|
||||||
|
export const white: RGB;
|
||||||
|
export const whitesmoke: RGB;
|
||||||
|
export const yellow: RGB;
|
||||||
|
export const yellowgreen: RGB;
|
52
node_modules/@types/color-name/package.json
generated
vendored
Normal file
52
node_modules/@types/color-name/package.json
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"_from": "@types/color-name@^1.1.1",
|
||||||
|
"_id": "@types/color-name@1.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||||
|
"_location": "/@types/color-name",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@types/color-name@^1.1.1",
|
||||||
|
"name": "@types/color-name",
|
||||||
|
"escapedName": "@types%2fcolor-name",
|
||||||
|
"scope": "@types",
|
||||||
|
"rawSpec": "^1.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/ansi-styles"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
||||||
|
"_shasum": "1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0",
|
||||||
|
"_spec": "@types/color-name@^1.1.1",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\ansi-styles",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Junyoung Clare Jang",
|
||||||
|
"url": "https://github.com/Ailrun"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "TypeScript definitions for color-name",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "",
|
||||||
|
"name": "@types/color-name",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"typeScriptVersion": "2.0",
|
||||||
|
"types": "index",
|
||||||
|
"typesPublisherContentHash": "e22c6881e2dcf766e32142cbb82d9acf9c08258bdf0da8e76c8a448d1be44ac7",
|
||||||
|
"version": "1.1.1"
|
||||||
|
}
|
37
node_modules/ansi-regex/index.d.ts
generated
vendored
Normal file
37
node_modules/ansi-regex/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
declare namespace ansiRegex {
|
||||||
|
interface Options {
|
||||||
|
/**
|
||||||
|
Match only the first ANSI escape.
|
||||||
|
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
onlyFirst: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Regular expression for matching ANSI escape codes.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import ansiRegex = require('ansi-regex');
|
||||||
|
|
||||||
|
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
ansiRegex().test('cake');
|
||||||
|
//=> false
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||||
|
//=> ['\u001B[4m', '\u001B[0m']
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||||
|
//=> ['\u001B[4m']
|
||||||
|
|
||||||
|
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||||
|
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
declare function ansiRegex(options?: ansiRegex.Options): RegExp;
|
||||||
|
|
||||||
|
export = ansiRegex;
|
10
node_modules/ansi-regex/index.js
generated
vendored
Normal file
10
node_modules/ansi-regex/index.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = ({onlyFirst = false} = {}) => {
|
||||||
|
const pattern = [
|
||||||
|
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
||||||
|
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
||||||
|
].join('|');
|
||||||
|
|
||||||
|
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
||||||
|
};
|
9
node_modules/ansi-regex/license
generated
vendored
Normal file
9
node_modules/ansi-regex/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
87
node_modules/ansi-regex/package.json
generated
vendored
Normal file
87
node_modules/ansi-regex/package.json
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
{
|
||||||
|
"_from": "ansi-regex@^5.0.0",
|
||||||
|
"_id": "ansi-regex@5.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
|
||||||
|
"_location": "/ansi-regex",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-regex@^5.0.0",
|
||||||
|
"name": "ansi-regex",
|
||||||
|
"escapedName": "ansi-regex",
|
||||||
|
"rawSpec": "^5.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^5.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/strip-ansi"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||||
|
"_shasum": "388539f55179bf39339c81af30a654d69f87cb75",
|
||||||
|
"_spec": "ansi-regex@^5.0.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\strip-ansi",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Regular expression for matching ANSI escape codes",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^2.4.0",
|
||||||
|
"tsd": "^0.9.0",
|
||||||
|
"xo": "^0.25.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"styles",
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"tty",
|
||||||
|
"escape",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"command-line",
|
||||||
|
"text",
|
||||||
|
"regex",
|
||||||
|
"regexp",
|
||||||
|
"re",
|
||||||
|
"match",
|
||||||
|
"test",
|
||||||
|
"find",
|
||||||
|
"pattern"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "ansi-regex",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/chalk/ansi-regex.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd",
|
||||||
|
"view-supported": "node fixtures/view-codes.js"
|
||||||
|
},
|
||||||
|
"version": "5.0.0"
|
||||||
|
}
|
78
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
78
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
|
||||||
|
|
||||||
|
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install ansi-regex
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const ansiRegex = require('ansi-regex');
|
||||||
|
|
||||||
|
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
ansiRegex().test('cake');
|
||||||
|
//=> false
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||||
|
//=> ['\u001B[4m', '\u001B[0m']
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||||
|
//=> ['\u001B[4m']
|
||||||
|
|
||||||
|
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||||
|
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### ansiRegex(options?)
|
||||||
|
|
||||||
|
Returns a regex for matching ANSI escape codes.
|
||||||
|
|
||||||
|
#### options
|
||||||
|
|
||||||
|
Type: `object`
|
||||||
|
|
||||||
|
##### onlyFirst
|
||||||
|
|
||||||
|
Type: `boolean`<br>
|
||||||
|
Default: `false` *(Matches any ANSI escape codes in a string)*
|
||||||
|
|
||||||
|
Match only the first ANSI escape.
|
||||||
|
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### Why do you test for codes not in the ECMA 48 standard?
|
||||||
|
|
||||||
|
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||||
|
|
||||||
|
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||||
|
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<b>
|
||||||
|
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||||
|
</b>
|
||||||
|
<br>
|
||||||
|
<sub>
|
||||||
|
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||||
|
</sub>
|
||||||
|
</div>
|
197
node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
197
node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
import * as cssColors from 'color-name';
|
||||||
|
|
||||||
|
declare namespace ansiStyles {
|
||||||
|
interface ColorConvert {
|
||||||
|
/**
|
||||||
|
The RGB color space.
|
||||||
|
|
||||||
|
@param red - (`0`-`255`)
|
||||||
|
@param green - (`0`-`255`)
|
||||||
|
@param blue - (`0`-`255`)
|
||||||
|
*/
|
||||||
|
rgb(red: number, green: number, blue: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The RGB HEX color space.
|
||||||
|
|
||||||
|
@param hex - A hexadecimal string containing RGB data.
|
||||||
|
*/
|
||||||
|
hex(hex: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param keyword - A CSS color name.
|
||||||
|
*/
|
||||||
|
keyword(keyword: keyof typeof cssColors): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The HSL color space.
|
||||||
|
|
||||||
|
@param hue - (`0`-`360`)
|
||||||
|
@param saturation - (`0`-`100`)
|
||||||
|
@param lightness - (`0`-`100`)
|
||||||
|
*/
|
||||||
|
hsl(hue: number, saturation: number, lightness: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The HSV color space.
|
||||||
|
|
||||||
|
@param hue - (`0`-`360`)
|
||||||
|
@param saturation - (`0`-`100`)
|
||||||
|
@param value - (`0`-`100`)
|
||||||
|
*/
|
||||||
|
hsv(hue: number, saturation: number, value: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The HSV color space.
|
||||||
|
|
||||||
|
@param hue - (`0`-`360`)
|
||||||
|
@param whiteness - (`0`-`100`)
|
||||||
|
@param blackness - (`0`-`100`)
|
||||||
|
*/
|
||||||
|
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||||
|
*/
|
||||||
|
ansi(ansi: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||||
|
*/
|
||||||
|
ansi256(ansi: number): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CSPair {
|
||||||
|
/**
|
||||||
|
The ANSI terminal control sequence for starting this style.
|
||||||
|
*/
|
||||||
|
readonly open: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The ANSI terminal control sequence for ending this style.
|
||||||
|
*/
|
||||||
|
readonly close: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ColorBase {
|
||||||
|
readonly ansi: ColorConvert;
|
||||||
|
readonly ansi256: ColorConvert;
|
||||||
|
readonly ansi16m: ColorConvert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The ANSI terminal control sequence for ending this color.
|
||||||
|
*/
|
||||||
|
readonly close: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Modifier {
|
||||||
|
/**
|
||||||
|
Resets the current color chain.
|
||||||
|
*/
|
||||||
|
readonly reset: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make text bold.
|
||||||
|
*/
|
||||||
|
readonly bold: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Emitting only a small amount of light.
|
||||||
|
*/
|
||||||
|
readonly dim: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make text italic. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly italic: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make text underline. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly underline: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inverse background and foreground colors.
|
||||||
|
*/
|
||||||
|
readonly inverse: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints the text, but makes it invisible.
|
||||||
|
*/
|
||||||
|
readonly hidden: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||||
|
*/
|
||||||
|
readonly strikethrough: CSPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ForegroundColor {
|
||||||
|
readonly black: CSPair;
|
||||||
|
readonly red: CSPair;
|
||||||
|
readonly green: CSPair;
|
||||||
|
readonly yellow: CSPair;
|
||||||
|
readonly blue: CSPair;
|
||||||
|
readonly cyan: CSPair;
|
||||||
|
readonly magenta: CSPair;
|
||||||
|
readonly white: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `blackBright`.
|
||||||
|
*/
|
||||||
|
readonly gray: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `blackBright`.
|
||||||
|
*/
|
||||||
|
readonly grey: CSPair;
|
||||||
|
|
||||||
|
readonly blackBright: CSPair;
|
||||||
|
readonly redBright: CSPair;
|
||||||
|
readonly greenBright: CSPair;
|
||||||
|
readonly yellowBright: CSPair;
|
||||||
|
readonly blueBright: CSPair;
|
||||||
|
readonly cyanBright: CSPair;
|
||||||
|
readonly magentaBright: CSPair;
|
||||||
|
readonly whiteBright: CSPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BackgroundColor {
|
||||||
|
readonly bgBlack: CSPair;
|
||||||
|
readonly bgRed: CSPair;
|
||||||
|
readonly bgGreen: CSPair;
|
||||||
|
readonly bgYellow: CSPair;
|
||||||
|
readonly bgBlue: CSPair;
|
||||||
|
readonly bgCyan: CSPair;
|
||||||
|
readonly bgMagenta: CSPair;
|
||||||
|
readonly bgWhite: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `bgBlackBright`.
|
||||||
|
*/
|
||||||
|
readonly bgGray: CSPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Alias for `bgBlackBright`.
|
||||||
|
*/
|
||||||
|
readonly bgGrey: CSPair;
|
||||||
|
|
||||||
|
readonly bgBlackBright: CSPair;
|
||||||
|
readonly bgRedBright: CSPair;
|
||||||
|
readonly bgGreenBright: CSPair;
|
||||||
|
readonly bgYellowBright: CSPair;
|
||||||
|
readonly bgBlueBright: CSPair;
|
||||||
|
readonly bgCyanBright: CSPair;
|
||||||
|
readonly bgMagentaBright: CSPair;
|
||||||
|
readonly bgWhiteBright: CSPair;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const ansiStyles: {
|
||||||
|
readonly modifier: ansiStyles.Modifier;
|
||||||
|
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||||
|
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||||
|
readonly codes: ReadonlyMap<number, number>;
|
||||||
|
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||||
|
|
||||||
|
export = ansiStyles;
|
163
node_modules/ansi-styles/index.js
generated
vendored
Normal file
163
node_modules/ansi-styles/index.js
generated
vendored
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||||
|
const code = fn(...args);
|
||||||
|
return `\u001B[${code + offset}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||||
|
const code = fn(...args);
|
||||||
|
return `\u001B[${38 + offset};5;${code}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||||
|
const rgb = fn(...args);
|
||||||
|
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ansi2ansi = n => n;
|
||||||
|
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||||
|
|
||||||
|
const setLazyProperty = (object, property, get) => {
|
||||||
|
Object.defineProperty(object, property, {
|
||||||
|
get: () => {
|
||||||
|
const value = get();
|
||||||
|
|
||||||
|
Object.defineProperty(object, property, {
|
||||||
|
value,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @type {typeof import('color-convert')} */
|
||||||
|
let colorConvert;
|
||||||
|
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||||
|
if (colorConvert === undefined) {
|
||||||
|
colorConvert = require('color-convert');
|
||||||
|
}
|
||||||
|
|
||||||
|
const offset = isBackground ? 10 : 0;
|
||||||
|
const styles = {};
|
||||||
|
|
||||||
|
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||||
|
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||||
|
if (sourceSpace === targetSpace) {
|
||||||
|
styles[name] = wrap(identity, offset);
|
||||||
|
} else if (typeof suite === 'object') {
|
||||||
|
styles[name] = wrap(suite[targetSpace], offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
};
|
||||||
|
|
||||||
|
function assembleStyles() {
|
||||||
|
const codes = new Map();
|
||||||
|
const styles = {
|
||||||
|
modifier: {
|
||||||
|
reset: [0, 0],
|
||||||
|
// 21 isn't widely supported and 22 does the same thing
|
||||||
|
bold: [1, 22],
|
||||||
|
dim: [2, 22],
|
||||||
|
italic: [3, 23],
|
||||||
|
underline: [4, 24],
|
||||||
|
inverse: [7, 27],
|
||||||
|
hidden: [8, 28],
|
||||||
|
strikethrough: [9, 29]
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
black: [30, 39],
|
||||||
|
red: [31, 39],
|
||||||
|
green: [32, 39],
|
||||||
|
yellow: [33, 39],
|
||||||
|
blue: [34, 39],
|
||||||
|
magenta: [35, 39],
|
||||||
|
cyan: [36, 39],
|
||||||
|
white: [37, 39],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
blackBright: [90, 39],
|
||||||
|
redBright: [91, 39],
|
||||||
|
greenBright: [92, 39],
|
||||||
|
yellowBright: [93, 39],
|
||||||
|
blueBright: [94, 39],
|
||||||
|
magentaBright: [95, 39],
|
||||||
|
cyanBright: [96, 39],
|
||||||
|
whiteBright: [97, 39]
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
bgBlack: [40, 49],
|
||||||
|
bgRed: [41, 49],
|
||||||
|
bgGreen: [42, 49],
|
||||||
|
bgYellow: [43, 49],
|
||||||
|
bgBlue: [44, 49],
|
||||||
|
bgMagenta: [45, 49],
|
||||||
|
bgCyan: [46, 49],
|
||||||
|
bgWhite: [47, 49],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
bgBlackBright: [100, 49],
|
||||||
|
bgRedBright: [101, 49],
|
||||||
|
bgGreenBright: [102, 49],
|
||||||
|
bgYellowBright: [103, 49],
|
||||||
|
bgBlueBright: [104, 49],
|
||||||
|
bgMagentaBright: [105, 49],
|
||||||
|
bgCyanBright: [106, 49],
|
||||||
|
bgWhiteBright: [107, 49]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Alias bright black as gray (and grey)
|
||||||
|
styles.color.gray = styles.color.blackBright;
|
||||||
|
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||||
|
styles.color.grey = styles.color.blackBright;
|
||||||
|
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||||
|
|
||||||
|
for (const [groupName, group] of Object.entries(styles)) {
|
||||||
|
for (const [styleName, style] of Object.entries(group)) {
|
||||||
|
styles[styleName] = {
|
||||||
|
open: `\u001B[${style[0]}m`,
|
||||||
|
close: `\u001B[${style[1]}m`
|
||||||
|
};
|
||||||
|
|
||||||
|
group[styleName] = styles[styleName];
|
||||||
|
|
||||||
|
codes.set(style[0], style[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(styles, groupName, {
|
||||||
|
value: group,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(styles, 'codes', {
|
||||||
|
value: codes,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
styles.color.close = '\u001B[39m';
|
||||||
|
styles.bgColor.close = '\u001B[49m';
|
||||||
|
|
||||||
|
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||||
|
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||||
|
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||||
|
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||||
|
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||||
|
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the export immutable
|
||||||
|
Object.defineProperty(module, 'exports', {
|
||||||
|
enumerable: true,
|
||||||
|
get: assembleStyles
|
||||||
|
});
|
9
node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/ansi-styles/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
89
node_modules/ansi-styles/package.json
generated
vendored
Normal file
89
node_modules/ansi-styles/package.json
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
{
|
||||||
|
"_from": "ansi-styles@^4.0.0",
|
||||||
|
"_id": "ansi-styles@4.2.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
|
||||||
|
"_location": "/ansi-styles",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-styles@^4.0.0",
|
||||||
|
"name": "ansi-styles",
|
||||||
|
"escapedName": "ansi-styles",
|
||||||
|
"rawSpec": "^4.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^4.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/wrap-ansi"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
|
||||||
|
"_shasum": "90ae75c424d008d2624c5bf29ead3177ebfcf359",
|
||||||
|
"_spec": "ansi-styles@^4.0.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\wrap-ansi",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/color-name": "^1.1.1",
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "ANSI escape codes for styling strings in the terminal",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/color-convert": "^1.9.0",
|
||||||
|
"ava": "^2.3.0",
|
||||||
|
"svg-term-cli": "^2.1.1",
|
||||||
|
"tsd": "^0.11.0",
|
||||||
|
"xo": "^0.25.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
||||||
|
"homepage": "https://github.com/chalk/ansi-styles#readme",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"styles",
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"tty",
|
||||||
|
"escape",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"command-line",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "ansi-styles",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/chalk/ansi-styles.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"version": "4.2.1"
|
||||||
|
}
|
158
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
158
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
|
||||||
|
|
||||||
|
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||||
|
|
||||||
|
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||||
|
|
||||||
|
<img src="screenshot.svg" width="900">
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install ansi-styles
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const style = require('ansi-styles');
|
||||||
|
|
||||||
|
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||||
|
|
||||||
|
|
||||||
|
// Color conversion between 16/256/truecolor
|
||||||
|
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||||
|
// may be degraded to fit that color palette. This means terminals
|
||||||
|
// that do not support 16 million colors will best-match the
|
||||||
|
// original color.
|
||||||
|
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||||
|
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||||
|
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Each style has an `open` and `close` property.
|
||||||
|
|
||||||
|
## Styles
|
||||||
|
|
||||||
|
### Modifiers
|
||||||
|
|
||||||
|
- `reset`
|
||||||
|
- `bold`
|
||||||
|
- `dim`
|
||||||
|
- `italic` *(Not widely supported)*
|
||||||
|
- `underline`
|
||||||
|
- `inverse`
|
||||||
|
- `hidden`
|
||||||
|
- `strikethrough` *(Not widely supported)*
|
||||||
|
|
||||||
|
### Colors
|
||||||
|
|
||||||
|
- `black`
|
||||||
|
- `red`
|
||||||
|
- `green`
|
||||||
|
- `yellow`
|
||||||
|
- `blue`
|
||||||
|
- `magenta`
|
||||||
|
- `cyan`
|
||||||
|
- `white`
|
||||||
|
- `blackBright` (alias: `gray`, `grey`)
|
||||||
|
- `redBright`
|
||||||
|
- `greenBright`
|
||||||
|
- `yellowBright`
|
||||||
|
- `blueBright`
|
||||||
|
- `magentaBright`
|
||||||
|
- `cyanBright`
|
||||||
|
- `whiteBright`
|
||||||
|
|
||||||
|
### Background colors
|
||||||
|
|
||||||
|
- `bgBlack`
|
||||||
|
- `bgRed`
|
||||||
|
- `bgGreen`
|
||||||
|
- `bgYellow`
|
||||||
|
- `bgBlue`
|
||||||
|
- `bgMagenta`
|
||||||
|
- `bgCyan`
|
||||||
|
- `bgWhite`
|
||||||
|
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||||
|
- `bgRedBright`
|
||||||
|
- `bgGreenBright`
|
||||||
|
- `bgYellowBright`
|
||||||
|
- `bgBlueBright`
|
||||||
|
- `bgMagentaBright`
|
||||||
|
- `bgCyanBright`
|
||||||
|
- `bgWhiteBright`
|
||||||
|
|
||||||
|
## Advanced usage
|
||||||
|
|
||||||
|
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||||
|
|
||||||
|
- `style.modifier`
|
||||||
|
- `style.color`
|
||||||
|
- `style.bgColor`
|
||||||
|
|
||||||
|
###### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(style.color.green.open);
|
||||||
|
```
|
||||||
|
|
||||||
|
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||||
|
|
||||||
|
###### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(style.codes.get(36));
|
||||||
|
//=> 39
|
||||||
|
```
|
||||||
|
|
||||||
|
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||||
|
|
||||||
|
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||||
|
|
||||||
|
The following color spaces from `color-convert` are supported:
|
||||||
|
|
||||||
|
- `rgb`
|
||||||
|
- `hex`
|
||||||
|
- `keyword`
|
||||||
|
- `hsl`
|
||||||
|
- `hsv`
|
||||||
|
- `hwb`
|
||||||
|
- `ansi`
|
||||||
|
- `ansi256`
|
||||||
|
|
||||||
|
To use these, call the associated conversion function with the intended output, for example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||||
|
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||||
|
|
||||||
|
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||||
|
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||||
|
|
||||||
|
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||||
|
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||||
|
```
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<b>
|
||||||
|
<a href="https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||||
|
</b>
|
||||||
|
<br>
|
||||||
|
<sub>
|
||||||
|
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||||
|
</sub>
|
||||||
|
</div>
|
185
node_modules/argparse/CHANGELOG.md
generated
vendored
Normal file
185
node_modules/argparse/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
||||||
|
1.0.10 / 2018-02-15
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Use .concat instead of + for arrays, #122.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.9 / 2016-09-29
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Rerelease after 1.0.8 - deps cleanup.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.8 / 2016-09-29
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
|
||||||
|
|
||||||
|
|
||||||
|
1.0.7 / 2016-03-17
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.6 / 2016-02-06
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance: moved to eslint & updated CS.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.5 / 2016-02-05
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Removed lodash dependency to significantly reduce install size.
|
||||||
|
Thanks to @mourner.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.4 / 2016-01-17
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance: lodash update to 4.0.0.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.3 / 2015-10-27
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.2 / 2015-03-22
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Relaxed lodash version dependency.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.1 / 2015-02-20
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Changed dependencies to be compatible with ancient nodejs.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.0 / 2015-02-19
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance release.
|
||||||
|
- Replaced `underscore` with `lodash`.
|
||||||
|
- Bumped version to 1.0.0 to better reflect semver meaning.
|
||||||
|
- HISTORY.md -> CHANGELOG.md
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
257
node_modules/argparse/README.md
generated
vendored
Normal file
257
node_modules/argparse/README.md
generated
vendored
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
argparse
|
||||||
|
========
|
||||||
|
|
||||||
|
[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse)
|
||||||
|
[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/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. Difference with original.**
|
||||||
|
|
||||||
|
- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).
|
||||||
|
- Use `defaultValue` instead of `default`.
|
||||||
|
- Use `argparse.Const.REMAINDER` instead of `argparse.REMAINDER`, and
|
||||||
|
similarly for constant values `OPTIONAL`, `ZERO_OR_MORE`, and `ONE_OR_MORE`
|
||||||
|
(aliases for `nargs` values `'?'`, `'*'`, `'+'`, respectively), and
|
||||||
|
`SUPPRESS`.
|
||||||
|
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
parser.addArgument(
|
||||||
|
'--baz',
|
||||||
|
{
|
||||||
|
help: 'baz bar'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
var args = parser.parseArgs();
|
||||||
|
console.dir(args);
|
||||||
|
```
|
||||||
|
|
||||||
|
Display help:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./test.js -h
|
||||||
|
usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
|
||||||
|
|
||||||
|
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
|
||||||
|
--baz BAZ baz bar
|
||||||
|
```
|
||||||
|
|
||||||
|
Parse arguments:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./test.js -f=3 --bar=4 --baz 5
|
||||||
|
{ foo: '3', bar: '4', baz: '5' }
|
||||||
|
```
|
||||||
|
|
||||||
|
More [examples](https://github.com/nodeca/argparse/tree/master/examples).
|
||||||
|
|
||||||
|
|
||||||
|
ArgumentParser objects
|
||||||
|
======================
|
||||||
|
|
||||||
|
```
|
||||||
|
new ArgumentParser({parameters 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 supported 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(name or flag or [name] or [flags...], {options})
|
||||||
|
```
|
||||||
|
|
||||||
|
Defines how a single command-line argument should be parsed.
|
||||||
|
|
||||||
|
- ```name or flag or [name] or [flags...]``` - Either a positional name
|
||||||
|
(e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array
|
||||||
|
of a single positional name (e.g., `['foo']`), or an array of options
|
||||||
|
(e.g., `['-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.
|
||||||
|
|
||||||
|
|
3
node_modules/argparse/index.js
generated
vendored
Normal file
3
node_modules/argparse/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* ##### Allowed 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 c = 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 = typeof options.nargs !== 'undefined' ? options.nargs : null;
|
||||||
|
this.constant = typeof options.constant !== 'undefined' ? options.constant : null;
|
||||||
|
this.defaultValue = options.defaultValue;
|
||||||
|
this.type = typeof options.type !== 'undefined' ? options.type : null;
|
||||||
|
this.choices = typeof options.choices !== 'undefined' ? options.choices : null;
|
||||||
|
this.required = typeof options.required !== 'undefined' ? options.required : false;
|
||||||
|
this.help = typeof options.help !== 'undefined' ? options.help : null;
|
||||||
|
this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null;
|
||||||
|
|
||||||
|
if (!(this.optionStrings instanceof Array)) {
|
||||||
|
throw new Error('optionStrings should be an array');
|
||||||
|
}
|
||||||
|
if (typeof 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 !== c.SUPPRESS) {
|
||||||
|
return this.metavar;
|
||||||
|
} else if (typeof this.dest !== 'undefined' && this.dest !== c.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
|
||||||
|
};
|
53
node_modules/argparse/lib/action/append.js
generated
vendored
Normal file
53
node_modules/argparse/lib/action/append.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*: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 c = 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 !== c.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 = (namespace[this.dest] || []).slice();
|
||||||
|
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 (typeof 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);
|
||||||
|
};
|
47
node_modules/argparse/lib/action/help.js
generated
vendored
Normal file
47
node_modules/argparse/lib/action/help.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*: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 c = 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 = c.SUPPRESS;
|
||||||
|
}
|
||||||
|
options.dest = (options.dest !== null ? options.dest : c.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 c = 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 (typeof this.constant !== 'undefined' && this.nargs !== c.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 (typeof 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);
|
149
node_modules/argparse/lib/action/subparsers.js
generated
vendored
Normal file
149
node_modules/argparse/lib/action/subparsers.js
generated
vendored
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
/** 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 Action = require('../action');
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
var c = require('../const');
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
var argumentErrorHelper = require('../argument/error');
|
||||||
|
|
||||||
|
|
||||||
|
/*:nodoc:*
|
||||||
|
* new ChoicesPseudoAction(name, help)
|
||||||
|
*
|
||||||
|
* Create pseudo action for correct help text
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
function ChoicesPseudoAction(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]]
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
function ActionSubparsers(options) {
|
||||||
|
options = options || {};
|
||||||
|
options.dest = options.dest || c.SUPPRESS;
|
||||||
|
options.nargs = c.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 || typeof options.help === 'string') {
|
||||||
|
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 !== c.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,
|
||||||
|
Object.keys(this._nameParserMap).join(', ')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse all the remaining options into the namespace
|
||||||
|
parser.parseArgs(argStrings, namespace);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = ActionSubparsers;
|
47
node_modules/argparse/lib/action/version.js
generated
vendored
Normal file
47
node_modules/argparse/lib/action/version.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*: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 c = 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 : c.SUPPRESS);
|
||||||
|
options.dest = (options.dest || c.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());
|
||||||
|
};
|
482
node_modules/argparse/lib/action_container.js
generated
vendored
Normal file
482
node_modules/argparse/lib/action_container.js
generated
vendored
Normal file
|
@ -0,0 +1,482 @@
|
||||||
|
/** internal
|
||||||
|
* class ActionContainer
|
||||||
|
*
|
||||||
|
* Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var format = require('util').format;
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
var c = require('./const');
|
||||||
|
|
||||||
|
var $$ = require('./utils');
|
||||||
|
|
||||||
|
//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 (arguments.length < 3) {
|
||||||
|
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) {
|
||||||
|
if ($$.has(options, property)) {
|
||||||
|
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 ($$.has(options, action.dest)) {
|
||||||
|
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 (String|Array): argument key, or 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, ... })
|
||||||
|
* - addArgument('--baz', { action: 'store', nargs: 1, ... })
|
||||||
|
**/
|
||||||
|
ActionContainer.prototype.addArgument = function (args, options) {
|
||||||
|
args = args;
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
if (typeof args === 'string') {
|
||||||
|
args = [ args ];
|
||||||
|
}
|
||||||
|
if (!Array.isArray(args)) {
|
||||||
|
throw new TypeError('addArgument first argument should be a string or an array');
|
||||||
|
}
|
||||||
|
if (typeof options !== 'object' || Array.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 (typeof options.defaultValue === 'undefined') {
|
||||||
|
var dest = options.dest;
|
||||||
|
if ($$.has(this._defaults, dest)) {
|
||||||
|
options.defaultValue = this._defaults[dest];
|
||||||
|
} else if (typeof this.argumentDefault !== 'undefined') {
|
||||||
|
options.defaultValue = this.argumentDefault;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the action object, and add it to the parser
|
||||||
|
var ActionClass = this._popActionClass(options);
|
||||||
|
if (typeof ActionClass !== 'function') {
|
||||||
|
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 (typeof typeFunction !== 'function') {
|
||||||
|
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 (!self._hasNegativeNumberOptionals.some(Boolean)) {
|
||||||
|
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 (Array.isArray(dest)) {
|
||||||
|
dest = dest[0];
|
||||||
|
}
|
||||||
|
// 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 !== c.OPTIONAL && options.nargs !== c.ZERO_OR_MORE) {
|
||||||
|
options.required = true;
|
||||||
|
}
|
||||||
|
if (options.nargs === c.ZERO_OR_MORE && typeof 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 = $$.trimChars(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' + $$.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 = conflOptionals.map(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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
1161
node_modules/argparse/lib/argument_parser.js
generated
vendored
Normal file
1161
node_modules/argparse/lib/argument_parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
node_modules/argparse/lib/const.js
generated
vendored
Normal file
21
node_modules/argparse/lib/const.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Constants
|
||||||
|
//
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
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';
|
87
node_modules/argparse/lib/help/added_formatters.js
generated
vendored
Normal file
87
node_modules/argparse/lib/help/added_formatters.js
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
var c = require('../const');
|
||||||
|
|
||||||
|
var $$ = require('../utils');
|
||||||
|
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.
|
||||||
|
**/
|
||||||
|
|
||||||
|
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 !== c.SUPPRESS) {
|
||||||
|
var defaulting_nargs = [ c.OPTIONAL, c.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.
|
||||||
|
**/
|
||||||
|
|
||||||
|
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 $$.trimEnd(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.
|
||||||
|
**/
|
||||||
|
|
||||||
|
function RawTextHelpFormatter(options) {
|
||||||
|
RawDescriptionHelpFormatter.call(this, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter);
|
||||||
|
|
||||||
|
RawTextHelpFormatter.prototype._splitLines = function (text) {
|
||||||
|
return text.split('\n');
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.RawTextHelpFormatter = RawTextHelpFormatter;
|
795
node_modules/argparse/lib/help/formatter.js
generated
vendored
Normal file
795
node_modules/argparse/lib/help/formatter.js
generated
vendored
Normal file
|
@ -0,0 +1,795 @@
|
||||||
|
/**
|
||||||
|
* 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 sprintf = require('sprintf-js').sprintf;
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
var c = require('../const');
|
||||||
|
|
||||||
|
var $$ = require('../utils');
|
||||||
|
|
||||||
|
|
||||||
|
/*: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 !== c.SUPPRESS) {
|
||||||
|
var currentIndent = formatter.currentIndent;
|
||||||
|
heading = $$.repeat(' ', currentIndent) + this._heading + ':' + c.EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// join the section-initialize newline, the heading and the help
|
||||||
|
return formatter._joinParts([ c.EOL, heading, itemHelp, c.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(c.EOL + c.EOL + c.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 !== c.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 !== c.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 !== c.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, c.EOL + c.EOL);
|
||||||
|
help = $$.trimChars(help, c.EOL) + c.EOL;
|
||||||
|
}
|
||||||
|
return help;
|
||||||
|
};
|
||||||
|
|
||||||
|
HelpFormatter.prototype._joinParts = function (partStrings) {
|
||||||
|
return partStrings.filter(function (part) {
|
||||||
|
return (part && part !== c.SUPPRESS);
|
||||||
|
}).join('');
|
||||||
|
};
|
||||||
|
|
||||||
|
HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) {
|
||||||
|
if (!prefix && typeof prefix !== 'string') {
|
||||||
|
prefix = 'usage: ';
|
||||||
|
}
|
||||||
|
|
||||||
|
actions = actions || [];
|
||||||
|
groups = groups || [];
|
||||||
|
|
||||||
|
|
||||||
|
// if usage is specified, use that
|
||||||
|
if (usage) {
|
||||||
|
usage = 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
|
||||||
|
/*eslint-disable func-style*/ // node 0.10 compat
|
||||||
|
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 = $$.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 = $$.repeat(' ', prefix.length);
|
||||||
|
parts = optionalParts.concat(positionalParts);
|
||||||
|
lines = _getLines(parts, indent);
|
||||||
|
if (lines.length > 1) {
|
||||||
|
lines = [].concat(
|
||||||
|
_getLines(optionalParts, indent),
|
||||||
|
_getLines(positionalParts, indent)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
lines = [ prog ].concat(lines);
|
||||||
|
}
|
||||||
|
// join lines into usage
|
||||||
|
usage = lines.join(c.EOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// prefix with 'usage:'
|
||||||
|
return prefix + usage + c.EOL + c.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 ($$.arrayEqual(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 === c.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 = text.trim();
|
||||||
|
|
||||||
|
// return the text
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
|
HelpFormatter.prototype._formatText = function (text) {
|
||||||
|
text = sprintf(text, { prog: this._prog });
|
||||||
|
var textWidth = this._width - this._currentIndent;
|
||||||
|
var indentIncriment = $$.repeat(' ', this._currentIndent);
|
||||||
|
return this._fillText(text, textWidth, indentIncriment) + c.EOL + c.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 = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL;
|
||||||
|
|
||||||
|
// short action name; start on the same line and pad two spaces
|
||||||
|
} else if (actionHeader.length <= actionWidth) {
|
||||||
|
actionHeader = $$.repeat(' ', this._currentIndent) +
|
||||||
|
actionHeader +
|
||||||
|
' ' +
|
||||||
|
$$.repeat(' ', actionWidth - actionHeader.length);
|
||||||
|
indentFirst = 0;
|
||||||
|
|
||||||
|
// long action name; start on the next line
|
||||||
|
} else {
|
||||||
|
actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.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($$.repeat(' ', indentFirst) + helpLines[0] + c.EOL);
|
||||||
|
helpLines.slice(1).forEach(function (line) {
|
||||||
|
parts.push($$.repeat(' ', helpPosition) + line + c.EOL);
|
||||||
|
});
|
||||||
|
|
||||||
|
// or add a newline if the description doesn't end with one
|
||||||
|
} else if (actionHeader.charAt(actionHeader.length - 1) !== c.EOL) {
|
||||||
|
parts.push(c.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];
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (typeof choices === 'string') {
|
||||||
|
choices = choices.split('').join(', ');
|
||||||
|
} else if (Array.isArray(choices)) {
|
||||||
|
choices = choices.join(',');
|
||||||
|
} else {
|
||||||
|
choices = Object.keys(choices).join(',');
|
||||||
|
}
|
||||||
|
result = '{' + choices + '}';
|
||||||
|
} else {
|
||||||
|
result = metavarDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
return function (size) {
|
||||||
|
if (Array.isArray(result)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
/*eslint-disable no-undefined*/
|
||||||
|
case undefined:
|
||||||
|
case null:
|
||||||
|
metavars = buildMetavar(1);
|
||||||
|
result = '' + metavars[0];
|
||||||
|
break;
|
||||||
|
case c.OPTIONAL:
|
||||||
|
metavars = buildMetavar(1);
|
||||||
|
result = '[' + metavars[0] + ']';
|
||||||
|
break;
|
||||||
|
case c.ZERO_OR_MORE:
|
||||||
|
metavars = buildMetavar(2);
|
||||||
|
result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]';
|
||||||
|
break;
|
||||||
|
case c.ONE_OR_MORE:
|
||||||
|
metavars = buildMetavar(2);
|
||||||
|
result = '' + metavars[0] + ' [' + metavars[1] + ' ...]';
|
||||||
|
break;
|
||||||
|
case c.REMAINDER:
|
||||||
|
result = '...';
|
||||||
|
break;
|
||||||
|
case c.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 !== c.SUPPRESS) {
|
||||||
|
params[actionProperty] = actionValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (params.choices) {
|
||||||
|
if (typeof params.choices === 'string') {
|
||||||
|
params.choices = params.choices.split('').join(', ');
|
||||||
|
} else if (Array.isArray(params.choices)) {
|
||||||
|
params.choices = params.choices.join(', ');
|
||||||
|
} else {
|
||||||
|
params.choices = Object.keys(params.choices).join(', ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 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 = text.trim();
|
||||||
|
text = text.replace(this._whitespaceMatcher, ' ');
|
||||||
|
|
||||||
|
// Wraps the single paragraph in text (a string) so every line
|
||||||
|
// is at most width characters long.
|
||||||
|
text.split(c.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(c.EOL);
|
||||||
|
};
|
||||||
|
|
||||||
|
HelpFormatter.prototype._getHelpString = function (action) {
|
||||||
|
return action.help;
|
||||||
|
};
|
76
node_modules/argparse/lib/namespace.js
generated
vendored
Normal file
76
node_modules/argparse/lib/namespace.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/**
|
||||||
|
* 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('./utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
};
|
57
node_modules/argparse/lib/utils.js
generated
vendored
Normal file
57
node_modules/argparse/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
exports.repeat = function (str, num) {
|
||||||
|
var result = '';
|
||||||
|
for (var i = 0; i < num; i++) { result += str; }
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.arrayEqual = function (a, b) {
|
||||||
|
if (a.length !== b.length) { return false; }
|
||||||
|
for (var i = 0; i < a.length; i++) {
|
||||||
|
if (a[i] !== b[i]) { return false; }
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.trimChars = function (str, chars) {
|
||||||
|
var start = 0;
|
||||||
|
var end = str.length - 1;
|
||||||
|
while (chars.indexOf(str.charAt(start)) >= 0) { start++; }
|
||||||
|
while (chars.indexOf(str.charAt(end)) >= 0) { end--; }
|
||||||
|
return str.slice(start, end + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.capitalize = function (str) {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.arrayUnion = function () {
|
||||||
|
var result = [];
|
||||||
|
for (var i = 0, values = {}; i < arguments.length; i++) {
|
||||||
|
var arr = arguments[i];
|
||||||
|
for (var j = 0; j < arr.length; j++) {
|
||||||
|
if (!values[arr[j]]) {
|
||||||
|
values[arr[j]] = true;
|
||||||
|
result.push(arr[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
function has(obj, key) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.has = has;
|
||||||
|
|
||||||
|
exports.extend = function (dest, src) {
|
||||||
|
for (var i in src) {
|
||||||
|
if (has(src, i)) { dest[i] = src[i]; }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.trimEnd = function (str) {
|
||||||
|
return str.replace(/\s+$/g, '');
|
||||||
|
};
|
70
node_modules/argparse/package.json
generated
vendored
Normal file
70
node_modules/argparse/package.json
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
"_from": "argparse@^1.0.7",
|
||||||
|
"_id": "argparse@1.0.10",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||||
|
"_location": "/argparse",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "argparse@^1.0.7",
|
||||||
|
"name": "argparse",
|
||||||
|
"escapedName": "argparse",
|
||||||
|
"rawSpec": "^1.0.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/markdown-it"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
|
"_shasum": "bcd6791ea5ae09725e17e5ad988134cd40b3d911",
|
||||||
|
"_spec": "argparse@^1.0.7",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\markdown-it",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/nodeca/argparse/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Eugene Shkuropat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Paul Jacobson"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"sprintf-js": "~1.0.2"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^2.13.1",
|
||||||
|
"istanbul": "^0.4.5",
|
||||||
|
"mocha": "^3.1.0",
|
||||||
|
"ndoc": "^5.0.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"lib/"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/nodeca/argparse#readme",
|
||||||
|
"keywords": [
|
||||||
|
"cli",
|
||||||
|
"parser",
|
||||||
|
"argparse",
|
||||||
|
"option",
|
||||||
|
"args"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "argparse",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/nodeca/argparse.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "make test"
|
||||||
|
},
|
||||||
|
"version": "1.0.10"
|
||||||
|
}
|
63
node_modules/camelcase/index.d.ts
generated
vendored
Normal file
63
node_modules/camelcase/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
declare namespace camelcase {
|
||||||
|
interface Options {
|
||||||
|
/**
|
||||||
|
Uppercase the first character: `foo-bar` → `FooBar`.
|
||||||
|
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
readonly pascalCase?: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const camelcase: {
|
||||||
|
/**
|
||||||
|
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
|
||||||
|
|
||||||
|
@param input - String to convert to camel case.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import camelCase = require('camelcase');
|
||||||
|
|
||||||
|
camelCase('foo-bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo_bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar', {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
|
||||||
|
camelCase('--foo.bar', {pascalCase: false});
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
console.log(process.argv[3]);
|
||||||
|
//=> '--foo-bar'
|
||||||
|
camelCase(process.argv[3]);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['foo', 'bar']);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
|
||||||
|
|
||||||
|
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||||
|
// declare function camelcase(
|
||||||
|
// input: string | ReadonlyArray<string>,
|
||||||
|
// options?: camelcase.Options
|
||||||
|
// ): string;
|
||||||
|
// export = camelcase;
|
||||||
|
default: typeof camelcase;
|
||||||
|
};
|
||||||
|
|
||||||
|
export = camelcase;
|
76
node_modules/camelcase/index.js
generated
vendored
Normal file
76
node_modules/camelcase/index.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const preserveCamelCase = string => {
|
||||||
|
let isLastCharLower = false;
|
||||||
|
let isLastCharUpper = false;
|
||||||
|
let isLastLastCharUpper = false;
|
||||||
|
|
||||||
|
for (let i = 0; i < string.length; i++) {
|
||||||
|
const character = string[i];
|
||||||
|
|
||||||
|
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
|
||||||
|
string = string.slice(0, i) + '-' + string.slice(i);
|
||||||
|
isLastCharLower = false;
|
||||||
|
isLastLastCharUpper = isLastCharUpper;
|
||||||
|
isLastCharUpper = true;
|
||||||
|
i++;
|
||||||
|
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
|
||||||
|
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
|
||||||
|
isLastLastCharUpper = isLastCharUpper;
|
||||||
|
isLastCharUpper = false;
|
||||||
|
isLastCharLower = true;
|
||||||
|
} else {
|
||||||
|
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
|
||||||
|
isLastLastCharUpper = isLastCharUpper;
|
||||||
|
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const camelCase = (input, options) => {
|
||||||
|
if (!(typeof input === 'string' || Array.isArray(input))) {
|
||||||
|
throw new TypeError('Expected the input to be `string | string[]`');
|
||||||
|
}
|
||||||
|
|
||||||
|
options = Object.assign({
|
||||||
|
pascalCase: false
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
|
||||||
|
|
||||||
|
if (Array.isArray(input)) {
|
||||||
|
input = input.map(x => x.trim())
|
||||||
|
.filter(x => x.length)
|
||||||
|
.join('-');
|
||||||
|
} else {
|
||||||
|
input = input.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.length === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.length === 1) {
|
||||||
|
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasUpperCase = input !== input.toLowerCase();
|
||||||
|
|
||||||
|
if (hasUpperCase) {
|
||||||
|
input = preserveCamelCase(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
input = input
|
||||||
|
.replace(/^[_.\- ]+/, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
|
||||||
|
.replace(/\d+(\w|$)/g, m => m.toUpperCase());
|
||||||
|
|
||||||
|
return postProcess(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = camelCase;
|
||||||
|
// TODO: Remove this for the next major release
|
||||||
|
module.exports.default = camelCase;
|
9
node_modules/camelcase/license
generated
vendored
Normal file
9
node_modules/camelcase/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
75
node_modules/camelcase/package.json
generated
vendored
Normal file
75
node_modules/camelcase/package.json
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
{
|
||||||
|
"_from": "camelcase@^5.0.0",
|
||||||
|
"_id": "camelcase@5.3.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
|
"_location": "/camelcase",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "camelcase@^5.0.0",
|
||||||
|
"name": "camelcase",
|
||||||
|
"escapedName": "camelcase",
|
||||||
|
"rawSpec": "^5.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^5.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/yargs-parser"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
|
"_shasum": "e3c9b31569e106811df242f715725a1f4c494320",
|
||||||
|
"_spec": "camelcase@^5.0.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\yargs-parser",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sindresorhus/camelcase/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^1.4.1",
|
||||||
|
"tsd": "^0.7.1",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/sindresorhus/camelcase#readme",
|
||||||
|
"keywords": [
|
||||||
|
"camelcase",
|
||||||
|
"camel-case",
|
||||||
|
"camel",
|
||||||
|
"case",
|
||||||
|
"dash",
|
||||||
|
"hyphen",
|
||||||
|
"dot",
|
||||||
|
"underscore",
|
||||||
|
"separator",
|
||||||
|
"string",
|
||||||
|
"text",
|
||||||
|
"convert",
|
||||||
|
"pascalcase",
|
||||||
|
"pascal-case"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "camelcase",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/sindresorhus/camelcase.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"version": "5.3.1"
|
||||||
|
}
|
99
node_modules/camelcase/readme.md
generated
vendored
Normal file
99
node_modules/camelcase/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
|
||||||
|
|
||||||
|
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<b>
|
||||||
|
<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
|
||||||
|
</b>
|
||||||
|
<br>
|
||||||
|
<sub>
|
||||||
|
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||||
|
</sub>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install camelcase
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const camelCase = require('camelcase');
|
||||||
|
|
||||||
|
camelCase('foo-bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo_bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar', {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
|
||||||
|
camelCase('--foo.bar', {pascalCase: false});
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
console.log(process.argv[3]);
|
||||||
|
//=> '--foo-bar'
|
||||||
|
camelCase(process.argv[3]);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['foo', 'bar']);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### camelCase(input, [options])
|
||||||
|
|
||||||
|
#### input
|
||||||
|
|
||||||
|
Type: `string` `string[]`
|
||||||
|
|
||||||
|
String to convert to camel case.
|
||||||
|
|
||||||
|
#### options
|
||||||
|
|
||||||
|
Type: `Object`
|
||||||
|
|
||||||
|
##### pascalCase
|
||||||
|
|
||||||
|
Type: `boolean`<br>
|
||||||
|
Default: `false`
|
||||||
|
|
||||||
|
Uppercase the first character: `foo-bar` → `FooBar`
|
||||||
|
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
||||||
|
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
|
||||||
|
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
|
||||||
|
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
76
node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
76
node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* update deps, drop Node 6
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
|
||||||
|
* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df))
|
||||||
|
|
||||||
|
## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Drop support for node < 6.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.0"></a>
|
||||||
|
## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.0"></a>
|
||||||
|
## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
|
||||||
|
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
|
||||||
|
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* officially drop support for Node < 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.2.0"></a>
|
||||||
|
## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
|
14
node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
14
node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Copyright (c) 2015, 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.
|
115
node_modules/cliui/README.md
generated
vendored
Normal file
115
node_modules/cliui/README.md
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
# cliui
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/yargs/cliui.svg)](https://travis-ci.org/yargs/cliui)
|
||||||
|
[![Coverage Status](https://coveralls.io/repos/yargs/cliui/badge.svg?branch=)](https://coveralls.io/r/yargs/cliui?branch=)
|
||||||
|
[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui)
|
||||||
|
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
|
||||||
|
|
||||||
|
easily create complex multi-column command-line-interfaces.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
var ui = require('cliui')()
|
||||||
|
|
||||||
|
ui.div('Usage: $0 [command] [options]')
|
||||||
|
|
||||||
|
ui.div({
|
||||||
|
text: 'Options:',
|
||||||
|
padding: [2, 0, 2, 0]
|
||||||
|
})
|
||||||
|
|
||||||
|
ui.div(
|
||||||
|
{
|
||||||
|
text: "-f, --file",
|
||||||
|
width: 20,
|
||||||
|
padding: [0, 4, 0, 4]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "the file to load." +
|
||||||
|
chalk.green("(if this description is long it wraps).")
|
||||||
|
,
|
||||||
|
width: 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: chalk.red("[required]"),
|
||||||
|
align: 'right'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
console.log(ui.toString())
|
||||||
|
```
|
||||||
|
|
||||||
|
<img width="500" src="screenshot.png">
|
||||||
|
|
||||||
|
## Layout DSL
|
||||||
|
|
||||||
|
cliui exposes a simple layout DSL:
|
||||||
|
|
||||||
|
If you create a single `ui.div`, passing a string rather than an
|
||||||
|
object:
|
||||||
|
|
||||||
|
* `\n`: characters will be interpreted as new rows.
|
||||||
|
* `\t`: characters will be interpreted as new columns.
|
||||||
|
* `\s`: characters will be interpreted as padding.
|
||||||
|
|
||||||
|
**as an example...**
|
||||||
|
|
||||||
|
```js
|
||||||
|
var ui = require('./')({
|
||||||
|
width: 60
|
||||||
|
})
|
||||||
|
|
||||||
|
ui.div(
|
||||||
|
'Usage: node ./bin/foo.js\n' +
|
||||||
|
' <regex>\t provide a regex\n' +
|
||||||
|
' <glob>\t provide a glob\t [required]'
|
||||||
|
)
|
||||||
|
|
||||||
|
console.log(ui.toString())
|
||||||
|
```
|
||||||
|
|
||||||
|
**will output:**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
Usage: node ./bin/foo.js
|
||||||
|
<regex> provide a regex
|
||||||
|
<glob> provide a glob [required]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
```js
|
||||||
|
cliui = require('cliui')
|
||||||
|
```
|
||||||
|
|
||||||
|
### cliui({width: integer})
|
||||||
|
|
||||||
|
Specify the maximum width of the UI being generated.
|
||||||
|
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
||||||
|
|
||||||
|
### cliui({wrap: boolean})
|
||||||
|
|
||||||
|
Enable or disable the wrapping of text in a column.
|
||||||
|
|
||||||
|
### cliui.div(column, column, column)
|
||||||
|
|
||||||
|
Create a row with any number of columns, a column
|
||||||
|
can either be a string, or an object with the following
|
||||||
|
options:
|
||||||
|
|
||||||
|
* **text:** some text to place in the column.
|
||||||
|
* **width:** the width of a column.
|
||||||
|
* **align:** alignment, `right` or `center`.
|
||||||
|
* **padding:** `[top, right, bottom, left]`.
|
||||||
|
* **border:** should a border be placed around the div?
|
||||||
|
|
||||||
|
### cliui.span(column, column, column)
|
||||||
|
|
||||||
|
Similar to `div`, except the next row will be appended without
|
||||||
|
a new line being created.
|
||||||
|
|
||||||
|
### cliui.resetOutput()
|
||||||
|
|
||||||
|
Resets the UI elements of the current cliui instance, maintaining the values
|
||||||
|
set for `width` and `wrap`.
|
354
node_modules/cliui/index.js
generated
vendored
Normal file
354
node_modules/cliui/index.js
generated
vendored
Normal file
|
@ -0,0 +1,354 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const stringWidth = require('string-width')
|
||||||
|
const stripAnsi = require('strip-ansi')
|
||||||
|
const wrap = require('wrap-ansi')
|
||||||
|
|
||||||
|
const align = {
|
||||||
|
right: alignRight,
|
||||||
|
center: alignCenter
|
||||||
|
}
|
||||||
|
const top = 0
|
||||||
|
const right = 1
|
||||||
|
const bottom = 2
|
||||||
|
const left = 3
|
||||||
|
|
||||||
|
class UI {
|
||||||
|
constructor (opts) {
|
||||||
|
this.width = opts.width
|
||||||
|
this.wrap = opts.wrap
|
||||||
|
this.rows = []
|
||||||
|
}
|
||||||
|
|
||||||
|
span (...args) {
|
||||||
|
const cols = this.div(...args)
|
||||||
|
cols.span = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resetOutput () {
|
||||||
|
this.rows = []
|
||||||
|
}
|
||||||
|
|
||||||
|
div (...args) {
|
||||||
|
if (args.length === 0) {
|
||||||
|
this.div('')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.wrap && this._shouldApplyLayoutDSL(...args)) {
|
||||||
|
return this._applyLayoutDSL(args[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
const cols = args.map(arg => {
|
||||||
|
if (typeof arg === 'string') {
|
||||||
|
return this._colFromString(arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
return arg
|
||||||
|
})
|
||||||
|
|
||||||
|
this.rows.push(cols)
|
||||||
|
return cols
|
||||||
|
}
|
||||||
|
|
||||||
|
_shouldApplyLayoutDSL (...args) {
|
||||||
|
return args.length === 1 && typeof args[0] === 'string' &&
|
||||||
|
/[\t\n]/.test(args[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
_applyLayoutDSL (str) {
|
||||||
|
const rows = str.split('\n').map(row => row.split('\t'))
|
||||||
|
let leftColumnWidth = 0
|
||||||
|
|
||||||
|
// simple heuristic for layout, make sure the
|
||||||
|
// second column lines up along the left-hand.
|
||||||
|
// don't allow the first column to take up more
|
||||||
|
// than 50% of the screen.
|
||||||
|
rows.forEach(columns => {
|
||||||
|
if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
|
||||||
|
leftColumnWidth = Math.min(
|
||||||
|
Math.floor(this.width * 0.5),
|
||||||
|
stringWidth(columns[0])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// generate a table:
|
||||||
|
// replacing ' ' with padding calculations.
|
||||||
|
// using the algorithmically generated width.
|
||||||
|
rows.forEach(columns => {
|
||||||
|
this.div(...columns.map((r, i) => {
|
||||||
|
return {
|
||||||
|
text: r.trim(),
|
||||||
|
padding: this._measurePadding(r),
|
||||||
|
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
return this.rows[this.rows.length - 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
_colFromString (text) {
|
||||||
|
return {
|
||||||
|
text,
|
||||||
|
padding: this._measurePadding(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_measurePadding (str) {
|
||||||
|
// measure padding without ansi escape codes
|
||||||
|
const noAnsi = stripAnsi(str)
|
||||||
|
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
|
||||||
|
}
|
||||||
|
|
||||||
|
toString () {
|
||||||
|
const lines = []
|
||||||
|
|
||||||
|
this.rows.forEach(row => {
|
||||||
|
this.rowToString(row, lines)
|
||||||
|
})
|
||||||
|
|
||||||
|
// don't display any lines with the
|
||||||
|
// hidden flag set.
|
||||||
|
return lines
|
||||||
|
.filter(line => !line.hidden)
|
||||||
|
.map(line => line.text)
|
||||||
|
.join('\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
rowToString (row, lines) {
|
||||||
|
this._rasterize(row).forEach((rrow, r) => {
|
||||||
|
let str = ''
|
||||||
|
rrow.forEach((col, c) => {
|
||||||
|
const { width } = row[c] // the width with padding.
|
||||||
|
const wrapWidth = this._negatePadding(row[c]) // the width without padding.
|
||||||
|
|
||||||
|
let ts = col // temporary string used during alignment/padding.
|
||||||
|
|
||||||
|
if (wrapWidth > stringWidth(col)) {
|
||||||
|
ts += ' '.repeat(wrapWidth - stringWidth(col))
|
||||||
|
}
|
||||||
|
|
||||||
|
// align the string within its column.
|
||||||
|
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
||||||
|
ts = align[row[c].align](ts, wrapWidth)
|
||||||
|
if (stringWidth(ts) < wrapWidth) {
|
||||||
|
ts += ' '.repeat(width - stringWidth(ts) - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply border and padding to string.
|
||||||
|
const padding = row[c].padding || [0, 0, 0, 0]
|
||||||
|
if (padding[left]) {
|
||||||
|
str += ' '.repeat(padding[left])
|
||||||
|
}
|
||||||
|
|
||||||
|
str += addBorder(row[c], ts, '| ')
|
||||||
|
str += ts
|
||||||
|
str += addBorder(row[c], ts, ' |')
|
||||||
|
if (padding[right]) {
|
||||||
|
str += ' '.repeat(padding[right])
|
||||||
|
}
|
||||||
|
|
||||||
|
// if prior row is span, try to render the
|
||||||
|
// current row on the prior line.
|
||||||
|
if (r === 0 && lines.length > 0) {
|
||||||
|
str = this._renderInline(str, lines[lines.length - 1])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// remove trailing whitespace.
|
||||||
|
lines.push({
|
||||||
|
text: str.replace(/ +$/, ''),
|
||||||
|
span: row.span
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return lines
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the full 'source' can render in
|
||||||
|
// the target line, do so.
|
||||||
|
_renderInline (source, previousLine) {
|
||||||
|
const leadingWhitespace = source.match(/^ */)[0].length
|
||||||
|
const target = previousLine.text
|
||||||
|
const targetTextWidth = stringWidth(target.trimRight())
|
||||||
|
|
||||||
|
if (!previousLine.span) {
|
||||||
|
return source
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're not applying wrapping logic,
|
||||||
|
// just always append to the span.
|
||||||
|
if (!this.wrap) {
|
||||||
|
previousLine.hidden = true
|
||||||
|
return target + source
|
||||||
|
}
|
||||||
|
|
||||||
|
if (leadingWhitespace < targetTextWidth) {
|
||||||
|
return source
|
||||||
|
}
|
||||||
|
|
||||||
|
previousLine.hidden = true
|
||||||
|
|
||||||
|
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft()
|
||||||
|
}
|
||||||
|
|
||||||
|
_rasterize (row) {
|
||||||
|
const rrows = []
|
||||||
|
const widths = this._columnWidths(row)
|
||||||
|
let wrapped
|
||||||
|
|
||||||
|
// word wrap all columns, and create
|
||||||
|
// a data-structure that is easy to rasterize.
|
||||||
|
row.forEach((col, c) => {
|
||||||
|
// leave room for left and right padding.
|
||||||
|
col.width = widths[c]
|
||||||
|
if (this.wrap) {
|
||||||
|
wrapped = wrap(col.text, this._negatePadding(col), { hard: true }).split('\n')
|
||||||
|
} else {
|
||||||
|
wrapped = col.text.split('\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col.border) {
|
||||||
|
wrapped.unshift('.' + '-'.repeat(this._negatePadding(col) + 2) + '.')
|
||||||
|
wrapped.push("'" + '-'.repeat(this._negatePadding(col) + 2) + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
// add top and bottom padding.
|
||||||
|
if (col.padding) {
|
||||||
|
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''))
|
||||||
|
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''))
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapped.forEach((str, r) => {
|
||||||
|
if (!rrows[r]) {
|
||||||
|
rrows.push([])
|
||||||
|
}
|
||||||
|
|
||||||
|
const rrow = rrows[r]
|
||||||
|
|
||||||
|
for (let i = 0; i < c; i++) {
|
||||||
|
if (rrow[i] === undefined) {
|
||||||
|
rrow.push('')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rrow.push(str)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return rrows
|
||||||
|
}
|
||||||
|
|
||||||
|
_negatePadding (col) {
|
||||||
|
let wrapWidth = col.width
|
||||||
|
if (col.padding) {
|
||||||
|
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col.border) {
|
||||||
|
wrapWidth -= 4
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrapWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
_columnWidths (row) {
|
||||||
|
if (!this.wrap) {
|
||||||
|
return row.map(col => {
|
||||||
|
return col.width || stringWidth(col.text)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let unset = row.length
|
||||||
|
let remainingWidth = this.width
|
||||||
|
|
||||||
|
// column widths can be set in config.
|
||||||
|
const widths = row.map(col => {
|
||||||
|
if (col.width) {
|
||||||
|
unset--
|
||||||
|
remainingWidth -= col.width
|
||||||
|
return col.width
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
// any unset widths should be calculated.
|
||||||
|
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0
|
||||||
|
|
||||||
|
return widths.map((w, i) => {
|
||||||
|
if (w === undefined) {
|
||||||
|
return Math.max(unsetWidth, _minWidth(row[i]))
|
||||||
|
}
|
||||||
|
|
||||||
|
return w
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addBorder (col, ts, style) {
|
||||||
|
if (col.border) {
|
||||||
|
if (/[.']-+[.']/.test(ts)) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.trim().length !== 0) {
|
||||||
|
return style
|
||||||
|
}
|
||||||
|
|
||||||
|
return ' '
|
||||||
|
}
|
||||||
|
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculates the minimum width of
|
||||||
|
// a column, based on padding preferences.
|
||||||
|
function _minWidth (col) {
|
||||||
|
const padding = col.padding || []
|
||||||
|
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
|
||||||
|
if (col.border) {
|
||||||
|
return minWidth + 4
|
||||||
|
}
|
||||||
|
|
||||||
|
return minWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWindowWidth () {
|
||||||
|
/* istanbul ignore next: depends on terminal */
|
||||||
|
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||||
|
return process.stdout.columns
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function alignRight (str, width) {
|
||||||
|
str = str.trim()
|
||||||
|
const strWidth = stringWidth(str)
|
||||||
|
|
||||||
|
if (strWidth < width) {
|
||||||
|
return ' '.repeat(width - strWidth) + str
|
||||||
|
}
|
||||||
|
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
function alignCenter (str, width) {
|
||||||
|
str = str.trim()
|
||||||
|
const strWidth = stringWidth(str)
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
|
if (strWidth >= width) {
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
return ' '.repeat((width - strWidth) >> 1) + str
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function (opts = {}) {
|
||||||
|
return new UI({
|
||||||
|
width: opts.width || getWindowWidth() || /* istanbul ignore next */ 80,
|
||||||
|
wrap: opts.wrap !== false
|
||||||
|
})
|
||||||
|
}
|
97
node_modules/cliui/package.json
generated
vendored
Normal file
97
node_modules/cliui/package.json
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
{
|
||||||
|
"_from": "cliui@^6.0.0",
|
||||||
|
"_id": "cliui@6.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
||||||
|
"_location": "/cliui",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "cliui@^6.0.0",
|
||||||
|
"name": "cliui",
|
||||||
|
"escapedName": "cliui",
|
||||||
|
"rawSpec": "^6.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^6.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/yargs"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||||
|
"_shasum": "511d702c0c4e41ca156d7d0e96021f23e13225b1",
|
||||||
|
"_spec": "cliui@^6.0.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\yargs",
|
||||||
|
"author": {
|
||||||
|
"name": "Ben Coe",
|
||||||
|
"email": "ben@npmjs.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/yargs/cliui/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"config": {
|
||||||
|
"blanket": {
|
||||||
|
"pattern": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"data-cover-never": [
|
||||||
|
"node_modules",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
"output-reporter": "spec"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^4.2.0",
|
||||||
|
"strip-ansi": "^6.0.0",
|
||||||
|
"wrap-ansi": "^6.2.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "easily create complex multi-column command-line-interfaces",
|
||||||
|
"devDependencies": {
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"chalk": "^3.0.0",
|
||||||
|
"coveralls": "^3.0.3",
|
||||||
|
"mocha": "^6.2.2",
|
||||||
|
"nyc": "^14.1.1",
|
||||||
|
"standard": "^12.0.1"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/yargs/cliui#readme",
|
||||||
|
"keywords": [
|
||||||
|
"cli",
|
||||||
|
"command-line",
|
||||||
|
"layout",
|
||||||
|
"design",
|
||||||
|
"console",
|
||||||
|
"wrap",
|
||||||
|
"table"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "cliui",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@github.com/yargs/cliui.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"coverage": "nyc --reporter=text-lcov mocha | coveralls",
|
||||||
|
"pretest": "standard",
|
||||||
|
"test": "nyc mocha"
|
||||||
|
},
|
||||||
|
"standard": {
|
||||||
|
"ignore": [
|
||||||
|
"**/example/**"
|
||||||
|
],
|
||||||
|
"globals": [
|
||||||
|
"it"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "6.0.0"
|
||||||
|
}
|
54
node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
54
node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# 1.0.0 - 2016-01-07
|
||||||
|
|
||||||
|
- Removed: unused speed test
|
||||||
|
- Added: Automatic routing between previously unsupported conversions
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Removed: `convert()` class
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Changed: all functions to lookup dictionary
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Changed: `ansi` to `ansi256`
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Fixed: argument grouping for functions requiring only one argument
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
|
||||||
|
# 0.6.0 - 2015-07-23
|
||||||
|
|
||||||
|
- Added: methods to handle
|
||||||
|
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||||
|
- rgb2ansi16
|
||||||
|
- rgb2ansi
|
||||||
|
- hsl2ansi16
|
||||||
|
- hsl2ansi
|
||||||
|
- hsv2ansi16
|
||||||
|
- hsv2ansi
|
||||||
|
- hwb2ansi16
|
||||||
|
- hwb2ansi
|
||||||
|
- cmyk2ansi16
|
||||||
|
- cmyk2ansi
|
||||||
|
- keyword2ansi16
|
||||||
|
- keyword2ansi
|
||||||
|
- ansi162rgb
|
||||||
|
- ansi162hsl
|
||||||
|
- ansi162hsv
|
||||||
|
- ansi162hwb
|
||||||
|
- ansi162cmyk
|
||||||
|
- ansi162keyword
|
||||||
|
- ansi2rgb
|
||||||
|
- ansi2hsl
|
||||||
|
- ansi2hsv
|
||||||
|
- ansi2hwb
|
||||||
|
- ansi2cmyk
|
||||||
|
- ansi2keyword
|
||||||
|
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||||
|
|
||||||
|
# 0.5.3 - 2015-06-02
|
||||||
|
|
||||||
|
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||||
|
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Check out commit logs for older releases
|
21
node_modules/color-convert/LICENSE
generated
vendored
Normal file
21
node_modules/color-convert/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
68
node_modules/color-convert/README.md
generated
vendored
Normal file
68
node_modules/color-convert/README.md
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# color-convert
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert)
|
||||||
|
|
||||||
|
Color-convert is a color conversion library for JavaScript and node.
|
||||||
|
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||||
|
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||||
|
|
||||||
|
var rgbChannels = convert.rgb.channels; // 3
|
||||||
|
var cmykChannels = convert.cmyk.channels; // 4
|
||||||
|
var ansiChannels = convert.ansi16.channels; // 1
|
||||||
|
```
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ npm install color-convert
|
||||||
|
```
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||||
|
|
||||||
|
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||||
|
|
||||||
|
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
// Hex to LAB
|
||||||
|
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||||
|
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||||
|
|
||||||
|
// RGB to CMYK
|
||||||
|
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||||
|
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arrays
|
||||||
|
All functions that accept multiple arguments also support passing an array.
|
||||||
|
|
||||||
|
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||||
|
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Routing
|
||||||
|
|
||||||
|
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||||
|
|
||||||
|
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||||
|
|
||||||
|
# Contribute
|
||||||
|
|
||||||
|
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||||
|
|
||||||
|
# License
|
||||||
|
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
839
node_modules/color-convert/conversions.js
generated
vendored
Normal file
839
node_modules/color-convert/conversions.js
generated
vendored
Normal file
|
@ -0,0 +1,839 @@
|
||||||
|
/* MIT license */
|
||||||
|
/* eslint-disable no-mixed-operators */
|
||||||
|
const cssKeywords = require('color-name');
|
||||||
|
|
||||||
|
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||||
|
// values that give correct `typeof` results).
|
||||||
|
// do not use box values types (i.e. Number(), String(), etc.)
|
||||||
|
|
||||||
|
const reverseKeywords = {};
|
||||||
|
for (const key of Object.keys(cssKeywords)) {
|
||||||
|
reverseKeywords[cssKeywords[key]] = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
const convert = {
|
||||||
|
rgb: {channels: 3, labels: 'rgb'},
|
||||||
|
hsl: {channels: 3, labels: 'hsl'},
|
||||||
|
hsv: {channels: 3, labels: 'hsv'},
|
||||||
|
hwb: {channels: 3, labels: 'hwb'},
|
||||||
|
cmyk: {channels: 4, labels: 'cmyk'},
|
||||||
|
xyz: {channels: 3, labels: 'xyz'},
|
||||||
|
lab: {channels: 3, labels: 'lab'},
|
||||||
|
lch: {channels: 3, labels: 'lch'},
|
||||||
|
hex: {channels: 1, labels: ['hex']},
|
||||||
|
keyword: {channels: 1, labels: ['keyword']},
|
||||||
|
ansi16: {channels: 1, labels: ['ansi16']},
|
||||||
|
ansi256: {channels: 1, labels: ['ansi256']},
|
||||||
|
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||||
|
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||||
|
gray: {channels: 1, labels: ['gray']}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = convert;
|
||||||
|
|
||||||
|
// Hide .channels and .labels properties
|
||||||
|
for (const model of Object.keys(convert)) {
|
||||||
|
if (!('channels' in convert[model])) {
|
||||||
|
throw new Error('missing channels property: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!('labels' in convert[model])) {
|
||||||
|
throw new Error('missing channel labels property: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (convert[model].labels.length !== convert[model].channels) {
|
||||||
|
throw new Error('channel and label counts mismatch: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
const {channels, labels} = convert[model];
|
||||||
|
delete convert[model].channels;
|
||||||
|
delete convert[model].labels;
|
||||||
|
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||||
|
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||||
|
}
|
||||||
|
|
||||||
|
convert.rgb.hsl = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const min = Math.min(r, g, b);
|
||||||
|
const max = Math.max(r, g, b);
|
||||||
|
const delta = max - min;
|
||||||
|
let h;
|
||||||
|
let s;
|
||||||
|
|
||||||
|
if (max === min) {
|
||||||
|
h = 0;
|
||||||
|
} else if (r === max) {
|
||||||
|
h = (g - b) / delta;
|
||||||
|
} else if (g === max) {
|
||||||
|
h = 2 + (b - r) / delta;
|
||||||
|
} else if (b === max) {
|
||||||
|
h = 4 + (r - g) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = Math.min(h * 60, 360);
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
const l = (min + max) / 2;
|
||||||
|
|
||||||
|
if (max === min) {
|
||||||
|
s = 0;
|
||||||
|
} else if (l <= 0.5) {
|
||||||
|
s = delta / (max + min);
|
||||||
|
} else {
|
||||||
|
s = delta / (2 - max - min);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [h, s * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hsv = function (rgb) {
|
||||||
|
let rdif;
|
||||||
|
let gdif;
|
||||||
|
let bdif;
|
||||||
|
let h;
|
||||||
|
let s;
|
||||||
|
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const v = Math.max(r, g, b);
|
||||||
|
const diff = v - Math.min(r, g, b);
|
||||||
|
const diffc = function (c) {
|
||||||
|
return (v - c) / 6 / diff + 1 / 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (diff === 0) {
|
||||||
|
h = 0;
|
||||||
|
s = 0;
|
||||||
|
} else {
|
||||||
|
s = diff / v;
|
||||||
|
rdif = diffc(r);
|
||||||
|
gdif = diffc(g);
|
||||||
|
bdif = diffc(b);
|
||||||
|
|
||||||
|
if (r === v) {
|
||||||
|
h = bdif - gdif;
|
||||||
|
} else if (g === v) {
|
||||||
|
h = (1 / 3) + rdif - bdif;
|
||||||
|
} else if (b === v) {
|
||||||
|
h = (2 / 3) + gdif - rdif;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 1;
|
||||||
|
} else if (h > 1) {
|
||||||
|
h -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
h * 360,
|
||||||
|
s * 100,
|
||||||
|
v * 100
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hwb = function (rgb) {
|
||||||
|
const r = rgb[0];
|
||||||
|
const g = rgb[1];
|
||||||
|
let b = rgb[2];
|
||||||
|
const h = convert.rgb.hsl(rgb)[0];
|
||||||
|
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||||
|
|
||||||
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||||
|
|
||||||
|
return [h, w * 100, b * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.cmyk = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
|
||||||
|
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||||
|
const c = (1 - r - k) / (1 - k) || 0;
|
||||||
|
const m = (1 - g - k) / (1 - k) || 0;
|
||||||
|
const y = (1 - b - k) / (1 - k) || 0;
|
||||||
|
|
||||||
|
return [c * 100, m * 100, y * 100, k * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
function comparativeDistance(x, y) {
|
||||||
|
/*
|
||||||
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||||
|
*/
|
||||||
|
return (
|
||||||
|
((x[0] - y[0]) ** 2) +
|
||||||
|
((x[1] - y[1]) ** 2) +
|
||||||
|
((x[2] - y[2]) ** 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
convert.rgb.keyword = function (rgb) {
|
||||||
|
const reversed = reverseKeywords[rgb];
|
||||||
|
if (reversed) {
|
||||||
|
return reversed;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentClosestDistance = Infinity;
|
||||||
|
let currentClosestKeyword;
|
||||||
|
|
||||||
|
for (const keyword of Object.keys(cssKeywords)) {
|
||||||
|
const value = cssKeywords[keyword];
|
||||||
|
|
||||||
|
// Compute comparative distance
|
||||||
|
const distance = comparativeDistance(rgb, value);
|
||||||
|
|
||||||
|
// Check if its less, if so set as closest
|
||||||
|
if (distance < currentClosestDistance) {
|
||||||
|
currentClosestDistance = distance;
|
||||||
|
currentClosestKeyword = keyword;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentClosestKeyword;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.keyword.rgb = function (keyword) {
|
||||||
|
return cssKeywords[keyword];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.xyz = function (rgb) {
|
||||||
|
let r = rgb[0] / 255;
|
||||||
|
let g = rgb[1] / 255;
|
||||||
|
let b = rgb[2] / 255;
|
||||||
|
|
||||||
|
// Assume sRGB
|
||||||
|
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||||
|
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||||
|
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||||
|
|
||||||
|
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||||
|
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||||
|
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||||
|
|
||||||
|
return [x * 100, y * 100, z * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.lab = function (rgb) {
|
||||||
|
const xyz = convert.rgb.xyz(rgb);
|
||||||
|
let x = xyz[0];
|
||||||
|
let y = xyz[1];
|
||||||
|
let z = xyz[2];
|
||||||
|
|
||||||
|
x /= 95.047;
|
||||||
|
y /= 100;
|
||||||
|
z /= 108.883;
|
||||||
|
|
||||||
|
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||||
|
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||||
|
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||||
|
|
||||||
|
const l = (116 * y) - 16;
|
||||||
|
const a = 500 * (x - y);
|
||||||
|
const b = 200 * (y - z);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.rgb = function (hsl) {
|
||||||
|
const h = hsl[0] / 360;
|
||||||
|
const s = hsl[1] / 100;
|
||||||
|
const l = hsl[2] / 100;
|
||||||
|
let t2;
|
||||||
|
let t3;
|
||||||
|
let val;
|
||||||
|
|
||||||
|
if (s === 0) {
|
||||||
|
val = l * 255;
|
||||||
|
return [val, val, val];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l < 0.5) {
|
||||||
|
t2 = l * (1 + s);
|
||||||
|
} else {
|
||||||
|
t2 = l + s - l * s;
|
||||||
|
}
|
||||||
|
|
||||||
|
const t1 = 2 * l - t2;
|
||||||
|
|
||||||
|
const rgb = [0, 0, 0];
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
t3 = h + 1 / 3 * -(i - 1);
|
||||||
|
if (t3 < 0) {
|
||||||
|
t3++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t3 > 1) {
|
||||||
|
t3--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (6 * t3 < 1) {
|
||||||
|
val = t1 + (t2 - t1) * 6 * t3;
|
||||||
|
} else if (2 * t3 < 1) {
|
||||||
|
val = t2;
|
||||||
|
} else if (3 * t3 < 2) {
|
||||||
|
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||||
|
} else {
|
||||||
|
val = t1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb[i] = val * 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.hsv = function (hsl) {
|
||||||
|
const h = hsl[0];
|
||||||
|
let s = hsl[1] / 100;
|
||||||
|
let l = hsl[2] / 100;
|
||||||
|
let smin = s;
|
||||||
|
const lmin = Math.max(l, 0.01);
|
||||||
|
|
||||||
|
l *= 2;
|
||||||
|
s *= (l <= 1) ? l : 2 - l;
|
||||||
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||||
|
const v = (l + s) / 2;
|
||||||
|
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||||
|
|
||||||
|
return [h, sv * 100, v * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.rgb = function (hsv) {
|
||||||
|
const h = hsv[0] / 60;
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
let v = hsv[2] / 100;
|
||||||
|
const hi = Math.floor(h) % 6;
|
||||||
|
|
||||||
|
const f = h - Math.floor(h);
|
||||||
|
const p = 255 * v * (1 - s);
|
||||||
|
const q = 255 * v * (1 - (s * f));
|
||||||
|
const t = 255 * v * (1 - (s * (1 - f)));
|
||||||
|
v *= 255;
|
||||||
|
|
||||||
|
switch (hi) {
|
||||||
|
case 0:
|
||||||
|
return [v, t, p];
|
||||||
|
case 1:
|
||||||
|
return [q, v, p];
|
||||||
|
case 2:
|
||||||
|
return [p, v, t];
|
||||||
|
case 3:
|
||||||
|
return [p, q, v];
|
||||||
|
case 4:
|
||||||
|
return [t, p, v];
|
||||||
|
case 5:
|
||||||
|
return [v, p, q];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.hsl = function (hsv) {
|
||||||
|
const h = hsv[0];
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
const v = hsv[2] / 100;
|
||||||
|
const vmin = Math.max(v, 0.01);
|
||||||
|
let sl;
|
||||||
|
let l;
|
||||||
|
|
||||||
|
l = (2 - s) * v;
|
||||||
|
const lmin = (2 - s) * vmin;
|
||||||
|
sl = s * vmin;
|
||||||
|
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||||
|
sl = sl || 0;
|
||||||
|
l /= 2;
|
||||||
|
|
||||||
|
return [h, sl * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||||
|
convert.hwb.rgb = function (hwb) {
|
||||||
|
const h = hwb[0] / 360;
|
||||||
|
let wh = hwb[1] / 100;
|
||||||
|
let bl = hwb[2] / 100;
|
||||||
|
const ratio = wh + bl;
|
||||||
|
let f;
|
||||||
|
|
||||||
|
// Wh + bl cant be > 1
|
||||||
|
if (ratio > 1) {
|
||||||
|
wh /= ratio;
|
||||||
|
bl /= ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
const i = Math.floor(6 * h);
|
||||||
|
const v = 1 - bl;
|
||||||
|
f = 6 * h - i;
|
||||||
|
|
||||||
|
if ((i & 0x01) !== 0) {
|
||||||
|
f = 1 - f;
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = wh + f * (v - wh); // Linear interpolation
|
||||||
|
|
||||||
|
let r;
|
||||||
|
let g;
|
||||||
|
let b;
|
||||||
|
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||||
|
switch (i) {
|
||||||
|
default:
|
||||||
|
case 6:
|
||||||
|
case 0: r = v; g = n; b = wh; break;
|
||||||
|
case 1: r = n; g = v; b = wh; break;
|
||||||
|
case 2: r = wh; g = v; b = n; break;
|
||||||
|
case 3: r = wh; g = n; b = v; break;
|
||||||
|
case 4: r = n; g = wh; b = v; break;
|
||||||
|
case 5: r = v; g = wh; b = n; break;
|
||||||
|
}
|
||||||
|
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.cmyk.rgb = function (cmyk) {
|
||||||
|
const c = cmyk[0] / 100;
|
||||||
|
const m = cmyk[1] / 100;
|
||||||
|
const y = cmyk[2] / 100;
|
||||||
|
const k = cmyk[3] / 100;
|
||||||
|
|
||||||
|
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||||
|
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||||
|
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.xyz.rgb = function (xyz) {
|
||||||
|
const x = xyz[0] / 100;
|
||||||
|
const y = xyz[1] / 100;
|
||||||
|
const z = xyz[2] / 100;
|
||||||
|
let r;
|
||||||
|
let g;
|
||||||
|
let b;
|
||||||
|
|
||||||
|
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||||
|
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||||
|
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||||
|
|
||||||
|
// Assume sRGB
|
||||||
|
r = r > 0.0031308
|
||||||
|
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: r * 12.92;
|
||||||
|
|
||||||
|
g = g > 0.0031308
|
||||||
|
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: g * 12.92;
|
||||||
|
|
||||||
|
b = b > 0.0031308
|
||||||
|
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: b * 12.92;
|
||||||
|
|
||||||
|
r = Math.min(Math.max(0, r), 1);
|
||||||
|
g = Math.min(Math.max(0, g), 1);
|
||||||
|
b = Math.min(Math.max(0, b), 1);
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.xyz.lab = function (xyz) {
|
||||||
|
let x = xyz[0];
|
||||||
|
let y = xyz[1];
|
||||||
|
let z = xyz[2];
|
||||||
|
|
||||||
|
x /= 95.047;
|
||||||
|
y /= 100;
|
||||||
|
z /= 108.883;
|
||||||
|
|
||||||
|
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||||
|
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||||
|
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||||
|
|
||||||
|
const l = (116 * y) - 16;
|
||||||
|
const a = 500 * (x - y);
|
||||||
|
const b = 200 * (y - z);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lab.xyz = function (lab) {
|
||||||
|
const l = lab[0];
|
||||||
|
const a = lab[1];
|
||||||
|
const b = lab[2];
|
||||||
|
let x;
|
||||||
|
let y;
|
||||||
|
let z;
|
||||||
|
|
||||||
|
y = (l + 16) / 116;
|
||||||
|
x = a / 500 + y;
|
||||||
|
z = y - b / 200;
|
||||||
|
|
||||||
|
const y2 = y ** 3;
|
||||||
|
const x2 = x ** 3;
|
||||||
|
const z2 = z ** 3;
|
||||||
|
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||||
|
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||||
|
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||||
|
|
||||||
|
x *= 95.047;
|
||||||
|
y *= 100;
|
||||||
|
z *= 108.883;
|
||||||
|
|
||||||
|
return [x, y, z];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lab.lch = function (lab) {
|
||||||
|
const l = lab[0];
|
||||||
|
const a = lab[1];
|
||||||
|
const b = lab[2];
|
||||||
|
let h;
|
||||||
|
|
||||||
|
const hr = Math.atan2(b, a);
|
||||||
|
h = hr * 360 / 2 / Math.PI;
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
const c = Math.sqrt(a * a + b * b);
|
||||||
|
|
||||||
|
return [l, c, h];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lch.lab = function (lch) {
|
||||||
|
const l = lch[0];
|
||||||
|
const c = lch[1];
|
||||||
|
const h = lch[2];
|
||||||
|
|
||||||
|
const hr = h / 360 * 2 * Math.PI;
|
||||||
|
const a = c * Math.cos(hr);
|
||||||
|
const b = c * Math.sin(hr);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||||
|
const [r, g, b] = args;
|
||||||
|
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||||
|
|
||||||
|
value = Math.round(value / 50);
|
||||||
|
|
||||||
|
if (value === 0) {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ansi = 30
|
||||||
|
+ ((Math.round(b / 255) << 2)
|
||||||
|
| (Math.round(g / 255) << 1)
|
||||||
|
| Math.round(r / 255));
|
||||||
|
|
||||||
|
if (value === 2) {
|
||||||
|
ansi += 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ansi;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.ansi16 = function (args) {
|
||||||
|
// Optimization here; we already know the value and don't need to get
|
||||||
|
// it converted for us.
|
||||||
|
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.ansi256 = function (args) {
|
||||||
|
const r = args[0];
|
||||||
|
const g = args[1];
|
||||||
|
const b = args[2];
|
||||||
|
|
||||||
|
// We use the extended greyscale palette here, with the exception of
|
||||||
|
// black and white. normal palette only has 4 greyscale shades.
|
||||||
|
if (r === g && g === b) {
|
||||||
|
if (r < 8) {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r > 248) {
|
||||||
|
return 231;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ansi = 16
|
||||||
|
+ (36 * Math.round(r / 255 * 5))
|
||||||
|
+ (6 * Math.round(g / 255 * 5))
|
||||||
|
+ Math.round(b / 255 * 5);
|
||||||
|
|
||||||
|
return ansi;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.ansi16.rgb = function (args) {
|
||||||
|
let color = args % 10;
|
||||||
|
|
||||||
|
// Handle greyscale
|
||||||
|
if (color === 0 || color === 7) {
|
||||||
|
if (args > 50) {
|
||||||
|
color += 3.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
color = color / 10.5 * 255;
|
||||||
|
|
||||||
|
return [color, color, color];
|
||||||
|
}
|
||||||
|
|
||||||
|
const mult = (~~(args > 50) + 1) * 0.5;
|
||||||
|
const r = ((color & 1) * mult) * 255;
|
||||||
|
const g = (((color >> 1) & 1) * mult) * 255;
|
||||||
|
const b = (((color >> 2) & 1) * mult) * 255;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.ansi256.rgb = function (args) {
|
||||||
|
// Handle greyscale
|
||||||
|
if (args >= 232) {
|
||||||
|
const c = (args - 232) * 10 + 8;
|
||||||
|
return [c, c, c];
|
||||||
|
}
|
||||||
|
|
||||||
|
args -= 16;
|
||||||
|
|
||||||
|
let rem;
|
||||||
|
const r = Math.floor(args / 36) / 5 * 255;
|
||||||
|
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||||
|
const b = (rem % 6) / 5 * 255;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hex = function (args) {
|
||||||
|
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||||
|
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||||
|
+ (Math.round(args[2]) & 0xFF);
|
||||||
|
|
||||||
|
const string = integer.toString(16).toUpperCase();
|
||||||
|
return '000000'.substring(string.length) + string;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hex.rgb = function (args) {
|
||||||
|
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||||
|
if (!match) {
|
||||||
|
return [0, 0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
let colorString = match[0];
|
||||||
|
|
||||||
|
if (match[0].length === 3) {
|
||||||
|
colorString = colorString.split('').map(char => {
|
||||||
|
return char + char;
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const integer = parseInt(colorString, 16);
|
||||||
|
const r = (integer >> 16) & 0xFF;
|
||||||
|
const g = (integer >> 8) & 0xFF;
|
||||||
|
const b = integer & 0xFF;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hcg = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const max = Math.max(Math.max(r, g), b);
|
||||||
|
const min = Math.min(Math.min(r, g), b);
|
||||||
|
const chroma = (max - min);
|
||||||
|
let grayscale;
|
||||||
|
let hue;
|
||||||
|
|
||||||
|
if (chroma < 1) {
|
||||||
|
grayscale = min / (1 - chroma);
|
||||||
|
} else {
|
||||||
|
grayscale = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chroma <= 0) {
|
||||||
|
hue = 0;
|
||||||
|
} else
|
||||||
|
if (max === r) {
|
||||||
|
hue = ((g - b) / chroma) % 6;
|
||||||
|
} else
|
||||||
|
if (max === g) {
|
||||||
|
hue = 2 + (b - r) / chroma;
|
||||||
|
} else {
|
||||||
|
hue = 4 + (r - g) / chroma;
|
||||||
|
}
|
||||||
|
|
||||||
|
hue /= 6;
|
||||||
|
hue %= 1;
|
||||||
|
|
||||||
|
return [hue * 360, chroma * 100, grayscale * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.hcg = function (hsl) {
|
||||||
|
const s = hsl[1] / 100;
|
||||||
|
const l = hsl[2] / 100;
|
||||||
|
|
||||||
|
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||||
|
|
||||||
|
let f = 0;
|
||||||
|
if (c < 1.0) {
|
||||||
|
f = (l - 0.5 * c) / (1.0 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hsl[0], c * 100, f * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.hcg = function (hsv) {
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
const v = hsv[2] / 100;
|
||||||
|
|
||||||
|
const c = s * v;
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
if (c < 1.0) {
|
||||||
|
f = (v - c) / (1 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hsv[0], c * 100, f * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.rgb = function (hcg) {
|
||||||
|
const h = hcg[0] / 360;
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
if (c === 0.0) {
|
||||||
|
return [g * 255, g * 255, g * 255];
|
||||||
|
}
|
||||||
|
|
||||||
|
const pure = [0, 0, 0];
|
||||||
|
const hi = (h % 1) * 6;
|
||||||
|
const v = hi % 1;
|
||||||
|
const w = 1 - v;
|
||||||
|
let mg = 0;
|
||||||
|
|
||||||
|
/* eslint-disable max-statements-per-line */
|
||||||
|
switch (Math.floor(hi)) {
|
||||||
|
case 0:
|
||||||
|
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||||
|
case 1:
|
||||||
|
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||||
|
case 2:
|
||||||
|
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||||
|
case 3:
|
||||||
|
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||||
|
case 4:
|
||||||
|
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||||
|
default:
|
||||||
|
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||||
|
}
|
||||||
|
/* eslint-enable max-statements-per-line */
|
||||||
|
|
||||||
|
mg = (1.0 - c) * g;
|
||||||
|
|
||||||
|
return [
|
||||||
|
(c * pure[0] + mg) * 255,
|
||||||
|
(c * pure[1] + mg) * 255,
|
||||||
|
(c * pure[2] + mg) * 255
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hsv = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
const v = c + g * (1.0 - c);
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
if (v > 0.0) {
|
||||||
|
f = c / v;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hcg[0], f * 100, v * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hsl = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
const l = g * (1.0 - c) + 0.5 * c;
|
||||||
|
let s = 0;
|
||||||
|
|
||||||
|
if (l > 0.0 && l < 0.5) {
|
||||||
|
s = c / (2 * l);
|
||||||
|
} else
|
||||||
|
if (l >= 0.5 && l < 1.0) {
|
||||||
|
s = c / (2 * (1 - l));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hcg[0], s * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hwb = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
const v = c + g * (1.0 - c);
|
||||||
|
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hwb.hcg = function (hwb) {
|
||||||
|
const w = hwb[1] / 100;
|
||||||
|
const b = hwb[2] / 100;
|
||||||
|
const v = 1 - b;
|
||||||
|
const c = v - w;
|
||||||
|
let g = 0;
|
||||||
|
|
||||||
|
if (c < 1) {
|
||||||
|
g = (v - c) / (1 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hwb[0], c * 100, g * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.apple.rgb = function (apple) {
|
||||||
|
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.apple = function (rgb) {
|
||||||
|
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.rgb = function (args) {
|
||||||
|
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hsl = function (args) {
|
||||||
|
return [0, 0, args[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hsv = convert.gray.hsl;
|
||||||
|
|
||||||
|
convert.gray.hwb = function (gray) {
|
||||||
|
return [0, 100, gray[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.cmyk = function (gray) {
|
||||||
|
return [0, 0, 0, gray[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.lab = function (gray) {
|
||||||
|
return [gray[0], 0, 0];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hex = function (gray) {
|
||||||
|
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||||
|
const integer = (val << 16) + (val << 8) + val;
|
||||||
|
|
||||||
|
const string = integer.toString(16).toUpperCase();
|
||||||
|
return '000000'.substring(string.length) + string;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.gray = function (rgb) {
|
||||||
|
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||||
|
return [val / 255 * 100];
|
||||||
|
};
|
81
node_modules/color-convert/index.js
generated
vendored
Normal file
81
node_modules/color-convert/index.js
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
const conversions = require('./conversions');
|
||||||
|
const route = require('./route');
|
||||||
|
|
||||||
|
const convert = {};
|
||||||
|
|
||||||
|
const models = Object.keys(conversions);
|
||||||
|
|
||||||
|
function wrapRaw(fn) {
|
||||||
|
const wrappedFn = function (...args) {
|
||||||
|
const arg0 = args[0];
|
||||||
|
if (arg0 === undefined || arg0 === null) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg0.length > 1) {
|
||||||
|
args = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn(args);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Preserve .conversion property if there is one
|
||||||
|
if ('conversion' in fn) {
|
||||||
|
wrappedFn.conversion = fn.conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrappedFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapRounded(fn) {
|
||||||
|
const wrappedFn = function (...args) {
|
||||||
|
const arg0 = args[0];
|
||||||
|
|
||||||
|
if (arg0 === undefined || arg0 === null) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg0.length > 1) {
|
||||||
|
args = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = fn(args);
|
||||||
|
|
||||||
|
// We're assuming the result is an array here.
|
||||||
|
// see notice in conversions.js; don't use box types
|
||||||
|
// in conversion functions.
|
||||||
|
if (typeof result === 'object') {
|
||||||
|
for (let len = result.length, i = 0; i < len; i++) {
|
||||||
|
result[i] = Math.round(result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Preserve .conversion property if there is one
|
||||||
|
if ('conversion' in fn) {
|
||||||
|
wrappedFn.conversion = fn.conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrappedFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
models.forEach(fromModel => {
|
||||||
|
convert[fromModel] = {};
|
||||||
|
|
||||||
|
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||||
|
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||||
|
|
||||||
|
const routes = route(fromModel);
|
||||||
|
const routeModels = Object.keys(routes);
|
||||||
|
|
||||||
|
routeModels.forEach(toModel => {
|
||||||
|
const fn = routes[toModel];
|
||||||
|
|
||||||
|
convert[fromModel][toModel] = wrapRounded(fn);
|
||||||
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = convert;
|
83
node_modules/color-convert/package.json
generated
vendored
Normal file
83
node_modules/color-convert/package.json
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
"_from": "color-convert@^2.0.1",
|
||||||
|
"_id": "color-convert@2.0.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"_location": "/color-convert",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "color-convert@^2.0.1",
|
||||||
|
"name": "color-convert",
|
||||||
|
"escapedName": "color-convert",
|
||||||
|
"rawSpec": "^2.0.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^2.0.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/ansi-styles"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"_shasum": "72d3a68d598c9bdb3af2ad1e84f21d896abd4de3",
|
||||||
|
"_spec": "color-convert@^2.0.1",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\ansi-styles",
|
||||||
|
"author": {
|
||||||
|
"name": "Heather Arthur",
|
||||||
|
"email": "fayearthur@gmail.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Qix-/color-convert/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Plain color conversion functions",
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.4.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"conversions.js",
|
||||||
|
"route.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/Qix-/color-convert#readme",
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"convert",
|
||||||
|
"converter",
|
||||||
|
"conversion",
|
||||||
|
"rgb",
|
||||||
|
"hsl",
|
||||||
|
"hsv",
|
||||||
|
"hwb",
|
||||||
|
"cmyk",
|
||||||
|
"ansi",
|
||||||
|
"ansi16"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "color-convert",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/Qix-/color-convert.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"pretest": "xo",
|
||||||
|
"test": "node test/basic.js"
|
||||||
|
},
|
||||||
|
"version": "2.0.1",
|
||||||
|
"xo": {
|
||||||
|
"rules": {
|
||||||
|
"default-case": 0,
|
||||||
|
"no-inline-comments": 0,
|
||||||
|
"operator-linebreak": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
97
node_modules/color-convert/route.js
generated
vendored
Normal file
97
node_modules/color-convert/route.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
const conversions = require('./conversions');
|
||||||
|
|
||||||
|
/*
|
||||||
|
This function routes a model to all other models.
|
||||||
|
|
||||||
|
all functions that are routed have a property `.conversion` attached
|
||||||
|
to the returned synthetic function. This property is an array
|
||||||
|
of strings, each with the steps in between the 'from' and 'to'
|
||||||
|
color models (inclusive).
|
||||||
|
|
||||||
|
conversions that are not possible simply are not included.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function buildGraph() {
|
||||||
|
const graph = {};
|
||||||
|
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||||
|
const models = Object.keys(conversions);
|
||||||
|
|
||||||
|
for (let len = models.length, i = 0; i < len; i++) {
|
||||||
|
graph[models[i]] = {
|
||||||
|
// http://jsperf.com/1-vs-infinity
|
||||||
|
// micro-opt, but this is simple.
|
||||||
|
distance: -1,
|
||||||
|
parent: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||||
|
function deriveBFS(fromModel) {
|
||||||
|
const graph = buildGraph();
|
||||||
|
const queue = [fromModel]; // Unshift -> queue -> pop
|
||||||
|
|
||||||
|
graph[fromModel].distance = 0;
|
||||||
|
|
||||||
|
while (queue.length) {
|
||||||
|
const current = queue.pop();
|
||||||
|
const adjacents = Object.keys(conversions[current]);
|
||||||
|
|
||||||
|
for (let len = adjacents.length, i = 0; i < len; i++) {
|
||||||
|
const adjacent = adjacents[i];
|
||||||
|
const node = graph[adjacent];
|
||||||
|
|
||||||
|
if (node.distance === -1) {
|
||||||
|
node.distance = graph[current].distance + 1;
|
||||||
|
node.parent = current;
|
||||||
|
queue.unshift(adjacent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
function link(from, to) {
|
||||||
|
return function (args) {
|
||||||
|
return to(from(args));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapConversion(toModel, graph) {
|
||||||
|
const path = [graph[toModel].parent, toModel];
|
||||||
|
let fn = conversions[graph[toModel].parent][toModel];
|
||||||
|
|
||||||
|
let cur = graph[toModel].parent;
|
||||||
|
while (graph[cur].parent) {
|
||||||
|
path.unshift(graph[cur].parent);
|
||||||
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||||
|
cur = graph[cur].parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn.conversion = path;
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function (fromModel) {
|
||||||
|
const graph = deriveBFS(fromModel);
|
||||||
|
const conversion = {};
|
||||||
|
|
||||||
|
const models = Object.keys(graph);
|
||||||
|
for (let len = models.length, i = 0; i < len; i++) {
|
||||||
|
const toModel = models[i];
|
||||||
|
const node = graph[toModel];
|
||||||
|
|
||||||
|
if (node.parent === null) {
|
||||||
|
// No possible conversion, or this node is the source model.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
conversion[toModel] = wrapConversion(toModel, graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
return conversion;
|
||||||
|
};
|
||||||
|
|
8
node_modules/color-name/LICENSE
generated
vendored
Normal file
8
node_modules/color-name/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2015 Dmitry Ivanov
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
node_modules/color-name/README.md
generated
vendored
Normal file
11
node_modules/color-name/README.md
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||||
|
|
||||||
|
[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/)
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
var colors = require('color-name');
|
||||||
|
colors.red //[255,0,0]
|
||||||
|
```
|
||||||
|
|
||||||
|
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
152
node_modules/color-name/index.js
generated
vendored
Normal file
152
node_modules/color-name/index.js
generated
vendored
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"aliceblue": [240, 248, 255],
|
||||||
|
"antiquewhite": [250, 235, 215],
|
||||||
|
"aqua": [0, 255, 255],
|
||||||
|
"aquamarine": [127, 255, 212],
|
||||||
|
"azure": [240, 255, 255],
|
||||||
|
"beige": [245, 245, 220],
|
||||||
|
"bisque": [255, 228, 196],
|
||||||
|
"black": [0, 0, 0],
|
||||||
|
"blanchedalmond": [255, 235, 205],
|
||||||
|
"blue": [0, 0, 255],
|
||||||
|
"blueviolet": [138, 43, 226],
|
||||||
|
"brown": [165, 42, 42],
|
||||||
|
"burlywood": [222, 184, 135],
|
||||||
|
"cadetblue": [95, 158, 160],
|
||||||
|
"chartreuse": [127, 255, 0],
|
||||||
|
"chocolate": [210, 105, 30],
|
||||||
|
"coral": [255, 127, 80],
|
||||||
|
"cornflowerblue": [100, 149, 237],
|
||||||
|
"cornsilk": [255, 248, 220],
|
||||||
|
"crimson": [220, 20, 60],
|
||||||
|
"cyan": [0, 255, 255],
|
||||||
|
"darkblue": [0, 0, 139],
|
||||||
|
"darkcyan": [0, 139, 139],
|
||||||
|
"darkgoldenrod": [184, 134, 11],
|
||||||
|
"darkgray": [169, 169, 169],
|
||||||
|
"darkgreen": [0, 100, 0],
|
||||||
|
"darkgrey": [169, 169, 169],
|
||||||
|
"darkkhaki": [189, 183, 107],
|
||||||
|
"darkmagenta": [139, 0, 139],
|
||||||
|
"darkolivegreen": [85, 107, 47],
|
||||||
|
"darkorange": [255, 140, 0],
|
||||||
|
"darkorchid": [153, 50, 204],
|
||||||
|
"darkred": [139, 0, 0],
|
||||||
|
"darksalmon": [233, 150, 122],
|
||||||
|
"darkseagreen": [143, 188, 143],
|
||||||
|
"darkslateblue": [72, 61, 139],
|
||||||
|
"darkslategray": [47, 79, 79],
|
||||||
|
"darkslategrey": [47, 79, 79],
|
||||||
|
"darkturquoise": [0, 206, 209],
|
||||||
|
"darkviolet": [148, 0, 211],
|
||||||
|
"deeppink": [255, 20, 147],
|
||||||
|
"deepskyblue": [0, 191, 255],
|
||||||
|
"dimgray": [105, 105, 105],
|
||||||
|
"dimgrey": [105, 105, 105],
|
||||||
|
"dodgerblue": [30, 144, 255],
|
||||||
|
"firebrick": [178, 34, 34],
|
||||||
|
"floralwhite": [255, 250, 240],
|
||||||
|
"forestgreen": [34, 139, 34],
|
||||||
|
"fuchsia": [255, 0, 255],
|
||||||
|
"gainsboro": [220, 220, 220],
|
||||||
|
"ghostwhite": [248, 248, 255],
|
||||||
|
"gold": [255, 215, 0],
|
||||||
|
"goldenrod": [218, 165, 32],
|
||||||
|
"gray": [128, 128, 128],
|
||||||
|
"green": [0, 128, 0],
|
||||||
|
"greenyellow": [173, 255, 47],
|
||||||
|
"grey": [128, 128, 128],
|
||||||
|
"honeydew": [240, 255, 240],
|
||||||
|
"hotpink": [255, 105, 180],
|
||||||
|
"indianred": [205, 92, 92],
|
||||||
|
"indigo": [75, 0, 130],
|
||||||
|
"ivory": [255, 255, 240],
|
||||||
|
"khaki": [240, 230, 140],
|
||||||
|
"lavender": [230, 230, 250],
|
||||||
|
"lavenderblush": [255, 240, 245],
|
||||||
|
"lawngreen": [124, 252, 0],
|
||||||
|
"lemonchiffon": [255, 250, 205],
|
||||||
|
"lightblue": [173, 216, 230],
|
||||||
|
"lightcoral": [240, 128, 128],
|
||||||
|
"lightcyan": [224, 255, 255],
|
||||||
|
"lightgoldenrodyellow": [250, 250, 210],
|
||||||
|
"lightgray": [211, 211, 211],
|
||||||
|
"lightgreen": [144, 238, 144],
|
||||||
|
"lightgrey": [211, 211, 211],
|
||||||
|
"lightpink": [255, 182, 193],
|
||||||
|
"lightsalmon": [255, 160, 122],
|
||||||
|
"lightseagreen": [32, 178, 170],
|
||||||
|
"lightskyblue": [135, 206, 250],
|
||||||
|
"lightslategray": [119, 136, 153],
|
||||||
|
"lightslategrey": [119, 136, 153],
|
||||||
|
"lightsteelblue": [176, 196, 222],
|
||||||
|
"lightyellow": [255, 255, 224],
|
||||||
|
"lime": [0, 255, 0],
|
||||||
|
"limegreen": [50, 205, 50],
|
||||||
|
"linen": [250, 240, 230],
|
||||||
|
"magenta": [255, 0, 255],
|
||||||
|
"maroon": [128, 0, 0],
|
||||||
|
"mediumaquamarine": [102, 205, 170],
|
||||||
|
"mediumblue": [0, 0, 205],
|
||||||
|
"mediumorchid": [186, 85, 211],
|
||||||
|
"mediumpurple": [147, 112, 219],
|
||||||
|
"mediumseagreen": [60, 179, 113],
|
||||||
|
"mediumslateblue": [123, 104, 238],
|
||||||
|
"mediumspringgreen": [0, 250, 154],
|
||||||
|
"mediumturquoise": [72, 209, 204],
|
||||||
|
"mediumvioletred": [199, 21, 133],
|
||||||
|
"midnightblue": [25, 25, 112],
|
||||||
|
"mintcream": [245, 255, 250],
|
||||||
|
"mistyrose": [255, 228, 225],
|
||||||
|
"moccasin": [255, 228, 181],
|
||||||
|
"navajowhite": [255, 222, 173],
|
||||||
|
"navy": [0, 0, 128],
|
||||||
|
"oldlace": [253, 245, 230],
|
||||||
|
"olive": [128, 128, 0],
|
||||||
|
"olivedrab": [107, 142, 35],
|
||||||
|
"orange": [255, 165, 0],
|
||||||
|
"orangered": [255, 69, 0],
|
||||||
|
"orchid": [218, 112, 214],
|
||||||
|
"palegoldenrod": [238, 232, 170],
|
||||||
|
"palegreen": [152, 251, 152],
|
||||||
|
"paleturquoise": [175, 238, 238],
|
||||||
|
"palevioletred": [219, 112, 147],
|
||||||
|
"papayawhip": [255, 239, 213],
|
||||||
|
"peachpuff": [255, 218, 185],
|
||||||
|
"peru": [205, 133, 63],
|
||||||
|
"pink": [255, 192, 203],
|
||||||
|
"plum": [221, 160, 221],
|
||||||
|
"powderblue": [176, 224, 230],
|
||||||
|
"purple": [128, 0, 128],
|
||||||
|
"rebeccapurple": [102, 51, 153],
|
||||||
|
"red": [255, 0, 0],
|
||||||
|
"rosybrown": [188, 143, 143],
|
||||||
|
"royalblue": [65, 105, 225],
|
||||||
|
"saddlebrown": [139, 69, 19],
|
||||||
|
"salmon": [250, 128, 114],
|
||||||
|
"sandybrown": [244, 164, 96],
|
||||||
|
"seagreen": [46, 139, 87],
|
||||||
|
"seashell": [255, 245, 238],
|
||||||
|
"sienna": [160, 82, 45],
|
||||||
|
"silver": [192, 192, 192],
|
||||||
|
"skyblue": [135, 206, 235],
|
||||||
|
"slateblue": [106, 90, 205],
|
||||||
|
"slategray": [112, 128, 144],
|
||||||
|
"slategrey": [112, 128, 144],
|
||||||
|
"snow": [255, 250, 250],
|
||||||
|
"springgreen": [0, 255, 127],
|
||||||
|
"steelblue": [70, 130, 180],
|
||||||
|
"tan": [210, 180, 140],
|
||||||
|
"teal": [0, 128, 128],
|
||||||
|
"thistle": [216, 191, 216],
|
||||||
|
"tomato": [255, 99, 71],
|
||||||
|
"turquoise": [64, 224, 208],
|
||||||
|
"violet": [238, 130, 238],
|
||||||
|
"wheat": [245, 222, 179],
|
||||||
|
"white": [255, 255, 255],
|
||||||
|
"whitesmoke": [245, 245, 245],
|
||||||
|
"yellow": [255, 255, 0],
|
||||||
|
"yellowgreen": [154, 205, 50]
|
||||||
|
};
|
56
node_modules/color-name/package.json
generated
vendored
Normal file
56
node_modules/color-name/package.json
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"_from": "color-name@~1.1.4",
|
||||||
|
"_id": "color-name@1.1.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"_location": "/color-name",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "color-name@~1.1.4",
|
||||||
|
"name": "color-name",
|
||||||
|
"escapedName": "color-name",
|
||||||
|
"rawSpec": "~1.1.4",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "~1.1.4"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/color-convert"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"_shasum": "c2a09a87acbde69543de6f63fa3995c826c536a2",
|
||||||
|
"_spec": "color-name@~1.1.4",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\color-convert",
|
||||||
|
"author": {
|
||||||
|
"name": "DY",
|
||||||
|
"email": "dfcreative@gmail.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/colorjs/color-name/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "A list of color names and its values",
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/colorjs/color-name",
|
||||||
|
"keywords": [
|
||||||
|
"color-name",
|
||||||
|
"color",
|
||||||
|
"color-keyword",
|
||||||
|
"keyword"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "color-name",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@github.com/colorjs/color-name.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node test.js"
|
||||||
|
},
|
||||||
|
"version": "1.1.4"
|
||||||
|
}
|
13
node_modules/decamelize/index.js
generated
vendored
Normal file
13
node_modules/decamelize/index.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
'use strict';
|
||||||
|
module.exports = function (str, sep) {
|
||||||
|
if (typeof str !== 'string') {
|
||||||
|
throw new TypeError('Expected a string');
|
||||||
|
}
|
||||||
|
|
||||||
|
sep = typeof sep === 'undefined' ? '_' : sep;
|
||||||
|
|
||||||
|
return str
|
||||||
|
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
|
||||||
|
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
|
||||||
|
.toLowerCase();
|
||||||
|
};
|
21
node_modules/decamelize/license
generated
vendored
Normal file
21
node_modules/decamelize/license
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
71
node_modules/decamelize/package.json
generated
vendored
Normal file
71
node_modules/decamelize/package.json
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
"_from": "decamelize@^1.2.0",
|
||||||
|
"_id": "decamelize@1.2.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||||
|
"_location": "/decamelize",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "decamelize@^1.2.0",
|
||||||
|
"name": "decamelize",
|
||||||
|
"escapedName": "decamelize",
|
||||||
|
"rawSpec": "^1.2.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.2.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/yargs",
|
||||||
|
"/yargs-parser"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
|
"_shasum": "f6534d15148269b20352e7bee26f501f9a191290",
|
||||||
|
"_spec": "decamelize@^1.2.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\yargs",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sindresorhus/decamelize/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/sindresorhus/decamelize#readme",
|
||||||
|
"keywords": [
|
||||||
|
"decamelize",
|
||||||
|
"decamelcase",
|
||||||
|
"camelcase",
|
||||||
|
"lowercase",
|
||||||
|
"case",
|
||||||
|
"dash",
|
||||||
|
"hyphen",
|
||||||
|
"string",
|
||||||
|
"str",
|
||||||
|
"text",
|
||||||
|
"convert"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "decamelize",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/sindresorhus/decamelize.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava"
|
||||||
|
},
|
||||||
|
"version": "1.2.0"
|
||||||
|
}
|
48
node_modules/decamelize/readme.md
generated
vendored
Normal file
48
node_modules/decamelize/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# decamelize [![Build Status](https://travis-ci.org/sindresorhus/decamelize.svg?branch=master)](https://travis-ci.org/sindresorhus/decamelize)
|
||||||
|
|
||||||
|
> Convert a camelized string into a lowercased one with a custom separator<br>
|
||||||
|
> Example: `unicornRainbow` → `unicorn_rainbow`
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install --save decamelize
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const decamelize = require('decamelize');
|
||||||
|
|
||||||
|
decamelize('unicornRainbow');
|
||||||
|
//=> 'unicorn_rainbow'
|
||||||
|
|
||||||
|
decamelize('unicornRainbow', '-');
|
||||||
|
//=> 'unicorn-rainbow'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### decamelize(input, [separator])
|
||||||
|
|
||||||
|
#### input
|
||||||
|
|
||||||
|
Type: `string`
|
||||||
|
|
||||||
|
#### separator
|
||||||
|
|
||||||
|
Type: `string`<br>
|
||||||
|
Default: `_`
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
101
node_modules/doctrine/CHANGELOG.md
generated
vendored
Normal file
101
node_modules/doctrine/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
v3.0.0 - November 9, 2018
|
||||||
|
|
||||||
|
* 0b5a8c7 Breaking: drop support for Node < 6 (#223) (Kai Cataldo)
|
||||||
|
* a05e9f2 Upgrade: eslint-release@1.0.0 (#220) (Teddy Katz)
|
||||||
|
* 36ed027 Chore: upgrade coveralls to ^3.0.1 (#213) (Teddy Katz)
|
||||||
|
* 8667e34 Upgrade: eslint-release@^0.11.1 (#210) (Kevin Partington)
|
||||||
|
|
||||||
|
v2.1.0 - January 6, 2018
|
||||||
|
|
||||||
|
* 827f314 Update: support node ranges (fixes #89) (#190) (Teddy Katz)
|
||||||
|
|
||||||
|
v2.0.2 - November 25, 2017
|
||||||
|
|
||||||
|
* 5049ee3 Fix: Remove redundant LICENSE/README names from files (#203) (Kevin Partington)
|
||||||
|
|
||||||
|
v2.0.1 - November 10, 2017
|
||||||
|
|
||||||
|
* 009f33d Fix: Making sure union type stringification respects compact flag (#199) (Mitermayer Reis)
|
||||||
|
* 19da935 Use native String.prototype.trim instead of a custom implementation. (#201) (Rouven Weßling)
|
||||||
|
* e3a011b chore: add mocha.opts to restore custom mocha config (Jason Kurian)
|
||||||
|
* d888200 chore: adds nyc and a newer version of mocha to accurately report coverage (Jason Kurian)
|
||||||
|
* 6b210a8 fix: support type expression for @this tag (fixes #181) (#182) (Frédéric Junod)
|
||||||
|
* 1c4a4c7 fix: Allow array indexes in names (#193) (Tom MacWright)
|
||||||
|
* 9aed54d Fix incorrect behavior when arrow functions are used as default values (#189) (Gaurab Paul)
|
||||||
|
* 9efb6ca Upgrade: Use Array.isArray instead of isarray package (#195) (medanat)
|
||||||
|
|
||||||
|
v2.0.0 - November 15, 2016
|
||||||
|
|
||||||
|
* 7d7c5f1 Breaking: Re-license to Apache 2 (fixes #176) (#178) (Nicholas C. Zakas)
|
||||||
|
* 5496132 Docs: Update license copyright (Nicholas C. Zakas)
|
||||||
|
|
||||||
|
v1.5.0 - October 13, 2016
|
||||||
|
|
||||||
|
* e33c6bb Update: Add support for BooleanLiteralType (#173) (Erik Arvidsson)
|
||||||
|
|
||||||
|
v1.4.0 - September 13, 2016
|
||||||
|
|
||||||
|
* d7426e5 Update: add ability to parse optional properties in typedefs (refs #5) (#174) (ikokostya)
|
||||||
|
|
||||||
|
v1.3.0 - August 22, 2016
|
||||||
|
|
||||||
|
* 12c7ad9 Update: Add support for numeric and string literal types (fixes #156) (#172) (Andrew Walter)
|
||||||
|
|
||||||
|
v1.2.3 - August 16, 2016
|
||||||
|
|
||||||
|
* b96a884 Build: Add CI release script (Nicholas C. Zakas)
|
||||||
|
* 8d9b3c7 Upgrade: Upgrade esutils to v2.0.2 (fixes #170) (#171) (Emeegeemee)
|
||||||
|
|
||||||
|
v1.2.2 - May 19, 2016
|
||||||
|
|
||||||
|
* ebe0b08 Fix: Support case insensitive tags (fixes #163) (#164) (alberto)
|
||||||
|
* 8e6d81e Chore: Remove copyright and license from headers (Nicholas C. Zakas)
|
||||||
|
* 79035c6 Chore: Include jQuery Foundation copyright (Nicholas C. Zakas)
|
||||||
|
* 06910a7 Fix: Preserve whitespace in default param string values (fixes #157) (Kai Cataldo)
|
||||||
|
|
||||||
|
v1.2.1 - March 29, 2016
|
||||||
|
|
||||||
|
* 1f54014 Fix: allow hyphens in names (fixes #116) (Kai Cataldo)
|
||||||
|
* bbee469 Docs: Add issue template (Nicholas C. Zakas)
|
||||||
|
|
||||||
|
v1.2.0 - February 19, 2016
|
||||||
|
|
||||||
|
* 18136c5 Build: Cleanup build system (Nicholas C. Zakas)
|
||||||
|
* b082f85 Update: Add support for slash in namepaths (fixes #100) (Ryan Duffy)
|
||||||
|
* def53a2 Docs: Fix typo in option lineNumbers (Daniel Tschinder)
|
||||||
|
* e2cbbc5 Update: Bump isarray to v1.0.0 (Shinnosuke Watanabe)
|
||||||
|
* ae07aa8 Fix: Allow whitespace in optional param with default value (fixes #141) (chris)
|
||||||
|
|
||||||
|
v1.1.0 - January 6, 2016
|
||||||
|
|
||||||
|
* Build: Switch to Makefile.js (Nicholas C. Zakas)
|
||||||
|
* New: support name expression for @this tag (fixes #143) (Tim Schaub)
|
||||||
|
* Build: Update ESLint settings (Nicholas C. Zakas)
|
||||||
|
|
||||||
|
v1.0.0 - December 21, 2015
|
||||||
|
|
||||||
|
* New: parse caption tags in examples into separate property. (fixes #131) (Tom MacWright)
|
||||||
|
|
||||||
|
v0.7.2 - November 27, 2015
|
||||||
|
|
||||||
|
* Fix: Line numbers for some tags (fixes #138) Fixing issue where input was not consumed via advance() but was skipped when parsing tags resulting in sometimes incorrect reported lineNumber. (TEHEK)
|
||||||
|
* Build: Add missing linefix package (Nicholas C. Zakas)
|
||||||
|
|
||||||
|
v0.7.1 - November 13, 2015
|
||||||
|
|
||||||
|
* Update: Begin switch to Makefile.js (Nicholas C. Zakas)
|
||||||
|
* Fix: permit return tag without type (fixes #136) (Tom MacWright)
|
||||||
|
* Fix: package.json homepage field (Bogdan Chadkin)
|
||||||
|
* Fix: Parse array default syntax. Fixes #133 (Tom MacWright)
|
||||||
|
* Fix: Last tag always has \n in the description (fixes #87) (Burak Yigit Kaya)
|
||||||
|
* Docs: Add changelog (Nicholas C. Zakas)
|
||||||
|
|
||||||
|
v0.7.0 - September 21, 2015
|
||||||
|
|
||||||
|
* Docs: Update README with new info (fixes #127) (Nicholas C. Zakas)
|
||||||
|
* Fix: Parsing fix for param with arrays and properties (fixes #111) (Gyandeep Singh)
|
||||||
|
* Build: Add travis build (fixes #123) (Gyandeep Singh)
|
||||||
|
* Fix: Parsing of parameter name without a type (fixes #120) (Gyandeep Singh)
|
||||||
|
* New: added preserveWhitespace option (Aleks Totic)
|
||||||
|
* New: Add "files" entry to only deploy select files (Rob Loach)
|
||||||
|
* New: Add support and tests for typedefs. Refs #5 (Tom MacWright)
|
177
node_modules/doctrine/LICENSE
generated
vendored
Normal file
177
node_modules/doctrine/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
202
node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
Normal file
202
node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
19
node_modules/doctrine/LICENSE.esprima
generated
vendored
Normal file
19
node_modules/doctrine/LICENSE.esprima
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 <COPYRIGHT HOLDER> 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.
|
165
node_modules/doctrine/README.md
generated
vendored
Normal file
165
node_modules/doctrine/README.md
generated
vendored
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
[![NPM version][npm-image]][npm-url]
|
||||||
|
[![build status][travis-image]][travis-url]
|
||||||
|
[![Test coverage][coveralls-image]][coveralls-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
[![Join the chat at https://gitter.im/eslint/doctrine](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
# Doctrine
|
||||||
|
|
||||||
|
Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
You can install Doctrine using [npm](https://npmjs.com):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install doctrine --save-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Doctrine can also be used in web browsers using [Browserify](http://browserify.org).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Require doctrine inside of your JavaScript:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var doctrine = require("doctrine");
|
||||||
|
```
|
||||||
|
|
||||||
|
### parse()
|
||||||
|
|
||||||
|
The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are:
|
||||||
|
|
||||||
|
* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`.
|
||||||
|
* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`.
|
||||||
|
* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`.
|
||||||
|
* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`.
|
||||||
|
* `lineNumbers` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`.
|
||||||
|
* `range` - set to `true` to add `range` to each node, specifying the start and end index of the node in the original comment. Default: `false`.
|
||||||
|
|
||||||
|
Here's a simple example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var ast = doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * This function comment is parsed by doctrine",
|
||||||
|
" * @param {{ok:String}} userName",
|
||||||
|
"*/"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
```
|
||||||
|
|
||||||
|
This example returns the following AST:
|
||||||
|
|
||||||
|
{
|
||||||
|
"description": "This function comment is parsed by doctrine",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"title": "param",
|
||||||
|
"description": null,
|
||||||
|
"type": {
|
||||||
|
"type": "RecordType",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"type": "FieldType",
|
||||||
|
"key": "ok",
|
||||||
|
"value": {
|
||||||
|
"type": "NameExpression",
|
||||||
|
"name": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "userName"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
See the [demo page](http://eslint.org/doctrine/demo/) more detail.
|
||||||
|
|
||||||
|
## Team
|
||||||
|
|
||||||
|
These folks keep the project moving and are resources for help:
|
||||||
|
|
||||||
|
* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
|
||||||
|
* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues).
|
||||||
|
|
||||||
|
## Frequently Asked Questions
|
||||||
|
|
||||||
|
### Can I pass a whole JavaScript file to Doctrine?
|
||||||
|
|
||||||
|
No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work.
|
||||||
|
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
#### doctrine
|
||||||
|
|
||||||
|
Copyright JS Foundation and other contributors, https://js.foundation
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
#### esprima
|
||||||
|
|
||||||
|
some of functions is derived from esprima
|
||||||
|
|
||||||
|
Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about)
|
||||||
|
(twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 <COPYRIGHT HOLDER> 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.
|
||||||
|
|
||||||
|
|
||||||
|
#### closure-compiler
|
||||||
|
|
||||||
|
some of extensions is derived from closure-compiler
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
|
||||||
|
### Where to ask for help?
|
||||||
|
|
||||||
|
Join our [Chatroom](https://gitter.im/eslint/doctrine)
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square
|
||||||
|
[npm-url]: https://www.npmjs.com/package/doctrine
|
||||||
|
[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square
|
||||||
|
[travis-url]: https://travis-ci.org/eslint/doctrine
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square
|
||||||
|
[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master
|
||||||
|
[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square
|
||||||
|
[downloads-url]: https://www.npmjs.com/package/doctrine
|
898
node_modules/doctrine/lib/doctrine.js
generated
vendored
Normal file
898
node_modules/doctrine/lib/doctrine.js
generated
vendored
Normal file
|
@ -0,0 +1,898 @@
|
||||||
|
/*
|
||||||
|
* @fileoverview Main Doctrine object
|
||||||
|
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
* @author Dan Tao <daniel.tao@gmail.com>
|
||||||
|
* @author Andrew Eisenberg <andrew@eisenberg.as>
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var typed,
|
||||||
|
utility,
|
||||||
|
jsdoc,
|
||||||
|
esutils,
|
||||||
|
hasOwnProperty;
|
||||||
|
|
||||||
|
esutils = require('esutils');
|
||||||
|
typed = require('./typed');
|
||||||
|
utility = require('./utility');
|
||||||
|
|
||||||
|
function sliceSource(source, index, last) {
|
||||||
|
return source.slice(index, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
hasOwnProperty = (function () {
|
||||||
|
var func = Object.prototype.hasOwnProperty;
|
||||||
|
return function hasOwnProperty(obj, name) {
|
||||||
|
return func.call(obj, name);
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
function shallowCopy(obj) {
|
||||||
|
var ret = {}, key;
|
||||||
|
for (key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) {
|
||||||
|
ret[key] = obj[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isASCIIAlphanumeric(ch) {
|
||||||
|
return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
|
||||||
|
(ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
|
||||||
|
(ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isParamTitle(title) {
|
||||||
|
return title === 'param' || title === 'argument' || title === 'arg';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isReturnTitle(title) {
|
||||||
|
return title === 'return' || title === 'returns';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isProperty(title) {
|
||||||
|
return title === 'property' || title === 'prop';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isNameParameterRequired(title) {
|
||||||
|
return isParamTitle(title) || isProperty(title) ||
|
||||||
|
title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAllowedName(title) {
|
||||||
|
return isNameParameterRequired(title) || title === 'const' || title === 'constant';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAllowedNested(title) {
|
||||||
|
return isProperty(title) || isParamTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAllowedOptional(title) {
|
||||||
|
return isProperty(title) || isParamTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isTypeParameterRequired(title) {
|
||||||
|
return isParamTitle(title) || isReturnTitle(title) ||
|
||||||
|
title === 'define' || title === 'enum' ||
|
||||||
|
title === 'implements' || title === 'this' ||
|
||||||
|
title === 'type' || title === 'typedef' || isProperty(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required
|
||||||
|
// This would require changes to 'parseType'
|
||||||
|
function isAllowedType(title) {
|
||||||
|
return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' ||
|
||||||
|
title === 'namespace' || title === 'member' || title === 'var' || title === 'module' ||
|
||||||
|
title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' ||
|
||||||
|
title === 'public' || title === 'private' || title === 'protected';
|
||||||
|
}
|
||||||
|
|
||||||
|
// A regex character class that contains all whitespace except linebreak characters (\r, \n, \u2028, \u2029)
|
||||||
|
var WHITESPACE = '[ \\f\\t\\v\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]';
|
||||||
|
|
||||||
|
var STAR_MATCHER = '(' + WHITESPACE + '*(?:\\*' + WHITESPACE + '?)?)(.+|[\r\n\u2028\u2029])';
|
||||||
|
|
||||||
|
function unwrapComment(doc) {
|
||||||
|
// JSDoc comment is following form
|
||||||
|
// /**
|
||||||
|
// * .......
|
||||||
|
// */
|
||||||
|
|
||||||
|
return doc.
|
||||||
|
// remove /**
|
||||||
|
replace(/^\/\*\*?/, '').
|
||||||
|
// remove */
|
||||||
|
replace(/\*\/$/, '').
|
||||||
|
// remove ' * ' at the beginning of a line
|
||||||
|
replace(new RegExp(STAR_MATCHER, 'g'), '$2').
|
||||||
|
// remove trailing whitespace
|
||||||
|
replace(/\s*$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an index in an "unwrapped" JSDoc comment to the corresponding index in the original "wrapped" version
|
||||||
|
* @param {string} originalSource The original wrapped comment
|
||||||
|
* @param {number} unwrappedIndex The index of a character in the unwrapped string
|
||||||
|
* @returns {number} The index of the corresponding character in the original wrapped string
|
||||||
|
*/
|
||||||
|
function convertUnwrappedCommentIndex(originalSource, unwrappedIndex) {
|
||||||
|
var replacedSource = originalSource.replace(/^\/\*\*?/, '');
|
||||||
|
var numSkippedChars = 0;
|
||||||
|
var matcher = new RegExp(STAR_MATCHER, 'g');
|
||||||
|
var match;
|
||||||
|
|
||||||
|
while ((match = matcher.exec(replacedSource))) {
|
||||||
|
numSkippedChars += match[1].length;
|
||||||
|
|
||||||
|
if (match.index + match[0].length > unwrappedIndex + numSkippedChars) {
|
||||||
|
return unwrappedIndex + numSkippedChars + originalSource.length - replacedSource.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return originalSource.replace(/\*\/$/, '').replace(/\s*$/, '').length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSDoc Tag Parser
|
||||||
|
|
||||||
|
(function (exports) {
|
||||||
|
var Rules,
|
||||||
|
index,
|
||||||
|
lineNumber,
|
||||||
|
length,
|
||||||
|
source,
|
||||||
|
originalSource,
|
||||||
|
recoverable,
|
||||||
|
sloppy,
|
||||||
|
strict;
|
||||||
|
|
||||||
|
function advance() {
|
||||||
|
var ch = source.charCodeAt(index);
|
||||||
|
index += 1;
|
||||||
|
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) {
|
||||||
|
lineNumber += 1;
|
||||||
|
}
|
||||||
|
return String.fromCharCode(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanTitle() {
|
||||||
|
var title = '';
|
||||||
|
// waste '@'
|
||||||
|
advance();
|
||||||
|
|
||||||
|
while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) {
|
||||||
|
title += advance();
|
||||||
|
}
|
||||||
|
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
function seekContent() {
|
||||||
|
var ch, waiting, last = index;
|
||||||
|
|
||||||
|
waiting = false;
|
||||||
|
while (last < length) {
|
||||||
|
ch = source.charCodeAt(last);
|
||||||
|
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) {
|
||||||
|
waiting = true;
|
||||||
|
} else if (waiting) {
|
||||||
|
if (ch === 0x40 /* '@' */) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!esutils.code.isWhiteSpace(ch)) {
|
||||||
|
waiting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last += 1;
|
||||||
|
}
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type expression may have nest brace, such as,
|
||||||
|
// { { ok: string } }
|
||||||
|
//
|
||||||
|
// therefore, scanning type expression with balancing braces.
|
||||||
|
function parseType(title, last, addRange) {
|
||||||
|
var ch, brace, type, startIndex, direct = false;
|
||||||
|
|
||||||
|
|
||||||
|
// search '{'
|
||||||
|
while (index < last) {
|
||||||
|
ch = source.charCodeAt(index);
|
||||||
|
if (esutils.code.isWhiteSpace(ch)) {
|
||||||
|
advance();
|
||||||
|
} else if (ch === 0x7B /* '{' */) {
|
||||||
|
advance();
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// this is direct pattern
|
||||||
|
direct = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (direct) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type expression { is found
|
||||||
|
brace = 1;
|
||||||
|
type = '';
|
||||||
|
while (index < last) {
|
||||||
|
ch = source.charCodeAt(index);
|
||||||
|
if (esutils.code.isLineTerminator(ch)) {
|
||||||
|
advance();
|
||||||
|
} else {
|
||||||
|
if (ch === 0x7D /* '}' */) {
|
||||||
|
brace -= 1;
|
||||||
|
if (brace === 0) {
|
||||||
|
advance();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (ch === 0x7B /* '{' */) {
|
||||||
|
brace += 1;
|
||||||
|
}
|
||||||
|
if (type === '') {
|
||||||
|
startIndex = index;
|
||||||
|
}
|
||||||
|
type += advance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (brace !== 0) {
|
||||||
|
// braces is not balanced
|
||||||
|
return utility.throwError('Braces are not balanced');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAllowedOptional(title)) {
|
||||||
|
return typed.parseParamType(type, {startIndex: convertIndex(startIndex), range: addRange});
|
||||||
|
}
|
||||||
|
|
||||||
|
return typed.parseType(type, {startIndex: convertIndex(startIndex), range: addRange});
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanIdentifier(last) {
|
||||||
|
var identifier;
|
||||||
|
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index)) && !source[index].match(/[0-9]/)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
identifier = advance();
|
||||||
|
while (index < last && esutils.code.isIdentifierPartES5(source.charCodeAt(index))) {
|
||||||
|
identifier += advance();
|
||||||
|
}
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
function skipWhiteSpace(last) {
|
||||||
|
while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) {
|
||||||
|
advance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseName(last, allowBrackets, allowNestedParams) {
|
||||||
|
var name = '',
|
||||||
|
useBrackets,
|
||||||
|
insideString;
|
||||||
|
|
||||||
|
|
||||||
|
skipWhiteSpace(last);
|
||||||
|
|
||||||
|
if (index >= last) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source.charCodeAt(index) === 0x5B /* '[' */) {
|
||||||
|
if (allowBrackets) {
|
||||||
|
useBrackets = true;
|
||||||
|
name = advance();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
name += scanIdentifier(last);
|
||||||
|
|
||||||
|
if (allowNestedParams) {
|
||||||
|
if (source.charCodeAt(index) === 0x3A /* ':' */ && (
|
||||||
|
name === 'module' ||
|
||||||
|
name === 'external' ||
|
||||||
|
name === 'event')) {
|
||||||
|
name += advance();
|
||||||
|
name += scanIdentifier(last);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){
|
||||||
|
name += advance();
|
||||||
|
name += advance();
|
||||||
|
}
|
||||||
|
while (source.charCodeAt(index) === 0x2E /* '.' */ ||
|
||||||
|
source.charCodeAt(index) === 0x2F /* '/' */ ||
|
||||||
|
source.charCodeAt(index) === 0x23 /* '#' */ ||
|
||||||
|
source.charCodeAt(index) === 0x2D /* '-' */ ||
|
||||||
|
source.charCodeAt(index) === 0x7E /* '~' */) {
|
||||||
|
name += advance();
|
||||||
|
name += scanIdentifier(last);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useBrackets) {
|
||||||
|
skipWhiteSpace(last);
|
||||||
|
// do we have a default value for this?
|
||||||
|
if (source.charCodeAt(index) === 0x3D /* '=' */) {
|
||||||
|
// consume the '='' symbol
|
||||||
|
name += advance();
|
||||||
|
skipWhiteSpace(last);
|
||||||
|
|
||||||
|
var ch;
|
||||||
|
var bracketDepth = 1;
|
||||||
|
|
||||||
|
// scan in the default value
|
||||||
|
while (index < last) {
|
||||||
|
ch = source.charCodeAt(index);
|
||||||
|
|
||||||
|
if (esutils.code.isWhiteSpace(ch)) {
|
||||||
|
if (!insideString) {
|
||||||
|
skipWhiteSpace(last);
|
||||||
|
ch = source.charCodeAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch === 0x27 /* ''' */) {
|
||||||
|
if (!insideString) {
|
||||||
|
insideString = '\'';
|
||||||
|
} else {
|
||||||
|
if (insideString === '\'') {
|
||||||
|
insideString = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch === 0x22 /* '"' */) {
|
||||||
|
if (!insideString) {
|
||||||
|
insideString = '"';
|
||||||
|
} else {
|
||||||
|
if (insideString === '"') {
|
||||||
|
insideString = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch === 0x5B /* '[' */) {
|
||||||
|
bracketDepth++;
|
||||||
|
} else if (ch === 0x5D /* ']' */ &&
|
||||||
|
--bracketDepth === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
name += advance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
skipWhiteSpace(last);
|
||||||
|
|
||||||
|
if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) {
|
||||||
|
// we never found a closing ']'
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// collect the last ']'
|
||||||
|
name += advance();
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function skipToTag() {
|
||||||
|
while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) {
|
||||||
|
advance();
|
||||||
|
}
|
||||||
|
if (index >= length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
utility.assert(source.charCodeAt(index) === 0x40 /* '@' */);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertIndex(rangeIndex) {
|
||||||
|
if (source === originalSource) {
|
||||||
|
return rangeIndex;
|
||||||
|
}
|
||||||
|
return convertUnwrappedCommentIndex(originalSource, rangeIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TagParser(options, title) {
|
||||||
|
this._options = options;
|
||||||
|
this._title = title.toLowerCase();
|
||||||
|
this._tag = {
|
||||||
|
title: title,
|
||||||
|
description: null
|
||||||
|
};
|
||||||
|
if (this._options.lineNumbers) {
|
||||||
|
this._tag.lineNumber = lineNumber;
|
||||||
|
}
|
||||||
|
this._first = index - title.length - 1;
|
||||||
|
this._last = 0;
|
||||||
|
// space to save special information for title parsers.
|
||||||
|
this._extra = { };
|
||||||
|
}
|
||||||
|
|
||||||
|
// addError(err, ...)
|
||||||
|
TagParser.prototype.addError = function addError(errorText) {
|
||||||
|
var args = Array.prototype.slice.call(arguments, 1),
|
||||||
|
msg = errorText.replace(
|
||||||
|
/%(\d)/g,
|
||||||
|
function (whole, index) {
|
||||||
|
utility.assert(index < args.length, 'Message reference must be in range');
|
||||||
|
return args[index];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!this._tag.errors) {
|
||||||
|
this._tag.errors = [];
|
||||||
|
}
|
||||||
|
if (strict) {
|
||||||
|
utility.throwError(msg);
|
||||||
|
}
|
||||||
|
this._tag.errors.push(msg);
|
||||||
|
return recoverable;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseType = function () {
|
||||||
|
// type required titles
|
||||||
|
if (isTypeParameterRequired(this._title)) {
|
||||||
|
try {
|
||||||
|
this._tag.type = parseType(this._title, this._last, this._options.range);
|
||||||
|
if (!this._tag.type) {
|
||||||
|
if (!isParamTitle(this._title) && !isReturnTitle(this._title)) {
|
||||||
|
if (!this.addError('Missing or invalid tag type')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this._tag.type = null;
|
||||||
|
if (!this.addError(error.message)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isAllowedType(this._title)) {
|
||||||
|
// optional types
|
||||||
|
try {
|
||||||
|
this._tag.type = parseType(this._title, this._last, this._options.range);
|
||||||
|
} catch (e) {
|
||||||
|
//For optional types, lets drop the thrown error when we hit the end of the file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype._parseNamePath = function (optional) {
|
||||||
|
var name;
|
||||||
|
name = parseName(this._last, sloppy && isAllowedOptional(this._title), true);
|
||||||
|
if (!name) {
|
||||||
|
if (!optional) {
|
||||||
|
if (!this.addError('Missing or invalid tag name')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._tag.name = name;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseNamePath = function () {
|
||||||
|
return this._parseNamePath(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseNamePathOptional = function () {
|
||||||
|
return this._parseNamePath(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
TagParser.prototype.parseName = function () {
|
||||||
|
var assign, name;
|
||||||
|
|
||||||
|
// param, property requires name
|
||||||
|
if (isAllowedName(this._title)) {
|
||||||
|
this._tag.name = parseName(this._last, sloppy && isAllowedOptional(this._title), isAllowedNested(this._title));
|
||||||
|
if (!this._tag.name) {
|
||||||
|
if (!isNameParameterRequired(this._title)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// it's possible the name has already been parsed but interpreted as a type
|
||||||
|
// it's also possible this is a sloppy declaration, in which case it will be
|
||||||
|
// fixed at the end
|
||||||
|
if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) {
|
||||||
|
this._extra.name = this._tag.type;
|
||||||
|
this._tag.name = this._tag.type.name;
|
||||||
|
this._tag.type = null;
|
||||||
|
} else {
|
||||||
|
if (!this.addError('Missing or invalid tag name')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
name = this._tag.name;
|
||||||
|
if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') {
|
||||||
|
// extract the default value if there is one
|
||||||
|
// example: @param {string} [somebody=John Doe] description
|
||||||
|
assign = name.substring(1, name.length - 1).split('=');
|
||||||
|
if (assign.length > 1) {
|
||||||
|
this._tag['default'] = assign.slice(1).join('=');
|
||||||
|
}
|
||||||
|
this._tag.name = assign[0];
|
||||||
|
|
||||||
|
// convert to an optional type
|
||||||
|
if (this._tag.type && this._tag.type.type !== 'OptionalType') {
|
||||||
|
this._tag.type = {
|
||||||
|
type: 'OptionalType',
|
||||||
|
expression: this._tag.type
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseDescription = function parseDescription() {
|
||||||
|
var description = sliceSource(source, index, this._last).trim();
|
||||||
|
if (description) {
|
||||||
|
if ((/^-\s+/).test(description)) {
|
||||||
|
description = description.substring(2);
|
||||||
|
}
|
||||||
|
this._tag.description = description;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseCaption = function parseDescription() {
|
||||||
|
var description = sliceSource(source, index, this._last).trim();
|
||||||
|
var captionStartTag = '<caption>';
|
||||||
|
var captionEndTag = '</caption>';
|
||||||
|
var captionStart = description.indexOf(captionStartTag);
|
||||||
|
var captionEnd = description.indexOf(captionEndTag);
|
||||||
|
if (captionStart >= 0 && captionEnd >= 0) {
|
||||||
|
this._tag.caption = description.substring(
|
||||||
|
captionStart + captionStartTag.length, captionEnd).trim();
|
||||||
|
this._tag.description = description.substring(captionEnd + captionEndTag.length).trim();
|
||||||
|
} else {
|
||||||
|
this._tag.description = description;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseKind = function parseKind() {
|
||||||
|
var kind, kinds;
|
||||||
|
kinds = {
|
||||||
|
'class': true,
|
||||||
|
'constant': true,
|
||||||
|
'event': true,
|
||||||
|
'external': true,
|
||||||
|
'file': true,
|
||||||
|
'function': true,
|
||||||
|
'member': true,
|
||||||
|
'mixin': true,
|
||||||
|
'module': true,
|
||||||
|
'namespace': true,
|
||||||
|
'typedef': true
|
||||||
|
};
|
||||||
|
kind = sliceSource(source, index, this._last).trim();
|
||||||
|
this._tag.kind = kind;
|
||||||
|
if (!hasOwnProperty(kinds, kind)) {
|
||||||
|
if (!this.addError('Invalid kind name \'%0\'', kind)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseAccess = function parseAccess() {
|
||||||
|
var access;
|
||||||
|
access = sliceSource(source, index, this._last).trim();
|
||||||
|
this._tag.access = access;
|
||||||
|
if (access !== 'private' && access !== 'protected' && access !== 'public') {
|
||||||
|
if (!this.addError('Invalid access name \'%0\'', access)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseThis = function parseThis() {
|
||||||
|
// this name may be a name expression (e.g. {foo.bar}),
|
||||||
|
// an union (e.g. {foo.bar|foo.baz}) or a name path (e.g. foo.bar)
|
||||||
|
var value = sliceSource(source, index, this._last).trim();
|
||||||
|
if (value && value.charAt(0) === '{') {
|
||||||
|
var gotType = this.parseType();
|
||||||
|
if (gotType && this._tag.type.type === 'NameExpression' || this._tag.type.type === 'UnionType') {
|
||||||
|
this._tag.name = this._tag.type.name;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return this.addError('Invalid name for this');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.parseNamePath();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parseVariation = function parseVariation() {
|
||||||
|
var variation, text;
|
||||||
|
text = sliceSource(source, index, this._last).trim();
|
||||||
|
variation = parseFloat(text, 10);
|
||||||
|
this._tag.variation = variation;
|
||||||
|
if (isNaN(variation)) {
|
||||||
|
if (!this.addError('Invalid variation \'%0\'', text)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.ensureEnd = function () {
|
||||||
|
var shouldBeEmpty = sliceSource(source, index, this._last).trim();
|
||||||
|
if (shouldBeEmpty) {
|
||||||
|
if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.epilogue = function epilogue() {
|
||||||
|
var description;
|
||||||
|
|
||||||
|
description = this._tag.description;
|
||||||
|
// un-fix potentially sloppy declaration
|
||||||
|
if (isAllowedOptional(this._title) && !this._tag.type && description && description.charAt(0) === '[') {
|
||||||
|
this._tag.type = this._extra.name;
|
||||||
|
if (!this._tag.name) {
|
||||||
|
this._tag.name = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sloppy) {
|
||||||
|
if (!this.addError('Missing or invalid tag name')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Rules = {
|
||||||
|
// http://usejsdoc.org/tags-access.html
|
||||||
|
'access': ['parseAccess'],
|
||||||
|
// http://usejsdoc.org/tags-alias.html
|
||||||
|
'alias': ['parseNamePath', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-augments.html
|
||||||
|
'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-constructor.html
|
||||||
|
'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// Synonym: http://usejsdoc.org/tags-constructor.html
|
||||||
|
'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// Synonym: http://usejsdoc.org/tags-extends.html
|
||||||
|
'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-example.html
|
||||||
|
'example': ['parseCaption'],
|
||||||
|
// http://usejsdoc.org/tags-deprecated.html
|
||||||
|
'deprecated': ['parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-global.html
|
||||||
|
'global': ['ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-inner.html
|
||||||
|
'inner': ['ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-instance.html
|
||||||
|
'instance': ['ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-kind.html
|
||||||
|
'kind': ['parseKind'],
|
||||||
|
// http://usejsdoc.org/tags-mixes.html
|
||||||
|
'mixes': ['parseNamePath', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-mixin.html
|
||||||
|
'mixin': ['parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-member.html
|
||||||
|
'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-method.html
|
||||||
|
'method': ['parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-module.html
|
||||||
|
'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// Synonym: http://usejsdoc.org/tags-method.html
|
||||||
|
'func': ['parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// Synonym: http://usejsdoc.org/tags-method.html
|
||||||
|
'function': ['parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// Synonym: http://usejsdoc.org/tags-member.html
|
||||||
|
'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-name.html
|
||||||
|
'name': ['parseNamePath', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-namespace.html
|
||||||
|
'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-private.html
|
||||||
|
'private': ['parseType', 'parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-protected.html
|
||||||
|
'protected': ['parseType', 'parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-public.html
|
||||||
|
'public': ['parseType', 'parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-readonly.html
|
||||||
|
'readonly': ['ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-requires.html
|
||||||
|
'requires': ['parseNamePath', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-since.html
|
||||||
|
'since': ['parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-static.html
|
||||||
|
'static': ['ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-summary.html
|
||||||
|
'summary': ['parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-this.html
|
||||||
|
'this': ['parseThis', 'ensureEnd'],
|
||||||
|
// http://usejsdoc.org/tags-todo.html
|
||||||
|
'todo': ['parseDescription'],
|
||||||
|
// http://usejsdoc.org/tags-typedef.html
|
||||||
|
'typedef': ['parseType', 'parseNamePathOptional'],
|
||||||
|
// http://usejsdoc.org/tags-variation.html
|
||||||
|
'variation': ['parseVariation'],
|
||||||
|
// http://usejsdoc.org/tags-version.html
|
||||||
|
'version': ['parseDescription']
|
||||||
|
};
|
||||||
|
|
||||||
|
TagParser.prototype.parse = function parse() {
|
||||||
|
var i, iz, sequences, method;
|
||||||
|
|
||||||
|
|
||||||
|
// empty title
|
||||||
|
if (!this._title) {
|
||||||
|
if (!this.addError('Missing or invalid title')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seek to content last index.
|
||||||
|
this._last = seekContent(this._title);
|
||||||
|
|
||||||
|
if (this._options.range) {
|
||||||
|
this._tag.range = [this._first, source.slice(0, this._last).replace(/\s*$/, '').length].map(convertIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasOwnProperty(Rules, this._title)) {
|
||||||
|
sequences = Rules[this._title];
|
||||||
|
} else {
|
||||||
|
// default sequences
|
||||||
|
sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue'];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, iz = sequences.length; i < iz; ++i) {
|
||||||
|
method = sequences[i];
|
||||||
|
if (!this[method]()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._tag;
|
||||||
|
};
|
||||||
|
|
||||||
|
function parseTag(options) {
|
||||||
|
var title, parser, tag;
|
||||||
|
|
||||||
|
// skip to tag
|
||||||
|
if (!skipToTag()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// scan title
|
||||||
|
title = scanTitle();
|
||||||
|
|
||||||
|
// construct tag parser
|
||||||
|
parser = new TagParser(options, title);
|
||||||
|
tag = parser.parse();
|
||||||
|
|
||||||
|
// Seek global index to end of this tag.
|
||||||
|
while (index < parser._last) {
|
||||||
|
advance();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parse JSDoc
|
||||||
|
//
|
||||||
|
|
||||||
|
function scanJSDocDescription(preserveWhitespace) {
|
||||||
|
var description = '', ch, atAllowed;
|
||||||
|
|
||||||
|
atAllowed = true;
|
||||||
|
while (index < length) {
|
||||||
|
ch = source.charCodeAt(index);
|
||||||
|
|
||||||
|
if (atAllowed && ch === 0x40 /* '@' */) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esutils.code.isLineTerminator(ch)) {
|
||||||
|
atAllowed = true;
|
||||||
|
} else if (atAllowed && !esutils.code.isWhiteSpace(ch)) {
|
||||||
|
atAllowed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
description += advance();
|
||||||
|
}
|
||||||
|
|
||||||
|
return preserveWhitespace ? description : description.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse(comment, options) {
|
||||||
|
var tags = [], tag, description, interestingTags, i, iz;
|
||||||
|
|
||||||
|
if (options === undefined) {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof options.unwrap === 'boolean' && options.unwrap) {
|
||||||
|
source = unwrapComment(comment);
|
||||||
|
} else {
|
||||||
|
source = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
originalSource = comment;
|
||||||
|
|
||||||
|
// array of relevant tags
|
||||||
|
if (options.tags) {
|
||||||
|
if (Array.isArray(options.tags)) {
|
||||||
|
interestingTags = { };
|
||||||
|
for (i = 0, iz = options.tags.length; i < iz; i++) {
|
||||||
|
if (typeof options.tags[i] === 'string') {
|
||||||
|
interestingTags[options.tags[i]] = true;
|
||||||
|
} else {
|
||||||
|
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
length = source.length;
|
||||||
|
index = 0;
|
||||||
|
lineNumber = 0;
|
||||||
|
recoverable = options.recoverable;
|
||||||
|
sloppy = options.sloppy;
|
||||||
|
strict = options.strict;
|
||||||
|
|
||||||
|
description = scanJSDocDescription(options.preserveWhitespace);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
tag = parseTag(options);
|
||||||
|
if (!tag) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) {
|
||||||
|
tags.push(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
description: description,
|
||||||
|
tags: tags
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.parse = parse;
|
||||||
|
}(jsdoc = {}));
|
||||||
|
|
||||||
|
exports.version = utility.VERSION;
|
||||||
|
exports.parse = jsdoc.parse;
|
||||||
|
exports.parseType = typed.parseType;
|
||||||
|
exports.parseParamType = typed.parseParamType;
|
||||||
|
exports.unwrapComment = unwrapComment;
|
||||||
|
exports.Syntax = shallowCopy(typed.Syntax);
|
||||||
|
exports.Error = utility.DoctrineError;
|
||||||
|
exports.type = {
|
||||||
|
Syntax: exports.Syntax,
|
||||||
|
parseType: typed.parseType,
|
||||||
|
parseParamType: typed.parseParamType,
|
||||||
|
stringify: typed.stringify
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
/* vim: set sw=4 ts=4 et tw=80 : */
|
1305
node_modules/doctrine/lib/typed.js
generated
vendored
Normal file
1305
node_modules/doctrine/lib/typed.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35
node_modules/doctrine/lib/utility.js
generated
vendored
Normal file
35
node_modules/doctrine/lib/utility.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* @fileoverview Utilities for Doctrine
|
||||||
|
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var VERSION;
|
||||||
|
|
||||||
|
VERSION = require('../package.json').version;
|
||||||
|
exports.VERSION = VERSION;
|
||||||
|
|
||||||
|
function DoctrineError(message) {
|
||||||
|
this.name = 'DoctrineError';
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
DoctrineError.prototype = (function () {
|
||||||
|
var Middle = function () { };
|
||||||
|
Middle.prototype = Error.prototype;
|
||||||
|
return new Middle();
|
||||||
|
}());
|
||||||
|
DoctrineError.prototype.constructor = DoctrineError;
|
||||||
|
exports.DoctrineError = DoctrineError;
|
||||||
|
|
||||||
|
function throwError(message) {
|
||||||
|
throw new DoctrineError(message);
|
||||||
|
}
|
||||||
|
exports.throwError = throwError;
|
||||||
|
|
||||||
|
exports.assert = require('assert');
|
||||||
|
}());
|
||||||
|
|
||||||
|
/* vim: set sw=4 ts=4 et tw=80 : */
|
89
node_modules/doctrine/package.json
generated
vendored
Normal file
89
node_modules/doctrine/package.json
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
{
|
||||||
|
"_from": "doctrine@^3.0.0",
|
||||||
|
"_id": "doctrine@3.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
|
||||||
|
"_location": "/doctrine",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "doctrine@^3.0.0",
|
||||||
|
"name": "doctrine",
|
||||||
|
"escapedName": "doctrine",
|
||||||
|
"rawSpec": "^3.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^3.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/modernizr"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||||
|
"_shasum": "addebead72a6574db783639dc87a121773973961",
|
||||||
|
"_spec": "doctrine@^3.0.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\modernizr",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/eslint/doctrine/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"esutils": "^2.0.2"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "JSDoc parser",
|
||||||
|
"devDependencies": {
|
||||||
|
"coveralls": "^3.0.1",
|
||||||
|
"dateformat": "^1.0.11",
|
||||||
|
"eslint": "^1.10.3",
|
||||||
|
"eslint-release": "^1.0.0",
|
||||||
|
"linefix": "^0.1.1",
|
||||||
|
"mocha": "^3.4.2",
|
||||||
|
"npm-license": "^0.3.1",
|
||||||
|
"nyc": "^10.3.2",
|
||||||
|
"semver": "^5.0.3",
|
||||||
|
"shelljs": "^0.5.3",
|
||||||
|
"shelljs-nodecli": "^0.1.1",
|
||||||
|
"should": "^5.0.1"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"lib": "./lib"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/eslint/doctrine",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"main": "lib/doctrine.js",
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "Nicholas C. Zakas",
|
||||||
|
"email": "nicholas+npm@nczconsulting.com",
|
||||||
|
"url": "https://www.nczonline.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Yusuke Suzuki",
|
||||||
|
"email": "utatane.tea@gmail.com",
|
||||||
|
"url": "https://github.com/Constellation"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "doctrine",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/eslint/doctrine.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"coveralls": "nyc report --reporter=text-lcov | coveralls",
|
||||||
|
"generate-alpharelease": "eslint-generate-prerelease alpha",
|
||||||
|
"generate-betarelease": "eslint-generate-prerelease beta",
|
||||||
|
"generate-rcrelease": "eslint-generate-prerelease rc",
|
||||||
|
"generate-release": "eslint-generate-release",
|
||||||
|
"lint": "eslint lib/",
|
||||||
|
"pretest": "npm run lint",
|
||||||
|
"publish-release": "eslint-publish-release",
|
||||||
|
"test": "nyc mocha"
|
||||||
|
},
|
||||||
|
"version": "3.0.0"
|
||||||
|
}
|
20
node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||||
|
|
||||||
|
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.
|
73
node_modules/emoji-regex/README.md
generated
vendored
Normal file
73
node_modules/emoji-regex/README.md
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
# emoji-regex [![Build status](https://travis-ci.org/mathiasbynens/emoji-regex.svg?branch=master)](https://travis-ci.org/mathiasbynens/emoji-regex)
|
||||||
|
|
||||||
|
_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard.
|
||||||
|
|
||||||
|
This repository contains a script that generates this regular expression based on [the data from Unicode v12](https://github.com/mathiasbynens/unicode-12.0.0). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Via [npm](https://www.npmjs.com/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install emoji-regex
|
||||||
|
```
|
||||||
|
|
||||||
|
In [Node.js](https://nodejs.org/):
|
||||||
|
|
||||||
|
```js
|
||||||
|
const emojiRegex = require('emoji-regex');
|
||||||
|
// Note: because the regular expression has the global flag set, this module
|
||||||
|
// exports a function that returns the regex rather than exporting the regular
|
||||||
|
// expression itself, to make it impossible to (accidentally) mutate the
|
||||||
|
// original regular expression.
|
||||||
|
|
||||||
|
const text = `
|
||||||
|
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
|
||||||
|
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
|
||||||
|
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
|
||||||
|
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
|
||||||
|
`;
|
||||||
|
|
||||||
|
const regex = emojiRegex();
|
||||||
|
let match;
|
||||||
|
while (match = regex.exec(text)) {
|
||||||
|
const emoji = match[0];
|
||||||
|
console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Console output:
|
||||||
|
|
||||||
|
```
|
||||||
|
Matched sequence ⌚ — code points: 1
|
||||||
|
Matched sequence ⌚ — code points: 1
|
||||||
|
Matched sequence ↔️ — code points: 2
|
||||||
|
Matched sequence ↔️ — code points: 2
|
||||||
|
Matched sequence 👩 — code points: 1
|
||||||
|
Matched sequence 👩 — code points: 1
|
||||||
|
Matched sequence 👩🏿 — code points: 2
|
||||||
|
Matched sequence 👩🏿 — code points: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const emojiRegex = require('emoji-regex/text.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const emojiRegex = require('emoji-regex/es2015/index.js');
|
||||||
|
const emojiRegexText = require('emoji-regex/es2015/text.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||||
|
|---|
|
||||||
|
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
_emoji-regex_ is available under the [MIT](https://mths.be/mit) license.
|
6
node_modules/emoji-regex/es2015/index.js
generated
vendored
Normal file
6
node_modules/emoji-regex/es2015/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/emoji-regex/es2015/text.js
generated
vendored
Normal file
6
node_modules/emoji-regex/es2015/text.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
23
node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
23
node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
declare module 'emoji-regex' {
|
||||||
|
function emojiRegex(): RegExp;
|
||||||
|
|
||||||
|
export default emojiRegex;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'emoji-regex/text' {
|
||||||
|
function emojiRegex(): RegExp;
|
||||||
|
|
||||||
|
export default emojiRegex;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'emoji-regex/es2015' {
|
||||||
|
function emojiRegex(): RegExp;
|
||||||
|
|
||||||
|
export default emojiRegex;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'emoji-regex/es2015/text' {
|
||||||
|
function emojiRegex(): RegExp;
|
||||||
|
|
||||||
|
export default emojiRegex;
|
||||||
|
}
|
6
node_modules/emoji-regex/index.js
generated
vendored
Normal file
6
node_modules/emoji-regex/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
77
node_modules/emoji-regex/package.json
generated
vendored
Normal file
77
node_modules/emoji-regex/package.json
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
{
|
||||||
|
"_from": "emoji-regex@^8.0.0",
|
||||||
|
"_id": "emoji-regex@8.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
|
"_location": "/emoji-regex",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "emoji-regex@^8.0.0",
|
||||||
|
"name": "emoji-regex",
|
||||||
|
"escapedName": "emoji-regex",
|
||||||
|
"rawSpec": "^8.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^8.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/string-width"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
"_shasum": "e818fd69ce5ccfcb404594f842963bf53164cc37",
|
||||||
|
"_spec": "emoji-regex@^8.0.0",
|
||||||
|
"_where": "C:\\Users\\knh94\\Documents\\GitHub\\welsonjs\\node_modules\\string-width",
|
||||||
|
"author": {
|
||||||
|
"name": "Mathias Bynens",
|
||||||
|
"url": "https://mathiasbynens.be/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/mathiasbynens/emoji-regex/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/cli": "^7.2.3",
|
||||||
|
"@babel/core": "^7.3.4",
|
||||||
|
"@babel/plugin-proposal-unicode-property-regex": "^7.2.0",
|
||||||
|
"@babel/preset-env": "^7.3.4",
|
||||||
|
"mocha": "^6.0.2",
|
||||||
|
"regexgen": "^1.3.0",
|
||||||
|
"unicode-12.0.0": "^0.7.9"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE-MIT.txt",
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts",
|
||||||
|
"text.js",
|
||||||
|
"es2015/index.js",
|
||||||
|
"es2015/text.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://mths.be/emoji-regex",
|
||||||
|
"keywords": [
|
||||||
|
"unicode",
|
||||||
|
"regex",
|
||||||
|
"regexp",
|
||||||
|
"regular expressions",
|
||||||
|
"code points",
|
||||||
|
"symbols",
|
||||||
|
"characters",
|
||||||
|
"emoji"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "emoji-regex",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/mathiasbynens/emoji-regex.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js",
|
||||||
|
"test": "mocha",
|
||||||
|
"test:watch": "npm run test -- --watch"
|
||||||
|
},
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"version": "8.0.0"
|
||||||
|
}
|
6
node_modules/emoji-regex/text.js
generated
vendored
Normal file
6
node_modules/emoji-regex/text.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/entities/LICENSE
generated
vendored
Normal file
11
node_modules/entities/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Copyright (c) Felix Böhm
|
||||||
|
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.
|
||||||
|
|
||||||
|
THIS 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 HOLDER 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,
|
||||||
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
7
node_modules/entities/lib/decode.d.ts
generated
vendored
Normal file
7
node_modules/entities/lib/decode.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
export declare const decodeXML: (str: string) => string;
|
||||||
|
export declare const decodeHTMLStrict: (str: string) => string;
|
||||||
|
export interface MapType {
|
||||||
|
[key: string]: string;
|
||||||
|
}
|
||||||
|
export declare const decodeHTML: (str: string) => string;
|
||||||
|
//# sourceMappingURL=decode.d.ts.map
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user