diff options
Diffstat (limited to 'node_modules/@shellscape/koa-static')
| -rw-r--r-- | node_modules/@shellscape/koa-static/History.md | 113 | ||||
| -rw-r--r-- | node_modules/@shellscape/koa-static/Readme.md | 86 | ||||
| -rw-r--r-- | node_modules/@shellscape/koa-static/index.js | 73 | ||||
| -rw-r--r-- | node_modules/@shellscape/koa-static/legacy/index.js | 92 | ||||
| -rw-r--r-- | node_modules/@shellscape/koa-static/package.json | 53 |
5 files changed, 0 insertions, 417 deletions
diff --git a/node_modules/@shellscape/koa-static/History.md b/node_modules/@shellscape/koa-static/History.md deleted file mode 100644 index f5dbcab1..00000000 --- a/node_modules/@shellscape/koa-static/History.md +++ /dev/null @@ -1,113 +0,0 @@ - -4.0.2 / 2017-11-16 -================== - -* Fix: `serve` mutates `opts` argument so it cannot be reused (#117) - -4.0.1 / 2017-07-09 -================== - - * Fix: throw error if error status not 404 - * fix `index: false` bug if path is directory - -4.0.0 / 2017-07-03 -================== - - * upgrade to koa-send@4 - * use async function - -3.0.0 / 2016-03-24 -================== - - * support koa 2.x - * travis: test node@4+ - -2.0.0 / 2016-01-07 -================== - - * bump koa-send@~3.1.0 - -1.5.2 / 2015-11-03 -================== - - * Fix: default index could be disabled. Closes #41 - -1.5.1 / 2015-10-14 -================== - - * Fix v1.4.x → 1.5.0 broken. Closes #53 - -1.5.0 / 2015-10-14 -================== - - * update koa-send@2 - * update devDeps - -1.4.9 / 2015-02-03 -================== - - * only support GET and HEAD requests - -1.4.8 / 2014-12-17 -================== - - * support root = `.` - -1.4.7 / 2014-09-07 -================== - - * update koa-send - -1.4.5 / 2014-05-05 -================== - - * Fix response already handled logic - Koajs now defaults status == 404. See koajs/koa#269 - -1.4.4 / 2014-05-04 -================== - - * Add two missing semicolons. Closes #24 - * Use bash syntax highlighting for install command. Closes #23 - * named generator function to help debugging. Closes #20 - -1.4.3 / 2014-02-11 -================== - - * update koa-send - -1.4.2 / 2014-01-07 -================== - - * update koa-send - -1.4.1 / 2013-12-30 -================== - - * fix for koa 0.2.1. Closes #12 - -1.4.0 / 2013-12-20 -================== - - * add: defer option - semi-breaking change - -1.3.0 / 2013-12-11 -================== - - * refactor to use koa-send - * rename maxAge -> maxage - * fix: don't bother responding if response already "handled" - -1.2.0 / 2013-09-14 -================== - - * add Last-Modified. Closes #5 - -1.1.1 / 2013-09-13 -================== - - * fix upstream responses - -1.1.0 / 2013-09-13 -================== - - * rewrite without send diff --git a/node_modules/@shellscape/koa-static/Readme.md b/node_modules/@shellscape/koa-static/Readme.md deleted file mode 100644 index 16c32eaa..00000000 --- a/node_modules/@shellscape/koa-static/Readme.md +++ /dev/null @@ -1,86 +0,0 @@ -# koa-static - -[![NPM version][npm-image]][npm-url] -[![Build status][travis-image]][travis-url] -[![Test coverage][coveralls-image]][coveralls-url] -[![Dependency Status][david-image]][david-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - - Koa static file serving middleware, wrapper for [`koa-send`](https://github.com/koajs/send). - -## Installation - -```bash -$ npm install koa-static -``` - -## API - -```js -const Koa = require('koa'); -const app = new Koa(); -app.use(require('koa-static')(root, opts)); -``` - -* `root` root directory string. nothing above this root directory can be served -* `opts` options object. - -### Options - - - `maxage` Browser cache max-age in milliseconds. defaults to 0 - - `hidden` Allow transfer of hidden files. defaults to false - - `index` Default file name, defaults to 'index.html' - - `defer` If true, serves after `return next()`, allowing any downstream middleware to respond first. - - `gzip` Try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested file with .gz extension exists. defaults to true. - - `br` Try to serve the brotli version of a file automatically when brotli is supported by a client and if the requested file with .br extension exists (note, that brotli is only accepted over https). defaults to true. - - [setHeaders](https://github.com/koajs/send#setheaders) Function to set custom headers on response. - - `extensions` Try to match extensions from passed array to search for file when no extension is sufficed in URL. First found is served. (defaults to `false`) - -## Example - -```js -const serve = require('koa-static'); -const Koa = require('koa'); -const app = new Koa(); - -// $ GET /package.json -app.use(serve('.')); - -// $ GET /hello.txt -app.use(serve('test/fixtures')); - -// or use absolute paths -app.use(serve(__dirname + '/test/fixtures')); - -app.listen(3000); - -console.log('listening on port 3000'); -``` - -### See also - - - [koajs/conditional-get](https://github.com/koajs/conditional-get) Conditional GET support for koa - - [koajs/compress](https://github.com/koajs/compress) Compress middleware for koa - - [koajs/mount](https://github.com/koajs/mount) Mount `koa-static` to a specific path - -## License - - MIT - -[npm-image]: https://img.shields.io/npm/v/koa-static.svg?style=flat-square -[npm-url]: https://npmjs.org/package/koa-static -[github-tag]: http://img.shields.io/github/tag/koajs/static.svg?style=flat-square -[github-url]: https://github.com/koajs/static/tags -[travis-image]: https://img.shields.io/travis/koajs/static.svg?style=flat-square -[travis-url]: https://travis-ci.org/koajs/static -[coveralls-image]: https://img.shields.io/coveralls/koajs/static.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/koajs/static?branch=master -[david-image]: http://img.shields.io/david/koajs/static.svg?style=flat-square -[david-url]: https://david-dm.org/koajs/static -[license-image]: http://img.shields.io/npm/l/koa-static.svg?style=flat-square -[license-url]: LICENSE -[downloads-image]: http://img.shields.io/npm/dm/koa-static.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/koa-static -[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square -[gittip-url]: https://www.gittip.com/jonathanong/ diff --git a/node_modules/@shellscape/koa-static/index.js b/node_modules/@shellscape/koa-static/index.js deleted file mode 100644 index 02355ef0..00000000 --- a/node_modules/@shellscape/koa-static/index.js +++ /dev/null @@ -1,73 +0,0 @@ - -'use strict' - -/** - * Module dependencies. - */ - -const debug = require('debug')('koa-static') -const { resolve } = require('path') -const assert = require('assert') -const send = require('koa-send') - -/** - * Expose `serve()`. - */ - -module.exports = serve - -/** - * Serve static files from `root`. - * - * @param {String} root - * @param {Object} [opts] - * @return {Function} - * @api public - */ - -function serve (root, opts) { - opts = Object.assign({}, opts) - - assert(root, 'root directory is required to serve files') - - // options - debug('static "%s" %j', root, opts) - opts.root = resolve(root) - if (opts.index !== false) opts.index = opts.index || 'index.html' - - if (!opts.defer) { - return async function serve (ctx, next) { - let done = false - - if (ctx.method === 'HEAD' || ctx.method === 'GET') { - try { - done = await send(ctx, ctx.path, opts) - } catch (err) { - if (err.status !== 404) { - throw err - } - } - } - - if (!done) { - await next() - } - } - } - - return async function serve (ctx, next) { - await next() - - if (ctx.method !== 'HEAD' && ctx.method !== 'GET') return - // response is already handled - if (ctx.body != null || ctx.status !== 404) return // eslint-disable-line - - try { - await send(ctx, ctx.path, opts) - } catch (err) { - if (err.status !== 404) { - throw err - } - } - } -} diff --git a/node_modules/@shellscape/koa-static/legacy/index.js b/node_modules/@shellscape/koa-static/legacy/index.js deleted file mode 100644 index fe21365b..00000000 --- a/node_modules/@shellscape/koa-static/legacy/index.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; -/** - * Module dependencies. - */ - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; } - -const debug = require('debug')('koa-static'); - -const { - resolve -} = require('path'); - -const assert = require('assert'); - -const send = require("@shellscape/koa-send/legacy"); -/** - * Expose `serve()`. - */ - - -module.exports = serve; -/** - * Serve static files from `root`. - * - * @param {String} root - * @param {Object} [opts] - * @return {Function} - * @api public - */ - -function serve(root, opts) { - opts = Object.assign({}, opts); - assert(root, 'root directory is required to serve files'); // options - - debug('static "%s" %j', root, opts); - opts.root = resolve(root); - if (opts.index !== false) opts.index = opts.index || 'index.html'; - - if (!opts.defer) { - return ( - /*#__PURE__*/ - function () { - var _serve = _asyncToGenerator(function* (ctx, next) { - let done = false; - - if (ctx.method === 'HEAD' || ctx.method === 'GET') { - try { - done = yield send(ctx, ctx.path, opts); - } catch (err) { - if (err.status !== 404) { - throw err; - } - } - } - - if (!done) { - yield next(); - } - }); - - return function serve(_x, _x2) { - return _serve.apply(this, arguments); - }; - }() - ); - } - - return ( - /*#__PURE__*/ - function () { - var _serve2 = _asyncToGenerator(function* (ctx, next) { - yield next(); - if (ctx.method !== 'HEAD' && ctx.method !== 'GET') return; // response is already handled - - if (ctx.body != null || ctx.status !== 404) return; // eslint-disable-line - - try { - yield send(ctx, ctx.path, opts); - } catch (err) { - if (err.status !== 404) { - throw err; - } - } - }); - - return function serve(_x3, _x4) { - return _serve2.apply(this, arguments); - }; - }() - ); -} diff --git a/node_modules/@shellscape/koa-static/package.json b/node_modules/@shellscape/koa-static/package.json deleted file mode 100644 index 24a4d5b9..00000000 --- a/node_modules/@shellscape/koa-static/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@shellscape/koa-static", - "description": "Static file serving middleware for koa", - "repository": "shellscape/koa-static", - "version": "4.0.5", - "keywords": [ - "koa", - "middleware", - "file", - "static", - "sendfile" - ], - "files": [ - "index.js", - "legacy/index.js" - ], - "publishConfig": { - "access": "public" - }, - "devDependencies": { - "@babel/cli": "^7.0.0-beta.39", - "@babel/core": "^7.0.0-beta.39", - "@babel/polyfill": "^7.0.0-beta.39", - "@babel/preset-env": "^7.0.0-beta.39", - "@babel/register": "^7.0.0-beta.39", - "babel-plugin-module-resolver": "^3.0.0", - "eslint": "^4.1.1", - "eslint-config-standard": "^10.2.1", - "eslint-plugin-import": "^2.6.1", - "eslint-plugin-node": "^5.1.0", - "eslint-plugin-promise": "^3.5.0", - "eslint-plugin-standard": "^3.0.1", - "istanbul": "^0.4.5", - "koa": "^2.3.0", - "mocha": "^3.4.2", - "supertest": "^3.0.0" - }, - "license": "MIT", - "dependencies": { - "debug": "^2.6.8", - "@shellscape/koa-send": "^4.1.0" - }, - "scripts": { - "lint": "eslint --fix .", - "prepublishOnly": "babel index.js --out-file legacy/index.js", - "test": "npm run prepublishOnly && mocha --harmony --reporter spec", - "test-cov": "node --harmony ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha", - "test-travis": "node --harmony ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly" - }, - "engines": { - "node": ">= 6" - } -} |
