This commit is contained in:
chrosey
2017-09-13 07:52:34 +02:00
parent a1f16c37f4
commit 2340b0226b
24621 changed files with 2912161 additions and 149 deletions
+67
View File
@@ -0,0 +1,67 @@
2.0.10 / 2017-03-23
===================
* deps: mime-db@'>= 1.27.0 < 2'
2.0.9 / 2016-10-31
==================
* Fix regex fallback to not override `compressible: false` in db
* deps: mime-db@'>= 1.24.0 < 2'
2.0.8 / 2016-05-12
==================
* deps: mime-db@'>= 1.23.0 < 2'
2.0.7 / 2016-01-18
==================
* deps: mime-db@'>= 1.21.0 < 2'
2.0.6 / 2015-09-29
==================
* deps: mime-db@'>= 1.19.0 < 2'
2.0.5 / 2015-07-30
==================
* deps: mime-db@'>= 1.16.0 < 2'
2.0.4 / 2015-07-01
==================
* deps: mime-db@'>= 1.14.0 < 2'
* perf: enable strict mode
2.0.3 / 2015-06-08
==================
* Fix regex fallback to work if type exists, but is undefined
* perf: hoist regex declaration
* perf: use regex to extract mime
* deps: mime-db@'>= 1.13.0 < 2'
2.0.2 / 2015-01-31
==================
* deps: mime-db@'>= 1.1.2 < 2'
2.0.1 / 2014-09-28
==================
* deps: mime-db@1.x
- Add new mime types
- Add additional compressible
- Update charsets
2.0.0 / 2014-09-02
==================
* use mime-db
* remove .get()
* specifications are now private
* regex is now private
* stricter regex
+24
View File
@@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2013 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2014 Jeremiah Senkpiel <fishrock123@rocketmail.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+62
View File
@@ -0,0 +1,62 @@
# compressible
[![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]
Compressible `Content-Type` / `mime` checking.
## Installation
```sh
$ npm install compressible
```
## API
<!-- eslint-disable no-unused-vars -->
```js
var compressible = require('compressible')
```
### compressible(type)
Checks if the given `Content-Type` is compressible. The `type` argument is expected
to be a value MIME type or `Content-Type` string, though no validation is performed.
The MIME is looked up in the [`mime-db`](https://www.npmjs.com/package/mime-db) and
if there is compressible information in the database entry, that is returned. Otherwise,
this module will fallback to `true` for the following types:
* `text/*`
* `*/*+json`
* `*/*+text`
* `*/*+xml`
If this module is not sure if a type is specifically compressible or specifically
uncompressible, `undefined` is returned.
<!-- eslint-disable no-undef -->
```js
compressible('text/html') // => true
compressible('image/png') // => false
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/compressible.svg
[npm-url]: https://npmjs.org/package/compressible
[node-version-image]: https://img.shields.io/node/v/compressible.svg
[node-version-url]: https://nodejs.org/en/download/
[travis-image]: https://img.shields.io/travis/jshttp/compressible/master.svg
[travis-url]: https://travis-ci.org/jshttp/compressible
[coveralls-image]: https://img.shields.io/coveralls/jshttp/compressible/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/compressible?branch=master
[downloads-image]: https://img.shields.io/npm/dm/compressible.svg
[downloads-url]: https://npmjs.org/package/compressible
+58
View File
@@ -0,0 +1,58 @@
/*!
* compressible
* Copyright(c) 2013 Jonathan Ong
* Copyright(c) 2014 Jeremiah Senkpiel
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var db = require('mime-db')
/**
* Module variables.
* @private
*/
var compressibleTypeRegExp = /^text\/|\+json$|\+text$|\+xml$/i
var extractTypeRegExp = /^\s*([^;\s]*)(?:;|\s|$)/
/**
* Module exports.
* @public
*/
module.exports = compressible
/**
* Checks if a type is compressible.
*
* @param {string} type
* @return {Boolean} compressible
* @public
*/
function compressible (type) {
if (!type || typeof type !== 'string') {
return false
}
// strip parameters
var match = extractTypeRegExp.exec(type)
var mime = match && match[1].toLowerCase()
var data = db[mime]
// return database information
if (data && data.compressible !== undefined) {
return data.compressible
}
// fallback to regexp or unknown
return compressibleTypeRegExp.test(mime) || undefined
}
+147
View File
@@ -0,0 +1,147 @@
{
"_args": [
[
{
"raw": "compressible@~2.0.8",
"scope": null,
"escapedName": "compressible",
"name": "compressible",
"rawSpec": "~2.0.8",
"spec": ">=2.0.8 <2.1.0",
"type": "range"
},
"c:\\xampp\\htdocs\\laravel\\node_modules\\compression"
]
],
"_from": "compressible@>=2.0.8 <2.1.0",
"_id": "compressible@2.0.10",
"_inCache": true,
"_location": "/compressible",
"_nodeVersion": "4.7.3",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/compressible-2.0.10.tgz_1490330888540_0.3248714415822178"
},
"_npmUser": {
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
"_npmVersion": "2.15.11",
"_phantomChildren": {},
"_requested": {
"raw": "compressible@~2.0.8",
"scope": null,
"escapedName": "compressible",
"name": "compressible",
"rawSpec": "~2.0.8",
"spec": ">=2.0.8 <2.1.0",
"type": "range"
},
"_requiredBy": [
"/compression"
],
"_resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.10.tgz",
"_shasum": "feda1c7f7617912732b29bf8cf26252a20b9eecd",
"_shrinkwrap": null,
"_spec": "compressible@~2.0.8",
"_where": "c:\\xampp\\htdocs\\laravel\\node_modules\\compression",
"bugs": {
"url": "https://github.com/jshttp/compressible/issues"
},
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
{
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
{
"name": "Jeremiah Senkpiel",
"email": "fishrock123@rocketmail.com",
"url": "https://searchbeam.jit.su"
}
],
"dependencies": {
"mime-db": ">= 1.27.0 < 2"
},
"description": "Compressible Content-Type / mime checking",
"devDependencies": {
"eslint": "3.18.0",
"eslint-config-standard": "7.1.0",
"eslint-plugin-markdown": "1.0.0-beta.4",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "2.1.1",
"istanbul": "0.4.5",
"mocha": "~1.21.5"
},
"directories": {},
"dist": {
"shasum": "feda1c7f7617912732b29bf8cf26252a20b9eecd",
"tarball": "https://registry.npmjs.org/compressible/-/compressible-2.0.10.tgz"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"HISTORY.md",
"LICENSE",
"README.md",
"index.js"
],
"gitHead": "235bc74b36aa7fe854df88ce2c68242c0a4ca938",
"homepage": "https://github.com/jshttp/compressible#readme",
"keywords": [
"compress",
"gzip",
"mime",
"content-type"
],
"license": "MIT",
"maintainers": [
{
"name": "defunctzombie",
"email": "shtylman@gmail.com"
},
{
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
{
"name": "federomero",
"email": "federomero@gmail.com"
},
{
"name": "fishrock123",
"email": "fishrock123@rocketmail.com"
},
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
{
"name": "mscdex",
"email": "mscdex@mscdex.net"
},
{
"name": "tjholowaychuk",
"email": "tj@vision-media.ca"
}
],
"name": "compressible",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/compressible.git"
},
"scripts": {
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"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 dot --check-leaks"
},
"version": "2.0.10"
}