Changements dans les modules (nouvelle version Express, mysql, ..)
This commit is contained in:
162
node_modules/serve-static/HISTORY.md
generated
vendored
162
node_modules/serve-static/HISTORY.md
generated
vendored
@@ -1,165 +1,3 @@
|
||||
1.15.0 / 2022-03-24
|
||||
===================
|
||||
|
||||
* deps: send@0.18.0
|
||||
- Fix emitted 416 error missing headers property
|
||||
- Limit the headers removed for 304 response
|
||||
- deps: depd@2.0.0
|
||||
- deps: destroy@1.2.0
|
||||
- deps: http-errors@2.0.0
|
||||
- deps: on-finished@2.4.1
|
||||
- deps: statuses@2.0.1
|
||||
|
||||
1.14.2 / 2021-12-15
|
||||
===================
|
||||
|
||||
* deps: send@0.17.2
|
||||
- deps: http-errors@1.8.1
|
||||
- deps: ms@2.1.3
|
||||
- pref: ignore empty http tokens
|
||||
|
||||
1.14.1 / 2019-05-10
|
||||
===================
|
||||
|
||||
* Set stricter CSP header in redirect response
|
||||
* deps: send@0.17.1
|
||||
- deps: range-parser@~1.2.1
|
||||
|
||||
1.14.0 / 2019-05-07
|
||||
===================
|
||||
|
||||
* deps: parseurl@~1.3.3
|
||||
* deps: send@0.17.0
|
||||
- deps: http-errors@~1.7.2
|
||||
- deps: mime@1.6.0
|
||||
- deps: ms@2.1.1
|
||||
- deps: statuses@~1.5.0
|
||||
- perf: remove redundant `path.normalize` call
|
||||
|
||||
1.13.2 / 2018-02-07
|
||||
===================
|
||||
|
||||
* Fix incorrect end tag in redirects
|
||||
* deps: encodeurl@~1.0.2
|
||||
- Fix encoding `%` as last character
|
||||
* deps: send@0.16.2
|
||||
- deps: depd@~1.1.2
|
||||
- deps: encodeurl@~1.0.2
|
||||
- deps: statuses@~1.4.0
|
||||
|
||||
1.13.1 / 2017-09-29
|
||||
===================
|
||||
|
||||
* Fix regression when `root` is incorrectly set to a file
|
||||
* deps: send@0.16.1
|
||||
|
||||
1.13.0 / 2017-09-27
|
||||
===================
|
||||
|
||||
* deps: send@0.16.0
|
||||
- Add 70 new types for file extensions
|
||||
- Add `immutable` option
|
||||
- Fix missing `</html>` in default error & redirects
|
||||
- Set charset as "UTF-8" for .js and .json
|
||||
- Use instance methods on steam to check for listeners
|
||||
- deps: mime@1.4.1
|
||||
- perf: improve path validation speed
|
||||
|
||||
1.12.6 / 2017-09-22
|
||||
===================
|
||||
|
||||
* deps: send@0.15.6
|
||||
- deps: debug@2.6.9
|
||||
- perf: improve `If-Match` token parsing
|
||||
* perf: improve slash collapsing
|
||||
|
||||
1.12.5 / 2017-09-21
|
||||
===================
|
||||
|
||||
* deps: parseurl@~1.3.2
|
||||
- perf: reduce overhead for full URLs
|
||||
- perf: unroll the "fast-path" `RegExp`
|
||||
* deps: send@0.15.5
|
||||
- Fix handling of modified headers with invalid dates
|
||||
- deps: etag@~1.8.1
|
||||
- deps: fresh@0.5.2
|
||||
|
||||
1.12.4 / 2017-08-05
|
||||
===================
|
||||
|
||||
* deps: send@0.15.4
|
||||
- deps: debug@2.6.8
|
||||
- deps: depd@~1.1.1
|
||||
- deps: http-errors@~1.6.2
|
||||
|
||||
1.12.3 / 2017-05-16
|
||||
===================
|
||||
|
||||
* deps: send@0.15.3
|
||||
- deps: debug@2.6.7
|
||||
|
||||
1.12.2 / 2017-04-26
|
||||
===================
|
||||
|
||||
* deps: send@0.15.2
|
||||
- deps: debug@2.6.4
|
||||
|
||||
1.12.1 / 2017-03-04
|
||||
===================
|
||||
|
||||
* deps: send@0.15.1
|
||||
- Fix issue when `Date.parse` does not return `NaN` on invalid date
|
||||
- Fix strict violation in broken environments
|
||||
|
||||
1.12.0 / 2017-02-25
|
||||
===================
|
||||
|
||||
* Send complete HTML document in redirect response
|
||||
* Set default CSP header in redirect response
|
||||
* deps: send@0.15.0
|
||||
- Fix false detection of `no-cache` request directive
|
||||
- Fix incorrect result when `If-None-Match` has both `*` and ETags
|
||||
- Fix weak `ETag` matching to match spec
|
||||
- Remove usage of `res._headers` private field
|
||||
- Support `If-Match` and `If-Unmodified-Since` headers
|
||||
- Use `res.getHeaderNames()` when available
|
||||
- Use `res.headersSent` when available
|
||||
- deps: debug@2.6.1
|
||||
- deps: etag@~1.8.0
|
||||
- deps: fresh@0.5.0
|
||||
- deps: http-errors@~1.6.1
|
||||
|
||||
1.11.2 / 2017-01-23
|
||||
===================
|
||||
|
||||
* deps: send@0.14.2
|
||||
- deps: http-errors@~1.5.1
|
||||
- deps: ms@0.7.2
|
||||
- deps: statuses@~1.3.1
|
||||
|
||||
1.11.1 / 2016-06-10
|
||||
===================
|
||||
|
||||
* Fix redirect error when `req.url` contains raw non-URL characters
|
||||
* deps: send@0.14.1
|
||||
|
||||
1.11.0 / 2016-06-07
|
||||
===================
|
||||
|
||||
* Use status code 301 for redirects
|
||||
* deps: send@0.14.0
|
||||
- Add `acceptRanges` option
|
||||
- Add `cacheControl` option
|
||||
- Attempt to combine multiple ranges into single range
|
||||
- Correctly inherit from `Stream` class
|
||||
- Fix `Content-Range` header in 416 responses when using `start`/`end` options
|
||||
- Fix `Content-Range` header missing from default 416 responses
|
||||
- Ignore non-byte `Range` headers
|
||||
- deps: http-errors@~1.5.0
|
||||
- deps: range-parser@~1.2.0
|
||||
- deps: statuses@~1.3.0
|
||||
- perf: remove argument reassignment
|
||||
|
||||
1.10.3 / 2016-05-30
|
||||
===================
|
||||
|
||||
|
||||
2
node_modules/serve-static/LICENSE
generated
vendored
2
node_modules/serve-static/LICENSE
generated
vendored
@@ -3,7 +3,7 @@
|
||||
Copyright (c) 2010 Sencha Inc.
|
||||
Copyright (c) 2011 LearnBoost
|
||||
Copyright (c) 2011 TJ Holowaychuk
|
||||
Copyright (c) 2014-2016 Douglas Christopher Wilson
|
||||
Copyright (c) 2014-2015 Douglas Christopher Wilson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
85
node_modules/serve-static/README.md
generated
vendored
85
node_modules/serve-static/README.md
generated
vendored
@@ -1,17 +1,14 @@
|
||||
# serve-static
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Linux Build][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Linux Build][travis-image]][travis-url]
|
||||
[![Windows Build][appveyor-image]][appveyor-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
[![Gratipay][gratipay-image]][gratipay-url]
|
||||
|
||||
## Install
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install serve-static
|
||||
```
|
||||
@@ -32,17 +29,6 @@ to the next middleware, allowing for stacking and fall-backs.
|
||||
|
||||
#### Options
|
||||
|
||||
##### acceptRanges
|
||||
|
||||
Enable or disable accepting ranged requests, defaults to true.
|
||||
Disabling this will not send `Accept-Ranges` and ignore the contents
|
||||
of the `Range` request header.
|
||||
|
||||
##### cacheControl
|
||||
|
||||
Enable or disable setting `Cache-Control` response header, defaults to
|
||||
true. Disabling this will ignore the `immutable` and `maxAge` options.
|
||||
|
||||
##### dotfiles
|
||||
|
||||
Set how "dotfiles" are treated when encountered. A dotfile is a file
|
||||
@@ -90,14 +76,6 @@ all methods.
|
||||
|
||||
The default value is `true`.
|
||||
|
||||
##### immutable
|
||||
|
||||
Enable or disable the `immutable` directive in the `Cache-Control` response
|
||||
header, defaults to `false`. If set to `true`, the `maxAge` option should
|
||||
also be specified to enable caching. The `immutable` directive will prevent
|
||||
supported clients from making conditional requests during the life of the
|
||||
`maxAge` option to check if the file has changed.
|
||||
|
||||
##### index
|
||||
|
||||
By default this module will send "index.html" files in response to a request
|
||||
@@ -139,11 +117,12 @@ var http = require('http')
|
||||
var serveStatic = require('serve-static')
|
||||
|
||||
// Serve up public/ftp folder
|
||||
var serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] })
|
||||
var serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})
|
||||
|
||||
// Create server
|
||||
var server = http.createServer(function onRequest (req, res) {
|
||||
serve(req, res, finalhandler(req, res))
|
||||
var server = http.createServer(function(req, res){
|
||||
var done = finalhandler(req, res)
|
||||
serve(req, res, done)
|
||||
})
|
||||
|
||||
// Listen
|
||||
@@ -160,18 +139,19 @@ var serveStatic = require('serve-static')
|
||||
|
||||
// Serve up public/ftp folder
|
||||
var serve = serveStatic('public/ftp', {
|
||||
index: false,
|
||||
setHeaders: setHeaders
|
||||
'index': false,
|
||||
'setHeaders': setHeaders
|
||||
})
|
||||
|
||||
// Set header to force download
|
||||
function setHeaders (res, path) {
|
||||
function setHeaders(res, path) {
|
||||
res.setHeader('Content-Disposition', contentDisposition(path))
|
||||
}
|
||||
|
||||
// Create server
|
||||
var server = http.createServer(function onRequest (req, res) {
|
||||
serve(req, res, finalhandler(req, res))
|
||||
var server = http.createServer(function(req, res){
|
||||
var done = finalhandler(req, res)
|
||||
serve(req, res, done)
|
||||
})
|
||||
|
||||
// Listen
|
||||
@@ -190,25 +170,24 @@ var serveStatic = require('serve-static')
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(serveStatic('public/ftp', { index: ['default.html', 'default.htm'] }))
|
||||
app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))
|
||||
app.listen(3000)
|
||||
```
|
||||
|
||||
#### Multiple roots
|
||||
|
||||
This example shows a simple way to search through multiple directories.
|
||||
Files are searched for in `public-optimized/` first, then `public/` second
|
||||
as a fallback.
|
||||
Files are look for in `public-optimized/` first, then `public/` second as
|
||||
a fallback.
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var path = require('path')
|
||||
var serveStatic = require('serve-static')
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(serveStatic(path.join(__dirname, 'public-optimized')))
|
||||
app.use(serveStatic(path.join(__dirname, 'public')))
|
||||
app.use(serveStatic(__dirname + '/public-optimized'))
|
||||
app.use(serveStatic(__dirname + '/public'))
|
||||
app.listen(3000)
|
||||
```
|
||||
|
||||
@@ -220,19 +199,18 @@ is for 1 day.
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var path = require('path')
|
||||
var serveStatic = require('serve-static')
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(serveStatic(path.join(__dirname, 'public'), {
|
||||
app.use(serveStatic(__dirname + '/public', {
|
||||
maxAge: '1d',
|
||||
setHeaders: setCustomCacheControl
|
||||
}))
|
||||
|
||||
app.listen(3000)
|
||||
|
||||
function setCustomCacheControl (res, path) {
|
||||
function setCustomCacheControl(res, path) {
|
||||
if (serveStatic.mime.lookup(path) === 'text/html') {
|
||||
// Custom Cache-Control for HTML files
|
||||
res.setHeader('Cache-Control', 'public, max-age=0')
|
||||
@@ -244,14 +222,15 @@ function setCustomCacheControl (res, path) {
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/serve-static/master?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/serve-static/master
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/serve-static?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/serve-static/master?label=linux
|
||||
[github-actions-ci-url]: https://github.com/expressjs/serve-static/actions/workflows/ci.yml
|
||||
[node-image]: https://badgen.net/npm/node/serve-static
|
||||
[node-url]: https://nodejs.org/en/download/
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/serve-static
|
||||
[npm-image]: https://img.shields.io/npm/v/serve-static.svg
|
||||
[npm-url]: https://npmjs.org/package/serve-static
|
||||
[npm-version-image]: https://badgen.net/npm/v/serve-static
|
||||
[travis-image]: https://img.shields.io/travis/expressjs/serve-static/master.svg?label=linux
|
||||
[travis-url]: https://travis-ci.org/expressjs/serve-static
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-static/master.svg?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static
|
||||
[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-static/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/serve-static
|
||||
[downloads-image]: https://img.shields.io/npm/dm/serve-static.svg
|
||||
[downloads-url]: https://npmjs.org/package/serve-static
|
||||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
||||
[gratipay-url]: https://gratipay.com/dougwilson/
|
||||
|
||||
41
node_modules/serve-static/index.js
generated
vendored
41
node_modules/serve-static/index.js
generated
vendored
@@ -2,7 +2,7 @@
|
||||
* serve-static
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* @private
|
||||
*/
|
||||
|
||||
var encodeUrl = require('encodeurl')
|
||||
var escapeHtml = require('escape-html')
|
||||
var parseUrl = require('parseurl')
|
||||
var resolve = require('path').resolve
|
||||
@@ -132,7 +131,7 @@ function serveStatic (root, options) {
|
||||
*/
|
||||
function collapseLeadingSlashes (str) {
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str.charCodeAt(i) !== 0x2f /* / */) {
|
||||
if (str[i] !== '/') {
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -142,27 +141,6 @@ function collapseLeadingSlashes (str) {
|
||||
: str
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a minimal HTML document.
|
||||
*
|
||||
* @param {string} title
|
||||
* @param {string} body
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createHtmlDocument (title, body) {
|
||||
return '<!DOCTYPE html>\n' +
|
||||
'<html lang="en">\n' +
|
||||
'<head>\n' +
|
||||
'<meta charset="utf-8">\n' +
|
||||
'<title>' + title + '</title>\n' +
|
||||
'</head>\n' +
|
||||
'<body>\n' +
|
||||
'<pre>' + body + '</pre>\n' +
|
||||
'</body>\n' +
|
||||
'</html>\n'
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a directory listener that just 404s.
|
||||
* @private
|
||||
@@ -180,7 +158,7 @@ function createNotFoundDirectoryListener () {
|
||||
*/
|
||||
|
||||
function createRedirectDirectoryListener () {
|
||||
return function redirect (res) {
|
||||
return function redirect () {
|
||||
if (this.hasTrailingSlash()) {
|
||||
this.error(404)
|
||||
return
|
||||
@@ -194,17 +172,16 @@ function createRedirectDirectoryListener () {
|
||||
originalUrl.pathname = collapseLeadingSlashes(originalUrl.pathname + '/')
|
||||
|
||||
// reformat the URL
|
||||
var loc = encodeUrl(url.format(originalUrl))
|
||||
var doc = createHtmlDocument('Redirecting', 'Redirecting to <a href="' + escapeHtml(loc) + '">' +
|
||||
escapeHtml(loc) + '</a>')
|
||||
var loc = url.format(originalUrl)
|
||||
var msg = 'Redirecting to <a href="' + escapeHtml(loc) + '">' + escapeHtml(loc) + '</a>\n'
|
||||
var res = this.res
|
||||
|
||||
// send redirect response
|
||||
res.statusCode = 301
|
||||
res.statusCode = 303
|
||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(doc))
|
||||
res.setHeader('Content-Security-Policy', "default-src 'none'")
|
||||
res.setHeader('Content-Length', Buffer.byteLength(msg))
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
res.setHeader('Location', loc)
|
||||
res.end(doc)
|
||||
res.end(msg)
|
||||
}
|
||||
}
|
||||
|
||||
3
node_modules/serve-static/node_modules/debug/.jshintrc
generated
vendored
Normal file
3
node_modules/serve-static/node_modules/debug/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"laxbreak": true
|
||||
}
|
||||
6
node_modules/serve-static/node_modules/debug/.npmignore
generated
vendored
Normal file
6
node_modules/serve-static/node_modules/debug/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
195
node_modules/serve-static/node_modules/debug/History.md
generated
vendored
Normal file
195
node_modules/serve-static/node_modules/debug/History.md
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
36
node_modules/serve-static/node_modules/debug/Makefile
generated
vendored
Normal file
36
node_modules/serve-static/node_modules/debug/Makefile
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
NPM ?= $(NODE) $(shell which npm)
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
all: dist/debug.js
|
||||
|
||||
install: node_modules
|
||||
|
||||
clean:
|
||||
@rm -rf dist
|
||||
|
||||
dist:
|
||||
@mkdir -p $@
|
||||
|
||||
dist/debug.js: node_modules browser.js debug.js dist
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > $@
|
||||
|
||||
distclean: clean
|
||||
@rm -rf node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(NPM) install
|
||||
@touch node_modules
|
||||
|
||||
.PHONY: all install clean distclean
|
||||
188
node_modules/serve-static/node_modules/debug/Readme.md
generated
vendored
Normal file
188
node_modules/serve-static/node_modules/debug/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
# debug
|
||||
|
||||
tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

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

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

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Browser support
|
||||
|
||||
Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include:
|
||||
|
||||
```js
|
||||
window.myDebug = require("debug");
|
||||
```
|
||||
|
||||
("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console:
|
||||
|
||||
```js
|
||||
myDebug.enable("worker:*")
|
||||
```
|
||||
|
||||
Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
### stderr vs stdout
|
||||
|
||||
You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
### Save debug output to a file
|
||||
|
||||
You can save all debug statements to a file by piping them.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ DEBUG_FD=3 node your-app.js 3> whatever.log
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
28
node_modules/serve-static/node_modules/debug/bower.json
generated
vendored
Normal file
28
node_modules/serve-static/node_modules/debug/bower.json
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "visionmedia-debug",
|
||||
"main": "dist/debug.js",
|
||||
"version": "2.2.0",
|
||||
"homepage": "https://github.com/visionmedia/debug",
|
||||
"authors": [
|
||||
"TJ Holowaychuk <tj@vision-media.ca>"
|
||||
],
|
||||
"description": "visionmedia-debug",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"es6",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"visionmedia",
|
||||
"debug"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
168
node_modules/serve-static/node_modules/debug/browser.js
generated
vendored
Normal file
168
node_modules/serve-static/node_modules/debug/browser.js
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
return ('WebkitAppearance' in document.documentElement.style) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(window.console && (console.firebug || (console.exception && console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
return JSON.stringify(v);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return args;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = exports.storage.debug;
|
||||
} catch(e) {}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage(){
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
||||
19
node_modules/serve-static/node_modules/debug/component.json
generated
vendored
Normal file
19
node_modules/serve-static/node_modules/debug/component.json
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.2.0",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "browser.js",
|
||||
"scripts": [
|
||||
"browser.js",
|
||||
"debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"rauchg/ms.js": "0.7.1"
|
||||
}
|
||||
}
|
||||
197
node_modules/serve-static/node_modules/debug/debug.js
generated
vendored
Normal file
197
node_modules/serve-static/node_modules/debug/debug.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = debug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lowercased letter, i.e. "n".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previously assigned color.
|
||||
*/
|
||||
|
||||
var prevColor = 0;
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor() {
|
||||
return exports.colors[prevColor++ % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function debug(namespace) {
|
||||
|
||||
// define the `disabled` version
|
||||
function disabled() {
|
||||
}
|
||||
disabled.enabled = false;
|
||||
|
||||
// define the `enabled` version
|
||||
function enabled() {
|
||||
|
||||
var self = enabled;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// add the `color` if not set
|
||||
if (null == self.useColors) self.useColors = exports.useColors();
|
||||
if (null == self.color && self.useColors) self.color = selectColor();
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %o
|
||||
args = ['%o'].concat(args);
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
if ('function' === typeof exports.formatArgs) {
|
||||
args = exports.formatArgs.apply(self, args);
|
||||
}
|
||||
var logFn = enabled.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
enabled.enabled = true;
|
||||
|
||||
var fn = exports.enabled(namespace) ? enabled : disabled;
|
||||
|
||||
fn.namespace = namespace;
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
var split = (namespaces || '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
||||
209
node_modules/serve-static/node_modules/debug/node.js
generated
vendored
Normal file
209
node_modules/serve-static/node_modules/debug/node.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* The file descriptor to write the `debug()` calls to.
|
||||
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
||||
*
|
||||
* $ DEBUG_FD=3 node script.js 3>debug.log
|
||||
*/
|
||||
|
||||
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
||||
var stream = 1 === fd ? process.stdout :
|
||||
2 === fd ? process.stderr :
|
||||
createWritableStdioStream(fd);
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
|
||||
if (0 === debugColors.length) {
|
||||
return tty.isatty(fd);
|
||||
} else {
|
||||
return '0' !== debugColors
|
||||
&& 'no' !== debugColors
|
||||
&& 'false' !== debugColors
|
||||
&& 'disabled' !== debugColors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, since Node doesn't do that out of the box.
|
||||
*/
|
||||
|
||||
var inspect = (4 === util.inspect.length ?
|
||||
// node <= 0.8.x
|
||||
function (v, colors) {
|
||||
return util.inspect(v, void 0, void 0, colors);
|
||||
} :
|
||||
// node > 0.8.x
|
||||
function (v, colors) {
|
||||
return util.inspect(v, { colors: colors });
|
||||
}
|
||||
);
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
return inspect(v, this.useColors)
|
||||
.replace(/\s*\n\s*/g, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
var name = this.namespace;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
|
||||
args[0] = ' \u001b[3' + c + ';1m' + name + ' '
|
||||
+ '\u001b[0m'
|
||||
+ args[0] + '\u001b[3' + c + 'm'
|
||||
+ ' +' + exports.humanize(this.diff) + '\u001b[0m';
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.error()` with the specified arguments.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return stream.write(util.format.apply(this, arguments) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from `node/src/node.js`.
|
||||
*
|
||||
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
||||
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
||||
*/
|
||||
|
||||
function createWritableStdioStream (fd) {
|
||||
var stream;
|
||||
var tty_wrap = process.binding('tty_wrap');
|
||||
|
||||
// Note stream._type is used for test-module-load-list.js
|
||||
|
||||
switch (tty_wrap.guessHandleType(fd)) {
|
||||
case 'TTY':
|
||||
stream = new tty.WriteStream(fd);
|
||||
stream._type = 'tty';
|
||||
|
||||
// Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'FILE':
|
||||
var fs = require('fs');
|
||||
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
||||
stream._type = 'fs';
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = require('net');
|
||||
stream = new net.Socket({
|
||||
fd: fd,
|
||||
readable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
// FIXME Should probably have an option in net.Socket to create a
|
||||
// stream from an existing fd which is writable only. But for now
|
||||
// we'll just add this hack and set the `readable` member to false.
|
||||
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
||||
stream.readable = false;
|
||||
stream.read = null;
|
||||
stream._type = 'pipe';
|
||||
|
||||
// FIXME Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Probably an error on in uv_guess_handle()
|
||||
throw new Error('Implement me. Unknown stream file type!');
|
||||
}
|
||||
|
||||
// For supporting legacy API we put the FD here.
|
||||
stream.fd = fd;
|
||||
|
||||
stream._isStdio = true;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
34
node_modules/serve-static/node_modules/debug/package.json
generated
vendored
Normal file
34
node_modules/serve-static/node_modules/debug/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"version": "2.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "0.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"mocha": "*"
|
||||
},
|
||||
"main": "./node.js",
|
||||
"browser": "./browser.js",
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
96
node_modules/serve-static/node_modules/depd/History.md
generated
vendored
Normal file
96
node_modules/serve-static/node_modules/depd/History.md
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
1.1.2 / 2018-01-11
|
||||
==================
|
||||
|
||||
* perf: remove argument reassignment
|
||||
* Support Node.js 0.6 to 9.x
|
||||
|
||||
1.1.1 / 2017-07-27
|
||||
==================
|
||||
|
||||
* Remove unnecessary `Buffer` loading
|
||||
* Support Node.js 0.6 to 8.x
|
||||
|
||||
1.1.0 / 2015-09-14
|
||||
==================
|
||||
|
||||
* Enable strict mode in more places
|
||||
* Support io.js 3.x
|
||||
* Support io.js 2.x
|
||||
* Support web browser loading
|
||||
- Requires bundler like Browserify or webpack
|
||||
|
||||
1.0.1 / 2015-04-07
|
||||
==================
|
||||
|
||||
* Fix `TypeError`s when under `'use strict'` code
|
||||
* Fix useless type name on auto-generated messages
|
||||
* Support io.js 1.x
|
||||
* Support Node.js 0.12
|
||||
|
||||
1.0.0 / 2014-09-17
|
||||
==================
|
||||
|
||||
* No changes
|
||||
|
||||
0.4.5 / 2014-09-09
|
||||
==================
|
||||
|
||||
* Improve call speed to functions using the function wrapper
|
||||
* Support Node.js 0.6
|
||||
|
||||
0.4.4 / 2014-07-27
|
||||
==================
|
||||
|
||||
* Work-around v8 generating empty stack traces
|
||||
|
||||
0.4.3 / 2014-07-26
|
||||
==================
|
||||
|
||||
* Fix exception when global `Error.stackTraceLimit` is too low
|
||||
|
||||
0.4.2 / 2014-07-19
|
||||
==================
|
||||
|
||||
* Correct call site for wrapped functions and properties
|
||||
|
||||
0.4.1 / 2014-07-19
|
||||
==================
|
||||
|
||||
* Improve automatic message generation for function properties
|
||||
|
||||
0.4.0 / 2014-07-19
|
||||
==================
|
||||
|
||||
* Add `TRACE_DEPRECATION` environment variable
|
||||
* Remove non-standard grey color from color output
|
||||
* Support `--no-deprecation` argument
|
||||
* Support `--trace-deprecation` argument
|
||||
* Support `deprecate.property(fn, prop, message)`
|
||||
|
||||
0.3.0 / 2014-06-16
|
||||
==================
|
||||
|
||||
* Add `NO_DEPRECATION` environment variable
|
||||
|
||||
0.2.0 / 2014-06-15
|
||||
==================
|
||||
|
||||
* Add `deprecate.property(obj, prop, message)`
|
||||
* Remove `supports-color` dependency for node.js 0.8
|
||||
|
||||
0.1.0 / 2014-06-15
|
||||
==================
|
||||
|
||||
* Add `deprecate.function(fn, message)`
|
||||
* Add `process.on('deprecation', fn)` emitter
|
||||
* Automatically generate message when omitted from `deprecate()`
|
||||
|
||||
0.0.1 / 2014-06-15
|
||||
==================
|
||||
|
||||
* Fix warning for dynamic calls at singe call site
|
||||
|
||||
0.0.0 / 2014-06-15
|
||||
==================
|
||||
|
||||
* Initial implementation
|
||||
22
node_modules/serve-static/node_modules/depd/LICENSE
generated
vendored
Normal file
22
node_modules/serve-static/node_modules/depd/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 Douglas Christopher Wilson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
280
node_modules/serve-static/node_modules/depd/Readme.md
generated
vendored
Normal file
280
node_modules/serve-static/node_modules/depd/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,280 @@
|
||||
# depd
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Linux Build][travis-image]][travis-url]
|
||||
[![Windows Build][appveyor-image]][appveyor-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Deprecate all the things
|
||||
|
||||
> With great modules comes great responsibility; mark things deprecated!
|
||||
|
||||
## Install
|
||||
|
||||
This module is installed directly using `npm`:
|
||||
|
||||
```sh
|
||||
$ npm install depd
|
||||
```
|
||||
|
||||
This module can also be bundled with systems like
|
||||
[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/),
|
||||
though by default this module will alter it's API to no longer display or
|
||||
track deprecations.
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var deprecate = require('depd')('my-module')
|
||||
```
|
||||
|
||||
This library allows you to display deprecation messages to your users.
|
||||
This library goes above and beyond with deprecation warnings by
|
||||
introspection of the call stack (but only the bits that it is interested
|
||||
in).
|
||||
|
||||
Instead of just warning on the first invocation of a deprecated
|
||||
function and never again, this module will warn on the first invocation
|
||||
of a deprecated function per unique call site, making it ideal to alert
|
||||
users of all deprecated uses across the code base, rather than just
|
||||
whatever happens to execute first.
|
||||
|
||||
The deprecation warnings from this module also include the file and line
|
||||
information for the call into the module that the deprecated function was
|
||||
in.
|
||||
|
||||
**NOTE** this library has a similar interface to the `debug` module, and
|
||||
this module uses the calling file to get the boundary for the call stacks,
|
||||
so you should always create a new `deprecate` object in each file and not
|
||||
within some central file.
|
||||
|
||||
### depd(namespace)
|
||||
|
||||
Create a new deprecate function that uses the given namespace name in the
|
||||
messages and will display the call site prior to the stack entering the
|
||||
file this function was called from. It is highly suggested you use the
|
||||
name of your module as the namespace.
|
||||
|
||||
### deprecate(message)
|
||||
|
||||
Call this function from deprecated code to display a deprecation message.
|
||||
This message will appear once per unique caller site. Caller site is the
|
||||
first call site in the stack in a different file from the caller of this
|
||||
function.
|
||||
|
||||
If the message is omitted, a message is generated for you based on the site
|
||||
of the `deprecate()` call and will display the name of the function called,
|
||||
similar to the name displayed in a stack trace.
|
||||
|
||||
### deprecate.function(fn, message)
|
||||
|
||||
Call this function to wrap a given function in a deprecation message on any
|
||||
call to the function. An optional message can be supplied to provide a custom
|
||||
message.
|
||||
|
||||
### deprecate.property(obj, prop, message)
|
||||
|
||||
Call this function to wrap a given property on object in a deprecation message
|
||||
on any accessing or setting of the property. An optional message can be supplied
|
||||
to provide a custom message.
|
||||
|
||||
The method must be called on the object where the property belongs (not
|
||||
inherited from the prototype).
|
||||
|
||||
If the property is a data descriptor, it will be converted to an accessor
|
||||
descriptor in order to display the deprecation message.
|
||||
|
||||
### process.on('deprecation', fn)
|
||||
|
||||
This module will allow easy capturing of deprecation errors by emitting the
|
||||
errors as the type "deprecation" on the global `process`. If there are no
|
||||
listeners for this type, the errors are written to STDERR as normal, but if
|
||||
there are any listeners, nothing will be written to STDERR and instead only
|
||||
emitted. From there, you can write the errors in a different format or to a
|
||||
logging source.
|
||||
|
||||
The error represents the deprecation and is emitted only once with the same
|
||||
rules as writing to STDERR. The error has the following properties:
|
||||
|
||||
- `message` - This is the message given by the library
|
||||
- `name` - This is always `'DeprecationError'`
|
||||
- `namespace` - This is the namespace the deprecation came from
|
||||
- `stack` - This is the stack of the call to the deprecated thing
|
||||
|
||||
Example `error.stack` output:
|
||||
|
||||
```
|
||||
DeprecationError: my-cool-module deprecated oldfunction
|
||||
at Object.<anonymous> ([eval]-wrapper:6:22)
|
||||
at Module._compile (module.js:456:26)
|
||||
at evalScript (node.js:532:25)
|
||||
at startup (node.js:80:7)
|
||||
at node.js:902:3
|
||||
```
|
||||
|
||||
### process.env.NO_DEPRECATION
|
||||
|
||||
As a user of modules that are deprecated, the environment variable `NO_DEPRECATION`
|
||||
is provided as a quick solution to silencing deprecation warnings from being
|
||||
output. The format of this is similar to that of `DEBUG`:
|
||||
|
||||
```sh
|
||||
$ NO_DEPRECATION=my-module,othermod node app.js
|
||||
```
|
||||
|
||||
This will suppress deprecations from being output for "my-module" and "othermod".
|
||||
The value is a list of comma-separated namespaces. To suppress every warning
|
||||
across all namespaces, use the value `*` for a namespace.
|
||||
|
||||
Providing the argument `--no-deprecation` to the `node` executable will suppress
|
||||
all deprecations (only available in Node.js 0.8 or higher).
|
||||
|
||||
**NOTE** This will not suppress the deperecations given to any "deprecation"
|
||||
event listeners, just the output to STDERR.
|
||||
|
||||
### process.env.TRACE_DEPRECATION
|
||||
|
||||
As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION`
|
||||
is provided as a solution to getting more detailed location information in deprecation
|
||||
warnings by including the entire stack trace. The format of this is the same as
|
||||
`NO_DEPRECATION`:
|
||||
|
||||
```sh
|
||||
$ TRACE_DEPRECATION=my-module,othermod node app.js
|
||||
```
|
||||
|
||||
This will include stack traces for deprecations being output for "my-module" and
|
||||
"othermod". The value is a list of comma-separated namespaces. To trace every
|
||||
warning across all namespaces, use the value `*` for a namespace.
|
||||
|
||||
Providing the argument `--trace-deprecation` to the `node` executable will trace
|
||||
all deprecations (only available in Node.js 0.8 or higher).
|
||||
|
||||
**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`.
|
||||
|
||||
## Display
|
||||
|
||||

|
||||
|
||||
When a user calls a function in your library that you mark deprecated, they
|
||||
will see the following written to STDERR (in the given colors, similar colors
|
||||
and layout to the `debug` module):
|
||||
|
||||
```
|
||||
bright cyan bright yellow
|
||||
| | reset cyan
|
||||
| | | |
|
||||
▼ ▼ ▼ ▼
|
||||
my-cool-module deprecated oldfunction [eval]-wrapper:6:22
|
||||
▲ ▲ ▲ ▲
|
||||
| | | |
|
||||
namespace | | location of mycoolmod.oldfunction() call
|
||||
| deprecation message
|
||||
the word "deprecated"
|
||||
```
|
||||
|
||||
If the user redirects their STDERR to a file or somewhere that does not support
|
||||
colors, they see (similar layout to the `debug` module):
|
||||
|
||||
```
|
||||
Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22
|
||||
▲ ▲ ▲ ▲ ▲
|
||||
| | | | |
|
||||
timestamp of message namespace | | location of mycoolmod.oldfunction() call
|
||||
| deprecation message
|
||||
the word "deprecated"
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Deprecating all calls to a function
|
||||
|
||||
This will display a deprecated message about "oldfunction" being deprecated
|
||||
from "my-module" on STDERR.
|
||||
|
||||
```js
|
||||
var deprecate = require('depd')('my-cool-module')
|
||||
|
||||
// message automatically derived from function name
|
||||
// Object.oldfunction
|
||||
exports.oldfunction = deprecate.function(function oldfunction () {
|
||||
// all calls to function are deprecated
|
||||
})
|
||||
|
||||
// specific message
|
||||
exports.oldfunction = deprecate.function(function () {
|
||||
// all calls to function are deprecated
|
||||
}, 'oldfunction')
|
||||
```
|
||||
|
||||
### Conditionally deprecating a function call
|
||||
|
||||
This will display a deprecated message about "weirdfunction" being deprecated
|
||||
from "my-module" on STDERR when called with less than 2 arguments.
|
||||
|
||||
```js
|
||||
var deprecate = require('depd')('my-cool-module')
|
||||
|
||||
exports.weirdfunction = function () {
|
||||
if (arguments.length < 2) {
|
||||
// calls with 0 or 1 args are deprecated
|
||||
deprecate('weirdfunction args < 2')
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When calling `deprecate` as a function, the warning is counted per call site
|
||||
within your own module, so you can display different deprecations depending
|
||||
on different situations and the users will still get all the warnings:
|
||||
|
||||
```js
|
||||
var deprecate = require('depd')('my-cool-module')
|
||||
|
||||
exports.weirdfunction = function () {
|
||||
if (arguments.length < 2) {
|
||||
// calls with 0 or 1 args are deprecated
|
||||
deprecate('weirdfunction args < 2')
|
||||
} else if (typeof arguments[0] !== 'string') {
|
||||
// calls with non-string first argument are deprecated
|
||||
deprecate('weirdfunction non-string first arg')
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Deprecating property access
|
||||
|
||||
This will display a deprecated message about "oldprop" being deprecated
|
||||
from "my-module" on STDERR when accessed. A deprecation will be displayed
|
||||
when setting the value and when getting the value.
|
||||
|
||||
```js
|
||||
var deprecate = require('depd')('my-cool-module')
|
||||
|
||||
exports.oldprop = 'something'
|
||||
|
||||
// message automatically derives from property name
|
||||
deprecate.property(exports, 'oldprop')
|
||||
|
||||
// explicit message
|
||||
deprecate.property(exports, 'oldprop', 'oldprop >= 0.10')
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-version-image]: https://img.shields.io/npm/v/depd.svg
|
||||
[npm-downloads-image]: https://img.shields.io/npm/dm/depd.svg
|
||||
[npm-url]: https://npmjs.org/package/depd
|
||||
[travis-image]: https://img.shields.io/travis/dougwilson/nodejs-depd/master.svg?label=linux
|
||||
[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/nodejs-depd/master.svg?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd
|
||||
[coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master
|
||||
[node-image]: https://img.shields.io/node/v/depd.svg
|
||||
[node-url]: https://nodejs.org/en/download/
|
||||
522
node_modules/serve-static/node_modules/depd/index.js
generated
vendored
Normal file
522
node_modules/serve-static/node_modules/depd/index.js
generated
vendored
Normal file
@@ -0,0 +1,522 @@
|
||||
/*!
|
||||
* depd
|
||||
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var callSiteToString = require('./lib/compat').callSiteToString
|
||||
var eventListenerCount = require('./lib/compat').eventListenerCount
|
||||
var relative = require('path').relative
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = depd
|
||||
|
||||
/**
|
||||
* Get the path to base files on.
|
||||
*/
|
||||
|
||||
var basePath = process.cwd()
|
||||
|
||||
/**
|
||||
* Determine if namespace is contained in the string.
|
||||
*/
|
||||
|
||||
function containsNamespace (str, namespace) {
|
||||
var vals = str.split(/[ ,]+/)
|
||||
var ns = String(namespace).toLowerCase()
|
||||
|
||||
for (var i = 0; i < vals.length; i++) {
|
||||
var val = vals[i]
|
||||
|
||||
// namespace contained
|
||||
if (val && (val === '*' || val.toLowerCase() === ns)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a data descriptor to accessor descriptor.
|
||||
*/
|
||||
|
||||
function convertDataDescriptorToAccessor (obj, prop, message) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
||||
var value = descriptor.value
|
||||
|
||||
descriptor.get = function getter () { return value }
|
||||
|
||||
if (descriptor.writable) {
|
||||
descriptor.set = function setter (val) { return (value = val) }
|
||||
}
|
||||
|
||||
delete descriptor.value
|
||||
delete descriptor.writable
|
||||
|
||||
Object.defineProperty(obj, prop, descriptor)
|
||||
|
||||
return descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* Create arguments string to keep arity.
|
||||
*/
|
||||
|
||||
function createArgumentsString (arity) {
|
||||
var str = ''
|
||||
|
||||
for (var i = 0; i < arity; i++) {
|
||||
str += ', arg' + i
|
||||
}
|
||||
|
||||
return str.substr(2)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create stack string from stack.
|
||||
*/
|
||||
|
||||
function createStackString (stack) {
|
||||
var str = this.name + ': ' + this.namespace
|
||||
|
||||
if (this.message) {
|
||||
str += ' deprecated ' + this.message
|
||||
}
|
||||
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
str += '\n at ' + callSiteToString(stack[i])
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
/**
|
||||
* Create deprecate for namespace in caller.
|
||||
*/
|
||||
|
||||
function depd (namespace) {
|
||||
if (!namespace) {
|
||||
throw new TypeError('argument namespace is required')
|
||||
}
|
||||
|
||||
var stack = getStack()
|
||||
var site = callSiteLocation(stack[1])
|
||||
var file = site[0]
|
||||
|
||||
function deprecate (message) {
|
||||
// call to self as log
|
||||
log.call(deprecate, message)
|
||||
}
|
||||
|
||||
deprecate._file = file
|
||||
deprecate._ignored = isignored(namespace)
|
||||
deprecate._namespace = namespace
|
||||
deprecate._traced = istraced(namespace)
|
||||
deprecate._warned = Object.create(null)
|
||||
|
||||
deprecate.function = wrapfunction
|
||||
deprecate.property = wrapproperty
|
||||
|
||||
return deprecate
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if namespace is ignored.
|
||||
*/
|
||||
|
||||
function isignored (namespace) {
|
||||
/* istanbul ignore next: tested in a child processs */
|
||||
if (process.noDeprecation) {
|
||||
// --no-deprecation support
|
||||
return true
|
||||
}
|
||||
|
||||
var str = process.env.NO_DEPRECATION || ''
|
||||
|
||||
// namespace ignored
|
||||
return containsNamespace(str, namespace)
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if namespace is traced.
|
||||
*/
|
||||
|
||||
function istraced (namespace) {
|
||||
/* istanbul ignore next: tested in a child processs */
|
||||
if (process.traceDeprecation) {
|
||||
// --trace-deprecation support
|
||||
return true
|
||||
}
|
||||
|
||||
var str = process.env.TRACE_DEPRECATION || ''
|
||||
|
||||
// namespace traced
|
||||
return containsNamespace(str, namespace)
|
||||
}
|
||||
|
||||
/**
|
||||
* Display deprecation message.
|
||||
*/
|
||||
|
||||
function log (message, site) {
|
||||
var haslisteners = eventListenerCount(process, 'deprecation') !== 0
|
||||
|
||||
// abort early if no destination
|
||||
if (!haslisteners && this._ignored) {
|
||||
return
|
||||
}
|
||||
|
||||
var caller
|
||||
var callFile
|
||||
var callSite
|
||||
var depSite
|
||||
var i = 0
|
||||
var seen = false
|
||||
var stack = getStack()
|
||||
var file = this._file
|
||||
|
||||
if (site) {
|
||||
// provided site
|
||||
depSite = site
|
||||
callSite = callSiteLocation(stack[1])
|
||||
callSite.name = depSite.name
|
||||
file = callSite[0]
|
||||
} else {
|
||||
// get call site
|
||||
i = 2
|
||||
depSite = callSiteLocation(stack[i])
|
||||
callSite = depSite
|
||||
}
|
||||
|
||||
// get caller of deprecated thing in relation to file
|
||||
for (; i < stack.length; i++) {
|
||||
caller = callSiteLocation(stack[i])
|
||||
callFile = caller[0]
|
||||
|
||||
if (callFile === file) {
|
||||
seen = true
|
||||
} else if (callFile === this._file) {
|
||||
file = this._file
|
||||
} else if (seen) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var key = caller
|
||||
? depSite.join(':') + '__' + caller.join(':')
|
||||
: undefined
|
||||
|
||||
if (key !== undefined && key in this._warned) {
|
||||
// already warned
|
||||
return
|
||||
}
|
||||
|
||||
this._warned[key] = true
|
||||
|
||||
// generate automatic message from call site
|
||||
var msg = message
|
||||
if (!msg) {
|
||||
msg = callSite === depSite || !callSite.name
|
||||
? defaultMessage(depSite)
|
||||
: defaultMessage(callSite)
|
||||
}
|
||||
|
||||
// emit deprecation if listeners exist
|
||||
if (haslisteners) {
|
||||
var err = DeprecationError(this._namespace, msg, stack.slice(i))
|
||||
process.emit('deprecation', err)
|
||||
return
|
||||
}
|
||||
|
||||
// format and write message
|
||||
var format = process.stderr.isTTY
|
||||
? formatColor
|
||||
: formatPlain
|
||||
var output = format.call(this, msg, caller, stack.slice(i))
|
||||
process.stderr.write(output + '\n', 'utf8')
|
||||
}
|
||||
|
||||
/**
|
||||
* Get call site location as array.
|
||||
*/
|
||||
|
||||
function callSiteLocation (callSite) {
|
||||
var file = callSite.getFileName() || '<anonymous>'
|
||||
var line = callSite.getLineNumber()
|
||||
var colm = callSite.getColumnNumber()
|
||||
|
||||
if (callSite.isEval()) {
|
||||
file = callSite.getEvalOrigin() + ', ' + file
|
||||
}
|
||||
|
||||
var site = [file, line, colm]
|
||||
|
||||
site.callSite = callSite
|
||||
site.name = callSite.getFunctionName()
|
||||
|
||||
return site
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a default message from the site.
|
||||
*/
|
||||
|
||||
function defaultMessage (site) {
|
||||
var callSite = site.callSite
|
||||
var funcName = site.name
|
||||
|
||||
// make useful anonymous name
|
||||
if (!funcName) {
|
||||
funcName = '<anonymous@' + formatLocation(site) + '>'
|
||||
}
|
||||
|
||||
var context = callSite.getThis()
|
||||
var typeName = context && callSite.getTypeName()
|
||||
|
||||
// ignore useless type name
|
||||
if (typeName === 'Object') {
|
||||
typeName = undefined
|
||||
}
|
||||
|
||||
// make useful type name
|
||||
if (typeName === 'Function') {
|
||||
typeName = context.name || typeName
|
||||
}
|
||||
|
||||
return typeName && callSite.getMethodName()
|
||||
? typeName + '.' + funcName
|
||||
: funcName
|
||||
}
|
||||
|
||||
/**
|
||||
* Format deprecation message without color.
|
||||
*/
|
||||
|
||||
function formatPlain (msg, caller, stack) {
|
||||
var timestamp = new Date().toUTCString()
|
||||
|
||||
var formatted = timestamp +
|
||||
' ' + this._namespace +
|
||||
' deprecated ' + msg
|
||||
|
||||
// add stack trace
|
||||
if (this._traced) {
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
formatted += '\n at ' + callSiteToString(stack[i])
|
||||
}
|
||||
|
||||
return formatted
|
||||
}
|
||||
|
||||
if (caller) {
|
||||
formatted += ' at ' + formatLocation(caller)
|
||||
}
|
||||
|
||||
return formatted
|
||||
}
|
||||
|
||||
/**
|
||||
* Format deprecation message with color.
|
||||
*/
|
||||
|
||||
function formatColor (msg, caller, stack) {
|
||||
var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
|
||||
' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
|
||||
' \x1b[0m' + msg + '\x1b[39m' // reset
|
||||
|
||||
// add stack trace
|
||||
if (this._traced) {
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
formatted += '\n \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan
|
||||
}
|
||||
|
||||
return formatted
|
||||
}
|
||||
|
||||
if (caller) {
|
||||
formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan
|
||||
}
|
||||
|
||||
return formatted
|
||||
}
|
||||
|
||||
/**
|
||||
* Format call site location.
|
||||
*/
|
||||
|
||||
function formatLocation (callSite) {
|
||||
return relative(basePath, callSite[0]) +
|
||||
':' + callSite[1] +
|
||||
':' + callSite[2]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stack as array of call sites.
|
||||
*/
|
||||
|
||||
function getStack () {
|
||||
var limit = Error.stackTraceLimit
|
||||
var obj = {}
|
||||
var prep = Error.prepareStackTrace
|
||||
|
||||
Error.prepareStackTrace = prepareObjectStackTrace
|
||||
Error.stackTraceLimit = Math.max(10, limit)
|
||||
|
||||
// capture the stack
|
||||
Error.captureStackTrace(obj)
|
||||
|
||||
// slice this function off the top
|
||||
var stack = obj.stack.slice(1)
|
||||
|
||||
Error.prepareStackTrace = prep
|
||||
Error.stackTraceLimit = limit
|
||||
|
||||
return stack
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture call site stack from v8.
|
||||
*/
|
||||
|
||||
function prepareObjectStackTrace (obj, stack) {
|
||||
return stack
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a wrapped function in a deprecation message.
|
||||
*/
|
||||
|
||||
function wrapfunction (fn, message) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new TypeError('argument fn must be a function')
|
||||
}
|
||||
|
||||
var args = createArgumentsString(fn.length)
|
||||
var deprecate = this // eslint-disable-line no-unused-vars
|
||||
var stack = getStack()
|
||||
var site = callSiteLocation(stack[1])
|
||||
|
||||
site.name = fn.name
|
||||
|
||||
// eslint-disable-next-line no-eval
|
||||
var deprecatedfn = eval('(function (' + args + ') {\n' +
|
||||
'"use strict"\n' +
|
||||
'log.call(deprecate, message, site)\n' +
|
||||
'return fn.apply(this, arguments)\n' +
|
||||
'})')
|
||||
|
||||
return deprecatedfn
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap property in a deprecation message.
|
||||
*/
|
||||
|
||||
function wrapproperty (obj, prop, message) {
|
||||
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
throw new TypeError('argument obj must be object')
|
||||
}
|
||||
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
||||
|
||||
if (!descriptor) {
|
||||
throw new TypeError('must call property on owner object')
|
||||
}
|
||||
|
||||
if (!descriptor.configurable) {
|
||||
throw new TypeError('property must be configurable')
|
||||
}
|
||||
|
||||
var deprecate = this
|
||||
var stack = getStack()
|
||||
var site = callSiteLocation(stack[1])
|
||||
|
||||
// set site name
|
||||
site.name = prop
|
||||
|
||||
// convert data descriptor
|
||||
if ('value' in descriptor) {
|
||||
descriptor = convertDataDescriptorToAccessor(obj, prop, message)
|
||||
}
|
||||
|
||||
var get = descriptor.get
|
||||
var set = descriptor.set
|
||||
|
||||
// wrap getter
|
||||
if (typeof get === 'function') {
|
||||
descriptor.get = function getter () {
|
||||
log.call(deprecate, message, site)
|
||||
return get.apply(this, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
// wrap setter
|
||||
if (typeof set === 'function') {
|
||||
descriptor.set = function setter () {
|
||||
log.call(deprecate, message, site)
|
||||
return set.apply(this, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(obj, prop, descriptor)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create DeprecationError for deprecation
|
||||
*/
|
||||
|
||||
function DeprecationError (namespace, message, stack) {
|
||||
var error = new Error()
|
||||
var stackString
|
||||
|
||||
Object.defineProperty(error, 'constructor', {
|
||||
value: DeprecationError
|
||||
})
|
||||
|
||||
Object.defineProperty(error, 'message', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: message,
|
||||
writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(error, 'name', {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: 'DeprecationError',
|
||||
writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(error, 'namespace', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: namespace,
|
||||
writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(error, 'stack', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: function () {
|
||||
if (stackString !== undefined) {
|
||||
return stackString
|
||||
}
|
||||
|
||||
// prepare stack trace
|
||||
return (stackString = createStackString.call(this, stack))
|
||||
},
|
||||
set: function setter (val) {
|
||||
stackString = val
|
||||
}
|
||||
})
|
||||
|
||||
return error
|
||||
}
|
||||
77
node_modules/serve-static/node_modules/depd/lib/browser/index.js
generated
vendored
Normal file
77
node_modules/serve-static/node_modules/depd/lib/browser/index.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*!
|
||||
* depd
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = depd
|
||||
|
||||
/**
|
||||
* Create deprecate for namespace in caller.
|
||||
*/
|
||||
|
||||
function depd (namespace) {
|
||||
if (!namespace) {
|
||||
throw new TypeError('argument namespace is required')
|
||||
}
|
||||
|
||||
function deprecate (message) {
|
||||
// no-op in browser
|
||||
}
|
||||
|
||||
deprecate._file = undefined
|
||||
deprecate._ignored = true
|
||||
deprecate._namespace = namespace
|
||||
deprecate._traced = false
|
||||
deprecate._warned = Object.create(null)
|
||||
|
||||
deprecate.function = wrapfunction
|
||||
deprecate.property = wrapproperty
|
||||
|
||||
return deprecate
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a wrapped function in a deprecation message.
|
||||
*
|
||||
* This is a no-op version of the wrapper, which does nothing but call
|
||||
* validation.
|
||||
*/
|
||||
|
||||
function wrapfunction (fn, message) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new TypeError('argument fn must be a function')
|
||||
}
|
||||
|
||||
return fn
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap property in a deprecation message.
|
||||
*
|
||||
* This is a no-op version of the wrapper, which does nothing but call
|
||||
* validation.
|
||||
*/
|
||||
|
||||
function wrapproperty (obj, prop, message) {
|
||||
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
throw new TypeError('argument obj must be object')
|
||||
}
|
||||
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
||||
|
||||
if (!descriptor) {
|
||||
throw new TypeError('must call property on owner object')
|
||||
}
|
||||
|
||||
if (!descriptor.configurable) {
|
||||
throw new TypeError('property must be configurable')
|
||||
}
|
||||
}
|
||||
103
node_modules/serve-static/node_modules/depd/lib/compat/callsite-tostring.js
generated
vendored
Normal file
103
node_modules/serve-static/node_modules/depd/lib/compat/callsite-tostring.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/*!
|
||||
* depd
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = callSiteToString
|
||||
|
||||
/**
|
||||
* Format a CallSite file location to a string.
|
||||
*/
|
||||
|
||||
function callSiteFileLocation (callSite) {
|
||||
var fileName
|
||||
var fileLocation = ''
|
||||
|
||||
if (callSite.isNative()) {
|
||||
fileLocation = 'native'
|
||||
} else if (callSite.isEval()) {
|
||||
fileName = callSite.getScriptNameOrSourceURL()
|
||||
if (!fileName) {
|
||||
fileLocation = callSite.getEvalOrigin()
|
||||
}
|
||||
} else {
|
||||
fileName = callSite.getFileName()
|
||||
}
|
||||
|
||||
if (fileName) {
|
||||
fileLocation += fileName
|
||||
|
||||
var lineNumber = callSite.getLineNumber()
|
||||
if (lineNumber != null) {
|
||||
fileLocation += ':' + lineNumber
|
||||
|
||||
var columnNumber = callSite.getColumnNumber()
|
||||
if (columnNumber) {
|
||||
fileLocation += ':' + columnNumber
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fileLocation || 'unknown source'
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a CallSite to a string.
|
||||
*/
|
||||
|
||||
function callSiteToString (callSite) {
|
||||
var addSuffix = true
|
||||
var fileLocation = callSiteFileLocation(callSite)
|
||||
var functionName = callSite.getFunctionName()
|
||||
var isConstructor = callSite.isConstructor()
|
||||
var isMethodCall = !(callSite.isToplevel() || isConstructor)
|
||||
var line = ''
|
||||
|
||||
if (isMethodCall) {
|
||||
var methodName = callSite.getMethodName()
|
||||
var typeName = getConstructorName(callSite)
|
||||
|
||||
if (functionName) {
|
||||
if (typeName && functionName.indexOf(typeName) !== 0) {
|
||||
line += typeName + '.'
|
||||
}
|
||||
|
||||
line += functionName
|
||||
|
||||
if (methodName && functionName.lastIndexOf('.' + methodName) !== functionName.length - methodName.length - 1) {
|
||||
line += ' [as ' + methodName + ']'
|
||||
}
|
||||
} else {
|
||||
line += typeName + '.' + (methodName || '<anonymous>')
|
||||
}
|
||||
} else if (isConstructor) {
|
||||
line += 'new ' + (functionName || '<anonymous>')
|
||||
} else if (functionName) {
|
||||
line += functionName
|
||||
} else {
|
||||
addSuffix = false
|
||||
line += fileLocation
|
||||
}
|
||||
|
||||
if (addSuffix) {
|
||||
line += ' (' + fileLocation + ')'
|
||||
}
|
||||
|
||||
return line
|
||||
}
|
||||
|
||||
/**
|
||||
* Get constructor name of reviver.
|
||||
*/
|
||||
|
||||
function getConstructorName (obj) {
|
||||
var receiver = obj.receiver
|
||||
return (receiver.constructor && receiver.constructor.name) || null
|
||||
}
|
||||
22
node_modules/serve-static/node_modules/depd/lib/compat/event-listener-count.js
generated
vendored
Normal file
22
node_modules/serve-static/node_modules/depd/lib/compat/event-listener-count.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* depd
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = eventListenerCount
|
||||
|
||||
/**
|
||||
* Get the count of listeners on an event emitter of a specific type.
|
||||
*/
|
||||
|
||||
function eventListenerCount (emitter, type) {
|
||||
return emitter.listeners(type).length
|
||||
}
|
||||
79
node_modules/serve-static/node_modules/depd/lib/compat/index.js
generated
vendored
Normal file
79
node_modules/serve-static/node_modules/depd/lib/compat/index.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*!
|
||||
* depd
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
lazyProperty(module.exports, 'callSiteToString', function callSiteToString () {
|
||||
var limit = Error.stackTraceLimit
|
||||
var obj = {}
|
||||
var prep = Error.prepareStackTrace
|
||||
|
||||
function prepareObjectStackTrace (obj, stack) {
|
||||
return stack
|
||||
}
|
||||
|
||||
Error.prepareStackTrace = prepareObjectStackTrace
|
||||
Error.stackTraceLimit = 2
|
||||
|
||||
// capture the stack
|
||||
Error.captureStackTrace(obj)
|
||||
|
||||
// slice the stack
|
||||
var stack = obj.stack.slice()
|
||||
|
||||
Error.prepareStackTrace = prep
|
||||
Error.stackTraceLimit = limit
|
||||
|
||||
return stack[0].toString ? toString : require('./callsite-tostring')
|
||||
})
|
||||
|
||||
lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount () {
|
||||
return EventEmitter.listenerCount || require('./event-listener-count')
|
||||
})
|
||||
|
||||
/**
|
||||
* Define a lazy property.
|
||||
*/
|
||||
|
||||
function lazyProperty (obj, prop, getter) {
|
||||
function get () {
|
||||
var val = getter()
|
||||
|
||||
Object.defineProperty(obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: val
|
||||
})
|
||||
|
||||
return val
|
||||
}
|
||||
|
||||
Object.defineProperty(obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: get
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the obj
|
||||
*/
|
||||
|
||||
function toString (obj) {
|
||||
return obj.toString()
|
||||
}
|
||||
41
node_modules/serve-static/node_modules/depd/package.json
generated
vendored
Normal file
41
node_modules/serve-static/node_modules/depd/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "depd",
|
||||
"description": "Deprecate all the things",
|
||||
"version": "1.1.2",
|
||||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"deprecate",
|
||||
"deprecated"
|
||||
],
|
||||
"repository": "dougwilson/nodejs-depd",
|
||||
"browser": "lib/browser/index.js",
|
||||
"devDependencies": {
|
||||
"benchmark": "2.1.4",
|
||||
"beautify-benchmark": "0.2.4",
|
||||
"eslint": "3.19.0",
|
||||
"eslint-config-standard": "7.1.0",
|
||||
"eslint-plugin-markdown": "1.0.0-beta.7",
|
||||
"eslint-plugin-promise": "3.6.0",
|
||||
"eslint-plugin-standard": "3.0.1",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "~1.21.5"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"History.md",
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"Readme.md"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node benchmark/index.js",
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --bail test/",
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --no-exit test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/"
|
||||
}
|
||||
}
|
||||
22
node_modules/serve-static/node_modules/destroy/LICENSE
generated
vendored
Normal file
22
node_modules/serve-static/node_modules/destroy/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
60
node_modules/serve-static/node_modules/destroy/README.md
generated
vendored
Normal file
60
node_modules/serve-static/node_modules/destroy/README.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# Destroy
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![Build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
[![Gittip][gittip-image]][gittip-url]
|
||||
|
||||
Destroy a stream.
|
||||
|
||||
This module is meant to ensure a stream gets destroyed, handling different APIs
|
||||
and Node.js bugs.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
```
|
||||
|
||||
### destroy(stream)
|
||||
|
||||
Destroy the given stream. In most cases, this is identical to a simple
|
||||
`stream.destroy()` call. The rules are as follows for a given stream:
|
||||
|
||||
1. If the `stream` is an instance of `ReadStream`, then call `stream.destroy()`
|
||||
and add a listener to the `open` event to call `stream.close()` if it is
|
||||
fired. This is for a Node.js bug that will leak a file descriptor if
|
||||
`.destroy()` is called before `open`.
|
||||
2. If the `stream` is not an instance of `Stream`, then nothing happens.
|
||||
3. If the `stream` has a `.destroy()` method, then call it.
|
||||
|
||||
The function returns the `stream` passed in as the argument.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
|
||||
var fs = require('fs')
|
||||
var stream = fs.createReadStream('package.json')
|
||||
|
||||
// ... and later
|
||||
destroy(stream)
|
||||
```
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square
|
||||
[npm-url]: https://npmjs.org/package/destroy
|
||||
[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square
|
||||
[github-url]: https://github.com/stream-utils/destroy/tags
|
||||
[travis-image]: https://img.shields.io/travis/stream-utils/destroy.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/stream-utils/destroy
|
||||
[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master
|
||||
[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square
|
||||
[license-url]: LICENSE.md
|
||||
[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square
|
||||
[downloads-url]: https://npmjs.org/package/destroy
|
||||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
|
||||
[gittip-url]: https://www.gittip.com/jonathanong/
|
||||
75
node_modules/serve-static/node_modules/destroy/index.js
generated
vendored
Normal file
75
node_modules/serve-static/node_modules/destroy/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*!
|
||||
* destroy
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var ReadStream = require('fs').ReadStream
|
||||
var Stream = require('stream')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = destroy
|
||||
|
||||
/**
|
||||
* Destroy a stream.
|
||||
*
|
||||
* @param {object} stream
|
||||
* @public
|
||||
*/
|
||||
|
||||
function destroy(stream) {
|
||||
if (stream instanceof ReadStream) {
|
||||
return destroyReadStream(stream)
|
||||
}
|
||||
|
||||
if (!(stream instanceof Stream)) {
|
||||
return stream
|
||||
}
|
||||
|
||||
if (typeof stream.destroy === 'function') {
|
||||
stream.destroy()
|
||||
}
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a ReadStream.
|
||||
*
|
||||
* @param {object} stream
|
||||
* @private
|
||||
*/
|
||||
|
||||
function destroyReadStream(stream) {
|
||||
stream.destroy()
|
||||
|
||||
if (typeof stream.close === 'function') {
|
||||
// node.js core bug work-around
|
||||
stream.on('open', onOpenClose)
|
||||
}
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
/**
|
||||
* On open handler to close stream.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function onOpenClose() {
|
||||
if (typeof this.fd === 'number') {
|
||||
// actually close down the fd
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
37
node_modules/serve-static/node_modules/destroy/package.json
generated
vendored
Normal file
37
node_modules/serve-static/node_modules/destroy/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "destroy",
|
||||
"description": "destroy a stream if possible",
|
||||
"version": "1.0.4",
|
||||
"author": {
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com",
|
||||
"twitter": "https://twitter.com/jongleberry"
|
||||
},
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "stream-utils/destroy",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "2.3.4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"LICENSE"
|
||||
],
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams",
|
||||
"destroy",
|
||||
"cleanup",
|
||||
"leak",
|
||||
"fd"
|
||||
]
|
||||
}
|
||||
24
node_modules/serve-static/node_modules/escape-html/LICENSE
generated
vendored
Normal file
24
node_modules/serve-static/node_modules/escape-html/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2013 TJ Holowaychuk
|
||||
Copyright (c) 2015 Andreas Lubbe
|
||||
Copyright (c) 2015 Tiancheng "Timothy" Gu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
43
node_modules/serve-static/node_modules/escape-html/Readme.md
generated
vendored
Normal file
43
node_modules/serve-static/node_modules/escape-html/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
# escape-html
|
||||
|
||||
Escape string for use in HTML
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var escape = require('escape-html');
|
||||
var html = escape('foo & bar');
|
||||
// -> foo & bar
|
||||
```
|
||||
|
||||
## Benchmark
|
||||
|
||||
```
|
||||
$ npm run-script bench
|
||||
|
||||
> escape-html@1.0.3 bench nodejs-escape-html
|
||||
> node benchmark/index.js
|
||||
|
||||
|
||||
http_parser@1.0
|
||||
node@0.10.33
|
||||
v8@3.14.5.9
|
||||
ares@1.9.0-DEV
|
||||
uv@0.10.29
|
||||
zlib@1.2.3
|
||||
modules@11
|
||||
openssl@1.0.1j
|
||||
|
||||
1 test completed.
|
||||
2 tests completed.
|
||||
3 tests completed.
|
||||
|
||||
no special characters x 19,435,271 ops/sec ±0.85% (187 runs sampled)
|
||||
single special character x 6,132,421 ops/sec ±0.67% (194 runs sampled)
|
||||
many special characters x 3,175,826 ops/sec ±0.65% (193 runs sampled)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
78
node_modules/serve-static/node_modules/escape-html/index.js
generated
vendored
Normal file
78
node_modules/serve-static/node_modules/escape-html/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*!
|
||||
* escape-html
|
||||
* Copyright(c) 2012-2013 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Andreas Lubbe
|
||||
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var matchHtmlRegExp = /["'&<>]/;
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = escapeHtml;
|
||||
|
||||
/**
|
||||
* Escape special characters in the given string of html.
|
||||
*
|
||||
* @param {string} string The string to escape for inserting into HTML
|
||||
* @return {string}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function escapeHtml(string) {
|
||||
var str = '' + string;
|
||||
var match = matchHtmlRegExp.exec(str);
|
||||
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var escape;
|
||||
var html = '';
|
||||
var index = 0;
|
||||
var lastIndex = 0;
|
||||
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escape = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escape = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escape = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escape = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escape = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lastIndex !== index) {
|
||||
html += str.substring(lastIndex, index);
|
||||
}
|
||||
|
||||
lastIndex = index + 1;
|
||||
html += escape;
|
||||
}
|
||||
|
||||
return lastIndex !== index
|
||||
? html + str.substring(lastIndex, index)
|
||||
: html;
|
||||
}
|
||||
24
node_modules/serve-static/node_modules/escape-html/package.json
generated
vendored
Normal file
24
node_modules/serve-static/node_modules/escape-html/package.json
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "escape-html",
|
||||
"description": "Escape string for use in HTML",
|
||||
"version": "1.0.3",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"escape",
|
||||
"html",
|
||||
"utility"
|
||||
],
|
||||
"repository": "component/escape-html",
|
||||
"devDependencies": {
|
||||
"benchmark": "1.0.0",
|
||||
"beautify-benchmark": "0.2.4"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"Readme.md",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"bench": "node benchmark/index.js"
|
||||
}
|
||||
}
|
||||
76
node_modules/serve-static/node_modules/http-errors/HISTORY.md
generated
vendored
Normal file
76
node_modules/serve-static/node_modules/http-errors/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
2015-02-02 / 1.3.1
|
||||
==================
|
||||
|
||||
* Fix regression where status can be overwritten in `createError` `props`
|
||||
|
||||
2015-02-01 / 1.3.0
|
||||
==================
|
||||
|
||||
* Construct errors using defined constructors from `createError`
|
||||
* Fix error names that are not identifiers
|
||||
- `createError["I'mateapot"]` is now `createError.ImATeapot`
|
||||
* Set a meaningful `name` property on constructed errors
|
||||
|
||||
2014-12-09 / 1.2.8
|
||||
==================
|
||||
|
||||
* Fix stack trace from exported function
|
||||
* Remove `arguments.callee` usage
|
||||
|
||||
2014-10-14 / 1.2.7
|
||||
==================
|
||||
|
||||
* Remove duplicate line
|
||||
|
||||
2014-10-02 / 1.2.6
|
||||
==================
|
||||
|
||||
* Fix `expose` to be `true` for `ClientError` constructor
|
||||
|
||||
2014-09-28 / 1.2.5
|
||||
==================
|
||||
|
||||
* deps: statuses@1
|
||||
|
||||
2014-09-21 / 1.2.4
|
||||
==================
|
||||
|
||||
* Fix dependency version to work with old `npm`s
|
||||
|
||||
2014-09-21 / 1.2.3
|
||||
==================
|
||||
|
||||
* deps: statuses@~1.1.0
|
||||
|
||||
2014-09-21 / 1.2.2
|
||||
==================
|
||||
|
||||
* Fix publish error
|
||||
|
||||
2014-09-21 / 1.2.1
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* Use `inherits` instead of `util`
|
||||
|
||||
2014-09-09 / 1.2.0
|
||||
==================
|
||||
|
||||
* Fix the way inheriting functions
|
||||
* Support `expose` being provided in properties argument
|
||||
|
||||
2014-09-08 / 1.1.0
|
||||
==================
|
||||
|
||||
* Default status to 500
|
||||
* Support provided `error` to extend
|
||||
|
||||
2014-09-08 / 1.0.1
|
||||
==================
|
||||
|
||||
* Fix accepting string message
|
||||
|
||||
2014-09-08 / 1.0.0
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
22
node_modules/serve-static/node_modules/http-errors/LICENSE
generated
vendored
Normal file
22
node_modules/serve-static/node_modules/http-errors/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
63
node_modules/serve-static/node_modules/http-errors/README.md
generated
vendored
Normal file
63
node_modules/serve-static/node_modules/http-errors/README.md
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# http-errors
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Create HTTP errors for Express, Koa, Connect, etc. with ease.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var createError = require('http-errors');
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (!req.user) return next(createError(401, 'Please login to view this page.'));
|
||||
next();
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This is the current API, currently extracted from Koa and subject to change.
|
||||
|
||||
### Error Properties
|
||||
|
||||
- `message`
|
||||
- `status` and `statusCode` - the status code of the error, defaulting to `500`
|
||||
|
||||
### createError([status], [message], [properties])
|
||||
|
||||
```js
|
||||
var err = createError(404, 'This video does not exist!');
|
||||
```
|
||||
|
||||
- `status: 500` - the status code as a number
|
||||
- `message` - the message of the error, defaulting to node's text for that status code.
|
||||
- `properties` - custom properties to attach to the object
|
||||
|
||||
### new createError\[code || name\](\[msg]\))
|
||||
|
||||
```js
|
||||
var err = new createError.NotFound();
|
||||
```
|
||||
|
||||
- `code` - the status code as a number
|
||||
- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/http-errors.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/http-errors
|
||||
[node-version-image]: https://img.shields.io/node/v/http-errors.svg?style=flat
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/jshttp/http-errors
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg?style=flat
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/http-errors
|
||||
[downloads-image]: https://img.shields.io/npm/dm/http-errors.svg?style=flat
|
||||
[downloads-url]: https://npmjs.org/package/http-errors
|
||||
120
node_modules/serve-static/node_modules/http-errors/index.js
generated
vendored
Normal file
120
node_modules/serve-static/node_modules/http-errors/index.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
var statuses = require('statuses');
|
||||
var inherits = require('inherits');
|
||||
|
||||
function toIdentifier(str) {
|
||||
return str.split(' ').map(function (token) {
|
||||
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
||||
}).join('').replace(/[^ _0-9a-z]/gi, '')
|
||||
}
|
||||
|
||||
exports = module.exports = function httpError() {
|
||||
// so much arity going on ~_~
|
||||
var err;
|
||||
var msg;
|
||||
var status = 500;
|
||||
var props = {};
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var arg = arguments[i];
|
||||
if (arg instanceof Error) {
|
||||
err = arg;
|
||||
status = err.status || err.statusCode || status;
|
||||
continue;
|
||||
}
|
||||
switch (typeof arg) {
|
||||
case 'string':
|
||||
msg = arg;
|
||||
break;
|
||||
case 'number':
|
||||
status = arg;
|
||||
break;
|
||||
case 'object':
|
||||
props = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof status !== 'number' || !statuses[status]) {
|
||||
status = 500
|
||||
}
|
||||
|
||||
// constructor
|
||||
var HttpError = exports[status]
|
||||
|
||||
if (!err) {
|
||||
// create error
|
||||
err = HttpError
|
||||
? new HttpError(msg)
|
||||
: new Error(msg || statuses[status])
|
||||
Error.captureStackTrace(err, httpError)
|
||||
}
|
||||
|
||||
if (!HttpError || !(err instanceof HttpError)) {
|
||||
// add properties to generic error
|
||||
err.expose = status < 500
|
||||
err.status = err.statusCode = status
|
||||
}
|
||||
|
||||
for (var key in props) {
|
||||
if (key !== 'status' && key !== 'statusCode') {
|
||||
err[key] = props[key]
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
};
|
||||
|
||||
// create generic error objects
|
||||
var codes = statuses.codes.filter(function (num) {
|
||||
return num >= 400;
|
||||
});
|
||||
|
||||
codes.forEach(function (code) {
|
||||
var name = toIdentifier(statuses[code])
|
||||
var className = name.match(/Error$/) ? name : name + 'Error'
|
||||
|
||||
if (code >= 500) {
|
||||
var ServerError = function ServerError(msg) {
|
||||
var self = new Error(msg != null ? msg : statuses[code])
|
||||
Error.captureStackTrace(self, ServerError)
|
||||
self.__proto__ = ServerError.prototype
|
||||
Object.defineProperty(self, 'name', {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: className,
|
||||
writable: true
|
||||
})
|
||||
return self
|
||||
}
|
||||
inherits(ServerError, Error);
|
||||
ServerError.prototype.status =
|
||||
ServerError.prototype.statusCode = code;
|
||||
ServerError.prototype.expose = false;
|
||||
exports[code] =
|
||||
exports[name] = ServerError
|
||||
return;
|
||||
}
|
||||
|
||||
var ClientError = function ClientError(msg) {
|
||||
var self = new Error(msg != null ? msg : statuses[code])
|
||||
Error.captureStackTrace(self, ClientError)
|
||||
self.__proto__ = ClientError.prototype
|
||||
Object.defineProperty(self, 'name', {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: className,
|
||||
writable: true
|
||||
})
|
||||
return self
|
||||
}
|
||||
inherits(ClientError, Error);
|
||||
ClientError.prototype.status =
|
||||
ClientError.prototype.statusCode = code;
|
||||
ClientError.prototype.expose = true;
|
||||
exports[code] =
|
||||
exports[name] = ClientError
|
||||
return;
|
||||
});
|
||||
|
||||
// backwards-compatibility
|
||||
exports["I'mateapot"] = exports.ImATeapot
|
||||
38
node_modules/serve-static/node_modules/http-errors/package.json
generated
vendored
Normal file
38
node_modules/serve-static/node_modules/http-errors/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "http-errors",
|
||||
"description": "Create HTTP error objects",
|
||||
"version": "1.3.1",
|
||||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
|
||||
"contributors": [
|
||||
"Alan Plum <me@pluma.io>",
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/http-errors",
|
||||
"dependencies": {
|
||||
"inherits": "~2.0.1",
|
||||
"statuses": "1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0",
|
||||
"mocha": "1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
||||
},
|
||||
"keywords": [
|
||||
"http",
|
||||
"error"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
]
|
||||
}
|
||||
5
node_modules/serve-static/node_modules/ms/.npmignore
generated
vendored
Normal file
5
node_modules/serve-static/node_modules/ms/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
test
|
||||
History.md
|
||||
Makefile
|
||||
component.json
|
||||
66
node_modules/serve-static/node_modules/ms/History.md
generated
vendored
Normal file
66
node_modules/serve-static/node_modules/ms/History.md
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
0.7.1 / 2015-04-20
|
||||
==================
|
||||
|
||||
* prevent extraordinary long inputs (@evilpacket)
|
||||
* Fixed broken readme link
|
||||
|
||||
0.7.0 / 2014-11-24
|
||||
==================
|
||||
|
||||
* add time abbreviations, updated tests and readme for the new units
|
||||
* fix example in the readme.
|
||||
* add LICENSE file
|
||||
|
||||
0.6.2 / 2013-12-05
|
||||
==================
|
||||
|
||||
* Adding repository section to package.json to suppress warning from NPM.
|
||||
|
||||
0.6.1 / 2013-05-10
|
||||
==================
|
||||
|
||||
* fix singularization [visionmedia]
|
||||
|
||||
0.6.0 / 2013-03-15
|
||||
==================
|
||||
|
||||
* fix minutes
|
||||
|
||||
0.5.1 / 2013-02-24
|
||||
==================
|
||||
|
||||
* add component namespace
|
||||
|
||||
0.5.0 / 2012-11-09
|
||||
==================
|
||||
|
||||
* add short formatting as default and .long option
|
||||
* add .license property to component.json
|
||||
* add version to component.json
|
||||
|
||||
0.4.0 / 2012-10-22
|
||||
==================
|
||||
|
||||
* add rounding to fix crazy decimals
|
||||
|
||||
0.3.0 / 2012-09-07
|
||||
==================
|
||||
|
||||
* fix `ms(<String>)` [visionmedia]
|
||||
|
||||
0.2.0 / 2012-09-03
|
||||
==================
|
||||
|
||||
* add component.json [visionmedia]
|
||||
* add days support [visionmedia]
|
||||
* add hours support [visionmedia]
|
||||
* add minutes support [visionmedia]
|
||||
* add seconds support [visionmedia]
|
||||
* add ms string support [visionmedia]
|
||||
* refactor tests to facilitate ms(number) [visionmedia]
|
||||
|
||||
0.1.0 / 2012-03-07
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
20
node_modules/serve-static/node_modules/ms/LICENSE
generated
vendored
Normal file
20
node_modules/serve-static/node_modules/ms/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Guillermo Rauch <rauchg@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
35
node_modules/serve-static/node_modules/ms/README.md
generated
vendored
Normal file
35
node_modules/serve-static/node_modules/ms/README.md
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# ms.js: miliseconds conversion utility
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('100') // 100
|
||||
```
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download).
|
||||
- If a number is supplied to `ms`, a string with a unit is returned.
|
||||
- If a string that contains the number is supplied, it returns it as
|
||||
a number (e.g: it returns `100` for `'100'`).
|
||||
- If you pass a string with a number and a valid unit, the number of
|
||||
equivalent ms is returned.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
125
node_modules/serve-static/node_modules/ms/index.js
generated
vendored
Normal file
125
node_modules/serve-static/node_modules/ms/index.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} options
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options){
|
||||
options = options || {};
|
||||
if ('string' == typeof val) return parse(val);
|
||||
return options.long
|
||||
? long(val)
|
||||
: short(val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = '' + str;
|
||||
if (str.length > 10000) return;
|
||||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
|
||||
if (!match) return;
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function short(ms) {
|
||||
if (ms >= d) return Math.round(ms / d) + 'd';
|
||||
if (ms >= h) return Math.round(ms / h) + 'h';
|
||||
if (ms >= m) return Math.round(ms / m) + 'm';
|
||||
if (ms >= s) return Math.round(ms / s) + 's';
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function long(ms) {
|
||||
return plural(ms, d, 'day')
|
||||
|| plural(ms, h, 'hour')
|
||||
|| plural(ms, m, 'minute')
|
||||
|| plural(ms, s, 'second')
|
||||
|| ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, n, name) {
|
||||
if (ms < n) return;
|
||||
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
|
||||
return Math.ceil(ms / n) + ' ' + name + 's';
|
||||
}
|
||||
20
node_modules/serve-static/node_modules/ms/package.json
generated
vendored
Normal file
20
node_modules/serve-static/node_modules/ms/package.json
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "ms",
|
||||
"version": "0.7.1",
|
||||
"description": "Tiny ms conversion utility",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/guille/ms.js.git"
|
||||
},
|
||||
"main": "./index",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"expect.js": "*",
|
||||
"serve": "*"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"ms/index.js": "index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
88
node_modules/serve-static/node_modules/on-finished/HISTORY.md
generated
vendored
Normal file
88
node_modules/serve-static/node_modules/on-finished/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
2.3.0 / 2015-05-26
|
||||
==================
|
||||
|
||||
* Add defined behavior for HTTP `CONNECT` requests
|
||||
* Add defined behavior for HTTP `Upgrade` requests
|
||||
* deps: ee-first@1.1.1
|
||||
|
||||
2.2.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Fix `isFinished(req)` when data buffered
|
||||
|
||||
2.2.0 / 2014-12-22
|
||||
==================
|
||||
|
||||
* Add message object to callback arguments
|
||||
|
||||
2.1.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* Fix handling of pipelined requests
|
||||
|
||||
2.1.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Check if `socket` is detached
|
||||
* Return `undefined` for `isFinished` if state unknown
|
||||
|
||||
2.0.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Add `isFinished` function
|
||||
* Move to `jshttp` organization
|
||||
* Remove support for plain socket argument
|
||||
* Rename to `on-finished`
|
||||
* Support both `req` and `res` as arguments
|
||||
* deps: ee-first@1.0.5
|
||||
|
||||
1.2.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* Reduce listeners added to emitters
|
||||
- avoids "event emitter leak" warnings when used multiple times on same request
|
||||
|
||||
1.2.1 / 2014-06-08
|
||||
==================
|
||||
|
||||
* Fix returned value when already finished
|
||||
|
||||
1.2.0 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Call callback when called on already-finished socket
|
||||
|
||||
1.1.4 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Support node.js 0.8
|
||||
|
||||
1.1.3 / 2014-04-30
|
||||
==================
|
||||
|
||||
* Make sure errors passed as instanceof `Error`
|
||||
|
||||
1.1.2 / 2014-04-18
|
||||
==================
|
||||
|
||||
* Default the `socket` to passed-in object
|
||||
|
||||
1.1.1 / 2014-01-16
|
||||
==================
|
||||
|
||||
* Rename module to `finished`
|
||||
|
||||
1.1.0 / 2013-12-25
|
||||
==================
|
||||
|
||||
* Call callback when called on already-errored socket
|
||||
|
||||
1.0.1 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Actually pass the error to the callback
|
||||
|
||||
1.0.0 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/serve-static/node_modules/on-finished/LICENSE
generated
vendored
Normal file
23
node_modules/serve-static/node_modules/on-finished/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
154
node_modules/serve-static/node_modules/on-finished/README.md
generated
vendored
Normal file
154
node_modules/serve-static/node_modules/on-finished/README.md
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
# on-finished
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Execute a callback when a HTTP request closes, finishes, or errors.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install on-finished
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var onFinished = require('on-finished')
|
||||
```
|
||||
|
||||
### onFinished(res, listener)
|
||||
|
||||
Attach a listener to listen for the response to finish. The listener will
|
||||
be invoked only once when the response finished. If the response finished
|
||||
to an error, the first argument will contain the error. If the response
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a response would be used to close things associated
|
||||
with the response, like open files.
|
||||
|
||||
Listener is invoked as `listener(err, res)`.
|
||||
|
||||
```js
|
||||
onFinished(res, function (err, res) {
|
||||
// clean up open fds, etc.
|
||||
// err contains the error is request error'd
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished(req, listener)
|
||||
|
||||
Attach a listener to listen for the request to finish. The listener will
|
||||
be invoked only once when the request finished. If the request finished
|
||||
to an error, the first argument will contain the error. If the request
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a request would be used to know when to continue
|
||||
after reading the data.
|
||||
|
||||
Listener is invoked as `listener(err, req)`.
|
||||
|
||||
```js
|
||||
var data = ''
|
||||
|
||||
req.setEncoding('utf8')
|
||||
res.on('data', function (str) {
|
||||
data += str
|
||||
})
|
||||
|
||||
onFinished(req, function (err, req) {
|
||||
// data is read unless there is err
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished.isFinished(res)
|
||||
|
||||
Determine if `res` is already finished. This would be useful to check and
|
||||
not even start certain operations if the response has already finished.
|
||||
|
||||
### onFinished.isFinished(req)
|
||||
|
||||
Determine if `req` is already finished. This would be useful to check and
|
||||
not even start certain operations if the request has already finished.
|
||||
|
||||
## Special Node.js requests
|
||||
|
||||
### HTTP CONNECT method
|
||||
|
||||
The meaning of the `CONNECT` method from RFC 7231, section 4.3.6:
|
||||
|
||||
> The CONNECT method requests that the recipient establish a tunnel to
|
||||
> the destination origin server identified by the request-target and,
|
||||
> if successful, thereafter restrict its behavior to blind forwarding
|
||||
> of packets, in both directions, until the tunnel is closed. Tunnels
|
||||
> are commonly used to create an end-to-end virtual connection, through
|
||||
> one or more proxies, which can then be secured using TLS (Transport
|
||||
> Layer Security, [RFC5246]).
|
||||
|
||||
In Node.js, these request objects come from the `'connect'` event on
|
||||
the HTTP server.
|
||||
|
||||
When this module is used on a HTTP `CONNECT` request, the request is
|
||||
considered "finished" immediately, **due to limitations in the Node.js
|
||||
interface**. This means if the `CONNECT` request contains a request entity,
|
||||
the request will be considered "finished" even before it has been read.
|
||||
|
||||
There is no such thing as a response object to a `CONNECT` request in
|
||||
Node.js, so there is no support for for one.
|
||||
|
||||
### HTTP Upgrade request
|
||||
|
||||
The meaning of the `Upgrade` header from RFC 7230, section 6.1:
|
||||
|
||||
> The "Upgrade" header field is intended to provide a simple mechanism
|
||||
> for transitioning from HTTP/1.1 to some other protocol on the same
|
||||
> connection.
|
||||
|
||||
In Node.js, these request objects come from the `'upgrade'` event on
|
||||
the HTTP server.
|
||||
|
||||
When this module is used on a HTTP request with an `Upgrade` header, the
|
||||
request is considered "finished" immediately, **due to limitations in the
|
||||
Node.js interface**. This means if the `Upgrade` request contains a request
|
||||
entity, the request will be considered "finished" even before it has been
|
||||
read.
|
||||
|
||||
There is no such thing as a response object to a `Upgrade` request in
|
||||
Node.js, so there is no support for for one.
|
||||
|
||||
## Example
|
||||
|
||||
The following code ensures that file descriptors are always closed
|
||||
once the response finishes.
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
var http = require('http')
|
||||
var onFinished = require('on-finished')
|
||||
|
||||
http.createServer(function onRequest(req, res) {
|
||||
var stream = fs.createReadStream('package.json')
|
||||
stream.pipe(res)
|
||||
onFinished(res, function (err) {
|
||||
destroy(stream)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/on-finished.svg
|
||||
[npm-url]: https://npmjs.org/package/on-finished
|
||||
[node-version-image]: https://img.shields.io/node/v/on-finished.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/on-finished/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/on-finished
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg
|
||||
[downloads-url]: https://npmjs.org/package/on-finished
|
||||
196
node_modules/serve-static/node_modules/on-finished/index.js
generated
vendored
Normal file
196
node_modules/serve-static/node_modules/on-finished/index.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
/*!
|
||||
* on-finished
|
||||
* Copyright(c) 2013 Jonathan Ong
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = onFinished
|
||||
module.exports.isFinished = isFinished
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var first = require('ee-first')
|
||||
|
||||
/**
|
||||
* Variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Invoke callback when the response has finished, useful for
|
||||
* cleaning up resources afterwards.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} listener
|
||||
* @return {object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function onFinished(msg, listener) {
|
||||
if (isFinished(msg) !== false) {
|
||||
defer(listener, null, msg)
|
||||
return msg
|
||||
}
|
||||
|
||||
// attach the listener to the message
|
||||
attachListener(msg, listener)
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if message is already finished.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function isFinished(msg) {
|
||||
var socket = msg.socket
|
||||
|
||||
if (typeof msg.finished === 'boolean') {
|
||||
// OutgoingMessage
|
||||
return Boolean(msg.finished || (socket && !socket.writable))
|
||||
}
|
||||
|
||||
if (typeof msg.complete === 'boolean') {
|
||||
// IncomingMessage
|
||||
return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable))
|
||||
}
|
||||
|
||||
// don't know
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a finished listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachFinishedListener(msg, callback) {
|
||||
var eeMsg
|
||||
var eeSocket
|
||||
var finished = false
|
||||
|
||||
function onFinish(error) {
|
||||
eeMsg.cancel()
|
||||
eeSocket.cancel()
|
||||
|
||||
finished = true
|
||||
callback(error)
|
||||
}
|
||||
|
||||
// finished on first message event
|
||||
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
|
||||
|
||||
function onSocket(socket) {
|
||||
// remove listener
|
||||
msg.removeListener('socket', onSocket)
|
||||
|
||||
if (finished) return
|
||||
if (eeMsg !== eeSocket) return
|
||||
|
||||
// finished on first socket event
|
||||
eeSocket = first([[socket, 'error', 'close']], onFinish)
|
||||
}
|
||||
|
||||
if (msg.socket) {
|
||||
// socket already assigned
|
||||
onSocket(msg.socket)
|
||||
return
|
||||
}
|
||||
|
||||
// wait for socket to be assigned
|
||||
msg.on('socket', onSocket)
|
||||
|
||||
if (msg.socket === undefined) {
|
||||
// node.js 0.8 patch
|
||||
patchAssignSocket(msg, onSocket)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach the listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachListener(msg, listener) {
|
||||
var attached = msg.__onFinished
|
||||
|
||||
// create a private single listener with queue
|
||||
if (!attached || !attached.queue) {
|
||||
attached = msg.__onFinished = createListener(msg)
|
||||
attachFinishedListener(msg, attached)
|
||||
}
|
||||
|
||||
attached.queue.push(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create listener on message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createListener(msg) {
|
||||
function listener(err) {
|
||||
if (msg.__onFinished === listener) msg.__onFinished = null
|
||||
if (!listener.queue) return
|
||||
|
||||
var queue = listener.queue
|
||||
listener.queue = null
|
||||
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
queue[i](err, msg)
|
||||
}
|
||||
}
|
||||
|
||||
listener.queue = []
|
||||
|
||||
return listener
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch ServerResponse.prototype.assignSocket for node.js 0.8.
|
||||
*
|
||||
* @param {ServerResponse} res
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function patchAssignSocket(res, callback) {
|
||||
var assignSocket = res.assignSocket
|
||||
|
||||
if (typeof assignSocket !== 'function') return
|
||||
|
||||
// res.on('socket', callback) is broken in 0.8
|
||||
res.assignSocket = function _assignSocket(socket) {
|
||||
assignSocket.call(this, socket)
|
||||
callback(socket)
|
||||
}
|
||||
}
|
||||
31
node_modules/serve-static/node_modules/on-finished/package.json
generated
vendored
Normal file
31
node_modules/serve-static/node_modules/on-finished/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "on-finished",
|
||||
"description": "Execute a callback when a request closes, finishes, or errors",
|
||||
"version": "2.3.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/on-finished",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "2.2.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
}
|
||||
}
|
||||
315
node_modules/serve-static/node_modules/send/HISTORY.md
generated
vendored
Normal file
315
node_modules/serve-static/node_modules/send/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
0.13.2 / 2016-03-05
|
||||
===================
|
||||
|
||||
* Fix invalid `Content-Type` header when `send.mime.default_type` unset
|
||||
|
||||
0.13.1 / 2016-01-16
|
||||
===================
|
||||
|
||||
* deps: depd@~1.1.0
|
||||
- Support web browser loading
|
||||
- perf: enable strict mode
|
||||
* deps: destroy@~1.0.4
|
||||
- perf: enable strict mode
|
||||
* deps: escape-html@~1.0.3
|
||||
- perf: enable strict mode
|
||||
- perf: optimize string replacement
|
||||
- perf: use faster string coercion
|
||||
* deps: range-parser@~1.0.3
|
||||
- perf: enable strict mode
|
||||
|
||||
0.13.0 / 2015-06-16
|
||||
===================
|
||||
|
||||
* Allow Node.js HTTP server to set `Date` response header
|
||||
* Fix incorrectly removing `Content-Location` on 304 response
|
||||
* Improve the default redirect response headers
|
||||
* Send appropriate headers on default error response
|
||||
* Use `http-errors` for standard emitted errors
|
||||
* Use `statuses` instead of `http` module for status messages
|
||||
* deps: escape-html@1.0.2
|
||||
* deps: etag@~1.7.0
|
||||
- Improve stat performance by removing hashing
|
||||
* deps: fresh@0.3.0
|
||||
- Add weak `ETag` matching support
|
||||
* deps: on-finished@~2.3.0
|
||||
- Add defined behavior for HTTP `CONNECT` requests
|
||||
- Add defined behavior for HTTP `Upgrade` requests
|
||||
- deps: ee-first@1.1.1
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary array allocations
|
||||
|
||||
0.12.3 / 2015-05-13
|
||||
===================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
* deps: depd@~1.0.1
|
||||
* deps: etag@~1.6.0
|
||||
- Improve support for JXcore
|
||||
- Support "fake" stats objects in environments without `fs`
|
||||
* deps: ms@0.7.1
|
||||
- Prevent extraordinarily long inputs
|
||||
* deps: on-finished@~2.2.1
|
||||
|
||||
0.12.2 / 2015-03-13
|
||||
===================
|
||||
|
||||
* Throw errors early for invalid `extensions` or `index` options
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
0.12.1 / 2015-02-17
|
||||
===================
|
||||
|
||||
* Fix regression sending zero-length files
|
||||
|
||||
0.12.0 / 2015-02-16
|
||||
===================
|
||||
|
||||
* Always read the stat size from the file
|
||||
* Fix mutating passed-in `options`
|
||||
* deps: mime@1.3.4
|
||||
|
||||
0.11.1 / 2015-01-20
|
||||
===================
|
||||
|
||||
* Fix `root` path disclosure
|
||||
|
||||
0.11.0 / 2015-01-05
|
||||
===================
|
||||
|
||||
* deps: debug@~2.1.1
|
||||
* deps: etag@~1.5.1
|
||||
- deps: crc@3.2.1
|
||||
* deps: ms@0.7.0
|
||||
- Add `milliseconds`
|
||||
- Add `msecs`
|
||||
- Add `secs`
|
||||
- Add `mins`
|
||||
- Add `hrs`
|
||||
- Add `yrs`
|
||||
* deps: on-finished@~2.2.0
|
||||
|
||||
0.10.1 / 2014-10-22
|
||||
===================
|
||||
|
||||
* deps: on-finished@~2.1.1
|
||||
- Fix handling of pipelined requests
|
||||
|
||||
0.10.0 / 2014-10-15
|
||||
===================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
* deps: depd@~1.0.0
|
||||
* deps: etag@~1.5.0
|
||||
- Improve string performance
|
||||
- Slightly improve speed for weak ETags over 1KB
|
||||
|
||||
0.9.3 / 2014-09-24
|
||||
==================
|
||||
|
||||
* deps: etag@~1.4.0
|
||||
- Support "fake" stats objects
|
||||
|
||||
0.9.2 / 2014-09-15
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.5
|
||||
* deps: etag@~1.3.1
|
||||
* deps: range-parser@~1.0.2
|
||||
|
||||
0.9.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* deps: fresh@0.2.4
|
||||
|
||||
0.9.0 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Add `lastModified` option
|
||||
* Use `etag` to generate `ETag` header
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
0.8.5 / 2014-09-04
|
||||
==================
|
||||
|
||||
* Fix malicious path detection for empty string path
|
||||
|
||||
0.8.4 / 2014-09-04
|
||||
==================
|
||||
|
||||
* Fix a path traversal issue when using `root`
|
||||
|
||||
0.8.3 / 2014-08-16
|
||||
==================
|
||||
|
||||
* deps: destroy@1.0.3
|
||||
- renamed from dethroy
|
||||
* deps: on-finished@2.1.0
|
||||
|
||||
0.8.2 / 2014-08-14
|
||||
==================
|
||||
|
||||
* Work around `fd` leak in Node.js 0.10 for `fs.ReadStream`
|
||||
* deps: dethroy@1.0.2
|
||||
|
||||
0.8.1 / 2014-08-05
|
||||
==================
|
||||
|
||||
* Fix `extensions` behavior when file already has extension
|
||||
|
||||
0.8.0 / 2014-08-05
|
||||
==================
|
||||
|
||||
* Add `extensions` option
|
||||
|
||||
0.7.4 / 2014-08-04
|
||||
==================
|
||||
|
||||
* Fix serving index files without root dir
|
||||
|
||||
0.7.3 / 2014-07-29
|
||||
==================
|
||||
|
||||
* Fix incorrect 403 on Windows and Node.js 0.11
|
||||
|
||||
0.7.2 / 2014-07-27
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.4
|
||||
- Work-around v8 generating empty stack traces
|
||||
|
||||
0.7.1 / 2014-07-26
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.3
|
||||
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||
|
||||
0.7.0 / 2014-07-20
|
||||
==================
|
||||
|
||||
* Deprecate `hidden` option; use `dotfiles` option
|
||||
* Add `dotfiles` option
|
||||
* deps: debug@1.0.4
|
||||
* deps: depd@0.4.2
|
||||
- Add `TRACE_DEPRECATION` environment variable
|
||||
- Remove non-standard grey color from color output
|
||||
- Support `--no-deprecation` argument
|
||||
- Support `--trace-deprecation` argument
|
||||
|
||||
0.6.0 / 2014-07-11
|
||||
==================
|
||||
|
||||
* Deprecate `from` option; use `root` option
|
||||
* Deprecate `send.etag()` -- use `etag` in `options`
|
||||
* Deprecate `send.hidden()` -- use `hidden` in `options`
|
||||
* Deprecate `send.index()` -- use `index` in `options`
|
||||
* Deprecate `send.maxage()` -- use `maxAge` in `options`
|
||||
* Deprecate `send.root()` -- use `root` in `options`
|
||||
* Cap `maxAge` value to 1 year
|
||||
* deps: debug@1.0.3
|
||||
- Add support for multiple wildcards in namespaces
|
||||
|
||||
0.5.0 / 2014-06-28
|
||||
==================
|
||||
|
||||
* Accept string for `maxAge` (converted by `ms`)
|
||||
* Add `headers` event
|
||||
* Include link in default redirect response
|
||||
* Use `EventEmitter.listenerCount` to count listeners
|
||||
|
||||
0.4.3 / 2014-06-11
|
||||
==================
|
||||
|
||||
* Do not throw un-catchable error on file open race condition
|
||||
* Use `escape-html` for HTML escaping
|
||||
* deps: debug@1.0.2
|
||||
- fix some debugging output colors on node.js 0.8
|
||||
* deps: finished@1.2.2
|
||||
* deps: fresh@0.2.2
|
||||
|
||||
0.4.2 / 2014-06-09
|
||||
==================
|
||||
|
||||
* fix "event emitter leak" warnings
|
||||
* deps: debug@1.0.1
|
||||
* deps: finished@1.2.1
|
||||
|
||||
0.4.1 / 2014-06-02
|
||||
==================
|
||||
|
||||
* Send `max-age` in `Cache-Control` in correct format
|
||||
|
||||
0.4.0 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Calculate ETag with md5 for reduced collisions
|
||||
* Fix wrong behavior when index file matches directory
|
||||
* Ignore stream errors after request ends
|
||||
- Goodbye `EBADF, read`
|
||||
* Skip directories in index file search
|
||||
* deps: debug@0.8.1
|
||||
|
||||
0.3.0 / 2014-04-24
|
||||
==================
|
||||
|
||||
* Fix sending files with dots without root set
|
||||
* Coerce option types
|
||||
* Accept API options in options object
|
||||
* Set etags to "weak"
|
||||
* Include file path in etag
|
||||
* Make "Can't set headers after they are sent." catchable
|
||||
* Send full entity-body for multi range requests
|
||||
* Default directory access to 403 when index disabled
|
||||
* Support multiple index paths
|
||||
* Support "If-Range" header
|
||||
* Control whether to generate etags
|
||||
* deps: mime@1.2.11
|
||||
|
||||
0.2.0 / 2014-01-29
|
||||
==================
|
||||
|
||||
* update range-parser and fresh
|
||||
|
||||
0.1.4 / 2013-08-11
|
||||
==================
|
||||
|
||||
* update fresh
|
||||
|
||||
0.1.3 / 2013-07-08
|
||||
==================
|
||||
|
||||
* Revert "Fix fd leak"
|
||||
|
||||
0.1.2 / 2013-07-03
|
||||
==================
|
||||
|
||||
* Fix fd leak
|
||||
|
||||
0.1.0 / 2012-08-25
|
||||
==================
|
||||
|
||||
* add options parameter to send() that is passed to fs.createReadStream() [kanongil]
|
||||
|
||||
0.0.4 / 2012-08-16
|
||||
==================
|
||||
|
||||
* allow custom "Accept-Ranges" definition
|
||||
|
||||
0.0.3 / 2012-07-16
|
||||
==================
|
||||
|
||||
* fix normalization of the root directory. Closes #3
|
||||
|
||||
0.0.2 / 2012-07-09
|
||||
==================
|
||||
|
||||
* add passing of req explicitly for now (YUCK)
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/serve-static/node_modules/send/LICENSE
generated
vendored
Normal file
23
node_modules/serve-static/node_modules/send/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 TJ Holowaychuk
|
||||
Copyright (c) 2014-2015 Douglas Christopher Wilson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
234
node_modules/serve-static/node_modules/send/README.md
generated
vendored
Normal file
234
node_modules/serve-static/node_modules/send/README.md
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
# send
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Linux Build][travis-image]][travis-url]
|
||||
[![Windows Build][appveyor-image]][appveyor-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
[![Gratipay][gratipay-image]][gratipay-url]
|
||||
|
||||
Send is a library for streaming files from the file system as a http response
|
||||
supporting partial responses (Ranges), conditional-GET negotiation, high test
|
||||
coverage, and granular events which may be leveraged to take appropriate actions
|
||||
in your application or framework.
|
||||
|
||||
Looking to serve up entire folders mapped to URLs? Try [serve-static](https://www.npmjs.org/package/serve-static).
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install send
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var send = require('send')
|
||||
```
|
||||
|
||||
### send(req, path, [options])
|
||||
|
||||
Create a new `SendStream` for the given path to send to a `res`. The `req` is
|
||||
the Node.js HTTP request and the `path` is a urlencoded path to send (urlencoded,
|
||||
not the actual file-system path).
|
||||
|
||||
#### Options
|
||||
|
||||
##### dotfiles
|
||||
|
||||
Set how "dotfiles" are treated when encountered. A dotfile is a file
|
||||
or directory that begins with a dot ("."). Note this check is done on
|
||||
the path itself without checking if the path actually exists on the
|
||||
disk. If `root` is specified, only the dotfiles above the root are
|
||||
checked (i.e. the root itself can be within a dotfile when when set
|
||||
to "deny").
|
||||
|
||||
- `'allow'` No special treatment for dotfiles.
|
||||
- `'deny'` Send a 403 for any request for a dotfile.
|
||||
- `'ignore'` Pretend like the dotfile does not exist and 404.
|
||||
|
||||
The default value is _similar_ to `'ignore'`, with the exception that
|
||||
this default will not ignore the files within a directory that begins
|
||||
with a dot, for backward-compatibility.
|
||||
|
||||
##### end
|
||||
|
||||
Byte offset at which the stream ends, defaults to the length of the file
|
||||
minus 1. The end is inclusive in the stream, meaning `end: 3` will include
|
||||
the 4th byte in the stream.
|
||||
|
||||
##### etag
|
||||
|
||||
Enable or disable etag generation, defaults to true.
|
||||
|
||||
##### extensions
|
||||
|
||||
If a given file doesn't exist, try appending one of the given extensions,
|
||||
in the given order. By default, this is disabled (set to `false`). An
|
||||
example value that will serve extension-less HTML files: `['html', 'htm']`.
|
||||
This is skipped if the requested file already has an extension.
|
||||
|
||||
##### index
|
||||
|
||||
By default send supports "index.html" files, to disable this
|
||||
set `false` or to supply a new index pass a string or an array
|
||||
in preferred order.
|
||||
|
||||
##### lastModified
|
||||
|
||||
Enable or disable `Last-Modified` header, defaults to true. Uses the file
|
||||
system's last modified value.
|
||||
|
||||
##### maxAge
|
||||
|
||||
Provide a max-age in milliseconds for http caching, defaults to 0.
|
||||
This can also be a string accepted by the
|
||||
[ms](https://www.npmjs.org/package/ms#readme) module.
|
||||
|
||||
##### root
|
||||
|
||||
Serve files relative to `path`.
|
||||
|
||||
##### start
|
||||
|
||||
Byte offset at which the stream starts, defaults to 0. The start is inclusive,
|
||||
meaning `start: 2` will include the 3rd byte in the stream.
|
||||
|
||||
#### Events
|
||||
|
||||
The `SendStream` is an event emitter and will emit the following events:
|
||||
|
||||
- `error` an error occurred `(err)`
|
||||
- `directory` a directory was requested
|
||||
- `file` a file was requested `(path, stat)`
|
||||
- `headers` the headers are about to be set on a file `(res, path, stat)`
|
||||
- `stream` file streaming has started `(stream)`
|
||||
- `end` streaming has completed
|
||||
|
||||
#### .pipe
|
||||
|
||||
The `pipe` method is used to pipe the response into the Node.js HTTP response
|
||||
object, typically `send(req, path, options).pipe(res)`.
|
||||
|
||||
### .mime
|
||||
|
||||
The `mime` export is the global instance of of the
|
||||
[`mime` npm module](https://www.npmjs.com/package/mime).
|
||||
|
||||
This is used to configure the MIME types that are associated with file extensions
|
||||
as well as other options for how to resolve the MIME type of a file (like the
|
||||
default type to use for an unknown file extension).
|
||||
|
||||
## Error-handling
|
||||
|
||||
By default when no `error` listeners are present an automatic response will be
|
||||
made, otherwise you have full control over the response, aka you may show a 5xx
|
||||
page etc.
|
||||
|
||||
## Caching
|
||||
|
||||
It does _not_ perform internal caching, you should use a reverse proxy cache
|
||||
such as Varnish for this, or those fancy things called CDNs. If your
|
||||
application is small enough that it would benefit from single-node memory
|
||||
caching, it's small enough that it does not need caching at all ;).
|
||||
|
||||
## Debugging
|
||||
|
||||
To enable `debug()` instrumentation output export __DEBUG__:
|
||||
|
||||
```
|
||||
$ DEBUG=send node app
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
```
|
||||
$ npm install
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Small example
|
||||
|
||||
```js
|
||||
var http = require('http');
|
||||
var send = require('send');
|
||||
|
||||
var app = http.createServer(function(req, res){
|
||||
send(req, req.url).pipe(res);
|
||||
}).listen(3000);
|
||||
```
|
||||
|
||||
### Custom file types
|
||||
|
||||
```js
|
||||
var http = require('http');
|
||||
var send = require('send');
|
||||
|
||||
// Default unknown types to text/plain
|
||||
send.mime.default_type = 'text/plain';
|
||||
|
||||
// Add a custom type
|
||||
send.mime.define({
|
||||
'application/x-my-type': ['x-mt', 'x-mtt']
|
||||
});
|
||||
|
||||
var app = http.createServer(function(req, res){
|
||||
send(req, req.url).pipe(res);
|
||||
}).listen(3000);
|
||||
```
|
||||
|
||||
### Serving from a root directory with custom error-handling
|
||||
|
||||
```js
|
||||
var http = require('http');
|
||||
var send = require('send');
|
||||
var url = require('url');
|
||||
|
||||
var app = http.createServer(function(req, res){
|
||||
// your custom error-handling logic:
|
||||
function error(err) {
|
||||
res.statusCode = err.status || 500;
|
||||
res.end(err.message);
|
||||
}
|
||||
|
||||
// your custom headers
|
||||
function headers(res, path, stat) {
|
||||
// serve all files for download
|
||||
res.setHeader('Content-Disposition', 'attachment');
|
||||
}
|
||||
|
||||
// your custom directory handling logic:
|
||||
function redirect() {
|
||||
res.statusCode = 301;
|
||||
res.setHeader('Location', req.url + '/');
|
||||
res.end('Redirecting to ' + req.url + '/');
|
||||
}
|
||||
|
||||
// transfer arbitrary files from within
|
||||
// /www/example.com/public/*
|
||||
send(req, url.parse(req.url).pathname, {root: '/www/example.com/public'})
|
||||
.on('error', error)
|
||||
.on('directory', redirect)
|
||||
.on('headers', headers)
|
||||
.pipe(res);
|
||||
}).listen(3000);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/send.svg
|
||||
[npm-url]: https://npmjs.org/package/send
|
||||
[travis-image]: https://img.shields.io/travis/pillarjs/send/master.svg?label=linux
|
||||
[travis-url]: https://travis-ci.org/pillarjs/send
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/send/master.svg?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send
|
||||
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/send/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/send.svg
|
||||
[downloads-url]: https://npmjs.org/package/send
|
||||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
||||
[gratipay-url]: https://www.gratipay.com/dougwilson/
|
||||
829
node_modules/serve-static/node_modules/send/index.js
generated
vendored
Normal file
829
node_modules/serve-static/node_modules/send/index.js
generated
vendored
Normal file
@@ -0,0 +1,829 @@
|
||||
/*!
|
||||
* send
|
||||
* Copyright(c) 2012 TJ Holowaychuk
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var createError = require('http-errors')
|
||||
var debug = require('debug')('send')
|
||||
var deprecate = require('depd')('send')
|
||||
var destroy = require('destroy')
|
||||
var escapeHtml = require('escape-html')
|
||||
, parseRange = require('range-parser')
|
||||
, Stream = require('stream')
|
||||
, mime = require('mime')
|
||||
, fresh = require('fresh')
|
||||
, path = require('path')
|
||||
, fs = require('fs')
|
||||
, normalize = path.normalize
|
||||
, join = path.join
|
||||
var etag = require('etag')
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var ms = require('ms');
|
||||
var onFinished = require('on-finished')
|
||||
var statuses = require('statuses')
|
||||
|
||||
/**
|
||||
* Variables.
|
||||
*/
|
||||
var extname = path.extname
|
||||
var maxMaxAge = 60 * 60 * 24 * 365 * 1000; // 1 year
|
||||
var resolve = path.resolve
|
||||
var sep = path.sep
|
||||
var toString = Object.prototype.toString
|
||||
var upPathRegexp = /(?:^|[\\\/])\.\.(?:[\\\/]|$)/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = send
|
||||
module.exports.mime = mime
|
||||
|
||||
/**
|
||||
* Shim EventEmitter.listenerCount for node.js < 0.10
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var listenerCount = EventEmitter.listenerCount
|
||||
|| function(emitter, type){ return emitter.listeners(type).length; };
|
||||
|
||||
/**
|
||||
* Return a `SendStream` for `req` and `path`.
|
||||
*
|
||||
* @param {object} req
|
||||
* @param {string} path
|
||||
* @param {object} [options]
|
||||
* @return {SendStream}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function send(req, path, options) {
|
||||
return new SendStream(req, path, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a `SendStream` with the given `path`.
|
||||
*
|
||||
* @param {Request} req
|
||||
* @param {String} path
|
||||
* @param {object} [options]
|
||||
* @private
|
||||
*/
|
||||
|
||||
function SendStream(req, path, options) {
|
||||
var opts = options || {}
|
||||
|
||||
this.options = opts
|
||||
this.path = path
|
||||
this.req = req
|
||||
|
||||
this._etag = opts.etag !== undefined
|
||||
? Boolean(opts.etag)
|
||||
: true
|
||||
|
||||
this._dotfiles = opts.dotfiles !== undefined
|
||||
? opts.dotfiles
|
||||
: 'ignore'
|
||||
|
||||
if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') {
|
||||
throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
|
||||
}
|
||||
|
||||
this._hidden = Boolean(opts.hidden)
|
||||
|
||||
if (opts.hidden !== undefined) {
|
||||
deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead')
|
||||
}
|
||||
|
||||
// legacy support
|
||||
if (opts.dotfiles === undefined) {
|
||||
this._dotfiles = undefined
|
||||
}
|
||||
|
||||
this._extensions = opts.extensions !== undefined
|
||||
? normalizeList(opts.extensions, 'extensions option')
|
||||
: []
|
||||
|
||||
this._index = opts.index !== undefined
|
||||
? normalizeList(opts.index, 'index option')
|
||||
: ['index.html']
|
||||
|
||||
this._lastModified = opts.lastModified !== undefined
|
||||
? Boolean(opts.lastModified)
|
||||
: true
|
||||
|
||||
this._maxage = opts.maxAge || opts.maxage
|
||||
this._maxage = typeof this._maxage === 'string'
|
||||
? ms(this._maxage)
|
||||
: Number(this._maxage)
|
||||
this._maxage = !isNaN(this._maxage)
|
||||
? Math.min(Math.max(0, this._maxage), maxMaxAge)
|
||||
: 0
|
||||
|
||||
this._root = opts.root
|
||||
? resolve(opts.root)
|
||||
: null
|
||||
|
||||
if (!this._root && opts.from) {
|
||||
this.from(opts.from)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from `Stream.prototype`.
|
||||
*/
|
||||
|
||||
SendStream.prototype.__proto__ = Stream.prototype;
|
||||
|
||||
/**
|
||||
* Enable or disable etag generation.
|
||||
*
|
||||
* @param {Boolean} val
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.etag = deprecate.function(function etag(val) {
|
||||
val = Boolean(val);
|
||||
debug('etag %s', val);
|
||||
this._etag = val;
|
||||
return this;
|
||||
}, 'send.etag: pass etag as option');
|
||||
|
||||
/**
|
||||
* Enable or disable "hidden" (dot) files.
|
||||
*
|
||||
* @param {Boolean} path
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.hidden = deprecate.function(function hidden(val) {
|
||||
val = Boolean(val);
|
||||
debug('hidden %s', val);
|
||||
this._hidden = val;
|
||||
this._dotfiles = undefined
|
||||
return this;
|
||||
}, 'send.hidden: use dotfiles option');
|
||||
|
||||
/**
|
||||
* Set index `paths`, set to a falsy
|
||||
* value to disable index support.
|
||||
*
|
||||
* @param {String|Boolean|Array} paths
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.index = deprecate.function(function index(paths) {
|
||||
var index = !paths ? [] : normalizeList(paths, 'paths argument');
|
||||
debug('index %o', paths);
|
||||
this._index = index;
|
||||
return this;
|
||||
}, 'send.index: pass index as option');
|
||||
|
||||
/**
|
||||
* Set root `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.root = function(path){
|
||||
path = String(path);
|
||||
this._root = resolve(path)
|
||||
return this;
|
||||
};
|
||||
|
||||
SendStream.prototype.from = deprecate.function(SendStream.prototype.root,
|
||||
'send.from: pass root as option');
|
||||
|
||||
SendStream.prototype.root = deprecate.function(SendStream.prototype.root,
|
||||
'send.root: pass root as option');
|
||||
|
||||
/**
|
||||
* Set max-age to `maxAge`.
|
||||
*
|
||||
* @param {Number} maxAge
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.maxage = deprecate.function(function maxage(maxAge) {
|
||||
maxAge = typeof maxAge === 'string'
|
||||
? ms(maxAge)
|
||||
: Number(maxAge);
|
||||
if (isNaN(maxAge)) maxAge = 0;
|
||||
if (Infinity == maxAge) maxAge = 60 * 60 * 24 * 365 * 1000;
|
||||
debug('max-age %d', maxAge);
|
||||
this._maxage = maxAge;
|
||||
return this;
|
||||
}, 'send.maxage: pass maxAge as option');
|
||||
|
||||
/**
|
||||
* Emit error with `status`.
|
||||
*
|
||||
* @param {number} status
|
||||
* @param {Error} [error]
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.error = function error(status, error) {
|
||||
// emit if listeners instead of responding
|
||||
if (listenerCount(this, 'error') !== 0) {
|
||||
return this.emit('error', createError(error, status, {
|
||||
expose: false
|
||||
}))
|
||||
}
|
||||
|
||||
var res = this.res
|
||||
var msg = statuses[status]
|
||||
|
||||
// wipe all existing headers
|
||||
res._headers = null
|
||||
|
||||
// send basic response
|
||||
res.statusCode = status
|
||||
res.setHeader('Content-Type', 'text/plain; charset=UTF-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(msg))
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
res.end(msg)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the pathname ends with "/".
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.hasTrailingSlash = function(){
|
||||
return '/' == this.path[this.path.length - 1];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this is a conditional GET request.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isConditionalGET = function(){
|
||||
return this.req.headers['if-none-match']
|
||||
|| this.req.headers['if-modified-since'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip content-* header fields.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.removeContentHeaderFields = function removeContentHeaderFields() {
|
||||
var res = this.res
|
||||
var headers = Object.keys(res._headers || {})
|
||||
|
||||
for (var i = 0; i < headers.length; i++) {
|
||||
var header = headers[i]
|
||||
if (header.substr(0, 8) === 'content-' && header !== 'content-location') {
|
||||
res.removeHeader(header)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond with 304 not modified.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.notModified = function(){
|
||||
var res = this.res;
|
||||
debug('not modified');
|
||||
this.removeContentHeaderFields();
|
||||
res.statusCode = 304;
|
||||
res.end();
|
||||
};
|
||||
|
||||
/**
|
||||
* Raise error that headers already sent.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.headersAlreadySent = function headersAlreadySent(){
|
||||
var err = new Error('Can\'t set headers after they are sent.');
|
||||
debug('headers already sent');
|
||||
this.error(500, err);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the request is cacheable, aka
|
||||
* responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isCachable = function(){
|
||||
var res = this.res;
|
||||
return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle stat() error.
|
||||
*
|
||||
* @param {Error} error
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.onStatError = function onStatError(error) {
|
||||
switch (error.code) {
|
||||
case 'ENAMETOOLONG':
|
||||
case 'ENOENT':
|
||||
case 'ENOTDIR':
|
||||
this.error(404, error)
|
||||
break
|
||||
default:
|
||||
this.error(500, error)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the cache is fresh.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isFresh = function(){
|
||||
return fresh(this.req.headers, this.res._headers);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the range is fresh.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isRangeFresh = function isRangeFresh(){
|
||||
var ifRange = this.req.headers['if-range'];
|
||||
|
||||
if (!ifRange) return true;
|
||||
|
||||
return ~ifRange.indexOf('"')
|
||||
? ~ifRange.indexOf(this.res._headers['etag'])
|
||||
: Date.parse(this.res._headers['last-modified']) <= Date.parse(ifRange);
|
||||
};
|
||||
|
||||
/**
|
||||
* Redirect to path.
|
||||
*
|
||||
* @param {string} path
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.redirect = function redirect(path) {
|
||||
if (listenerCount(this, 'directory') !== 0) {
|
||||
this.emit('directory')
|
||||
return
|
||||
}
|
||||
|
||||
if (this.hasTrailingSlash()) {
|
||||
this.error(403)
|
||||
return
|
||||
}
|
||||
|
||||
var loc = path + '/'
|
||||
var msg = 'Redirecting to <a href="' + escapeHtml(loc) + '">' + escapeHtml(loc) + '</a>\n'
|
||||
var res = this.res
|
||||
|
||||
// redirect
|
||||
res.statusCode = 301
|
||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(msg))
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
res.setHeader('Location', loc)
|
||||
res.end(msg)
|
||||
}
|
||||
|
||||
/**
|
||||
* Pipe to `res.
|
||||
*
|
||||
* @param {Stream} res
|
||||
* @return {Stream} res
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.pipe = function(res){
|
||||
var self = this
|
||||
, args = arguments
|
||||
, root = this._root;
|
||||
|
||||
// references
|
||||
this.res = res;
|
||||
|
||||
// decode the path
|
||||
var path = decode(this.path)
|
||||
if (path === -1) return this.error(400)
|
||||
|
||||
// null byte(s)
|
||||
if (~path.indexOf('\0')) return this.error(400);
|
||||
|
||||
var parts
|
||||
if (root !== null) {
|
||||
// malicious path
|
||||
if (upPathRegexp.test(normalize('.' + sep + path))) {
|
||||
debug('malicious path "%s"', path)
|
||||
return this.error(403)
|
||||
}
|
||||
|
||||
// join / normalize from optional root dir
|
||||
path = normalize(join(root, path))
|
||||
root = normalize(root + sep)
|
||||
|
||||
// explode path parts
|
||||
parts = path.substr(root.length).split(sep)
|
||||
} else {
|
||||
// ".." is malicious without "root"
|
||||
if (upPathRegexp.test(path)) {
|
||||
debug('malicious path "%s"', path)
|
||||
return this.error(403)
|
||||
}
|
||||
|
||||
// explode path parts
|
||||
parts = normalize(path).split(sep)
|
||||
|
||||
// resolve the path
|
||||
path = resolve(path)
|
||||
}
|
||||
|
||||
// dotfile handling
|
||||
if (containsDotFile(parts)) {
|
||||
var access = this._dotfiles
|
||||
|
||||
// legacy support
|
||||
if (access === undefined) {
|
||||
access = parts[parts.length - 1][0] === '.'
|
||||
? (this._hidden ? 'allow' : 'ignore')
|
||||
: 'allow'
|
||||
}
|
||||
|
||||
debug('%s dotfile "%s"', access, path)
|
||||
switch (access) {
|
||||
case 'allow':
|
||||
break
|
||||
case 'deny':
|
||||
return this.error(403)
|
||||
case 'ignore':
|
||||
default:
|
||||
return this.error(404)
|
||||
}
|
||||
}
|
||||
|
||||
// index file support
|
||||
if (this._index.length && this.path[this.path.length - 1] === '/') {
|
||||
this.sendIndex(path);
|
||||
return res;
|
||||
}
|
||||
|
||||
this.sendFile(path);
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* Transfer `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.send = function(path, stat){
|
||||
var len = stat.size;
|
||||
var options = this.options
|
||||
var opts = {}
|
||||
var res = this.res;
|
||||
var req = this.req;
|
||||
var ranges = req.headers.range;
|
||||
var offset = options.start || 0;
|
||||
|
||||
if (res._header) {
|
||||
// impossible to send now
|
||||
return this.headersAlreadySent();
|
||||
}
|
||||
|
||||
debug('pipe "%s"', path)
|
||||
|
||||
// set header fields
|
||||
this.setHeader(path, stat);
|
||||
|
||||
// set content-type
|
||||
this.type(path);
|
||||
|
||||
// conditional GET support
|
||||
if (this.isConditionalGET()
|
||||
&& this.isCachable()
|
||||
&& this.isFresh()) {
|
||||
return this.notModified();
|
||||
}
|
||||
|
||||
// adjust len to start/end options
|
||||
len = Math.max(0, len - offset);
|
||||
if (options.end !== undefined) {
|
||||
var bytes = options.end - offset + 1;
|
||||
if (len > bytes) len = bytes;
|
||||
}
|
||||
|
||||
// Range support
|
||||
if (ranges) {
|
||||
ranges = parseRange(len, ranges);
|
||||
|
||||
// If-Range support
|
||||
if (!this.isRangeFresh()) {
|
||||
debug('range stale');
|
||||
ranges = -2;
|
||||
}
|
||||
|
||||
// unsatisfiable
|
||||
if (-1 == ranges) {
|
||||
debug('range unsatisfiable');
|
||||
res.setHeader('Content-Range', 'bytes */' + stat.size);
|
||||
return this.error(416);
|
||||
}
|
||||
|
||||
// valid (syntactically invalid/multiple ranges are treated as a regular response)
|
||||
if (-2 != ranges && ranges.length === 1) {
|
||||
debug('range %j', ranges);
|
||||
|
||||
// Content-Range
|
||||
res.statusCode = 206;
|
||||
res.setHeader('Content-Range', 'bytes '
|
||||
+ ranges[0].start
|
||||
+ '-'
|
||||
+ ranges[0].end
|
||||
+ '/'
|
||||
+ len);
|
||||
|
||||
offset += ranges[0].start;
|
||||
len = ranges[0].end - ranges[0].start + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// clone options
|
||||
for (var prop in options) {
|
||||
opts[prop] = options[prop]
|
||||
}
|
||||
|
||||
// set read options
|
||||
opts.start = offset
|
||||
opts.end = Math.max(offset, offset + len - 1)
|
||||
|
||||
// content-length
|
||||
res.setHeader('Content-Length', len);
|
||||
|
||||
// HEAD support
|
||||
if ('HEAD' == req.method) return res.end();
|
||||
|
||||
this.stream(path, opts)
|
||||
};
|
||||
|
||||
/**
|
||||
* Transfer file for `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
SendStream.prototype.sendFile = function sendFile(path) {
|
||||
var i = 0
|
||||
var self = this
|
||||
|
||||
debug('stat "%s"', path);
|
||||
fs.stat(path, function onstat(err, stat) {
|
||||
if (err && err.code === 'ENOENT'
|
||||
&& !extname(path)
|
||||
&& path[path.length - 1] !== sep) {
|
||||
// not found, check extensions
|
||||
return next(err)
|
||||
}
|
||||
if (err) return self.onStatError(err)
|
||||
if (stat.isDirectory()) return self.redirect(self.path)
|
||||
self.emit('file', path, stat)
|
||||
self.send(path, stat)
|
||||
})
|
||||
|
||||
function next(err) {
|
||||
if (self._extensions.length <= i) {
|
||||
return err
|
||||
? self.onStatError(err)
|
||||
: self.error(404)
|
||||
}
|
||||
|
||||
var p = path + '.' + self._extensions[i++]
|
||||
|
||||
debug('stat "%s"', p)
|
||||
fs.stat(p, function (err, stat) {
|
||||
if (err) return next(err)
|
||||
if (stat.isDirectory()) return next()
|
||||
self.emit('file', p, stat)
|
||||
self.send(p, stat)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer index for `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
SendStream.prototype.sendIndex = function sendIndex(path){
|
||||
var i = -1;
|
||||
var self = this;
|
||||
|
||||
function next(err){
|
||||
if (++i >= self._index.length) {
|
||||
if (err) return self.onStatError(err);
|
||||
return self.error(404);
|
||||
}
|
||||
|
||||
var p = join(path, self._index[i]);
|
||||
|
||||
debug('stat "%s"', p);
|
||||
fs.stat(p, function(err, stat){
|
||||
if (err) return next(err);
|
||||
if (stat.isDirectory()) return next();
|
||||
self.emit('file', p, stat);
|
||||
self.send(p, stat);
|
||||
});
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
/**
|
||||
* Stream `path` to the response.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Object} options
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.stream = function(path, options){
|
||||
// TODO: this is all lame, refactor meeee
|
||||
var finished = false;
|
||||
var self = this;
|
||||
var res = this.res;
|
||||
var req = this.req;
|
||||
|
||||
// pipe
|
||||
var stream = fs.createReadStream(path, options);
|
||||
this.emit('stream', stream);
|
||||
stream.pipe(res);
|
||||
|
||||
// response finished, done with the fd
|
||||
onFinished(res, function onfinished(){
|
||||
finished = true;
|
||||
destroy(stream);
|
||||
});
|
||||
|
||||
// error handling code-smell
|
||||
stream.on('error', function onerror(err){
|
||||
// request already finished
|
||||
if (finished) return;
|
||||
|
||||
// clean up stream
|
||||
finished = true;
|
||||
destroy(stream);
|
||||
|
||||
// error
|
||||
self.onStatError(err);
|
||||
});
|
||||
|
||||
// end
|
||||
stream.on('end', function onend(){
|
||||
self.emit('end');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set content-type based on `path`
|
||||
* if it hasn't been explicitly set.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.type = function type(path) {
|
||||
var res = this.res;
|
||||
|
||||
if (res.getHeader('Content-Type')) return;
|
||||
|
||||
var type = mime.lookup(path);
|
||||
|
||||
if (!type) {
|
||||
debug('no content-type');
|
||||
return;
|
||||
}
|
||||
|
||||
var charset = mime.charsets.lookup(type);
|
||||
|
||||
debug('content-type %s', type);
|
||||
res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
|
||||
};
|
||||
|
||||
/**
|
||||
* Set response header fields, most
|
||||
* fields may be pre-defined.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Object} stat
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.setHeader = function setHeader(path, stat){
|
||||
var res = this.res;
|
||||
|
||||
this.emit('headers', res, path, stat);
|
||||
|
||||
if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes');
|
||||
if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + Math.floor(this._maxage / 1000));
|
||||
|
||||
if (this._lastModified && !res.getHeader('Last-Modified')) {
|
||||
var modified = stat.mtime.toUTCString()
|
||||
debug('modified %s', modified)
|
||||
res.setHeader('Last-Modified', modified)
|
||||
}
|
||||
|
||||
if (this._etag && !res.getHeader('ETag')) {
|
||||
var val = etag(stat)
|
||||
debug('etag %s', val)
|
||||
res.setHeader('ETag', val)
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if path parts contain a dotfile.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function containsDotFile(parts) {
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
if (parts[i][0] === '.') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* decodeURIComponent.
|
||||
*
|
||||
* Allows V8 to only deoptimize this fn instead of all
|
||||
* of send().
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function decode(path) {
|
||||
try {
|
||||
return decodeURIComponent(path)
|
||||
} catch (err) {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize the index option into an array.
|
||||
*
|
||||
* @param {boolean|string|array} val
|
||||
* @param {string} name
|
||||
* @private
|
||||
*/
|
||||
|
||||
function normalizeList(val, name) {
|
||||
var list = [].concat(val || [])
|
||||
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (typeof list[i] !== 'string') {
|
||||
throw new TypeError(name + ' must be array of strings or false')
|
||||
}
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
50
node_modules/serve-static/node_modules/send/package.json
generated
vendored
Normal file
50
node_modules/serve-static/node_modules/send/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "send",
|
||||
"description": "Better streaming static file server with Range and conditional-GET support",
|
||||
"version": "0.13.2",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "pillarjs/send",
|
||||
"keywords": [
|
||||
"static",
|
||||
"file",
|
||||
"server"
|
||||
],
|
||||
"dependencies": {
|
||||
"debug": "~2.2.0",
|
||||
"depd": "~1.1.0",
|
||||
"destroy": "~1.0.4",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.7.0",
|
||||
"fresh": "0.3.0",
|
||||
"http-errors": "~1.3.1",
|
||||
"mime": "1.3.4",
|
||||
"ms": "0.7.1",
|
||||
"on-finished": "~2.3.0",
|
||||
"range-parser": "~1.0.3",
|
||||
"statuses": "~1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"after": "0.8.1",
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "2.4.5",
|
||||
"supertest": "1.1.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --check-leaks --reporter spec --bail",
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot"
|
||||
}
|
||||
}
|
||||
22
node_modules/serve-static/node_modules/statuses/LICENSE
generated
vendored
Normal file
22
node_modules/serve-static/node_modules/statuses/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
114
node_modules/serve-static/node_modules/statuses/README.md
generated
vendored
Normal file
114
node_modules/serve-static/node_modules/statuses/README.md
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
# Statuses
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP status utility for node.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var status = require('statuses');
|
||||
```
|
||||
|
||||
### var code = status(Integer || String)
|
||||
|
||||
If `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown.
|
||||
|
||||
```js
|
||||
status(403) // => 'Forbidden'
|
||||
status('403') // => 'Forbidden'
|
||||
status('forbidden') // => 403
|
||||
status('Forbidden') // => 403
|
||||
status(306) // throws, as it's not supported by node.js
|
||||
```
|
||||
|
||||
### status.codes
|
||||
|
||||
Returns an array of all the status codes as `Integer`s.
|
||||
|
||||
### var msg = status[code]
|
||||
|
||||
Map of `code` to `status message`. `undefined` for invalid `code`s.
|
||||
|
||||
```js
|
||||
status[404] // => 'Not Found'
|
||||
```
|
||||
|
||||
### var code = status[msg]
|
||||
|
||||
Map of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s.
|
||||
|
||||
```js
|
||||
status['not found'] // => 404
|
||||
status['Not Found'] // => 404
|
||||
```
|
||||
|
||||
### status.redirect[code]
|
||||
|
||||
Returns `true` if a status code is a valid redirect status.
|
||||
|
||||
```js
|
||||
status.redirect[200] // => undefined
|
||||
status.redirect[301] // => true
|
||||
```
|
||||
|
||||
### status.empty[code]
|
||||
|
||||
Returns `true` if a status code expects an empty body.
|
||||
|
||||
```js
|
||||
status.empty[200] // => undefined
|
||||
status.empty[204] // => true
|
||||
status.empty[304] // => true
|
||||
```
|
||||
|
||||
### status.retry[code]
|
||||
|
||||
Returns `true` if you should retry the rest.
|
||||
|
||||
```js
|
||||
status.retry[501] // => undefined
|
||||
status.retry[503] // => true
|
||||
```
|
||||
|
||||
### statuses/codes.json
|
||||
|
||||
```js
|
||||
var codes = require('statuses/codes.json');
|
||||
```
|
||||
|
||||
This is a JSON file of the status codes
|
||||
taken from `require('http').STATUS_CODES`.
|
||||
This is saved so that codes are consistent even in older node.js versions.
|
||||
For example, `308` will be added in v0.12.
|
||||
|
||||
## Adding Status Codes
|
||||
|
||||
The status codes are primarily sourced from http://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv.
|
||||
Additionally, custom codes are added from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes.
|
||||
These are added manually in the `lib/*.json` files.
|
||||
If you would like to add a status code, add it to the appropriate JSON file.
|
||||
|
||||
To rebuild `codes.json`, run the following:
|
||||
|
||||
```bash
|
||||
# update src/iana.json
|
||||
npm run update
|
||||
# build codes.json
|
||||
npm run build
|
||||
```
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/statuses.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/statuses
|
||||
[node-version-image]: http://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/jshttp/statuses
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg?style=flat
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
|
||||
[downloads-image]: http://img.shields.io/npm/dm/statuses.svg?style=flat
|
||||
[downloads-url]: https://npmjs.org/package/statuses
|
||||
64
node_modules/serve-static/node_modules/statuses/codes.json
generated
vendored
Normal file
64
node_modules/serve-static/node_modules/statuses/codes.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"100": "Continue",
|
||||
"101": "Switching Protocols",
|
||||
"102": "Processing",
|
||||
"200": "OK",
|
||||
"201": "Created",
|
||||
"202": "Accepted",
|
||||
"203": "Non-Authoritative Information",
|
||||
"204": "No Content",
|
||||
"205": "Reset Content",
|
||||
"206": "Partial Content",
|
||||
"207": "Multi-Status",
|
||||
"208": "Already Reported",
|
||||
"226": "IM Used",
|
||||
"300": "Multiple Choices",
|
||||
"301": "Moved Permanently",
|
||||
"302": "Found",
|
||||
"303": "See Other",
|
||||
"304": "Not Modified",
|
||||
"305": "Use Proxy",
|
||||
"306": "(Unused)",
|
||||
"307": "Temporary Redirect",
|
||||
"308": "Permanent Redirect",
|
||||
"400": "Bad Request",
|
||||
"401": "Unauthorized",
|
||||
"402": "Payment Required",
|
||||
"403": "Forbidden",
|
||||
"404": "Not Found",
|
||||
"405": "Method Not Allowed",
|
||||
"406": "Not Acceptable",
|
||||
"407": "Proxy Authentication Required",
|
||||
"408": "Request Timeout",
|
||||
"409": "Conflict",
|
||||
"410": "Gone",
|
||||
"411": "Length Required",
|
||||
"412": "Precondition Failed",
|
||||
"413": "Payload Too Large",
|
||||
"414": "URI Too Long",
|
||||
"415": "Unsupported Media Type",
|
||||
"416": "Range Not Satisfiable",
|
||||
"417": "Expectation Failed",
|
||||
"418": "I'm a teapot",
|
||||
"422": "Unprocessable Entity",
|
||||
"423": "Locked",
|
||||
"424": "Failed Dependency",
|
||||
"425": "Unordered Collection",
|
||||
"426": "Upgrade Required",
|
||||
"428": "Precondition Required",
|
||||
"429": "Too Many Requests",
|
||||
"431": "Request Header Fields Too Large",
|
||||
"451": "Unavailable For Legal Reasons",
|
||||
"500": "Internal Server Error",
|
||||
"501": "Not Implemented",
|
||||
"502": "Bad Gateway",
|
||||
"503": "Service Unavailable",
|
||||
"504": "Gateway Timeout",
|
||||
"505": "HTTP Version Not Supported",
|
||||
"506": "Variant Also Negotiates",
|
||||
"507": "Insufficient Storage",
|
||||
"508": "Loop Detected",
|
||||
"509": "Bandwidth Limit Exceeded",
|
||||
"510": "Not Extended",
|
||||
"511": "Network Authentication Required"
|
||||
}
|
||||
60
node_modules/serve-static/node_modules/statuses/index.js
generated
vendored
Normal file
60
node_modules/serve-static/node_modules/statuses/index.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
var codes = require('./codes.json');
|
||||
|
||||
module.exports = status;
|
||||
|
||||
// [Integer...]
|
||||
status.codes = Object.keys(codes).map(function (code) {
|
||||
code = ~~code;
|
||||
var msg = codes[code];
|
||||
status[code] = msg;
|
||||
status[msg] = status[msg.toLowerCase()] = code;
|
||||
return code;
|
||||
});
|
||||
|
||||
// status codes for redirects
|
||||
status.redirect = {
|
||||
300: true,
|
||||
301: true,
|
||||
302: true,
|
||||
303: true,
|
||||
305: true,
|
||||
307: true,
|
||||
308: true,
|
||||
};
|
||||
|
||||
// status codes for empty bodies
|
||||
status.empty = {
|
||||
204: true,
|
||||
205: true,
|
||||
304: true,
|
||||
};
|
||||
|
||||
// status codes for when you should retry the request
|
||||
status.retry = {
|
||||
502: true,
|
||||
503: true,
|
||||
504: true,
|
||||
};
|
||||
|
||||
function status(code) {
|
||||
if (typeof code === 'number') {
|
||||
if (!status[code]) throw new Error('invalid status code: ' + code);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (typeof code !== 'string') {
|
||||
throw new TypeError('code must be a number or string');
|
||||
}
|
||||
|
||||
// '403'
|
||||
var n = parseInt(code, 10)
|
||||
if (!isNaN(n)) {
|
||||
if (!status[n]) throw new Error('invalid status code: ' + n);
|
||||
return n;
|
||||
}
|
||||
|
||||
n = status[code.toLowerCase()];
|
||||
if (!n) throw new Error('invalid status message: "' + code + '"');
|
||||
return n;
|
||||
}
|
||||
36
node_modules/serve-static/node_modules/statuses/package.json
generated
vendored
Normal file
36
node_modules/serve-static/node_modules/statuses/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "statuses",
|
||||
"description": "HTTP status utility",
|
||||
"version": "1.2.1",
|
||||
"author": {
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com",
|
||||
"twitter": "https://twitter.com/jongleberry"
|
||||
},
|
||||
"repository": "jshttp/statuses",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"http",
|
||||
"status",
|
||||
"code"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"codes.json",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"csv-parse": "0.0.6",
|
||||
"istanbul": "0",
|
||||
"mocha": "1",
|
||||
"stream-to-array": "2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js",
|
||||
"update": "node scripts/update.js",
|
||||
"test": "mocha --reporter spec --bail --check-leaks",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks"
|
||||
}
|
||||
}
|
||||
32
node_modules/serve-static/package.json
generated
vendored
32
node_modules/serve-static/package.json
generated
vendored
@@ -1,28 +1,23 @@
|
||||
{
|
||||
"name": "serve-static",
|
||||
"description": "Serve static files",
|
||||
"version": "1.15.0",
|
||||
"version": "1.10.3",
|
||||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"license": "MIT",
|
||||
"repository": "expressjs/serve-static",
|
||||
"dependencies": {
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "0.18.0"
|
||||
"parseurl": "~1.3.1",
|
||||
"send": "0.13.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "5.2.0",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.2",
|
||||
"nyc": "15.1.0",
|
||||
"safe-buffer": "5.2.1",
|
||||
"supertest": "6.2.2"
|
||||
"eslint": "2.11.1",
|
||||
"eslint-config-standard": "5.3.1",
|
||||
"eslint-plugin-promise": "1.3.1",
|
||||
"eslint-plugin-standard": "1.3.2",
|
||||
"istanbul": "0.4.3",
|
||||
"mocha": "2.5.3",
|
||||
"supertest": "1.1.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
@@ -33,10 +28,9 @@
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"lint": "eslint **/*.js",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"version": "node scripts/version-history.js && git add HISTORY.md"
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user