upload site
0
README.md
Normal file
BIN
assets/.DS_Store
vendored
Normal file
19
assets/css/_functions.scss
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
@mixin centerer($horizontal: true, $vertical: true) {
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
@if ($horizontal and $vertical) {
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
@else if ($horizontal) {
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@else if ($vertical) {
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(0, -50%);
|
||||||
|
}
|
||||||
|
}
|
116
assets/css/main.css
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
@import url("https://fonts.googleapis.com/css?family=Poppins&display=swap");
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #2e40ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
section#main {
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.tip {
|
||||||
|
color: white;
|
||||||
|
font-size: 2vw;
|
||||||
|
padding-top: 40vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
section#socials {
|
||||||
|
font-size: 5vw;
|
||||||
|
height: 80%;
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
text-align: center;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
-webkit-box-pack: center;
|
||||||
|
-ms-flex-pack: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
a svg {
|
||||||
|
max-width: 3ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
margin: 2vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
background: -webkit-gradient(linear, left bottom, right top, from(#000000), to(#2e40ff));
|
||||||
|
background: linear-gradient(to top right, #000000, #2e40ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
header#name {
|
||||||
|
padding-left: 2vw;
|
||||||
|
padding-top: 1vh;
|
||||||
|
padding-bottom: 1vh;
|
||||||
|
color: white;
|
||||||
|
font-size: 4vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.twitter {
|
||||||
|
fill: #1DA1F2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Discord {
|
||||||
|
fill: #7289da;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Github {
|
||||||
|
fill: #181717;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Instagram {
|
||||||
|
fill: #E4405F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.FurAffinity {
|
||||||
|
fill: #FAAF3A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.telegram {
|
||||||
|
fill: #2CA5E0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 100px;
|
||||||
|
-webkit-transition: all 1s ease-in-out .1s, -webkit-transform .5s;
|
||||||
|
transition: all 1s ease-in-out .1s, -webkit-transform .5s;
|
||||||
|
transition: transform .5s, all 1s ease-in-out .1s;
|
||||||
|
transition: transform .5s, all 1s ease-in-out .1s, -webkit-transform .5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon:hover {
|
||||||
|
-webkit-transform: translateY(-1vh);
|
||||||
|
transform: translateY(-1vh);
|
||||||
|
}
|
||||||
|
|
||||||
|
.credits {
|
||||||
|
font-size: 2.5vh;
|
||||||
|
padding: .5vh;
|
||||||
|
color: #ffffff49;
|
||||||
|
z-index: 999;
|
||||||
|
cursor: pointer;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.credits a {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #ffffff49;
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.credits a:hover {
|
||||||
|
color: #ffffff49;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=main.css.map */
|
9
assets/css/main.css.map
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"mappings": "AAAA,OAAO,CAAC,mEAAI;AAGZ,AAAA,CAAC,CAAC;EACD,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;EACV,WAAW,EAAE,qBAAqB;CAAG;;AAEtC,AAAA,IAAI,CAAC;EACJ,gBAAgB,EAAE,OAAO;CAAG;;AAE7B,AAAA,OAAO,AAAA,KAAK,CAAC;EACZ,UAAU,EAAE,MAAM;EAClB,MAAM,EAAE,IAAI;EACZ,gBAAgB,EAAE,OAAO;CAAG;;AAG7B,AAAA,CAAC,AAAA,IAAI,CAAC;EACL,KAAK,EAAE,KAAK;EACZ,SAAS,EAAE,GAAG;EAEd,WAAW,EAAE,IAAI;CAAG;;AAErB,AAAA,OAAO,AAAA,QAAQ,CAAC;EACf,SAAS,EAAE,GAAG;EACd,MAAM,EAAE,GAAG;EACX,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,MAAM;EAClB,WAAW,EAAE,MAAM;EACnB,eAAe,EAAE,MAAM;CAAG;;AAE3B,AAAA,CAAC,CAAC,GAAG,CAAC;EACL,SAAS,EAAE,GAAG;CAAG;;AAElB,AAAA,CAAC,CAAC;EACD,MAAM,EAAE,GAAG;CAAG;;AAEf,AAAA,KAAK,CAAC;EACL,UAAU,EAAE,+CAA8C;CAAG;;AAE9D,AAAA,MAAM,AAAA,KAAK,CAAC;EACX,YAAY,EAAE,GAAG;EACjB,WAAW,EAAE,GAAG;EAChB,cAAc,EAAE,GAAG;EACnB,KAAK,EAAE,KAAK;EACZ,SAAS,EAAE,GAAG;CAAG;;AAElB,AAAA,QAAQ,CAAC;EACR,IAAI,EAAE,OAAO;CAAG;;AACjB,AAAA,QAAQ,CAAC;EACR,IAAI,EAAE,OAAO;CAAG;;AACjB,AAAA,OAAO,CAAC;EACP,IAAI,EAAE,OAAO;CAAG;;AACjB,AAAA,UAAU,CAAC;EACV,IAAI,EAAE,OAAO;CAAG;;AACjB,AAAA,YAAY,CAAC;EACZ,IAAI,EAAE,OAAO;CAAG;;AACjB,AAAA,SAAS,CAAC;EACT,IAAI,EAAE,OAAO;CAAG;;AAGjB,AAAA,KAAK,CAAC;EACL,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,qCAAqC;CAAG;;AACrD,AAAA,KAAK,AAAA,MAAM,CAAC;EACX,SAAS,EAAE,gBAAgB;CAAG;;AAG/B,AAAA,QAAQ,CAAC;EACR,SAAS,EAAE,KAAK;EAChB,OAAO,EAAE,IAAI;EACb,KAAK,EAAE,SAAS;EAChB,OAAO,EAAE,GAAG;EACZ,MAAM,EAAE,OAAO;EACf,cAAc,EAAE,IAAI;CAQE;;AAdvB,AAOC,QAPO,CAOP,CAAC,CAAC;EACD,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;EACV,KAAK,EAAE,SAAS;EAChB,cAAc,EAAE,GAAG;CAAG;;AAXxB,AAaC,QAbO,CAaP,CAAC,AAAA,MAAM,CAAC;EACP,KAAK,EAAE,SAAS;CAAG",
|
||||||
|
"sources": [
|
||||||
|
"main.sass"
|
||||||
|
],
|
||||||
|
"names": [],
|
||||||
|
"file": "main.css"
|
||||||
|
}
|
83
assets/css/main.sass
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Poppins&display=swap');
|
||||||
|
|
||||||
|
|
||||||
|
*
|
||||||
|
margin: 0
|
||||||
|
padding: 0
|
||||||
|
font-family: 'Poppins', sans-serif
|
||||||
|
|
||||||
|
body
|
||||||
|
background-color: #2e40ff
|
||||||
|
|
||||||
|
section#main
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000000;
|
||||||
|
|
||||||
|
|
||||||
|
p.tip
|
||||||
|
color: white
|
||||||
|
font-size: 2vw
|
||||||
|
display:
|
||||||
|
padding-top: 40vh
|
||||||
|
|
||||||
|
section#socials
|
||||||
|
font-size: 5vw
|
||||||
|
height: 80%
|
||||||
|
display: flex
|
||||||
|
text-align: center
|
||||||
|
align-items: center
|
||||||
|
justify-content: center
|
||||||
|
|
||||||
|
a svg
|
||||||
|
max-width: 3ch
|
||||||
|
|
||||||
|
a
|
||||||
|
margin: 2vw
|
||||||
|
|
||||||
|
#main
|
||||||
|
background: linear-gradient(to top right,#000000, #2e40ff)
|
||||||
|
|
||||||
|
header#name
|
||||||
|
padding-left: 2vw
|
||||||
|
padding-top: 1vh
|
||||||
|
padding-bottom: 1vh
|
||||||
|
color: white
|
||||||
|
font-size: 4vh
|
||||||
|
|
||||||
|
.twitter
|
||||||
|
fill: #1DA1F2
|
||||||
|
.Discord
|
||||||
|
fill: #7289da
|
||||||
|
.Github
|
||||||
|
fill: #181717
|
||||||
|
.Instagram
|
||||||
|
fill: #E4405F
|
||||||
|
.FurAffinity
|
||||||
|
fill: #FAAF3A
|
||||||
|
.telegram
|
||||||
|
fill: #2CA5E0
|
||||||
|
|
||||||
|
|
||||||
|
.icon
|
||||||
|
width: 100px
|
||||||
|
transition: transform .5s, all 1s ease-in-out .1s
|
||||||
|
.icon:hover
|
||||||
|
transform: translateY(-1vh)
|
||||||
|
|
||||||
|
|
||||||
|
.credits
|
||||||
|
font-size: 2.5vh;
|
||||||
|
padding: .5vh;
|
||||||
|
color: #ffffff49;
|
||||||
|
z-index: 999;
|
||||||
|
cursor: pointer;
|
||||||
|
pointer-events: none;
|
||||||
|
a
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #ffffff49;
|
||||||
|
pointer-events: all;
|
||||||
|
|
||||||
|
a:hover
|
||||||
|
color: #ffffff49;
|
1
assets/icons/discord.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discord icon</title><path d="M20.222 0c1.406 0 2.54 1.137 2.607 2.475V24l-2.677-2.273-1.47-1.338-1.604-1.398.67 2.205H3.71c-1.402 0-2.54-1.065-2.54-2.476V2.48C1.17 1.142 2.31.003 3.715.003h16.5L20.222 0zm-6.118 5.683h-.03l-.202.2c2.073.6 3.076 1.537 3.076 1.537-1.336-.668-2.54-1.002-3.744-1.137-.87-.135-1.74-.064-2.475 0h-.2c-.47 0-1.47.2-2.81.735-.467.203-.735.336-.735.336s1.002-1.002 3.21-1.537l-.135-.135s-1.672-.064-3.477 1.27c0 0-1.805 3.144-1.805 7.02 0 0 1 1.74 3.743 1.806 0 0 .4-.533.805-1.002-1.54-.468-2.14-1.404-2.14-1.404s.134.066.335.2h.06c.03 0 .044.015.06.03v.006c.016.016.03.03.06.03.33.136.66.27.93.4.466.202 1.065.403 1.8.536.93.135 1.996.2 3.21 0 .6-.135 1.2-.267 1.8-.535.39-.2.87-.4 1.397-.737 0 0-.6.936-2.205 1.404.33.466.795 1 .795 1 2.744-.06 3.81-1.8 3.87-1.726 0-3.87-1.815-7.02-1.815-7.02-1.635-1.214-3.165-1.26-3.435-1.26l.056-.02zm.168 4.413c.703 0 1.27.6 1.27 1.335 0 .74-.57 1.34-1.27 1.34-.7 0-1.27-.6-1.27-1.334.002-.74.573-1.338 1.27-1.338zm-4.543 0c.7 0 1.266.6 1.266 1.335 0 .74-.57 1.34-1.27 1.34-.7 0-1.27-.6-1.27-1.334 0-.74.57-1.338 1.27-1.338z"/></svg>
|
After Width: | Height: | Size: 1.1 KiB |
1
assets/icons/gitdab.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Git icon</title><path d="M23.546 10.93L13.067.452c-.604-.603-1.582-.603-2.188 0L8.708 2.627l2.76 2.76c.645-.215 1.379-.07 1.889.441.516.515.658 1.258.438 1.9l2.658 2.66c.645-.223 1.387-.078 1.9.435.721.72.721 1.884 0 2.604-.719.719-1.881.719-2.6 0-.539-.541-.674-1.337-.404-1.996L12.86 8.955v6.525c.176.086.342.203.488.348.713.721.713 1.883 0 2.6-.719.721-1.889.721-2.609 0-.719-.719-.719-1.879 0-2.598.182-.18.387-.316.605-.406V8.835c-.217-.091-.424-.222-.6-.401-.545-.545-.676-1.342-.396-2.009L7.636 3.7.45 10.881c-.6.605-.6 1.584 0 2.189l10.48 10.477c.604.604 1.582.604 2.186 0l10.43-10.43c.605-.603.605-1.582 0-2.187"/></svg>
|
After Width: | Height: | Size: 707 B |
1
assets/icons/github.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub icon</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
|
After Width: | Height: | Size: 827 B |
1
assets/icons/gitlab.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitLab icon</title><path d="M23.955 13.587l-1.342-4.135-2.664-8.189c-.135-.423-.73-.423-.867 0L16.418 9.45H7.582L4.919 1.263C4.783.84 4.185.84 4.05 1.26L1.386 9.449.044 13.587c-.121.375.014.789.331 1.023L12 23.054l11.625-8.443c.318-.235.453-.647.33-1.024"/></svg>
|
After Width: | Height: | Size: 341 B |
1
assets/icons/keybase.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Keybase icon</title><path d="M10.446 21.371c0 .528-.428.953-.954.953-.525 0-.954-.425-.954-.953 0-.526.428-.954.953-.954.524 0 .951.431.951.955m5.922-.001c0 .528-.428.953-.955.953-.526 0-.952-.425-.952-.953 0-.526.423-.954.949-.954s.954.431.954.955M20.904 12.213l-.156-.204c-.046-.06-.096-.116-.143-.175-.045-.061-.094-.113-.141-.169-.104-.12-.209-.239-.319-.359l-.076-.08-.091-.099-.135-.131c-.015-.018-.032-.034-.05-.053-1.16-1.139-2.505-1.986-3.955-2.504l-.23-.078c.012-.027.024-.055.035-.083.41-1.064.367-2.223-.12-3.255-.491-1.035-1.356-1.8-2.438-2.16-.656-.216-1.23-.319-1.711-.305-.033-.105-.1-.577.496-1.848L10.663 0l-.287.399c-.33.455-.648.895-.945 1.328-.328-.345-.766-.552-1.245-.58L6.79 1.061h-.012c-.033-.003-.07-.003-.104-.003-.99 0-1.81.771-1.87 1.755l-.088 1.402v.003c-.061 1.029.727 1.915 1.755 1.979l1.002.061c-.065.84.073 1.62.405 2.306-1.346.562-2.586 1.401-3.66 2.484C.913 14.391.913 18.051.913 20.994v1.775l1.305-1.387c.266.93.652 1.807 1.145 2.615H5.06c-.833-1.114-1.419-2.426-1.68-3.848l1.913-2.03-.985 3.091 1.74-1.268c3.075-2.234 6.744-2.75 10.91-1.529 1.805.532 3.56.039 4.473-1.257l.104-.165c.091.498.141.998.141 1.496 0 1.563-.255 3.687-1.38 5.512h1.611c.776-1.563 1.181-3.432 1.181-5.512-.001-2.199-.786-4.421-2.184-6.274zM8.894 6.191c.123-1.002.578-1.949 1.23-2.97.025.05.054.097.084.144.264.398.713.625 1.199.605.217-.008.605.025 1.233.232.714.236 1.286.744 1.608 1.425s.349 1.442.079 2.149c-.173.445-.454.82-.806 1.109l-.408-.502-.002-.003c-.279-.341-.694-.535-1.134-.535-.335 0-.664.117-.925.33-.334.27-.514.66-.534 1.058-1.2-.541-1.8-1.643-1.628-3.041l.004-.001zm4.304 5.11l-.519.425c-.046.036-.095.053-.146.053-.066 0-.133-.03-.177-.085l-.111-.135c-.083-.1-.067-.25.034-.334l.51-.42-1.055-1.299c-.109-.133-.091-.33.044-.436.058-.048.126-.072.194-.072.091 0 .181.038.24.113l2.963 3.645c.109.135.09.33-.042.436-.039.029-.082.053-.126.063-.023.006-.045.009-.07.009-.09 0-.178-.04-.24-.113l-.295-.365-1.045.854c-.046.037-.1.055-.154.055-.068 0-.139-.03-.186-.09l-.477-.579c-.082-.102-.068-.252.035-.336l1.051-.857-.426-.533-.002.001zM7.753 4.866l-1.196-.075c-.255-.015-.45-.235-.435-.488l.09-1.401c.014-.245.216-.436.461-.436h.024l1.401.091c.123.006.236.06.317.152.083.094.123.21.116.336l-.007.101c-.32.567-.585 1.134-.773 1.72h.002zm12.524 11.481c-.565.805-1.687 1.081-2.924.718-3.886-1.141-7.396-.903-10.468.701l1.636-5.123-5.291 5.609c.099-3.762 2.453-6.966 5.758-8.311.471.373 1.034.66 1.673.841.16.044.322.074.48.102-.183.458-.119.997.21 1.407l.075.09c-.172.45-.105.975.221 1.374l.475.582c.266.325.659.513 1.079.513.321 0 .635-.111.886-.314l.285-.232c.174.074.367.113.566.113.113 0 .222-.01.33-.035.218-.05.424-.15.598-.291.623-.51.72-1.435.209-2.06l-1.67-2.056c.145-.117.281-.244.408-.381.135.037.271.078.4.12.266.097.533.198.795.315 1.005.445 1.954 1.1 2.771 1.897.029.03.059.055.085.083l.17.175c.038.039.076.079.111.12.079.085.16.175.239.267l.126.15c.045.053.086.104.13.16l.114.15c.04.051.079.102.117.154.838 1.149.987 2.329.404 3.157v.005zM7.719 4.115l-.835-.051.053-.835.834.051-.052.835z"/></svg>
|
After Width: | Height: | Size: 3 KiB |
1
assets/icons/mastodon.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Mastodon icon</title><path d="M23.193 7.879c0-5.206-3.411-6.732-3.411-6.732C18.062.357 15.108.025 12.041 0h-.076c-3.068.025-6.02.357-7.74 1.147 0 0-3.411 1.526-3.411 6.732 0 1.192-.023 2.618.015 4.129.124 5.092.934 10.109 5.641 11.355 2.17.574 4.034.695 5.535.612 2.722-.15 4.25-.972 4.25-.972l-.09-1.975s-1.945.613-4.129.539c-2.165-.074-4.449-.233-4.799-2.891a5.499 5.499 0 0 1-.048-.745s2.125.52 4.817.643c1.646.075 3.19-.097 4.758-.283 3.007-.359 5.625-2.212 5.954-3.905.517-2.665.475-6.507.475-6.507zm-4.024 6.709h-2.497V8.469c0-1.29-.543-1.944-1.628-1.944-1.2 0-1.802.776-1.802 2.312v3.349h-2.483v-3.35c0-1.536-.602-2.312-1.802-2.312-1.085 0-1.628.655-1.628 1.944v6.119H4.832V8.284c0-1.289.328-2.313.987-3.07.68-.758 1.569-1.146 2.674-1.146 1.278 0 2.246.491 2.886 1.474L12 6.585l.622-1.043c.64-.983 1.608-1.474 2.886-1.474 1.104 0 1.994.388 2.674 1.146.658.757.986 1.781.986 3.07v6.304z"/></svg>
|
After Width: | Height: | Size: 979 B |
1
assets/icons/patreon.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Patreon icon</title><path d="M15.386.524c-4.764 0-8.64 3.876-8.64 8.64 0 4.75 3.876 8.613 8.64 8.613 4.75 0 8.614-3.864 8.614-8.613C24 4.4 20.136.524 15.386.524M.003 23.537h4.22V.524H.003"/></svg>
|
After Width: | Height: | Size: 274 B |
1
assets/icons/steam.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Steam icon</title><path d="M11.979 0C5.678 0 .511 4.86.022 11.037l6.432 2.658c.545-.371 1.203-.59 1.912-.59.063 0 .125.004.188.006l2.861-4.142V8.91c0-2.495 2.028-4.524 4.524-4.524 2.494 0 4.524 2.031 4.524 4.527s-2.03 4.525-4.524 4.525h-.105l-4.076 2.911c0 .052.004.105.004.159 0 1.875-1.515 3.396-3.39 3.396-1.635 0-3.016-1.173-3.331-2.727L.436 15.27C1.862 20.307 6.486 24 11.979 24c6.627 0 11.999-5.373 11.999-12S18.605 0 11.979 0zM7.54 18.21l-1.473-.61c.262.543.714.999 1.314 1.25 1.297.539 2.793-.076 3.332-1.375.263-.63.264-1.319.005-1.949s-.75-1.121-1.377-1.383c-.624-.26-1.29-.249-1.878-.03l1.523.63c.956.4 1.409 1.5 1.009 2.455-.397.957-1.497 1.41-2.454 1.012H7.54zm11.415-9.303c0-1.662-1.353-3.015-3.015-3.015-1.665 0-3.015 1.353-3.015 3.015 0 1.665 1.35 3.015 3.015 3.015 1.663 0 3.015-1.35 3.015-3.015zm-5.273-.005c0-1.252 1.013-2.266 2.265-2.266 1.249 0 2.266 1.014 2.266 2.266 0 1.251-1.017 2.265-2.266 2.265-1.253 0-2.265-1.014-2.265-2.265z"/></svg>
|
After Width: | Height: | Size: 1 KiB |
1
assets/icons/twitch.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch icon</title><path d="M2.089 0L.525 4.175v16.694h5.736V24h3.132l3.127-3.132h4.695l6.26-6.258V0H2.089zm2.086 2.085H21.39v11.479l-3.652 3.652H12l-3.127 3.127v-3.127H4.175V2.085zM9.915 12.522H12v-6.26H9.915v6.26zm5.735 0h2.086v-6.26H15.65v6.26z"/></svg>
|
After Width: | Height: | Size: 334 B |
1
assets/icons/twitter.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitter icon</title><path d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"/></svg>
|
After Width: | Height: | Size: 757 B |
BIN
assets/images/.DS_Store
vendored
Normal file
BIN
assets/images/icon.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
assets/images/kyosho/.DS_Store
vendored
Normal file
BIN
assets/images/kyosho/KYOSHO.png
Normal file
After Width: | Height: | Size: 526 KiB |
BIN
assets/images/kyosho/Kyosho-CherryBlossom1.png
Normal file
After Width: | Height: | Size: 13 MiB |
BIN
assets/images/kyosho/Kyosho-CherryBlossom2.png
Normal file
After Width: | Height: | Size: 9.8 MiB |
1
assets/js/lore.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
console.log('Lore Page');
|
32
assets/js/main.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
let scheme = window.matchMedia(`(prefers-color-scheme: dark)`);
|
||||||
|
let theme = window.localStorage.getItem('prefer-light');
|
||||||
|
let title = document.getElementsByClassName('title')[0];
|
||||||
|
let body = document.getElementsByTagName('body')[0];
|
||||||
|
let toggle = document.getElementsByClassName('toggle')[0];
|
||||||
|
|
||||||
|
if (theme === 'yes') {
|
||||||
|
body.classList.add('light');
|
||||||
|
} else if (theme === 'no') {
|
||||||
|
console.log('User does not like light, removing Light');
|
||||||
|
body.classList.remove('light');
|
||||||
|
} else {
|
||||||
|
if (scheme) {
|
||||||
|
body.classList.remove('light');
|
||||||
|
console.log('User has not yet visited, but prefers dark');
|
||||||
|
} else {
|
||||||
|
body.classList.add('light');
|
||||||
|
console.log('User has not yet visited, but prefers light');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle.addEventListener('click', (e) => {
|
||||||
|
//console.log(e);
|
||||||
|
body.classList.toggle('light');
|
||||||
|
if (body.classList.contains('light')) {
|
||||||
|
window.localStorage.setItem('prefer-light', 'yes');
|
||||||
|
console.log('user likes light');
|
||||||
|
} else {
|
||||||
|
window.localStorage.setItem('prefer-light', 'no');
|
||||||
|
console.log('user likes dark');
|
||||||
|
}
|
||||||
|
});
|
3
constants.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
name: 'benji.monster',
|
||||||
|
};
|
1
node_modules/.bin/handlebars
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../handlebars/bin/handlebars
|
1
node_modules/.bin/is-ci
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../is-ci/bin.js
|
1
node_modules/.bin/mime
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../mime/cli.js
|
1
node_modules/.bin/nodemon
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../nodemon/bin/nodemon.js
|
1
node_modules/.bin/nodetouch
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../touch/bin/nodetouch.js
|
1
node_modules/.bin/nopt
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../nopt/bin/nopt.js
|
1
node_modules/.bin/rc
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../rc/cli.js
|
1
node_modules/.bin/semver
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../semver/bin/semver
|
1
node_modules/.bin/uglifyjs
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../uglify-js/bin/uglifyjs
|
1
node_modules/.bin/which
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../which/bin/which
|
46
node_modules/abbrev/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
This software is dual-licensed under the ISC and MIT licenses.
|
||||||
|
You may use this software under EITHER of the following licenses.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
Copyright Isaac Z. Schlueter and Contributors
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
23
node_modules/abbrev/README.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# abbrev-js
|
||||||
|
|
||||||
|
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
var abbrev = require("abbrev");
|
||||||
|
abbrev("foo", "fool", "folding", "flop");
|
||||||
|
|
||||||
|
// returns:
|
||||||
|
{ fl: 'flop'
|
||||||
|
, flo: 'flop'
|
||||||
|
, flop: 'flop'
|
||||||
|
, fol: 'folding'
|
||||||
|
, fold: 'folding'
|
||||||
|
, foldi: 'folding'
|
||||||
|
, foldin: 'folding'
|
||||||
|
, folding: 'folding'
|
||||||
|
, foo: 'foo'
|
||||||
|
, fool: 'fool'
|
||||||
|
}
|
||||||
|
|
||||||
|
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
|
61
node_modules/abbrev/abbrev.js
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
module.exports = exports = abbrev.abbrev = abbrev
|
||||||
|
|
||||||
|
abbrev.monkeyPatch = monkeyPatch
|
||||||
|
|
||||||
|
function monkeyPatch () {
|
||||||
|
Object.defineProperty(Array.prototype, 'abbrev', {
|
||||||
|
value: function () { return abbrev(this) },
|
||||||
|
enumerable: false, configurable: true, writable: true
|
||||||
|
})
|
||||||
|
|
||||||
|
Object.defineProperty(Object.prototype, 'abbrev', {
|
||||||
|
value: function () { return abbrev(Object.keys(this)) },
|
||||||
|
enumerable: false, configurable: true, writable: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function abbrev (list) {
|
||||||
|
if (arguments.length !== 1 || !Array.isArray(list)) {
|
||||||
|
list = Array.prototype.slice.call(arguments, 0)
|
||||||
|
}
|
||||||
|
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
|
||||||
|
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort them lexicographically, so that they're next to their nearest kin
|
||||||
|
args = args.sort(lexSort)
|
||||||
|
|
||||||
|
// walk through each, seeing how much it has in common with the next and previous
|
||||||
|
var abbrevs = {}
|
||||||
|
, prev = ""
|
||||||
|
for (var i = 0, l = args.length ; i < l ; i ++) {
|
||||||
|
var current = args[i]
|
||||||
|
, next = args[i + 1] || ""
|
||||||
|
, nextMatches = true
|
||||||
|
, prevMatches = true
|
||||||
|
if (current === next) continue
|
||||||
|
for (var j = 0, cl = current.length ; j < cl ; j ++) {
|
||||||
|
var curChar = current.charAt(j)
|
||||||
|
nextMatches = nextMatches && curChar === next.charAt(j)
|
||||||
|
prevMatches = prevMatches && curChar === prev.charAt(j)
|
||||||
|
if (!nextMatches && !prevMatches) {
|
||||||
|
j ++
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prev = current
|
||||||
|
if (j === cl) {
|
||||||
|
abbrevs[current] = current
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
|
||||||
|
abbrevs[a] = current
|
||||||
|
a += current.charAt(j)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return abbrevs
|
||||||
|
}
|
||||||
|
|
||||||
|
function lexSort (a, b) {
|
||||||
|
return a === b ? 0 : a > b ? 1 : -1
|
||||||
|
}
|
59
node_modules/abbrev/package.json
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"abbrev@1.1.1",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "abbrev@1.1.1",
|
||||||
|
"_id": "abbrev@1.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
||||||
|
"_location": "/abbrev",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "abbrev@1.1.1",
|
||||||
|
"name": "abbrev",
|
||||||
|
"escapedName": "abbrev",
|
||||||
|
"rawSpec": "1.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/nopt"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
|
"_spec": "1.1.1",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/abbrev-js/issues"
|
||||||
|
},
|
||||||
|
"description": "Like ruby's abbrev module, but in js",
|
||||||
|
"devDependencies": {
|
||||||
|
"tap": "^10.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"abbrev.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/abbrev-js#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "abbrev.js",
|
||||||
|
"name": "abbrev",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postpublish": "git push origin --all; git push origin --tags",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"test": "tap test.js --100"
|
||||||
|
},
|
||||||
|
"version": "1.1.1"
|
||||||
|
}
|
236
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
1.3.7 / 2019-04-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.6.2
|
||||||
|
- Fix sorting charset, encoding, and language with extra parameters
|
||||||
|
|
||||||
|
1.3.6 / 2019-04-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.24
|
||||||
|
- deps: mime-db@~1.40.0
|
||||||
|
|
||||||
|
1.3.5 / 2018-02-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.18
|
||||||
|
- deps: mime-db@~1.33.0
|
||||||
|
|
||||||
|
1.3.4 / 2017-08-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.16
|
||||||
|
- deps: mime-db@~1.29.0
|
||||||
|
|
||||||
|
1.3.3 / 2016-05-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.11
|
||||||
|
- deps: mime-db@~1.23.0
|
||||||
|
* deps: negotiator@0.6.1
|
||||||
|
- perf: improve `Accept` parsing speed
|
||||||
|
- perf: improve `Accept-Charset` parsing speed
|
||||||
|
- perf: improve `Accept-Encoding` parsing speed
|
||||||
|
- perf: improve `Accept-Language` parsing speed
|
||||||
|
|
||||||
|
1.3.2 / 2016-03-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.10
|
||||||
|
- Fix extension of `application/dash+xml`
|
||||||
|
- Update primary extension for `audio/mp4`
|
||||||
|
- deps: mime-db@~1.22.0
|
||||||
|
|
||||||
|
1.3.1 / 2016-01-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.9
|
||||||
|
- deps: mime-db@~1.21.0
|
||||||
|
|
||||||
|
1.3.0 / 2015-09-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.7
|
||||||
|
- deps: mime-db@~1.19.0
|
||||||
|
* deps: negotiator@0.6.0
|
||||||
|
- Fix including type extensions in parameters in `Accept` parsing
|
||||||
|
- Fix parsing `Accept` parameters with quoted equals
|
||||||
|
- Fix parsing `Accept` parameters with quoted semicolons
|
||||||
|
- Lazy-load modules from main entry point
|
||||||
|
- perf: delay type concatenation until needed
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: hoist regular expressions
|
||||||
|
- perf: remove closures getting spec properties
|
||||||
|
- perf: remove a closure from media type parsing
|
||||||
|
- perf: remove property delete from media type parsing
|
||||||
|
|
||||||
|
1.2.13 / 2015-09-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.6
|
||||||
|
- deps: mime-db@~1.18.0
|
||||||
|
|
||||||
|
1.2.12 / 2015-07-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.4
|
||||||
|
- deps: mime-db@~1.16.0
|
||||||
|
|
||||||
|
1.2.11 / 2015-07-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.3
|
||||||
|
- deps: mime-db@~1.15.0
|
||||||
|
|
||||||
|
1.2.10 / 2015-07-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.2
|
||||||
|
- deps: mime-db@~1.14.0
|
||||||
|
|
||||||
|
1.2.9 / 2015-06-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.1
|
||||||
|
- perf: fix deopt during mapping
|
||||||
|
|
||||||
|
1.2.8 / 2015-06-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.0
|
||||||
|
- deps: mime-db@~1.13.0
|
||||||
|
* perf: avoid argument reassignment & argument slice
|
||||||
|
* perf: avoid negotiator recursive construction
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove unnecessary bitwise operator
|
||||||
|
|
||||||
|
1.2.7 / 2015-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.3
|
||||||
|
- Fix media type parameter matching to be case-insensitive
|
||||||
|
|
||||||
|
1.2.6 / 2015-05-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.11
|
||||||
|
- deps: mime-db@~1.9.1
|
||||||
|
* deps: negotiator@0.5.2
|
||||||
|
- Fix comparing media types with quoted values
|
||||||
|
- Fix splitting media types with quoted commas
|
||||||
|
|
||||||
|
1.2.5 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.10
|
||||||
|
- deps: mime-db@~1.8.0
|
||||||
|
|
||||||
|
1.2.4 / 2015-02-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support Node.js 0.6
|
||||||
|
* deps: mime-types@~2.0.9
|
||||||
|
- deps: mime-db@~1.7.0
|
||||||
|
* deps: negotiator@0.5.1
|
||||||
|
- Fix preference sorting to be stable for long acceptable lists
|
||||||
|
|
||||||
|
1.2.3 / 2015-01-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.8
|
||||||
|
- deps: mime-db@~1.6.0
|
||||||
|
|
||||||
|
1.2.2 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.7
|
||||||
|
- deps: mime-db@~1.5.0
|
||||||
|
|
||||||
|
1.2.1 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.5
|
||||||
|
- deps: mime-db@~1.3.1
|
||||||
|
|
||||||
|
1.2.0 / 2014-12-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.0
|
||||||
|
- Fix list return order when large accepted list
|
||||||
|
- Fix missing identity encoding when q=0 exists
|
||||||
|
- Remove dynamic building of Negotiator class
|
||||||
|
|
||||||
|
1.1.4 / 2014-12-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.4
|
||||||
|
- deps: mime-db@~1.3.0
|
||||||
|
|
||||||
|
1.1.3 / 2014-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.3
|
||||||
|
- deps: mime-db@~1.2.0
|
||||||
|
|
||||||
|
1.1.2 / 2014-10-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.9
|
||||||
|
- Fix error when media type has invalid parameter
|
||||||
|
|
||||||
|
1.1.1 / 2014-09-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.2
|
||||||
|
- deps: mime-db@~1.1.0
|
||||||
|
* deps: negotiator@0.4.8
|
||||||
|
- Fix all negotiations to be case-insensitive
|
||||||
|
- Stable sort preferences of same quality according to client order
|
||||||
|
|
||||||
|
1.1.0 / 2014-09-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* update `mime-types`
|
||||||
|
|
||||||
|
1.0.7 / 2014-07-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix wrong type returned from `type` when match after unknown extension
|
||||||
|
|
||||||
|
1.0.6 / 2014-06-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.7
|
||||||
|
|
||||||
|
1.0.5 / 2014-06-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix crash when unknown extension given
|
||||||
|
|
||||||
|
1.0.4 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `mime-types`
|
||||||
|
|
||||||
|
1.0.3 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.6
|
||||||
|
- Order by specificity when quality is the same
|
||||||
|
|
||||||
|
1.0.2 / 2014-05-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix interpretation when header not in request
|
||||||
|
* deps: pin negotiator@0.4.5
|
||||||
|
|
||||||
|
1.0.1 / 2014-01-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Identity encoding isn't always acceptable
|
||||||
|
* deps: negotiator@~0.4.0
|
||||||
|
|
||||||
|
1.0.0 / 2013-12-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Genesis
|
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
142
node_modules/accepts/README.md
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
# accepts
|
||||||
|
|
||||||
|
[![NPM Version][npm-version-image]][npm-url]
|
||||||
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||||
|
[![Node.js Version][node-version-image]][node-version-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||||
|
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||||
|
|
||||||
|
In addition to negotiator, it allows:
|
||||||
|
|
||||||
|
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||||
|
as well as `('text/html', 'application/json')`.
|
||||||
|
- Allows type shorthands such as `json`.
|
||||||
|
- Returns `false` when no types match
|
||||||
|
- Treats non-existent headers as `*`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||||
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||||
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install accepts
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
```
|
||||||
|
|
||||||
|
### accepts(req)
|
||||||
|
|
||||||
|
Create a new `Accepts` object for the given `req`.
|
||||||
|
|
||||||
|
#### .charset(charsets)
|
||||||
|
|
||||||
|
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .charsets()
|
||||||
|
|
||||||
|
Return the charsets that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .encoding(encodings)
|
||||||
|
|
||||||
|
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .encodings()
|
||||||
|
|
||||||
|
Return the encodings that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .language(languages)
|
||||||
|
|
||||||
|
Return the first accepted language. If nothing in `languages` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .languages()
|
||||||
|
|
||||||
|
Return the languages that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .type(types)
|
||||||
|
|
||||||
|
Return the first accepted type (and it is returned as the same text as what
|
||||||
|
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||||
|
is returned.
|
||||||
|
|
||||||
|
The `types` array can contain full MIME types or file extensions. Any value
|
||||||
|
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||||
|
|
||||||
|
#### .types()
|
||||||
|
|
||||||
|
Return the types that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Simple type negotiation
|
||||||
|
|
||||||
|
This simple example shows how to use `accepts` to return a different typed
|
||||||
|
respond body based on what the client wants to accept. The server lists it's
|
||||||
|
preferences in order and will get back the best match between the client and
|
||||||
|
server.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
var http = require('http')
|
||||||
|
|
||||||
|
function app (req, res) {
|
||||||
|
var accept = accepts(req)
|
||||||
|
|
||||||
|
// the order of this list is significant; should be server preferred order
|
||||||
|
switch (accept.type(['json', 'html'])) {
|
||||||
|
case 'json':
|
||||||
|
res.setHeader('Content-Type', 'application/json')
|
||||||
|
res.write('{"hello":"world!"}')
|
||||||
|
break
|
||||||
|
case 'html':
|
||||||
|
res.setHeader('Content-Type', 'text/html')
|
||||||
|
res.write('<b>hello, world!</b>')
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// the fallback is text/plain, so no need to specify it above
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('hello, world!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
res.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
http.createServer(app).listen(3000)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test this out with the cURL program:
|
||||||
|
```sh
|
||||||
|
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||||
|
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||||
|
[node-version-url]: https://nodejs.org/en/download
|
||||||
|
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||||
|
[npm-url]: https://npmjs.org/package/accepts
|
||||||
|
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||||
|
[travis-image]: https://badgen.net/travis/jshttp/accepts/master
|
||||||
|
[travis-url]: https://travis-ci.org/jshttp/accepts
|
238
node_modules/accepts/index.js
generated
vendored
Normal file
|
@ -0,0 +1,238 @@
|
||||||
|
/*!
|
||||||
|
* accepts
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Negotiator = require('negotiator')
|
||||||
|
var mime = require('mime-types')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = Accepts
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Accepts object for the given req.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Accepts (req) {
|
||||||
|
if (!(this instanceof Accepts)) {
|
||||||
|
return new Accepts(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.headers = req.headers
|
||||||
|
this.negotiator = new Negotiator(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given `type(s)` is acceptable, returning
|
||||||
|
* the best match when true, otherwise `undefined`, in which
|
||||||
|
* case you should respond with 406 "Not Acceptable".
|
||||||
|
*
|
||||||
|
* The `type` value may be a single mime type string
|
||||||
|
* such as "application/json", the extension name
|
||||||
|
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||||
|
* or array is given the _best_ match, if any is returned.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* // Accept: text/html
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
* this.types('text/html');
|
||||||
|
* // => "text/html"
|
||||||
|
* this.types('json', 'text');
|
||||||
|
* // => "json"
|
||||||
|
* this.types('application/json');
|
||||||
|
* // => "application/json"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('image/png');
|
||||||
|
* this.types('png');
|
||||||
|
* // => undefined
|
||||||
|
*
|
||||||
|
* // Accept: text/*;q=.5, application/json
|
||||||
|
* this.types(['html', 'json']);
|
||||||
|
* this.types('html', 'json');
|
||||||
|
* // => "json"
|
||||||
|
*
|
||||||
|
* @param {String|Array} types...
|
||||||
|
* @return {String|Array|Boolean}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.type =
|
||||||
|
Accepts.prototype.types = function (types_) {
|
||||||
|
var types = types_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (types && !Array.isArray(types)) {
|
||||||
|
types = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < types.length; i++) {
|
||||||
|
types[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no types, return all requested types
|
||||||
|
if (!types || types.length === 0) {
|
||||||
|
return this.negotiator.mediaTypes()
|
||||||
|
}
|
||||||
|
|
||||||
|
// no accept header, return first given type
|
||||||
|
if (!this.headers.accept) {
|
||||||
|
return types[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
var mimes = types.map(extToMime)
|
||||||
|
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||||
|
var first = accepts[0]
|
||||||
|
|
||||||
|
return first
|
||||||
|
? types[mimes.indexOf(first)]
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted encodings or best fit based on `encodings`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Encoding: gzip, deflate`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['gzip', 'deflate']
|
||||||
|
*
|
||||||
|
* @param {String|Array} encodings...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.encoding =
|
||||||
|
Accepts.prototype.encodings = function (encodings_) {
|
||||||
|
var encodings = encodings_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (encodings && !Array.isArray(encodings)) {
|
||||||
|
encodings = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < encodings.length; i++) {
|
||||||
|
encodings[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no encodings, return all requested encodings
|
||||||
|
if (!encodings || encodings.length === 0) {
|
||||||
|
return this.negotiator.encodings()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.encodings(encodings)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted charsets or best fit based on `charsets`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||||
|
*
|
||||||
|
* @param {String|Array} charsets...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.charset =
|
||||||
|
Accepts.prototype.charsets = function (charsets_) {
|
||||||
|
var charsets = charsets_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (charsets && !Array.isArray(charsets)) {
|
||||||
|
charsets = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < charsets.length; i++) {
|
||||||
|
charsets[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no charsets, return all requested charsets
|
||||||
|
if (!charsets || charsets.length === 0) {
|
||||||
|
return this.negotiator.charsets()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.charsets(charsets)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted languages or best fit based on `langs`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['es', 'pt', 'en']
|
||||||
|
*
|
||||||
|
* @param {String|Array} langs...
|
||||||
|
* @return {Array|String}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.lang =
|
||||||
|
Accepts.prototype.langs =
|
||||||
|
Accepts.prototype.language =
|
||||||
|
Accepts.prototype.languages = function (languages_) {
|
||||||
|
var languages = languages_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (languages && !Array.isArray(languages)) {
|
||||||
|
languages = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < languages.length; i++) {
|
||||||
|
languages[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no languages, return all requested languages
|
||||||
|
if (!languages || languages.length === 0) {
|
||||||
|
return this.negotiator.languages()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.languages(languages)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert extnames to mime.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extToMime (type) {
|
||||||
|
return type.indexOf('/') === -1
|
||||||
|
? mime.lookup(type)
|
||||||
|
: type
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if mime is valid.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function validMime (type) {
|
||||||
|
return typeof type === 'string'
|
||||||
|
}
|
90
node_modules/accepts/package.json
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"accepts@1.3.7",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "accepts@1.3.7",
|
||||||
|
"_id": "accepts@1.3.7",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||||
|
"_location": "/accepts",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "accepts@1.3.7",
|
||||||
|
"name": "accepts",
|
||||||
|
"escapedName": "accepts",
|
||||||
|
"rawSpec": "1.3.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.3.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/compression",
|
||||||
|
"/express"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
|
"_spec": "1.3.7",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jshttp/accepts/issues"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Douglas Christopher Wilson",
|
||||||
|
"email": "doug@somethingdoug.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jonathan Ong",
|
||||||
|
"email": "me@jongleberry.com",
|
||||||
|
"url": "http://jongleberry.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"mime-types": "~2.1.24",
|
||||||
|
"negotiator": "0.6.2"
|
||||||
|
},
|
||||||
|
"description": "Higher-level content negotiation",
|
||||||
|
"devDependencies": {
|
||||||
|
"deep-equal": "1.0.1",
|
||||||
|
"eslint": "5.16.0",
|
||||||
|
"eslint-config-standard": "12.0.0",
|
||||||
|
"eslint-plugin-import": "2.17.2",
|
||||||
|
"eslint-plugin-markdown": "1.0.0",
|
||||||
|
"eslint-plugin-node": "8.0.1",
|
||||||
|
"eslint-plugin-promise": "4.1.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
|
"mocha": "6.1.4",
|
||||||
|
"nyc": "14.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"HISTORY.md",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jshttp/accepts#readme",
|
||||||
|
"keywords": [
|
||||||
|
"content",
|
||||||
|
"negotiation",
|
||||||
|
"accept",
|
||||||
|
"accepts"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "accepts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jshttp/accepts.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --plugin markdown --ext js,md .",
|
||||||
|
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||||
|
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||||
|
"test-travis": "nyc --reporter=text npm test"
|
||||||
|
},
|
||||||
|
"version": "1.3.7"
|
||||||
|
}
|
36
node_modules/ansi-align/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
<a name="2.0.0"></a>
|
||||||
|
# [2.0.0](https://github.com/nexdrew/ansi-align/compare/v1.1.0...v2.0.0) (2017-05-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* ES2015ify, dropping support for Node <4 ([#30](https://github.com/nexdrew/ansi-align/issues/30)) ([7b43f48](https://github.com/nexdrew/ansi-align/commit/7b43f48))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use ansi-align@1.1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.1.0"></a>
|
||||||
|
# [1.1.0](https://github.com/nexdrew/ansi-align/compare/v1.0.0...v1.1.0) (2016-06-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* support left-alignment as no-op ([#3](https://github.com/nexdrew/ansi-align/issues/3)) ([e581db6](https://github.com/nexdrew/ansi-align/commit/e581db6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.0.0"></a>
|
||||||
|
# 1.0.0 (2016-04-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* initial commit ([1914d90](https://github.com/nexdrew/ansi-align/commit/1914d90))
|
13
node_modules/ansi-align/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (c) 2016, 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.
|
79
node_modules/ansi-align/README.md
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
# ansi-align
|
||||||
|
|
||||||
|
> align-text with ANSI support for CLIs
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/nexdrew/ansi-align.svg?branch=master)](https://travis-ci.org/nexdrew/ansi-align)
|
||||||
|
[![Coverage Status](https://coveralls.io/repos/github/nexdrew/ansi-align/badge.svg?branch=master)](https://coveralls.io/github/nexdrew/ansi-align?branch=master)
|
||||||
|
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
|
||||||
|
|
||||||
|
Easily center- or right- align a block of text, carefully ignoring ANSI escape codes.
|
||||||
|
|
||||||
|
E.g. turn this:
|
||||||
|
|
||||||
|
<img width="281" alt="ansi text block no alignment :(" src="https://cloud.githubusercontent.com/assets/1929625/14937509/7c3076dc-0ed7-11e6-8c16-4f6a4ccc8346.png">
|
||||||
|
|
||||||
|
Into this:
|
||||||
|
|
||||||
|
<img width="278" alt="ansi text block center aligned!" src="https://cloud.githubusercontent.com/assets/1929625/14937510/7c3ca0b0-0ed7-11e6-8f0a-541ca39b6e0a.png">
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save ansi-align
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
var ansiAlign = require('ansi-align')
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `ansiAlign(text, [opts])`
|
||||||
|
|
||||||
|
Align the given text per the line with the greatest [`string-width`](https://github.com/sindresorhus/string-width), returning a new string (or array).
|
||||||
|
|
||||||
|
#### Arguments
|
||||||
|
|
||||||
|
- `text`: required, string or array
|
||||||
|
|
||||||
|
The text to align. If a string is given, it will be split using either the `opts.split` value or `'\n'` by default. If an array is given, a different array of modified strings will be returned.
|
||||||
|
|
||||||
|
- `opts`: optional, object
|
||||||
|
|
||||||
|
Options to change behavior, see below.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
- `opts.align`: string, default `'center'`
|
||||||
|
|
||||||
|
The alignment mode. Use `'center'` for center-alignment, `'right'` for right-alignment, or `'left'` for left-alignment. Note that the given `text` is assumed to be left-aligned already, so specifying `align: 'left'` just returns the `text` as is (no-op).
|
||||||
|
|
||||||
|
- `opts.split`: string or RegExp, default `'\n'`
|
||||||
|
|
||||||
|
The separator to use when splitting the text. Only used if text is given as a string.
|
||||||
|
|
||||||
|
- `opts.pad`: string, default `' '`
|
||||||
|
|
||||||
|
The value used to left-pad (prepend to) lines of lesser width. Will be repeated as necessary to adjust alignment to the line with the greatest width.
|
||||||
|
|
||||||
|
### `ansiAlign.center(text)`
|
||||||
|
|
||||||
|
Alias for `ansiAlign(text, { align: 'center' })`.
|
||||||
|
|
||||||
|
### `ansiAlign.right(text)`
|
||||||
|
|
||||||
|
Alias for `ansiAlign(text, { align: 'right' })`.
|
||||||
|
|
||||||
|
### `ansiAlign.left(text)`
|
||||||
|
|
||||||
|
Alias for `ansiAlign(text, { align: 'left' })`, which is a no-op.
|
||||||
|
|
||||||
|
## Similar Packages
|
||||||
|
|
||||||
|
- [`center-align`](https://github.com/jonschlinkert/center-align): Very close to this package, except it doesn't support ANSI codes.
|
||||||
|
- [`left-pad`](https://github.com/camwest/left-pad): Great for left-padding but does not support center alignment or ANSI codes.
|
||||||
|
- Pretty much anything by the [chalk](https://github.com/chalk) team
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
ISC © Contributors
|
61
node_modules/ansi-align/index.js
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const stringWidth = require('string-width')
|
||||||
|
|
||||||
|
function ansiAlign (text, opts) {
|
||||||
|
if (!text) return text
|
||||||
|
|
||||||
|
opts = opts || {}
|
||||||
|
const align = opts.align || 'center'
|
||||||
|
|
||||||
|
// short-circuit `align: 'left'` as no-op
|
||||||
|
if (align === 'left') return text
|
||||||
|
|
||||||
|
const split = opts.split || '\n'
|
||||||
|
const pad = opts.pad || ' '
|
||||||
|
const widthDiffFn = align !== 'right' ? halfDiff : fullDiff
|
||||||
|
|
||||||
|
let returnString = false
|
||||||
|
if (!Array.isArray(text)) {
|
||||||
|
returnString = true
|
||||||
|
text = String(text).split(split)
|
||||||
|
}
|
||||||
|
|
||||||
|
let width
|
||||||
|
let maxWidth = 0
|
||||||
|
text = text.map(function (str) {
|
||||||
|
str = String(str)
|
||||||
|
width = stringWidth(str)
|
||||||
|
maxWidth = Math.max(width, maxWidth)
|
||||||
|
return {
|
||||||
|
str,
|
||||||
|
width
|
||||||
|
}
|
||||||
|
}).map(function (obj) {
|
||||||
|
return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str
|
||||||
|
})
|
||||||
|
|
||||||
|
return returnString ? text.join(split) : text
|
||||||
|
}
|
||||||
|
|
||||||
|
ansiAlign.left = function left (text) {
|
||||||
|
return ansiAlign(text, { align: 'left' })
|
||||||
|
}
|
||||||
|
|
||||||
|
ansiAlign.center = function center (text) {
|
||||||
|
return ansiAlign(text, { align: 'center' })
|
||||||
|
}
|
||||||
|
|
||||||
|
ansiAlign.right = function right (text) {
|
||||||
|
return ansiAlign(text, { align: 'right' })
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ansiAlign
|
||||||
|
|
||||||
|
function halfDiff (maxWidth, curWidth) {
|
||||||
|
return Math.floor((maxWidth - curWidth) / 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function fullDiff (maxWidth, curWidth) {
|
||||||
|
return maxWidth - curWidth
|
||||||
|
}
|
73
node_modules/ansi-align/package.json
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"ansi-align@2.0.0",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "ansi-align@2.0.0",
|
||||||
|
"_id": "ansi-align@2.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=",
|
||||||
|
"_location": "/ansi-align",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-align@2.0.0",
|
||||||
|
"name": "ansi-align",
|
||||||
|
"escapedName": "ansi-align",
|
||||||
|
"rawSpec": "2.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/boxen"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz",
|
||||||
|
"_spec": "2.0.0",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "nexdrew"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/nexdrew/ansi-align/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^2.0.0"
|
||||||
|
},
|
||||||
|
"description": "align-text with ANSI support for CLIs",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^0.19.1",
|
||||||
|
"chalk": "^1.1.3",
|
||||||
|
"coveralls": "^2.13.1",
|
||||||
|
"nyc": "^10.3.0",
|
||||||
|
"standard": "^10.0.2",
|
||||||
|
"standard-version": "^4.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/nexdrew/ansi-align#readme",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"align",
|
||||||
|
"cli",
|
||||||
|
"center",
|
||||||
|
"pad"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "ansi-align",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/nexdrew/ansi-align.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||||
|
"pretest": "standard",
|
||||||
|
"release": "standard-version",
|
||||||
|
"test": "nyc ava"
|
||||||
|
},
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
10
node_modules/ansi-regex/index.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
const pattern = [
|
||||||
|
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
|
||||||
|
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'
|
||||||
|
].join('|');
|
||||||
|
|
||||||
|
return new RegExp(pattern, 'g');
|
||||||
|
};
|
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.
|
88
node_modules/ansi-regex/package.json
generated
vendored
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"ansi-regex@3.0.0",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "ansi-regex@3.0.0",
|
||||||
|
"_id": "ansi-regex@3.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
|
||||||
|
"_location": "/ansi-regex",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-regex@3.0.0",
|
||||||
|
"name": "ansi-regex",
|
||||||
|
"escapedName": "ansi-regex",
|
||||||
|
"rawSpec": "3.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "3.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/strip-ansi"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
||||||
|
"_spec": "3.0.0",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||||
|
},
|
||||||
|
"description": "Regular expression for matching ANSI escape codes",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"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",
|
||||||
|
"view-supported": "node fixtures/view-codes.js"
|
||||||
|
},
|
||||||
|
"version": "3.0.0"
|
||||||
|
}
|
46
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# 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']
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 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-)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
165
node_modules/ansi-styles/index.js
generated
vendored
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
'use strict';
|
||||||
|
const colorConvert = require('color-convert');
|
||||||
|
|
||||||
|
const wrapAnsi16 = (fn, offset) => function () {
|
||||||
|
const code = fn.apply(colorConvert, arguments);
|
||||||
|
return `\u001B[${code + offset}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi256 = (fn, offset) => function () {
|
||||||
|
const code = fn.apply(colorConvert, arguments);
|
||||||
|
return `\u001B[${38 + offset};5;${code}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi16m = (fn, offset) => function () {
|
||||||
|
const rgb = fn.apply(colorConvert, arguments);
|
||||||
|
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
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],
|
||||||
|
gray: [90, 39],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
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]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fix humans
|
||||||
|
styles.color.grey = styles.color.gray;
|
||||||
|
|
||||||
|
for (const groupName of Object.keys(styles)) {
|
||||||
|
const group = styles[groupName];
|
||||||
|
|
||||||
|
for (const styleName of Object.keys(group)) {
|
||||||
|
const style = group[styleName];
|
||||||
|
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const ansi2ansi = n => n;
|
||||||
|
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||||
|
|
||||||
|
styles.color.close = '\u001B[39m';
|
||||||
|
styles.bgColor.close = '\u001B[49m';
|
||||||
|
|
||||||
|
styles.color.ansi = {
|
||||||
|
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||||
|
};
|
||||||
|
styles.color.ansi256 = {
|
||||||
|
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||||
|
};
|
||||||
|
styles.color.ansi16m = {
|
||||||
|
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
styles.bgColor.ansi = {
|
||||||
|
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||||
|
};
|
||||||
|
styles.bgColor.ansi256 = {
|
||||||
|
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||||
|
};
|
||||||
|
styles.bgColor.ansi16m = {
|
||||||
|
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let key of Object.keys(colorConvert)) {
|
||||||
|
if (typeof colorConvert[key] !== 'object') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const suite = colorConvert[key];
|
||||||
|
|
||||||
|
if (key === 'ansi16') {
|
||||||
|
key = 'ansi';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('ansi16' in suite) {
|
||||||
|
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||||
|
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('ansi256' in suite) {
|
||||||
|
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||||
|
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('rgb' in suite) {
|
||||||
|
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||||
|
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the export immutable
|
||||||
|
Object.defineProperty(module, 'exports', {
|
||||||
|
enumerable: true,
|
||||||
|
get: assembleStyles
|
||||||
|
});
|
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.
|
91
node_modules/ansi-styles/package.json
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"ansi-styles@3.2.1",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "ansi-styles@3.2.1",
|
||||||
|
"_id": "ansi-styles@3.2.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||||
|
"_location": "/ansi-styles",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-styles@3.2.1",
|
||||||
|
"name": "ansi-styles",
|
||||||
|
"escapedName": "ansi-styles",
|
||||||
|
"rawSpec": "3.2.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "3.2.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/chalk"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||||
|
"_spec": "3.2.1",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"ava": {
|
||||||
|
"require": "babel-polyfill"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^1.9.0"
|
||||||
|
},
|
||||||
|
"description": "ANSI escape codes for styling strings in the terminal",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"babel-polyfill": "^6.23.0",
|
||||||
|
"svg-term-cli": "^2.1.1",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"version": "3.2.1"
|
||||||
|
}
|
147
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
|
||||||
|
|
||||||
|
> [ANSI escape codes](http://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="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/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`
|
||||||
|
- `gray` ("bright black")
|
||||||
|
- `redBright`
|
||||||
|
- `greenBright`
|
||||||
|
- `yellowBright`
|
||||||
|
- `blueBright`
|
||||||
|
- `magentaBright`
|
||||||
|
- `cyanBright`
|
||||||
|
- `whiteBright`
|
||||||
|
|
||||||
|
### Background colors
|
||||||
|
|
||||||
|
- `bgBlack`
|
||||||
|
- `bgRed`
|
||||||
|
- `bgGreen`
|
||||||
|
- `bgYellow`
|
||||||
|
- `bgBlue`
|
||||||
|
- `bgMagenta`
|
||||||
|
- `bgCyan`
|
||||||
|
- `bgWhite`
|
||||||
|
- `bgBlackBright`
|
||||||
|
- `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.
|
||||||
|
|
||||||
|
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-)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
15
node_modules/anymatch/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
|
||||||
|
|
||||||
|
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.
|
87
node_modules/anymatch/README.md
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master)
|
||||||
|
======
|
||||||
|
Javascript module to match a string against a regular expression, glob, string,
|
||||||
|
or function that takes the string as an argument and returns a truthy or falsy
|
||||||
|
value. The matcher can also be an array of any or all of these. Useful for
|
||||||
|
allowing a very flexible user-defined config to define things like file paths.
|
||||||
|
|
||||||
|
__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__
|
||||||
|
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
```sh
|
||||||
|
npm install anymatch
|
||||||
|
```
|
||||||
|
|
||||||
|
#### anymatch(matchers, testString, [returnIndex], [options])
|
||||||
|
* __matchers__: (_Array|String|RegExp|Function_)
|
||||||
|
String to be directly matched, string with glob patterns, regular expression
|
||||||
|
test, function that takes the testString as an argument and returns a truthy
|
||||||
|
value if it should be matched, or an array of any number and mix of these types.
|
||||||
|
* __testString__: (_String|Array_) The string to test against the matchers. If
|
||||||
|
passed as an array, the first element of the array will be used as the
|
||||||
|
`testString` for non-function matchers, while the entire array will be applied
|
||||||
|
as the arguments for function matchers.
|
||||||
|
* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options.
|
||||||
|
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of
|
||||||
|
the first matcher that that testString matched, or -1 if no match, instead of a
|
||||||
|
boolean result.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const anymatch = require('anymatch');
|
||||||
|
|
||||||
|
const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ;
|
||||||
|
|
||||||
|
anymatch(matchers, 'path/to/file.js'); // true
|
||||||
|
anymatch(matchers, 'path/anyjs/baz.js'); // true
|
||||||
|
anymatch(matchers, 'path/to/foo.js'); // true
|
||||||
|
anymatch(matchers, 'path/to/bar.js'); // true
|
||||||
|
anymatch(matchers, 'bar.js'); // false
|
||||||
|
|
||||||
|
// returnIndex = true
|
||||||
|
anymatch(matchers, 'foo.js', {returnIndex: true}); // 2
|
||||||
|
anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1
|
||||||
|
|
||||||
|
// any picomatc
|
||||||
|
|
||||||
|
// using globs to match directories and their children
|
||||||
|
anymatch('node_modules', 'node_modules'); // true
|
||||||
|
anymatch('node_modules', 'node_modules/somelib/index.js'); // false
|
||||||
|
anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
|
||||||
|
anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
|
||||||
|
anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
|
||||||
|
|
||||||
|
const matcher = anymatch(matchers);
|
||||||
|
['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ]
|
||||||
|
anymatch master* ❯
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### anymatch(matchers)
|
||||||
|
You can also pass in only your matcher(s) to get a curried function that has
|
||||||
|
already been bound to the provided matching criteria. This can be used as an
|
||||||
|
`Array#filter` callback.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var matcher = anymatch(matchers);
|
||||||
|
|
||||||
|
matcher('path/to/file.js'); // true
|
||||||
|
matcher('path/anyjs/baz.js', true); // 1
|
||||||
|
|
||||||
|
['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
|
||||||
|
```
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
----------
|
||||||
|
[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)
|
||||||
|
|
||||||
|
- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only.
|
||||||
|
- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).
|
||||||
|
- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
|
||||||
|
for glob pattern matching. Issues with glob pattern matching should be
|
||||||
|
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE)
|
19
node_modules/anymatch/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
type AnymatchFn = (testString: string) => boolean;
|
||||||
|
type AnymatchPattern = string|RegExp|AnymatchFn;
|
||||||
|
type AnymatchMatcher = AnymatchPattern|AnymatchPattern[]
|
||||||
|
type AnymatchTester = {
|
||||||
|
(testString: string|any[], returnIndex: true): number;
|
||||||
|
(testString: string|any[]): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
type PicomatchOptions = {dot: boolean};
|
||||||
|
|
||||||
|
declare const anymatch: {
|
||||||
|
(matchers: AnymatchMatcher): AnymatchTester;
|
||||||
|
(matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number;
|
||||||
|
(matchers: AnymatchMatcher, testString: string|any[]): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {AnymatchMatcher as Matcher}
|
||||||
|
export {AnymatchTester as Tester}
|
||||||
|
export default anymatch
|
102
node_modules/anymatch/index.js
generated
vendored
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
|
||||||
|
const picomatch = require('picomatch');
|
||||||
|
const normalizePath = require('normalize-path');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {(testString: string) => boolean} AnymatchFn
|
||||||
|
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
|
||||||
|
* @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
|
||||||
|
*/
|
||||||
|
const BANG = '!';
|
||||||
|
const DEFAULT_OPTIONS = {returnIndex: false};
|
||||||
|
const arrify = (item) => Array.isArray(item) ? item : [item];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {AnymatchPattern} matcher
|
||||||
|
* @param {object} options
|
||||||
|
* @returns {AnymatchFn}
|
||||||
|
*/
|
||||||
|
const createPattern = (matcher, options) => {
|
||||||
|
if (typeof matcher === 'function') {
|
||||||
|
return matcher;
|
||||||
|
}
|
||||||
|
if (typeof matcher === 'string') {
|
||||||
|
const glob = picomatch(matcher, options);
|
||||||
|
return (string) => matcher === string || glob(string);
|
||||||
|
}
|
||||||
|
if (matcher instanceof RegExp) {
|
||||||
|
return (string) => matcher.test(string);
|
||||||
|
}
|
||||||
|
return (string) => false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array<Function>} patterns
|
||||||
|
* @param {Array<Function>} negPatterns
|
||||||
|
* @param {String|Array} args
|
||||||
|
* @param {Boolean} returnIndex
|
||||||
|
* @returns {boolean|number}
|
||||||
|
*/
|
||||||
|
const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
|
||||||
|
const isList = Array.isArray(args);
|
||||||
|
const _path = isList ? args[0] : args;
|
||||||
|
if (!isList && typeof _path !== 'string') {
|
||||||
|
throw new TypeError('anymatch: second argument must be a string: got ' +
|
||||||
|
Object.prototype.toString.call(_path))
|
||||||
|
}
|
||||||
|
const path = normalizePath(_path);
|
||||||
|
|
||||||
|
for (let index = 0; index < negPatterns.length; index++) {
|
||||||
|
const nglob = negPatterns[index];
|
||||||
|
if (nglob(path)) {
|
||||||
|
return returnIndex ? -1 : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const applied = isList && [path].concat(args.slice(1));
|
||||||
|
for (let index = 0; index < patterns.length; index++) {
|
||||||
|
const pattern = patterns[index];
|
||||||
|
if (isList ? pattern(...applied) : pattern(path)) {
|
||||||
|
return returnIndex ? index : true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnIndex ? -1 : false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {AnymatchMatcher} matchers
|
||||||
|
* @param {Array|string} testString
|
||||||
|
* @param {object} options
|
||||||
|
* @returns {boolean|number|Function}
|
||||||
|
*/
|
||||||
|
const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
|
||||||
|
if (matchers == null) {
|
||||||
|
throw new TypeError('anymatch: specify first argument');
|
||||||
|
}
|
||||||
|
const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
|
||||||
|
const returnIndex = opts.returnIndex || false;
|
||||||
|
|
||||||
|
// Early cache for matchers.
|
||||||
|
const mtchers = arrify(matchers);
|
||||||
|
const negatedGlobs = mtchers
|
||||||
|
.filter(item => typeof item === 'string' && item.charAt(0) === BANG)
|
||||||
|
.map(item => item.slice(1))
|
||||||
|
.map(item => picomatch(item, opts));
|
||||||
|
const patterns = mtchers.map(matcher => createPattern(matcher, opts));
|
||||||
|
|
||||||
|
if (testString == null) {
|
||||||
|
return (testString, ri = false) => {
|
||||||
|
const returnIndex = typeof ri === 'boolean' ? ri : false;
|
||||||
|
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
||||||
|
};
|
||||||
|
|
||||||
|
anymatch.default = anymatch;
|
||||||
|
module.exports = anymatch;
|
79
node_modules/anymatch/package.json
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"anymatch@3.1.1",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "anymatch@3.1.1",
|
||||||
|
"_id": "anymatch@3.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
|
||||||
|
"_location": "/anymatch",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "anymatch@3.1.1",
|
||||||
|
"name": "anymatch",
|
||||||
|
"escapedName": "anymatch",
|
||||||
|
"rawSpec": "3.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "3.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/chokidar"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
|
||||||
|
"_spec": "3.1.1",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Elan Shanker",
|
||||||
|
"url": "https://github.com/es128"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/micromatch/anymatch/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"picomatch": "^2.0.4"
|
||||||
|
},
|
||||||
|
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "^6.1.3",
|
||||||
|
"nyc": "^14.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/micromatch/anymatch",
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"any",
|
||||||
|
"string",
|
||||||
|
"file",
|
||||||
|
"fs",
|
||||||
|
"list",
|
||||||
|
"glob",
|
||||||
|
"regex",
|
||||||
|
"regexp",
|
||||||
|
"regular",
|
||||||
|
"expression",
|
||||||
|
"function"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"name": "anymatch",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/micromatch/anymatch.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"mocha": "mocha",
|
||||||
|
"test": "nyc mocha"
|
||||||
|
},
|
||||||
|
"version": "3.1.1"
|
||||||
|
}
|
21
node_modules/array-flatten/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
43
node_modules/array-flatten/README.md
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Array Flatten
|
||||||
|
|
||||||
|
[![NPM version][npm-image]][npm-url]
|
||||||
|
[![NPM downloads][downloads-image]][downloads-url]
|
||||||
|
[![Build status][travis-image]][travis-url]
|
||||||
|
[![Test coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install array-flatten --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var flatten = require('array-flatten')
|
||||||
|
|
||||||
|
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
||||||
|
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
|
||||||
|
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
||||||
|
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
flatten(arguments) //=> [1, 2, 3]
|
||||||
|
})(1, [2, 3])
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
||||||
|
[npm-url]: https://npmjs.org/package/array-flatten
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
||||||
|
[downloads-url]: https://npmjs.org/package/array-flatten
|
||||||
|
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
||||||
|
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
||||||
|
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
64
node_modules/array-flatten/array-flatten.js
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose `arrayFlatten`.
|
||||||
|
*/
|
||||||
|
module.exports = arrayFlatten
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive flatten function with depth.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Array} result
|
||||||
|
* @param {Number} depth
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function flattenWithDepth (array, result, depth) {
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var value = array[i]
|
||||||
|
|
||||||
|
if (depth > 0 && Array.isArray(value)) {
|
||||||
|
flattenWithDepth(value, result, depth - 1)
|
||||||
|
} else {
|
||||||
|
result.push(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive flatten function. Omitting depth is slightly faster.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Array} result
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function flattenForever (array, result) {
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var value = array[i]
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
flattenForever(value, result)
|
||||||
|
} else {
|
||||||
|
result.push(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flatten an array, with the ability to define a depth.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Number} depth
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function arrayFlatten (array, depth) {
|
||||||
|
if (depth == null) {
|
||||||
|
return flattenForever(array, [])
|
||||||
|
}
|
||||||
|
|
||||||
|
return flattenWithDepth(array, [], depth)
|
||||||
|
}
|
67
node_modules/array-flatten/package.json
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"array-flatten@1.1.1",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "array-flatten@1.1.1",
|
||||||
|
"_id": "array-flatten@1.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
|
||||||
|
"_location": "/array-flatten",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "array-flatten@1.1.1",
|
||||||
|
"name": "array-flatten",
|
||||||
|
"escapedName": "array-flatten",
|
||||||
|
"rawSpec": "1.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/express"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
|
"_spec": "1.1.1",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Blake Embrey",
|
||||||
|
"email": "hello@blakeembrey.com",
|
||||||
|
"url": "http://blakeembrey.me"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
||||||
|
},
|
||||||
|
"description": "Flatten an array of nested arrays into a single flat array",
|
||||||
|
"devDependencies": {
|
||||||
|
"istanbul": "^0.3.13",
|
||||||
|
"mocha": "^2.2.4",
|
||||||
|
"pre-commit": "^1.0.7",
|
||||||
|
"standard": "^3.7.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"array-flatten.js",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/blakeembrey/array-flatten",
|
||||||
|
"keywords": [
|
||||||
|
"array",
|
||||||
|
"flatten",
|
||||||
|
"arguments",
|
||||||
|
"depth"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "array-flatten.js",
|
||||||
|
"name": "array-flatten",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/blakeembrey/array-flatten.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "istanbul cover _mocha -- -R spec"
|
||||||
|
},
|
||||||
|
"version": "1.1.1"
|
||||||
|
}
|
70
node_modules/asap/CHANGES.md
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
|
||||||
|
## 2.0.6
|
||||||
|
|
||||||
|
Version 2.0.4 adds support for React Native by clarifying in package.json that
|
||||||
|
the browser environment does not support Node.js domains.
|
||||||
|
Why this is necessary, we leave as an exercise for the user.
|
||||||
|
|
||||||
|
## 2.0.3
|
||||||
|
|
||||||
|
Version 2.0.3 fixes a bug when adjusting the capacity of the task queue.
|
||||||
|
|
||||||
|
## 2.0.1-2.02
|
||||||
|
|
||||||
|
Version 2.0.1 fixes a bug in the way redirects were expressed that affected the
|
||||||
|
function of Browserify, but which Mr would tolerate.
|
||||||
|
|
||||||
|
## 2.0.0
|
||||||
|
|
||||||
|
Version 2 of ASAP is a full rewrite with a few salient changes.
|
||||||
|
First, the ASAP source is CommonJS only and designed with [Browserify][] and
|
||||||
|
[Browserify-compatible][Mr] module loaders in mind.
|
||||||
|
|
||||||
|
[Browserify]: https://github.com/substack/node-browserify
|
||||||
|
[Mr]: https://github.com/montagejs/mr
|
||||||
|
|
||||||
|
The new version has been refactored in two dimensions.
|
||||||
|
Support for Node.js and browsers have been separated, using Browserify
|
||||||
|
redirects and ASAP has been divided into two modules.
|
||||||
|
The "raw" layer depends on the tasks to catch thrown exceptions and unravel
|
||||||
|
Node.js domains.
|
||||||
|
|
||||||
|
The full implementation of ASAP is loadable as `require("asap")` in both Node.js
|
||||||
|
and browsers.
|
||||||
|
|
||||||
|
The raw layer that lacks exception handling overhead is loadable as
|
||||||
|
`require("asap/raw")`.
|
||||||
|
The interface is the same for both layers.
|
||||||
|
|
||||||
|
Tasks are no longer required to be functions, but can rather be any object that
|
||||||
|
implements `task.call()`.
|
||||||
|
With this feature you can recycle task objects to avoid garbage collector churn
|
||||||
|
and avoid closures in general.
|
||||||
|
|
||||||
|
The implementation has been rigorously documented so that our successors can
|
||||||
|
understand the scope of the problem that this module solves and all of its
|
||||||
|
nuances, ensuring that the next generation of implementations know what details
|
||||||
|
are essential.
|
||||||
|
|
||||||
|
- [asap.js](https://github.com/kriskowal/asap/blob/master/asap.js)
|
||||||
|
- [raw.js](https://github.com/kriskowal/asap/blob/master/raw.js)
|
||||||
|
- [browser-asap.js](https://github.com/kriskowal/asap/blob/master/browser-asap.js)
|
||||||
|
- [browser-raw.js](https://github.com/kriskowal/asap/blob/master/browser-raw.js)
|
||||||
|
|
||||||
|
The new version has also been rigorously tested across a broad spectrum of
|
||||||
|
browsers, in both the window and worker context.
|
||||||
|
The following charts capture the browser test results for the most recent
|
||||||
|
release.
|
||||||
|
The first chart shows test results for ASAP running in the main window context.
|
||||||
|
The second chart shows test results for ASAP running in a web worker context.
|
||||||
|
Test results are inconclusive (grey) on browsers that do not support web
|
||||||
|
workers.
|
||||||
|
These data are captured automatically by [Continuous
|
||||||
|
Integration][].
|
||||||
|
|
||||||
|
![Browser Compatibility](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-results-matrix.svg)
|
||||||
|
|
||||||
|
![Compatibility in Web Workers](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-worker-results-matrix.svg)
|
||||||
|
|
||||||
|
[Continuous Integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
|
||||||
|
|
21
node_modules/asap/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
Copyright 2009–2014 Contributors. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
|
237
node_modules/asap/README.md
generated
vendored
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
# ASAP
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/kriskowal/asap.png?branch=master)](https://travis-ci.org/kriskowal/asap)
|
||||||
|
|
||||||
|
Promise and asynchronous observer libraries, as well as hand-rolled callback
|
||||||
|
programs and libraries, often need a mechanism to postpone the execution of a
|
||||||
|
callback until the next available event.
|
||||||
|
(See [Designing API’s for Asynchrony][Zalgo].)
|
||||||
|
The `asap` function executes a task **as soon as possible** but not before it
|
||||||
|
returns, waiting only for the completion of the current event and previously
|
||||||
|
scheduled tasks.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
asap(function () {
|
||||||
|
// ...
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
[Zalgo]: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
|
||||||
|
|
||||||
|
This CommonJS package provides an `asap` module that exports a function that
|
||||||
|
executes a task function *as soon as possible*.
|
||||||
|
|
||||||
|
ASAP strives to schedule events to occur before yielding for IO, reflow,
|
||||||
|
or redrawing.
|
||||||
|
Each event receives an independent stack, with only platform code in parent
|
||||||
|
frames and the events run in the order they are scheduled.
|
||||||
|
|
||||||
|
ASAP provides a fast event queue that will execute tasks until it is
|
||||||
|
empty before yielding to the JavaScript engine's underlying event-loop.
|
||||||
|
When a task gets added to a previously empty event queue, ASAP schedules a flush
|
||||||
|
event, preferring for that event to occur before the JavaScript engine has an
|
||||||
|
opportunity to perform IO tasks or rendering, thus making the first task and
|
||||||
|
subsequent tasks semantically indistinguishable.
|
||||||
|
ASAP uses a variety of techniques to preserve this invariant on different
|
||||||
|
versions of browsers and Node.js.
|
||||||
|
|
||||||
|
By design, ASAP prevents input events from being handled until the task
|
||||||
|
queue is empty.
|
||||||
|
If the process is busy enough, this may cause incoming connection requests to be
|
||||||
|
dropped, and may cause existing connections to inform the sender to reduce the
|
||||||
|
transmission rate or stall.
|
||||||
|
ASAP allows this on the theory that, if there is enough work to do, there is no
|
||||||
|
sense in looking for trouble.
|
||||||
|
As a consequence, ASAP can interfere with smooth animation.
|
||||||
|
If your task should be tied to the rendering loop, consider using
|
||||||
|
`requestAnimationFrame` instead.
|
||||||
|
A long sequence of tasks can also effect the long running script dialog.
|
||||||
|
If this is a problem, you may be able to use ASAP’s cousin `setImmediate` to
|
||||||
|
break long processes into shorter intervals and periodically allow the browser
|
||||||
|
to breathe.
|
||||||
|
`setImmediate` will yield for IO, reflow, and repaint events.
|
||||||
|
It also returns a handler and can be canceled.
|
||||||
|
For a `setImmediate` shim, consider [YuzuJS setImmediate][setImmediate].
|
||||||
|
|
||||||
|
[setImmediate]: https://github.com/YuzuJS/setImmediate
|
||||||
|
|
||||||
|
Take care.
|
||||||
|
ASAP can sustain infinite recursive calls without warning.
|
||||||
|
It will not halt from a stack overflow, and it will not consume unbounded
|
||||||
|
memory.
|
||||||
|
This is behaviorally equivalent to an infinite loop.
|
||||||
|
Just as with infinite loops, you can monitor a Node.js process for this behavior
|
||||||
|
with a heart-beat signal.
|
||||||
|
As with infinite loops, a very small amount of caution goes a long way to
|
||||||
|
avoiding problems.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
function loop() {
|
||||||
|
asap(loop);
|
||||||
|
}
|
||||||
|
loop();
|
||||||
|
```
|
||||||
|
|
||||||
|
In browsers, if a task throws an exception, it will not interrupt the flushing
|
||||||
|
of high-priority tasks.
|
||||||
|
The exception will be postponed to a later, low-priority event to avoid
|
||||||
|
slow-downs.
|
||||||
|
In Node.js, if a task throws an exception, ASAP will resume flushing only if—and
|
||||||
|
only after—the error is handled by `domain.on("error")` or
|
||||||
|
`process.on("uncaughtException")`.
|
||||||
|
|
||||||
|
## Raw ASAP
|
||||||
|
|
||||||
|
Checking for exceptions comes at a cost.
|
||||||
|
The package also provides an `asap/raw` module that exports the underlying
|
||||||
|
implementation which is faster but stalls if a task throws an exception.
|
||||||
|
This internal version of the ASAP function does not check for errors.
|
||||||
|
If a task does throw an error, it will stall the event queue unless you manually
|
||||||
|
call `rawAsap.requestFlush()` before throwing the error, or any time after.
|
||||||
|
|
||||||
|
In Node.js, `asap/raw` also runs all tasks outside any domain.
|
||||||
|
If you need a task to be bound to your domain, you will have to do it manually.
|
||||||
|
|
||||||
|
```js
|
||||||
|
if (process.domain) {
|
||||||
|
task = process.domain.bind(task);
|
||||||
|
}
|
||||||
|
rawAsap(task);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
|
||||||
|
A task may be any object that implements `call()`.
|
||||||
|
A function will suffice, but closures tend not to be reusable and can cause
|
||||||
|
garbage collector churn.
|
||||||
|
Both `asap` and `rawAsap` accept task objects to give you the option of
|
||||||
|
recycling task objects or using higher callable object abstractions.
|
||||||
|
See the `asap` source for an illustration.
|
||||||
|
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
|
||||||
|
ASAP is tested on Node.js v0.10 and in a broad spectrum of web browsers.
|
||||||
|
The following charts capture the browser test results for the most recent
|
||||||
|
release.
|
||||||
|
The first chart shows test results for ASAP running in the main window context.
|
||||||
|
The second chart shows test results for ASAP running in a web worker context.
|
||||||
|
Test results are inconclusive (grey) on browsers that do not support web
|
||||||
|
workers.
|
||||||
|
These data are captured automatically by [Continuous
|
||||||
|
Integration][].
|
||||||
|
|
||||||
|
[Continuous Integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
|
||||||
|
|
||||||
|
![Browser Compatibility](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-results-matrix.svg)
|
||||||
|
|
||||||
|
![Compatibility in Web Workers](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-worker-results-matrix.svg)
|
||||||
|
|
||||||
|
## Caveats
|
||||||
|
|
||||||
|
When a task is added to an empty event queue, it is not always possible to
|
||||||
|
guarantee that the task queue will begin flushing immediately after the current
|
||||||
|
event.
|
||||||
|
However, once the task queue begins flushing, it will not yield until the queue
|
||||||
|
is empty, even if the queue grows while executing tasks.
|
||||||
|
|
||||||
|
The following browsers allow the use of [DOM mutation observers][] to access
|
||||||
|
the HTML [microtask queue][], and thus begin flushing ASAP's task queue
|
||||||
|
immediately at the end of the current event loop turn, before any rendering or
|
||||||
|
IO:
|
||||||
|
|
||||||
|
[microtask queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#microtask-queue
|
||||||
|
[DOM mutation observers]: http://dom.spec.whatwg.org/#mutation-observers
|
||||||
|
|
||||||
|
- Android 4–4.3
|
||||||
|
- Chrome 26–34
|
||||||
|
- Firefox 14–29
|
||||||
|
- Internet Explorer 11
|
||||||
|
- iPad Safari 6–7.1
|
||||||
|
- iPhone Safari 7–7.1
|
||||||
|
- Safari 6–7
|
||||||
|
|
||||||
|
In the absense of mutation observers, there are a few browsers, and situations
|
||||||
|
like web workers in some of the above browsers, where [message channels][]
|
||||||
|
would be a useful way to avoid falling back to timers.
|
||||||
|
Message channels give direct access to the HTML [task queue][], so the ASAP
|
||||||
|
task queue would flush after any already queued rendering and IO tasks, but
|
||||||
|
without having the minimum delay imposed by timers.
|
||||||
|
However, among these browsers, Internet Explorer 10 and Safari do not reliably
|
||||||
|
dispatch messages, so they are not worth the trouble to implement.
|
||||||
|
|
||||||
|
[message channels]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#message-channels
|
||||||
|
[task queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#concept-task
|
||||||
|
|
||||||
|
- Internet Explorer 10
|
||||||
|
- Safair 5.0-1
|
||||||
|
- Opera 11-12
|
||||||
|
|
||||||
|
In the absense of mutation observers, these browsers and the following browsers
|
||||||
|
all fall back to using `setTimeout` and `setInterval` to ensure that a `flush`
|
||||||
|
occurs.
|
||||||
|
The implementation uses both and cancels whatever handler loses the race, since
|
||||||
|
`setTimeout` tends to occasionally skip tasks in unisolated circumstances.
|
||||||
|
Timers generally delay the flushing of ASAP's task queue for four milliseconds.
|
||||||
|
|
||||||
|
- Firefox 3–13
|
||||||
|
- Internet Explorer 6–10
|
||||||
|
- iPad Safari 4.3
|
||||||
|
- Lynx 2.8.7
|
||||||
|
|
||||||
|
|
||||||
|
## Heritage
|
||||||
|
|
||||||
|
ASAP has been factored out of the [Q][] asynchronous promise library.
|
||||||
|
It originally had a naïve implementation in terms of `setTimeout`, but
|
||||||
|
[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be
|
||||||
|
useful for creating a high-priority, no-delay event dispatch hack.
|
||||||
|
Since then, Internet Explorer proposed and implemented `setImmediate`.
|
||||||
|
Robert Katić began contributing to Q by measuring the performance of
|
||||||
|
the internal implementation of `asap`, paying particular attention to
|
||||||
|
error recovery.
|
||||||
|
Domenic, Robert, and Kris Kowal collectively settled on the current strategy of
|
||||||
|
unrolling the high-priority event queue internally regardless of what strategy
|
||||||
|
we used to dispatch the potentially lower-priority flush event.
|
||||||
|
Domenic went on to make ASAP cooperate with Node.js domains.
|
||||||
|
|
||||||
|
[Q]: https://github.com/kriskowal/q
|
||||||
|
[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html
|
||||||
|
|
||||||
|
For further reading, Nicholas Zakas provided a thorough article on [The
|
||||||
|
Case for setImmediate][NCZ].
|
||||||
|
|
||||||
|
[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/
|
||||||
|
|
||||||
|
Ember’s RSVP promise implementation later [adopted][RSVP ASAP] the name ASAP but
|
||||||
|
further developed the implentation.
|
||||||
|
Particularly, The `MessagePort` implementation was abandoned due to interaction
|
||||||
|
[problems with Mobile Internet Explorer][IE Problems] in favor of an
|
||||||
|
implementation backed on the newer and more reliable DOM `MutationObserver`
|
||||||
|
interface.
|
||||||
|
These changes were back-ported into this library.
|
||||||
|
|
||||||
|
[IE Problems]: https://github.com/cujojs/when/issues/197
|
||||||
|
[RSVP ASAP]: https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
||||||
|
|
||||||
|
In addition, ASAP factored into `asap` and `asap/raw`, such that `asap` remained
|
||||||
|
exception-safe, but `asap/raw` provided a tight kernel that could be used for
|
||||||
|
tasks that guaranteed that they would not throw exceptions.
|
||||||
|
This core is useful for promise implementations that capture thrown errors in
|
||||||
|
rejected promises and do not need a second safety net.
|
||||||
|
At the same time, the exception handling in `asap` was factored into separate
|
||||||
|
implementations for Node.js and browsers, using the the [Browserify][Browser
|
||||||
|
Config] `browser` property in `package.json` to instruct browser module loaders
|
||||||
|
and bundlers, including [Browserify][], [Mr][], and [Mop][], to use the
|
||||||
|
browser-only implementation.
|
||||||
|
|
||||||
|
[Browser Config]: https://gist.github.com/defunctzombie/4339901
|
||||||
|
[Browserify]: https://github.com/substack/node-browserify
|
||||||
|
[Mr]: https://github.com/montagejs/mr
|
||||||
|
[Mop]: https://github.com/montagejs/mop
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright 2009-2014 by Contributors
|
||||||
|
MIT License (enclosed)
|
||||||
|
|
65
node_modules/asap/asap.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var rawAsap = require("./raw");
|
||||||
|
var freeTasks = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls a task as soon as possible after returning, in its own event, with
|
||||||
|
* priority over IO events. An exception thrown in a task can be handled by
|
||||||
|
* `process.on("uncaughtException") or `domain.on("error")`, but will otherwise
|
||||||
|
* crash the process. If the error is handled, all subsequent tasks will
|
||||||
|
* resume.
|
||||||
|
*
|
||||||
|
* @param {{call}} task A callable object, typically a function that takes no
|
||||||
|
* arguments.
|
||||||
|
*/
|
||||||
|
module.exports = asap;
|
||||||
|
function asap(task) {
|
||||||
|
var rawTask;
|
||||||
|
if (freeTasks.length) {
|
||||||
|
rawTask = freeTasks.pop();
|
||||||
|
} else {
|
||||||
|
rawTask = new RawTask();
|
||||||
|
}
|
||||||
|
rawTask.task = task;
|
||||||
|
rawTask.domain = process.domain;
|
||||||
|
rawAsap(rawTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RawTask() {
|
||||||
|
this.task = null;
|
||||||
|
this.domain = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
RawTask.prototype.call = function () {
|
||||||
|
if (this.domain) {
|
||||||
|
this.domain.enter();
|
||||||
|
}
|
||||||
|
var threw = true;
|
||||||
|
try {
|
||||||
|
this.task.call();
|
||||||
|
threw = false;
|
||||||
|
// If the task throws an exception (presumably) Node.js restores the
|
||||||
|
// domain stack for the next event.
|
||||||
|
if (this.domain) {
|
||||||
|
this.domain.exit();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// We use try/finally and a threw flag to avoid messing up stack traces
|
||||||
|
// when we catch and release errors.
|
||||||
|
if (threw) {
|
||||||
|
// In Node.js, uncaught exceptions are considered fatal errors.
|
||||||
|
// Re-throw them to interrupt flushing!
|
||||||
|
// Ensure that flushing continues if an uncaught exception is
|
||||||
|
// suppressed listening process.on("uncaughtException") or
|
||||||
|
// domain.on("error").
|
||||||
|
rawAsap.requestFlush();
|
||||||
|
}
|
||||||
|
// If the task threw an error, we do not want to exit the domain here.
|
||||||
|
// Exiting the domain would prevent the domain from catching the error.
|
||||||
|
this.task = null;
|
||||||
|
this.domain = null;
|
||||||
|
freeTasks.push(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
66
node_modules/asap/browser-asap.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// rawAsap provides everything we need except exception management.
|
||||||
|
var rawAsap = require("./raw");
|
||||||
|
// RawTasks are recycled to reduce GC churn.
|
||||||
|
var freeTasks = [];
|
||||||
|
// We queue errors to ensure they are thrown in right order (FIFO).
|
||||||
|
// Array-as-queue is good enough here, since we are just dealing with exceptions.
|
||||||
|
var pendingErrors = [];
|
||||||
|
var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
|
||||||
|
|
||||||
|
function throwFirstError() {
|
||||||
|
if (pendingErrors.length) {
|
||||||
|
throw pendingErrors.shift();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls a task as soon as possible after returning, in its own event, with priority
|
||||||
|
* over other events like animation, reflow, and repaint. An error thrown from an
|
||||||
|
* event will not interrupt, nor even substantially slow down the processing of
|
||||||
|
* other events, but will be rather postponed to a lower priority event.
|
||||||
|
* @param {{call}} task A callable object, typically a function that takes no
|
||||||
|
* arguments.
|
||||||
|
*/
|
||||||
|
module.exports = asap;
|
||||||
|
function asap(task) {
|
||||||
|
var rawTask;
|
||||||
|
if (freeTasks.length) {
|
||||||
|
rawTask = freeTasks.pop();
|
||||||
|
} else {
|
||||||
|
rawTask = new RawTask();
|
||||||
|
}
|
||||||
|
rawTask.task = task;
|
||||||
|
rawAsap(rawTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We wrap tasks with recyclable task objects. A task object implements
|
||||||
|
// `call`, just like a function.
|
||||||
|
function RawTask() {
|
||||||
|
this.task = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The sole purpose of wrapping the task is to catch the exception and recycle
|
||||||
|
// the task object after its single use.
|
||||||
|
RawTask.prototype.call = function () {
|
||||||
|
try {
|
||||||
|
this.task.call();
|
||||||
|
} catch (error) {
|
||||||
|
if (asap.onerror) {
|
||||||
|
// This hook exists purely for testing purposes.
|
||||||
|
// Its name will be periodically randomized to break any code that
|
||||||
|
// depends on its existence.
|
||||||
|
asap.onerror(error);
|
||||||
|
} else {
|
||||||
|
// In a web browser, exceptions are not fatal. However, to avoid
|
||||||
|
// slowing down the queue of pending tasks, we rethrow the error in a
|
||||||
|
// lower priority turn.
|
||||||
|
pendingErrors.push(error);
|
||||||
|
requestErrorThrow();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
this.task = null;
|
||||||
|
freeTasks[freeTasks.length] = this;
|
||||||
|
}
|
||||||
|
};
|
223
node_modules/asap/browser-raw.js
generated
vendored
Normal file
|
@ -0,0 +1,223 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Use the fastest means possible to execute a task in its own turn, with
|
||||||
|
// priority over other events including IO, animation, reflow, and redraw
|
||||||
|
// events in browsers.
|
||||||
|
//
|
||||||
|
// An exception thrown by a task will permanently interrupt the processing of
|
||||||
|
// subsequent tasks. The higher level `asap` function ensures that if an
|
||||||
|
// exception is thrown by a task, that the task queue will continue flushing as
|
||||||
|
// soon as possible, but if you use `rawAsap` directly, you are responsible to
|
||||||
|
// either ensure that no exceptions are thrown from your task, or to manually
|
||||||
|
// call `rawAsap.requestFlush` if an exception is thrown.
|
||||||
|
module.exports = rawAsap;
|
||||||
|
function rawAsap(task) {
|
||||||
|
if (!queue.length) {
|
||||||
|
requestFlush();
|
||||||
|
flushing = true;
|
||||||
|
}
|
||||||
|
// Equivalent to push, but avoids a function call.
|
||||||
|
queue[queue.length] = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
var queue = [];
|
||||||
|
// Once a flush has been requested, no further calls to `requestFlush` are
|
||||||
|
// necessary until the next `flush` completes.
|
||||||
|
var flushing = false;
|
||||||
|
// `requestFlush` is an implementation-specific method that attempts to kick
|
||||||
|
// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
|
||||||
|
// the event queue before yielding to the browser's own event loop.
|
||||||
|
var requestFlush;
|
||||||
|
// The position of the next task to execute in the task queue. This is
|
||||||
|
// preserved between calls to `flush` so that it can be resumed if
|
||||||
|
// a task throws an exception.
|
||||||
|
var index = 0;
|
||||||
|
// If a task schedules additional tasks recursively, the task queue can grow
|
||||||
|
// unbounded. To prevent memory exhaustion, the task queue will periodically
|
||||||
|
// truncate already-completed tasks.
|
||||||
|
var capacity = 1024;
|
||||||
|
|
||||||
|
// The flush function processes all tasks that have been scheduled with
|
||||||
|
// `rawAsap` unless and until one of those tasks throws an exception.
|
||||||
|
// If a task throws an exception, `flush` ensures that its state will remain
|
||||||
|
// consistent and will resume where it left off when called again.
|
||||||
|
// However, `flush` does not make any arrangements to be called again if an
|
||||||
|
// exception is thrown.
|
||||||
|
function flush() {
|
||||||
|
while (index < queue.length) {
|
||||||
|
var currentIndex = index;
|
||||||
|
// Advance the index before calling the task. This ensures that we will
|
||||||
|
// begin flushing on the next task the task throws an error.
|
||||||
|
index = index + 1;
|
||||||
|
queue[currentIndex].call();
|
||||||
|
// Prevent leaking memory for long chains of recursive calls to `asap`.
|
||||||
|
// If we call `asap` within tasks scheduled by `asap`, the queue will
|
||||||
|
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
||||||
|
// shift tasks off the queue after they have been executed.
|
||||||
|
// Instead, we periodically shift 1024 tasks off the queue.
|
||||||
|
if (index > capacity) {
|
||||||
|
// Manually shift all values starting at the index back to the
|
||||||
|
// beginning of the queue.
|
||||||
|
for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
|
||||||
|
queue[scan] = queue[scan + index];
|
||||||
|
}
|
||||||
|
queue.length -= index;
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queue.length = 0;
|
||||||
|
index = 0;
|
||||||
|
flushing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `requestFlush` is implemented using a strategy based on data collected from
|
||||||
|
// every available SauceLabs Selenium web driver worker at time of writing.
|
||||||
|
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
|
||||||
|
|
||||||
|
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
|
||||||
|
// have WebKitMutationObserver but not un-prefixed MutationObserver.
|
||||||
|
// Must use `global` or `self` instead of `window` to work in both frames and web
|
||||||
|
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
|
||||||
|
|
||||||
|
/* globals self */
|
||||||
|
var scope = typeof global !== "undefined" ? global : self;
|
||||||
|
var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
|
||||||
|
|
||||||
|
// MutationObservers are desirable because they have high priority and work
|
||||||
|
// reliably everywhere they are implemented.
|
||||||
|
// They are implemented in all modern browsers.
|
||||||
|
//
|
||||||
|
// - Android 4-4.3
|
||||||
|
// - Chrome 26-34
|
||||||
|
// - Firefox 14-29
|
||||||
|
// - Internet Explorer 11
|
||||||
|
// - iPad Safari 6-7.1
|
||||||
|
// - iPhone Safari 7-7.1
|
||||||
|
// - Safari 6-7
|
||||||
|
if (typeof BrowserMutationObserver === "function") {
|
||||||
|
requestFlush = makeRequestCallFromMutationObserver(flush);
|
||||||
|
|
||||||
|
// MessageChannels are desirable because they give direct access to the HTML
|
||||||
|
// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
|
||||||
|
// 11-12, and in web workers in many engines.
|
||||||
|
// Although message channels yield to any queued rendering and IO tasks, they
|
||||||
|
// would be better than imposing the 4ms delay of timers.
|
||||||
|
// However, they do not work reliably in Internet Explorer or Safari.
|
||||||
|
|
||||||
|
// Internet Explorer 10 is the only browser that has setImmediate but does
|
||||||
|
// not have MutationObservers.
|
||||||
|
// Although setImmediate yields to the browser's renderer, it would be
|
||||||
|
// preferrable to falling back to setTimeout since it does not have
|
||||||
|
// the minimum 4ms penalty.
|
||||||
|
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
|
||||||
|
// Desktop to a lesser extent) that renders both setImmediate and
|
||||||
|
// MessageChannel useless for the purposes of ASAP.
|
||||||
|
// https://github.com/kriskowal/q/issues/396
|
||||||
|
|
||||||
|
// Timers are implemented universally.
|
||||||
|
// We fall back to timers in workers in most engines, and in foreground
|
||||||
|
// contexts in the following browsers.
|
||||||
|
// However, note that even this simple case requires nuances to operate in a
|
||||||
|
// broad spectrum of browsers.
|
||||||
|
//
|
||||||
|
// - Firefox 3-13
|
||||||
|
// - Internet Explorer 6-9
|
||||||
|
// - iPad Safari 4.3
|
||||||
|
// - Lynx 2.8.7
|
||||||
|
} else {
|
||||||
|
requestFlush = makeRequestCallFromTimer(flush);
|
||||||
|
}
|
||||||
|
|
||||||
|
// `requestFlush` requests that the high priority event queue be flushed as
|
||||||
|
// soon as possible.
|
||||||
|
// This is useful to prevent an error thrown in a task from stalling the event
|
||||||
|
// queue if the exception handled by Node.js’s
|
||||||
|
// `process.on("uncaughtException")` or by a domain.
|
||||||
|
rawAsap.requestFlush = requestFlush;
|
||||||
|
|
||||||
|
// To request a high priority event, we induce a mutation observer by toggling
|
||||||
|
// the text of a text node between "1" and "-1".
|
||||||
|
function makeRequestCallFromMutationObserver(callback) {
|
||||||
|
var toggle = 1;
|
||||||
|
var observer = new BrowserMutationObserver(callback);
|
||||||
|
var node = document.createTextNode("");
|
||||||
|
observer.observe(node, {characterData: true});
|
||||||
|
return function requestCall() {
|
||||||
|
toggle = -toggle;
|
||||||
|
node.data = toggle;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// The message channel technique was discovered by Malte Ubl and was the
|
||||||
|
// original foundation for this library.
|
||||||
|
// http://www.nonblocking.io/2011/06/windownexttick.html
|
||||||
|
|
||||||
|
// Safari 6.0.5 (at least) intermittently fails to create message ports on a
|
||||||
|
// page's first load. Thankfully, this version of Safari supports
|
||||||
|
// MutationObservers, so we don't need to fall back in that case.
|
||||||
|
|
||||||
|
// function makeRequestCallFromMessageChannel(callback) {
|
||||||
|
// var channel = new MessageChannel();
|
||||||
|
// channel.port1.onmessage = callback;
|
||||||
|
// return function requestCall() {
|
||||||
|
// channel.port2.postMessage(0);
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// For reasons explained above, we are also unable to use `setImmediate`
|
||||||
|
// under any circumstances.
|
||||||
|
// Even if we were, there is another bug in Internet Explorer 10.
|
||||||
|
// It is not sufficient to assign `setImmediate` to `requestFlush` because
|
||||||
|
// `setImmediate` must be called *by name* and therefore must be wrapped in a
|
||||||
|
// closure.
|
||||||
|
// Never forget.
|
||||||
|
|
||||||
|
// function makeRequestCallFromSetImmediate(callback) {
|
||||||
|
// return function requestCall() {
|
||||||
|
// setImmediate(callback);
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Safari 6.0 has a problem where timers will get lost while the user is
|
||||||
|
// scrolling. This problem does not impact ASAP because Safari 6.0 supports
|
||||||
|
// mutation observers, so that implementation is used instead.
|
||||||
|
// However, if we ever elect to use timers in Safari, the prevalent work-around
|
||||||
|
// is to add a scroll event listener that calls for a flush.
|
||||||
|
|
||||||
|
// `setTimeout` does not call the passed callback if the delay is less than
|
||||||
|
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
|
||||||
|
// even then.
|
||||||
|
|
||||||
|
function makeRequestCallFromTimer(callback) {
|
||||||
|
return function requestCall() {
|
||||||
|
// We dispatch a timeout with a specified delay of 0 for engines that
|
||||||
|
// can reliably accommodate that request. This will usually be snapped
|
||||||
|
// to a 4 milisecond delay, but once we're flushing, there's no delay
|
||||||
|
// between events.
|
||||||
|
var timeoutHandle = setTimeout(handleTimer, 0);
|
||||||
|
// However, since this timer gets frequently dropped in Firefox
|
||||||
|
// workers, we enlist an interval handle that will try to fire
|
||||||
|
// an event 20 times per second until it succeeds.
|
||||||
|
var intervalHandle = setInterval(handleTimer, 50);
|
||||||
|
|
||||||
|
function handleTimer() {
|
||||||
|
// Whichever timer succeeds will cancel both timers and
|
||||||
|
// execute the callback.
|
||||||
|
clearTimeout(timeoutHandle);
|
||||||
|
clearInterval(intervalHandle);
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is for `asap.js` only.
|
||||||
|
// Its name will be periodically randomized to break any code that depends on
|
||||||
|
// its existence.
|
||||||
|
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
|
||||||
|
|
||||||
|
// ASAP was originally a nextTick shim included in Q. This was factored out
|
||||||
|
// into this ASAP package. It was later adapted to RSVP which made further
|
||||||
|
// amendments. These decisions, particularly to marginalize MessageChannel and
|
||||||
|
// to capture the MutationObserver implementation in a closure, were integrated
|
||||||
|
// back into ASAP proper.
|
||||||
|
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
90
node_modules/asap/package.json
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"asap@2.0.6",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "asap@2.0.6",
|
||||||
|
"_id": "asap@2.0.6",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=",
|
||||||
|
"_location": "/asap",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "asap@2.0.6",
|
||||||
|
"name": "asap",
|
||||||
|
"escapedName": "asap",
|
||||||
|
"rawSpec": "2.0.6",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.6"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/promise"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||||
|
"_spec": "2.0.6",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"browser": {
|
||||||
|
"./asap": "./browser-asap.js",
|
||||||
|
"./asap.js": "./browser-asap.js",
|
||||||
|
"./raw": "./browser-raw.js",
|
||||||
|
"./raw.js": "./browser-raw.js",
|
||||||
|
"./test/domain.js": "./test/browser-domain.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/kriskowal/asap/issues"
|
||||||
|
},
|
||||||
|
"description": "High-priority task queue for Node.js and browsers",
|
||||||
|
"devDependencies": {
|
||||||
|
"benchmark": "^1.0.0",
|
||||||
|
"events": "^1.0.1",
|
||||||
|
"jshint": "^2.5.1",
|
||||||
|
"knox": "^0.8.10",
|
||||||
|
"mr": "^2.0.5",
|
||||||
|
"opener": "^1.3.0",
|
||||||
|
"q": "^2.0.3",
|
||||||
|
"q-io": "^2.0.3",
|
||||||
|
"saucelabs": "^0.1.1",
|
||||||
|
"wd": "^0.2.21",
|
||||||
|
"weak-map": "^1.0.5"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"raw.js",
|
||||||
|
"asap.js",
|
||||||
|
"browser-raw.js",
|
||||||
|
"browser-asap.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/kriskowal/asap#readme",
|
||||||
|
"keywords": [
|
||||||
|
"event",
|
||||||
|
"task",
|
||||||
|
"queue"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./asap.js",
|
||||||
|
"name": "asap",
|
||||||
|
"react-native": {
|
||||||
|
"domain": false
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/kriskowal/asap.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"benchmarks": "node benchmarks",
|
||||||
|
"lint": "jshint raw.js asap.js browser-raw.js browser-asap.js $(find scripts -name '*.js' | grep -v gauntlet)",
|
||||||
|
"test": "npm run lint && npm run test-node",
|
||||||
|
"test-browser": "node scripts/publish-bundle.js test/asap-test.js | xargs opener",
|
||||||
|
"test-node": "node test/asap-test.js",
|
||||||
|
"test-publish": "node scripts/publish-bundle.js test/asap-test.js | pbcopy",
|
||||||
|
"test-saucelabs": "node scripts/saucelabs.js test/asap-test.js scripts/saucelabs-spot-configurations.json",
|
||||||
|
"test-saucelabs-all": "node scripts/saucelabs.js test/asap-test.js scripts/saucelabs-all-configurations.json",
|
||||||
|
"test-saucelabs-worker": "node scripts/saucelabs-worker-test.js scripts/saucelabs-spot-configurations.json",
|
||||||
|
"test-saucelabs-worker-all": "node scripts/saucelabs-worker-test.js scripts/saucelabs-all-configurations.json",
|
||||||
|
"test-travis": "npm run lint && npm run test-node && npm run test-saucelabs && npm run test-saucelabs-worker"
|
||||||
|
},
|
||||||
|
"version": "2.0.6"
|
||||||
|
}
|
101
node_modules/asap/raw.js
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var domain; // The domain module is executed on demand
|
||||||
|
var hasSetImmediate = typeof setImmediate === "function";
|
||||||
|
|
||||||
|
// Use the fastest means possible to execute a task in its own turn, with
|
||||||
|
// priority over other events including network IO events in Node.js.
|
||||||
|
//
|
||||||
|
// An exception thrown by a task will permanently interrupt the processing of
|
||||||
|
// subsequent tasks. The higher level `asap` function ensures that if an
|
||||||
|
// exception is thrown by a task, that the task queue will continue flushing as
|
||||||
|
// soon as possible, but if you use `rawAsap` directly, you are responsible to
|
||||||
|
// either ensure that no exceptions are thrown from your task, or to manually
|
||||||
|
// call `rawAsap.requestFlush` if an exception is thrown.
|
||||||
|
module.exports = rawAsap;
|
||||||
|
function rawAsap(task) {
|
||||||
|
if (!queue.length) {
|
||||||
|
requestFlush();
|
||||||
|
flushing = true;
|
||||||
|
}
|
||||||
|
// Avoids a function call
|
||||||
|
queue[queue.length] = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
var queue = [];
|
||||||
|
// Once a flush has been requested, no further calls to `requestFlush` are
|
||||||
|
// necessary until the next `flush` completes.
|
||||||
|
var flushing = false;
|
||||||
|
// The position of the next task to execute in the task queue. This is
|
||||||
|
// preserved between calls to `flush` so that it can be resumed if
|
||||||
|
// a task throws an exception.
|
||||||
|
var index = 0;
|
||||||
|
// If a task schedules additional tasks recursively, the task queue can grow
|
||||||
|
// unbounded. To prevent memory excaustion, the task queue will periodically
|
||||||
|
// truncate already-completed tasks.
|
||||||
|
var capacity = 1024;
|
||||||
|
|
||||||
|
// The flush function processes all tasks that have been scheduled with
|
||||||
|
// `rawAsap` unless and until one of those tasks throws an exception.
|
||||||
|
// If a task throws an exception, `flush` ensures that its state will remain
|
||||||
|
// consistent and will resume where it left off when called again.
|
||||||
|
// However, `flush` does not make any arrangements to be called again if an
|
||||||
|
// exception is thrown.
|
||||||
|
function flush() {
|
||||||
|
while (index < queue.length) {
|
||||||
|
var currentIndex = index;
|
||||||
|
// Advance the index before calling the task. This ensures that we will
|
||||||
|
// begin flushing on the next task the task throws an error.
|
||||||
|
index = index + 1;
|
||||||
|
queue[currentIndex].call();
|
||||||
|
// Prevent leaking memory for long chains of recursive calls to `asap`.
|
||||||
|
// If we call `asap` within tasks scheduled by `asap`, the queue will
|
||||||
|
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
||||||
|
// shift tasks off the queue after they have been executed.
|
||||||
|
// Instead, we periodically shift 1024 tasks off the queue.
|
||||||
|
if (index > capacity) {
|
||||||
|
// Manually shift all values starting at the index back to the
|
||||||
|
// beginning of the queue.
|
||||||
|
for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
|
||||||
|
queue[scan] = queue[scan + index];
|
||||||
|
}
|
||||||
|
queue.length -= index;
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queue.length = 0;
|
||||||
|
index = 0;
|
||||||
|
flushing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rawAsap.requestFlush = requestFlush;
|
||||||
|
function requestFlush() {
|
||||||
|
// Ensure flushing is not bound to any domain.
|
||||||
|
// It is not sufficient to exit the domain, because domains exist on a stack.
|
||||||
|
// To execute code outside of any domain, the following dance is necessary.
|
||||||
|
var parentDomain = process.domain;
|
||||||
|
if (parentDomain) {
|
||||||
|
if (!domain) {
|
||||||
|
// Lazy execute the domain module.
|
||||||
|
// Only employed if the user elects to use domains.
|
||||||
|
domain = require("domain");
|
||||||
|
}
|
||||||
|
domain.active = process.domain = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `setImmediate` is slower that `process.nextTick`, but `process.nextTick`
|
||||||
|
// cannot handle recursion.
|
||||||
|
// `requestFlush` will only be called recursively from `asap.js`, to resume
|
||||||
|
// flushing after an error is thrown into a domain.
|
||||||
|
// Conveniently, `setImmediate` was introduced in the same version
|
||||||
|
// `process.nextTick` started throwing recursion errors.
|
||||||
|
if (flushing && hasSetImmediate) {
|
||||||
|
setImmediate(flush);
|
||||||
|
} else {
|
||||||
|
process.nextTick(flush);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentDomain) {
|
||||||
|
domain.active = process.domain = parentDomain;
|
||||||
|
}
|
||||||
|
}
|
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
test
|
||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
Makefile
|
||||||
|
example.js
|
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
# balanced-match
|
||||||
|
|
||||||
|
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||||
|
|
||||||
|
[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
|
||||||
|
[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
|
||||||
|
|
||||||
|
[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Get the first matching pair of braces:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var balanced = require('balanced-match');
|
||||||
|
|
||||||
|
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||||
|
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||||
|
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||||
|
```
|
||||||
|
|
||||||
|
The matches are:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ node example.js
|
||||||
|
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||||
|
{ start: 3,
|
||||||
|
end: 9,
|
||||||
|
pre: 'pre',
|
||||||
|
body: 'first',
|
||||||
|
post: 'between{second}post' }
|
||||||
|
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### var m = balanced(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
object with those keys:
|
||||||
|
|
||||||
|
* **start** the index of the first match of `a`
|
||||||
|
* **end** the index of the matching `b`
|
||||||
|
* **pre** the preamble, `a` and `b` not included
|
||||||
|
* **body** the match, `a` and `b` not included
|
||||||
|
* **post** the postscript, `a` and `b` not included
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||||
|
|
||||||
|
### var r = balanced.range(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
array with indexes: `[ <a index>, <b index> ]`.
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install balanced-match
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
'use strict';
|
||||||
|
module.exports = balanced;
|
||||||
|
function balanced(a, b, str) {
|
||||||
|
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||||
|
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||||
|
|
||||||
|
var r = range(a, b, str);
|
||||||
|
|
||||||
|
return r && {
|
||||||
|
start: r[0],
|
||||||
|
end: r[1],
|
||||||
|
pre: str.slice(0, r[0]),
|
||||||
|
body: str.slice(r[0] + a.length, r[1]),
|
||||||
|
post: str.slice(r[1] + b.length)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeMatch(reg, str) {
|
||||||
|
var m = str.match(reg);
|
||||||
|
return m ? m[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
balanced.range = range;
|
||||||
|
function range(a, b, str) {
|
||||||
|
var begs, beg, left, right, result;
|
||||||
|
var ai = str.indexOf(a);
|
||||||
|
var bi = str.indexOf(b, ai + 1);
|
||||||
|
var i = ai;
|
||||||
|
|
||||||
|
if (ai >= 0 && bi > 0) {
|
||||||
|
begs = [];
|
||||||
|
left = str.length;
|
||||||
|
|
||||||
|
while (i >= 0 && !result) {
|
||||||
|
if (i == ai) {
|
||||||
|
begs.push(i);
|
||||||
|
ai = str.indexOf(a, i + 1);
|
||||||
|
} else if (begs.length == 1) {
|
||||||
|
result = [ begs.pop(), bi ];
|
||||||
|
} else {
|
||||||
|
beg = begs.pop();
|
||||||
|
if (beg < left) {
|
||||||
|
left = beg;
|
||||||
|
right = bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
bi = str.indexOf(b, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = ai < bi && ai >= 0 ? ai : bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begs.length) {
|
||||||
|
result = [ left, right ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
80
node_modules/balanced-match/package.json
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"balanced-match@1.0.0",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "balanced-match@1.0.0",
|
||||||
|
"_id": "balanced-match@1.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||||
|
"_location": "/balanced-match",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "balanced-match@1.0.0",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"escapedName": "balanced-match",
|
||||||
|
"rawSpec": "1.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/brace-expansion"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"_spec": "1.0.0",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Gruber",
|
||||||
|
"email": "mail@juliangruber.com",
|
||||||
|
"url": "http://juliangruber.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||||
|
"devDependencies": {
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tape": "^4.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"regexp",
|
||||||
|
"test",
|
||||||
|
"balanced",
|
||||||
|
"parse"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "make bench",
|
||||||
|
"test": "make test"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/20..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/25..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
52
node_modules/basic-auth/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
2.0.1 / 2018-09-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: safe-buffer@5.1.2
|
||||||
|
|
||||||
|
2.0.0 / 2017-09-12
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Drop support for Node.js below 0.8
|
||||||
|
* Remove `auth(ctx)` signature -- pass in header or `auth(ctx.req)`
|
||||||
|
* Use `safe-buffer` for improved Buffer API
|
||||||
|
|
||||||
|
1.1.0 / 2016-11-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add `auth.parse` for low-level string parsing
|
||||||
|
|
||||||
|
1.0.4 / 2016-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Improve error message when `req` argument is not an object
|
||||||
|
* Improve error message when `req` missing `headers` property
|
||||||
|
|
||||||
|
1.0.3 / 2015-07-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix regression accepting a Koa context
|
||||||
|
|
||||||
|
1.0.2 / 2015-06-12
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Improve error message when `req` argument missing
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: hoist regular expression
|
||||||
|
* perf: parse with regular expressions
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.0.1 / 2015-05-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Update readme
|
||||||
|
|
||||||
|
1.0.0 / 2014-07-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support empty password
|
||||||
|
* Support empty username
|
||||||
|
|
||||||
|
0.0.1 / 2013-11-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
24
node_modules/basic-auth/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2013 TJ Holowaychuk
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
113
node_modules/basic-auth/README.md
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
# basic-auth
|
||||||
|
|
||||||
|
[![NPM Version][npm-image]][npm-url]
|
||||||
|
[![NPM Downloads][downloads-image]][downloads-url]
|
||||||
|
[![Node.js Version][node-version-image]][node-version-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Generic basic auth Authorization header field parser for whatever.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||||
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||||
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install basic-auth
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
```
|
||||||
|
|
||||||
|
### auth(req)
|
||||||
|
|
||||||
|
Get the basic auth credentials from the given request. The `Authorization`
|
||||||
|
header is parsed and if the header is invalid, `undefined` is returned,
|
||||||
|
otherwise an object with `name` and `pass` properties.
|
||||||
|
|
||||||
|
### auth.parse(string)
|
||||||
|
|
||||||
|
Parse a basic auth authorization header string. This will return an object
|
||||||
|
with `name` and `pass` properties, or `undefined` if the string is invalid.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Pass a Node.js request object to the module export. If parsing fails
|
||||||
|
`undefined` is returned, otherwise an object with `.name` and `.pass`.
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars, no-undef -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
var user = auth(req)
|
||||||
|
// => { name: 'something', pass: 'whatever' }
|
||||||
|
```
|
||||||
|
|
||||||
|
A header string from any other location can also be parsed with
|
||||||
|
`auth.parse`, for example a `Proxy-Authorization` header:
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars, no-undef -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
var user = auth.parse(req.getHeader('Proxy-Authorization'))
|
||||||
|
```
|
||||||
|
|
||||||
|
### With vanilla node.js http server
|
||||||
|
|
||||||
|
```js
|
||||||
|
var http = require('http')
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
var compare = require('tsscmp')
|
||||||
|
|
||||||
|
// Create server
|
||||||
|
var server = http.createServer(function (req, res) {
|
||||||
|
var credentials = auth(req)
|
||||||
|
|
||||||
|
// Check credentials
|
||||||
|
// The "check" function will typically be against your user store
|
||||||
|
if (!credentials || !check(credentials.name, credentials.pass)) {
|
||||||
|
res.statusCode = 401
|
||||||
|
res.setHeader('WWW-Authenticate', 'Basic realm="example"')
|
||||||
|
res.end('Access denied')
|
||||||
|
} else {
|
||||||
|
res.end('Access granted')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Basic function to validate credentials for example
|
||||||
|
function check (name, pass) {
|
||||||
|
var valid = true
|
||||||
|
|
||||||
|
// Simple method to prevent short-circut and use timing-safe compare
|
||||||
|
valid = compare(name, 'john') && valid
|
||||||
|
valid = compare(pass, 'secret') && valid
|
||||||
|
|
||||||
|
return valid
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listen
|
||||||
|
server.listen(3000)
|
||||||
|
```
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/basic-auth/master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master
|
||||||
|
[downloads-image]: https://badgen.net/npm/dm/basic-auth
|
||||||
|
[downloads-url]: https://npmjs.org/package/basic-auth
|
||||||
|
[node-version-image]: https://badgen.net/npm/node/basic-auth
|
||||||
|
[node-version-url]: https://nodejs.org/en/download
|
||||||
|
[npm-image]: https://badgen.net/npm/v/basic-auth
|
||||||
|
[npm-url]: https://npmjs.org/package/basic-auth
|
||||||
|
[travis-image]: https://badgen.net/travis/jshttp/basic-auth/master
|
||||||
|
[travis-url]: https://travis-ci.org/jshttp/basic-auth
|
133
node_modules/basic-auth/index.js
generated
vendored
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
/*!
|
||||||
|
* basic-auth
|
||||||
|
* Copyright(c) 2013 TJ Holowaychuk
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = auth
|
||||||
|
module.exports.parse = parse
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp for basic auth credentials
|
||||||
|
*
|
||||||
|
* credentials = auth-scheme 1*SP token68
|
||||||
|
* auth-scheme = "Basic" ; case insensitive
|
||||||
|
* token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp for basic auth user/pass
|
||||||
|
*
|
||||||
|
* user-pass = userid ":" password
|
||||||
|
* userid = *<TEXT excluding ":">
|
||||||
|
* password = *TEXT
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var USER_PASS_REGEXP = /^([^:]*):(.*)$/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the Authorization header field of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @return {object} with .name and .pass
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function auth (req) {
|
||||||
|
if (!req) {
|
||||||
|
throw new TypeError('argument req is required')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof req !== 'object') {
|
||||||
|
throw new TypeError('argument req is required to be an object')
|
||||||
|
}
|
||||||
|
|
||||||
|
// get header
|
||||||
|
var header = getAuthorization(req)
|
||||||
|
|
||||||
|
// parse header
|
||||||
|
return parse(header)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode base64 string.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function decodeBase64 (str) {
|
||||||
|
return Buffer.from(str, 'base64').toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Authorization header from request object.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAuthorization (req) {
|
||||||
|
if (!req.headers || typeof req.headers !== 'object') {
|
||||||
|
throw new TypeError('argument req is required to have headers property')
|
||||||
|
}
|
||||||
|
|
||||||
|
return req.headers.authorization
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse basic auth to object.
|
||||||
|
*
|
||||||
|
* @param {string} string
|
||||||
|
* @return {object}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parse (string) {
|
||||||
|
if (typeof string !== 'string') {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse header
|
||||||
|
var match = CREDENTIALS_REGEXP.exec(string)
|
||||||
|
|
||||||
|
if (!match) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// decode user pass
|
||||||
|
var userPass = USER_PASS_REGEXP.exec(decodeBase64(match[1]))
|
||||||
|
|
||||||
|
if (!userPass) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// return credentials object
|
||||||
|
return new Credentials(userPass[1], userPass[2])
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object to represent user credentials.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Credentials (name, pass) {
|
||||||
|
this.name = name
|
||||||
|
this.pass = pass
|
||||||
|
}
|
76
node_modules/basic-auth/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"basic-auth@2.0.1",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "basic-auth@2.0.1",
|
||||||
|
"_id": "basic-auth@2.0.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||||
|
"_location": "/basic-auth",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "basic-auth@2.0.1",
|
||||||
|
"name": "basic-auth",
|
||||||
|
"escapedName": "basic-auth",
|
||||||
|
"rawSpec": "2.0.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/morgan"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||||
|
"_spec": "2.0.1",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jshttp/basic-auth/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "5.1.2"
|
||||||
|
},
|
||||||
|
"description": "node.js basic auth parser",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "5.6.0",
|
||||||
|
"eslint-config-standard": "12.0.0",
|
||||||
|
"eslint-plugin-import": "2.14.0",
|
||||||
|
"eslint-plugin-markdown": "1.0.0-beta.6",
|
||||||
|
"eslint-plugin-node": "7.0.1",
|
||||||
|
"eslint-plugin-promise": "4.0.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
|
"istanbul": "0.4.5",
|
||||||
|
"mocha": "5.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"HISTORY.md",
|
||||||
|
"LICENSE",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jshttp/basic-auth#readme",
|
||||||
|
"keywords": [
|
||||||
|
"basic",
|
||||||
|
"auth",
|
||||||
|
"authorization",
|
||||||
|
"basicauth"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "basic-auth",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jshttp/basic-auth.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --plugin markdown --ext js,md .",
|
||||||
|
"test": "mocha --check-leaks --reporter spec --bail",
|
||||||
|
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||||
|
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||||
|
},
|
||||||
|
"version": "2.0.1"
|
||||||
|
}
|
252
node_modules/binary-extensions/binary-extensions.json
generated
vendored
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
[
|
||||||
|
"3dm",
|
||||||
|
"3ds",
|
||||||
|
"3g2",
|
||||||
|
"3gp",
|
||||||
|
"7z",
|
||||||
|
"a",
|
||||||
|
"aac",
|
||||||
|
"adp",
|
||||||
|
"ai",
|
||||||
|
"aif",
|
||||||
|
"aiff",
|
||||||
|
"alz",
|
||||||
|
"ape",
|
||||||
|
"apk",
|
||||||
|
"ar",
|
||||||
|
"arj",
|
||||||
|
"asf",
|
||||||
|
"au",
|
||||||
|
"avi",
|
||||||
|
"bak",
|
||||||
|
"baml",
|
||||||
|
"bh",
|
||||||
|
"bin",
|
||||||
|
"bk",
|
||||||
|
"bmp",
|
||||||
|
"btif",
|
||||||
|
"bz2",
|
||||||
|
"bzip2",
|
||||||
|
"cab",
|
||||||
|
"caf",
|
||||||
|
"cgm",
|
||||||
|
"class",
|
||||||
|
"cmx",
|
||||||
|
"cpio",
|
||||||
|
"cr2",
|
||||||
|
"cur",
|
||||||
|
"dat",
|
||||||
|
"dcm",
|
||||||
|
"deb",
|
||||||
|
"dex",
|
||||||
|
"djvu",
|
||||||
|
"dll",
|
||||||
|
"dmg",
|
||||||
|
"dng",
|
||||||
|
"doc",
|
||||||
|
"docm",
|
||||||
|
"docx",
|
||||||
|
"dot",
|
||||||
|
"dotm",
|
||||||
|
"dra",
|
||||||
|
"DS_Store",
|
||||||
|
"dsk",
|
||||||
|
"dts",
|
||||||
|
"dtshd",
|
||||||
|
"dvb",
|
||||||
|
"dwg",
|
||||||
|
"dxf",
|
||||||
|
"ecelp4800",
|
||||||
|
"ecelp7470",
|
||||||
|
"ecelp9600",
|
||||||
|
"egg",
|
||||||
|
"eol",
|
||||||
|
"eot",
|
||||||
|
"epub",
|
||||||
|
"exe",
|
||||||
|
"f4v",
|
||||||
|
"fbs",
|
||||||
|
"fh",
|
||||||
|
"fla",
|
||||||
|
"flac",
|
||||||
|
"fli",
|
||||||
|
"flv",
|
||||||
|
"fpx",
|
||||||
|
"fst",
|
||||||
|
"fvt",
|
||||||
|
"g3",
|
||||||
|
"gh",
|
||||||
|
"gif",
|
||||||
|
"graffle",
|
||||||
|
"gz",
|
||||||
|
"gzip",
|
||||||
|
"h261",
|
||||||
|
"h263",
|
||||||
|
"h264",
|
||||||
|
"icns",
|
||||||
|
"ico",
|
||||||
|
"ief",
|
||||||
|
"img",
|
||||||
|
"ipa",
|
||||||
|
"iso",
|
||||||
|
"jar",
|
||||||
|
"jpeg",
|
||||||
|
"jpg",
|
||||||
|
"jpgv",
|
||||||
|
"jpm",
|
||||||
|
"jxr",
|
||||||
|
"key",
|
||||||
|
"ktx",
|
||||||
|
"lha",
|
||||||
|
"lib",
|
||||||
|
"lvp",
|
||||||
|
"lz",
|
||||||
|
"lzh",
|
||||||
|
"lzma",
|
||||||
|
"lzo",
|
||||||
|
"m3u",
|
||||||
|
"m4a",
|
||||||
|
"m4v",
|
||||||
|
"mar",
|
||||||
|
"mdi",
|
||||||
|
"mht",
|
||||||
|
"mid",
|
||||||
|
"midi",
|
||||||
|
"mj2",
|
||||||
|
"mka",
|
||||||
|
"mkv",
|
||||||
|
"mmr",
|
||||||
|
"mng",
|
||||||
|
"mobi",
|
||||||
|
"mov",
|
||||||
|
"movie",
|
||||||
|
"mp3",
|
||||||
|
"mp4",
|
||||||
|
"mp4a",
|
||||||
|
"mpeg",
|
||||||
|
"mpg",
|
||||||
|
"mpga",
|
||||||
|
"mxu",
|
||||||
|
"nef",
|
||||||
|
"npx",
|
||||||
|
"numbers",
|
||||||
|
"nupkg",
|
||||||
|
"o",
|
||||||
|
"oga",
|
||||||
|
"ogg",
|
||||||
|
"ogv",
|
||||||
|
"otf",
|
||||||
|
"pages",
|
||||||
|
"pbm",
|
||||||
|
"pcx",
|
||||||
|
"pdb",
|
||||||
|
"pdf",
|
||||||
|
"pea",
|
||||||
|
"pgm",
|
||||||
|
"pic",
|
||||||
|
"png",
|
||||||
|
"pnm",
|
||||||
|
"pot",
|
||||||
|
"potm",
|
||||||
|
"potx",
|
||||||
|
"ppa",
|
||||||
|
"ppam",
|
||||||
|
"ppm",
|
||||||
|
"pps",
|
||||||
|
"ppsm",
|
||||||
|
"ppsx",
|
||||||
|
"ppt",
|
||||||
|
"pptm",
|
||||||
|
"pptx",
|
||||||
|
"psd",
|
||||||
|
"pya",
|
||||||
|
"pyc",
|
||||||
|
"pyo",
|
||||||
|
"pyv",
|
||||||
|
"qt",
|
||||||
|
"rar",
|
||||||
|
"ras",
|
||||||
|
"raw",
|
||||||
|
"resources",
|
||||||
|
"rgb",
|
||||||
|
"rip",
|
||||||
|
"rlc",
|
||||||
|
"rmf",
|
||||||
|
"rmvb",
|
||||||
|
"rtf",
|
||||||
|
"rz",
|
||||||
|
"s3m",
|
||||||
|
"s7z",
|
||||||
|
"scpt",
|
||||||
|
"sgi",
|
||||||
|
"shar",
|
||||||
|
"sil",
|
||||||
|
"sketch",
|
||||||
|
"slk",
|
||||||
|
"smv",
|
||||||
|
"snk",
|
||||||
|
"so",
|
||||||
|
"stl",
|
||||||
|
"suo",
|
||||||
|
"sub",
|
||||||
|
"swf",
|
||||||
|
"tar",
|
||||||
|
"tbz",
|
||||||
|
"tbz2",
|
||||||
|
"tga",
|
||||||
|
"tgz",
|
||||||
|
"thmx",
|
||||||
|
"tif",
|
||||||
|
"tiff",
|
||||||
|
"tlz",
|
||||||
|
"ttc",
|
||||||
|
"ttf",
|
||||||
|
"txz",
|
||||||
|
"udf",
|
||||||
|
"uvh",
|
||||||
|
"uvi",
|
||||||
|
"uvm",
|
||||||
|
"uvp",
|
||||||
|
"uvs",
|
||||||
|
"uvu",
|
||||||
|
"viv",
|
||||||
|
"vob",
|
||||||
|
"war",
|
||||||
|
"wav",
|
||||||
|
"wax",
|
||||||
|
"wbmp",
|
||||||
|
"wdp",
|
||||||
|
"weba",
|
||||||
|
"webm",
|
||||||
|
"webp",
|
||||||
|
"whl",
|
||||||
|
"wim",
|
||||||
|
"wm",
|
||||||
|
"wma",
|
||||||
|
"wmv",
|
||||||
|
"wmx",
|
||||||
|
"woff",
|
||||||
|
"woff2",
|
||||||
|
"wrm",
|
||||||
|
"wvx",
|
||||||
|
"xbm",
|
||||||
|
"xif",
|
||||||
|
"xla",
|
||||||
|
"xlam",
|
||||||
|
"xls",
|
||||||
|
"xlsb",
|
||||||
|
"xlsm",
|
||||||
|
"xlsx",
|
||||||
|
"xlt",
|
||||||
|
"xltm",
|
||||||
|
"xltx",
|
||||||
|
"xm",
|
||||||
|
"xmind",
|
||||||
|
"xpi",
|
||||||
|
"xpm",
|
||||||
|
"xwd",
|
||||||
|
"xz",
|
||||||
|
"z",
|
||||||
|
"zip",
|
||||||
|
"zipx"
|
||||||
|
]
|
3
node_modules/binary-extensions/binary-extensions.json.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
declare const binaryExtensionsJson: readonly string[];
|
||||||
|
|
||||||
|
export = binaryExtensionsJson;
|
14
node_modules/binary-extensions/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
List of binary file extensions.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import binaryExtensions = require('binary-extensions');
|
||||||
|
|
||||||
|
console.log(binaryExtensions);
|
||||||
|
//=> ['3ds', '3g2', …]
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
declare const binaryExtensions: readonly string[];
|
||||||
|
|
||||||
|
export = binaryExtensions;
|
1
node_modules/binary-extensions/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./binary-extensions.json');
|
9
node_modules/binary-extensions/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), Paul Miller (https://paulmillr.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.
|
73
node_modules/binary-extensions/package.json
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"binary-extensions@2.0.0",
|
||||||
|
"/home/ry/Desktop/Work/benji.monster"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "binary-extensions@2.0.0",
|
||||||
|
"_id": "binary-extensions@2.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
|
||||||
|
"_location": "/binary-extensions",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "binary-extensions@2.0.0",
|
||||||
|
"name": "binary-extensions",
|
||||||
|
"escapedName": "binary-extensions",
|
||||||
|
"rawSpec": "2.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/is-binary-path"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
|
||||||
|
"_spec": "2.0.0",
|
||||||
|
"_where": "/home/ry/Desktop/Work/benji.monster",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sindresorhus/binary-extensions/issues"
|
||||||
|
},
|
||||||
|
"description": "List of binary file extensions",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^1.4.1",
|
||||||
|
"tsd": "^0.7.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts",
|
||||||
|
"binary-extensions.json",
|
||||||
|
"binary-extensions.json.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/sindresorhus/binary-extensions#readme",
|
||||||
|
"keywords": [
|
||||||
|
"binary",
|
||||||
|
"extensions",
|
||||||
|
"extension",
|
||||||
|
"file",
|
||||||
|
"json",
|
||||||
|
"list",
|
||||||
|
"array"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "binary-extensions",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/sindresorhus/binary-extensions.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
33
node_modules/binary-extensions/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# binary-extensions [![Build Status](https://travis-ci.org/sindresorhus/binary-extensions.svg?branch=master)](https://travis-ci.org/sindresorhus/binary-extensions)
|
||||||
|
|
||||||
|
> List of binary file extensions
|
||||||
|
|
||||||
|
The list is just a [JSON file](binary-extensions.json) and can be used anywhere.
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install binary-extensions
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const binaryExtensions = require('binary-extensions');
|
||||||
|
|
||||||
|
console.log(binaryExtensions);
|
||||||
|
//=> ['3ds', '3g2', …]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file
|
||||||
|
- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com), [Paul Miller](https://paulmillr.com)
|
609
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,609 @@
|
||||||
|
1.19.0 / 2019-04-25
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@3.1.0
|
||||||
|
- Add petabyte (`pb`) support
|
||||||
|
* deps: http-errors@1.7.2
|
||||||
|
- Set constructor name when possible
|
||||||
|
- deps: setprototypeof@1.1.1
|
||||||
|
- deps: statuses@'>= 1.5.0 < 2'
|
||||||
|
* deps: iconv-lite@0.4.24
|
||||||
|
- Added encoding MIK
|
||||||
|
* deps: qs@6.7.0
|
||||||
|
- Fix parsing array brackets after index
|
||||||
|
* deps: raw-body@2.4.0
|
||||||
|
- deps: bytes@3.1.0
|
||||||
|
- deps: http-errors@1.7.2
|
||||||
|
- deps: iconv-lite@0.4.24
|
||||||
|
* deps: type-is@~1.6.17
|
||||||
|
- deps: mime-types@~2.1.24
|
||||||
|
- perf: prevent internal `throw` on invalid type
|
||||||
|
|
||||||
|
1.18.3 / 2018-05-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix stack trace for strict json parse error
|
||||||
|
* deps: depd@~1.1.2
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
* deps: http-errors@~1.6.3
|
||||||
|
- deps: depd@~1.1.2
|
||||||
|
- deps: setprototypeof@1.1.0
|
||||||
|
- deps: statuses@'>= 1.3.1 < 2'
|
||||||
|
* deps: iconv-lite@0.4.23
|
||||||
|
- Fix loading encoding with year appended
|
||||||
|
- Fix deprecation warnings on Node.js 10+
|
||||||
|
* deps: qs@6.5.2
|
||||||
|
* deps: raw-body@2.3.3
|
||||||
|
- deps: http-errors@1.6.3
|
||||||
|
- deps: iconv-lite@0.4.23
|
||||||
|
* deps: type-is@~1.6.16
|
||||||
|
- deps: mime-types@~2.1.18
|
||||||
|
|
||||||
|
1.18.2 / 2017-09-22
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.9
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.18.1 / 2017-09-12
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: content-type@~1.0.4
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
- perf: skip parameter parsing when no parameters
|
||||||
|
* deps: iconv-lite@0.4.19
|
||||||
|
- Fix ISO-8859-1 regression
|
||||||
|
- Update Windows-1255
|
||||||
|
* deps: qs@6.5.1
|
||||||
|
- Fix parsing & compacting very deep objects
|
||||||
|
* deps: raw-body@2.3.2
|
||||||
|
- deps: iconv-lite@0.4.19
|
||||||
|
|
||||||
|
1.18.0 / 2017-09-08
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix JSON strict violation error to match native parse error
|
||||||
|
* Include the `body` property on verify errors
|
||||||
|
* Include the `type` property on all generated errors
|
||||||
|
* Use `http-errors` to set status code on errors
|
||||||
|
* deps: bytes@3.0.0
|
||||||
|
* deps: debug@2.6.8
|
||||||
|
* deps: depd@~1.1.1
|
||||||
|
- Remove unnecessary `Buffer` loading
|
||||||
|
* deps: http-errors@~1.6.2
|
||||||
|
- deps: depd@1.1.1
|
||||||
|
* deps: iconv-lite@0.4.18
|
||||||
|
- Add support for React Native
|
||||||
|
- Add a warning if not loaded as utf-8
|
||||||
|
- Fix CESU-8 decoding in Node.js 8
|
||||||
|
- Improve speed of ISO-8859-1 encoding
|
||||||
|
* deps: qs@6.5.0
|
||||||
|
* deps: raw-body@2.3.1
|
||||||
|
- Use `http-errors` for standard emitted errors
|
||||||
|
- deps: bytes@3.0.0
|
||||||
|
- deps: iconv-lite@0.4.18
|
||||||
|
- perf: skip buffer decoding on overage chunk
|
||||||
|
* perf: prevent internal `throw` when missing charset
|
||||||
|
|
||||||
|
1.17.2 / 2017-05-17
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.7
|
||||||
|
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||||
|
- deps: ms@2.0.0
|
||||||
|
* deps: type-is@~1.6.15
|
||||||
|
- deps: mime-types@~2.1.15
|
||||||
|
|
||||||
|
1.17.1 / 2017-03-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@6.4.0
|
||||||
|
- Fix regression parsing keys starting with `[`
|
||||||
|
|
||||||
|
1.17.0 / 2017-03-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: http-errors@~1.6.1
|
||||||
|
- Make `message` property enumerable for `HttpError`s
|
||||||
|
- deps: setprototypeof@1.0.3
|
||||||
|
* deps: qs@6.3.1
|
||||||
|
- Fix compacting nested arrays
|
||||||
|
|
||||||
|
1.16.1 / 2017-02-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.1
|
||||||
|
- Fix deprecation messages in WebStorm and other editors
|
||||||
|
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
||||||
|
|
||||||
|
1.16.0 / 2017-01-17
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.0
|
||||||
|
- Allow colors in workers
|
||||||
|
- Deprecated `DEBUG_FD` environment variable
|
||||||
|
- Fix error when running under React Native
|
||||||
|
- Use same color for same namespace
|
||||||
|
- deps: ms@0.7.2
|
||||||
|
* deps: http-errors@~1.5.1
|
||||||
|
- deps: inherits@2.0.3
|
||||||
|
- deps: setprototypeof@1.0.2
|
||||||
|
- deps: statuses@'>= 1.3.1 < 2'
|
||||||
|
* deps: iconv-lite@0.4.15
|
||||||
|
- Added encoding MS-31J
|
||||||
|
- Added encoding MS-932
|
||||||
|
- Added encoding MS-936
|
||||||
|
- Added encoding MS-949
|
||||||
|
- Added encoding MS-950
|
||||||
|
- Fix GBK/GB18030 handling of Euro character
|
||||||
|
* deps: qs@6.2.1
|
||||||
|
- Fix array parsing from skipping empty values
|
||||||
|
* deps: raw-body@~2.2.0
|
||||||
|
- deps: iconv-lite@0.4.15
|
||||||
|
* deps: type-is@~1.6.14
|
||||||
|
- deps: mime-types@~2.1.13
|
||||||
|
|
||||||
|
1.15.2 / 2016-06-19
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.4.0
|
||||||
|
* deps: content-type@~1.0.2
|
||||||
|
- perf: enable strict mode
|
||||||
|
* deps: http-errors@~1.5.0
|
||||||
|
- Use `setprototypeof` module to replace `__proto__` setting
|
||||||
|
- deps: statuses@'>= 1.3.0 < 2'
|
||||||
|
- perf: enable strict mode
|
||||||
|
* deps: qs@6.2.0
|
||||||
|
* deps: raw-body@~2.1.7
|
||||||
|
- deps: bytes@2.4.0
|
||||||
|
- perf: remove double-cleanup on happy path
|
||||||
|
* deps: type-is@~1.6.13
|
||||||
|
- deps: mime-types@~2.1.11
|
||||||
|
|
||||||
|
1.15.1 / 2016-05-05
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.3.0
|
||||||
|
- Drop partial bytes on all parsed units
|
||||||
|
- Fix parsing byte string that looks like hex
|
||||||
|
* deps: raw-body@~2.1.6
|
||||||
|
- deps: bytes@2.3.0
|
||||||
|
* deps: type-is@~1.6.12
|
||||||
|
- deps: mime-types@~2.1.10
|
||||||
|
|
||||||
|
1.15.0 / 2016-02-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: http-errors@~1.4.0
|
||||||
|
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
||||||
|
- deps: inherits@2.0.1
|
||||||
|
- deps: statuses@'>= 1.2.1 < 2'
|
||||||
|
* deps: qs@6.1.0
|
||||||
|
* deps: type-is@~1.6.11
|
||||||
|
- deps: mime-types@~2.1.9
|
||||||
|
|
||||||
|
1.14.2 / 2015-12-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.2.0
|
||||||
|
* deps: iconv-lite@0.4.13
|
||||||
|
* deps: qs@5.2.0
|
||||||
|
* deps: raw-body@~2.1.5
|
||||||
|
- deps: bytes@2.2.0
|
||||||
|
- deps: iconv-lite@0.4.13
|
||||||
|
* deps: type-is@~1.6.10
|
||||||
|
- deps: mime-types@~2.1.8
|
||||||
|
|
||||||
|
1.14.1 / 2015-09-27
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix issue where invalid charset results in 400 when `verify` used
|
||||||
|
* deps: iconv-lite@0.4.12
|
||||||
|
- Fix CESU-8 decoding in Node.js 4.x
|
||||||
|
* deps: raw-body@~2.1.4
|
||||||
|
- Fix masking critical errors from `iconv-lite`
|
||||||
|
- deps: iconv-lite@0.4.12
|
||||||
|
* deps: type-is@~1.6.9
|
||||||
|
- deps: mime-types@~2.1.7
|
||||||
|
|
||||||
|
1.14.0 / 2015-09-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix JSON strict parse error to match syntax errors
|
||||||
|
* Provide static `require` analysis in `urlencoded` parser
|
||||||
|
* deps: depd@~1.1.0
|
||||||
|
- Support web browser loading
|
||||||
|
* deps: qs@5.1.0
|
||||||
|
* deps: raw-body@~2.1.3
|
||||||
|
- Fix sync callback when attaching data listener causes sync read
|
||||||
|
* deps: type-is@~1.6.8
|
||||||
|
- Fix type error when given invalid type to match against
|
||||||
|
- deps: mime-types@~2.1.6
|
||||||
|
|
||||||
|
1.13.3 / 2015-07-31
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: type-is@~1.6.6
|
||||||
|
- deps: mime-types@~2.1.4
|
||||||
|
|
||||||
|
1.13.2 / 2015-07-05
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.11
|
||||||
|
* deps: qs@4.0.0
|
||||||
|
- Fix dropping parameters like `hasOwnProperty`
|
||||||
|
- Fix user-visible incompatibilities from 3.1.0
|
||||||
|
- Fix various parsing edge cases
|
||||||
|
* deps: raw-body@~2.1.2
|
||||||
|
- Fix error stack traces to skip `makeError`
|
||||||
|
- deps: iconv-lite@0.4.11
|
||||||
|
* deps: type-is@~1.6.4
|
||||||
|
- deps: mime-types@~2.1.2
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.13.1 / 2015-06-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@2.4.2
|
||||||
|
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
||||||
|
|
||||||
|
1.13.0 / 2015-06-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Add `statusCode` property on `Error`s, in addition to `status`
|
||||||
|
* Change `type` default to `application/json` for JSON parser
|
||||||
|
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
||||||
|
* Provide static `require` analysis
|
||||||
|
* Use the `http-errors` module to generate errors
|
||||||
|
* deps: bytes@2.1.0
|
||||||
|
- Slight optimizations
|
||||||
|
* deps: iconv-lite@0.4.10
|
||||||
|
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
||||||
|
- Leading BOM is now removed when decoding
|
||||||
|
* deps: on-finished@~2.3.0
|
||||||
|
- Add defined behavior for HTTP `CONNECT` requests
|
||||||
|
- Add defined behavior for HTTP `Upgrade` requests
|
||||||
|
- deps: ee-first@1.1.1
|
||||||
|
* deps: qs@3.1.0
|
||||||
|
- Fix dropping parameters like `hasOwnProperty`
|
||||||
|
- Fix various parsing edge cases
|
||||||
|
- Parsed object now has `null` prototype
|
||||||
|
* deps: raw-body@~2.1.1
|
||||||
|
- Use `unpipe` module for unpiping requests
|
||||||
|
- deps: iconv-lite@0.4.10
|
||||||
|
* deps: type-is@~1.6.3
|
||||||
|
- deps: mime-types@~2.1.1
|
||||||
|
- perf: reduce try block size
|
||||||
|
- perf: remove bitwise operations
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
* perf: remove delete call
|
||||||
|
|
||||||
|
1.12.4 / 2015-05-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@~2.2.0
|
||||||
|
* deps: qs@2.4.2
|
||||||
|
- Fix allowing parameters like `constructor`
|
||||||
|
* deps: on-finished@~2.2.1
|
||||||
|
* deps: raw-body@~2.0.1
|
||||||
|
- Fix a false-positive when unpiping in Node.js 0.8
|
||||||
|
- deps: bytes@2.0.1
|
||||||
|
* deps: type-is@~1.6.2
|
||||||
|
- deps: mime-types@~2.0.11
|
||||||
|
|
||||||
|
1.12.3 / 2015-04-15
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Slight efficiency improvement when not debugging
|
||||||
|
* deps: depd@~1.0.1
|
||||||
|
* deps: iconv-lite@0.4.8
|
||||||
|
- Add encoding alias UNICODE-1-1-UTF-7
|
||||||
|
* deps: raw-body@1.3.4
|
||||||
|
- Fix hanging callback if request aborts during read
|
||||||
|
- deps: iconv-lite@0.4.8
|
||||||
|
|
||||||
|
1.12.2 / 2015-03-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@2.4.1
|
||||||
|
- Fix error when parameter `hasOwnProperty` is present
|
||||||
|
|
||||||
|
1.12.1 / 2015-03-15
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@~2.1.3
|
||||||
|
- Fix high intensity foreground color for bold
|
||||||
|
- deps: ms@0.7.0
|
||||||
|
* deps: type-is@~1.6.1
|
||||||
|
- deps: mime-types@~2.0.10
|
||||||
|
|
||||||
|
1.12.0 / 2015-02-13
|
||||||
|
===================
|
||||||
|
|
||||||
|
* add `debug` messages
|
||||||
|
* accept a function for the `type` option
|
||||||
|
* use `content-type` to parse `Content-Type` headers
|
||||||
|
* deps: iconv-lite@0.4.7
|
||||||
|
- Gracefully support enumerables on `Object.prototype`
|
||||||
|
* deps: raw-body@1.3.3
|
||||||
|
- deps: iconv-lite@0.4.7
|
||||||
|
* deps: type-is@~1.6.0
|
||||||
|
- fix argument reassignment
|
||||||
|
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
||||||
|
- support wildcard for both type and subtype (`*/*`)
|
||||||
|
- deps: mime-types@~2.0.9
|
||||||
|
|
||||||
|
1.11.0 / 2015-01-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* make internal `extended: true` depth limit infinity
|
||||||
|
* deps: type-is@~1.5.6
|
||||||
|
- deps: mime-types@~2.0.8
|
||||||
|
|
||||||
|
1.10.2 / 2015-01-20
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.6
|
||||||
|
- Fix rare aliases of single-byte encodings
|
||||||
|
* deps: raw-body@1.3.2
|
||||||
|
- deps: iconv-lite@0.4.6
|
||||||
|
|
||||||
|
1.10.1 / 2015-01-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: on-finished@~2.2.0
|
||||||
|
* deps: type-is@~1.5.5
|
||||||
|
- deps: mime-types@~2.0.7
|
||||||
|
|
||||||
|
1.10.0 / 2014-12-02
|
||||||
|
===================
|
||||||
|
|
||||||
|
* make internal `extended: true` array limit dynamic
|
||||||
|
|
||||||
|
1.9.3 / 2014-11-21
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.5
|
||||||
|
- Fix Windows-31J and X-SJIS encoding support
|
||||||
|
* deps: qs@2.3.3
|
||||||
|
- Fix `arrayLimit` behavior
|
||||||
|
* deps: raw-body@1.3.1
|
||||||
|
- deps: iconv-lite@0.4.5
|
||||||
|
* deps: type-is@~1.5.3
|
||||||
|
- deps: mime-types@~2.0.3
|
||||||
|
|
||||||
|
1.9.2 / 2014-10-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.3.2
|
||||||
|
- Fix parsing of mixed objects and values
|
||||||
|
|
||||||
|
1.9.1 / 2014-10-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: on-finished@~2.1.1
|
||||||
|
- Fix handling of pipelined requests
|
||||||
|
* deps: qs@2.3.0
|
||||||
|
- Fix parsing of mixed implicit and explicit arrays
|
||||||
|
* deps: type-is@~1.5.2
|
||||||
|
- deps: mime-types@~2.0.2
|
||||||
|
|
||||||
|
1.9.0 / 2014-09-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* include the charset in "unsupported charset" error message
|
||||||
|
* include the encoding in "unsupported content encoding" error message
|
||||||
|
* deps: depd@~1.0.0
|
||||||
|
|
||||||
|
1.8.4 / 2014-09-23
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix content encoding to be case-insensitive
|
||||||
|
|
||||||
|
1.8.3 / 2014-09-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.4
|
||||||
|
- Fix issue with object keys starting with numbers truncated
|
||||||
|
|
||||||
|
1.8.2 / 2014-09-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.5
|
||||||
|
|
||||||
|
1.8.1 / 2014-09-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: media-typer@0.3.0
|
||||||
|
* deps: type-is@~1.5.1
|
||||||
|
|
||||||
|
1.8.0 / 2014-09-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* make empty-body-handling consistent between chunked requests
|
||||||
|
- empty `json` produces `{}`
|
||||||
|
- empty `raw` produces `new Buffer(0)`
|
||||||
|
- empty `text` produces `''`
|
||||||
|
- empty `urlencoded` produces `{}`
|
||||||
|
* deps: qs@2.2.3
|
||||||
|
- Fix issue where first empty value in array is discarded
|
||||||
|
* deps: type-is@~1.5.0
|
||||||
|
- fix `hasbody` to be true for `content-length: 0`
|
||||||
|
|
||||||
|
1.7.0 / 2014-09-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `parameterLimit` option to `urlencoded` parser
|
||||||
|
* change `urlencoded` extended array limit to 100
|
||||||
|
* respond with 413 when over `parameterLimit` in `urlencoded`
|
||||||
|
|
||||||
|
1.6.7 / 2014-08-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.2
|
||||||
|
- Remove unnecessary cloning
|
||||||
|
|
||||||
|
1.6.6 / 2014-08-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.0
|
||||||
|
- Array parsing fix
|
||||||
|
- Performance improvements
|
||||||
|
|
||||||
|
1.6.5 / 2014-08-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: on-finished@2.1.0
|
||||||
|
|
||||||
|
1.6.4 / 2014-08-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.2
|
||||||
|
|
||||||
|
1.6.3 / 2014-08-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.1
|
||||||
|
|
||||||
|
1.6.2 / 2014-08-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.0
|
||||||
|
- Fix parsing array of objects
|
||||||
|
|
||||||
|
1.6.1 / 2014-08-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.1.0
|
||||||
|
- Accept urlencoded square brackets
|
||||||
|
- Accept empty values in implicit array notation
|
||||||
|
|
||||||
|
1.6.0 / 2014-08-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.0.2
|
||||||
|
- Complete rewrite
|
||||||
|
- Limits array length to 20
|
||||||
|
- Limits object depth to 5
|
||||||
|
- Limits parameters to 1,000
|
||||||
|
|
||||||
|
1.5.2 / 2014-07-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.4
|
||||||
|
- Work-around v8 generating empty stack traces
|
||||||
|
|
||||||
|
1.5.1 / 2014-07-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.3
|
||||||
|
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||||
|
|
||||||
|
1.5.0 / 2014-07-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.2
|
||||||
|
- Add `TRACE_DEPRECATION` environment variable
|
||||||
|
- Remove non-standard grey color from color output
|
||||||
|
- Support `--no-deprecation` argument
|
||||||
|
- Support `--trace-deprecation` argument
|
||||||
|
* deps: iconv-lite@0.4.4
|
||||||
|
- Added encoding UTF-7
|
||||||
|
* deps: raw-body@1.3.0
|
||||||
|
- deps: iconv-lite@0.4.4
|
||||||
|
- Added encoding UTF-7
|
||||||
|
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
||||||
|
* deps: type-is@~1.3.2
|
||||||
|
|
||||||
|
1.4.3 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.3.1
|
||||||
|
- fix global variable leak
|
||||||
|
|
||||||
|
1.4.2 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.3.0
|
||||||
|
- improve type parsing
|
||||||
|
|
||||||
|
1.4.1 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix urlencoded extended deprecation message
|
||||||
|
|
||||||
|
1.4.0 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `text` parser
|
||||||
|
* add `raw` parser
|
||||||
|
* check accepted charset in content-type (accepts utf-8)
|
||||||
|
* check accepted encoding in content-encoding (accepts identity)
|
||||||
|
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
||||||
|
* deprecate `urlencoded()` without provided `extended` option
|
||||||
|
* lazy-load urlencoded parsers
|
||||||
|
* parsers split into files for reduced mem usage
|
||||||
|
* support gzip and deflate bodies
|
||||||
|
- set `inflate: false` to turn off
|
||||||
|
* deps: raw-body@1.2.2
|
||||||
|
- Support all encodings from `iconv-lite`
|
||||||
|
|
||||||
|
1.3.1 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.2.1
|
||||||
|
- Switch dependency from mime to mime-types@1.0.0
|
||||||
|
|
||||||
|
1.3.0 / 2014-05-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `extended` option to urlencoded parser
|
||||||
|
|
||||||
|
1.2.2 / 2014-05-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: raw-body@1.1.6
|
||||||
|
- assert stream encoding on node.js 0.8
|
||||||
|
- assert stream encoding on node.js < 0.10.6
|
||||||
|
- deps: bytes@1
|
||||||
|
|
||||||
|
1.2.1 / 2014-05-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* invoke `next(err)` after request fully read
|
||||||
|
- prevents hung responses and socket hang ups
|
||||||
|
|
||||||
|
1.2.0 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `verify` option
|
||||||
|
* deps: type-is@1.2.0
|
||||||
|
- support suffix matching
|
||||||
|
|
||||||
|
1.1.2 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* improve json parser speed
|
||||||
|
|
||||||
|
1.1.1 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix repeated limit parsing with every request
|
||||||
|
|
||||||
|
1.1.0 / 2014-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `type` option
|
||||||
|
* deps: pin for safety and consistency
|
||||||
|
|
||||||
|
1.0.2 / 2014-04-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `type-is` module
|
||||||
|
|
||||||
|
1.0.1 / 2014-03-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* lower default limits to 100kb
|
23
node_modules/body-parser/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
443
node_modules/body-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,443 @@
|
||||||
|
# body-parser
|
||||||
|
|
||||||
|
[![NPM Version][npm-image]][npm-url]
|
||||||
|
[![NPM Downloads][downloads-image]][downloads-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Node.js body parsing middleware.
|
||||||
|
|
||||||
|
Parse incoming request bodies in a middleware before your handlers, available
|
||||||
|
under the `req.body` property.
|
||||||
|
|
||||||
|
**Note** As `req.body`'s shape is based on user-controlled input, all
|
||||||
|
properties and values in this object are untrusted and should be validated
|
||||||
|
before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
||||||
|
ways, for example the `foo` property may not be there or may not be a string,
|
||||||
|
and `toString` may not be a function and instead a string or other user input.
|
||||||
|
|
||||||
|
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
||||||
|
|
||||||
|
_This does not handle multipart bodies_, due to their complex and typically
|
||||||
|
large nature. For multipart bodies, you may be interested in the following
|
||||||
|
modules:
|
||||||
|
|
||||||
|
* [busboy](https://www.npmjs.org/package/busboy#readme) and
|
||||||
|
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
|
||||||
|
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
|
||||||
|
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
|
||||||
|
* [formidable](https://www.npmjs.org/package/formidable#readme)
|
||||||
|
* [multer](https://www.npmjs.org/package/multer#readme)
|
||||||
|
|
||||||
|
This module provides the following parsers:
|
||||||
|
|
||||||
|
* [JSON body parser](#bodyparserjsonoptions)
|
||||||
|
* [Raw body parser](#bodyparserrawoptions)
|
||||||
|
* [Text body parser](#bodyparsertextoptions)
|
||||||
|
* [URL-encoded form body parser](#bodyparserurlencodedoptions)
|
||||||
|
|
||||||
|
Other body parsers you might be interested in:
|
||||||
|
|
||||||
|
- [body](https://www.npmjs.org/package/body#readme)
|
||||||
|
- [co-body](https://www.npmjs.org/package/co-body#readme)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install body-parser
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
```
|
||||||
|
|
||||||
|
The `bodyParser` object exposes various factories to create middlewares. All
|
||||||
|
middlewares will populate the `req.body` property with the parsed body when
|
||||||
|
the `Content-Type` request header matches the `type` option, or an empty
|
||||||
|
object (`{}`) if there was no body to parse, the `Content-Type` was not matched,
|
||||||
|
or an error occurred.
|
||||||
|
|
||||||
|
The various errors returned by this module are described in the
|
||||||
|
[errors section](#errors).
|
||||||
|
|
||||||
|
### bodyParser.json([options])
|
||||||
|
|
||||||
|
Returns middleware that only parses `json` and only looks at requests where
|
||||||
|
the `Content-Type` header matches the `type` option. This parser accepts any
|
||||||
|
Unicode encoding of the body and supports automatic inflation of `gzip` and
|
||||||
|
`deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`).
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `json` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### reviver
|
||||||
|
|
||||||
|
The `reviver` option is passed directly to `JSON.parse` as the second
|
||||||
|
argument. You can find more information on this argument
|
||||||
|
[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter).
|
||||||
|
|
||||||
|
##### strict
|
||||||
|
|
||||||
|
When set to `true`, will only accept arrays and objects; when `false` will
|
||||||
|
accept anything `JSON.parse` accepts. Defaults to `true`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not a
|
||||||
|
function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `json`), a mime type (like `application/json`), or
|
||||||
|
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
||||||
|
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
||||||
|
value. Defaults to `application/json`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.raw([options])
|
||||||
|
|
||||||
|
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
||||||
|
of the body.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `raw` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function.
|
||||||
|
If not a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
||||||
|
can be an extension name (like `bin`), a mime type (like
|
||||||
|
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
||||||
|
`application/*`). If a function, the `type` option is called as `fn(req)`
|
||||||
|
and the request is parsed if it returns a truthy value. Defaults to
|
||||||
|
`application/octet-stream`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.text([options])
|
||||||
|
|
||||||
|
Returns middleware that parses all bodies as a string and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` string containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This will be a string of the
|
||||||
|
body.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `text` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### defaultCharset
|
||||||
|
|
||||||
|
Specify the default character set for the text content if the charset is not
|
||||||
|
specified in the `Content-Type` header of the request. Defaults to `utf-8`.
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not
|
||||||
|
a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
||||||
|
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
||||||
|
option is called as `fn(req)` and the request is parsed if it returns a
|
||||||
|
truthy value. Defaults to `text/plain`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.urlencoded([options])
|
||||||
|
|
||||||
|
Returns middleware that only parses `urlencoded` bodies and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser accepts only UTF-8 encoding of the body and supports automatic
|
||||||
|
inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This object will contain
|
||||||
|
key-value pairs, where the value can be a string or array (when `extended` is
|
||||||
|
`false`), or any type (when `extended` is `true`).
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `urlencoded` function takes an optional `options` object that may contain
|
||||||
|
any of the following keys:
|
||||||
|
|
||||||
|
##### extended
|
||||||
|
|
||||||
|
The `extended` option allows to choose between parsing the URL-encoded data
|
||||||
|
with the `querystring` library (when `false`) or the `qs` library (when
|
||||||
|
`true`). The "extended" syntax allows for rich objects and arrays to be
|
||||||
|
encoded into the URL-encoded format, allowing for a JSON-like experience
|
||||||
|
with URL-encoded. For more information, please
|
||||||
|
[see the qs library](https://www.npmjs.org/package/qs#readme).
|
||||||
|
|
||||||
|
Defaults to `true`, but using the default has been deprecated. Please
|
||||||
|
research into the difference between `qs` and `querystring` and choose the
|
||||||
|
appropriate setting.
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### parameterLimit
|
||||||
|
|
||||||
|
The `parameterLimit` option controls the maximum number of parameters that
|
||||||
|
are allowed in the URL-encoded data. If a request contains more parameters
|
||||||
|
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not
|
||||||
|
a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `urlencoded`), a mime type (like
|
||||||
|
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
||||||
|
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
||||||
|
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
||||||
|
to `application/x-www-form-urlencoded`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
## Errors
|
||||||
|
|
||||||
|
The middlewares provided by this module create errors depending on the error
|
||||||
|
condition during parsing. The errors will typically have a `status`/`statusCode`
|
||||||
|
property that contains the suggested HTTP response code, an `expose` property
|
||||||
|
to determine if the `message` property should be displayed to the client, a
|
||||||
|
`type` property to determine the type of error without matching against the
|
||||||
|
`message`, and a `body` property containing the read body, if available.
|
||||||
|
|
||||||
|
The following are the common errors emitted, though any error can come through
|
||||||
|
for various reasons.
|
||||||
|
|
||||||
|
### content encoding unsupported
|
||||||
|
|
||||||
|
This error will occur when the request had a `Content-Encoding` header that
|
||||||
|
contained an encoding but the "inflation" option was set to `false`. The
|
||||||
|
`status` property is set to `415`, the `type` property is set to
|
||||||
|
`'encoding.unsupported'`, and the `charset` property will be set to the
|
||||||
|
encoding that is unsupported.
|
||||||
|
|
||||||
|
### request aborted
|
||||||
|
|
||||||
|
This error will occur when the request is aborted by the client before reading
|
||||||
|
the body has finished. The `received` property will be set to the number of
|
||||||
|
bytes received before the request was aborted and the `expected` property is
|
||||||
|
set to the number of expected bytes. The `status` property is set to `400`
|
||||||
|
and `type` property is set to `'request.aborted'`.
|
||||||
|
|
||||||
|
### request entity too large
|
||||||
|
|
||||||
|
This error will occur when the request body's size is larger than the "limit"
|
||||||
|
option. The `limit` property will be set to the byte limit and the `length`
|
||||||
|
property will be set to the request body's length. The `status` property is
|
||||||
|
set to `413` and the `type` property is set to `'entity.too.large'`.
|
||||||
|
|
||||||
|
### request size did not match content length
|
||||||
|
|
||||||
|
This error will occur when the request's length did not match the length from
|
||||||
|
the `Content-Length` header. This typically occurs when the request is malformed,
|
||||||
|
typically when the `Content-Length` header was calculated based on characters
|
||||||
|
instead of bytes. The `status` property is set to `400` and the `type` property
|
||||||
|
is set to `'request.size.invalid'`.
|
||||||
|
|
||||||
|
### stream encoding should not be set
|
||||||
|
|
||||||
|
This error will occur when something called the `req.setEncoding` method prior
|
||||||
|
to this middleware. This module operates directly on bytes only and you cannot
|
||||||
|
call `req.setEncoding` when using this module. The `status` property is set to
|
||||||
|
`500` and the `type` property is set to `'stream.encoding.set'`.
|
||||||
|
|
||||||
|
### too many parameters
|
||||||
|
|
||||||
|
This error will occur when the content of the request exceeds the configured
|
||||||
|
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
||||||
|
`413` and the `type` property is set to `'parameters.too.many'`.
|
||||||
|
|
||||||
|
### unsupported charset "BOGUS"
|
||||||
|
|
||||||
|
This error will occur when the request had a charset parameter in the
|
||||||
|
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
||||||
|
parser does not support it. The charset is contained in the message as well
|
||||||
|
as in the `charset` property. The `status` property is set to `415`, the
|
||||||
|
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
||||||
|
is set to the charset that is unsupported.
|
||||||
|
|
||||||
|
### unsupported content encoding "bogus"
|
||||||
|
|
||||||
|
This error will occur when the request had a `Content-Encoding` header that
|
||||||
|
contained an unsupported encoding. The encoding is contained in the message
|
||||||
|
as well as in the `encoding` property. The `status` property is set to `415`,
|
||||||
|
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
||||||
|
property is set to the encoding that is unsupported.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Express/Connect top-level generic
|
||||||
|
|
||||||
|
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
||||||
|
top-level middleware, which will parse the bodies of all incoming requests.
|
||||||
|
This is the simplest setup.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// parse application/x-www-form-urlencoded
|
||||||
|
app.use(bodyParser.urlencoded({ extended: false }))
|
||||||
|
|
||||||
|
// parse application/json
|
||||||
|
app.use(bodyParser.json())
|
||||||
|
|
||||||
|
app.use(function (req, res) {
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('you posted:\n')
|
||||||
|
res.end(JSON.stringify(req.body, null, 2))
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Express route-specific
|
||||||
|
|
||||||
|
This example demonstrates adding body parsers specifically to the routes that
|
||||||
|
need them. In general, this is the most recommended way to use body-parser with
|
||||||
|
Express.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// create application/json parser
|
||||||
|
var jsonParser = bodyParser.json()
|
||||||
|
|
||||||
|
// create application/x-www-form-urlencoded parser
|
||||||
|
var urlencodedParser = bodyParser.urlencoded({ extended: false })
|
||||||
|
|
||||||
|
// POST /login gets urlencoded bodies
|
||||||
|
app.post('/login', urlencodedParser, function (req, res) {
|
||||||
|
res.send('welcome, ' + req.body.username)
|
||||||
|
})
|
||||||
|
|
||||||
|
// POST /api/users gets JSON bodies
|
||||||
|
app.post('/api/users', jsonParser, function (req, res) {
|
||||||
|
// create user in req.body
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Change accepted type for parsers
|
||||||
|
|
||||||
|
All the parsers accept a `type` option which allows you to change the
|
||||||
|
`Content-Type` that the middleware will parse.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// parse various different custom JSON types as JSON
|
||||||
|
app.use(bodyParser.json({ type: 'application/*+json' }))
|
||||||
|
|
||||||
|
// parse some custom thing into a Buffer
|
||||||
|
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
||||||
|
|
||||||
|
// parse an HTML body into a string
|
||||||
|
app.use(bodyParser.text({ type: 'text/html' }))
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/body-parser.svg
|
||||||
|
[npm-url]: https://npmjs.org/package/body-parser
|
||||||
|
[travis-image]: https://img.shields.io/travis/expressjs/body-parser/master.svg
|
||||||
|
[travis-url]: https://travis-ci.org/expressjs/body-parser
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg
|
||||||
|
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg
|
||||||
|
[downloads-url]: https://npmjs.org/package/body-parser
|
157
node_modules/body-parser/index.js
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var deprecate = require('depd')('body-parser')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of loaded parsers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var parsers = Object.create(null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef Parsers
|
||||||
|
* @type {function}
|
||||||
|
* @property {function} json
|
||||||
|
* @property {function} raw
|
||||||
|
* @property {function} text
|
||||||
|
* @property {function} urlencoded
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @type {Parsers}
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = deprecate.function(bodyParser,
|
||||||
|
'bodyParser: use individual json/urlencoded middlewares')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'json', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('json')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raw parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'raw', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('raw')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'text', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('text')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL-encoded parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'urlencoded', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('urlencoded')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse json and urlencoded bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @deprecated
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function bodyParser (options) {
|
||||||
|
var opts = {}
|
||||||
|
|
||||||
|
// exclude type option
|
||||||
|
if (options) {
|
||||||
|
for (var prop in options) {
|
||||||
|
if (prop !== 'type') {
|
||||||
|
opts[prop] = options[prop]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _urlencoded = exports.urlencoded(opts)
|
||||||
|
var _json = exports.json(opts)
|
||||||
|
|
||||||
|
return function bodyParser (req, res, next) {
|
||||||
|
_json(req, res, function (err) {
|
||||||
|
if (err) return next(err)
|
||||||
|
_urlencoded(req, res, next)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a getter for loading a parser.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createParserGetter (name) {
|
||||||
|
return function get () {
|
||||||
|
return loadParser(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a parser module.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function loadParser (parserName) {
|
||||||
|
var parser = parsers[parserName]
|
||||||
|
|
||||||
|
if (parser !== undefined) {
|
||||||
|
return parser
|
||||||
|
}
|
||||||
|
|
||||||
|
// this uses a switch for static require analysis
|
||||||
|
switch (parserName) {
|
||||||
|
case 'json':
|
||||||
|
parser = require('./lib/types/json')
|
||||||
|
break
|
||||||
|
case 'raw':
|
||||||
|
parser = require('./lib/types/raw')
|
||||||
|
break
|
||||||
|
case 'text':
|
||||||
|
parser = require('./lib/types/text')
|
||||||
|
break
|
||||||
|
case 'urlencoded':
|
||||||
|
parser = require('./lib/types/urlencoded')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// store to prevent invoking require()
|
||||||
|
return (parsers[parserName] = parser)
|
||||||
|
}
|
181
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var getBody = require('raw-body')
|
||||||
|
var iconv = require('iconv-lite')
|
||||||
|
var onFinished = require('on-finished')
|
||||||
|
var zlib = require('zlib')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = read
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a request into a buffer and parse.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @param {object} res
|
||||||
|
* @param {function} next
|
||||||
|
* @param {function} parse
|
||||||
|
* @param {function} debug
|
||||||
|
* @param {object} options
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function read (req, res, next, parse, debug, options) {
|
||||||
|
var length
|
||||||
|
var opts = options
|
||||||
|
var stream
|
||||||
|
|
||||||
|
// flag as parsed
|
||||||
|
req._body = true
|
||||||
|
|
||||||
|
// read options
|
||||||
|
var encoding = opts.encoding !== null
|
||||||
|
? opts.encoding
|
||||||
|
: null
|
||||||
|
var verify = opts.verify
|
||||||
|
|
||||||
|
try {
|
||||||
|
// get the content stream
|
||||||
|
stream = contentstream(req, debug, opts.inflate)
|
||||||
|
length = stream.length
|
||||||
|
stream.length = undefined
|
||||||
|
} catch (err) {
|
||||||
|
return next(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// set raw-body options
|
||||||
|
opts.length = length
|
||||||
|
opts.encoding = verify
|
||||||
|
? null
|
||||||
|
: encoding
|
||||||
|
|
||||||
|
// assert charset is supported
|
||||||
|
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
||||||
|
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||||
|
charset: encoding.toLowerCase(),
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// read body
|
||||||
|
debug('read body')
|
||||||
|
getBody(stream, opts, function (error, body) {
|
||||||
|
if (error) {
|
||||||
|
var _error
|
||||||
|
|
||||||
|
if (error.type === 'encoding.unsupported') {
|
||||||
|
// echo back charset
|
||||||
|
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||||
|
charset: encoding.toLowerCase(),
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// set status code on error
|
||||||
|
_error = createError(400, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// read off entire request
|
||||||
|
stream.resume()
|
||||||
|
onFinished(req, function onfinished () {
|
||||||
|
next(createError(400, _error))
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify
|
||||||
|
if (verify) {
|
||||||
|
try {
|
||||||
|
debug('verify body')
|
||||||
|
verify(req, res, body, encoding)
|
||||||
|
} catch (err) {
|
||||||
|
next(createError(403, err, {
|
||||||
|
body: body,
|
||||||
|
type: err.type || 'entity.verify.failed'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse
|
||||||
|
var str = body
|
||||||
|
try {
|
||||||
|
debug('parse body')
|
||||||
|
str = typeof body !== 'string' && encoding !== null
|
||||||
|
? iconv.decode(body, encoding)
|
||||||
|
: body
|
||||||
|
req.body = parse(str)
|
||||||
|
} catch (err) {
|
||||||
|
next(createError(400, err, {
|
||||||
|
body: str,
|
||||||
|
type: err.type || 'entity.parse.failed'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the content stream of the request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @param {function} debug
|
||||||
|
* @param {boolean} [inflate=true]
|
||||||
|
* @return {object}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function contentstream (req, debug, inflate) {
|
||||||
|
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
||||||
|
var length = req.headers['content-length']
|
||||||
|
var stream
|
||||||
|
|
||||||
|
debug('content-encoding "%s"', encoding)
|
||||||
|
|
||||||
|
if (inflate === false && encoding !== 'identity') {
|
||||||
|
throw createError(415, 'content encoding unsupported', {
|
||||||
|
encoding: encoding,
|
||||||
|
type: 'encoding.unsupported'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (encoding) {
|
||||||
|
case 'deflate':
|
||||||
|
stream = zlib.createInflate()
|
||||||
|
debug('inflate body')
|
||||||
|
req.pipe(stream)
|
||||||
|
break
|
||||||
|
case 'gzip':
|
||||||
|
stream = zlib.createGunzip()
|
||||||
|
debug('gunzip body')
|
||||||
|
req.pipe(stream)
|
||||||
|
break
|
||||||
|
case 'identity':
|
||||||
|
stream = req
|
||||||
|
stream.length = length
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
||||||
|
encoding: encoding,
|
||||||
|
type: 'encoding.unsupported'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream
|
||||||
|
}
|
230
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var debug = require('debug')('body-parser:json')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp to match the first non-space in a string.
|
||||||
|
*
|
||||||
|
* Allowed whitespace is defined in RFC 7159:
|
||||||
|
*
|
||||||
|
* ws = *(
|
||||||
|
* %x20 / ; Space
|
||||||
|
* %x09 / ; Horizontal tab
|
||||||
|
* %x0A / ; Line feed or New line
|
||||||
|
* %x0D ) ; Carriage return
|
||||||
|
*/
|
||||||
|
|
||||||
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse JSON bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function json (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var reviver = opts.reviver
|
||||||
|
var strict = opts.strict !== false
|
||||||
|
var type = opts.type || 'application/json'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (body) {
|
||||||
|
if (body.length === 0) {
|
||||||
|
// special-case empty json body, as it's a common client-side mistake
|
||||||
|
// TODO: maybe make this configurable or part of "strict" option
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strict) {
|
||||||
|
var first = firstchar(body)
|
||||||
|
|
||||||
|
if (first !== '{' && first !== '[') {
|
||||||
|
debug('strict violation')
|
||||||
|
throw createStrictSyntaxError(body, first)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
debug('parse json')
|
||||||
|
return JSON.parse(body, reviver)
|
||||||
|
} catch (e) {
|
||||||
|
throw normalizeJsonSyntaxError(e, {
|
||||||
|
message: e.message,
|
||||||
|
stack: e.stack
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function jsonParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert charset per RFC 7159 sec 8.1
|
||||||
|
var charset = getCharset(req) || 'utf-8'
|
||||||
|
if (charset.substr(0, 4) !== 'utf-') {
|
||||||
|
debug('invalid charset')
|
||||||
|
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||||
|
charset: charset,
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create strict violation syntax error matching native error.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @param {string} char
|
||||||
|
* @return {Error}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createStrictSyntaxError (str, char) {
|
||||||
|
var index = str.indexOf(char)
|
||||||
|
var partial = str.substring(0, index) + '#'
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||||
|
} catch (e) {
|
||||||
|
return normalizeJsonSyntaxError(e, {
|
||||||
|
message: e.message.replace('#', char),
|
||||||
|
stack: e.stack
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the first non-whitespace character in a string.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {function}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function firstchar (str) {
|
||||||
|
return FIRST_CHAR_REGEXP.exec(str)[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a SyntaxError for JSON.parse.
|
||||||
|
*
|
||||||
|
* @param {SyntaxError} error
|
||||||
|
* @param {object} obj
|
||||||
|
* @return {SyntaxError}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizeJsonSyntaxError (error, obj) {
|
||||||
|
var keys = Object.getOwnPropertyNames(error)
|
||||||
|
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
var key = keys[i]
|
||||||
|
if (key !== 'stack' && key !== 'message') {
|
||||||
|
delete error[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace stack before message for Node.js 0.10 and below
|
||||||
|
error.stack = obj.stack.replace(error.message, obj.message)
|
||||||
|
error.message = obj.message
|
||||||
|
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
101
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var debug = require('debug')('body-parser:raw')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = raw
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse raw bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function raw (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'application/octet-stream'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (buf) {
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
return function rawParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: null,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
121
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var debug = require('debug')('body-parser:text')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = text
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse text bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function text (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var defaultCharset = opts.defaultCharset || 'utf-8'
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'text/plain'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (buf) {
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
return function textParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// get charset
|
||||||
|
var charset = getCharset(req) || defaultCharset
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
284
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
|
@ -0,0 +1,284 @@
|
||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var debug = require('debug')('body-parser:urlencoded')
|
||||||
|
var deprecate = require('depd')('body-parser')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = urlencoded
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of parser modules.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var parsers = Object.create(null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse urlencoded bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function urlencoded (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
// notice because option default will flip in next major
|
||||||
|
if (opts.extended === undefined) {
|
||||||
|
deprecate('undefined extended: provide extended option')
|
||||||
|
}
|
||||||
|
|
||||||
|
var extended = opts.extended !== false
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'application/x-www-form-urlencoded'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate query parser
|
||||||
|
var queryparse = extended
|
||||||
|
? extendedparser(opts)
|
||||||
|
: simpleparser(opts)
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (body) {
|
||||||
|
return body.length
|
||||||
|
? queryparse(body)
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function urlencodedParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert charset
|
||||||
|
var charset = getCharset(req) || 'utf-8'
|
||||||
|
if (charset !== 'utf-8') {
|
||||||
|
debug('invalid charset')
|
||||||
|
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||||
|
charset: charset,
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
debug: debug,
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the extended query parser.
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extendedparser (options) {
|
||||||
|
var parameterLimit = options.parameterLimit !== undefined
|
||||||
|
? options.parameterLimit
|
||||||
|
: 1000
|
||||||
|
var parse = parser('qs')
|
||||||
|
|
||||||
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||||
|
throw new TypeError('option parameterLimit must be a positive number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(parameterLimit)) {
|
||||||
|
parameterLimit = parameterLimit | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return function queryparse (body) {
|
||||||
|
var paramCount = parameterCount(body, parameterLimit)
|
||||||
|
|
||||||
|
if (paramCount === undefined) {
|
||||||
|
debug('too many parameters')
|
||||||
|
throw createError(413, 'too many parameters', {
|
||||||
|
type: 'parameters.too.many'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var arrayLimit = Math.max(100, paramCount)
|
||||||
|
|
||||||
|
debug('parse extended urlencoding')
|
||||||
|
return parse(body, {
|
||||||
|
allowPrototypes: true,
|
||||||
|
arrayLimit: arrayLimit,
|
||||||
|
depth: Infinity,
|
||||||
|
parameterLimit: parameterLimit
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the number of parameters, stopping once limit reached
|
||||||
|
*
|
||||||
|
* @param {string} body
|
||||||
|
* @param {number} limit
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parameterCount (body, limit) {
|
||||||
|
var count = 0
|
||||||
|
var index = 0
|
||||||
|
|
||||||
|
while ((index = body.indexOf('&', index)) !== -1) {
|
||||||
|
count++
|
||||||
|
index++
|
||||||
|
|
||||||
|
if (count === limit) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get parser for module name dynamically.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @return {function}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parser (name) {
|
||||||
|
var mod = parsers[name]
|
||||||
|
|
||||||
|
if (mod !== undefined) {
|
||||||
|
return mod.parse
|
||||||
|
}
|
||||||
|
|
||||||
|
// this uses a switch for static require analysis
|
||||||
|
switch (name) {
|
||||||
|
case 'qs':
|
||||||
|
mod = require('qs')
|
||||||
|
break
|
||||||
|
case 'querystring':
|
||||||
|
mod = require('querystring')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// store to prevent invoking require()
|
||||||
|
parsers[name] = mod
|
||||||
|
|
||||||
|
return mod.parse
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple query parser.
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
function simpleparser (options) {
|
||||||
|
var parameterLimit = options.parameterLimit !== undefined
|
||||||
|
? options.parameterLimit
|
||||||
|
: 1000
|
||||||
|
var parse = parser('querystring')
|
||||||
|
|
||||||
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||||
|
throw new TypeError('option parameterLimit must be a positive number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(parameterLimit)) {
|
||||||
|
parameterLimit = parameterLimit | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return function queryparse (body) {
|
||||||
|
var paramCount = parameterCount(body, parameterLimit)
|
||||||
|
|
||||||
|
if (paramCount === undefined) {
|
||||||
|
debug('too many parameters')
|
||||||
|
throw createError(413, 'too many parameters', {
|
||||||
|
type: 'parameters.too.many'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('parse urlencoding')
|
||||||
|
return parse(body, undefined, undefined, { maxKeys: parameterLimit })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|