update
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- app.js +1 -1
- node_modules/.bin/mime +1 -0
- node_modules/.package-lock.json +924 -0
- node_modules/@scarf/scarf/LICENSE +201 -0
- node_modules/@scarf/scarf/README.md +198 -0
- node_modules/@scarf/scarf/package.json +36 -0
- node_modules/@scarf/scarf/report.js +574 -0
- node_modules/accepts/HISTORY.md +243 -0
- node_modules/accepts/LICENSE +23 -0
- node_modules/accepts/README.md +140 -0
- node_modules/accepts/index.js +238 -0
- node_modules/accepts/package.json +47 -0
- node_modules/array-flatten/LICENSE +21 -0
- node_modules/array-flatten/README.md +43 -0
- node_modules/array-flatten/array-flatten.js +64 -0
- node_modules/array-flatten/package.json +39 -0
- node_modules/body-parser/HISTORY.md +672 -0
- node_modules/body-parser/LICENSE +23 -0
- node_modules/body-parser/README.md +476 -0
- node_modules/body-parser/SECURITY.md +25 -0
- node_modules/body-parser/index.js +156 -0
- node_modules/body-parser/lib/read.js +205 -0
- node_modules/body-parser/lib/types/json.js +247 -0
- node_modules/body-parser/lib/types/raw.js +101 -0
- node_modules/body-parser/lib/types/text.js +121 -0
- node_modules/body-parser/lib/types/urlencoded.js +307 -0
- node_modules/body-parser/package.json +56 -0
- node_modules/bytes/History.md +97 -0
- node_modules/bytes/LICENSE +23 -0
- node_modules/bytes/Readme.md +152 -0
- node_modules/bytes/index.js +170 -0
- node_modules/bytes/package.json +42 -0
- node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- node_modules/call-bind-apply-helpers/.nycrc +9 -0
- node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- node_modules/call-bind-apply-helpers/LICENSE +21 -0
- node_modules/call-bind-apply-helpers/README.md +62 -0
- node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- node_modules/call-bind-apply-helpers/index.js +15 -0
- node_modules/call-bind-apply-helpers/package.json +85 -0
- node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
app.js
CHANGED
|
@@ -11,7 +11,7 @@ app.use(cors());
|
|
| 11 |
app.use(express.json());
|
| 12 |
|
| 13 |
// Config
|
| 14 |
-
const DOMAIN = process.env.DOMAIN || 'https://rezaharis-
|
| 15 |
const AUTHOR = 'Fourstore';
|
| 16 |
const RELEASE_DATE = new Date().toISOString().split('T')[0];
|
| 17 |
|
|
|
|
| 11 |
app.use(express.json());
|
| 12 |
|
| 13 |
// Config
|
| 14 |
+
const DOMAIN = process.env.DOMAIN || 'https://rezaharis-hai.hf.space';
|
| 15 |
const AUTHOR = 'Fourstore';
|
| 16 |
const RELEASE_DATE = new Date().toISOString().split('T')[0];
|
| 17 |
|
node_modules/.bin/mime
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../mime/cli.js
|
node_modules/.package-lock.json
ADDED
|
@@ -0,0 +1,924 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ytdlp-service",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"lockfileVersion": 3,
|
| 5 |
+
"requires": true,
|
| 6 |
+
"packages": {
|
| 7 |
+
"node_modules/@scarf/scarf": {
|
| 8 |
+
"version": "1.4.0",
|
| 9 |
+
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz",
|
| 10 |
+
"integrity": "sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==",
|
| 11 |
+
"hasInstallScript": true,
|
| 12 |
+
"license": "Apache-2.0"
|
| 13 |
+
},
|
| 14 |
+
"node_modules/accepts": {
|
| 15 |
+
"version": "1.3.8",
|
| 16 |
+
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
| 17 |
+
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
| 18 |
+
"license": "MIT",
|
| 19 |
+
"dependencies": {
|
| 20 |
+
"mime-types": "~2.1.34",
|
| 21 |
+
"negotiator": "0.6.3"
|
| 22 |
+
},
|
| 23 |
+
"engines": {
|
| 24 |
+
"node": ">= 0.6"
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
"node_modules/array-flatten": {
|
| 28 |
+
"version": "1.1.1",
|
| 29 |
+
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
| 30 |
+
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
| 31 |
+
"license": "MIT"
|
| 32 |
+
},
|
| 33 |
+
"node_modules/body-parser": {
|
| 34 |
+
"version": "1.20.3",
|
| 35 |
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
|
| 36 |
+
"integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
|
| 37 |
+
"license": "MIT",
|
| 38 |
+
"dependencies": {
|
| 39 |
+
"bytes": "3.1.2",
|
| 40 |
+
"content-type": "~1.0.5",
|
| 41 |
+
"debug": "2.6.9",
|
| 42 |
+
"depd": "2.0.0",
|
| 43 |
+
"destroy": "1.2.0",
|
| 44 |
+
"http-errors": "2.0.0",
|
| 45 |
+
"iconv-lite": "0.4.24",
|
| 46 |
+
"on-finished": "2.4.1",
|
| 47 |
+
"qs": "6.13.0",
|
| 48 |
+
"raw-body": "2.5.2",
|
| 49 |
+
"type-is": "~1.6.18",
|
| 50 |
+
"unpipe": "1.0.0"
|
| 51 |
+
},
|
| 52 |
+
"engines": {
|
| 53 |
+
"node": ">= 0.8",
|
| 54 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
"node_modules/bytes": {
|
| 58 |
+
"version": "3.1.2",
|
| 59 |
+
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
| 60 |
+
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
| 61 |
+
"license": "MIT",
|
| 62 |
+
"engines": {
|
| 63 |
+
"node": ">= 0.8"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"node_modules/call-bind-apply-helpers": {
|
| 67 |
+
"version": "1.0.2",
|
| 68 |
+
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
| 69 |
+
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
| 70 |
+
"license": "MIT",
|
| 71 |
+
"dependencies": {
|
| 72 |
+
"es-errors": "^1.3.0",
|
| 73 |
+
"function-bind": "^1.1.2"
|
| 74 |
+
},
|
| 75 |
+
"engines": {
|
| 76 |
+
"node": ">= 0.4"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"node_modules/call-bound": {
|
| 80 |
+
"version": "1.0.4",
|
| 81 |
+
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
| 82 |
+
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
| 83 |
+
"license": "MIT",
|
| 84 |
+
"dependencies": {
|
| 85 |
+
"call-bind-apply-helpers": "^1.0.2",
|
| 86 |
+
"get-intrinsic": "^1.3.0"
|
| 87 |
+
},
|
| 88 |
+
"engines": {
|
| 89 |
+
"node": ">= 0.4"
|
| 90 |
+
},
|
| 91 |
+
"funding": {
|
| 92 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"node_modules/child_process": {
|
| 96 |
+
"version": "1.0.2",
|
| 97 |
+
"resolved": "https://registry.npmjs.org/child_process/-/child_process-1.0.2.tgz",
|
| 98 |
+
"integrity": "sha512-Wmza/JzL0SiWz7kl6MhIKT5ceIlnFPJX+lwUGj7Clhy5MMldsSoJR0+uvRzOS5Kv45Mq7t1PoE8TsOA9bzvb6g==",
|
| 99 |
+
"license": "ISC"
|
| 100 |
+
},
|
| 101 |
+
"node_modules/content-disposition": {
|
| 102 |
+
"version": "0.5.4",
|
| 103 |
+
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
| 104 |
+
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
| 105 |
+
"license": "MIT",
|
| 106 |
+
"dependencies": {
|
| 107 |
+
"safe-buffer": "5.2.1"
|
| 108 |
+
},
|
| 109 |
+
"engines": {
|
| 110 |
+
"node": ">= 0.6"
|
| 111 |
+
}
|
| 112 |
+
},
|
| 113 |
+
"node_modules/content-type": {
|
| 114 |
+
"version": "1.0.5",
|
| 115 |
+
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
| 116 |
+
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
| 117 |
+
"license": "MIT",
|
| 118 |
+
"engines": {
|
| 119 |
+
"node": ">= 0.6"
|
| 120 |
+
}
|
| 121 |
+
},
|
| 122 |
+
"node_modules/cookie": {
|
| 123 |
+
"version": "0.7.1",
|
| 124 |
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz",
|
| 125 |
+
"integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==",
|
| 126 |
+
"license": "MIT",
|
| 127 |
+
"engines": {
|
| 128 |
+
"node": ">= 0.6"
|
| 129 |
+
}
|
| 130 |
+
},
|
| 131 |
+
"node_modules/cookie-signature": {
|
| 132 |
+
"version": "1.0.6",
|
| 133 |
+
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
| 134 |
+
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
|
| 135 |
+
"license": "MIT"
|
| 136 |
+
},
|
| 137 |
+
"node_modules/cors": {
|
| 138 |
+
"version": "2.8.5",
|
| 139 |
+
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
| 140 |
+
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
| 141 |
+
"license": "MIT",
|
| 142 |
+
"dependencies": {
|
| 143 |
+
"object-assign": "^4",
|
| 144 |
+
"vary": "^1"
|
| 145 |
+
},
|
| 146 |
+
"engines": {
|
| 147 |
+
"node": ">= 0.10"
|
| 148 |
+
}
|
| 149 |
+
},
|
| 150 |
+
"node_modules/debug": {
|
| 151 |
+
"version": "2.6.9",
|
| 152 |
+
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
| 153 |
+
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
| 154 |
+
"license": "MIT",
|
| 155 |
+
"dependencies": {
|
| 156 |
+
"ms": "2.0.0"
|
| 157 |
+
}
|
| 158 |
+
},
|
| 159 |
+
"node_modules/depd": {
|
| 160 |
+
"version": "2.0.0",
|
| 161 |
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
| 162 |
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
| 163 |
+
"license": "MIT",
|
| 164 |
+
"engines": {
|
| 165 |
+
"node": ">= 0.8"
|
| 166 |
+
}
|
| 167 |
+
},
|
| 168 |
+
"node_modules/destroy": {
|
| 169 |
+
"version": "1.2.0",
|
| 170 |
+
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
| 171 |
+
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
| 172 |
+
"license": "MIT",
|
| 173 |
+
"engines": {
|
| 174 |
+
"node": ">= 0.8",
|
| 175 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"node_modules/dunder-proto": {
|
| 179 |
+
"version": "1.0.1",
|
| 180 |
+
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
| 181 |
+
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
| 182 |
+
"license": "MIT",
|
| 183 |
+
"dependencies": {
|
| 184 |
+
"call-bind-apply-helpers": "^1.0.1",
|
| 185 |
+
"es-errors": "^1.3.0",
|
| 186 |
+
"gopd": "^1.2.0"
|
| 187 |
+
},
|
| 188 |
+
"engines": {
|
| 189 |
+
"node": ">= 0.4"
|
| 190 |
+
}
|
| 191 |
+
},
|
| 192 |
+
"node_modules/ee-first": {
|
| 193 |
+
"version": "1.1.1",
|
| 194 |
+
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
| 195 |
+
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
| 196 |
+
"license": "MIT"
|
| 197 |
+
},
|
| 198 |
+
"node_modules/encodeurl": {
|
| 199 |
+
"version": "2.0.0",
|
| 200 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
| 201 |
+
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
| 202 |
+
"license": "MIT",
|
| 203 |
+
"engines": {
|
| 204 |
+
"node": ">= 0.8"
|
| 205 |
+
}
|
| 206 |
+
},
|
| 207 |
+
"node_modules/es-define-property": {
|
| 208 |
+
"version": "1.0.1",
|
| 209 |
+
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
| 210 |
+
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
| 211 |
+
"license": "MIT",
|
| 212 |
+
"engines": {
|
| 213 |
+
"node": ">= 0.4"
|
| 214 |
+
}
|
| 215 |
+
},
|
| 216 |
+
"node_modules/es-errors": {
|
| 217 |
+
"version": "1.3.0",
|
| 218 |
+
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
| 219 |
+
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
| 220 |
+
"license": "MIT",
|
| 221 |
+
"engines": {
|
| 222 |
+
"node": ">= 0.4"
|
| 223 |
+
}
|
| 224 |
+
},
|
| 225 |
+
"node_modules/es-object-atoms": {
|
| 226 |
+
"version": "1.1.1",
|
| 227 |
+
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
| 228 |
+
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
| 229 |
+
"license": "MIT",
|
| 230 |
+
"dependencies": {
|
| 231 |
+
"es-errors": "^1.3.0"
|
| 232 |
+
},
|
| 233 |
+
"engines": {
|
| 234 |
+
"node": ">= 0.4"
|
| 235 |
+
}
|
| 236 |
+
},
|
| 237 |
+
"node_modules/escape-html": {
|
| 238 |
+
"version": "1.0.3",
|
| 239 |
+
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
| 240 |
+
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
| 241 |
+
"license": "MIT"
|
| 242 |
+
},
|
| 243 |
+
"node_modules/etag": {
|
| 244 |
+
"version": "1.8.1",
|
| 245 |
+
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
| 246 |
+
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
| 247 |
+
"license": "MIT",
|
| 248 |
+
"engines": {
|
| 249 |
+
"node": ">= 0.6"
|
| 250 |
+
}
|
| 251 |
+
},
|
| 252 |
+
"node_modules/express": {
|
| 253 |
+
"version": "4.21.2",
|
| 254 |
+
"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
|
| 255 |
+
"integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
|
| 256 |
+
"license": "MIT",
|
| 257 |
+
"dependencies": {
|
| 258 |
+
"accepts": "~1.3.8",
|
| 259 |
+
"array-flatten": "1.1.1",
|
| 260 |
+
"body-parser": "1.20.3",
|
| 261 |
+
"content-disposition": "0.5.4",
|
| 262 |
+
"content-type": "~1.0.4",
|
| 263 |
+
"cookie": "0.7.1",
|
| 264 |
+
"cookie-signature": "1.0.6",
|
| 265 |
+
"debug": "2.6.9",
|
| 266 |
+
"depd": "2.0.0",
|
| 267 |
+
"encodeurl": "~2.0.0",
|
| 268 |
+
"escape-html": "~1.0.3",
|
| 269 |
+
"etag": "~1.8.1",
|
| 270 |
+
"finalhandler": "1.3.1",
|
| 271 |
+
"fresh": "0.5.2",
|
| 272 |
+
"http-errors": "2.0.0",
|
| 273 |
+
"merge-descriptors": "1.0.3",
|
| 274 |
+
"methods": "~1.1.2",
|
| 275 |
+
"on-finished": "2.4.1",
|
| 276 |
+
"parseurl": "~1.3.3",
|
| 277 |
+
"path-to-regexp": "0.1.12",
|
| 278 |
+
"proxy-addr": "~2.0.7",
|
| 279 |
+
"qs": "6.13.0",
|
| 280 |
+
"range-parser": "~1.2.1",
|
| 281 |
+
"safe-buffer": "5.2.1",
|
| 282 |
+
"send": "0.19.0",
|
| 283 |
+
"serve-static": "1.16.2",
|
| 284 |
+
"setprototypeof": "1.2.0",
|
| 285 |
+
"statuses": "2.0.1",
|
| 286 |
+
"type-is": "~1.6.18",
|
| 287 |
+
"utils-merge": "1.0.1",
|
| 288 |
+
"vary": "~1.1.2"
|
| 289 |
+
},
|
| 290 |
+
"engines": {
|
| 291 |
+
"node": ">= 0.10.0"
|
| 292 |
+
},
|
| 293 |
+
"funding": {
|
| 294 |
+
"type": "opencollective",
|
| 295 |
+
"url": "https://opencollective.com/express"
|
| 296 |
+
}
|
| 297 |
+
},
|
| 298 |
+
"node_modules/finalhandler": {
|
| 299 |
+
"version": "1.3.1",
|
| 300 |
+
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
|
| 301 |
+
"integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
|
| 302 |
+
"license": "MIT",
|
| 303 |
+
"dependencies": {
|
| 304 |
+
"debug": "2.6.9",
|
| 305 |
+
"encodeurl": "~2.0.0",
|
| 306 |
+
"escape-html": "~1.0.3",
|
| 307 |
+
"on-finished": "2.4.1",
|
| 308 |
+
"parseurl": "~1.3.3",
|
| 309 |
+
"statuses": "2.0.1",
|
| 310 |
+
"unpipe": "~1.0.0"
|
| 311 |
+
},
|
| 312 |
+
"engines": {
|
| 313 |
+
"node": ">= 0.8"
|
| 314 |
+
}
|
| 315 |
+
},
|
| 316 |
+
"node_modules/forwarded": {
|
| 317 |
+
"version": "0.2.0",
|
| 318 |
+
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
| 319 |
+
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
| 320 |
+
"license": "MIT",
|
| 321 |
+
"engines": {
|
| 322 |
+
"node": ">= 0.6"
|
| 323 |
+
}
|
| 324 |
+
},
|
| 325 |
+
"node_modules/fresh": {
|
| 326 |
+
"version": "0.5.2",
|
| 327 |
+
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
| 328 |
+
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
| 329 |
+
"license": "MIT",
|
| 330 |
+
"engines": {
|
| 331 |
+
"node": ">= 0.6"
|
| 332 |
+
}
|
| 333 |
+
},
|
| 334 |
+
"node_modules/fs": {
|
| 335 |
+
"version": "0.0.1-security",
|
| 336 |
+
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
| 337 |
+
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==",
|
| 338 |
+
"license": "ISC"
|
| 339 |
+
},
|
| 340 |
+
"node_modules/function-bind": {
|
| 341 |
+
"version": "1.1.2",
|
| 342 |
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
| 343 |
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
| 344 |
+
"license": "MIT",
|
| 345 |
+
"funding": {
|
| 346 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 347 |
+
}
|
| 348 |
+
},
|
| 349 |
+
"node_modules/get-intrinsic": {
|
| 350 |
+
"version": "1.3.0",
|
| 351 |
+
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
| 352 |
+
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
| 353 |
+
"license": "MIT",
|
| 354 |
+
"dependencies": {
|
| 355 |
+
"call-bind-apply-helpers": "^1.0.2",
|
| 356 |
+
"es-define-property": "^1.0.1",
|
| 357 |
+
"es-errors": "^1.3.0",
|
| 358 |
+
"es-object-atoms": "^1.1.1",
|
| 359 |
+
"function-bind": "^1.1.2",
|
| 360 |
+
"get-proto": "^1.0.1",
|
| 361 |
+
"gopd": "^1.2.0",
|
| 362 |
+
"has-symbols": "^1.1.0",
|
| 363 |
+
"hasown": "^2.0.2",
|
| 364 |
+
"math-intrinsics": "^1.1.0"
|
| 365 |
+
},
|
| 366 |
+
"engines": {
|
| 367 |
+
"node": ">= 0.4"
|
| 368 |
+
},
|
| 369 |
+
"funding": {
|
| 370 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 371 |
+
}
|
| 372 |
+
},
|
| 373 |
+
"node_modules/get-proto": {
|
| 374 |
+
"version": "1.0.1",
|
| 375 |
+
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
| 376 |
+
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
| 377 |
+
"license": "MIT",
|
| 378 |
+
"dependencies": {
|
| 379 |
+
"dunder-proto": "^1.0.1",
|
| 380 |
+
"es-object-atoms": "^1.0.0"
|
| 381 |
+
},
|
| 382 |
+
"engines": {
|
| 383 |
+
"node": ">= 0.4"
|
| 384 |
+
}
|
| 385 |
+
},
|
| 386 |
+
"node_modules/gopd": {
|
| 387 |
+
"version": "1.2.0",
|
| 388 |
+
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
| 389 |
+
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
| 390 |
+
"license": "MIT",
|
| 391 |
+
"engines": {
|
| 392 |
+
"node": ">= 0.4"
|
| 393 |
+
},
|
| 394 |
+
"funding": {
|
| 395 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 396 |
+
}
|
| 397 |
+
},
|
| 398 |
+
"node_modules/has-symbols": {
|
| 399 |
+
"version": "1.1.0",
|
| 400 |
+
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
| 401 |
+
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
| 402 |
+
"license": "MIT",
|
| 403 |
+
"engines": {
|
| 404 |
+
"node": ">= 0.4"
|
| 405 |
+
},
|
| 406 |
+
"funding": {
|
| 407 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 408 |
+
}
|
| 409 |
+
},
|
| 410 |
+
"node_modules/hasown": {
|
| 411 |
+
"version": "2.0.2",
|
| 412 |
+
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
| 413 |
+
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
| 414 |
+
"license": "MIT",
|
| 415 |
+
"dependencies": {
|
| 416 |
+
"function-bind": "^1.1.2"
|
| 417 |
+
},
|
| 418 |
+
"engines": {
|
| 419 |
+
"node": ">= 0.4"
|
| 420 |
+
}
|
| 421 |
+
},
|
| 422 |
+
"node_modules/http-errors": {
|
| 423 |
+
"version": "2.0.0",
|
| 424 |
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
| 425 |
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
| 426 |
+
"license": "MIT",
|
| 427 |
+
"dependencies": {
|
| 428 |
+
"depd": "2.0.0",
|
| 429 |
+
"inherits": "2.0.4",
|
| 430 |
+
"setprototypeof": "1.2.0",
|
| 431 |
+
"statuses": "2.0.1",
|
| 432 |
+
"toidentifier": "1.0.1"
|
| 433 |
+
},
|
| 434 |
+
"engines": {
|
| 435 |
+
"node": ">= 0.8"
|
| 436 |
+
}
|
| 437 |
+
},
|
| 438 |
+
"node_modules/iconv-lite": {
|
| 439 |
+
"version": "0.4.24",
|
| 440 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
| 441 |
+
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
| 442 |
+
"license": "MIT",
|
| 443 |
+
"dependencies": {
|
| 444 |
+
"safer-buffer": ">= 2.1.2 < 3"
|
| 445 |
+
},
|
| 446 |
+
"engines": {
|
| 447 |
+
"node": ">=0.10.0"
|
| 448 |
+
}
|
| 449 |
+
},
|
| 450 |
+
"node_modules/inherits": {
|
| 451 |
+
"version": "2.0.4",
|
| 452 |
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
| 453 |
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
| 454 |
+
"license": "ISC"
|
| 455 |
+
},
|
| 456 |
+
"node_modules/ipaddr.js": {
|
| 457 |
+
"version": "1.9.1",
|
| 458 |
+
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
| 459 |
+
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
| 460 |
+
"license": "MIT",
|
| 461 |
+
"engines": {
|
| 462 |
+
"node": ">= 0.10"
|
| 463 |
+
}
|
| 464 |
+
},
|
| 465 |
+
"node_modules/math-intrinsics": {
|
| 466 |
+
"version": "1.1.0",
|
| 467 |
+
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
| 468 |
+
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
| 469 |
+
"license": "MIT",
|
| 470 |
+
"engines": {
|
| 471 |
+
"node": ">= 0.4"
|
| 472 |
+
}
|
| 473 |
+
},
|
| 474 |
+
"node_modules/media-typer": {
|
| 475 |
+
"version": "0.3.0",
|
| 476 |
+
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
| 477 |
+
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
| 478 |
+
"license": "MIT",
|
| 479 |
+
"engines": {
|
| 480 |
+
"node": ">= 0.6"
|
| 481 |
+
}
|
| 482 |
+
},
|
| 483 |
+
"node_modules/merge-descriptors": {
|
| 484 |
+
"version": "1.0.3",
|
| 485 |
+
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
| 486 |
+
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
| 487 |
+
"license": "MIT",
|
| 488 |
+
"funding": {
|
| 489 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
| 490 |
+
}
|
| 491 |
+
},
|
| 492 |
+
"node_modules/methods": {
|
| 493 |
+
"version": "1.1.2",
|
| 494 |
+
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
| 495 |
+
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
| 496 |
+
"license": "MIT",
|
| 497 |
+
"engines": {
|
| 498 |
+
"node": ">= 0.6"
|
| 499 |
+
}
|
| 500 |
+
},
|
| 501 |
+
"node_modules/mime": {
|
| 502 |
+
"version": "1.6.0",
|
| 503 |
+
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
| 504 |
+
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
| 505 |
+
"license": "MIT",
|
| 506 |
+
"bin": {
|
| 507 |
+
"mime": "cli.js"
|
| 508 |
+
},
|
| 509 |
+
"engines": {
|
| 510 |
+
"node": ">=4"
|
| 511 |
+
}
|
| 512 |
+
},
|
| 513 |
+
"node_modules/mime-db": {
|
| 514 |
+
"version": "1.52.0",
|
| 515 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
| 516 |
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
| 517 |
+
"license": "MIT",
|
| 518 |
+
"engines": {
|
| 519 |
+
"node": ">= 0.6"
|
| 520 |
+
}
|
| 521 |
+
},
|
| 522 |
+
"node_modules/mime-types": {
|
| 523 |
+
"version": "2.1.35",
|
| 524 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
| 525 |
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
| 526 |
+
"license": "MIT",
|
| 527 |
+
"dependencies": {
|
| 528 |
+
"mime-db": "1.52.0"
|
| 529 |
+
},
|
| 530 |
+
"engines": {
|
| 531 |
+
"node": ">= 0.6"
|
| 532 |
+
}
|
| 533 |
+
},
|
| 534 |
+
"node_modules/ms": {
|
| 535 |
+
"version": "2.0.0",
|
| 536 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
| 537 |
+
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
| 538 |
+
"license": "MIT"
|
| 539 |
+
},
|
| 540 |
+
"node_modules/negotiator": {
|
| 541 |
+
"version": "0.6.3",
|
| 542 |
+
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
| 543 |
+
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
| 544 |
+
"license": "MIT",
|
| 545 |
+
"engines": {
|
| 546 |
+
"node": ">= 0.6"
|
| 547 |
+
}
|
| 548 |
+
},
|
| 549 |
+
"node_modules/object-assign": {
|
| 550 |
+
"version": "4.1.1",
|
| 551 |
+
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
| 552 |
+
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
| 553 |
+
"license": "MIT",
|
| 554 |
+
"engines": {
|
| 555 |
+
"node": ">=0.10.0"
|
| 556 |
+
}
|
| 557 |
+
},
|
| 558 |
+
"node_modules/object-inspect": {
|
| 559 |
+
"version": "1.13.4",
|
| 560 |
+
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
| 561 |
+
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
| 562 |
+
"license": "MIT",
|
| 563 |
+
"engines": {
|
| 564 |
+
"node": ">= 0.4"
|
| 565 |
+
},
|
| 566 |
+
"funding": {
|
| 567 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 568 |
+
}
|
| 569 |
+
},
|
| 570 |
+
"node_modules/on-finished": {
|
| 571 |
+
"version": "2.4.1",
|
| 572 |
+
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
| 573 |
+
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
| 574 |
+
"license": "MIT",
|
| 575 |
+
"dependencies": {
|
| 576 |
+
"ee-first": "1.1.1"
|
| 577 |
+
},
|
| 578 |
+
"engines": {
|
| 579 |
+
"node": ">= 0.8"
|
| 580 |
+
}
|
| 581 |
+
},
|
| 582 |
+
"node_modules/parseurl": {
|
| 583 |
+
"version": "1.3.3",
|
| 584 |
+
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
| 585 |
+
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
| 586 |
+
"license": "MIT",
|
| 587 |
+
"engines": {
|
| 588 |
+
"node": ">= 0.8"
|
| 589 |
+
}
|
| 590 |
+
},
|
| 591 |
+
"node_modules/path": {
|
| 592 |
+
"version": "0.12.7",
|
| 593 |
+
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
|
| 594 |
+
"integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
|
| 595 |
+
"license": "MIT",
|
| 596 |
+
"dependencies": {
|
| 597 |
+
"process": "^0.11.1",
|
| 598 |
+
"util": "^0.10.3"
|
| 599 |
+
}
|
| 600 |
+
},
|
| 601 |
+
"node_modules/path-to-regexp": {
|
| 602 |
+
"version": "0.1.12",
|
| 603 |
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
|
| 604 |
+
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
| 605 |
+
"license": "MIT"
|
| 606 |
+
},
|
| 607 |
+
"node_modules/process": {
|
| 608 |
+
"version": "0.11.10",
|
| 609 |
+
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
| 610 |
+
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
| 611 |
+
"license": "MIT",
|
| 612 |
+
"engines": {
|
| 613 |
+
"node": ">= 0.6.0"
|
| 614 |
+
}
|
| 615 |
+
},
|
| 616 |
+
"node_modules/proxy-addr": {
|
| 617 |
+
"version": "2.0.7",
|
| 618 |
+
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
| 619 |
+
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
| 620 |
+
"license": "MIT",
|
| 621 |
+
"dependencies": {
|
| 622 |
+
"forwarded": "0.2.0",
|
| 623 |
+
"ipaddr.js": "1.9.1"
|
| 624 |
+
},
|
| 625 |
+
"engines": {
|
| 626 |
+
"node": ">= 0.10"
|
| 627 |
+
}
|
| 628 |
+
},
|
| 629 |
+
"node_modules/qs": {
|
| 630 |
+
"version": "6.13.0",
|
| 631 |
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
|
| 632 |
+
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
|
| 633 |
+
"license": "BSD-3-Clause",
|
| 634 |
+
"dependencies": {
|
| 635 |
+
"side-channel": "^1.0.6"
|
| 636 |
+
},
|
| 637 |
+
"engines": {
|
| 638 |
+
"node": ">=0.6"
|
| 639 |
+
},
|
| 640 |
+
"funding": {
|
| 641 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 642 |
+
}
|
| 643 |
+
},
|
| 644 |
+
"node_modules/range-parser": {
|
| 645 |
+
"version": "1.2.1",
|
| 646 |
+
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
| 647 |
+
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
| 648 |
+
"license": "MIT",
|
| 649 |
+
"engines": {
|
| 650 |
+
"node": ">= 0.6"
|
| 651 |
+
}
|
| 652 |
+
},
|
| 653 |
+
"node_modules/raw-body": {
|
| 654 |
+
"version": "2.5.2",
|
| 655 |
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
|
| 656 |
+
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
|
| 657 |
+
"license": "MIT",
|
| 658 |
+
"dependencies": {
|
| 659 |
+
"bytes": "3.1.2",
|
| 660 |
+
"http-errors": "2.0.0",
|
| 661 |
+
"iconv-lite": "0.4.24",
|
| 662 |
+
"unpipe": "1.0.0"
|
| 663 |
+
},
|
| 664 |
+
"engines": {
|
| 665 |
+
"node": ">= 0.8"
|
| 666 |
+
}
|
| 667 |
+
},
|
| 668 |
+
"node_modules/safe-buffer": {
|
| 669 |
+
"version": "5.2.1",
|
| 670 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
| 671 |
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
| 672 |
+
"funding": [
|
| 673 |
+
{
|
| 674 |
+
"type": "github",
|
| 675 |
+
"url": "https://github.com/sponsors/feross"
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
"type": "patreon",
|
| 679 |
+
"url": "https://www.patreon.com/feross"
|
| 680 |
+
},
|
| 681 |
+
{
|
| 682 |
+
"type": "consulting",
|
| 683 |
+
"url": "https://feross.org/support"
|
| 684 |
+
}
|
| 685 |
+
],
|
| 686 |
+
"license": "MIT"
|
| 687 |
+
},
|
| 688 |
+
"node_modules/safer-buffer": {
|
| 689 |
+
"version": "2.1.2",
|
| 690 |
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
| 691 |
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
| 692 |
+
"license": "MIT"
|
| 693 |
+
},
|
| 694 |
+
"node_modules/send": {
|
| 695 |
+
"version": "0.19.0",
|
| 696 |
+
"resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
|
| 697 |
+
"integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
|
| 698 |
+
"license": "MIT",
|
| 699 |
+
"dependencies": {
|
| 700 |
+
"debug": "2.6.9",
|
| 701 |
+
"depd": "2.0.0",
|
| 702 |
+
"destroy": "1.2.0",
|
| 703 |
+
"encodeurl": "~1.0.2",
|
| 704 |
+
"escape-html": "~1.0.3",
|
| 705 |
+
"etag": "~1.8.1",
|
| 706 |
+
"fresh": "0.5.2",
|
| 707 |
+
"http-errors": "2.0.0",
|
| 708 |
+
"mime": "1.6.0",
|
| 709 |
+
"ms": "2.1.3",
|
| 710 |
+
"on-finished": "2.4.1",
|
| 711 |
+
"range-parser": "~1.2.1",
|
| 712 |
+
"statuses": "2.0.1"
|
| 713 |
+
},
|
| 714 |
+
"engines": {
|
| 715 |
+
"node": ">= 0.8.0"
|
| 716 |
+
}
|
| 717 |
+
},
|
| 718 |
+
"node_modules/send/node_modules/encodeurl": {
|
| 719 |
+
"version": "1.0.2",
|
| 720 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
| 721 |
+
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
| 722 |
+
"license": "MIT",
|
| 723 |
+
"engines": {
|
| 724 |
+
"node": ">= 0.8"
|
| 725 |
+
}
|
| 726 |
+
},
|
| 727 |
+
"node_modules/send/node_modules/ms": {
|
| 728 |
+
"version": "2.1.3",
|
| 729 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
| 730 |
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
| 731 |
+
"license": "MIT"
|
| 732 |
+
},
|
| 733 |
+
"node_modules/serve-static": {
|
| 734 |
+
"version": "1.16.2",
|
| 735 |
+
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
|
| 736 |
+
"integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
|
| 737 |
+
"license": "MIT",
|
| 738 |
+
"dependencies": {
|
| 739 |
+
"encodeurl": "~2.0.0",
|
| 740 |
+
"escape-html": "~1.0.3",
|
| 741 |
+
"parseurl": "~1.3.3",
|
| 742 |
+
"send": "0.19.0"
|
| 743 |
+
},
|
| 744 |
+
"engines": {
|
| 745 |
+
"node": ">= 0.8.0"
|
| 746 |
+
}
|
| 747 |
+
},
|
| 748 |
+
"node_modules/setprototypeof": {
|
| 749 |
+
"version": "1.2.0",
|
| 750 |
+
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
| 751 |
+
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
| 752 |
+
"license": "ISC"
|
| 753 |
+
},
|
| 754 |
+
"node_modules/side-channel": {
|
| 755 |
+
"version": "1.1.0",
|
| 756 |
+
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
| 757 |
+
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
| 758 |
+
"license": "MIT",
|
| 759 |
+
"dependencies": {
|
| 760 |
+
"es-errors": "^1.3.0",
|
| 761 |
+
"object-inspect": "^1.13.3",
|
| 762 |
+
"side-channel-list": "^1.0.0",
|
| 763 |
+
"side-channel-map": "^1.0.1",
|
| 764 |
+
"side-channel-weakmap": "^1.0.2"
|
| 765 |
+
},
|
| 766 |
+
"engines": {
|
| 767 |
+
"node": ">= 0.4"
|
| 768 |
+
},
|
| 769 |
+
"funding": {
|
| 770 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 771 |
+
}
|
| 772 |
+
},
|
| 773 |
+
"node_modules/side-channel-list": {
|
| 774 |
+
"version": "1.0.0",
|
| 775 |
+
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
| 776 |
+
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
| 777 |
+
"license": "MIT",
|
| 778 |
+
"dependencies": {
|
| 779 |
+
"es-errors": "^1.3.0",
|
| 780 |
+
"object-inspect": "^1.13.3"
|
| 781 |
+
},
|
| 782 |
+
"engines": {
|
| 783 |
+
"node": ">= 0.4"
|
| 784 |
+
},
|
| 785 |
+
"funding": {
|
| 786 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 787 |
+
}
|
| 788 |
+
},
|
| 789 |
+
"node_modules/side-channel-map": {
|
| 790 |
+
"version": "1.0.1",
|
| 791 |
+
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
| 792 |
+
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
| 793 |
+
"license": "MIT",
|
| 794 |
+
"dependencies": {
|
| 795 |
+
"call-bound": "^1.0.2",
|
| 796 |
+
"es-errors": "^1.3.0",
|
| 797 |
+
"get-intrinsic": "^1.2.5",
|
| 798 |
+
"object-inspect": "^1.13.3"
|
| 799 |
+
},
|
| 800 |
+
"engines": {
|
| 801 |
+
"node": ">= 0.4"
|
| 802 |
+
},
|
| 803 |
+
"funding": {
|
| 804 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 805 |
+
}
|
| 806 |
+
},
|
| 807 |
+
"node_modules/side-channel-weakmap": {
|
| 808 |
+
"version": "1.0.2",
|
| 809 |
+
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
| 810 |
+
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
| 811 |
+
"license": "MIT",
|
| 812 |
+
"dependencies": {
|
| 813 |
+
"call-bound": "^1.0.2",
|
| 814 |
+
"es-errors": "^1.3.0",
|
| 815 |
+
"get-intrinsic": "^1.2.5",
|
| 816 |
+
"object-inspect": "^1.13.3",
|
| 817 |
+
"side-channel-map": "^1.0.1"
|
| 818 |
+
},
|
| 819 |
+
"engines": {
|
| 820 |
+
"node": ">= 0.4"
|
| 821 |
+
},
|
| 822 |
+
"funding": {
|
| 823 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 824 |
+
}
|
| 825 |
+
},
|
| 826 |
+
"node_modules/statuses": {
|
| 827 |
+
"version": "2.0.1",
|
| 828 |
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
| 829 |
+
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
| 830 |
+
"license": "MIT",
|
| 831 |
+
"engines": {
|
| 832 |
+
"node": ">= 0.8"
|
| 833 |
+
}
|
| 834 |
+
},
|
| 835 |
+
"node_modules/swagger-ui-dist": {
|
| 836 |
+
"version": "5.27.0",
|
| 837 |
+
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.27.0.tgz",
|
| 838 |
+
"integrity": "sha512-tS6LRyBhY6yAqxrfsA9IYpGWPUJOri6sclySa7TdC7XQfGLvTwDY531KLgfQwHEtQsn+sT4JlUspbeQDBVGWig==",
|
| 839 |
+
"license": "Apache-2.0",
|
| 840 |
+
"dependencies": {
|
| 841 |
+
"@scarf/scarf": "=1.4.0"
|
| 842 |
+
}
|
| 843 |
+
},
|
| 844 |
+
"node_modules/swagger-ui-express": {
|
| 845 |
+
"version": "5.0.1",
|
| 846 |
+
"resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.1.tgz",
|
| 847 |
+
"integrity": "sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA==",
|
| 848 |
+
"license": "MIT",
|
| 849 |
+
"dependencies": {
|
| 850 |
+
"swagger-ui-dist": ">=5.0.0"
|
| 851 |
+
},
|
| 852 |
+
"engines": {
|
| 853 |
+
"node": ">= v0.10.32"
|
| 854 |
+
},
|
| 855 |
+
"peerDependencies": {
|
| 856 |
+
"express": ">=4.0.0 || >=5.0.0-beta"
|
| 857 |
+
}
|
| 858 |
+
},
|
| 859 |
+
"node_modules/toidentifier": {
|
| 860 |
+
"version": "1.0.1",
|
| 861 |
+
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
| 862 |
+
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
| 863 |
+
"license": "MIT",
|
| 864 |
+
"engines": {
|
| 865 |
+
"node": ">=0.6"
|
| 866 |
+
}
|
| 867 |
+
},
|
| 868 |
+
"node_modules/type-is": {
|
| 869 |
+
"version": "1.6.18",
|
| 870 |
+
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
| 871 |
+
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
| 872 |
+
"license": "MIT",
|
| 873 |
+
"dependencies": {
|
| 874 |
+
"media-typer": "0.3.0",
|
| 875 |
+
"mime-types": "~2.1.24"
|
| 876 |
+
},
|
| 877 |
+
"engines": {
|
| 878 |
+
"node": ">= 0.6"
|
| 879 |
+
}
|
| 880 |
+
},
|
| 881 |
+
"node_modules/unpipe": {
|
| 882 |
+
"version": "1.0.0",
|
| 883 |
+
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
| 884 |
+
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
| 885 |
+
"license": "MIT",
|
| 886 |
+
"engines": {
|
| 887 |
+
"node": ">= 0.8"
|
| 888 |
+
}
|
| 889 |
+
},
|
| 890 |
+
"node_modules/util": {
|
| 891 |
+
"version": "0.10.4",
|
| 892 |
+
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
|
| 893 |
+
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
| 894 |
+
"license": "MIT",
|
| 895 |
+
"dependencies": {
|
| 896 |
+
"inherits": "2.0.3"
|
| 897 |
+
}
|
| 898 |
+
},
|
| 899 |
+
"node_modules/util/node_modules/inherits": {
|
| 900 |
+
"version": "2.0.3",
|
| 901 |
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
| 902 |
+
"integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==",
|
| 903 |
+
"license": "ISC"
|
| 904 |
+
},
|
| 905 |
+
"node_modules/utils-merge": {
|
| 906 |
+
"version": "1.0.1",
|
| 907 |
+
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
| 908 |
+
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
| 909 |
+
"license": "MIT",
|
| 910 |
+
"engines": {
|
| 911 |
+
"node": ">= 0.4.0"
|
| 912 |
+
}
|
| 913 |
+
},
|
| 914 |
+
"node_modules/vary": {
|
| 915 |
+
"version": "1.1.2",
|
| 916 |
+
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
| 917 |
+
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
| 918 |
+
"license": "MIT",
|
| 919 |
+
"engines": {
|
| 920 |
+
"node": ">= 0.8"
|
| 921 |
+
}
|
| 922 |
+
}
|
| 923 |
+
}
|
| 924 |
+
}
|
node_modules/@scarf/scarf/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright 2020 Scarf Systems, Inc.
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# scarf-js
|
| 2 |
+
|
| 3 |
+

|
| 4 |
+
[](https://badge.fury.io/js/%40scarf%2Fscarf)
|
| 5 |
+
<a href="https://www.npmjs.com/package/@scarf/scarf"></a>
|
| 6 |
+
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=fc72d03c-c3a2-4736-b243-10eeff839778" />
|
| 7 |
+
<a href="https://tinyurl.com/scarf-community-slack"><img src="https://img.shields.io/badge/Scarf%20Community%20-Slack-blue" alt="Join the Scarf Community Slack" />
|
| 8 |
+
</a>
|
| 9 |
+
|
| 10 |
+
Scarf is like Google Analytics for your npm packages. By sending some basic
|
| 11 |
+
details after installation, this package can help you can gain insight into how
|
| 12 |
+
your packages are used and by which companies. Scarf aims to help open-source developers
|
| 13 |
+
fund their work when it is used commercially.
|
| 14 |
+
|
| 15 |
+
To read more about why we wrote this library, check out [this post](https://github.com/scarf-sh/scarf-js/blob/master/WHY.org) on the topic.
|
| 16 |
+
|
| 17 |
+
### Features
|
| 18 |
+
|
| 19 |
+
- No dependencies.
|
| 20 |
+
- Fully transparent to the user. Scarf will log its behavior to the console
|
| 21 |
+
during installation. It will never silently report analytics for someone that
|
| 22 |
+
hasn't explictly given permission to do so.
|
| 23 |
+
- Never interrupts your package installation. Reporting is done on a best effort basis.
|
| 24 |
+
|
| 25 |
+
### Installing
|
| 26 |
+
|
| 27 |
+
You'll first need to create a library entry on [Scarf](https://scarf.sh). Once
|
| 28 |
+
created, add a dependency on this library to your own:
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
npm i --save @scarf/scarf
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
Once your library is published to npm with this change, Scarf will automatically
|
| 35 |
+
collect stats on install, no additional code is required!
|
| 36 |
+
|
| 37 |
+
Head to your package's dashboard on Scarf to see your reports when available.
|
| 38 |
+
|
| 39 |
+
### Configuring
|
| 40 |
+
|
| 41 |
+
Users of your package will be opted in by default and can opt out by setting the
|
| 42 |
+
`SCARF_ANALYTICS=false` environment variable. If you'd like Scarf analytics to
|
| 43 |
+
instead be opt-in, you can set this by adding an entry to your `package.json`
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
```json5
|
| 47 |
+
// your-package/package.json
|
| 48 |
+
|
| 49 |
+
{
|
| 50 |
+
// ...
|
| 51 |
+
"scarfSettings": {
|
| 52 |
+
"defaultOptIn": false
|
| 53 |
+
}
|
| 54 |
+
// ...
|
| 55 |
+
}
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Scarf will now be opt-out by default, and users can set `SCARF_ANALYTICS=true`
|
| 59 |
+
to opt in.
|
| 60 |
+
|
| 61 |
+
Regardless of the default state, Scarf will log what it is doing to users who
|
| 62 |
+
haven't explictly opted in or out.
|
| 63 |
+
|
| 64 |
+
By default, scarf-js will only trigger analytics when your package is installed as a dependency of another package, or is being installed globally. This ensures that scarf-js analytics will not be triggered on `npm install` being run _within your project_. To change this, you can add:
|
| 65 |
+
|
| 66 |
+
```json5
|
| 67 |
+
// your-package/package.json
|
| 68 |
+
|
| 69 |
+
{
|
| 70 |
+
// ...
|
| 71 |
+
"scarfSettings": {
|
| 72 |
+
"allowTopLevel": true
|
| 73 |
+
}
|
| 74 |
+
// ...
|
| 75 |
+
}
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
#### Full Configuration Example
|
| 80 |
+
|
| 81 |
+
```json5
|
| 82 |
+
// your-package/package.json
|
| 83 |
+
|
| 84 |
+
{
|
| 85 |
+
// ...
|
| 86 |
+
"scarfSettings": {
|
| 87 |
+
// Toggles whether Scarf is enabled for this package
|
| 88 |
+
"enabled": true,
|
| 89 |
+
// Enables Scarf when users run npm install directly in your repository
|
| 90 |
+
// Scarf will try to report the Git commit SHA of your repository if it can
|
| 91 |
+
// be obtained.
|
| 92 |
+
"allowTopLevel": true,
|
| 93 |
+
// Users will be opted into analytics by default
|
| 94 |
+
"defaultOptIn": true,
|
| 95 |
+
// By default, Scarf searches for its own location in your build's dependency
|
| 96 |
+
// graph to ensure reporting can be done for all packages using Scarf.
|
| 97 |
+
// For large projects with lots of dependencies, generating that dependency
|
| 98 |
+
// graph takes more time than Scarf allots for its entire process, so Scarf
|
| 99 |
+
// will always time out. `skipTraversal` is an optional flag for large
|
| 100 |
+
// applications to skip that traversal entirely. Use this flag with caution and
|
| 101 |
+
// care, as it will break Scarf analytics for all other packages you depend
|
| 102 |
+
// on in your build.
|
| 103 |
+
"skipTraversal": false
|
| 104 |
+
}
|
| 105 |
+
// ...
|
| 106 |
+
}
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
### FAQ
|
| 110 |
+
|
| 111 |
+
#### What information does scarf-js provide me as a package author?
|
| 112 |
+
|
| 113 |
+
- Understanding your user-base
|
| 114 |
+
- Which companies are using your package?
|
| 115 |
+
- Is your project growing or shrinking? Where? On which platforms?
|
| 116 |
+
- Which versions of your package are being used?
|
| 117 |
+
|
| 118 |
+
#### As a user of a package using scarf-js, what information does scarf-js send about me?
|
| 119 |
+
|
| 120 |
+
*Scarf does not store personally identifying information.* Scarf aims to collect information that is helpful for:
|
| 121 |
+
- Open Source package maintainence
|
| 122 |
+
- Open Source commercialization
|
| 123 |
+
|
| 124 |
+
Specifically, scarf-js sends:
|
| 125 |
+
|
| 126 |
+
- The operating system you are using
|
| 127 |
+
- Your IP address will be used to look up any available company information. _Scarf does not store the actual IP address_
|
| 128 |
+
- Limited dependency tree information. Scarf sends the name and version of the package(s) that directly depend on scarf-js. Additionally, scarf-js will send SHA256-hashed name and version for the following packages in the dependency tree:
|
| 129 |
+
- Packages that depend on a package that depends on scarf-js.
|
| 130 |
+
- The root package of the dependency tree.
|
| 131 |
+
This allows Scarf to provide information for maintainers about which public packages are using their own, without exposing identifying details of non-public packages.
|
| 132 |
+
|
| 133 |
+
You can have scarf-js print the exact JSON payload it sends by setting `SCARF_VERBOSE=true` in your environment.
|
| 134 |
+
|
| 135 |
+
#### As a user of a package using scarf-js, how can I opt out of analytics?
|
| 136 |
+
|
| 137 |
+
Scarf's analytics help support developers of the open source packages you are
|
| 138 |
+
using, so enabling analytics is appreciated. However, if you'd like to opt out,
|
| 139 |
+
you can add your preference to your project's `package.json`:
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
```json5
|
| 143 |
+
// your-package/package.json
|
| 144 |
+
|
| 145 |
+
{
|
| 146 |
+
// ...
|
| 147 |
+
"scarfSettings": {
|
| 148 |
+
"enabled": false
|
| 149 |
+
}
|
| 150 |
+
// ...
|
| 151 |
+
}
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
Alternatively, you can set this variable in your environment:
|
| 155 |
+
|
| 156 |
+
```shell
|
| 157 |
+
export SCARF_ANALYTICS=false
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
You can also set this variable in accordance to the [Console Do Not Track](https://consoledonottrack.com/) standard:
|
| 161 |
+
```shell
|
| 162 |
+
export DO_NOT_TRACK=1
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
Either route will disable Scarf for all packages.
|
| 166 |
+
|
| 167 |
+
#### I distribute a package on npm, and scarf-js is in our dependency tree. Can I disable the analytics for my downstream dependents?
|
| 168 |
+
|
| 169 |
+
Yes. By opting out of analytics via `package.json`, any package upstream will have analytics disbabled.
|
| 170 |
+
|
| 171 |
+
```json5
|
| 172 |
+
// your-package/package.json
|
| 173 |
+
|
| 174 |
+
{
|
| 175 |
+
// ...
|
| 176 |
+
"scarfSettings": {
|
| 177 |
+
"enabled": false
|
| 178 |
+
}
|
| 179 |
+
// ...
|
| 180 |
+
}
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
Installers of your packages will have scarf-js disabled for all dependencies upstream from yours.
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
### Developing
|
| 187 |
+
|
| 188 |
+
Setting the environment variable `SCARF_LOCAL_PORT=8080` will configure Scarf to
|
| 189 |
+
use http://localhost:8080 as the analytics endpoint host.
|
| 190 |
+
|
| 191 |
+
### Future work
|
| 192 |
+
|
| 193 |
+
Future releases of scarf-js will provide a module of utility functions to
|
| 194 |
+
collect usage analytics in addition to the current installation analytics.
|
| 195 |
+
|
| 196 |
+
### Community
|
| 197 |
+
|
| 198 |
+
Join the [Scarf-Community workspace](https://tinyurl.com/scarf-community-slack) on Slack and find us in the #scarf-js channel. We'll keep an eye out for your questions and concerns.
|
node_modules/@scarf/scarf/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@scarf/scarf",
|
| 3 |
+
"version": "1.4.0",
|
| 4 |
+
"description": "Scarf is like Google Analytics for your npm packages. Gain insights into how your packages are installed and used, and by which companies.",
|
| 5 |
+
"main": "report.js",
|
| 6 |
+
"homepage": "https://github.com/scarf-sh/scarf-js",
|
| 7 |
+
"repository": {
|
| 8 |
+
"type": "git",
|
| 9 |
+
"url": "git+https://github.com/scarf-sh/scarf-js.git"
|
| 10 |
+
},
|
| 11 |
+
"files": [
|
| 12 |
+
"report.js"
|
| 13 |
+
],
|
| 14 |
+
"scripts": {
|
| 15 |
+
"postinstall": "node ./report.js",
|
| 16 |
+
"test": "jest --verbose"
|
| 17 |
+
},
|
| 18 |
+
"author": "Scarf Systems",
|
| 19 |
+
"license": "Apache-2.0",
|
| 20 |
+
"devDependencies": {
|
| 21 |
+
"jest": "^25.3.0",
|
| 22 |
+
"minimist": "^1.2.2",
|
| 23 |
+
"standard": "^14.3.1"
|
| 24 |
+
},
|
| 25 |
+
"standard": {
|
| 26 |
+
"globals": [
|
| 27 |
+
"expect",
|
| 28 |
+
"test",
|
| 29 |
+
"jest",
|
| 30 |
+
"beforeAll",
|
| 31 |
+
"afterAll",
|
| 32 |
+
"fail",
|
| 33 |
+
"describe"
|
| 34 |
+
]
|
| 35 |
+
}
|
| 36 |
+
}
|
node_modules/@scarf/scarf/report.js
ADDED
|
@@ -0,0 +1,574 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const path = require('path')
|
| 2 |
+
const os = require('os')
|
| 3 |
+
const exec = require('child_process').exec
|
| 4 |
+
const localDevPort = process.env.SCARF_LOCAL_PORT
|
| 5 |
+
const https = localDevPort ? require('http') : require('https')
|
| 6 |
+
const fs = require('fs')
|
| 7 |
+
const fsAsync = fs.promises
|
| 8 |
+
const util = require('util')
|
| 9 |
+
|
| 10 |
+
const scarfHost = localDevPort ? 'localhost' : 'scarf.sh'
|
| 11 |
+
const scarfLibName = '@scarf/scarf'
|
| 12 |
+
const privatePackageRewrite = '@private/private'
|
| 13 |
+
const privateVersionRewrite = '0'
|
| 14 |
+
|
| 15 |
+
const rootPath = process.env.INIT_CWD
|
| 16 |
+
|
| 17 |
+
// Pulled into a function for test mocking
|
| 18 |
+
function tmpFileName () {
|
| 19 |
+
// throttle per user
|
| 20 |
+
const username = os.userInfo().username
|
| 21 |
+
return path.join(os.tmpdir(), `scarf-js-history-${username}.log`)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// Pulled into a function for test mocking
|
| 25 |
+
function dirName () {
|
| 26 |
+
return __dirname
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function npmExecPath () {
|
| 30 |
+
return process.env.npm_execpath
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
const userMessageThrottleTime = 1000 * 60 // 1 minute
|
| 34 |
+
|
| 35 |
+
const execTimeout = 3000
|
| 36 |
+
|
| 37 |
+
// In general, these keys should never change to remain backwards compatible
|
| 38 |
+
// with previous versions of Scarf. If we need to update them, we'll need to
|
| 39 |
+
// make sure we can read the previous values as well
|
| 40 |
+
const optedInLogRateLimitKey = 'optedInLastLog'
|
| 41 |
+
const optedOutLogRateLimitKey = 'optedOutLastLog'
|
| 42 |
+
|
| 43 |
+
const makeDefaultSettings = () => {
|
| 44 |
+
return {
|
| 45 |
+
defaultOptIn: true
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
function logIfVerbose (toLog, stream) {
|
| 50 |
+
if (process.env.SCARF_VERBOSE === 'true') {
|
| 51 |
+
(stream || console.log)(toLog)
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// SCARF_NO_ANALYTICS was the original variable, we'll get rid of it eventually
|
| 56 |
+
const userHasOptedOut = (rootPackage) => {
|
| 57 |
+
return (rootPackage && rootPackage.scarfSettings && rootPackage.scarfSettings.enabled === false) ||
|
| 58 |
+
(process.env.SCARF_ANALYTICS === 'false' || process.env.SCARF_NO_ANALYTICS === 'true' || process.env.DO_NOT_TRACK === '1')
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
const userHasOptedIn = (rootPackage) => {
|
| 62 |
+
return (rootPackage && rootPackage.scarfSettings && rootPackage.scarfSettings.enabled) || process.env.SCARF_ANALYTICS === 'true'
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
// Packages that depend on Scarf can configure whether to should fire when
|
| 66 |
+
// `npm install` is being run directly from within the package, rather than from a
|
| 67 |
+
// dependent package
|
| 68 |
+
function allowTopLevel (rootPackage) {
|
| 69 |
+
return rootPackage && rootPackage.scarfSettings && rootPackage.scarfSettings.allowTopLevel
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
function skipTraversal (rootPackage) {
|
| 73 |
+
return rootPackage && rootPackage.scarfSettings && rootPackage.scarfSettings.skipTraversal
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
function parentIsRoot (dependencyToReport) {
|
| 77 |
+
const parent = dependencyToReport.parent
|
| 78 |
+
const rootPackage = dependencyToReport.rootPackage
|
| 79 |
+
|
| 80 |
+
return parent && rootPackage && parent.name === rootPackage.name && parent.version === rootPackage.version
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
function isTopLevel (dependencyToReport) {
|
| 84 |
+
return parentIsRoot(dependencyToReport) && !process.env.npm_config_global
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
function isGlobal (dependencyToReport) {
|
| 88 |
+
return parentIsRoot(dependencyToReport) && !!process.env.npm_config_global
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
function hashWithDefault (toHash, defaultReturn) {
|
| 92 |
+
let crypto
|
| 93 |
+
try {
|
| 94 |
+
crypto = require('crypto')
|
| 95 |
+
} catch (err) {
|
| 96 |
+
logIfVerbose('node crypto module unavailable')
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
if (crypto && toHash) {
|
| 100 |
+
return crypto.createHash('sha256').update(toHash, 'utf-8').digest('hex')
|
| 101 |
+
} else {
|
| 102 |
+
return defaultReturn
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
// We don't send any paths, hash package names and versions
|
| 107 |
+
function redactSensitivePackageInfo (dependencyInfo) {
|
| 108 |
+
if (dependencyInfo.grandparent && dependencyInfo.grandparent.name) {
|
| 109 |
+
dependencyInfo.grandparent.nameHash = hashWithDefault(dependencyInfo.grandparent.name, privatePackageRewrite)
|
| 110 |
+
dependencyInfo.grandparent.versionHash = hashWithDefault(dependencyInfo.grandparent.version, privateVersionRewrite)
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
if (dependencyInfo.rootPackage && dependencyInfo.rootPackage.name) {
|
| 114 |
+
dependencyInfo.rootPackage.nameHash = hashWithDefault(dependencyInfo.rootPackage.name, privatePackageRewrite)
|
| 115 |
+
dependencyInfo.rootPackage.versionHash = hashWithDefault(dependencyInfo.rootPackage.version, privateVersionRewrite)
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
delete (dependencyInfo.rootPackage.packageJsonPath)
|
| 119 |
+
delete (dependencyInfo.rootPackage.path)
|
| 120 |
+
delete (dependencyInfo.rootPackage.name)
|
| 121 |
+
delete (dependencyInfo.rootPackage.version)
|
| 122 |
+
delete (dependencyInfo.parent.path)
|
| 123 |
+
delete (dependencyInfo.scarf.path)
|
| 124 |
+
if (dependencyInfo.grandparent) {
|
| 125 |
+
delete (dependencyInfo.grandparent.path)
|
| 126 |
+
delete (dependencyInfo.grandparent.name)
|
| 127 |
+
delete (dependencyInfo.grandparent.version)
|
| 128 |
+
}
|
| 129 |
+
return dependencyInfo
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/*
|
| 133 |
+
Scarf-js is automatically disabled when being run inside of a yarn install.
|
| 134 |
+
The `npm_execpath` environment variable tells us which package manager is
|
| 135 |
+
running our install
|
| 136 |
+
*/
|
| 137 |
+
function isYarn () {
|
| 138 |
+
const execPath = module.exports.npmExecPath() || ''
|
| 139 |
+
return ['yarn', 'yarn.js', 'yarnpkg', 'yarn.cmd', 'yarnpkg.cmd']
|
| 140 |
+
.some(packageManBinName => execPath.endsWith(packageManBinName))
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
function processDependencyTreeOutput (resolve, reject) {
|
| 144 |
+
return function (error, stdout, stderr) {
|
| 145 |
+
if (error && !stdout) {
|
| 146 |
+
return reject(new Error(`Scarf received an error from npm -ls: ${error} | ${stderr}`))
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
try {
|
| 150 |
+
const output = JSON.parse(stdout)
|
| 151 |
+
|
| 152 |
+
const depsToScarf = findScarfInFullDependencyTree(output).filter(depChain => depChain.length >= 2)
|
| 153 |
+
if (!depsToScarf.length) {
|
| 154 |
+
return reject(new Error('No Scarf parent package found'))
|
| 155 |
+
}
|
| 156 |
+
const rootPackageDetails = rootPackageDepInfo(output)
|
| 157 |
+
|
| 158 |
+
const dependencyInfo = depsToScarf.map(depChain => {
|
| 159 |
+
return {
|
| 160 |
+
scarf: depChain[depChain.length - 1],
|
| 161 |
+
parent: depChain[depChain.length - 2],
|
| 162 |
+
grandparent: depChain[depChain.length - 3],
|
| 163 |
+
rootPackage: rootPackageDetails,
|
| 164 |
+
anyInChainDisabled: depChain.some(dep => {
|
| 165 |
+
return (dep.scarfSettings || {}).enabled === false
|
| 166 |
+
})
|
| 167 |
+
}
|
| 168 |
+
})
|
| 169 |
+
|
| 170 |
+
dependencyInfo.forEach(d => {
|
| 171 |
+
d.parent.scarfSettings = Object.assign(makeDefaultSettings(), d.parent.scarfSettings || {})
|
| 172 |
+
})
|
| 173 |
+
|
| 174 |
+
// Here, we find the dependency chain that corresponds to the scarf package we're currently in
|
| 175 |
+
const dependencyToReport = dependencyInfo.find(dep => (dep.scarf.path === module.exports.dirName())) || dependencyInfo[0]
|
| 176 |
+
if (!dependencyToReport) {
|
| 177 |
+
return reject(new Error(`Couldn't find dependency info for path ${module.exports.dirName()}`))
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// If any intermediate dependency in the chain of deps that leads to scarf
|
| 181 |
+
// has disabled Scarf, we must respect that setting unless the user overrides it.
|
| 182 |
+
if (dependencyToReport.anyInChainDisabled && !userHasOptedIn(dependencyToReport.rootPackage)) {
|
| 183 |
+
return reject(new Error('Scarf has been disabled via a package.json in the dependency chain.'))
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
if (isTopLevel(dependencyToReport) && !isGlobal(dependencyToReport) && !allowTopLevel(rootPackageDetails)) {
|
| 187 |
+
return reject(new Error('The package depending on Scarf is the root package being installed, but Scarf is not configured to run in this case. To enable it, set `scarfSettings.allowTopLevel = true` in your package.json'))
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
return resolve(dependencyToReport)
|
| 191 |
+
} catch (err) {
|
| 192 |
+
logIfVerbose(err, console.error)
|
| 193 |
+
return reject(err)
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
function processGitRevParseOutput (resolve, reject) {
|
| 199 |
+
return function (error, stdout, stderr) {
|
| 200 |
+
if (error && !stdout) {
|
| 201 |
+
return reject(new Error(`Scarf received an error from git rev-parse: ${error} | ${stderr}`))
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
const output = String(stdout).trim()
|
| 205 |
+
|
| 206 |
+
if (output.length > 0) {
|
| 207 |
+
return resolve(output)
|
| 208 |
+
} else {
|
| 209 |
+
return reject(new Error('Scarf did not receive usable output from git rev-parse'))
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// packageJSONOverride: a test convenience to set a packageJSON explicitly.
|
| 215 |
+
// Leave empty to use the actual root package.json.
|
| 216 |
+
async function getDependencyInfo (packageJSONOverride) {
|
| 217 |
+
try {
|
| 218 |
+
const rootPackageJSON = require(packageJSONOverride || path.join(rootPath, 'package.json'))
|
| 219 |
+
const scarfPackageJSON = require(path.join(dirName(), 'package.json'))
|
| 220 |
+
|
| 221 |
+
if (skipTraversal(rootPackageJSON)) {
|
| 222 |
+
logIfVerbose('skipping dependency tree traversal')
|
| 223 |
+
const rootInfoToReport = {
|
| 224 |
+
name: rootPackageJSON.name,
|
| 225 |
+
version: rootPackageJSON.version,
|
| 226 |
+
scarfSettings: { ...makeDefaultSettings(), ...rootPackageJSON.scarfSettings }
|
| 227 |
+
}
|
| 228 |
+
const shallowDepInfo = {
|
| 229 |
+
scarf: { name: '@scarf/scarf', version: scarfPackageJSON.version },
|
| 230 |
+
parent: { ...rootInfoToReport },
|
| 231 |
+
rootPackage: { ...rootInfoToReport },
|
| 232 |
+
anyInChainDisabled: false,
|
| 233 |
+
skippedTraversal: true
|
| 234 |
+
}
|
| 235 |
+
logIfVerbose(util.inspect(shallowDepInfo))
|
| 236 |
+
return shallowDepInfo
|
| 237 |
+
}
|
| 238 |
+
} catch (err) {
|
| 239 |
+
logIfVerbose(err, console.error)
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
return new Promise((resolve, reject) => {
|
| 243 |
+
exec(`cd ${rootPath} && npm ls @scarf/scarf --json --long`, { timeout: execTimeout, maxBuffer: 1024 * 1024 * 1024 }, processDependencyTreeOutput(resolve, reject))
|
| 244 |
+
})
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
async function getGitShaFromRootPath () {
|
| 248 |
+
const promise = new Promise((resolve, reject) => {
|
| 249 |
+
exec(`cd ${rootPath} && git rev-parse HEAD`, { timeout: execTimeout, maxBuffer: 1024 * 1024 * 1024 }, processGitRevParseOutput(resolve, reject))
|
| 250 |
+
})
|
| 251 |
+
try {
|
| 252 |
+
return await promise
|
| 253 |
+
} catch (e) {
|
| 254 |
+
logIfVerbose(e)
|
| 255 |
+
return undefined
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
async function reportPostInstall () {
|
| 260 |
+
const scarfApiToken = process.env.SCARF_API_TOKEN
|
| 261 |
+
|
| 262 |
+
const dependencyInfo = await module.exports.getDependencyInfo()
|
| 263 |
+
logIfVerbose(dependencyInfo)
|
| 264 |
+
if (!dependencyInfo.parent || !dependencyInfo.parent.name) {
|
| 265 |
+
return Promise.reject(new Error('No parent found, nothing to report'))
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
if (parentIsRoot(dependencyInfo) && allowTopLevel(dependencyInfo.rootPackage)) {
|
| 269 |
+
const gitSha = await getGitShaFromRootPath()
|
| 270 |
+
logIfVerbose(`Injecting sha to parent: ${gitSha}`)
|
| 271 |
+
dependencyInfo.parent.gitSha = gitSha
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
const rootPackage = dependencyInfo.rootPackage
|
| 275 |
+
|
| 276 |
+
if (!userHasOptedIn(rootPackage) && isYarn()) {
|
| 277 |
+
return Promise.reject(new Error('Package manager is yarn. scarf-js is unable to inform user of analytics. Aborting.'))
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
await new Promise((resolve, reject) => {
|
| 281 |
+
if (dependencyInfo.parent.scarfSettings.defaultOptIn) {
|
| 282 |
+
if (userHasOptedOut(rootPackage)) {
|
| 283 |
+
return reject(new Error('User has opted out'))
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
if (!userHasOptedIn(rootPackage)) {
|
| 287 |
+
rateLimitedUserLog(optedInLogRateLimitKey, `
|
| 288 |
+
The dependency '${dependencyInfo.parent.name}' is tracking installation
|
| 289 |
+
statistics using scarf-js (https://scarf.sh), which helps open-source developers
|
| 290 |
+
fund and maintain their projects. Scarf securely logs basic installation
|
| 291 |
+
details when this package is installed. The Scarf npm library is open source
|
| 292 |
+
and permissively licensed at https://github.com/scarf-sh/scarf-js. For more
|
| 293 |
+
details about your project's dependencies, try running 'npm ls'. To opt out of
|
| 294 |
+
analytics, set the environment variable 'SCARF_ANALYTICS=false'.
|
| 295 |
+
`)
|
| 296 |
+
}
|
| 297 |
+
resolve(dependencyInfo)
|
| 298 |
+
} else {
|
| 299 |
+
if (!userHasOptedIn(rootPackage)) {
|
| 300 |
+
if (!userHasOptedOut(rootPackage)) {
|
| 301 |
+
// We'll only print the 'please opt in' text if the user hasn't
|
| 302 |
+
// already opted out, and our logging rate limit hasn't been reached
|
| 303 |
+
if (hasHitRateLimit(optedOutLogRateLimitKey, getRateLimitedLogHistory())) {
|
| 304 |
+
return reject(new Error('Analytics are opt-out by default, but rate limit already hit for prompting opt-in.'))
|
| 305 |
+
}
|
| 306 |
+
rateLimitedUserLog(optedOutLogRateLimitKey, `
|
| 307 |
+
The dependency '${dependencyInfo.parent.name}' would like to track
|
| 308 |
+
installation statistics using scarf-js (https://scarf.sh), which helps
|
| 309 |
+
open-source developers fund and maintain their projects. Reporting is disabled
|
| 310 |
+
by default for this package. When enabled, Scarf securely logs basic
|
| 311 |
+
installation details when this package is installed. The Scarf npm library is
|
| 312 |
+
open source and permissively licensed at https://github.com/scarf-sh/scarf-js.
|
| 313 |
+
For more details about your project's dependencies, try running 'npm ls'.
|
| 314 |
+
`
|
| 315 |
+
)
|
| 316 |
+
const stdin = process.stdin
|
| 317 |
+
stdin.setEncoding('utf-8')
|
| 318 |
+
|
| 319 |
+
process.stdout.write(`Would you like to support ${dependencyInfo.parent.name} by sending analytics for this install? (y/N): `)
|
| 320 |
+
|
| 321 |
+
const timeout1 = setTimeout(() => {
|
| 322 |
+
console.log('')
|
| 323 |
+
console.log('No opt in received, skipping analytics')
|
| 324 |
+
reject(new Error('Timeout waiting for user opt in'))
|
| 325 |
+
}, 7000)
|
| 326 |
+
|
| 327 |
+
stdin.on('data', async function (data) {
|
| 328 |
+
clearTimeout(timeout1)
|
| 329 |
+
const enabled = data.trim().toLowerCase() === 'y'
|
| 330 |
+
|
| 331 |
+
const afterUserInput = (enabled, saved) => {
|
| 332 |
+
if (enabled) {
|
| 333 |
+
console.log('Thanks for enabling analytics!')
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
if (!saved) {
|
| 337 |
+
console.log('To prevent this message in the future, you can also set the `SCARF_ANALYTICS=true|false` environment variable')
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
if (enabled) {
|
| 341 |
+
return resolve(dependencyInfo)
|
| 342 |
+
} else {
|
| 343 |
+
return reject(new Error('Not enabled via cli'))
|
| 344 |
+
}
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
process.stdout.write('Save this preference to your project\'s package.json file? (y/N): ')
|
| 348 |
+
|
| 349 |
+
setTimeout(() => {
|
| 350 |
+
console.log('')
|
| 351 |
+
return afterUserInput(enabled, false)
|
| 352 |
+
}, 15000)
|
| 353 |
+
|
| 354 |
+
stdin.removeAllListeners('data')
|
| 355 |
+
stdin.on('data', async function (data) {
|
| 356 |
+
try {
|
| 357 |
+
const savePreference = data.trim().toLowerCase() === 'y'
|
| 358 |
+
if (savePreference) {
|
| 359 |
+
await savePreferencesToRootPackage(dependencyInfo.rootPackage.packageJsonPath, enabled)
|
| 360 |
+
}
|
| 361 |
+
return afterUserInput(enabled, savePreference)
|
| 362 |
+
} catch (err) {
|
| 363 |
+
logIfVerbose(err, console.error)
|
| 364 |
+
return reject(err)
|
| 365 |
+
}
|
| 366 |
+
})
|
| 367 |
+
})
|
| 368 |
+
}
|
| 369 |
+
} else {
|
| 370 |
+
resolve(dependencyInfo)
|
| 371 |
+
}
|
| 372 |
+
}
|
| 373 |
+
})
|
| 374 |
+
|
| 375 |
+
redactSensitivePackageInfo(dependencyInfo)
|
| 376 |
+
|
| 377 |
+
const infoPayload = {
|
| 378 |
+
libraryType: 'npm',
|
| 379 |
+
rawPlatform: os.platform(),
|
| 380 |
+
rawArch: os.arch(),
|
| 381 |
+
nodeVersion: process.versions.node,
|
| 382 |
+
dependencyInfo: dependencyInfo
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
const data = JSON.stringify(infoPayload)
|
| 386 |
+
logIfVerbose(`Scarf payload: ${data}`)
|
| 387 |
+
|
| 388 |
+
const reqOptions = {
|
| 389 |
+
host: scarfHost,
|
| 390 |
+
port: localDevPort,
|
| 391 |
+
method: 'POST',
|
| 392 |
+
path: '/package-event/install',
|
| 393 |
+
headers: {
|
| 394 |
+
'Content-Type': 'application/json',
|
| 395 |
+
'Content-Length': data.length
|
| 396 |
+
},
|
| 397 |
+
timeout: execTimeout
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
if (scarfApiToken) {
|
| 401 |
+
const authToken = Buffer.from(`n/a:${scarfApiToken}`).toString('base64')
|
| 402 |
+
reqOptions.headers.Authorization = `Basic ${authToken}`
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
await new Promise((resolve, reject) => {
|
| 406 |
+
const req = https.request(reqOptions, (res) => {
|
| 407 |
+
logIfVerbose(`Response status: ${res.statusCode}`)
|
| 408 |
+
resolve()
|
| 409 |
+
})
|
| 410 |
+
|
| 411 |
+
req.on('error', error => {
|
| 412 |
+
logIfVerbose(error, console.error)
|
| 413 |
+
reject(error)
|
| 414 |
+
})
|
| 415 |
+
|
| 416 |
+
req.on('timeout', error => {
|
| 417 |
+
logIfVerbose(error, console.error)
|
| 418 |
+
reject(error)
|
| 419 |
+
})
|
| 420 |
+
|
| 421 |
+
req.write(data)
|
| 422 |
+
req.end()
|
| 423 |
+
})
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
// Find all paths to Scarf from the json output of npm ls @scarf/scarf --json in
|
| 427 |
+
// the root package being installed by the user
|
| 428 |
+
//
|
| 429 |
+
// [{
|
| 430 |
+
// scarf: {name: `@scarf/scarf`, version: '0.0.1'},
|
| 431 |
+
// parent: { name: 'scarfed-library', version: '1.0.0', scarfSettings: { defaultOptIn: true } },
|
| 432 |
+
// grandparent: { name: 'scarfed-lib-consumer', version: '1.0.0' }
|
| 433 |
+
// }]
|
| 434 |
+
function findScarfInSubDepTree (pathToDep, deps) {
|
| 435 |
+
const depNames = Object.keys(deps || {})
|
| 436 |
+
|
| 437 |
+
if (!depNames) {
|
| 438 |
+
return []
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
const scarfFound = depNames.find(depName => depName === scarfLibName)
|
| 442 |
+
const output = []
|
| 443 |
+
if (scarfFound) {
|
| 444 |
+
output.push(pathToDep.concat([{ name: scarfLibName, version: deps[scarfLibName].version, path: deps[scarfLibName].path }]))
|
| 445 |
+
}
|
| 446 |
+
for (let i = 0; i < depNames.length; i++) {
|
| 447 |
+
const depName = depNames[i]
|
| 448 |
+
const newPathToDep = pathToDep.concat([
|
| 449 |
+
{
|
| 450 |
+
name: depName,
|
| 451 |
+
version: deps[depName].version,
|
| 452 |
+
scarfSettings: deps[depName].scarfSettings,
|
| 453 |
+
path: deps[depName].path
|
| 454 |
+
}
|
| 455 |
+
])
|
| 456 |
+
const results = findScarfInSubDepTree(newPathToDep, deps[depName].dependencies)
|
| 457 |
+
if (results) {
|
| 458 |
+
for (let j = 0; j < results.length; j++) {
|
| 459 |
+
output.push(results[j])
|
| 460 |
+
}
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
return output
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
function findScarfInFullDependencyTree (tree) {
|
| 468 |
+
if (tree.name === scarfLibName) {
|
| 469 |
+
return [[{ name: scarfLibName, version: tree.version }]]
|
| 470 |
+
} else {
|
| 471 |
+
return findScarfInSubDepTree([packageDetailsFromDepInfo(tree)], tree.dependencies)
|
| 472 |
+
}
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
function packageDetailsFromDepInfo (tree) {
|
| 476 |
+
return {
|
| 477 |
+
name: tree.name,
|
| 478 |
+
version: tree.version,
|
| 479 |
+
scarfSettings: tree.scarfSettings,
|
| 480 |
+
path: tree.path
|
| 481 |
+
}
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
function rootPackageDepInfo (packageInfo) {
|
| 485 |
+
if (process.env.npm_config_global) {
|
| 486 |
+
packageInfo = Object.values(packageInfo.dependencies)[0]
|
| 487 |
+
}
|
| 488 |
+
const info = packageDetailsFromDepInfo(packageInfo)
|
| 489 |
+
info.packageJsonPath = `${packageInfo.path}/package.json`
|
| 490 |
+
return info
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
async function savePreferencesToRootPackage (path, optIn) {
|
| 494 |
+
const packageJsonString = await fsAsync.readFile(path)
|
| 495 |
+
const parsed = JSON.parse(packageJsonString)
|
| 496 |
+
parsed.scarfSettings = {
|
| 497 |
+
enabled: optIn
|
| 498 |
+
}
|
| 499 |
+
await fsAsync.writeFile(path, JSON.stringify(parsed, null, 2))
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
/*
|
| 503 |
+
If Scarf-js appears in many different spots in a package's dependency tree, we
|
| 504 |
+
want to avoid spamming the user with the same message informing them of
|
| 505 |
+
Scarf's analytics. Rate limited logs will record timestamps of logging in a
|
| 506 |
+
temp file. Before logging something to the user, we will verify we're not over
|
| 507 |
+
the rate limit.
|
| 508 |
+
*/
|
| 509 |
+
function rateLimitedUserLog (rateLimitKey, toLog) {
|
| 510 |
+
const history = getRateLimitedLogHistory()
|
| 511 |
+
if (!hasHitRateLimit(rateLimitKey, history)) {
|
| 512 |
+
writeCurrentTimeToLogHistory(rateLimitKey, history)
|
| 513 |
+
console.log(toLog)
|
| 514 |
+
} else {
|
| 515 |
+
logIfVerbose(`[SUPPRESSED USER MESSAGE, RATE LIMIT HIT] ${toLog}`)
|
| 516 |
+
}
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
function getRateLimitedLogHistory () {
|
| 520 |
+
let history
|
| 521 |
+
try {
|
| 522 |
+
history = JSON.parse(fs.readFileSync(module.exports.tmpFileName()))
|
| 523 |
+
} catch (e) {
|
| 524 |
+
logIfVerbose(e)
|
| 525 |
+
}
|
| 526 |
+
return history || {}
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
// Current rate limit: 1/minute
|
| 530 |
+
function hasHitRateLimit (rateLimitKey, history) {
|
| 531 |
+
if (!history || !history[rateLimitKey]) {
|
| 532 |
+
return false
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
const lastLog = history[rateLimitKey]
|
| 536 |
+
return (new Date().getTime() - lastLog) < userMessageThrottleTime
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
function writeCurrentTimeToLogHistory (rateLimitKey, history) {
|
| 540 |
+
history[rateLimitKey] = new Date().getTime()
|
| 541 |
+
fs.writeFileSync(module.exports.tmpFileName(), JSON.stringify(history))
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
module.exports = {
|
| 545 |
+
redactSensitivePackageInfo,
|
| 546 |
+
hasHitRateLimit,
|
| 547 |
+
getRateLimitedLogHistory,
|
| 548 |
+
rateLimitedUserLog,
|
| 549 |
+
tmpFileName,
|
| 550 |
+
dirName,
|
| 551 |
+
processDependencyTreeOutput,
|
| 552 |
+
processGitRevParseOutput,
|
| 553 |
+
npmExecPath,
|
| 554 |
+
getDependencyInfo,
|
| 555 |
+
getGitShaFromRootPath,
|
| 556 |
+
reportPostInstall,
|
| 557 |
+
hashWithDefault,
|
| 558 |
+
findScarfInFullDependencyTree
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
if (require.main === module) {
|
| 562 |
+
try {
|
| 563 |
+
reportPostInstall().catch(e => {
|
| 564 |
+
// This is an optional, best effort attempt. If there are any errors in
|
| 565 |
+
// Scarf, we must not interfere with whatever the user is doing
|
| 566 |
+
logIfVerbose(`\n\n${e}`, console.error)
|
| 567 |
+
}).finally(() => {
|
| 568 |
+
process.exit(0)
|
| 569 |
+
})
|
| 570 |
+
} catch (e) {
|
| 571 |
+
logIfVerbose(`\n\nTop level error: ${e}`, console.error)
|
| 572 |
+
process.exit(0)
|
| 573 |
+
}
|
| 574 |
+
}
|
node_modules/accepts/HISTORY.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1.3.8 / 2022-02-02
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* deps: mime-types@~2.1.34
|
| 5 |
+
- deps: mime-db@~1.51.0
|
| 6 |
+
* deps: negotiator@0.6.3
|
| 7 |
+
|
| 8 |
+
1.3.7 / 2019-04-29
|
| 9 |
+
==================
|
| 10 |
+
|
| 11 |
+
* deps: negotiator@0.6.2
|
| 12 |
+
- Fix sorting charset, encoding, and language with extra parameters
|
| 13 |
+
|
| 14 |
+
1.3.6 / 2019-04-28
|
| 15 |
+
==================
|
| 16 |
+
|
| 17 |
+
* deps: mime-types@~2.1.24
|
| 18 |
+
- deps: mime-db@~1.40.0
|
| 19 |
+
|
| 20 |
+
1.3.5 / 2018-02-28
|
| 21 |
+
==================
|
| 22 |
+
|
| 23 |
+
* deps: mime-types@~2.1.18
|
| 24 |
+
- deps: mime-db@~1.33.0
|
| 25 |
+
|
| 26 |
+
1.3.4 / 2017-08-22
|
| 27 |
+
==================
|
| 28 |
+
|
| 29 |
+
* deps: mime-types@~2.1.16
|
| 30 |
+
- deps: mime-db@~1.29.0
|
| 31 |
+
|
| 32 |
+
1.3.3 / 2016-05-02
|
| 33 |
+
==================
|
| 34 |
+
|
| 35 |
+
* deps: mime-types@~2.1.11
|
| 36 |
+
- deps: mime-db@~1.23.0
|
| 37 |
+
* deps: negotiator@0.6.1
|
| 38 |
+
- perf: improve `Accept` parsing speed
|
| 39 |
+
- perf: improve `Accept-Charset` parsing speed
|
| 40 |
+
- perf: improve `Accept-Encoding` parsing speed
|
| 41 |
+
- perf: improve `Accept-Language` parsing speed
|
| 42 |
+
|
| 43 |
+
1.3.2 / 2016-03-08
|
| 44 |
+
==================
|
| 45 |
+
|
| 46 |
+
* deps: mime-types@~2.1.10
|
| 47 |
+
- Fix extension of `application/dash+xml`
|
| 48 |
+
- Update primary extension for `audio/mp4`
|
| 49 |
+
- deps: mime-db@~1.22.0
|
| 50 |
+
|
| 51 |
+
1.3.1 / 2016-01-19
|
| 52 |
+
==================
|
| 53 |
+
|
| 54 |
+
* deps: mime-types@~2.1.9
|
| 55 |
+
- deps: mime-db@~1.21.0
|
| 56 |
+
|
| 57 |
+
1.3.0 / 2015-09-29
|
| 58 |
+
==================
|
| 59 |
+
|
| 60 |
+
* deps: mime-types@~2.1.7
|
| 61 |
+
- deps: mime-db@~1.19.0
|
| 62 |
+
* deps: negotiator@0.6.0
|
| 63 |
+
- Fix including type extensions in parameters in `Accept` parsing
|
| 64 |
+
- Fix parsing `Accept` parameters with quoted equals
|
| 65 |
+
- Fix parsing `Accept` parameters with quoted semicolons
|
| 66 |
+
- Lazy-load modules from main entry point
|
| 67 |
+
- perf: delay type concatenation until needed
|
| 68 |
+
- perf: enable strict mode
|
| 69 |
+
- perf: hoist regular expressions
|
| 70 |
+
- perf: remove closures getting spec properties
|
| 71 |
+
- perf: remove a closure from media type parsing
|
| 72 |
+
- perf: remove property delete from media type parsing
|
| 73 |
+
|
| 74 |
+
1.2.13 / 2015-09-06
|
| 75 |
+
===================
|
| 76 |
+
|
| 77 |
+
* deps: mime-types@~2.1.6
|
| 78 |
+
- deps: mime-db@~1.18.0
|
| 79 |
+
|
| 80 |
+
1.2.12 / 2015-07-30
|
| 81 |
+
===================
|
| 82 |
+
|
| 83 |
+
* deps: mime-types@~2.1.4
|
| 84 |
+
- deps: mime-db@~1.16.0
|
| 85 |
+
|
| 86 |
+
1.2.11 / 2015-07-16
|
| 87 |
+
===================
|
| 88 |
+
|
| 89 |
+
* deps: mime-types@~2.1.3
|
| 90 |
+
- deps: mime-db@~1.15.0
|
| 91 |
+
|
| 92 |
+
1.2.10 / 2015-07-01
|
| 93 |
+
===================
|
| 94 |
+
|
| 95 |
+
* deps: mime-types@~2.1.2
|
| 96 |
+
- deps: mime-db@~1.14.0
|
| 97 |
+
|
| 98 |
+
1.2.9 / 2015-06-08
|
| 99 |
+
==================
|
| 100 |
+
|
| 101 |
+
* deps: mime-types@~2.1.1
|
| 102 |
+
- perf: fix deopt during mapping
|
| 103 |
+
|
| 104 |
+
1.2.8 / 2015-06-07
|
| 105 |
+
==================
|
| 106 |
+
|
| 107 |
+
* deps: mime-types@~2.1.0
|
| 108 |
+
- deps: mime-db@~1.13.0
|
| 109 |
+
* perf: avoid argument reassignment & argument slice
|
| 110 |
+
* perf: avoid negotiator recursive construction
|
| 111 |
+
* perf: enable strict mode
|
| 112 |
+
* perf: remove unnecessary bitwise operator
|
| 113 |
+
|
| 114 |
+
1.2.7 / 2015-05-10
|
| 115 |
+
==================
|
| 116 |
+
|
| 117 |
+
* deps: negotiator@0.5.3
|
| 118 |
+
- Fix media type parameter matching to be case-insensitive
|
| 119 |
+
|
| 120 |
+
1.2.6 / 2015-05-07
|
| 121 |
+
==================
|
| 122 |
+
|
| 123 |
+
* deps: mime-types@~2.0.11
|
| 124 |
+
- deps: mime-db@~1.9.1
|
| 125 |
+
* deps: negotiator@0.5.2
|
| 126 |
+
- Fix comparing media types with quoted values
|
| 127 |
+
- Fix splitting media types with quoted commas
|
| 128 |
+
|
| 129 |
+
1.2.5 / 2015-03-13
|
| 130 |
+
==================
|
| 131 |
+
|
| 132 |
+
* deps: mime-types@~2.0.10
|
| 133 |
+
- deps: mime-db@~1.8.0
|
| 134 |
+
|
| 135 |
+
1.2.4 / 2015-02-14
|
| 136 |
+
==================
|
| 137 |
+
|
| 138 |
+
* Support Node.js 0.6
|
| 139 |
+
* deps: mime-types@~2.0.9
|
| 140 |
+
- deps: mime-db@~1.7.0
|
| 141 |
+
* deps: negotiator@0.5.1
|
| 142 |
+
- Fix preference sorting to be stable for long acceptable lists
|
| 143 |
+
|
| 144 |
+
1.2.3 / 2015-01-31
|
| 145 |
+
==================
|
| 146 |
+
|
| 147 |
+
* deps: mime-types@~2.0.8
|
| 148 |
+
- deps: mime-db@~1.6.0
|
| 149 |
+
|
| 150 |
+
1.2.2 / 2014-12-30
|
| 151 |
+
==================
|
| 152 |
+
|
| 153 |
+
* deps: mime-types@~2.0.7
|
| 154 |
+
- deps: mime-db@~1.5.0
|
| 155 |
+
|
| 156 |
+
1.2.1 / 2014-12-30
|
| 157 |
+
==================
|
| 158 |
+
|
| 159 |
+
* deps: mime-types@~2.0.5
|
| 160 |
+
- deps: mime-db@~1.3.1
|
| 161 |
+
|
| 162 |
+
1.2.0 / 2014-12-19
|
| 163 |
+
==================
|
| 164 |
+
|
| 165 |
+
* deps: negotiator@0.5.0
|
| 166 |
+
- Fix list return order when large accepted list
|
| 167 |
+
- Fix missing identity encoding when q=0 exists
|
| 168 |
+
- Remove dynamic building of Negotiator class
|
| 169 |
+
|
| 170 |
+
1.1.4 / 2014-12-10
|
| 171 |
+
==================
|
| 172 |
+
|
| 173 |
+
* deps: mime-types@~2.0.4
|
| 174 |
+
- deps: mime-db@~1.3.0
|
| 175 |
+
|
| 176 |
+
1.1.3 / 2014-11-09
|
| 177 |
+
==================
|
| 178 |
+
|
| 179 |
+
* deps: mime-types@~2.0.3
|
| 180 |
+
- deps: mime-db@~1.2.0
|
| 181 |
+
|
| 182 |
+
1.1.2 / 2014-10-14
|
| 183 |
+
==================
|
| 184 |
+
|
| 185 |
+
* deps: negotiator@0.4.9
|
| 186 |
+
- Fix error when media type has invalid parameter
|
| 187 |
+
|
| 188 |
+
1.1.1 / 2014-09-28
|
| 189 |
+
==================
|
| 190 |
+
|
| 191 |
+
* deps: mime-types@~2.0.2
|
| 192 |
+
- deps: mime-db@~1.1.0
|
| 193 |
+
* deps: negotiator@0.4.8
|
| 194 |
+
- Fix all negotiations to be case-insensitive
|
| 195 |
+
- Stable sort preferences of same quality according to client order
|
| 196 |
+
|
| 197 |
+
1.1.0 / 2014-09-02
|
| 198 |
+
==================
|
| 199 |
+
|
| 200 |
+
* update `mime-types`
|
| 201 |
+
|
| 202 |
+
1.0.7 / 2014-07-04
|
| 203 |
+
==================
|
| 204 |
+
|
| 205 |
+
* Fix wrong type returned from `type` when match after unknown extension
|
| 206 |
+
|
| 207 |
+
1.0.6 / 2014-06-24
|
| 208 |
+
==================
|
| 209 |
+
|
| 210 |
+
* deps: negotiator@0.4.7
|
| 211 |
+
|
| 212 |
+
1.0.5 / 2014-06-20
|
| 213 |
+
==================
|
| 214 |
+
|
| 215 |
+
* fix crash when unknown extension given
|
| 216 |
+
|
| 217 |
+
1.0.4 / 2014-06-19
|
| 218 |
+
==================
|
| 219 |
+
|
| 220 |
+
* use `mime-types`
|
| 221 |
+
|
| 222 |
+
1.0.3 / 2014-06-11
|
| 223 |
+
==================
|
| 224 |
+
|
| 225 |
+
* deps: negotiator@0.4.6
|
| 226 |
+
- Order by specificity when quality is the same
|
| 227 |
+
|
| 228 |
+
1.0.2 / 2014-05-29
|
| 229 |
+
==================
|
| 230 |
+
|
| 231 |
+
* Fix interpretation when header not in request
|
| 232 |
+
* deps: pin negotiator@0.4.5
|
| 233 |
+
|
| 234 |
+
1.0.1 / 2014-01-18
|
| 235 |
+
==================
|
| 236 |
+
|
| 237 |
+
* Identity encoding isn't always acceptable
|
| 238 |
+
* deps: negotiator@~0.4.0
|
| 239 |
+
|
| 240 |
+
1.0.0 / 2013-12-27
|
| 241 |
+
==================
|
| 242 |
+
|
| 243 |
+
* Genesis
|
node_modules/accepts/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
| 4 |
+
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 7 |
+
a copy of this software and associated documentation files (the
|
| 8 |
+
'Software'), to deal in the Software without restriction, including
|
| 9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 12 |
+
the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be
|
| 15 |
+
included in all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 21 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 22 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 23 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/accepts/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# accepts
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-version-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
| 5 |
+
[![Node.js Version][node-version-image]][node-version-url]
|
| 6 |
+
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
| 7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 8 |
+
|
| 9 |
+
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
| 10 |
+
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
| 11 |
+
|
| 12 |
+
In addition to negotiator, it allows:
|
| 13 |
+
|
| 14 |
+
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
| 15 |
+
as well as `('text/html', 'application/json')`.
|
| 16 |
+
- Allows type shorthands such as `json`.
|
| 17 |
+
- Returns `false` when no types match
|
| 18 |
+
- Treats non-existent headers as `*`
|
| 19 |
+
|
| 20 |
+
## Installation
|
| 21 |
+
|
| 22 |
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
| 23 |
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
| 24 |
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
| 25 |
+
|
| 26 |
+
```sh
|
| 27 |
+
$ npm install accepts
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## API
|
| 31 |
+
|
| 32 |
+
```js
|
| 33 |
+
var accepts = require('accepts')
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
### accepts(req)
|
| 37 |
+
|
| 38 |
+
Create a new `Accepts` object for the given `req`.
|
| 39 |
+
|
| 40 |
+
#### .charset(charsets)
|
| 41 |
+
|
| 42 |
+
Return the first accepted charset. If nothing in `charsets` is accepted,
|
| 43 |
+
then `false` is returned.
|
| 44 |
+
|
| 45 |
+
#### .charsets()
|
| 46 |
+
|
| 47 |
+
Return the charsets that the request accepts, in the order of the client's
|
| 48 |
+
preference (most preferred first).
|
| 49 |
+
|
| 50 |
+
#### .encoding(encodings)
|
| 51 |
+
|
| 52 |
+
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
| 53 |
+
then `false` is returned.
|
| 54 |
+
|
| 55 |
+
#### .encodings()
|
| 56 |
+
|
| 57 |
+
Return the encodings that the request accepts, in the order of the client's
|
| 58 |
+
preference (most preferred first).
|
| 59 |
+
|
| 60 |
+
#### .language(languages)
|
| 61 |
+
|
| 62 |
+
Return the first accepted language. If nothing in `languages` is accepted,
|
| 63 |
+
then `false` is returned.
|
| 64 |
+
|
| 65 |
+
#### .languages()
|
| 66 |
+
|
| 67 |
+
Return the languages that the request accepts, in the order of the client's
|
| 68 |
+
preference (most preferred first).
|
| 69 |
+
|
| 70 |
+
#### .type(types)
|
| 71 |
+
|
| 72 |
+
Return the first accepted type (and it is returned as the same text as what
|
| 73 |
+
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
| 74 |
+
is returned.
|
| 75 |
+
|
| 76 |
+
The `types` array can contain full MIME types or file extensions. Any value
|
| 77 |
+
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
| 78 |
+
|
| 79 |
+
#### .types()
|
| 80 |
+
|
| 81 |
+
Return the types that the request accepts, in the order of the client's
|
| 82 |
+
preference (most preferred first).
|
| 83 |
+
|
| 84 |
+
## Examples
|
| 85 |
+
|
| 86 |
+
### Simple type negotiation
|
| 87 |
+
|
| 88 |
+
This simple example shows how to use `accepts` to return a different typed
|
| 89 |
+
respond body based on what the client wants to accept. The server lists it's
|
| 90 |
+
preferences in order and will get back the best match between the client and
|
| 91 |
+
server.
|
| 92 |
+
|
| 93 |
+
```js
|
| 94 |
+
var accepts = require('accepts')
|
| 95 |
+
var http = require('http')
|
| 96 |
+
|
| 97 |
+
function app (req, res) {
|
| 98 |
+
var accept = accepts(req)
|
| 99 |
+
|
| 100 |
+
// the order of this list is significant; should be server preferred order
|
| 101 |
+
switch (accept.type(['json', 'html'])) {
|
| 102 |
+
case 'json':
|
| 103 |
+
res.setHeader('Content-Type', 'application/json')
|
| 104 |
+
res.write('{"hello":"world!"}')
|
| 105 |
+
break
|
| 106 |
+
case 'html':
|
| 107 |
+
res.setHeader('Content-Type', 'text/html')
|
| 108 |
+
res.write('<b>hello, world!</b>')
|
| 109 |
+
break
|
| 110 |
+
default:
|
| 111 |
+
// the fallback is text/plain, so no need to specify it above
|
| 112 |
+
res.setHeader('Content-Type', 'text/plain')
|
| 113 |
+
res.write('hello, world!')
|
| 114 |
+
break
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
res.end()
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
http.createServer(app).listen(3000)
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
You can test this out with the cURL program:
|
| 124 |
+
```sh
|
| 125 |
+
curl -I -H'Accept: text/html' http://localhost:3000/
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
## License
|
| 129 |
+
|
| 130 |
+
[MIT](LICENSE)
|
| 131 |
+
|
| 132 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
| 133 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
| 134 |
+
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
| 135 |
+
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
| 136 |
+
[node-version-image]: https://badgen.net/npm/node/accepts
|
| 137 |
+
[node-version-url]: https://nodejs.org/en/download
|
| 138 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
| 139 |
+
[npm-url]: https://npmjs.org/package/accepts
|
| 140 |
+
[npm-version-image]: https://badgen.net/npm/v/accepts
|
node_modules/accepts/index.js
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
+
* Copyright(c) 2014 Jonathan Ong
|
| 4 |
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
| 5 |
+
* MIT Licensed
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
'use strict'
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Module dependencies.
|
| 12 |
+
* @private
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
var Negotiator = require('negotiator')
|
| 16 |
+
var mime = require('mime-types')
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Module exports.
|
| 20 |
+
* @public
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
module.exports = Accepts
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Create a new Accepts object for the given req.
|
| 27 |
+
*
|
| 28 |
+
* @param {object} req
|
| 29 |
+
* @public
|
| 30 |
+
*/
|
| 31 |
+
|
| 32 |
+
function Accepts (req) {
|
| 33 |
+
if (!(this instanceof Accepts)) {
|
| 34 |
+
return new Accepts(req)
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
this.headers = req.headers
|
| 38 |
+
this.negotiator = new Negotiator(req)
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Check if the given `type(s)` is acceptable, returning
|
| 43 |
+
* the best match when true, otherwise `undefined`, in which
|
| 44 |
+
* case you should respond with 406 "Not Acceptable".
|
| 45 |
+
*
|
| 46 |
+
* The `type` value may be a single mime type string
|
| 47 |
+
* such as "application/json", the extension name
|
| 48 |
+
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
| 49 |
+
* or array is given the _best_ match, if any is returned.
|
| 50 |
+
*
|
| 51 |
+
* Examples:
|
| 52 |
+
*
|
| 53 |
+
* // Accept: text/html
|
| 54 |
+
* this.types('html');
|
| 55 |
+
* // => "html"
|
| 56 |
+
*
|
| 57 |
+
* // Accept: text/*, application/json
|
| 58 |
+
* this.types('html');
|
| 59 |
+
* // => "html"
|
| 60 |
+
* this.types('text/html');
|
| 61 |
+
* // => "text/html"
|
| 62 |
+
* this.types('json', 'text');
|
| 63 |
+
* // => "json"
|
| 64 |
+
* this.types('application/json');
|
| 65 |
+
* // => "application/json"
|
| 66 |
+
*
|
| 67 |
+
* // Accept: text/*, application/json
|
| 68 |
+
* this.types('image/png');
|
| 69 |
+
* this.types('png');
|
| 70 |
+
* // => undefined
|
| 71 |
+
*
|
| 72 |
+
* // Accept: text/*;q=.5, application/json
|
| 73 |
+
* this.types(['html', 'json']);
|
| 74 |
+
* this.types('html', 'json');
|
| 75 |
+
* // => "json"
|
| 76 |
+
*
|
| 77 |
+
* @param {String|Array} types...
|
| 78 |
+
* @return {String|Array|Boolean}
|
| 79 |
+
* @public
|
| 80 |
+
*/
|
| 81 |
+
|
| 82 |
+
Accepts.prototype.type =
|
| 83 |
+
Accepts.prototype.types = function (types_) {
|
| 84 |
+
var types = types_
|
| 85 |
+
|
| 86 |
+
// support flattened arguments
|
| 87 |
+
if (types && !Array.isArray(types)) {
|
| 88 |
+
types = new Array(arguments.length)
|
| 89 |
+
for (var i = 0; i < types.length; i++) {
|
| 90 |
+
types[i] = arguments[i]
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// no types, return all requested types
|
| 95 |
+
if (!types || types.length === 0) {
|
| 96 |
+
return this.negotiator.mediaTypes()
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// no accept header, return first given type
|
| 100 |
+
if (!this.headers.accept) {
|
| 101 |
+
return types[0]
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
var mimes = types.map(extToMime)
|
| 105 |
+
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
| 106 |
+
var first = accepts[0]
|
| 107 |
+
|
| 108 |
+
return first
|
| 109 |
+
? types[mimes.indexOf(first)]
|
| 110 |
+
: false
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/**
|
| 114 |
+
* Return accepted encodings or best fit based on `encodings`.
|
| 115 |
+
*
|
| 116 |
+
* Given `Accept-Encoding: gzip, deflate`
|
| 117 |
+
* an array sorted by quality is returned:
|
| 118 |
+
*
|
| 119 |
+
* ['gzip', 'deflate']
|
| 120 |
+
*
|
| 121 |
+
* @param {String|Array} encodings...
|
| 122 |
+
* @return {String|Array}
|
| 123 |
+
* @public
|
| 124 |
+
*/
|
| 125 |
+
|
| 126 |
+
Accepts.prototype.encoding =
|
| 127 |
+
Accepts.prototype.encodings = function (encodings_) {
|
| 128 |
+
var encodings = encodings_
|
| 129 |
+
|
| 130 |
+
// support flattened arguments
|
| 131 |
+
if (encodings && !Array.isArray(encodings)) {
|
| 132 |
+
encodings = new Array(arguments.length)
|
| 133 |
+
for (var i = 0; i < encodings.length; i++) {
|
| 134 |
+
encodings[i] = arguments[i]
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// no encodings, return all requested encodings
|
| 139 |
+
if (!encodings || encodings.length === 0) {
|
| 140 |
+
return this.negotiator.encodings()
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
return this.negotiator.encodings(encodings)[0] || false
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* Return accepted charsets or best fit based on `charsets`.
|
| 148 |
+
*
|
| 149 |
+
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
| 150 |
+
* an array sorted by quality is returned:
|
| 151 |
+
*
|
| 152 |
+
* ['utf-8', 'utf-7', 'iso-8859-1']
|
| 153 |
+
*
|
| 154 |
+
* @param {String|Array} charsets...
|
| 155 |
+
* @return {String|Array}
|
| 156 |
+
* @public
|
| 157 |
+
*/
|
| 158 |
+
|
| 159 |
+
Accepts.prototype.charset =
|
| 160 |
+
Accepts.prototype.charsets = function (charsets_) {
|
| 161 |
+
var charsets = charsets_
|
| 162 |
+
|
| 163 |
+
// support flattened arguments
|
| 164 |
+
if (charsets && !Array.isArray(charsets)) {
|
| 165 |
+
charsets = new Array(arguments.length)
|
| 166 |
+
for (var i = 0; i < charsets.length; i++) {
|
| 167 |
+
charsets[i] = arguments[i]
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
// no charsets, return all requested charsets
|
| 172 |
+
if (!charsets || charsets.length === 0) {
|
| 173 |
+
return this.negotiator.charsets()
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
return this.negotiator.charsets(charsets)[0] || false
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* Return accepted languages or best fit based on `langs`.
|
| 181 |
+
*
|
| 182 |
+
* Given `Accept-Language: en;q=0.8, es, pt`
|
| 183 |
+
* an array sorted by quality is returned:
|
| 184 |
+
*
|
| 185 |
+
* ['es', 'pt', 'en']
|
| 186 |
+
*
|
| 187 |
+
* @param {String|Array} langs...
|
| 188 |
+
* @return {Array|String}
|
| 189 |
+
* @public
|
| 190 |
+
*/
|
| 191 |
+
|
| 192 |
+
Accepts.prototype.lang =
|
| 193 |
+
Accepts.prototype.langs =
|
| 194 |
+
Accepts.prototype.language =
|
| 195 |
+
Accepts.prototype.languages = function (languages_) {
|
| 196 |
+
var languages = languages_
|
| 197 |
+
|
| 198 |
+
// support flattened arguments
|
| 199 |
+
if (languages && !Array.isArray(languages)) {
|
| 200 |
+
languages = new Array(arguments.length)
|
| 201 |
+
for (var i = 0; i < languages.length; i++) {
|
| 202 |
+
languages[i] = arguments[i]
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// no languages, return all requested languages
|
| 207 |
+
if (!languages || languages.length === 0) {
|
| 208 |
+
return this.negotiator.languages()
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
return this.negotiator.languages(languages)[0] || false
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* Convert extnames to mime.
|
| 216 |
+
*
|
| 217 |
+
* @param {String} type
|
| 218 |
+
* @return {String}
|
| 219 |
+
* @private
|
| 220 |
+
*/
|
| 221 |
+
|
| 222 |
+
function extToMime (type) {
|
| 223 |
+
return type.indexOf('/') === -1
|
| 224 |
+
? mime.lookup(type)
|
| 225 |
+
: type
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* Check if mime is valid.
|
| 230 |
+
*
|
| 231 |
+
* @param {String} type
|
| 232 |
+
* @return {String}
|
| 233 |
+
* @private
|
| 234 |
+
*/
|
| 235 |
+
|
| 236 |
+
function validMime (type) {
|
| 237 |
+
return typeof type === 'string'
|
| 238 |
+
}
|
node_modules/accepts/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "accepts",
|
| 3 |
+
"description": "Higher-level content negotiation",
|
| 4 |
+
"version": "1.3.8",
|
| 5 |
+
"contributors": [
|
| 6 |
+
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
| 7 |
+
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
| 8 |
+
],
|
| 9 |
+
"license": "MIT",
|
| 10 |
+
"repository": "jshttp/accepts",
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"mime-types": "~2.1.34",
|
| 13 |
+
"negotiator": "0.6.3"
|
| 14 |
+
},
|
| 15 |
+
"devDependencies": {
|
| 16 |
+
"deep-equal": "1.0.1",
|
| 17 |
+
"eslint": "7.32.0",
|
| 18 |
+
"eslint-config-standard": "14.1.1",
|
| 19 |
+
"eslint-plugin-import": "2.25.4",
|
| 20 |
+
"eslint-plugin-markdown": "2.2.1",
|
| 21 |
+
"eslint-plugin-node": "11.1.0",
|
| 22 |
+
"eslint-plugin-promise": "4.3.1",
|
| 23 |
+
"eslint-plugin-standard": "4.1.0",
|
| 24 |
+
"mocha": "9.2.0",
|
| 25 |
+
"nyc": "15.1.0"
|
| 26 |
+
},
|
| 27 |
+
"files": [
|
| 28 |
+
"LICENSE",
|
| 29 |
+
"HISTORY.md",
|
| 30 |
+
"index.js"
|
| 31 |
+
],
|
| 32 |
+
"engines": {
|
| 33 |
+
"node": ">= 0.6"
|
| 34 |
+
},
|
| 35 |
+
"scripts": {
|
| 36 |
+
"lint": "eslint .",
|
| 37 |
+
"test": "mocha --reporter spec --check-leaks --bail test/",
|
| 38 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
| 39 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
| 40 |
+
},
|
| 41 |
+
"keywords": [
|
| 42 |
+
"content",
|
| 43 |
+
"negotiation",
|
| 44 |
+
"accept",
|
| 45 |
+
"accepts"
|
| 46 |
+
]
|
| 47 |
+
}
|
node_modules/array-flatten/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
node_modules/array-flatten/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Array Flatten
|
| 2 |
+
|
| 3 |
+
[![NPM version][npm-image]][npm-url]
|
| 4 |
+
[![NPM downloads][downloads-image]][downloads-url]
|
| 5 |
+
[![Build status][travis-image]][travis-url]
|
| 6 |
+
[![Test coverage][coveralls-image]][coveralls-url]
|
| 7 |
+
|
| 8 |
+
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
| 9 |
+
|
| 10 |
+
## Installation
|
| 11 |
+
|
| 12 |
+
```
|
| 13 |
+
npm install array-flatten --save
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
## Usage
|
| 17 |
+
|
| 18 |
+
```javascript
|
| 19 |
+
var flatten = require('array-flatten')
|
| 20 |
+
|
| 21 |
+
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
| 22 |
+
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
| 23 |
+
|
| 24 |
+
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
| 25 |
+
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
| 26 |
+
|
| 27 |
+
(function () {
|
| 28 |
+
flatten(arguments) //=> [1, 2, 3]
|
| 29 |
+
})(1, [2, 3])
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
## License
|
| 33 |
+
|
| 34 |
+
MIT
|
| 35 |
+
|
| 36 |
+
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
| 37 |
+
[npm-url]: https://npmjs.org/package/array-flatten
|
| 38 |
+
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
| 39 |
+
[downloads-url]: https://npmjs.org/package/array-flatten
|
| 40 |
+
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
| 41 |
+
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
| 42 |
+
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
| 43 |
+
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
node_modules/array-flatten/array-flatten.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict'
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Expose `arrayFlatten`.
|
| 5 |
+
*/
|
| 6 |
+
module.exports = arrayFlatten
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* Recursive flatten function with depth.
|
| 10 |
+
*
|
| 11 |
+
* @param {Array} array
|
| 12 |
+
* @param {Array} result
|
| 13 |
+
* @param {Number} depth
|
| 14 |
+
* @return {Array}
|
| 15 |
+
*/
|
| 16 |
+
function flattenWithDepth (array, result, depth) {
|
| 17 |
+
for (var i = 0; i < array.length; i++) {
|
| 18 |
+
var value = array[i]
|
| 19 |
+
|
| 20 |
+
if (depth > 0 && Array.isArray(value)) {
|
| 21 |
+
flattenWithDepth(value, result, depth - 1)
|
| 22 |
+
} else {
|
| 23 |
+
result.push(value)
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
return result
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Recursive flatten function. Omitting depth is slightly faster.
|
| 32 |
+
*
|
| 33 |
+
* @param {Array} array
|
| 34 |
+
* @param {Array} result
|
| 35 |
+
* @return {Array}
|
| 36 |
+
*/
|
| 37 |
+
function flattenForever (array, result) {
|
| 38 |
+
for (var i = 0; i < array.length; i++) {
|
| 39 |
+
var value = array[i]
|
| 40 |
+
|
| 41 |
+
if (Array.isArray(value)) {
|
| 42 |
+
flattenForever(value, result)
|
| 43 |
+
} else {
|
| 44 |
+
result.push(value)
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
return result
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Flatten an array, with the ability to define a depth.
|
| 53 |
+
*
|
| 54 |
+
* @param {Array} array
|
| 55 |
+
* @param {Number} depth
|
| 56 |
+
* @return {Array}
|
| 57 |
+
*/
|
| 58 |
+
function arrayFlatten (array, depth) {
|
| 59 |
+
if (depth == null) {
|
| 60 |
+
return flattenForever(array, [])
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
return flattenWithDepth(array, [], depth)
|
| 64 |
+
}
|
node_modules/array-flatten/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "array-flatten",
|
| 3 |
+
"version": "1.1.1",
|
| 4 |
+
"description": "Flatten an array of nested arrays into a single flat array",
|
| 5 |
+
"main": "array-flatten.js",
|
| 6 |
+
"files": [
|
| 7 |
+
"array-flatten.js",
|
| 8 |
+
"LICENSE"
|
| 9 |
+
],
|
| 10 |
+
"scripts": {
|
| 11 |
+
"test": "istanbul cover _mocha -- -R spec"
|
| 12 |
+
},
|
| 13 |
+
"repository": {
|
| 14 |
+
"type": "git",
|
| 15 |
+
"url": "git://github.com/blakeembrey/array-flatten.git"
|
| 16 |
+
},
|
| 17 |
+
"keywords": [
|
| 18 |
+
"array",
|
| 19 |
+
"flatten",
|
| 20 |
+
"arguments",
|
| 21 |
+
"depth"
|
| 22 |
+
],
|
| 23 |
+
"author": {
|
| 24 |
+
"name": "Blake Embrey",
|
| 25 |
+
"email": "hello@blakeembrey.com",
|
| 26 |
+
"url": "http://blakeembrey.me"
|
| 27 |
+
},
|
| 28 |
+
"license": "MIT",
|
| 29 |
+
"bugs": {
|
| 30 |
+
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
| 31 |
+
},
|
| 32 |
+
"homepage": "https://github.com/blakeembrey/array-flatten",
|
| 33 |
+
"devDependencies": {
|
| 34 |
+
"istanbul": "^0.3.13",
|
| 35 |
+
"mocha": "^2.2.4",
|
| 36 |
+
"pre-commit": "^1.0.7",
|
| 37 |
+
"standard": "^3.7.3"
|
| 38 |
+
}
|
| 39 |
+
}
|
node_modules/body-parser/HISTORY.md
ADDED
|
@@ -0,0 +1,672 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1.20.3 / 2024-09-10
|
| 2 |
+
===================
|
| 3 |
+
|
| 4 |
+
* deps: qs@6.13.0
|
| 5 |
+
* add `depth` option to customize the depth level in the parser
|
| 6 |
+
* IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)
|
| 7 |
+
|
| 8 |
+
1.20.2 / 2023-02-21
|
| 9 |
+
===================
|
| 10 |
+
|
| 11 |
+
* Fix strict json error message on Node.js 19+
|
| 12 |
+
* deps: content-type@~1.0.5
|
| 13 |
+
- perf: skip value escaping when unnecessary
|
| 14 |
+
* deps: raw-body@2.5.2
|
| 15 |
+
|
| 16 |
+
1.20.1 / 2022-10-06
|
| 17 |
+
===================
|
| 18 |
+
|
| 19 |
+
* deps: qs@6.11.0
|
| 20 |
+
* perf: remove unnecessary object clone
|
| 21 |
+
|
| 22 |
+
1.20.0 / 2022-04-02
|
| 23 |
+
===================
|
| 24 |
+
|
| 25 |
+
* Fix error message for json parse whitespace in `strict`
|
| 26 |
+
* Fix internal error when inflated body exceeds limit
|
| 27 |
+
* Prevent loss of async hooks context
|
| 28 |
+
* Prevent hanging when request already read
|
| 29 |
+
* deps: depd@2.0.0
|
| 30 |
+
- Replace internal `eval` usage with `Function` constructor
|
| 31 |
+
- Use instance methods on `process` to check for listeners
|
| 32 |
+
* deps: http-errors@2.0.0
|
| 33 |
+
- deps: depd@2.0.0
|
| 34 |
+
- deps: statuses@2.0.1
|
| 35 |
+
* deps: on-finished@2.4.1
|
| 36 |
+
* deps: qs@6.10.3
|
| 37 |
+
* deps: raw-body@2.5.1
|
| 38 |
+
- deps: http-errors@2.0.0
|
| 39 |
+
|
| 40 |
+
1.19.2 / 2022-02-15
|
| 41 |
+
===================
|
| 42 |
+
|
| 43 |
+
* deps: bytes@3.1.2
|
| 44 |
+
* deps: qs@6.9.7
|
| 45 |
+
* Fix handling of `__proto__` keys
|
| 46 |
+
* deps: raw-body@2.4.3
|
| 47 |
+
- deps: bytes@3.1.2
|
| 48 |
+
|
| 49 |
+
1.19.1 / 2021-12-10
|
| 50 |
+
===================
|
| 51 |
+
|
| 52 |
+
* deps: bytes@3.1.1
|
| 53 |
+
* deps: http-errors@1.8.1
|
| 54 |
+
- deps: inherits@2.0.4
|
| 55 |
+
- deps: toidentifier@1.0.1
|
| 56 |
+
- deps: setprototypeof@1.2.0
|
| 57 |
+
* deps: qs@6.9.6
|
| 58 |
+
* deps: raw-body@2.4.2
|
| 59 |
+
- deps: bytes@3.1.1
|
| 60 |
+
- deps: http-errors@1.8.1
|
| 61 |
+
* deps: safe-buffer@5.2.1
|
| 62 |
+
* deps: type-is@~1.6.18
|
| 63 |
+
|
| 64 |
+
1.19.0 / 2019-04-25
|
| 65 |
+
===================
|
| 66 |
+
|
| 67 |
+
* deps: bytes@3.1.0
|
| 68 |
+
- Add petabyte (`pb`) support
|
| 69 |
+
* deps: http-errors@1.7.2
|
| 70 |
+
- Set constructor name when possible
|
| 71 |
+
- deps: setprototypeof@1.1.1
|
| 72 |
+
- deps: statuses@'>= 1.5.0 < 2'
|
| 73 |
+
* deps: iconv-lite@0.4.24
|
| 74 |
+
- Added encoding MIK
|
| 75 |
+
* deps: qs@6.7.0
|
| 76 |
+
- Fix parsing array brackets after index
|
| 77 |
+
* deps: raw-body@2.4.0
|
| 78 |
+
- deps: bytes@3.1.0
|
| 79 |
+
- deps: http-errors@1.7.2
|
| 80 |
+
- deps: iconv-lite@0.4.24
|
| 81 |
+
* deps: type-is@~1.6.17
|
| 82 |
+
- deps: mime-types@~2.1.24
|
| 83 |
+
- perf: prevent internal `throw` on invalid type
|
| 84 |
+
|
| 85 |
+
1.18.3 / 2018-05-14
|
| 86 |
+
===================
|
| 87 |
+
|
| 88 |
+
* Fix stack trace for strict json parse error
|
| 89 |
+
* deps: depd@~1.1.2
|
| 90 |
+
- perf: remove argument reassignment
|
| 91 |
+
* deps: http-errors@~1.6.3
|
| 92 |
+
- deps: depd@~1.1.2
|
| 93 |
+
- deps: setprototypeof@1.1.0
|
| 94 |
+
- deps: statuses@'>= 1.3.1 < 2'
|
| 95 |
+
* deps: iconv-lite@0.4.23
|
| 96 |
+
- Fix loading encoding with year appended
|
| 97 |
+
- Fix deprecation warnings on Node.js 10+
|
| 98 |
+
* deps: qs@6.5.2
|
| 99 |
+
* deps: raw-body@2.3.3
|
| 100 |
+
- deps: http-errors@1.6.3
|
| 101 |
+
- deps: iconv-lite@0.4.23
|
| 102 |
+
* deps: type-is@~1.6.16
|
| 103 |
+
- deps: mime-types@~2.1.18
|
| 104 |
+
|
| 105 |
+
1.18.2 / 2017-09-22
|
| 106 |
+
===================
|
| 107 |
+
|
| 108 |
+
* deps: debug@2.6.9
|
| 109 |
+
* perf: remove argument reassignment
|
| 110 |
+
|
| 111 |
+
1.18.1 / 2017-09-12
|
| 112 |
+
===================
|
| 113 |
+
|
| 114 |
+
* deps: content-type@~1.0.4
|
| 115 |
+
- perf: remove argument reassignment
|
| 116 |
+
- perf: skip parameter parsing when no parameters
|
| 117 |
+
* deps: iconv-lite@0.4.19
|
| 118 |
+
- Fix ISO-8859-1 regression
|
| 119 |
+
- Update Windows-1255
|
| 120 |
+
* deps: qs@6.5.1
|
| 121 |
+
- Fix parsing & compacting very deep objects
|
| 122 |
+
* deps: raw-body@2.3.2
|
| 123 |
+
- deps: iconv-lite@0.4.19
|
| 124 |
+
|
| 125 |
+
1.18.0 / 2017-09-08
|
| 126 |
+
===================
|
| 127 |
+
|
| 128 |
+
* Fix JSON strict violation error to match native parse error
|
| 129 |
+
* Include the `body` property on verify errors
|
| 130 |
+
* Include the `type` property on all generated errors
|
| 131 |
+
* Use `http-errors` to set status code on errors
|
| 132 |
+
* deps: bytes@3.0.0
|
| 133 |
+
* deps: debug@2.6.8
|
| 134 |
+
* deps: depd@~1.1.1
|
| 135 |
+
- Remove unnecessary `Buffer` loading
|
| 136 |
+
* deps: http-errors@~1.6.2
|
| 137 |
+
- deps: depd@1.1.1
|
| 138 |
+
* deps: iconv-lite@0.4.18
|
| 139 |
+
- Add support for React Native
|
| 140 |
+
- Add a warning if not loaded as utf-8
|
| 141 |
+
- Fix CESU-8 decoding in Node.js 8
|
| 142 |
+
- Improve speed of ISO-8859-1 encoding
|
| 143 |
+
* deps: qs@6.5.0
|
| 144 |
+
* deps: raw-body@2.3.1
|
| 145 |
+
- Use `http-errors` for standard emitted errors
|
| 146 |
+
- deps: bytes@3.0.0
|
| 147 |
+
- deps: iconv-lite@0.4.18
|
| 148 |
+
- perf: skip buffer decoding on overage chunk
|
| 149 |
+
* perf: prevent internal `throw` when missing charset
|
| 150 |
+
|
| 151 |
+
1.17.2 / 2017-05-17
|
| 152 |
+
===================
|
| 153 |
+
|
| 154 |
+
* deps: debug@2.6.7
|
| 155 |
+
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
| 156 |
+
- deps: ms@2.0.0
|
| 157 |
+
* deps: type-is@~1.6.15
|
| 158 |
+
- deps: mime-types@~2.1.15
|
| 159 |
+
|
| 160 |
+
1.17.1 / 2017-03-06
|
| 161 |
+
===================
|
| 162 |
+
|
| 163 |
+
* deps: qs@6.4.0
|
| 164 |
+
- Fix regression parsing keys starting with `[`
|
| 165 |
+
|
| 166 |
+
1.17.0 / 2017-03-01
|
| 167 |
+
===================
|
| 168 |
+
|
| 169 |
+
* deps: http-errors@~1.6.1
|
| 170 |
+
- Make `message` property enumerable for `HttpError`s
|
| 171 |
+
- deps: setprototypeof@1.0.3
|
| 172 |
+
* deps: qs@6.3.1
|
| 173 |
+
- Fix compacting nested arrays
|
| 174 |
+
|
| 175 |
+
1.16.1 / 2017-02-10
|
| 176 |
+
===================
|
| 177 |
+
|
| 178 |
+
* deps: debug@2.6.1
|
| 179 |
+
- Fix deprecation messages in WebStorm and other editors
|
| 180 |
+
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
| 181 |
+
|
| 182 |
+
1.16.0 / 2017-01-17
|
| 183 |
+
===================
|
| 184 |
+
|
| 185 |
+
* deps: debug@2.6.0
|
| 186 |
+
- Allow colors in workers
|
| 187 |
+
- Deprecated `DEBUG_FD` environment variable
|
| 188 |
+
- Fix error when running under React Native
|
| 189 |
+
- Use same color for same namespace
|
| 190 |
+
- deps: ms@0.7.2
|
| 191 |
+
* deps: http-errors@~1.5.1
|
| 192 |
+
- deps: inherits@2.0.3
|
| 193 |
+
- deps: setprototypeof@1.0.2
|
| 194 |
+
- deps: statuses@'>= 1.3.1 < 2'
|
| 195 |
+
* deps: iconv-lite@0.4.15
|
| 196 |
+
- Added encoding MS-31J
|
| 197 |
+
- Added encoding MS-932
|
| 198 |
+
- Added encoding MS-936
|
| 199 |
+
- Added encoding MS-949
|
| 200 |
+
- Added encoding MS-950
|
| 201 |
+
- Fix GBK/GB18030 handling of Euro character
|
| 202 |
+
* deps: qs@6.2.1
|
| 203 |
+
- Fix array parsing from skipping empty values
|
| 204 |
+
* deps: raw-body@~2.2.0
|
| 205 |
+
- deps: iconv-lite@0.4.15
|
| 206 |
+
* deps: type-is@~1.6.14
|
| 207 |
+
- deps: mime-types@~2.1.13
|
| 208 |
+
|
| 209 |
+
1.15.2 / 2016-06-19
|
| 210 |
+
===================
|
| 211 |
+
|
| 212 |
+
* deps: bytes@2.4.0
|
| 213 |
+
* deps: content-type@~1.0.2
|
| 214 |
+
- perf: enable strict mode
|
| 215 |
+
* deps: http-errors@~1.5.0
|
| 216 |
+
- Use `setprototypeof` module to replace `__proto__` setting
|
| 217 |
+
- deps: statuses@'>= 1.3.0 < 2'
|
| 218 |
+
- perf: enable strict mode
|
| 219 |
+
* deps: qs@6.2.0
|
| 220 |
+
* deps: raw-body@~2.1.7
|
| 221 |
+
- deps: bytes@2.4.0
|
| 222 |
+
- perf: remove double-cleanup on happy path
|
| 223 |
+
* deps: type-is@~1.6.13
|
| 224 |
+
- deps: mime-types@~2.1.11
|
| 225 |
+
|
| 226 |
+
1.15.1 / 2016-05-05
|
| 227 |
+
===================
|
| 228 |
+
|
| 229 |
+
* deps: bytes@2.3.0
|
| 230 |
+
- Drop partial bytes on all parsed units
|
| 231 |
+
- Fix parsing byte string that looks like hex
|
| 232 |
+
* deps: raw-body@~2.1.6
|
| 233 |
+
- deps: bytes@2.3.0
|
| 234 |
+
* deps: type-is@~1.6.12
|
| 235 |
+
- deps: mime-types@~2.1.10
|
| 236 |
+
|
| 237 |
+
1.15.0 / 2016-02-10
|
| 238 |
+
===================
|
| 239 |
+
|
| 240 |
+
* deps: http-errors@~1.4.0
|
| 241 |
+
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
| 242 |
+
- deps: inherits@2.0.1
|
| 243 |
+
- deps: statuses@'>= 1.2.1 < 2'
|
| 244 |
+
* deps: qs@6.1.0
|
| 245 |
+
* deps: type-is@~1.6.11
|
| 246 |
+
- deps: mime-types@~2.1.9
|
| 247 |
+
|
| 248 |
+
1.14.2 / 2015-12-16
|
| 249 |
+
===================
|
| 250 |
+
|
| 251 |
+
* deps: bytes@2.2.0
|
| 252 |
+
* deps: iconv-lite@0.4.13
|
| 253 |
+
* deps: qs@5.2.0
|
| 254 |
+
* deps: raw-body@~2.1.5
|
| 255 |
+
- deps: bytes@2.2.0
|
| 256 |
+
- deps: iconv-lite@0.4.13
|
| 257 |
+
* deps: type-is@~1.6.10
|
| 258 |
+
- deps: mime-types@~2.1.8
|
| 259 |
+
|
| 260 |
+
1.14.1 / 2015-09-27
|
| 261 |
+
===================
|
| 262 |
+
|
| 263 |
+
* Fix issue where invalid charset results in 400 when `verify` used
|
| 264 |
+
* deps: iconv-lite@0.4.12
|
| 265 |
+
- Fix CESU-8 decoding in Node.js 4.x
|
| 266 |
+
* deps: raw-body@~2.1.4
|
| 267 |
+
- Fix masking critical errors from `iconv-lite`
|
| 268 |
+
- deps: iconv-lite@0.4.12
|
| 269 |
+
* deps: type-is@~1.6.9
|
| 270 |
+
- deps: mime-types@~2.1.7
|
| 271 |
+
|
| 272 |
+
1.14.0 / 2015-09-16
|
| 273 |
+
===================
|
| 274 |
+
|
| 275 |
+
* Fix JSON strict parse error to match syntax errors
|
| 276 |
+
* Provide static `require` analysis in `urlencoded` parser
|
| 277 |
+
* deps: depd@~1.1.0
|
| 278 |
+
- Support web browser loading
|
| 279 |
+
* deps: qs@5.1.0
|
| 280 |
+
* deps: raw-body@~2.1.3
|
| 281 |
+
- Fix sync callback when attaching data listener causes sync read
|
| 282 |
+
* deps: type-is@~1.6.8
|
| 283 |
+
- Fix type error when given invalid type to match against
|
| 284 |
+
- deps: mime-types@~2.1.6
|
| 285 |
+
|
| 286 |
+
1.13.3 / 2015-07-31
|
| 287 |
+
===================
|
| 288 |
+
|
| 289 |
+
* deps: type-is@~1.6.6
|
| 290 |
+
- deps: mime-types@~2.1.4
|
| 291 |
+
|
| 292 |
+
1.13.2 / 2015-07-05
|
| 293 |
+
===================
|
| 294 |
+
|
| 295 |
+
* deps: iconv-lite@0.4.11
|
| 296 |
+
* deps: qs@4.0.0
|
| 297 |
+
- Fix dropping parameters like `hasOwnProperty`
|
| 298 |
+
- Fix user-visible incompatibilities from 3.1.0
|
| 299 |
+
- Fix various parsing edge cases
|
| 300 |
+
* deps: raw-body@~2.1.2
|
| 301 |
+
- Fix error stack traces to skip `makeError`
|
| 302 |
+
- deps: iconv-lite@0.4.11
|
| 303 |
+
* deps: type-is@~1.6.4
|
| 304 |
+
- deps: mime-types@~2.1.2
|
| 305 |
+
- perf: enable strict mode
|
| 306 |
+
- perf: remove argument reassignment
|
| 307 |
+
|
| 308 |
+
1.13.1 / 2015-06-16
|
| 309 |
+
===================
|
| 310 |
+
|
| 311 |
+
* deps: qs@2.4.2
|
| 312 |
+
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
| 313 |
+
|
| 314 |
+
1.13.0 / 2015-06-14
|
| 315 |
+
===================
|
| 316 |
+
|
| 317 |
+
* Add `statusCode` property on `Error`s, in addition to `status`
|
| 318 |
+
* Change `type` default to `application/json` for JSON parser
|
| 319 |
+
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
| 320 |
+
* Provide static `require` analysis
|
| 321 |
+
* Use the `http-errors` module to generate errors
|
| 322 |
+
* deps: bytes@2.1.0
|
| 323 |
+
- Slight optimizations
|
| 324 |
+
* deps: iconv-lite@0.4.10
|
| 325 |
+
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
| 326 |
+
- Leading BOM is now removed when decoding
|
| 327 |
+
* deps: on-finished@~2.3.0
|
| 328 |
+
- Add defined behavior for HTTP `CONNECT` requests
|
| 329 |
+
- Add defined behavior for HTTP `Upgrade` requests
|
| 330 |
+
- deps: ee-first@1.1.1
|
| 331 |
+
* deps: qs@3.1.0
|
| 332 |
+
- Fix dropping parameters like `hasOwnProperty`
|
| 333 |
+
- Fix various parsing edge cases
|
| 334 |
+
- Parsed object now has `null` prototype
|
| 335 |
+
* deps: raw-body@~2.1.1
|
| 336 |
+
- Use `unpipe` module for unpiping requests
|
| 337 |
+
- deps: iconv-lite@0.4.10
|
| 338 |
+
* deps: type-is@~1.6.3
|
| 339 |
+
- deps: mime-types@~2.1.1
|
| 340 |
+
- perf: reduce try block size
|
| 341 |
+
- perf: remove bitwise operations
|
| 342 |
+
* perf: enable strict mode
|
| 343 |
+
* perf: remove argument reassignment
|
| 344 |
+
* perf: remove delete call
|
| 345 |
+
|
| 346 |
+
1.12.4 / 2015-05-10
|
| 347 |
+
===================
|
| 348 |
+
|
| 349 |
+
* deps: debug@~2.2.0
|
| 350 |
+
* deps: qs@2.4.2
|
| 351 |
+
- Fix allowing parameters like `constructor`
|
| 352 |
+
* deps: on-finished@~2.2.1
|
| 353 |
+
* deps: raw-body@~2.0.1
|
| 354 |
+
- Fix a false-positive when unpiping in Node.js 0.8
|
| 355 |
+
- deps: bytes@2.0.1
|
| 356 |
+
* deps: type-is@~1.6.2
|
| 357 |
+
- deps: mime-types@~2.0.11
|
| 358 |
+
|
| 359 |
+
1.12.3 / 2015-04-15
|
| 360 |
+
===================
|
| 361 |
+
|
| 362 |
+
* Slight efficiency improvement when not debugging
|
| 363 |
+
* deps: depd@~1.0.1
|
| 364 |
+
* deps: iconv-lite@0.4.8
|
| 365 |
+
- Add encoding alias UNICODE-1-1-UTF-7
|
| 366 |
+
* deps: raw-body@1.3.4
|
| 367 |
+
- Fix hanging callback if request aborts during read
|
| 368 |
+
- deps: iconv-lite@0.4.8
|
| 369 |
+
|
| 370 |
+
1.12.2 / 2015-03-16
|
| 371 |
+
===================
|
| 372 |
+
|
| 373 |
+
* deps: qs@2.4.1
|
| 374 |
+
- Fix error when parameter `hasOwnProperty` is present
|
| 375 |
+
|
| 376 |
+
1.12.1 / 2015-03-15
|
| 377 |
+
===================
|
| 378 |
+
|
| 379 |
+
* deps: debug@~2.1.3
|
| 380 |
+
- Fix high intensity foreground color for bold
|
| 381 |
+
- deps: ms@0.7.0
|
| 382 |
+
* deps: type-is@~1.6.1
|
| 383 |
+
- deps: mime-types@~2.0.10
|
| 384 |
+
|
| 385 |
+
1.12.0 / 2015-02-13
|
| 386 |
+
===================
|
| 387 |
+
|
| 388 |
+
* add `debug` messages
|
| 389 |
+
* accept a function for the `type` option
|
| 390 |
+
* use `content-type` to parse `Content-Type` headers
|
| 391 |
+
* deps: iconv-lite@0.4.7
|
| 392 |
+
- Gracefully support enumerables on `Object.prototype`
|
| 393 |
+
* deps: raw-body@1.3.3
|
| 394 |
+
- deps: iconv-lite@0.4.7
|
| 395 |
+
* deps: type-is@~1.6.0
|
| 396 |
+
- fix argument reassignment
|
| 397 |
+
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
| 398 |
+
- support wildcard for both type and subtype (`*/*`)
|
| 399 |
+
- deps: mime-types@~2.0.9
|
| 400 |
+
|
| 401 |
+
1.11.0 / 2015-01-30
|
| 402 |
+
===================
|
| 403 |
+
|
| 404 |
+
* make internal `extended: true` depth limit infinity
|
| 405 |
+
* deps: type-is@~1.5.6
|
| 406 |
+
- deps: mime-types@~2.0.8
|
| 407 |
+
|
| 408 |
+
1.10.2 / 2015-01-20
|
| 409 |
+
===================
|
| 410 |
+
|
| 411 |
+
* deps: iconv-lite@0.4.6
|
| 412 |
+
- Fix rare aliases of single-byte encodings
|
| 413 |
+
* deps: raw-body@1.3.2
|
| 414 |
+
- deps: iconv-lite@0.4.6
|
| 415 |
+
|
| 416 |
+
1.10.1 / 2015-01-01
|
| 417 |
+
===================
|
| 418 |
+
|
| 419 |
+
* deps: on-finished@~2.2.0
|
| 420 |
+
* deps: type-is@~1.5.5
|
| 421 |
+
- deps: mime-types@~2.0.7
|
| 422 |
+
|
| 423 |
+
1.10.0 / 2014-12-02
|
| 424 |
+
===================
|
| 425 |
+
|
| 426 |
+
* make internal `extended: true` array limit dynamic
|
| 427 |
+
|
| 428 |
+
1.9.3 / 2014-11-21
|
| 429 |
+
==================
|
| 430 |
+
|
| 431 |
+
* deps: iconv-lite@0.4.5
|
| 432 |
+
- Fix Windows-31J and X-SJIS encoding support
|
| 433 |
+
* deps: qs@2.3.3
|
| 434 |
+
- Fix `arrayLimit` behavior
|
| 435 |
+
* deps: raw-body@1.3.1
|
| 436 |
+
- deps: iconv-lite@0.4.5
|
| 437 |
+
* deps: type-is@~1.5.3
|
| 438 |
+
- deps: mime-types@~2.0.3
|
| 439 |
+
|
| 440 |
+
1.9.2 / 2014-10-27
|
| 441 |
+
==================
|
| 442 |
+
|
| 443 |
+
* deps: qs@2.3.2
|
| 444 |
+
- Fix parsing of mixed objects and values
|
| 445 |
+
|
| 446 |
+
1.9.1 / 2014-10-22
|
| 447 |
+
==================
|
| 448 |
+
|
| 449 |
+
* deps: on-finished@~2.1.1
|
| 450 |
+
- Fix handling of pipelined requests
|
| 451 |
+
* deps: qs@2.3.0
|
| 452 |
+
- Fix parsing of mixed implicit and explicit arrays
|
| 453 |
+
* deps: type-is@~1.5.2
|
| 454 |
+
- deps: mime-types@~2.0.2
|
| 455 |
+
|
| 456 |
+
1.9.0 / 2014-09-24
|
| 457 |
+
==================
|
| 458 |
+
|
| 459 |
+
* include the charset in "unsupported charset" error message
|
| 460 |
+
* include the encoding in "unsupported content encoding" error message
|
| 461 |
+
* deps: depd@~1.0.0
|
| 462 |
+
|
| 463 |
+
1.8.4 / 2014-09-23
|
| 464 |
+
==================
|
| 465 |
+
|
| 466 |
+
* fix content encoding to be case-insensitive
|
| 467 |
+
|
| 468 |
+
1.8.3 / 2014-09-19
|
| 469 |
+
==================
|
| 470 |
+
|
| 471 |
+
* deps: qs@2.2.4
|
| 472 |
+
- Fix issue with object keys starting with numbers truncated
|
| 473 |
+
|
| 474 |
+
1.8.2 / 2014-09-15
|
| 475 |
+
==================
|
| 476 |
+
|
| 477 |
+
* deps: depd@0.4.5
|
| 478 |
+
|
| 479 |
+
1.8.1 / 2014-09-07
|
| 480 |
+
==================
|
| 481 |
+
|
| 482 |
+
* deps: media-typer@0.3.0
|
| 483 |
+
* deps: type-is@~1.5.1
|
| 484 |
+
|
| 485 |
+
1.8.0 / 2014-09-05
|
| 486 |
+
==================
|
| 487 |
+
|
| 488 |
+
* make empty-body-handling consistent between chunked requests
|
| 489 |
+
- empty `json` produces `{}`
|
| 490 |
+
- empty `raw` produces `new Buffer(0)`
|
| 491 |
+
- empty `text` produces `''`
|
| 492 |
+
- empty `urlencoded` produces `{}`
|
| 493 |
+
* deps: qs@2.2.3
|
| 494 |
+
- Fix issue where first empty value in array is discarded
|
| 495 |
+
* deps: type-is@~1.5.0
|
| 496 |
+
- fix `hasbody` to be true for `content-length: 0`
|
| 497 |
+
|
| 498 |
+
1.7.0 / 2014-09-01
|
| 499 |
+
==================
|
| 500 |
+
|
| 501 |
+
* add `parameterLimit` option to `urlencoded` parser
|
| 502 |
+
* change `urlencoded` extended array limit to 100
|
| 503 |
+
* respond with 413 when over `parameterLimit` in `urlencoded`
|
| 504 |
+
|
| 505 |
+
1.6.7 / 2014-08-29
|
| 506 |
+
==================
|
| 507 |
+
|
| 508 |
+
* deps: qs@2.2.2
|
| 509 |
+
- Remove unnecessary cloning
|
| 510 |
+
|
| 511 |
+
1.6.6 / 2014-08-27
|
| 512 |
+
==================
|
| 513 |
+
|
| 514 |
+
* deps: qs@2.2.0
|
| 515 |
+
- Array parsing fix
|
| 516 |
+
- Performance improvements
|
| 517 |
+
|
| 518 |
+
1.6.5 / 2014-08-16
|
| 519 |
+
==================
|
| 520 |
+
|
| 521 |
+
* deps: on-finished@2.1.0
|
| 522 |
+
|
| 523 |
+
1.6.4 / 2014-08-14
|
| 524 |
+
==================
|
| 525 |
+
|
| 526 |
+
* deps: qs@1.2.2
|
| 527 |
+
|
| 528 |
+
1.6.3 / 2014-08-10
|
| 529 |
+
==================
|
| 530 |
+
|
| 531 |
+
* deps: qs@1.2.1
|
| 532 |
+
|
| 533 |
+
1.6.2 / 2014-08-07
|
| 534 |
+
==================
|
| 535 |
+
|
| 536 |
+
* deps: qs@1.2.0
|
| 537 |
+
- Fix parsing array of objects
|
| 538 |
+
|
| 539 |
+
1.6.1 / 2014-08-06
|
| 540 |
+
==================
|
| 541 |
+
|
| 542 |
+
* deps: qs@1.1.0
|
| 543 |
+
- Accept urlencoded square brackets
|
| 544 |
+
- Accept empty values in implicit array notation
|
| 545 |
+
|
| 546 |
+
1.6.0 / 2014-08-05
|
| 547 |
+
==================
|
| 548 |
+
|
| 549 |
+
* deps: qs@1.0.2
|
| 550 |
+
- Complete rewrite
|
| 551 |
+
- Limits array length to 20
|
| 552 |
+
- Limits object depth to 5
|
| 553 |
+
- Limits parameters to 1,000
|
| 554 |
+
|
| 555 |
+
1.5.2 / 2014-07-27
|
| 556 |
+
==================
|
| 557 |
+
|
| 558 |
+
* deps: depd@0.4.4
|
| 559 |
+
- Work-around v8 generating empty stack traces
|
| 560 |
+
|
| 561 |
+
1.5.1 / 2014-07-26
|
| 562 |
+
==================
|
| 563 |
+
|
| 564 |
+
* deps: depd@0.4.3
|
| 565 |
+
- Fix exception when global `Error.stackTraceLimit` is too low
|
| 566 |
+
|
| 567 |
+
1.5.0 / 2014-07-20
|
| 568 |
+
==================
|
| 569 |
+
|
| 570 |
+
* deps: depd@0.4.2
|
| 571 |
+
- Add `TRACE_DEPRECATION` environment variable
|
| 572 |
+
- Remove non-standard grey color from color output
|
| 573 |
+
- Support `--no-deprecation` argument
|
| 574 |
+
- Support `--trace-deprecation` argument
|
| 575 |
+
* deps: iconv-lite@0.4.4
|
| 576 |
+
- Added encoding UTF-7
|
| 577 |
+
* deps: raw-body@1.3.0
|
| 578 |
+
- deps: iconv-lite@0.4.4
|
| 579 |
+
- Added encoding UTF-7
|
| 580 |
+
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
| 581 |
+
* deps: type-is@~1.3.2
|
| 582 |
+
|
| 583 |
+
1.4.3 / 2014-06-19
|
| 584 |
+
==================
|
| 585 |
+
|
| 586 |
+
* deps: type-is@1.3.1
|
| 587 |
+
- fix global variable leak
|
| 588 |
+
|
| 589 |
+
1.4.2 / 2014-06-19
|
| 590 |
+
==================
|
| 591 |
+
|
| 592 |
+
* deps: type-is@1.3.0
|
| 593 |
+
- improve type parsing
|
| 594 |
+
|
| 595 |
+
1.4.1 / 2014-06-19
|
| 596 |
+
==================
|
| 597 |
+
|
| 598 |
+
* fix urlencoded extended deprecation message
|
| 599 |
+
|
| 600 |
+
1.4.0 / 2014-06-19
|
| 601 |
+
==================
|
| 602 |
+
|
| 603 |
+
* add `text` parser
|
| 604 |
+
* add `raw` parser
|
| 605 |
+
* check accepted charset in content-type (accepts utf-8)
|
| 606 |
+
* check accepted encoding in content-encoding (accepts identity)
|
| 607 |
+
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
| 608 |
+
* deprecate `urlencoded()` without provided `extended` option
|
| 609 |
+
* lazy-load urlencoded parsers
|
| 610 |
+
* parsers split into files for reduced mem usage
|
| 611 |
+
* support gzip and deflate bodies
|
| 612 |
+
- set `inflate: false` to turn off
|
| 613 |
+
* deps: raw-body@1.2.2
|
| 614 |
+
- Support all encodings from `iconv-lite`
|
| 615 |
+
|
| 616 |
+
1.3.1 / 2014-06-11
|
| 617 |
+
==================
|
| 618 |
+
|
| 619 |
+
* deps: type-is@1.2.1
|
| 620 |
+
- Switch dependency from mime to mime-types@1.0.0
|
| 621 |
+
|
| 622 |
+
1.3.0 / 2014-05-31
|
| 623 |
+
==================
|
| 624 |
+
|
| 625 |
+
* add `extended` option to urlencoded parser
|
| 626 |
+
|
| 627 |
+
1.2.2 / 2014-05-27
|
| 628 |
+
==================
|
| 629 |
+
|
| 630 |
+
* deps: raw-body@1.1.6
|
| 631 |
+
- assert stream encoding on node.js 0.8
|
| 632 |
+
- assert stream encoding on node.js < 0.10.6
|
| 633 |
+
- deps: bytes@1
|
| 634 |
+
|
| 635 |
+
1.2.1 / 2014-05-26
|
| 636 |
+
==================
|
| 637 |
+
|
| 638 |
+
* invoke `next(err)` after request fully read
|
| 639 |
+
- prevents hung responses and socket hang ups
|
| 640 |
+
|
| 641 |
+
1.2.0 / 2014-05-11
|
| 642 |
+
==================
|
| 643 |
+
|
| 644 |
+
* add `verify` option
|
| 645 |
+
* deps: type-is@1.2.0
|
| 646 |
+
- support suffix matching
|
| 647 |
+
|
| 648 |
+
1.1.2 / 2014-05-11
|
| 649 |
+
==================
|
| 650 |
+
|
| 651 |
+
* improve json parser speed
|
| 652 |
+
|
| 653 |
+
1.1.1 / 2014-05-11
|
| 654 |
+
==================
|
| 655 |
+
|
| 656 |
+
* fix repeated limit parsing with every request
|
| 657 |
+
|
| 658 |
+
1.1.0 / 2014-05-10
|
| 659 |
+
==================
|
| 660 |
+
|
| 661 |
+
* add `type` option
|
| 662 |
+
* deps: pin for safety and consistency
|
| 663 |
+
|
| 664 |
+
1.0.2 / 2014-04-14
|
| 665 |
+
==================
|
| 666 |
+
|
| 667 |
+
* use `type-is` module
|
| 668 |
+
|
| 669 |
+
1.0.1 / 2014-03-20
|
| 670 |
+
==================
|
| 671 |
+
|
| 672 |
+
* lower default limits to 100kb
|
node_modules/body-parser/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
| 4 |
+
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 7 |
+
a copy of this software and associated documentation files (the
|
| 8 |
+
'Software'), to deal in the Software without restriction, including
|
| 9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 12 |
+
the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be
|
| 15 |
+
included in all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 21 |
+
CLAIM, DAMAGES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
[![NPM Version][npm-version-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
| 5 |
+
[![Build Status][ci-image]][ci-url]
|
| 6 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 7 |
+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
| 8 |
+
|
| 9 |
+
Node.js body parsing middleware.
|
| 10 |
+
|
| 11 |
+
Parse incoming request bodies in a middleware before your handlers, available
|
| 12 |
+
under the `req.body` property.
|
| 13 |
+
|
| 14 |
+
**Note** As `req.body`'s shape is based on user-controlled input, all
|
| 15 |
+
properties and values in this object are untrusted and should be validated
|
| 16 |
+
before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
| 17 |
+
ways, for example the `foo` property may not be there or may not be a string,
|
| 18 |
+
and `toString` may not be a function and instead a string or other user input.
|
| 19 |
+
|
| 20 |
+
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
| 21 |
+
|
| 22 |
+
_This does not handle multipart bodies_, due to their complex and typically
|
| 23 |
+
large nature. For multipart bodies, you may be interested in the following
|
| 24 |
+
modules:
|
| 25 |
+
|
| 26 |
+
* [busboy](https://www.npmjs.org/package/busboy#readme) and
|
| 27 |
+
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
|
| 28 |
+
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
|
| 29 |
+
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
|
| 30 |
+
* [formidable](https://www.npmjs.org/package/formidable#readme)
|
| 31 |
+
* [multer](https://www.npmjs.org/package/multer#readme)
|
| 32 |
+
|
| 33 |
+
This module provides the following parsers:
|
| 34 |
+
|
| 35 |
+
* [JSON body parser](#bodyparserjsonoptions)
|
| 36 |
+
* [Raw body parser](#bodyparserrawoptions)
|
| 37 |
+
* [Text body parser](#bodyparsertextoptions)
|
| 38 |
+
* [URL-encoded form body parser](#bodyparserurlencodedoptions)
|
| 39 |
+
|
| 40 |
+
Other body parsers you might be interested in:
|
| 41 |
+
|
| 42 |
+
- [body](https://www.npmjs.org/package/body#readme)
|
| 43 |
+
- [co-body](https://www.npmjs.org/package/co-body#readme)
|
| 44 |
+
|
| 45 |
+
## Installation
|
| 46 |
+
|
| 47 |
+
```sh
|
| 48 |
+
$ npm install body-parser
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## API
|
| 52 |
+
|
| 53 |
+
```js
|
| 54 |
+
var bodyParser = require('body-parser')
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
The `bodyParser` object exposes various factories to create middlewares. All
|
| 58 |
+
middlewares will populate the `req.body` property with the parsed body when
|
| 59 |
+
the `Content-Type` request header matches the `type` option, or an empty
|
| 60 |
+
object (`{}`) if there was no body to parse, the `Content-Type` was not matched,
|
| 61 |
+
or an error occurred.
|
| 62 |
+
|
| 63 |
+
The various errors returned by this module are described in the
|
| 64 |
+
[errors section](#errors).
|
| 65 |
+
|
| 66 |
+
### bodyParser.json([options])
|
| 67 |
+
|
| 68 |
+
Returns middleware that only parses `json` and only looks at requests where
|
| 69 |
+
the `Content-Type` header matches the `type` option. This parser accepts any
|
| 70 |
+
Unicode encoding of the body and supports automatic inflation of `gzip` and
|
| 71 |
+
`deflate` encodings.
|
| 72 |
+
|
| 73 |
+
A new `body` object containing the parsed data is populated on the `request`
|
| 74 |
+
object after the middleware (i.e. `req.body`).
|
| 75 |
+
|
| 76 |
+
#### Options
|
| 77 |
+
|
| 78 |
+
The `json` function takes an optional `options` object that may contain any of
|
| 79 |
+
the following keys:
|
| 80 |
+
|
| 81 |
+
##### inflate
|
| 82 |
+
|
| 83 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
| 84 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
| 85 |
+
|
| 86 |
+
##### limit
|
| 87 |
+
|
| 88 |
+
Controls the maximum request body size. If this is a number, then the value
|
| 89 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
| 90 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
| 91 |
+
to `'100kb'`.
|
| 92 |
+
|
| 93 |
+
##### reviver
|
| 94 |
+
|
| 95 |
+
The `reviver` option is passed directly to `JSON.parse` as the second
|
| 96 |
+
argument. You can find more information on this argument
|
| 97 |
+
[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).
|
| 98 |
+
|
| 99 |
+
##### strict
|
| 100 |
+
|
| 101 |
+
When set to `true`, will only accept arrays and objects; when `false` will
|
| 102 |
+
accept anything `JSON.parse` accepts. Defaults to `true`.
|
| 103 |
+
|
| 104 |
+
##### type
|
| 105 |
+
|
| 106 |
+
The `type` option is used to determine what media type the middleware will
|
| 107 |
+
parse. This option can be a string, array of strings, or a function. If not a
|
| 108 |
+
function, `type` option is passed directly to the
|
| 109 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
| 110 |
+
be an extension name (like `json`), a mime type (like `application/json`), or
|
| 111 |
+
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
| 112 |
+
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
| 113 |
+
value. Defaults to `application/json`.
|
| 114 |
+
|
| 115 |
+
##### verify
|
| 116 |
+
|
| 117 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
| 118 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
| 119 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
| 120 |
+
|
| 121 |
+
### bodyParser.raw([options])
|
| 122 |
+
|
| 123 |
+
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
| 124 |
+
requests where the `Content-Type` header matches the `type` option. This
|
| 125 |
+
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
| 126 |
+
|
| 127 |
+
A new `body` object containing the parsed data is populated on the `request`
|
| 128 |
+
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
| 129 |
+
of the body.
|
| 130 |
+
|
| 131 |
+
#### Options
|
| 132 |
+
|
| 133 |
+
The `raw` function takes an optional `options` object that may contain any of
|
| 134 |
+
the following keys:
|
| 135 |
+
|
| 136 |
+
##### inflate
|
| 137 |
+
|
| 138 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
| 139 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
| 140 |
+
|
| 141 |
+
##### limit
|
| 142 |
+
|
| 143 |
+
Controls the maximum request body size. If this is a number, then the value
|
| 144 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
| 145 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
| 146 |
+
to `'100kb'`.
|
| 147 |
+
|
| 148 |
+
##### type
|
| 149 |
+
|
| 150 |
+
The `type` option is used to determine what media type the middleware will
|
| 151 |
+
parse. This option can be a string, array of strings, or a function.
|
| 152 |
+
If not a function, `type` option is passed directly to the
|
| 153 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
| 154 |
+
can be an extension name (like `bin`), a mime type (like
|
| 155 |
+
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
| 156 |
+
`application/*`). If a function, the `type` option is called as `fn(req)`
|
| 157 |
+
and the request is parsed if it returns a truthy value. Defaults to
|
| 158 |
+
`application/octet-stream`.
|
| 159 |
+
|
| 160 |
+
##### verify
|
| 161 |
+
|
| 162 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
| 163 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
| 164 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
| 165 |
+
|
| 166 |
+
### bodyParser.text([options])
|
| 167 |
+
|
| 168 |
+
Returns middleware that parses all bodies as a string and only looks at
|
| 169 |
+
requests where the `Content-Type` header matches the `type` option. This
|
| 170 |
+
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
| 171 |
+
|
| 172 |
+
A new `body` string containing the parsed data is populated on the `request`
|
| 173 |
+
object after the middleware (i.e. `req.body`). This will be a string of the
|
| 174 |
+
body.
|
| 175 |
+
|
| 176 |
+
#### Options
|
| 177 |
+
|
| 178 |
+
The `text` function takes an optional `options` object that may contain any of
|
| 179 |
+
the following keys:
|
| 180 |
+
|
| 181 |
+
##### defaultCharset
|
| 182 |
+
|
| 183 |
+
Specify the default character set for the text content if the charset is not
|
| 184 |
+
specified in the `Content-Type` header of the request. Defaults to `utf-8`.
|
| 185 |
+
|
| 186 |
+
##### inflate
|
| 187 |
+
|
| 188 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
| 189 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
| 190 |
+
|
| 191 |
+
##### limit
|
| 192 |
+
|
| 193 |
+
Controls the maximum request body size. If this is a number, then the value
|
| 194 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
| 195 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
| 196 |
+
to `'100kb'`.
|
| 197 |
+
|
| 198 |
+
##### type
|
| 199 |
+
|
| 200 |
+
The `type` option is used to determine what media type the middleware will
|
| 201 |
+
parse. This option can be a string, array of strings, or a function. If not
|
| 202 |
+
a function, `type` option is passed directly to the
|
| 203 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
| 204 |
+
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
| 205 |
+
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
| 206 |
+
option is called as `fn(req)` and the request is parsed if it returns a
|
| 207 |
+
truthy value. Defaults to `text/plain`.
|
| 208 |
+
|
| 209 |
+
##### verify
|
| 210 |
+
|
| 211 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
| 212 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
| 213 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
| 214 |
+
|
| 215 |
+
### bodyParser.urlencoded([options])
|
| 216 |
+
|
| 217 |
+
Returns middleware that only parses `urlencoded` bodies and only looks at
|
| 218 |
+
requests where the `Content-Type` header matches the `type` option. This
|
| 219 |
+
parser accepts only UTF-8 encoding of the body and supports automatic
|
| 220 |
+
inflation of `gzip` and `deflate` encodings.
|
| 221 |
+
|
| 222 |
+
A new `body` object containing the parsed data is populated on the `request`
|
| 223 |
+
object after the middleware (i.e. `req.body`). This object will contain
|
| 224 |
+
key-value pairs, where the value can be a string or array (when `extended` is
|
| 225 |
+
`false`), or any type (when `extended` is `true`).
|
| 226 |
+
|
| 227 |
+
#### Options
|
| 228 |
+
|
| 229 |
+
The `urlencoded` function takes an optional `options` object that may contain
|
| 230 |
+
any of the following keys:
|
| 231 |
+
|
| 232 |
+
##### extended
|
| 233 |
+
|
| 234 |
+
The `extended` option allows to choose between parsing the URL-encoded data
|
| 235 |
+
with the `querystring` library (when `false`) or the `qs` library (when
|
| 236 |
+
`true`). The "extended" syntax allows for rich objects and arrays to be
|
| 237 |
+
encoded into the URL-encoded format, allowing for a JSON-like experience
|
| 238 |
+
with URL-encoded. For more information, please
|
| 239 |
+
[see the qs library](https://www.npmjs.org/package/qs#readme).
|
| 240 |
+
|
| 241 |
+
Defaults to `true`, but using the default has been deprecated. Please
|
| 242 |
+
research into the difference between `qs` and `querystring` and choose the
|
| 243 |
+
appropriate setting.
|
| 244 |
+
|
| 245 |
+
##### inflate
|
| 246 |
+
|
| 247 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
| 248 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
| 249 |
+
|
| 250 |
+
##### limit
|
| 251 |
+
|
| 252 |
+
Controls the maximum request body size. If this is a number, then the value
|
| 253 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
| 254 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
| 255 |
+
to `'100kb'`.
|
| 256 |
+
|
| 257 |
+
##### parameterLimit
|
| 258 |
+
|
| 259 |
+
The `parameterLimit` option controls the maximum number of parameters that
|
| 260 |
+
are allowed in the URL-encoded data. If a request contains more parameters
|
| 261 |
+
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
| 262 |
+
|
| 263 |
+
##### type
|
| 264 |
+
|
| 265 |
+
The `type` option is used to determine what media type the middleware will
|
| 266 |
+
parse. This option can be a string, array of strings, or a function. If not
|
| 267 |
+
a function, `type` option is passed directly to the
|
| 268 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
| 269 |
+
be an extension name (like `urlencoded`), a mime type (like
|
| 270 |
+
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
| 271 |
+
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
| 272 |
+
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
| 273 |
+
to `application/x-www-form-urlencoded`.
|
| 274 |
+
|
| 275 |
+
##### verify
|
| 276 |
+
|
| 277 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
| 278 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
| 279 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
| 280 |
+
|
| 281 |
+
#### depth
|
| 282 |
+
|
| 283 |
+
The `depth` option is used to configure the maximum depth of the `qs` library when `extended` is `true`. This allows you to limit the amount of keys that are parsed and can be useful to prevent certain types of abuse. Defaults to `32`. It is recommended to keep this value as low as possible.
|
| 284 |
+
|
| 285 |
+
## Errors
|
| 286 |
+
|
| 287 |
+
The middlewares provided by this module create errors using the
|
| 288 |
+
[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors
|
| 289 |
+
will typically have a `status`/`statusCode` property that contains the suggested
|
| 290 |
+
HTTP response code, an `expose` property to determine if the `message` property
|
| 291 |
+
should be displayed to the client, a `type` property to determine the type of
|
| 292 |
+
error without matching against the `message`, and a `body` property containing
|
| 293 |
+
the read body, if available.
|
| 294 |
+
|
| 295 |
+
The following are the common errors created, though any error can come through
|
| 296 |
+
for various reasons.
|
| 297 |
+
|
| 298 |
+
### content encoding unsupported
|
| 299 |
+
|
| 300 |
+
This error will occur when the request had a `Content-Encoding` header that
|
| 301 |
+
contained an encoding but the "inflation" option was set to `false`. The
|
| 302 |
+
`status` property is set to `415`, the `type` property is set to
|
| 303 |
+
`'encoding.unsupported'`, and the `charset` property will be set to the
|
| 304 |
+
encoding that is unsupported.
|
| 305 |
+
|
| 306 |
+
### entity parse failed
|
| 307 |
+
|
| 308 |
+
This error will occur when the request contained an entity that could not be
|
| 309 |
+
parsed by the middleware. The `status` property is set to `400`, the `type`
|
| 310 |
+
property is set to `'entity.parse.failed'`, and the `body` property is set to
|
| 311 |
+
the entity value that failed parsing.
|
| 312 |
+
|
| 313 |
+
### entity verify failed
|
| 314 |
+
|
| 315 |
+
This error will occur when the request contained an entity that could not be
|
| 316 |
+
failed verification by the defined `verify` option. The `status` property is
|
| 317 |
+
set to `403`, the `type` property is set to `'entity.verify.failed'`, and the
|
| 318 |
+
`body` property is set to the entity value that failed verification.
|
| 319 |
+
|
| 320 |
+
### request aborted
|
| 321 |
+
|
| 322 |
+
This error will occur when the request is aborted by the client before reading
|
| 323 |
+
the body has finished. The `received` property will be set to the number of
|
| 324 |
+
bytes received before the request was aborted and the `expected` property is
|
| 325 |
+
set to the number of expected bytes. The `status` property is set to `400`
|
| 326 |
+
and `type` property is set to `'request.aborted'`.
|
| 327 |
+
|
| 328 |
+
### request entity too large
|
| 329 |
+
|
| 330 |
+
This error will occur when the request body's size is larger than the "limit"
|
| 331 |
+
option. The `limit` property will be set to the byte limit and the `length`
|
| 332 |
+
property will be set to the request body's length. The `status` property is
|
| 333 |
+
set to `413` and the `type` property is set to `'entity.too.large'`.
|
| 334 |
+
|
| 335 |
+
### request size did not match content length
|
| 336 |
+
|
| 337 |
+
This error will occur when the request's length did not match the length from
|
| 338 |
+
the `Content-Length` header. This typically occurs when the request is malformed,
|
| 339 |
+
typically when the `Content-Length` header was calculated based on characters
|
| 340 |
+
instead of bytes. The `status` property is set to `400` and the `type` property
|
| 341 |
+
is set to `'request.size.invalid'`.
|
| 342 |
+
|
| 343 |
+
### stream encoding should not be set
|
| 344 |
+
|
| 345 |
+
This error will occur when something called the `req.setEncoding` method prior
|
| 346 |
+
to this middleware. This module operates directly on bytes only and you cannot
|
| 347 |
+
call `req.setEncoding` when using this module. The `status` property is set to
|
| 348 |
+
`500` and the `type` property is set to `'stream.encoding.set'`.
|
| 349 |
+
|
| 350 |
+
### stream is not readable
|
| 351 |
+
|
| 352 |
+
This error will occur when the request is no longer readable when this middleware
|
| 353 |
+
attempts to read it. This typically means something other than a middleware from
|
| 354 |
+
this module read the request body already and the middleware was also configured to
|
| 355 |
+
read the same request. The `status` property is set to `500` and the `type`
|
| 356 |
+
property is set to `'stream.not.readable'`.
|
| 357 |
+
|
| 358 |
+
### too many parameters
|
| 359 |
+
|
| 360 |
+
This error will occur when the content of the request exceeds the configured
|
| 361 |
+
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
| 362 |
+
`413` and the `type` property is set to `'parameters.too.many'`.
|
| 363 |
+
|
| 364 |
+
### unsupported charset "BOGUS"
|
| 365 |
+
|
| 366 |
+
This error will occur when the request had a charset parameter in the
|
| 367 |
+
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
| 368 |
+
parser does not support it. The charset is contained in the message as well
|
| 369 |
+
as in the `charset` property. The `status` property is set to `415`, the
|
| 370 |
+
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
| 371 |
+
is set to the charset that is unsupported.
|
| 372 |
+
|
| 373 |
+
### unsupported content encoding "bogus"
|
| 374 |
+
|
| 375 |
+
This error will occur when the request had a `Content-Encoding` header that
|
| 376 |
+
contained an unsupported encoding. The encoding is contained in the message
|
| 377 |
+
as well as in the `encoding` property. The `status` property is set to `415`,
|
| 378 |
+
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
| 379 |
+
property is set to the encoding that is unsupported.
|
| 380 |
+
|
| 381 |
+
### The input exceeded the depth
|
| 382 |
+
|
| 383 |
+
This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown.
|
| 384 |
+
|
| 385 |
+
## Examples
|
| 386 |
+
|
| 387 |
+
### Express/Connect top-level generic
|
| 388 |
+
|
| 389 |
+
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
| 390 |
+
top-level middleware, which will parse the bodies of all incoming requests.
|
| 391 |
+
This is the simplest setup.
|
| 392 |
+
|
| 393 |
+
```js
|
| 394 |
+
var express = require('express')
|
| 395 |
+
var bodyParser = require('body-parser')
|
| 396 |
+
|
| 397 |
+
var app = express()
|
| 398 |
+
|
| 399 |
+
// parse application/x-www-form-urlencoded
|
| 400 |
+
app.use(bodyParser.urlencoded({ extended: false }))
|
| 401 |
+
|
| 402 |
+
// parse application/json
|
| 403 |
+
app.use(bodyParser.json())
|
| 404 |
+
|
| 405 |
+
app.use(function (req, res) {
|
| 406 |
+
res.setHeader('Content-Type', 'text/plain')
|
| 407 |
+
res.write('you posted:\n')
|
| 408 |
+
res.end(JSON.stringify(req.body, null, 2))
|
| 409 |
+
})
|
| 410 |
+
```
|
| 411 |
+
|
| 412 |
+
### Express route-specific
|
| 413 |
+
|
| 414 |
+
This example demonstrates adding body parsers specifically to the routes that
|
| 415 |
+
need them. In general, this is the most recommended way to use body-parser with
|
| 416 |
+
Express.
|
| 417 |
+
|
| 418 |
+
```js
|
| 419 |
+
var express = require('express')
|
| 420 |
+
var bodyParser = require('body-parser')
|
| 421 |
+
|
| 422 |
+
var app = express()
|
| 423 |
+
|
| 424 |
+
// create application/json parser
|
| 425 |
+
var jsonParser = bodyParser.json()
|
| 426 |
+
|
| 427 |
+
// create application/x-www-form-urlencoded parser
|
| 428 |
+
var urlencodedParser = bodyParser.urlencoded({ extended: false })
|
| 429 |
+
|
| 430 |
+
// POST /login gets urlencoded bodies
|
| 431 |
+
app.post('/login', urlencodedParser, function (req, res) {
|
| 432 |
+
res.send('welcome, ' + req.body.username)
|
| 433 |
+
})
|
| 434 |
+
|
| 435 |
+
// POST /api/users gets JSON bodies
|
| 436 |
+
app.post('/api/users', jsonParser, function (req, res) {
|
| 437 |
+
// create user in req.body
|
| 438 |
+
})
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
+
### Change accepted type for parsers
|
| 442 |
+
|
| 443 |
+
All the parsers accept a `type` option which allows you to change the
|
| 444 |
+
`Content-Type` that the middleware will parse.
|
| 445 |
+
|
| 446 |
+
```js
|
| 447 |
+
var express = require('express')
|
| 448 |
+
var bodyParser = require('body-parser')
|
| 449 |
+
|
| 450 |
+
var app = express()
|
| 451 |
+
|
| 452 |
+
// parse various different custom JSON types as JSON
|
| 453 |
+
app.use(bodyParser.json({ type: 'application/*+json' }))
|
| 454 |
+
|
| 455 |
+
// parse some custom thing into a Buffer
|
| 456 |
+
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
| 457 |
+
|
| 458 |
+
// parse an HTML body into a string
|
| 459 |
+
app.use(bodyParser.text({ type: 'text/html' }))
|
| 460 |
+
```
|
| 461 |
+
|
| 462 |
+
## License
|
| 463 |
+
|
| 464 |
+
[MIT](LICENSE)
|
| 465 |
+
|
| 466 |
+
[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci
|
| 467 |
+
[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
|
| 468 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master
|
| 469 |
+
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
| 470 |
+
[node-version-image]: https://badgen.net/npm/node/body-parser
|
| 471 |
+
[node-version-url]: https://nodejs.org/en/download
|
| 472 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/body-parser
|
| 473 |
+
[npm-url]: https://npmjs.org/package/body-parser
|
| 474 |
+
[npm-version-image]: https://badgen.net/npm/v/body-parser
|
| 475 |
+
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
|
| 476 |
+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|
node_modules/body-parser/SECURITY.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Security Policies and Procedures
|
| 2 |
+
|
| 3 |
+
## Reporting a Bug
|
| 4 |
+
|
| 5 |
+
The Express team and community take all security bugs seriously. Thank you
|
| 6 |
+
for improving the security of Express. We appreciate your efforts and
|
| 7 |
+
responsible disclosure and will make every effort to acknowledge your
|
| 8 |
+
contributions.
|
| 9 |
+
|
| 10 |
+
Report security bugs by emailing the current owner(s) of `body-parser`. This
|
| 11 |
+
information can be found in the npm registry using the command
|
| 12 |
+
`npm owner ls body-parser`.
|
| 13 |
+
If unsure or unable to get the information from the above, open an issue
|
| 14 |
+
in the [project issue tracker](https://github.com/expressjs/body-parser/issues)
|
| 15 |
+
asking for the current contact information.
|
| 16 |
+
|
| 17 |
+
To ensure the timely response to your report, please ensure that the entirety
|
| 18 |
+
of the report is contained within the email body and not solely behind a web
|
| 19 |
+
link or an attachment.
|
| 20 |
+
|
| 21 |
+
At least one owner will acknowledge your email within 48 hours, and will send a
|
| 22 |
+
more detailed response within 48 hours indicating the next steps in handling
|
| 23 |
+
your report. After the initial reply to your report, the owners will
|
| 24 |
+
endeavor to keep you informed of the progress towards a fix and full
|
| 25 |
+
announcement, and may ask for additional information or guidance.
|
node_modules/body-parser/index.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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dependencies.
|
| 11 |
+
* @private
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
var deprecate = require('depd')('body-parser')
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Cache of loaded parsers.
|
| 18 |
+
* @private
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
var parsers = Object.create(null)
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* @typedef Parsers
|
| 25 |
+
* @type {function}
|
| 26 |
+
* @property {function} json
|
| 27 |
+
* @property {function} raw
|
| 28 |
+
* @property {function} text
|
| 29 |
+
* @property {function} urlencoded
|
| 30 |
+
*/
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Module exports.
|
| 34 |
+
* @type {Parsers}
|
| 35 |
+
*/
|
| 36 |
+
|
| 37 |
+
exports = module.exports = deprecate.function(bodyParser,
|
| 38 |
+
'bodyParser: use individual json/urlencoded middlewares')
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* JSON parser.
|
| 42 |
+
* @public
|
| 43 |
+
*/
|
| 44 |
+
|
| 45 |
+
Object.defineProperty(exports, 'json', {
|
| 46 |
+
configurable: true,
|
| 47 |
+
enumerable: true,
|
| 48 |
+
get: createParserGetter('json')
|
| 49 |
+
})
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Raw parser.
|
| 53 |
+
* @public
|
| 54 |
+
*/
|
| 55 |
+
|
| 56 |
+
Object.defineProperty(exports, 'raw', {
|
| 57 |
+
configurable: true,
|
| 58 |
+
enumerable: true,
|
| 59 |
+
get: createParserGetter('raw')
|
| 60 |
+
})
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Text parser.
|
| 64 |
+
* @public
|
| 65 |
+
*/
|
| 66 |
+
|
| 67 |
+
Object.defineProperty(exports, 'text', {
|
| 68 |
+
configurable: true,
|
| 69 |
+
enumerable: true,
|
| 70 |
+
get: createParserGetter('text')
|
| 71 |
+
})
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* URL-encoded parser.
|
| 75 |
+
* @public
|
| 76 |
+
*/
|
| 77 |
+
|
| 78 |
+
Object.defineProperty(exports, 'urlencoded', {
|
| 79 |
+
configurable: true,
|
| 80 |
+
enumerable: true,
|
| 81 |
+
get: createParserGetter('urlencoded')
|
| 82 |
+
})
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Create a middleware to parse json and urlencoded bodies.
|
| 86 |
+
*
|
| 87 |
+
* @param {object} [options]
|
| 88 |
+
* @return {function}
|
| 89 |
+
* @deprecated
|
| 90 |
+
* @public
|
| 91 |
+
*/
|
| 92 |
+
|
| 93 |
+
function bodyParser (options) {
|
| 94 |
+
// use default type for parsers
|
| 95 |
+
var opts = Object.create(options || null, {
|
| 96 |
+
type: {
|
| 97 |
+
configurable: true,
|
| 98 |
+
enumerable: true,
|
| 99 |
+
value: undefined,
|
| 100 |
+
writable: true
|
| 101 |
+
}
|
| 102 |
+
})
|
| 103 |
+
|
| 104 |
+
var _urlencoded = exports.urlencoded(opts)
|
| 105 |
+
var _json = exports.json(opts)
|
| 106 |
+
|
| 107 |
+
return function bodyParser (req, res, next) {
|
| 108 |
+
_json(req, res, function (err) {
|
| 109 |
+
if (err) return next(err)
|
| 110 |
+
_urlencoded(req, res, next)
|
| 111 |
+
})
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Create a getter for loading a parser.
|
| 117 |
+
* @private
|
| 118 |
+
*/
|
| 119 |
+
|
| 120 |
+
function createParserGetter (name) {
|
| 121 |
+
return function get () {
|
| 122 |
+
return loadParser(name)
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* Load a parser module.
|
| 128 |
+
* @private
|
| 129 |
+
*/
|
| 130 |
+
|
| 131 |
+
function loadParser (parserName) {
|
| 132 |
+
var parser = parsers[parserName]
|
| 133 |
+
|
| 134 |
+
if (parser !== undefined) {
|
| 135 |
+
return parser
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// this uses a switch for static require analysis
|
| 139 |
+
switch (parserName) {
|
| 140 |
+
case 'json':
|
| 141 |
+
parser = require('./lib/types/json')
|
| 142 |
+
break
|
| 143 |
+
case 'raw':
|
| 144 |
+
parser = require('./lib/types/raw')
|
| 145 |
+
break
|
| 146 |
+
case 'text':
|
| 147 |
+
parser = require('./lib/types/text')
|
| 148 |
+
break
|
| 149 |
+
case 'urlencoded':
|
| 150 |
+
parser = require('./lib/types/urlencoded')
|
| 151 |
+
break
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
// store to prevent invoking require()
|
| 155 |
+
return (parsers[parserName] = parser)
|
| 156 |
+
}
|
node_modules/body-parser/lib/read.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* body-parser
|
| 3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
'use strict'
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Module dependencies.
|
| 11 |
+
* @private
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
var createError = require('http-errors')
|
| 15 |
+
var destroy = require('destroy')
|
| 16 |
+
var getBody = require('raw-body')
|
| 17 |
+
var iconv = require('iconv-lite')
|
| 18 |
+
var onFinished = require('on-finished')
|
| 19 |
+
var unpipe = require('unpipe')
|
| 20 |
+
var zlib = require('zlib')
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Module exports.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
module.exports = read
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Read a request into a buffer and parse.
|
| 30 |
+
*
|
| 31 |
+
* @param {object} req
|
| 32 |
+
* @param {object} res
|
| 33 |
+
* @param {function} next
|
| 34 |
+
* @param {function} parse
|
| 35 |
+
* @param {function} debug
|
| 36 |
+
* @param {object} options
|
| 37 |
+
* @private
|
| 38 |
+
*/
|
| 39 |
+
|
| 40 |
+
function read (req, res, next, parse, debug, options) {
|
| 41 |
+
var length
|
| 42 |
+
var opts = options
|
| 43 |
+
var stream
|
| 44 |
+
|
| 45 |
+
// flag as parsed
|
| 46 |
+
req._body = true
|
| 47 |
+
|
| 48 |
+
// read options
|
| 49 |
+
var encoding = opts.encoding !== null
|
| 50 |
+
? opts.encoding
|
| 51 |
+
: null
|
| 52 |
+
var verify = opts.verify
|
| 53 |
+
|
| 54 |
+
try {
|
| 55 |
+
// get the content stream
|
| 56 |
+
stream = contentstream(req, debug, opts.inflate)
|
| 57 |
+
length = stream.length
|
| 58 |
+
stream.length = undefined
|
| 59 |
+
} catch (err) {
|
| 60 |
+
return next(err)
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
// set raw-body options
|
| 64 |
+
opts.length = length
|
| 65 |
+
opts.encoding = verify
|
| 66 |
+
? null
|
| 67 |
+
: encoding
|
| 68 |
+
|
| 69 |
+
// assert charset is supported
|
| 70 |
+
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
| 71 |
+
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
| 72 |
+
charset: encoding.toLowerCase(),
|
| 73 |
+
type: 'charset.unsupported'
|
| 74 |
+
}))
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
// read body
|
| 78 |
+
debug('read body')
|
| 79 |
+
getBody(stream, opts, function (error, body) {
|
| 80 |
+
if (error) {
|
| 81 |
+
var _error
|
| 82 |
+
|
| 83 |
+
if (error.type === 'encoding.unsupported') {
|
| 84 |
+
// echo back charset
|
| 85 |
+
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
| 86 |
+
charset: encoding.toLowerCase(),
|
| 87 |
+
type: 'charset.unsupported'
|
| 88 |
+
})
|
| 89 |
+
} else {
|
| 90 |
+
// set status code on error
|
| 91 |
+
_error = createError(400, error)
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// unpipe from stream and destroy
|
| 95 |
+
if (stream !== req) {
|
| 96 |
+
unpipe(req)
|
| 97 |
+
destroy(stream, true)
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// read off entire request
|
| 101 |
+
dump(req, function onfinished () {
|
| 102 |
+
next(createError(400, _error))
|
| 103 |
+
})
|
| 104 |
+
return
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// verify
|
| 108 |
+
if (verify) {
|
| 109 |
+
try {
|
| 110 |
+
debug('verify body')
|
| 111 |
+
verify(req, res, body, encoding)
|
| 112 |
+
} catch (err) {
|
| 113 |
+
next(createError(403, err, {
|
| 114 |
+
body: body,
|
| 115 |
+
type: err.type || 'entity.verify.failed'
|
| 116 |
+
}))
|
| 117 |
+
return
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
// parse
|
| 122 |
+
var str = body
|
| 123 |
+
try {
|
| 124 |
+
debug('parse body')
|
| 125 |
+
str = typeof body !== 'string' && encoding !== null
|
| 126 |
+
? iconv.decode(body, encoding)
|
| 127 |
+
: body
|
| 128 |
+
req.body = parse(str)
|
| 129 |
+
} catch (err) {
|
| 130 |
+
next(createError(400, err, {
|
| 131 |
+
body: str,
|
| 132 |
+
type: err.type || 'entity.parse.failed'
|
| 133 |
+
}))
|
| 134 |
+
return
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
next()
|
| 138 |
+
})
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* Get the content stream of the request.
|
| 143 |
+
*
|
| 144 |
+
* @param {object} req
|
| 145 |
+
* @param {function} debug
|
| 146 |
+
* @param {boolean} [inflate=true]
|
| 147 |
+
* @return {object}
|
| 148 |
+
* @api private
|
| 149 |
+
*/
|
| 150 |
+
|
| 151 |
+
function contentstream (req, debug, inflate) {
|
| 152 |
+
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
| 153 |
+
var length = req.headers['content-length']
|
| 154 |
+
var stream
|
| 155 |
+
|
| 156 |
+
debug('content-encoding "%s"', encoding)
|
| 157 |
+
|
| 158 |
+
if (inflate === false && encoding !== 'identity') {
|
| 159 |
+
throw createError(415, 'content encoding unsupported', {
|
| 160 |
+
encoding: encoding,
|
| 161 |
+
type: 'encoding.unsupported'
|
| 162 |
+
})
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
switch (encoding) {
|
| 166 |
+
case 'deflate':
|
| 167 |
+
stream = zlib.createInflate()
|
| 168 |
+
debug('inflate body')
|
| 169 |
+
req.pipe(stream)
|
| 170 |
+
break
|
| 171 |
+
case 'gzip':
|
| 172 |
+
stream = zlib.createGunzip()
|
| 173 |
+
debug('gunzip body')
|
| 174 |
+
req.pipe(stream)
|
| 175 |
+
break
|
| 176 |
+
case 'identity':
|
| 177 |
+
stream = req
|
| 178 |
+
stream.length = length
|
| 179 |
+
break
|
| 180 |
+
default:
|
| 181 |
+
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
| 182 |
+
encoding: encoding,
|
| 183 |
+
type: 'encoding.unsupported'
|
| 184 |
+
})
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
return stream
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/**
|
| 191 |
+
* Dump the contents of a request.
|
| 192 |
+
*
|
| 193 |
+
* @param {object} req
|
| 194 |
+
* @param {function} callback
|
| 195 |
+
* @api private
|
| 196 |
+
*/
|
| 197 |
+
|
| 198 |
+
function dump (req, callback) {
|
| 199 |
+
if (onFinished.isFinished(req)) {
|
| 200 |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* body-parser
|
| 3 |
+
* Copyright(c) 2014 Jonathan Ong
|
| 4 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
| 5 |
+
* MIT Licensed
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
'use strict'
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Module dependencies.
|
| 12 |
+
* @private
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
var bytes = require('bytes')
|
| 16 |
+
var contentType = require('content-type')
|
| 17 |
+
var createError = require('http-errors')
|
| 18 |
+
var debug = require('debug')('body-parser:json')
|
| 19 |
+
var read = require('../read')
|
| 20 |
+
var typeis = require('type-is')
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Module exports.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
module.exports = json
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* RegExp to match the first non-space in a string.
|
| 30 |
+
*
|
| 31 |
+
* Allowed whitespace is defined in RFC 7159:
|
| 32 |
+
*
|
| 33 |
+
* ws = *(
|
| 34 |
+
* %x20 / ; Space
|
| 35 |
+
* %x09 / ; Horizontal tab
|
| 36 |
+
* %x0A / ; Line feed or New line
|
| 37 |
+
* %x0D ) ; Carriage return
|
| 38 |
+
*/
|
| 39 |
+
|
| 40 |
+
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
|
| 41 |
+
|
| 42 |
+
var JSON_SYNTAX_CHAR = '#'
|
| 43 |
+
var JSON_SYNTAX_REGEXP = /#+/g
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Create a middleware to parse JSON bodies.
|
| 47 |
+
*
|
| 48 |
+
* @param {object} [options]
|
| 49 |
+
* @return {function}
|
| 50 |
+
* @public
|
| 51 |
+
*/
|
| 52 |
+
|
| 53 |
+
function json (options) {
|
| 54 |
+
var opts = options || {}
|
| 55 |
+
|
| 56 |
+
var limit = typeof opts.limit !== 'number'
|
| 57 |
+
? bytes.parse(opts.limit || '100kb')
|
| 58 |
+
: opts.limit
|
| 59 |
+
var inflate = opts.inflate !== false
|
| 60 |
+
var reviver = opts.reviver
|
| 61 |
+
var strict = opts.strict !== false
|
| 62 |
+
var type = opts.type || 'application/json'
|
| 63 |
+
var verify = opts.verify || false
|
| 64 |
+
|
| 65 |
+
if (verify !== false && typeof verify !== 'function') {
|
| 66 |
+
throw new TypeError('option verify must be function')
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// create the appropriate type checking function
|
| 70 |
+
var shouldParse = typeof type !== 'function'
|
| 71 |
+
? typeChecker(type)
|
| 72 |
+
: type
|
| 73 |
+
|
| 74 |
+
function parse (body) {
|
| 75 |
+
if (body.length === 0) {
|
| 76 |
+
// special-case empty json body, as it's a common client-side mistake
|
| 77 |
+
// TODO: maybe make this configurable or part of "strict" option
|
| 78 |
+
return {}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
if (strict) {
|
| 82 |
+
var first = firstchar(body)
|
| 83 |
+
|
| 84 |
+
if (first !== '{' && first !== '[') {
|
| 85 |
+
debug('strict violation')
|
| 86 |
+
throw createStrictSyntaxError(body, first)
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
try {
|
| 91 |
+
debug('parse json')
|
| 92 |
+
return JSON.parse(body, reviver)
|
| 93 |
+
} catch (e) {
|
| 94 |
+
throw normalizeJsonSyntaxError(e, {
|
| 95 |
+
message: e.message,
|
| 96 |
+
stack: e.stack
|
| 97 |
+
})
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
return function jsonParser (req, res, next) {
|
| 102 |
+
if (req._body) {
|
| 103 |
+
debug('body already parsed')
|
| 104 |
+
next()
|
| 105 |
+
return
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
req.body = req.body || {}
|
| 109 |
+
|
| 110 |
+
// skip requests without bodies
|
| 111 |
+
if (!typeis.hasBody(req)) {
|
| 112 |
+
debug('skip empty body')
|
| 113 |
+
next()
|
| 114 |
+
return
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
debug('content-type %j', req.headers['content-type'])
|
| 118 |
+
|
| 119 |
+
// determine if request should be parsed
|
| 120 |
+
if (!shouldParse(req)) {
|
| 121 |
+
debug('skip parsing')
|
| 122 |
+
next()
|
| 123 |
+
return
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// assert charset per RFC 7159 sec 8.1
|
| 127 |
+
var charset = getCharset(req) || 'utf-8'
|
| 128 |
+
if (charset.slice(0, 4) !== 'utf-') {
|
| 129 |
+
debug('invalid charset')
|
| 130 |
+
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
| 131 |
+
charset: charset,
|
| 132 |
+
type: 'charset.unsupported'
|
| 133 |
+
}))
|
| 134 |
+
return
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
// read
|
| 138 |
+
read(req, res, next, parse, debug, {
|
| 139 |
+
encoding: charset,
|
| 140 |
+
inflate: inflate,
|
| 141 |
+
limit: limit,
|
| 142 |
+
verify: verify
|
| 143 |
+
})
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
/**
|
| 148 |
+
* Create strict violation syntax error matching native error.
|
| 149 |
+
*
|
| 150 |
+
* @param {string} str
|
| 151 |
+
* @param {string} char
|
| 152 |
+
* @return {Error}
|
| 153 |
+
* @private
|
| 154 |
+
*/
|
| 155 |
+
|
| 156 |
+
function createStrictSyntaxError (str, char) {
|
| 157 |
+
var index = str.indexOf(char)
|
| 158 |
+
var partial = ''
|
| 159 |
+
|
| 160 |
+
if (index !== -1) {
|
| 161 |
+
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
|
| 162 |
+
|
| 163 |
+
for (var i = index + 1; i < str.length; i++) {
|
| 164 |
+
partial += JSON_SYNTAX_CHAR
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
try {
|
| 169 |
+
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
| 170 |
+
} catch (e) {
|
| 171 |
+
return normalizeJsonSyntaxError(e, {
|
| 172 |
+
message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) {
|
| 173 |
+
return str.substring(index, index + placeholder.length)
|
| 174 |
+
}),
|
| 175 |
+
stack: e.stack
|
| 176 |
+
})
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
/**
|
| 181 |
+
* Get the first non-whitespace character in a string.
|
| 182 |
+
*
|
| 183 |
+
* @param {string} str
|
| 184 |
+
* @return {function}
|
| 185 |
+
* @private
|
| 186 |
+
*/
|
| 187 |
+
|
| 188 |
+
function firstchar (str) {
|
| 189 |
+
var match = FIRST_CHAR_REGEXP.exec(str)
|
| 190 |
+
|
| 191 |
+
return match
|
| 192 |
+
? match[1]
|
| 193 |
+
: undefined
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* Get the charset of a request.
|
| 198 |
+
*
|
| 199 |
+
* @param {object} req
|
| 200 |
+
* @api private
|
| 201 |
+
*/
|
| 202 |
+
|
| 203 |
+
function getCharset (req) {
|
| 204 |
+
try {
|
| 205 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
| 206 |
+
} catch (e) {
|
| 207 |
+
return undefined
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
/**
|
| 212 |
+
* Normalize a SyntaxError for JSON.parse.
|
| 213 |
+
*
|
| 214 |
+
* @param {SyntaxError} error
|
| 215 |
+
* @param {object} obj
|
| 216 |
+
* @return {SyntaxError}
|
| 217 |
+
*/
|
| 218 |
+
|
| 219 |
+
function normalizeJsonSyntaxError (error, obj) {
|
| 220 |
+
var keys = Object.getOwnPropertyNames(error)
|
| 221 |
+
|
| 222 |
+
for (var i = 0; i < keys.length; i++) {
|
| 223 |
+
var key = keys[i]
|
| 224 |
+
if (key !== 'stack' && key !== 'message') {
|
| 225 |
+
delete error[key]
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
// replace stack before message for Node.js 0.10 and below
|
| 230 |
+
error.stack = obj.stack.replace(error.message, obj.message)
|
| 231 |
+
error.message = obj.message
|
| 232 |
+
|
| 233 |
+
return error
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/**
|
| 237 |
+
* Get the simple type checker.
|
| 238 |
+
*
|
| 239 |
+
* @param {string} type
|
| 240 |
+
* @return {function}
|
| 241 |
+
*/
|
| 242 |
+
|
| 243 |
+
function typeChecker (type) {
|
| 244 |
+
return function checkType (req) {
|
| 245 |
+
return Boolean(typeis(req, type))
|
| 246 |
+
}
|
| 247 |
+
}
|
node_modules/body-parser/lib/types/raw.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* body-parser
|
| 3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
'use strict'
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Module dependencies.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
var bytes = require('bytes')
|
| 14 |
+
var debug = require('debug')('body-parser:raw')
|
| 15 |
+
var read = require('../read')
|
| 16 |
+
var typeis = require('type-is')
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Module exports.
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
module.exports = raw
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Create a middleware to parse raw bodies.
|
| 26 |
+
*
|
| 27 |
+
* @param {object} [options]
|
| 28 |
+
* @return {function}
|
| 29 |
+
* @api public
|
| 30 |
+
*/
|
| 31 |
+
|
| 32 |
+
function raw (options) {
|
| 33 |
+
var opts = options || {}
|
| 34 |
+
|
| 35 |
+
var inflate = opts.inflate !== false
|
| 36 |
+
var limit = typeof opts.limit !== 'number'
|
| 37 |
+
? bytes.parse(opts.limit || '100kb')
|
| 38 |
+
: opts.limit
|
| 39 |
+
var type = opts.type || 'application/octet-stream'
|
| 40 |
+
var verify = opts.verify || false
|
| 41 |
+
|
| 42 |
+
if (verify !== false && typeof verify !== 'function') {
|
| 43 |
+
throw new TypeError('option verify must be function')
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
// create the appropriate type checking function
|
| 47 |
+
var shouldParse = typeof type !== 'function'
|
| 48 |
+
? typeChecker(type)
|
| 49 |
+
: type
|
| 50 |
+
|
| 51 |
+
function parse (buf) {
|
| 52 |
+
return buf
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
return function rawParser (req, res, next) {
|
| 56 |
+
if (req._body) {
|
| 57 |
+
debug('body already parsed')
|
| 58 |
+
next()
|
| 59 |
+
return
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
req.body = req.body || {}
|
| 63 |
+
|
| 64 |
+
// skip requests without bodies
|
| 65 |
+
if (!typeis.hasBody(req)) {
|
| 66 |
+
debug('skip empty body')
|
| 67 |
+
next()
|
| 68 |
+
return
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
debug('content-type %j', req.headers['content-type'])
|
| 72 |
+
|
| 73 |
+
// determine if request should be parsed
|
| 74 |
+
if (!shouldParse(req)) {
|
| 75 |
+
debug('skip parsing')
|
| 76 |
+
next()
|
| 77 |
+
return
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// read
|
| 81 |
+
read(req, res, next, parse, debug, {
|
| 82 |
+
encoding: null,
|
| 83 |
+
inflate: inflate,
|
| 84 |
+
limit: limit,
|
| 85 |
+
verify: verify
|
| 86 |
+
})
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Get the simple type checker.
|
| 92 |
+
*
|
| 93 |
+
* @param {string} type
|
| 94 |
+
* @return {function}
|
| 95 |
+
*/
|
| 96 |
+
|
| 97 |
+
function typeChecker (type) {
|
| 98 |
+
return function checkType (req) {
|
| 99 |
+
return Boolean(typeis(req, type))
|
| 100 |
+
}
|
| 101 |
+
}
|
node_modules/body-parser/lib/types/text.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* body-parser
|
| 3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
'use strict'
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Module dependencies.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
var bytes = require('bytes')
|
| 14 |
+
var contentType = require('content-type')
|
| 15 |
+
var debug = require('debug')('body-parser:text')
|
| 16 |
+
var read = require('../read')
|
| 17 |
+
var typeis = require('type-is')
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Module exports.
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
module.exports = text
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Create a middleware to parse text bodies.
|
| 27 |
+
*
|
| 28 |
+
* @param {object} [options]
|
| 29 |
+
* @return {function}
|
| 30 |
+
* @api public
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
function text (options) {
|
| 34 |
+
var opts = options || {}
|
| 35 |
+
|
| 36 |
+
var defaultCharset = opts.defaultCharset || 'utf-8'
|
| 37 |
+
var inflate = opts.inflate !== false
|
| 38 |
+
var limit = typeof opts.limit !== 'number'
|
| 39 |
+
? bytes.parse(opts.limit || '100kb')
|
| 40 |
+
: opts.limit
|
| 41 |
+
var type = opts.type || 'text/plain'
|
| 42 |
+
var verify = opts.verify || false
|
| 43 |
+
|
| 44 |
+
if (verify !== false && typeof verify !== 'function') {
|
| 45 |
+
throw new TypeError('option verify must be function')
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
// create the appropriate type checking function
|
| 49 |
+
var shouldParse = typeof type !== 'function'
|
| 50 |
+
? typeChecker(type)
|
| 51 |
+
: type
|
| 52 |
+
|
| 53 |
+
function parse (buf) {
|
| 54 |
+
return buf
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
return function textParser (req, res, next) {
|
| 58 |
+
if (req._body) {
|
| 59 |
+
debug('body already parsed')
|
| 60 |
+
next()
|
| 61 |
+
return
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
req.body = req.body || {}
|
| 65 |
+
|
| 66 |
+
// skip requests without bodies
|
| 67 |
+
if (!typeis.hasBody(req)) {
|
| 68 |
+
debug('skip empty body')
|
| 69 |
+
next()
|
| 70 |
+
return
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
debug('content-type %j', req.headers['content-type'])
|
| 74 |
+
|
| 75 |
+
// determine if request should be parsed
|
| 76 |
+
if (!shouldParse(req)) {
|
| 77 |
+
debug('skip parsing')
|
| 78 |
+
next()
|
| 79 |
+
return
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// get charset
|
| 83 |
+
var charset = getCharset(req) || defaultCharset
|
| 84 |
+
|
| 85 |
+
// read
|
| 86 |
+
read(req, res, next, parse, debug, {
|
| 87 |
+
encoding: charset,
|
| 88 |
+
inflate: inflate,
|
| 89 |
+
limit: limit,
|
| 90 |
+
verify: verify
|
| 91 |
+
})
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Get the charset of a request.
|
| 97 |
+
*
|
| 98 |
+
* @param {object} req
|
| 99 |
+
* @api private
|
| 100 |
+
*/
|
| 101 |
+
|
| 102 |
+
function getCharset (req) {
|
| 103 |
+
try {
|
| 104 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
| 105 |
+
} catch (e) {
|
| 106 |
+
return undefined
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Get the simple type checker.
|
| 112 |
+
*
|
| 113 |
+
* @param {string} type
|
| 114 |
+
* @return {function}
|
| 115 |
+
*/
|
| 116 |
+
|
| 117 |
+
function typeChecker (type) {
|
| 118 |
+
return function checkType (req) {
|
| 119 |
+
return Boolean(typeis(req, type))
|
| 120 |
+
}
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
|
| 8 |
+
'use strict'
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Module dependencies.
|
| 12 |
+
* @private
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
var bytes = require('bytes')
|
| 16 |
+
var contentType = require('content-type')
|
| 17 |
+
var createError = require('http-errors')
|
| 18 |
+
var debug = require('debug')('body-parser:urlencoded')
|
| 19 |
+
var deprecate = require('depd')('body-parser')
|
| 20 |
+
var read = require('../read')
|
| 21 |
+
var typeis = require('type-is')
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Module exports.
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
module.exports = urlencoded
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Cache of parser modules.
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
var parsers = Object.create(null)
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Create a middleware to parse urlencoded bodies.
|
| 37 |
+
*
|
| 38 |
+
* @param {object} [options]
|
| 39 |
+
* @return {function}
|
| 40 |
+
* @public
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
function urlencoded (options) {
|
| 44 |
+
var opts = options || {}
|
| 45 |
+
|
| 46 |
+
// notice because option default will flip in next major
|
| 47 |
+
if (opts.extended === undefined) {
|
| 48 |
+
deprecate('undefined extended: provide extended option')
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
var extended = opts.extended !== false
|
| 52 |
+
var inflate = opts.inflate !== false
|
| 53 |
+
var limit = typeof opts.limit !== 'number'
|
| 54 |
+
? bytes.parse(opts.limit || '100kb')
|
| 55 |
+
: opts.limit
|
| 56 |
+
var type = opts.type || 'application/x-www-form-urlencoded'
|
| 57 |
+
var verify = opts.verify || false
|
| 58 |
+
var depth = typeof opts.depth !== 'number'
|
| 59 |
+
? Number(opts.depth || 32)
|
| 60 |
+
: opts.depth
|
| 61 |
+
|
| 62 |
+
if (verify !== false && typeof verify !== 'function') {
|
| 63 |
+
throw new TypeError('option verify must be function')
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
// create the appropriate query parser
|
| 67 |
+
var queryparse = extended
|
| 68 |
+
? extendedparser(opts)
|
| 69 |
+
: simpleparser(opts)
|
| 70 |
+
|
| 71 |
+
// create the appropriate type checking function
|
| 72 |
+
var shouldParse = typeof type !== 'function'
|
| 73 |
+
? typeChecker(type)
|
| 74 |
+
: type
|
| 75 |
+
|
| 76 |
+
function parse (body) {
|
| 77 |
+
return body.length
|
| 78 |
+
? queryparse(body)
|
| 79 |
+
: {}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
return function urlencodedParser (req, res, next) {
|
| 83 |
+
if (req._body) {
|
| 84 |
+
debug('body already parsed')
|
| 85 |
+
next()
|
| 86 |
+
return
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
req.body = req.body || {}
|
| 90 |
+
|
| 91 |
+
// skip requests without bodies
|
| 92 |
+
if (!typeis.hasBody(req)) {
|
| 93 |
+
debug('skip empty body')
|
| 94 |
+
next()
|
| 95 |
+
return
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
debug('content-type %j', req.headers['content-type'])
|
| 99 |
+
|
| 100 |
+
// determine if request should be parsed
|
| 101 |
+
if (!shouldParse(req)) {
|
| 102 |
+
debug('skip parsing')
|
| 103 |
+
next()
|
| 104 |
+
return
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// assert charset
|
| 108 |
+
var charset = getCharset(req) || 'utf-8'
|
| 109 |
+
if (charset !== 'utf-8') {
|
| 110 |
+
debug('invalid charset')
|
| 111 |
+
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
| 112 |
+
charset: charset,
|
| 113 |
+
type: 'charset.unsupported'
|
| 114 |
+
}))
|
| 115 |
+
return
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
// read
|
| 119 |
+
read(req, res, next, parse, debug, {
|
| 120 |
+
debug: debug,
|
| 121 |
+
encoding: charset,
|
| 122 |
+
inflate: inflate,
|
| 123 |
+
limit: limit,
|
| 124 |
+
verify: verify,
|
| 125 |
+
depth: depth
|
| 126 |
+
})
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* Get the extended query parser.
|
| 132 |
+
*
|
| 133 |
+
* @param {object} options
|
| 134 |
+
*/
|
| 135 |
+
|
| 136 |
+
function extendedparser (options) {
|
| 137 |
+
var parameterLimit = options.parameterLimit !== undefined
|
| 138 |
+
? options.parameterLimit
|
| 139 |
+
: 1000
|
| 140 |
+
|
| 141 |
+
var depth = typeof options.depth !== 'number'
|
| 142 |
+
? Number(options.depth || 32)
|
| 143 |
+
: options.depth
|
| 144 |
+
var parse = parser('qs')
|
| 145 |
+
|
| 146 |
+
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
| 147 |
+
throw new TypeError('option parameterLimit must be a positive number')
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
if (isNaN(depth) || depth < 0) {
|
| 151 |
+
throw new TypeError('option depth must be a zero or a positive number')
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
if (isFinite(parameterLimit)) {
|
| 155 |
+
parameterLimit = parameterLimit | 0
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
return function queryparse (body) {
|
| 159 |
+
var paramCount = parameterCount(body, parameterLimit)
|
| 160 |
+
|
| 161 |
+
if (paramCount === undefined) {
|
| 162 |
+
debug('too many parameters')
|
| 163 |
+
throw createError(413, 'too many parameters', {
|
| 164 |
+
type: 'parameters.too.many'
|
| 165 |
+
})
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
var arrayLimit = Math.max(100, paramCount)
|
| 169 |
+
|
| 170 |
+
debug('parse extended urlencoding')
|
| 171 |
+
try {
|
| 172 |
+
return parse(body, {
|
| 173 |
+
allowPrototypes: true,
|
| 174 |
+
arrayLimit: arrayLimit,
|
| 175 |
+
depth: depth,
|
| 176 |
+
strictDepth: true,
|
| 177 |
+
parameterLimit: parameterLimit
|
| 178 |
+
})
|
| 179 |
+
} catch (err) {
|
| 180 |
+
if (err instanceof RangeError) {
|
| 181 |
+
throw createError(400, 'The input exceeded the depth', {
|
| 182 |
+
type: 'querystring.parse.rangeError'
|
| 183 |
+
})
|
| 184 |
+
} else {
|
| 185 |
+
throw err
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
/**
|
| 192 |
+
* Get the charset of a request.
|
| 193 |
+
*
|
| 194 |
+
* @param {object} req
|
| 195 |
+
* @api private
|
| 196 |
+
*/
|
| 197 |
+
|
| 198 |
+
function getCharset (req) {
|
| 199 |
+
try {
|
| 200 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
| 201 |
+
} catch (e) {
|
| 202 |
+
return undefined
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
/**
|
| 207 |
+
* Count the number of parameters, stopping once limit reached
|
| 208 |
+
*
|
| 209 |
+
* @param {string} body
|
| 210 |
+
* @param {number} limit
|
| 211 |
+
* @api private
|
| 212 |
+
*/
|
| 213 |
+
|
| 214 |
+
function parameterCount (body, limit) {
|
| 215 |
+
var count = 0
|
| 216 |
+
var index = 0
|
| 217 |
+
|
| 218 |
+
while ((index = body.indexOf('&', index)) !== -1) {
|
| 219 |
+
count++
|
| 220 |
+
index++
|
| 221 |
+
|
| 222 |
+
if (count === limit) {
|
| 223 |
+
return undefined
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
return count
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
/**
|
| 231 |
+
* Get parser for module name dynamically.
|
| 232 |
+
*
|
| 233 |
+
* @param {string} name
|
| 234 |
+
* @return {function}
|
| 235 |
+
* @api private
|
| 236 |
+
*/
|
| 237 |
+
|
| 238 |
+
function parser (name) {
|
| 239 |
+
var mod = parsers[name]
|
| 240 |
+
|
| 241 |
+
if (mod !== undefined) {
|
| 242 |
+
return mod.parse
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
// this uses a switch for static require analysis
|
| 246 |
+
switch (name) {
|
| 247 |
+
case 'qs':
|
| 248 |
+
mod = require('qs')
|
| 249 |
+
break
|
| 250 |
+
case 'querystring':
|
| 251 |
+
mod = require('querystring')
|
| 252 |
+
break
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// store to prevent invoking require()
|
| 256 |
+
parsers[name] = mod
|
| 257 |
+
|
| 258 |
+
return mod.parse
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
/**
|
| 262 |
+
* Get the simple query parser.
|
| 263 |
+
*
|
| 264 |
+
* @param {object} options
|
| 265 |
+
*/
|
| 266 |
+
|
| 267 |
+
function simpleparser (options) {
|
| 268 |
+
var parameterLimit = options.parameterLimit !== undefined
|
| 269 |
+
? options.parameterLimit
|
| 270 |
+
: 1000
|
| 271 |
+
var parse = parser('querystring')
|
| 272 |
+
|
| 273 |
+
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
| 274 |
+
throw new TypeError('option parameterLimit must be a positive number')
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
if (isFinite(parameterLimit)) {
|
| 278 |
+
parameterLimit = parameterLimit | 0
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
return function queryparse (body) {
|
| 282 |
+
var paramCount = parameterCount(body, parameterLimit)
|
| 283 |
+
|
| 284 |
+
if (paramCount === undefined) {
|
| 285 |
+
debug('too many parameters')
|
| 286 |
+
throw createError(413, 'too many parameters', {
|
| 287 |
+
type: 'parameters.too.many'
|
| 288 |
+
})
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
debug('parse urlencoding')
|
| 292 |
+
return parse(body, undefined, undefined, { maxKeys: parameterLimit })
|
| 293 |
+
}
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
/**
|
| 297 |
+
* Get the simple type checker.
|
| 298 |
+
*
|
| 299 |
+
* @param {string} type
|
| 300 |
+
* @return {function}
|
| 301 |
+
*/
|
| 302 |
+
|
| 303 |
+
function typeChecker (type) {
|
| 304 |
+
return function checkType (req) {
|
| 305 |
+
return Boolean(typeis(req, type))
|
| 306 |
+
}
|
| 307 |
+
}
|
node_modules/body-parser/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "body-parser",
|
| 3 |
+
"description": "Node.js body parsing middleware",
|
| 4 |
+
"version": "1.20.3",
|
| 5 |
+
"contributors": [
|
| 6 |
+
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
| 7 |
+
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
| 8 |
+
],
|
| 9 |
+
"license": "MIT",
|
| 10 |
+
"repository": "expressjs/body-parser",
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"bytes": "3.1.2",
|
| 13 |
+
"content-type": "~1.0.5",
|
| 14 |
+
"debug": "2.6.9",
|
| 15 |
+
"depd": "2.0.0",
|
| 16 |
+
"destroy": "1.2.0",
|
| 17 |
+
"http-errors": "2.0.0",
|
| 18 |
+
"iconv-lite": "0.4.24",
|
| 19 |
+
"on-finished": "2.4.1",
|
| 20 |
+
"qs": "6.13.0",
|
| 21 |
+
"raw-body": "2.5.2",
|
| 22 |
+
"type-is": "~1.6.18",
|
| 23 |
+
"unpipe": "1.0.0"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"eslint": "8.34.0",
|
| 27 |
+
"eslint-config-standard": "14.1.1",
|
| 28 |
+
"eslint-plugin-import": "2.27.5",
|
| 29 |
+
"eslint-plugin-markdown": "3.0.0",
|
| 30 |
+
"eslint-plugin-node": "11.1.0",
|
| 31 |
+
"eslint-plugin-promise": "6.1.1",
|
| 32 |
+
"eslint-plugin-standard": "4.1.0",
|
| 33 |
+
"methods": "1.1.2",
|
| 34 |
+
"mocha": "10.2.0",
|
| 35 |
+
"nyc": "15.1.0",
|
| 36 |
+
"safe-buffer": "5.2.1",
|
| 37 |
+
"supertest": "6.3.3"
|
| 38 |
+
},
|
| 39 |
+
"files": [
|
| 40 |
+
"lib/",
|
| 41 |
+
"LICENSE",
|
| 42 |
+
"HISTORY.md",
|
| 43 |
+
"SECURITY.md",
|
| 44 |
+
"index.js"
|
| 45 |
+
],
|
| 46 |
+
"engines": {
|
| 47 |
+
"node": ">= 0.8",
|
| 48 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
| 49 |
+
},
|
| 50 |
+
"scripts": {
|
| 51 |
+
"lint": "eslint .",
|
| 52 |
+
"test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/",
|
| 53 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
| 54 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
| 55 |
+
}
|
| 56 |
+
}
|
node_modules/bytes/History.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
3.1.2 / 2022-01-27
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* Fix return value for un-parsable strings
|
| 5 |
+
|
| 6 |
+
3.1.1 / 2021-11-15
|
| 7 |
+
==================
|
| 8 |
+
|
| 9 |
+
* Fix "thousandsSeparator" incorrecting formatting fractional part
|
| 10 |
+
|
| 11 |
+
3.1.0 / 2019-01-22
|
| 12 |
+
==================
|
| 13 |
+
|
| 14 |
+
* Add petabyte (`pb`) support
|
| 15 |
+
|
| 16 |
+
3.0.0 / 2017-08-31
|
| 17 |
+
==================
|
| 18 |
+
|
| 19 |
+
* Change "kB" to "KB" in format output
|
| 20 |
+
* Remove support for Node.js 0.6
|
| 21 |
+
* Remove support for ComponentJS
|
| 22 |
+
|
| 23 |
+
2.5.0 / 2017-03-24
|
| 24 |
+
==================
|
| 25 |
+
|
| 26 |
+
* Add option "unit"
|
| 27 |
+
|
| 28 |
+
2.4.0 / 2016-06-01
|
| 29 |
+
==================
|
| 30 |
+
|
| 31 |
+
* Add option "unitSeparator"
|
| 32 |
+
|
| 33 |
+
2.3.0 / 2016-02-15
|
| 34 |
+
==================
|
| 35 |
+
|
| 36 |
+
* Drop partial bytes on all parsed units
|
| 37 |
+
* Fix non-finite numbers to `.format` to return `null`
|
| 38 |
+
* Fix parsing byte string that looks like hex
|
| 39 |
+
* perf: hoist regular expressions
|
| 40 |
+
|
| 41 |
+
2.2.0 / 2015-11-13
|
| 42 |
+
==================
|
| 43 |
+
|
| 44 |
+
* add option "decimalPlaces"
|
| 45 |
+
* add option "fixedDecimals"
|
| 46 |
+
|
| 47 |
+
2.1.0 / 2015-05-21
|
| 48 |
+
==================
|
| 49 |
+
|
| 50 |
+
* add `.format` export
|
| 51 |
+
* add `.parse` export
|
| 52 |
+
|
| 53 |
+
2.0.2 / 2015-05-20
|
| 54 |
+
==================
|
| 55 |
+
|
| 56 |
+
* remove map recreation
|
| 57 |
+
* remove unnecessary object construction
|
| 58 |
+
|
| 59 |
+
2.0.1 / 2015-05-07
|
| 60 |
+
==================
|
| 61 |
+
|
| 62 |
+
* fix browserify require
|
| 63 |
+
* remove node.extend dependency
|
| 64 |
+
|
| 65 |
+
2.0.0 / 2015-04-12
|
| 66 |
+
==================
|
| 67 |
+
|
| 68 |
+
* add option "case"
|
| 69 |
+
* add option "thousandsSeparator"
|
| 70 |
+
* return "null" on invalid parse input
|
| 71 |
+
* support proper round-trip: bytes(bytes(num)) === num
|
| 72 |
+
* units no longer case sensitive when parsing
|
| 73 |
+
|
| 74 |
+
1.0.0 / 2014-05-05
|
| 75 |
+
==================
|
| 76 |
+
|
| 77 |
+
* add negative support. fixes #6
|
| 78 |
+
|
| 79 |
+
0.3.0 / 2014-03-19
|
| 80 |
+
==================
|
| 81 |
+
|
| 82 |
+
* added terabyte support
|
| 83 |
+
|
| 84 |
+
0.2.1 / 2013-04-01
|
| 85 |
+
==================
|
| 86 |
+
|
| 87 |
+
* add .component
|
| 88 |
+
|
| 89 |
+
0.2.0 / 2012-10-28
|
| 90 |
+
==================
|
| 91 |
+
|
| 92 |
+
* bytes(200).should.eql('200b')
|
| 93 |
+
|
| 94 |
+
0.1.0 / 2012-07-04
|
| 95 |
+
==================
|
| 96 |
+
|
| 97 |
+
* add bytes to string conversion [yields]
|
node_modules/bytes/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
| 4 |
+
Copyright (c) 2015 Jed Watson <jed.watson@me.com>
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 7 |
+
a copy of this software and associated documentation files (the
|
| 8 |
+
'Software'), to deal in the Software without restriction, including
|
| 9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 12 |
+
the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be
|
| 15 |
+
included in all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 21 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 22 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 23 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/bytes/Readme.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
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![Test Coverage][coveralls-image]][coveralls-url]
|
| 7 |
+
|
| 8 |
+
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
|
| 9 |
+
|
| 10 |
+
## Installation
|
| 11 |
+
|
| 12 |
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
| 13 |
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
| 14 |
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
$ npm install bytes
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Usage
|
| 21 |
+
|
| 22 |
+
```js
|
| 23 |
+
var bytes = require('bytes');
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
#### bytes(number|string value, [options]): number|string|null
|
| 27 |
+
|
| 28 |
+
Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`.
|
| 29 |
+
|
| 30 |
+
**Arguments**
|
| 31 |
+
|
| 32 |
+
| Name | Type | Description |
|
| 33 |
+
|---------|----------|--------------------|
|
| 34 |
+
| value | `number`|`string` | Number value to format or string value to parse |
|
| 35 |
+
| options | `Object` | Conversion options for `format` |
|
| 36 |
+
|
| 37 |
+
**Returns**
|
| 38 |
+
|
| 39 |
+
| Name | Type | Description |
|
| 40 |
+
|---------|------------------|-------------------------------------------------|
|
| 41 |
+
| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. |
|
| 42 |
+
|
| 43 |
+
**Example**
|
| 44 |
+
|
| 45 |
+
```js
|
| 46 |
+
bytes(1024);
|
| 47 |
+
// output: '1KB'
|
| 48 |
+
|
| 49 |
+
bytes('1KB');
|
| 50 |
+
// output: 1024
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
#### bytes.format(number value, [options]): string|null
|
| 54 |
+
|
| 55 |
+
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
|
| 56 |
+
rounded.
|
| 57 |
+
|
| 58 |
+
**Arguments**
|
| 59 |
+
|
| 60 |
+
| Name | Type | Description |
|
| 61 |
+
|---------|----------|--------------------|
|
| 62 |
+
| value | `number` | Value in bytes |
|
| 63 |
+
| options | `Object` | Conversion options |
|
| 64 |
+
|
| 65 |
+
**Options**
|
| 66 |
+
|
| 67 |
+
| Property | Type | Description |
|
| 68 |
+
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
| 69 |
+
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
| 70 |
+
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
| 71 |
+
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. |
|
| 72 |
+
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
|
| 73 |
+
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
|
| 74 |
+
|
| 75 |
+
**Returns**
|
| 76 |
+
|
| 77 |
+
| Name | Type | Description |
|
| 78 |
+
|---------|------------------|-------------------------------------------------|
|
| 79 |
+
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
| 80 |
+
|
| 81 |
+
**Example**
|
| 82 |
+
|
| 83 |
+
```js
|
| 84 |
+
bytes.format(1024);
|
| 85 |
+
// output: '1KB'
|
| 86 |
+
|
| 87 |
+
bytes.format(1000);
|
| 88 |
+
// output: '1000B'
|
| 89 |
+
|
| 90 |
+
bytes.format(1000, {thousandsSeparator: ' '});
|
| 91 |
+
// output: '1 000B'
|
| 92 |
+
|
| 93 |
+
bytes.format(1024 * 1.7, {decimalPlaces: 0});
|
| 94 |
+
// output: '2KB'
|
| 95 |
+
|
| 96 |
+
bytes.format(1024, {unitSeparator: ' '});
|
| 97 |
+
// output: '1 KB'
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
#### bytes.parse(string|number value): number|null
|
| 101 |
+
|
| 102 |
+
Parse the string value into an integer in bytes. If no unit is given, or `value`
|
| 103 |
+
is a number, it is assumed the value is in bytes.
|
| 104 |
+
|
| 105 |
+
Supported units and abbreviations are as follows and are case-insensitive:
|
| 106 |
+
|
| 107 |
+
* `b` for bytes
|
| 108 |
+
* `kb` for kilobytes
|
| 109 |
+
* `mb` for megabytes
|
| 110 |
+
* `gb` for gigabytes
|
| 111 |
+
* `tb` for terabytes
|
| 112 |
+
* `pb` for petabytes
|
| 113 |
+
|
| 114 |
+
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
|
| 115 |
+
|
| 116 |
+
**Arguments**
|
| 117 |
+
|
| 118 |
+
| Name | Type | Description |
|
| 119 |
+
|---------------|--------|--------------------|
|
| 120 |
+
| value | `string`|`number` | String to parse, or number in bytes. |
|
| 121 |
+
|
| 122 |
+
**Returns**
|
| 123 |
+
|
| 124 |
+
| Name | Type | Description |
|
| 125 |
+
|---------|-------------|-------------------------|
|
| 126 |
+
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
| 127 |
+
|
| 128 |
+
**Example**
|
| 129 |
+
|
| 130 |
+
```js
|
| 131 |
+
bytes.parse('1KB');
|
| 132 |
+
// output: 1024
|
| 133 |
+
|
| 134 |
+
bytes.parse('1024');
|
| 135 |
+
// output: 1024
|
| 136 |
+
|
| 137 |
+
bytes.parse(1024);
|
| 138 |
+
// output: 1024
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
## License
|
| 142 |
+
|
| 143 |
+
[MIT](LICENSE)
|
| 144 |
+
|
| 145 |
+
[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci
|
| 146 |
+
[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci
|
| 147 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
|
| 148 |
+
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
|
| 149 |
+
[downloads-image]: https://badgen.net/npm/dm/bytes
|
| 150 |
+
[downloads-url]: https://np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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* bytes
|
| 3 |
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
| 4 |
+
* Copyright(c) 2015 Jed Watson
|
| 5 |
+
* MIT Licensed
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
'use strict';
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Module exports.
|
| 12 |
+
* @public
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
module.exports = bytes;
|
| 16 |
+
module.exports.format = format;
|
| 17 |
+
module.exports.parse = parse;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Module variables.
|
| 21 |
+
* @private
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
| 25 |
+
|
| 26 |
+
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
| 27 |
+
|
| 28 |
+
var map = {
|
| 29 |
+
b: 1,
|
| 30 |
+
kb: 1 << 10,
|
| 31 |
+
mb: 1 << 20,
|
| 32 |
+
gb: 1 << 30,
|
| 33 |
+
tb: Math.pow(1024, 4),
|
| 34 |
+
pb: Math.pow(1024, 5),
|
| 35 |
+
};
|
| 36 |
+
|
| 37 |
+
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
| 41 |
+
*
|
| 42 |
+
* @param {string|number} value
|
| 43 |
+
* @param {{
|
| 44 |
+
* case: [string],
|
| 45 |
+
* decimalPlaces: [number]
|
| 46 |
+
* fixedDecimals: [boolean]
|
| 47 |
+
* thousandsSeparator: [string]
|
| 48 |
+
* unitSeparator: [string]
|
| 49 |
+
* }} [options] bytes options.
|
| 50 |
+
*
|
| 51 |
+
* @returns {string|number|null}
|
| 52 |
+
*/
|
| 53 |
+
|
| 54 |
+
function bytes(value, options) {
|
| 55 |
+
if (typeof value === 'string') {
|
| 56 |
+
return parse(value);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if (typeof value === 'number') {
|
| 60 |
+
return format(value, options);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
return null;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* Format the given value in bytes into a string.
|
| 68 |
+
*
|
| 69 |
+
* If the value is negative, it is kept as such. If it is a float,
|
| 70 |
+
* it is rounded.
|
| 71 |
+
*
|
| 72 |
+
* @param {number} value
|
| 73 |
+
* @param {object} [options]
|
| 74 |
+
* @param {number} [options.decimalPlaces=2]
|
| 75 |
+
* @param {number} [options.fixedDecimals=false]
|
| 76 |
+
* @param {string} [options.thousandsSeparator=]
|
| 77 |
+
* @param {string} [options.unit=]
|
| 78 |
+
* @param {string} [options.unitSeparator=]
|
| 79 |
+
*
|
| 80 |
+
* @returns {string|null}
|
| 81 |
+
* @public
|
| 82 |
+
*/
|
| 83 |
+
|
| 84 |
+
function format(value, options) {
|
| 85 |
+
if (!Number.isFinite(value)) {
|
| 86 |
+
return null;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
var mag = Math.abs(value);
|
| 90 |
+
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
| 91 |
+
var unitSeparator = (options && options.unitSeparator) || '';
|
| 92 |
+
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
| 93 |
+
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
| 94 |
+
var unit = (options && options.unit) || '';
|
| 95 |
+
|
| 96 |
+
if (!unit || !map[unit.toLowerCase()]) {
|
| 97 |
+
if (mag >= map.pb) {
|
| 98 |
+
unit = 'PB';
|
| 99 |
+
} else if (mag >= map.tb) {
|
| 100 |
+
unit = 'TB';
|
| 101 |
+
} else if (mag >= map.gb) {
|
| 102 |
+
unit = 'GB';
|
| 103 |
+
} else if (mag >= map.mb) {
|
| 104 |
+
unit = 'MB';
|
| 105 |
+
} else if (mag >= map.kb) {
|
| 106 |
+
unit = 'KB';
|
| 107 |
+
} else {
|
| 108 |
+
unit = 'B';
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
var val = value / map[unit.toLowerCase()];
|
| 113 |
+
var str = val.toFixed(decimalPlaces);
|
| 114 |
+
|
| 115 |
+
if (!fixedDecimals) {
|
| 116 |
+
str = str.replace(formatDecimalsRegExp, '$1');
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
if (thousandsSeparator) {
|
| 120 |
+
str = str.split('.').map(function (s, i) {
|
| 121 |
+
return i === 0
|
| 122 |
+
? s.replace(formatThousandsRegExp, thousandsSeparator)
|
| 123 |
+
: s
|
| 124 |
+
}).join('.');
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
return str + unitSeparator + unit;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* Parse the string value into an integer in bytes.
|
| 132 |
+
*
|
| 133 |
+
* If no unit is given, it is assumed the value is in bytes.
|
| 134 |
+
*
|
| 135 |
+
* @param {number|string} val
|
| 136 |
+
*
|
| 137 |
+
* @returns {number|null}
|
| 138 |
+
* @public
|
| 139 |
+
*/
|
| 140 |
+
|
| 141 |
+
function parse(val) {
|
| 142 |
+
if (typeof val === 'number' && !isNaN(val)) {
|
| 143 |
+
return val;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
if (typeof val !== 'string') {
|
| 147 |
+
return null;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
// Test if the string passed is valid
|
| 151 |
+
var results = parseRegExp.exec(val);
|
| 152 |
+
var floatValue;
|
| 153 |
+
var unit = 'b';
|
| 154 |
+
|
| 155 |
+
if (!results) {
|
| 156 |
+
// Nothing could be extracted from the given string
|
| 157 |
+
floatValue = parseInt(val, 10);
|
| 158 |
+
unit = 'b'
|
| 159 |
+
} else {
|
| 160 |
+
// Retrieve the value and the unit
|
| 161 |
+
floatValue = parseFloat(results[1]);
|
| 162 |
+
unit = results[4].toLowerCase();
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
if (isNaN(floatValue)) {
|
| 166 |
+
return null;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
return Math.floor(map[unit] * floatValue);
|
| 170 |
+
}
|
node_modules/bytes/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "bytes",
|
| 3 |
+
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
| 4 |
+
"version": "3.1.2",
|
| 5 |
+
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
|
| 6 |
+
"contributors": [
|
| 7 |
+
"Jed Watson <jed.watson@me.com>",
|
| 8 |
+
"Théo FIDRY <theo.fidry@gmail.com>"
|
| 9 |
+
],
|
| 10 |
+
"license": "MIT",
|
| 11 |
+
"keywords": [
|
| 12 |
+
"byte",
|
| 13 |
+
"bytes",
|
| 14 |
+
"utility",
|
| 15 |
+
"parse",
|
| 16 |
+
"parser",
|
| 17 |
+
"convert",
|
| 18 |
+
"converter"
|
| 19 |
+
],
|
| 20 |
+
"repository": "visionmedia/bytes.js",
|
| 21 |
+
"devDependencies": {
|
| 22 |
+
"eslint": "7.32.0",
|
| 23 |
+
"eslint-plugin-markdown": "2.2.1",
|
| 24 |
+
"mocha": "9.2.0",
|
| 25 |
+
"nyc": "15.1.0"
|
| 26 |
+
},
|
| 27 |
+
"files": [
|
| 28 |
+
"History.md",
|
| 29 |
+
"LICENSE",
|
| 30 |
+
"Readme.md",
|
| 31 |
+
"index.js"
|
| 32 |
+
],
|
| 33 |
+
"engines": {
|
| 34 |
+
"node": ">= 0.8"
|
| 35 |
+
},
|
| 36 |
+
"scripts": {
|
| 37 |
+
"lint": "eslint .",
|
| 38 |
+
"test": "mocha --check-leaks --reporter spec",
|
| 39 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
| 40 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
| 41 |
+
}
|
| 42 |
+
}
|
node_modules/call-bind-apply-helpers/.eslintrc
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"root": true,
|
| 3 |
+
|
| 4 |
+
"extends": "@ljharb",
|
| 5 |
+
|
| 6 |
+
"rules": {
|
| 7 |
+
"func-name-matching": 0,
|
| 8 |
+
"id-length": 0,
|
| 9 |
+
"new-cap": [2, {
|
| 10 |
+
"capIsNewExceptions": [
|
| 11 |
+
"GetIntrinsic",
|
| 12 |
+
],
|
| 13 |
+
}],
|
| 14 |
+
"no-extra-parens": 0,
|
| 15 |
+
"no-magic-numbers": 0,
|
| 16 |
+
},
|
| 17 |
+
}
|
node_modules/call-bind-apply-helpers/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# These are supported funding model platforms
|
| 2 |
+
|
| 3 |
+
github: [ljharb]
|
| 4 |
+
patreon: # Replace with a single Patreon username
|
| 5 |
+
open_collective: # Replace with a single Open Collective username
|
| 6 |
+
ko_fi: # Replace with a single Ko-fi username
|
| 7 |
+
tidelift: npm/call-bind-apply-helpers
|
| 8 |
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
| 9 |
+
liberapay: # Replace with a single Liberapay username
|
| 10 |
+
issuehunt: # Replace with a single IssueHunt username
|
| 11 |
+
otechie: # Replace with a single Otechie username
|
| 12 |
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
node_modules/call-bind-apply-helpers/.nycrc
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"all": true,
|
| 3 |
+
"check-coverage": false,
|
| 4 |
+
"reporter": ["text-summary", "text", "html", "json"],
|
| 5 |
+
"exclude": [
|
| 6 |
+
"coverage",
|
| 7 |
+
"test"
|
| 8 |
+
]
|
| 9 |
+
}
|
node_modules/call-bind-apply-helpers/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to this project will be documented in this file.
|
| 4 |
+
|
| 5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
| 6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
| 7 |
+
|
| 8 |
+
## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12
|
| 9 |
+
|
| 10 |
+
### Commits
|
| 11 |
+
|
| 12 |
+
- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1)
|
| 13 |
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1)
|
| 14 |
+
|
| 15 |
+
## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08
|
| 16 |
+
|
| 17 |
+
### Commits
|
| 18 |
+
|
| 19 |
+
- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8)
|
| 20 |
+
- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75)
|
| 21 |
+
- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940)
|
| 22 |
+
|
| 23 |
+
## v1.0.0 - 2024-12-05
|
| 24 |
+
|
| 25 |
+
### Commits
|
| 26 |
+
|
| 27 |
+
- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04)
|
| 28 |
+
- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f)
|
| 29 |
+
- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603)
|
| 30 |
+
- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930)
|
node_modules/call-bind-apply-helpers/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 Jordan Harband
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
node_modules/call-bind-apply-helpers/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# call-bind-apply-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
| 2 |
+
|
| 3 |
+
[![github actions][actions-image]][actions-url]
|
| 4 |
+
[![coverage][codecov-image]][codecov-url]
|
| 5 |
+
[![dependency status][deps-svg]][deps-url]
|
| 6 |
+
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
| 7 |
+
[![License][license-image]][license-url]
|
| 8 |
+
[![Downloads][downloads-image]][downloads-url]
|
| 9 |
+
|
| 10 |
+
[![npm badge][npm-badge-png]][package-url]
|
| 11 |
+
|
| 12 |
+
Helper functions around Function call/apply/bind, for use in `call-bind`.
|
| 13 |
+
|
| 14 |
+
The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`.
|
| 15 |
+
Please use `call-bind` unless you have a very good reason not to.
|
| 16 |
+
|
| 17 |
+
## Getting started
|
| 18 |
+
|
| 19 |
+
```sh
|
| 20 |
+
npm install --save call-bind-apply-helpers
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
## Usage/Examples
|
| 24 |
+
|
| 25 |
+
```js
|
| 26 |
+
const assert = require('assert');
|
| 27 |
+
const callBindBasic = require('call-bind-apply-helpers');
|
| 28 |
+
|
| 29 |
+
function f(a, b) {
|
| 30 |
+
assert.equal(this, 1);
|
| 31 |
+
assert.equal(a, 2);
|
| 32 |
+
assert.equal(b, 3);
|
| 33 |
+
assert.equal(arguments.length, 2);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
const fBound = callBindBasic([f, 1]);
|
| 37 |
+
|
| 38 |
+
delete Function.prototype.call;
|
| 39 |
+
delete Function.prototype.bind;
|
| 40 |
+
|
| 41 |
+
fBound(2, 3);
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Tests
|
| 45 |
+
|
| 46 |
+
Clone the repo, `npm install`, and run `npm test`
|
| 47 |
+
|
| 48 |
+
[package-url]: https://npmjs.org/package/call-bind-apply-helpers
|
| 49 |
+
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg
|
| 50 |
+
[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg
|
| 51 |
+
[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers
|
| 52 |
+
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg
|
| 53 |
+
[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies
|
| 54 |
+
[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true
|
| 55 |
+
[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg
|
| 56 |
+
[license-url]: LICENSE
|
| 57 |
+
[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg
|
| 58 |
+
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers
|
| 59 |
+
[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg
|
| 60 |
+
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/
|
| 61 |
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers
|
| 62 |
+
[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions
|
node_modules/call-bind-apply-helpers/actualApply.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export = Reflect.apply;
|
node_modules/call-bind-apply-helpers/actualApply.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var bind = require('function-bind');
|
| 4 |
+
|
| 5 |
+
var $apply = require('./functionApply');
|
| 6 |
+
var $call = require('./functionCall');
|
| 7 |
+
var $reflectApply = require('./reflectApply');
|
| 8 |
+
|
| 9 |
+
/** @type {import('./actualApply')} */
|
| 10 |
+
module.exports = $reflectApply || bind.call($call, $apply);
|
node_modules/call-bind-apply-helpers/applyBind.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import actualApply from './actualApply';
|
| 2 |
+
|
| 3 |
+
type TupleSplitHead<T extends any[], N extends number> = T['length'] extends N
|
| 4 |
+
? T
|
| 5 |
+
: T extends [...infer R, any]
|
| 6 |
+
? TupleSplitHead<R, N>
|
| 7 |
+
: never
|
| 8 |
+
|
| 9 |
+
type TupleSplitTail<T, N extends number, O extends any[] = []> = O['length'] extends N
|
| 10 |
+
? T
|
| 11 |
+
: T extends [infer F, ...infer R]
|
| 12 |
+
? TupleSplitTail<[...R], N, [...O, F]>
|
| 13 |
+
: never
|
| 14 |
+
|
| 15 |
+
type TupleSplit<T extends any[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>]
|
| 16 |
+
|
| 17 |
+
declare function applyBind(...args: TupleSplit<Parameters<typeof actualApply>, 2>[1]): ReturnType<typeof actualApply>;
|
| 18 |
+
|
| 19 |
+
export = applyBind;
|
node_modules/call-bind-apply-helpers/applyBind.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var bind = require('function-bind');
|
| 4 |
+
var $apply = require('./functionApply');
|
| 5 |
+
var actualApply = require('./actualApply');
|
| 6 |
+
|
| 7 |
+
/** @type {import('./applyBind')} */
|
| 8 |
+
module.exports = function applyBind() {
|
| 9 |
+
return actualApply(bind, $apply, arguments);
|
| 10 |
+
};
|
node_modules/call-bind-apply-helpers/functionApply.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export = Function.prototype.apply;
|
node_modules/call-bind-apply-helpers/functionApply.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
/** @type {import('./functionApply')} */
|
| 4 |
+
module.exports = Function.prototype.apply;
|
node_modules/call-bind-apply-helpers/functionCall.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export = Function.prototype.call;
|
node_modules/call-bind-apply-helpers/functionCall.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
/** @type {import('./functionCall')} */
|
| 4 |
+
module.exports = Function.prototype.call;
|
node_modules/call-bind-apply-helpers/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
type RemoveFromTuple<
|
| 2 |
+
Tuple extends readonly unknown[],
|
| 3 |
+
RemoveCount extends number,
|
| 4 |
+
Index extends 1[] = []
|
| 5 |
+
> = Index["length"] extends RemoveCount
|
| 6 |
+
? Tuple
|
| 7 |
+
: Tuple extends [infer First, ...infer Rest]
|
| 8 |
+
? RemoveFromTuple<Rest, RemoveCount, [...Index, 1]>
|
| 9 |
+
: Tuple;
|
| 10 |
+
|
| 11 |
+
type ConcatTuples<
|
| 12 |
+
Prefix extends readonly unknown[],
|
| 13 |
+
Suffix extends readonly unknown[]
|
| 14 |
+
> = [...Prefix, ...Suffix];
|
| 15 |
+
|
| 16 |
+
type ExtractFunctionParams<T> = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R
|
| 17 |
+
? { thisArg: TThis; params: P; returnType: R }
|
| 18 |
+
: never;
|
| 19 |
+
|
| 20 |
+
type BindFunction<
|
| 21 |
+
T extends (this: any, ...args: any[]) => any,
|
| 22 |
+
TThis,
|
| 23 |
+
TBoundArgs extends readonly unknown[],
|
| 24 |
+
ReceiverBound extends boolean
|
| 25 |
+
> = ExtractFunctionParams<T> extends {
|
| 26 |
+
thisArg: infer OrigThis;
|
| 27 |
+
params: infer P extends readonly unknown[];
|
| 28 |
+
returnType: infer R;
|
| 29 |
+
}
|
| 30 |
+
? ReceiverBound extends true
|
| 31 |
+
? (...args: RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>) => R extends [OrigThis, ...infer Rest]
|
| 32 |
+
? [TThis, ...Rest] // Replace `this` with `thisArg`
|
| 33 |
+
: R
|
| 34 |
+
: <U, RemainingArgs extends RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>>(
|
| 35 |
+
thisArg: U,
|
| 36 |
+
...args: RemainingArgs
|
| 37 |
+
) => R extends [OrigThis, ...infer Rest]
|
| 38 |
+
? [U, ...ConcatTuples<TBoundArgs, Rest>] // Preserve bound args in return type
|
| 39 |
+
: R
|
| 40 |
+
: never;
|
| 41 |
+
|
| 42 |
+
declare function callBind<
|
| 43 |
+
const T extends (this: any, ...args: any[]) => any,
|
| 44 |
+
Extracted extends ExtractFunctionParams<T>,
|
| 45 |
+
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[],
|
| 46 |
+
const TThis extends Extracted["thisArg"]
|
| 47 |
+
>(
|
| 48 |
+
args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs]
|
| 49 |
+
): BindFunction<T, TThis, TBoundArgs, true>;
|
| 50 |
+
|
| 51 |
+
declare function callBind<
|
| 52 |
+
const T extends (this: any, ...args: any[]) => any,
|
| 53 |
+
Extracted extends ExtractFunctionParams<T>,
|
| 54 |
+
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[]
|
| 55 |
+
>(
|
| 56 |
+
args: [fn: T, ...boundArgs: TBoundArgs]
|
| 57 |
+
): BindFunction<T, Extracted["thisArg"], TBoundArgs, false>;
|
| 58 |
+
|
| 59 |
+
declare function callBind<const TArgs extends readonly unknown[]>(
|
| 60 |
+
args: [fn: Exclude<TArgs[0], Function>, ...rest: TArgs]
|
| 61 |
+
): never;
|
| 62 |
+
|
| 63 |
+
// export as namespace callBind;
|
| 64 |
+
export = callBind;
|
node_modules/call-bind-apply-helpers/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var bind = require('function-bind');
|
| 4 |
+
var $TypeError = require('es-errors/type');
|
| 5 |
+
|
| 6 |
+
var $call = require('./functionCall');
|
| 7 |
+
var $actualApply = require('./actualApply');
|
| 8 |
+
|
| 9 |
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
| 10 |
+
module.exports = function callBindBasic(args) {
|
| 11 |
+
if (args.length < 1 || typeof args[0] !== 'function') {
|
| 12 |
+
throw new $TypeError('a function is required');
|
| 13 |
+
}
|
| 14 |
+
return $actualApply(bind, $call, args);
|
| 15 |
+
};
|
node_modules/call-bind-apply-helpers/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "call-bind-apply-helpers",
|
| 3 |
+
"version": "1.0.2",
|
| 4 |
+
"description": "Helper functions around Function call/apply/bind, for use in `call-bind`",
|
| 5 |
+
"main": "index.js",
|
| 6 |
+
"exports": {
|
| 7 |
+
".": "./index.js",
|
| 8 |
+
"./actualApply": "./actualApply.js",
|
| 9 |
+
"./applyBind": "./applyBind.js",
|
| 10 |
+
"./functionApply": "./functionApply.js",
|
| 11 |
+
"./functionCall": "./functionCall.js",
|
| 12 |
+
"./reflectApply": "./reflectApply.js",
|
| 13 |
+
"./package.json": "./package.json"
|
| 14 |
+
},
|
| 15 |
+
"scripts": {
|
| 16 |
+
"prepack": "npmignore --auto --commentLines=auto",
|
| 17 |
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
| 18 |
+
"prepublishOnly": "safe-publish-latest",
|
| 19 |
+
"prelint": "evalmd README.md",
|
| 20 |
+
"lint": "eslint --ext=.js,.mjs .",
|
| 21 |
+
"postlint": "tsc -p . && attw -P",
|
| 22 |
+
"pretest": "npm run lint",
|
| 23 |
+
"tests-only": "nyc tape 'test/**/*.js'",
|
| 24 |
+
"test": "npm run tests-only",
|
| 25 |
+
"posttest": "npx npm@'>=10.2' audit --production",
|
| 26 |
+
"version": "auto-changelog && git add CHANGELOG.md",
|
| 27 |
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
| 28 |
+
},
|
| 29 |
+
"repository": {
|
| 30 |
+
"type": "git",
|
| 31 |
+
"url": "git+https://github.com/ljharb/call-bind-apply-helpers.git"
|
| 32 |
+
},
|
| 33 |
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
| 34 |
+
"license": "MIT",
|
| 35 |
+
"bugs": {
|
| 36 |
+
"url": "https://github.com/ljharb/call-bind-apply-helpers/issues"
|
| 37 |
+
},
|
| 38 |
+
"homepage": "https://github.com/ljharb/call-bind-apply-helpers#readme",
|
| 39 |
+
"dependencies": {
|
| 40 |
+
"es-errors": "^1.3.0",
|
| 41 |
+
"function-bind": "^1.1.2"
|
| 42 |
+
},
|
| 43 |
+
"devDependencies": {
|
| 44 |
+
"@arethetypeswrong/cli": "^0.17.3",
|
| 45 |
+
"@ljharb/eslint-config": "^21.1.1",
|
| 46 |
+
"@ljharb/tsconfig": "^0.2.3",
|
| 47 |
+
"@types/for-each": "^0.3.3",
|
| 48 |
+
"@types/function-bind": "^1.1.10",
|
| 49 |
+
"@types/object-inspect": "^1.13.0",
|
| 50 |
+
"@types/tape": "^5.8.1",
|
| 51 |
+
"auto-changelog": "^2.5.0",
|
| 52 |
+
"encoding": "^0.1.13",
|
| 53 |
+
"es-value-fixtures": "^1.7.1",
|
| 54 |
+
"eslint": "=8.8.0",
|
| 55 |
+
"evalmd": "^0.0.19",
|
| 56 |
+
"for-each": "^0.3.5",
|
| 57 |
+
"has-strict-mode": "^1.1.0",
|
| 58 |
+
"in-publish": "^2.0.1",
|
| 59 |
+
"npmignore": "^0.3.1",
|
| 60 |
+
"nyc": "^10.3.2",
|
| 61 |
+
"object-inspect": "^1.13.4",
|
| 62 |
+
"safe-publish-latest": "^2.0.0",
|
| 63 |
+
"tape": "^5.9.0",
|
| 64 |
+
"typescript": "next"
|
| 65 |
+
},
|
| 66 |
+
"testling": {
|
| 67 |
+
"files": "test/index.js"
|
| 68 |
+
},
|
| 69 |
+
"auto-changelog": {
|
| 70 |
+
"output": "CHANGELOG.md",
|
| 71 |
+
"template": "keepachangelog",
|
| 72 |
+
"unreleased": false,
|
| 73 |
+
"commitLimit": false,
|
| 74 |
+
"backfillLimit": false,
|
| 75 |
+
"hideCredit": true
|
| 76 |
+
},
|
| 77 |
+
"publishConfig": {
|
| 78 |
+
"ignore": [
|
| 79 |
+
".github/workflows"
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
"engines": {
|
| 83 |
+
"node": ">= 0.4"
|
| 84 |
+
}
|
| 85 |
+
}
|
node_modules/call-bind-apply-helpers/reflectApply.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare const reflectApply: false | typeof Reflect.apply;
|
| 2 |
+
|
| 3 |
+
export = reflectApply;
|