init
This commit is contained in:
commit
e8de544ece
5
.idea/.gitignore
vendored
Normal file
5
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
6
.idea/misc.xml
Normal file
6
.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/multiview.iml" filepath="$PROJECT_DIR$/.idea/multiview.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
12
.idea/multiview.iml
Normal file
12
.idea/multiview.iml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
78
live/css/design.css
Normal file
78
live/css/design.css
Normal file
@ -0,0 +1,78 @@
|
||||
html, body {
|
||||
background-color: #000000;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
font-family: 'Muli', sans-serif;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
#container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
.quarter {
|
||||
width: calc(50% - 5px);
|
||||
float: left;
|
||||
}
|
||||
.stream {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border: 3px solid #000000;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
padding-bottom: 56.55%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.active {
|
||||
border: 3px solid #ff3333;
|
||||
}
|
||||
|
||||
.title {
|
||||
background-color: #000000;
|
||||
opacity: 0.3;
|
||||
border-bottom-right-radius: 4px;
|
||||
padding: 0px 8px 5px 5px;
|
||||
color: #ffffff;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1500;
|
||||
}
|
||||
|
||||
.live .overlay {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.offline {
|
||||
background-color: #111111;
|
||||
}
|
||||
|
||||
.offline p {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
|
||||
}
|
80
live/index.html
Normal file
80
live/index.html
Normal file
@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Multiview News</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet">
|
||||
<link href="/css/design.css" rel="stylesheet">
|
||||
<link href="https://vjs.zencdn.net/7.3.0/video-js.css" rel="stylesheet">
|
||||
<script src="https://www.youtube.com/iframe_api"></script>
|
||||
<script src= "https://player.twitch.tv/js/embed/v1.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div class="quarter">
|
||||
<div class="wrapper">
|
||||
<div class="stream live youtube" data-youtube-id="skynews-youtube">
|
||||
<div class="overlay"></div>
|
||||
<div class="title">Sky News</div>
|
||||
<iframe id="skynews-youtube" type="text/html" frameborder="0" width="100%" height="100%"
|
||||
src="http://www.youtube.com/embed/9Auq9mYxFEE?enablejsapi=1&autoplay=1&mute=1&controls=0&fs=0&modestbranding=1"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarter">
|
||||
<div class="wrapper">
|
||||
<div class="stream live" data-video-id="2" data-video-source="https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_news24.m3u8">
|
||||
<div class="overlay"></div>
|
||||
<div class="title">BBC News</div>
|
||||
<video id="video_stream2" class="video-js vjs-16-9" autoplay muted preload="auto" data-setup='{ "youtube": { "ytControls": 0 } }'>
|
||||
<source src="https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_news24.m3u8" type="application/x-mpegURL">
|
||||
</video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarter">
|
||||
<div class="wrapper">
|
||||
<!--<div class="stream live" data-video-id="3" data-video-source="https://churro.prod.reuters.tv/rest/v2/live/playlist/story/371233">
|
||||
<div class="overlay"></div>
|
||||
<div class="title">Reuters - France/Germany Border</div>
|
||||
<video id="video_stream3" class="video-js vjs-16-9" autoplay muted preload="auto" data-setup='{ "youtube": { "ytControls": 0 } }'>
|
||||
<source src="https://churro.prod.reuters.tv/rest/v2/live/playlist/story/371233" type="application/x-mpegURL">
|
||||
</video>
|
||||
</div>-->
|
||||
<div class="stream live youtube" data-youtube-id="euronews-youtube">
|
||||
<div class="overlay"></div>
|
||||
<div class="title">Euronews</div>
|
||||
<iframe id="euronews-youtube" type="text/html" frameborder="0" width="100%" height="100%"
|
||||
src="https://www.youtube.com/embed/6xrJy-1_qS4?enablejsapi=1&autoplay=1&mute=1&controls=0&fs=0&modestbranding=1"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarter">
|
||||
<div class="wrapper">
|
||||
<div class="stream live twitch" data-video-id="4" data-twitch-id="twitch-rukpolitics" id="twitch-rukpolitics">
|
||||
<div class="overlay"></div>
|
||||
<div class="title">twitch.tv/rukpolitics</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://vjs.zencdn.net/7.3.0/video.js"></script>
|
||||
<script src="/js/videojs.youtube.min.js"></script>
|
||||
<script
|
||||
src="https://code.jquery.com/jquery-3.3.1.min.js"
|
||||
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://js.pusher.com/4.3/pusher.min.js"></script>
|
||||
<script src="/js/multiview.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(() => {
|
||||
Multiview.playTwitch('twitch-rukpolitics', 'rukpolitics');
|
||||
Multiview.playYoutube('skynews-youtube');
|
||||
Multiview.playYoutube('euronews-youtube');
|
||||
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
192
live/js/multiview.js
Normal file
192
live/js/multiview.js
Normal file
@ -0,0 +1,192 @@
|
||||
var Multiview = {
|
||||
host: 'ws.silvrtree.co.cuk',
|
||||
port: 80,
|
||||
appId: 'multiview',
|
||||
pusher: null,
|
||||
youtube: {},
|
||||
twitch: {},
|
||||
|
||||
init: function () {
|
||||
jQuery(document).ready(function () {
|
||||
Multiview.ready();
|
||||
})
|
||||
},
|
||||
|
||||
ready: function () {
|
||||
Multiview.bindEvents();
|
||||
//Multiview.connectToPusher();
|
||||
},
|
||||
|
||||
playYoutube: function(id) {
|
||||
console.log(YT);
|
||||
this.youtube[id]= new YT.Player(id, {
|
||||
'events': {
|
||||
'onReady': function(event) {
|
||||
event.target.mute();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
playTwitch: function(id, channel) {
|
||||
this.twitch[id]= new Twitch.Player(id, {
|
||||
'channel': channel,
|
||||
'muted': true,
|
||||
'width': '100%',
|
||||
'height': '100%'
|
||||
});
|
||||
},
|
||||
|
||||
connectToPusher: function()
|
||||
{
|
||||
this.pusher = new Pusher('092c4207-a7c6-4964-ac32-7a93feb511f6', {
|
||||
wsHost: this.host,
|
||||
wsPort: this.port,
|
||||
wssPort: this.port,
|
||||
disableStats: true,
|
||||
authEndpoint: '/laravel-websockets/auth',
|
||||
auth: {
|
||||
headers: {
|
||||
'X-App-ID': this.appId
|
||||
}
|
||||
},
|
||||
enabledTransports: ['ws', 'flash']
|
||||
});
|
||||
this.pusher.subscribe('multiview').bind('App\\Events\\ChannelStatusEvent', function (data) {
|
||||
Multiview.processStatus(data.streams);
|
||||
});
|
||||
},
|
||||
|
||||
bindEvents: function () {
|
||||
jQuery('.stream .overlay').unbind('click');
|
||||
jQuery('.stream .overlay').click(function() {
|
||||
Multiview.toggleStream(jQuery(this).parent());
|
||||
});
|
||||
},
|
||||
|
||||
toggleStream: function(streamContainer) {
|
||||
if (streamContainer.hasClass('active')) {
|
||||
Multiview.muteStream(streamContainer);
|
||||
} else {
|
||||
if (!streamContainer.hasClass('live')) {
|
||||
return;
|
||||
}
|
||||
Multiview.unmuteStream(streamContainer);
|
||||
}
|
||||
},
|
||||
|
||||
muteStream: function(streamContainer) {
|
||||
console.log('Muting ', streamContainer);
|
||||
console.log('streamContainer class', streamContainer.class);
|
||||
if (streamContainer.hasClass('youtube')) {
|
||||
let id = streamContainer.attr('data-youtube-id');
|
||||
if (this.youtube.hasOwnProperty(id)) {
|
||||
this.youtube[id].mute();
|
||||
streamContainer.removeClass('active');
|
||||
}
|
||||
} else if (streamContainer.hasClass('twitch')) {
|
||||
let id = streamContainer.attr('data-twitch-id');
|
||||
if (this.twitch.hasOwnProperty(id)) {
|
||||
this.twitch[id].setMuted(true);
|
||||
streamContainer.removeClass('active');
|
||||
}
|
||||
} else {
|
||||
streamContainer.removeClass('active');
|
||||
try {
|
||||
videojs('video_stream' + streamContainer.attr('data-video-id')).muted(true);
|
||||
} catch (ex) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
unmuteStream: function(streamContainer) {
|
||||
console.log('Unmuting ', streamContainer);
|
||||
console.log('streamContainer id', streamContainer.attr('data-youtube-id'));
|
||||
if (streamContainer.hasClass('youtube')) {
|
||||
let id = streamContainer.attr('data-youtube-id');
|
||||
|
||||
console.log('id', id);
|
||||
console.log(this.youtube);
|
||||
|
||||
if (this.youtube.hasOwnProperty(id)) {
|
||||
jQuery('.stream').each(function() {
|
||||
Multiview.muteStream(jQuery(this));
|
||||
})
|
||||
streamContainer.addClass('active');
|
||||
this.youtube[id].unMute();
|
||||
}
|
||||
} else if (streamContainer.hasClass('twitch')) {
|
||||
let id = streamContainer.attr('data-twitch-id');
|
||||
if (this.twitch.hasOwnProperty(id)) {
|
||||
jQuery('.stream').each(function() {
|
||||
Multiview.muteStream(jQuery(this));
|
||||
})
|
||||
streamContainer.addClass('active');
|
||||
this.twitch[id].setMuted(false);
|
||||
}
|
||||
} else {
|
||||
jQuery('.stream').each(function() {
|
||||
Multiview.muteStream(jQuery(this));
|
||||
})
|
||||
streamContainer.addClass('active');
|
||||
const id = 'video_stream' + streamContainer.attr('data-video-id');
|
||||
try {
|
||||
videojs('video_stream' + streamContainer.attr('data-video-id')).muted(false);
|
||||
} catch (ex) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
removeStream: function(streamNumber) {
|
||||
const streamContainer = jQuery('div[data-video-id=' + streamNumber + ']');
|
||||
streamContainer.removeAttr('data-video-source');
|
||||
streamContainer.html('<p>Stream Offline</p>');
|
||||
streamContainer.attr('class', 'stream offline');
|
||||
},
|
||||
|
||||
addStream: function(streamNumber, title, source, type)
|
||||
{
|
||||
let oldPlayer = videojs('video_stream' + streamNumber);
|
||||
if (oldPlayer) {
|
||||
oldPlayer.dispose();
|
||||
}
|
||||
const streamContainer = jQuery('div[data-video-id=' + streamNumber + ']');
|
||||
streamContainer.attr('class', 'stream live');
|
||||
streamContainer.attr('data-video-source', source);
|
||||
let html = '';
|
||||
html += '<div class="overlay"></div>';
|
||||
html += '<div class="title">' + title + '</div>';
|
||||
html += '<video id="video_stream' + streamNumber + '" class="video-js vjs-16-9" autoplay="autoplay" muted="muted" preload="auto" >';
|
||||
html += '<source src="' + source + '" type="' + type + '">';
|
||||
html += '</video>';
|
||||
streamContainer.html(html);
|
||||
videojs('video_stream' + streamNumber, {});
|
||||
Multiview.bindEvents();
|
||||
},
|
||||
|
||||
processStatus: function(streams) {
|
||||
streams.forEach(stream => {
|
||||
Multiview.updateStream(stream.id, stream);
|
||||
});
|
||||
},
|
||||
|
||||
updateStream: function(streamNumber, stream)
|
||||
{
|
||||
if (!stream.live) {
|
||||
Multiview.removeStream(streamNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
let currentVideoSource = jQuery('div[data-video-id=' + streamNumber + ']').attr('data-video-source');
|
||||
if (currentVideoSource === stream.url) {
|
||||
return;
|
||||
}
|
||||
|
||||
Multiview.addStream(streamNumber, stream.title, stream.url, stream.type);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
Multiview.init();
|
544
live/js/videojs.youtube.min.js
vendored
Normal file
544
live/js/videojs.youtube.min.js
vendored
Normal file
@ -0,0 +1,544 @@
|
||||
(function (root, factory) {
|
||||
if (typeof exports === "object" && typeof module !== "undefined") {
|
||||
var videojs = require("video.js");
|
||||
module.exports = factory(videojs.default || videojs)
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
define(["videojs"], function (videojs) {
|
||||
return root.Youtube = factory(videojs)
|
||||
})
|
||||
} else {
|
||||
root.Youtube = factory(root.videojs)
|
||||
}
|
||||
})(this, function (videojs) {
|
||||
"use strict";
|
||||
var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID;
|
||||
var Tech = videojs.getTech("Tech");
|
||||
var Youtube = videojs.extend(Tech, {
|
||||
constructor: function (options, ready) {
|
||||
Tech.call(this, options, ready);
|
||||
this.setPoster(options.poster);
|
||||
this.setSrc(this.options_.source, true);
|
||||
this.setTimeout(function () {
|
||||
if (this.el_) {
|
||||
this.el_.parentNode.className += " vjs-youtube";
|
||||
if (_isOnMobile) {
|
||||
this.el_.parentNode.className += " vjs-youtube-mobile"
|
||||
}
|
||||
if (Youtube.isApiReady) {
|
||||
this.initYTPlayer()
|
||||
} else {
|
||||
Youtube.apiReadyQueue.push(this)
|
||||
}
|
||||
}
|
||||
}.bind(this))
|
||||
}, dispose: function () {
|
||||
if (this.ytPlayer) {
|
||||
if (this.ytPlayer.stopVideo) {
|
||||
this.ytPlayer.stopVideo()
|
||||
}
|
||||
if (this.ytPlayer.destroy) {
|
||||
this.ytPlayer.destroy()
|
||||
}
|
||||
} else {
|
||||
var index = Youtube.apiReadyQueue.indexOf(this);
|
||||
if (index !== -1) {
|
||||
Youtube.apiReadyQueue.splice(index, 1)
|
||||
}
|
||||
}
|
||||
this.ytPlayer = null;
|
||||
this.el_.parentNode.className = this.el_.parentNode.className.replace(" vjs-youtube", "").replace(" vjs-youtube-mobile", "");
|
||||
this.el_.parentNode.removeChild(this.el_);
|
||||
Tech.prototype.dispose.call(this)
|
||||
}, createEl: function () {
|
||||
var div = document.createElement("div");
|
||||
div.setAttribute("id", this.options_.techId);
|
||||
div.setAttribute("style", "width:100%;height:100%;top:0;left:0;position:absolute");
|
||||
div.setAttribute("class", "vjs-tech");
|
||||
var divWrapper = document.createElement("div");
|
||||
divWrapper.appendChild(div);
|
||||
if (!_isOnMobile && !this.options_.ytControls) {
|
||||
var divBlocker = document.createElement("div");
|
||||
divBlocker.setAttribute("class", "vjs-iframe-blocker");
|
||||
divBlocker.setAttribute("style", "position:absolute;top:0;left:0;width:100%;height:100%");
|
||||
divBlocker.onclick = function () {
|
||||
this.pause()
|
||||
}.bind(this);
|
||||
divWrapper.appendChild(divBlocker)
|
||||
}
|
||||
return divWrapper
|
||||
}, initYTPlayer: function () {
|
||||
var playerVars = {controls: 0, modestbranding: 1, rel: 0, showinfo: 0, loop: this.options_.loop ? 1 : 0};
|
||||
if (typeof this.options_.autohide !== "undefined") {
|
||||
playerVars.autohide = this.options_.autohide
|
||||
}
|
||||
if (typeof this.options_["cc_load_policy"] !== "undefined") {
|
||||
playerVars["cc_load_policy"] = this.options_["cc_load_policy"]
|
||||
}
|
||||
if (typeof this.options_.ytControls !== "undefined") {
|
||||
playerVars.controls = this.options_.ytControls
|
||||
}
|
||||
if (typeof this.options_.disablekb !== "undefined") {
|
||||
playerVars.disablekb = this.options_.disablekb
|
||||
}
|
||||
if (typeof this.options_.color !== "undefined") {
|
||||
playerVars.color = this.options_.color
|
||||
}
|
||||
if (!playerVars.controls) {
|
||||
playerVars.fs = 0
|
||||
} else if (typeof this.options_.fs !== "undefined") {
|
||||
playerVars.fs = this.options_.fs
|
||||
}
|
||||
if (this.options_.source.src.indexOf("end=") !== -1) {
|
||||
var srcEndTime = this.options_.source.src.match(/end=([0-9]*)/);
|
||||
this.options_.end = parseInt(srcEndTime[1])
|
||||
}
|
||||
if (typeof this.options_.end !== "undefined") {
|
||||
playerVars.end = this.options_.end
|
||||
}
|
||||
if (typeof this.options_.hl !== "undefined") {
|
||||
playerVars.hl = this.options_.hl
|
||||
} else if (typeof this.options_.language !== "undefined") {
|
||||
playerVars.hl = this.options_.language.substr(0, 2)
|
||||
}
|
||||
if (typeof this.options_["iv_load_policy"] !== "undefined") {
|
||||
playerVars["iv_load_policy"] = this.options_["iv_load_policy"]
|
||||
}
|
||||
if (typeof this.options_.list !== "undefined") {
|
||||
playerVars.list = this.options_.list
|
||||
} else if (this.url && typeof this.url.listId !== "undefined") {
|
||||
playerVars.list = this.url.listId
|
||||
}
|
||||
if (typeof this.options_.listType !== "undefined") {
|
||||
playerVars.listType = this.options_.listType
|
||||
}
|
||||
if (typeof this.options_.modestbranding !== "undefined") {
|
||||
playerVars.modestbranding = this.options_.modestbranding
|
||||
}
|
||||
if (typeof this.options_.playlist !== "undefined") {
|
||||
playerVars.playlist = this.options_.playlist
|
||||
}
|
||||
if (typeof this.options_.playsinline !== "undefined") {
|
||||
playerVars.playsinline = this.options_.playsinline
|
||||
}
|
||||
if (typeof this.options_.rel !== "undefined") {
|
||||
playerVars.rel = this.options_.rel
|
||||
}
|
||||
if (typeof this.options_.showinfo !== "undefined") {
|
||||
playerVars.showinfo = this.options_.showinfo
|
||||
}
|
||||
if (this.options_.source.src.indexOf("start=") !== -1) {
|
||||
var srcStartTime = this.options_.source.src.match(/start=([0-9]*)/);
|
||||
this.options_.start = parseInt(srcStartTime[1])
|
||||
}
|
||||
if (typeof this.options_.start !== "undefined") {
|
||||
playerVars.start = this.options_.start
|
||||
}
|
||||
if (typeof this.options_.theme !== "undefined") {
|
||||
playerVars.theme = this.options_.theme
|
||||
}
|
||||
if (typeof this.options_.customVars !== "undefined") {
|
||||
var customVars = this.options_.customVars;
|
||||
Object.keys(customVars).forEach(function (key) {
|
||||
playerVars[key] = customVars[key]
|
||||
})
|
||||
}
|
||||
this.activeVideoId = this.url ? this.url.videoId : null;
|
||||
this.activeList = playerVars.list;
|
||||
var playerConfig = {
|
||||
videoId: this.activeVideoId,
|
||||
playerVars: playerVars,
|
||||
events: {
|
||||
onReady: this.onPlayerReady.bind(this),
|
||||
onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this),
|
||||
onPlaybackRateChange: this.onPlayerPlaybackRateChange.bind(this),
|
||||
onStateChange: this.onPlayerStateChange.bind(this),
|
||||
onVolumeChange: this.onPlayerVolumeChange.bind(this),
|
||||
onError: this.onPlayerError.bind(this)
|
||||
}
|
||||
};
|
||||
if (typeof this.options_.enablePrivacyEnhancedMode !== "undefined" && this.options_.enablePrivacyEnhancedMode) {
|
||||
playerConfig.host = "https://www.youtube-nocookie.com"
|
||||
}
|
||||
this.ytPlayer = new YT.Player(this.options_.techId, playerConfig)
|
||||
}, onPlayerReady: function () {
|
||||
if (this.options_.muted) {
|
||||
this.ytPlayer.mute()
|
||||
}
|
||||
var playbackRates = this.ytPlayer.getAvailablePlaybackRates();
|
||||
if (playbackRates.length > 1) {
|
||||
this.featuresPlaybackRate = true
|
||||
}
|
||||
this.playerReady_ = true;
|
||||
this.triggerReady();
|
||||
if (this.playOnReady) {
|
||||
this.play()
|
||||
} else if (this.cueOnReady) {
|
||||
this.cueVideoById_(this.url.videoId);
|
||||
this.activeVideoId = this.url.videoId
|
||||
}
|
||||
}, onPlayerPlaybackQualityChange: function () {
|
||||
}, onPlayerPlaybackRateChange: function () {
|
||||
this.trigger("ratechange")
|
||||
}, onPlayerStateChange: function (e) {
|
||||
var state = e.data;
|
||||
if (state === this.lastState || this.errorNumber) {
|
||||
return
|
||||
}
|
||||
this.lastState = state;
|
||||
switch (state) {
|
||||
case-1:
|
||||
this.trigger("loadstart");
|
||||
this.trigger("loadedmetadata");
|
||||
this.trigger("durationchange");
|
||||
this.trigger("ratechange");
|
||||
break;
|
||||
case YT.PlayerState.ENDED:
|
||||
this.trigger("ended");
|
||||
break;
|
||||
case YT.PlayerState.PLAYING:
|
||||
this.trigger("timeupdate");
|
||||
this.trigger("durationchange");
|
||||
this.trigger("playing");
|
||||
this.trigger("play");
|
||||
if (this.isSeeking) {
|
||||
this.onSeeked()
|
||||
}
|
||||
break;
|
||||
case YT.PlayerState.PAUSED:
|
||||
this.trigger("canplay");
|
||||
if (this.isSeeking) {
|
||||
this.onSeeked()
|
||||
} else {
|
||||
this.trigger("pause")
|
||||
}
|
||||
break;
|
||||
case YT.PlayerState.BUFFERING:
|
||||
this.player_.trigger("timeupdate");
|
||||
this.player_.trigger("waiting");
|
||||
break
|
||||
}
|
||||
}, onPlayerVolumeChange: function () {
|
||||
this.trigger("volumechange")
|
||||
}, onPlayerError: function (e) {
|
||||
this.errorNumber = e.data;
|
||||
this.trigger("pause");
|
||||
this.trigger("error")
|
||||
}, error: function () {
|
||||
var code = 1e3 + this.errorNumber;
|
||||
switch (this.errorNumber) {
|
||||
case 5:
|
||||
return {code: code, message: "Error while trying to play the video"};
|
||||
case 2:
|
||||
case 100:
|
||||
return {code: code, message: "Unable to find the video"};
|
||||
case 101:
|
||||
case 150:
|
||||
return {code: code, message: "Playback on other Websites has been disabled by the video owner."}
|
||||
}
|
||||
return {code: code, message: "YouTube unknown error (" + this.errorNumber + ")"}
|
||||
}, loadVideoById_: function (id) {
|
||||
var options = {videoId: id};
|
||||
if (this.options_.start) {
|
||||
options.startSeconds = this.options_.start
|
||||
}
|
||||
if (this.options_.end) {
|
||||
options.endEnd = this.options_.end
|
||||
}
|
||||
this.ytPlayer.loadVideoById(options)
|
||||
}, cueVideoById_: function (id) {
|
||||
var options = {videoId: id};
|
||||
if (this.options_.start) {
|
||||
options.startSeconds = this.options_.start
|
||||
}
|
||||
if (this.options_.end) {
|
||||
options.endEnd = this.options_.end
|
||||
}
|
||||
this.ytPlayer.cueVideoById(options)
|
||||
}, src: function (src) {
|
||||
if (src) {
|
||||
this.setSrc({src: src})
|
||||
}
|
||||
return this.source
|
||||
}, poster: function () {
|
||||
if (_isOnMobile) {
|
||||
return null
|
||||
}
|
||||
return this.poster_
|
||||
}, setPoster: function (poster) {
|
||||
this.poster_ = poster
|
||||
}, setSrc: function (source) {
|
||||
if (!source || !source.src) {
|
||||
return
|
||||
}
|
||||
delete this.errorNumber;
|
||||
this.source = source;
|
||||
this.url = Youtube.parseUrl(source.src);
|
||||
if (!this.options_.poster) {
|
||||
if (this.url.videoId) {
|
||||
this.poster_ = "https://img.youtube.com/vi/" + this.url.videoId + "/0.jpg";
|
||||
this.trigger("posterchange");
|
||||
this.checkHighResPoster()
|
||||
}
|
||||
}
|
||||
if (this.options_.autoplay && !_isOnMobile) {
|
||||
if (this.isReady_) {
|
||||
this.play()
|
||||
} else {
|
||||
this.playOnReady = true
|
||||
}
|
||||
} else if (this.activeVideoId !== this.url.videoId) {
|
||||
if (this.isReady_) {
|
||||
this.cueVideoById_(this.url.videoId);
|
||||
this.activeVideoId = this.url.videoId
|
||||
} else {
|
||||
this.cueOnReady = true
|
||||
}
|
||||
}
|
||||
}, autoplay: function () {
|
||||
return this.options_.autoplay
|
||||
}, setAutoplay: function (val) {
|
||||
this.options_.autoplay = val
|
||||
}, loop: function () {
|
||||
return this.options_.loop
|
||||
}, setLoop: function (val) {
|
||||
this.options_.loop = val
|
||||
}, play: function () {
|
||||
if (!this.url || !this.url.videoId) {
|
||||
return
|
||||
}
|
||||
this.wasPausedBeforeSeek = false;
|
||||
if (this.isReady_) {
|
||||
if (this.url.listId) {
|
||||
if (this.activeList === this.url.listId) {
|
||||
this.ytPlayer.playVideo()
|
||||
} else {
|
||||
this.ytPlayer.loadPlaylist(this.url.listId);
|
||||
this.activeList = this.url.listId
|
||||
}
|
||||
}
|
||||
if (this.activeVideoId === this.url.videoId) {
|
||||
this.ytPlayer.playVideo()
|
||||
} else {
|
||||
this.loadVideoById_(this.url.videoId);
|
||||
this.activeVideoId = this.url.videoId
|
||||
}
|
||||
} else {
|
||||
this.trigger("waiting");
|
||||
this.playOnReady = true
|
||||
}
|
||||
}, pause: function () {
|
||||
if (this.ytPlayer) {
|
||||
this.ytPlayer.pauseVideo()
|
||||
}
|
||||
}, paused: function () {
|
||||
return this.ytPlayer ? this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING : true
|
||||
}, currentTime: function () {
|
||||
return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0
|
||||
}, setCurrentTime: function (seconds) {
|
||||
if (this.lastState === YT.PlayerState.PAUSED) {
|
||||
this.timeBeforeSeek = this.currentTime()
|
||||
}
|
||||
if (!this.isSeeking) {
|
||||
this.wasPausedBeforeSeek = this.paused()
|
||||
}
|
||||
this.ytPlayer.seekTo(seconds, true);
|
||||
this.trigger("timeupdate");
|
||||
this.trigger("seeking");
|
||||
this.isSeeking = true;
|
||||
if (this.lastState === YT.PlayerState.PAUSED && this.timeBeforeSeek !== seconds) {
|
||||
clearInterval(this.checkSeekedInPauseInterval);
|
||||
this.checkSeekedInPauseInterval = setInterval(function () {
|
||||
if (this.lastState !== YT.PlayerState.PAUSED || !this.isSeeking) {
|
||||
clearInterval(this.checkSeekedInPauseInterval)
|
||||
} else if (this.currentTime() !== this.timeBeforeSeek) {
|
||||
this.trigger("timeupdate");
|
||||
this.onSeeked()
|
||||
}
|
||||
}.bind(this), 250)
|
||||
}
|
||||
}, seeking: function () {
|
||||
return this.isSeeking
|
||||
}, seekable: function () {
|
||||
if (!this.ytPlayer) {
|
||||
return videojs.createTimeRange()
|
||||
}
|
||||
return videojs.createTimeRange(0, this.ytPlayer.getDuration())
|
||||
}, onSeeked: function () {
|
||||
clearInterval(this.checkSeekedInPauseInterval);
|
||||
this.isSeeking = false;
|
||||
if (this.wasPausedBeforeSeek) {
|
||||
this.pause()
|
||||
}
|
||||
this.trigger("seeked")
|
||||
}, playbackRate: function () {
|
||||
return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1
|
||||
}, setPlaybackRate: function (suggestedRate) {
|
||||
if (!this.ytPlayer) {
|
||||
return
|
||||
}
|
||||
this.ytPlayer.setPlaybackRate(suggestedRate)
|
||||
}, duration: function () {
|
||||
return this.ytPlayer ? this.ytPlayer.getDuration() : 0
|
||||
}, currentSrc: function () {
|
||||
return this.source && this.source.src
|
||||
}, ended: function () {
|
||||
return this.ytPlayer ? this.lastState === YT.PlayerState.ENDED : false
|
||||
}, volume: function () {
|
||||
return this.ytPlayer ? this.ytPlayer.getVolume() / 100 : 1
|
||||
}, setVolume: function (percentAsDecimal) {
|
||||
if (!this.ytPlayer) {
|
||||
return
|
||||
}
|
||||
this.ytPlayer.setVolume(percentAsDecimal * 100)
|
||||
}, muted: function () {
|
||||
return this.ytPlayer ? this.ytPlayer.isMuted() : false
|
||||
}, setMuted: function (mute) {
|
||||
if (!this.ytPlayer) {
|
||||
return
|
||||
} else {
|
||||
this.muted(true)
|
||||
}
|
||||
if (mute) {
|
||||
this.ytPlayer.mute()
|
||||
} else {
|
||||
this.ytPlayer.unMute()
|
||||
}
|
||||
this.setTimeout(function () {
|
||||
this.trigger("volumechange")
|
||||
}, 50)
|
||||
}, buffered: function () {
|
||||
if (!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) {
|
||||
return videojs.createTimeRange()
|
||||
}
|
||||
var bufferedEnd = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration();
|
||||
return videojs.createTimeRange(0, bufferedEnd)
|
||||
}, preload: function () {
|
||||
}, load: function () {
|
||||
}, reset: function () {
|
||||
}, networkState: function () {
|
||||
if (!this.ytPlayer) {
|
||||
return 0
|
||||
}
|
||||
switch (this.ytPlayer.getPlayerState()) {
|
||||
case-1:
|
||||
return 0;
|
||||
case 3:
|
||||
return 2;
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}, readyState: function () {
|
||||
if (!this.ytPlayer) {
|
||||
return 0
|
||||
}
|
||||
switch (this.ytPlayer.getPlayerState()) {
|
||||
case-1:
|
||||
return 0;
|
||||
case 5:
|
||||
return 1;
|
||||
case 3:
|
||||
return 2;
|
||||
default:
|
||||
return 4
|
||||
}
|
||||
}, supportsFullScreen: function () {
|
||||
return document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled
|
||||
}, checkHighResPoster: function () {
|
||||
var uri = "https://img.youtube.com/vi/" + this.url.videoId + "/maxresdefault.jpg";
|
||||
try {
|
||||
var image = new Image;
|
||||
image.onload = function () {
|
||||
if ("naturalHeight" in image) {
|
||||
if (image.naturalHeight <= 90 || image.naturalWidth <= 120) {
|
||||
return
|
||||
}
|
||||
} else if (image.height <= 90 || image.width <= 120) {
|
||||
return
|
||||
}
|
||||
this.poster_ = uri;
|
||||
this.trigger("posterchange")
|
||||
}.bind(this);
|
||||
image.onerror = function () {
|
||||
};
|
||||
image.src = uri
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
Youtube.isSupported = function () {
|
||||
return true
|
||||
};
|
||||
Youtube.canPlaySource = function (e) {
|
||||
return Youtube.canPlayType(e.type)
|
||||
};
|
||||
Youtube.canPlayType = function (e) {
|
||||
return e === "video/youtube"
|
||||
};
|
||||
Youtube.parseUrl = function (url) {
|
||||
var result = {videoId: null};
|
||||
var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
|
||||
var match = url.match(regex);
|
||||
if (match && match[2].length === 11) {
|
||||
result.videoId = match[2]
|
||||
}
|
||||
var regPlaylist = /[?&]list=([^#\&\?]+)/;
|
||||
match = url.match(regPlaylist);
|
||||
if (match && match[1]) {
|
||||
result.listId = match[1]
|
||||
}
|
||||
return result
|
||||
};
|
||||
|
||||
function apiLoaded() {
|
||||
YT.ready(function () {
|
||||
Youtube.isApiReady = true;
|
||||
for (var i = 0; i < Youtube.apiReadyQueue.length; ++i) {
|
||||
Youtube.apiReadyQueue[i].initYTPlayer()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function loadScript(src, callback) {
|
||||
var loaded = false;
|
||||
var tag = document.createElement("script");
|
||||
var firstScriptTag = document.getElementsByTagName("script")[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
tag.onload = function () {
|
||||
if (!loaded) {
|
||||
loaded = true;
|
||||
callback()
|
||||
}
|
||||
};
|
||||
tag.onreadystatechange = function () {
|
||||
if (!loaded && (this.readyState === "complete" || this.readyState === "loaded")) {
|
||||
loaded = true;
|
||||
callback()
|
||||
}
|
||||
};
|
||||
tag.src = src
|
||||
}
|
||||
|
||||
function injectCss() {
|
||||
var css = ".vjs-youtube .vjs-iframe-blocker { display: none; }" + ".vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }" + ".vjs-youtube .vjs-poster { background-size: cover; }" + ".vjs-youtube-mobile .vjs-big-play-button { display: none; }";
|
||||
var head = document.head || document.getElementsByTagName("head")[0];
|
||||
var style = document.createElement("style");
|
||||
style.type = "text/css";
|
||||
if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css))
|
||||
}
|
||||
head.appendChild(style)
|
||||
}
|
||||
|
||||
Youtube.apiReadyQueue = [];
|
||||
if (typeof document !== "undefined") {
|
||||
loadScript("https://www.youtube.com/iframe_api", apiLoaded);
|
||||
injectCss()
|
||||
}
|
||||
if (typeof videojs.registerTech !== "undefined") {
|
||||
videojs.registerTech("Youtube", Youtube)
|
||||
} else {
|
||||
videojs.registerComponent("Youtube", Youtube)
|
||||
}
|
||||
});
|
1
node_modules/.bin/mime
generated
vendored
Symbolic link
1
node_modules/.bin/mime
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../mime/cli.js
|
11
node_modules/@arr/every/index.js
generated
vendored
Normal file
11
node_modules/@arr/every/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
module.exports = function (arr, cb) {
|
||||
var i=0, len=arr.length;
|
||||
|
||||
for (; i < len; i++) {
|
||||
if (!cb(arr[i], i, arr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
1
node_modules/@arr/every/module.d.ts
generated
vendored
Normal file
1
node_modules/@arr/every/module.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default function<T>(arr: T[], callback: (val: T, idx: number, arr: T[]) => unknown): boolean;
|
11
node_modules/@arr/every/module.js
generated
vendored
Normal file
11
node_modules/@arr/every/module.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export default function (arr, cb) {
|
||||
var i=0, len=arr.length;
|
||||
|
||||
for (; i < len; i++) {
|
||||
if (!cb(arr[i], i, arr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
63
node_modules/@arr/every/package.json
generated
vendored
Normal file
63
node_modules/@arr/every/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "@arr/every@^1.0.0",
|
||||
"_id": "@arr/every@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-UQFQ6SgyJ6LX42W8rHCs8KVc0JS0tzVL9ct4XYedJukskYVWTo49tNiMEK9C2HTyarbNiT/RVIRSY82vH+6sTg==",
|
||||
"_location": "/@arr/every",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@arr/every@^1.0.0",
|
||||
"name": "@arr/every",
|
||||
"escapedName": "@arr%2fevery",
|
||||
"scope": "@arr",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/matchit"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@arr/every/-/every-1.0.1.tgz",
|
||||
"_shasum": "22fe1f8e6355beca6c7c7bde965eb15cf994387b",
|
||||
"_spec": "@arr/every@^1.0.0",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/matchit",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lukeed/arr/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A tiny, faster alternative to native Array.prototype.every",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"homepage": "https://github.com/lukeed/arr#readme",
|
||||
"keywords": [
|
||||
"arr",
|
||||
"array",
|
||||
"Array.every",
|
||||
"Array.prototype.every",
|
||||
"performance",
|
||||
"native",
|
||||
"every"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "module.js",
|
||||
"name": "@arr/every",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lukeed/arr.git"
|
||||
},
|
||||
"types": "module.d.ts",
|
||||
"version": "1.0.1"
|
||||
}
|
45
node_modules/@arr/every/readme.md
generated
vendored
Normal file
45
node_modules/@arr/every/readme.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# @arr/every
|
||||
|
||||
> A tiny, faster alternative to native `Array.prototype.every`
|
||||
|
||||
:warning: Unlike native, `@arr/every` does _not_ support the optional `thisArg` parameter!
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save @arr/every
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import every from '@arr/every';
|
||||
|
||||
const isBigEnough = val => val >= 10;
|
||||
|
||||
every([12, 5, 8, 130, 44], isBigEnough);
|
||||
//=> false
|
||||
every([12, 54, 18, 130, 44], isBigEnough);
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### every(arr, callback)
|
||||
|
||||
#### arr
|
||||
Type: `Array`<br>
|
||||
The array to iterate upon.
|
||||
|
||||
#### callback(value[, index, array])
|
||||
Type: `Function`<br>
|
||||
Function to test for each element, taking three arguments:
|
||||
|
||||
* **value** (required) -- The current element being processed in the array.
|
||||
* **index** (optional) -- The index of the current element being processed in the array.
|
||||
* **array** (optional) -- The array `every` was called upon.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](http://lukeed.com)
|
22
node_modules/@polka/url/index.js
generated
vendored
Normal file
22
node_modules/@polka/url/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
module.exports = function (req) {
|
||||
let url = req.url;
|
||||
if (url === void 0) return url;
|
||||
|
||||
let obj = req._parsedUrl;
|
||||
if (obj && obj._raw === url) return obj;
|
||||
|
||||
obj = {};
|
||||
obj.query = obj.search = null;
|
||||
obj.href = obj.path = obj.pathname = url;
|
||||
|
||||
let idx = url.indexOf('?', 1);
|
||||
if (idx !== -1) {
|
||||
obj.search = url.substring(idx);
|
||||
obj.query = obj.search.substring(1);
|
||||
obj.pathname = url.substring(0, idx);
|
||||
}
|
||||
|
||||
obj._raw = url;
|
||||
|
||||
return (req._parsedUrl = obj);
|
||||
}
|
52
node_modules/@polka/url/package.json
generated
vendored
Normal file
52
node_modules/@polka/url/package.json
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"_from": "@polka/url@^0.5.0",
|
||||
"_id": "@polka/url@0.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-oZLYFEAzUKyi3SKnXvj32ZCEGH6RDnao7COuCVhDydMS9NrCSVXhM79VaKyP5+Zc33m0QXEd2DN3UkU7OsHcfw==",
|
||||
"_location": "/@polka/url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@polka/url@^0.5.0",
|
||||
"name": "@polka/url",
|
||||
"escapedName": "@polka%2furl",
|
||||
"scope": "@polka",
|
||||
"rawSpec": "^0.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/polka",
|
||||
"/sirv"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz",
|
||||
"_shasum": "b21510597fd601e5d7c95008b76bf0d254ebfd31",
|
||||
"_spec": "@polka/url@^0.5.0",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/polka",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke@lukeed.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lukeed/polka/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Super fast, memoized `req.url` parser",
|
||||
"files": [
|
||||
"*.js"
|
||||
],
|
||||
"homepage": "https://github.com/lukeed/polka#readme",
|
||||
"license": "MIT",
|
||||
"name": "@polka/url",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lukeed/polka.git"
|
||||
},
|
||||
"version": "0.5.0"
|
||||
}
|
86
node_modules/@polka/url/readme.md
generated
vendored
Normal file
86
node_modules/@polka/url/readme.md
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
# @polka/url [![npm](https://badgen.now.sh/npm/v/@polka/url)](https://npmjs.org/package/@polka/url)
|
||||
|
||||
> Super fast, memoized `req.url` parser; _not_ limited to [Polka][polka]!
|
||||
|
||||
Parses the `url` from a [`IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) request. The returned object will always only contain the following keys: `search`, `query`, `pathname`, `path`, `href`, and `_raw`.
|
||||
|
||||
> **Note:** This library does not process `protocol`, `hostname`, `port`, etc.<br>This is because the incoming `req.url` value only begins with the path information.
|
||||
|
||||
Parsed requests will be mutated with a `_parsedUrl` key, containing the returned output. This is used for future memoization, so as to avoid parsing the same `url` value multiple times.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save @polka/url
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const parse = require('@polka/url');
|
||||
|
||||
let req = { url: '/foo/bar?fizz=buzz' };
|
||||
let foo = parse(req);
|
||||
//=> { search: '?fizz=buzz',
|
||||
//=> query: 'fizz=buzz',
|
||||
//=> pathname: '/foo/bar',
|
||||
//=> path: '/foo/bar?fizz=buzz',
|
||||
//=> href: '/foo/bar?fizz=buzz',
|
||||
//=> _raw: '/foo/bar?fizz=buzz' }
|
||||
|
||||
// Attaches result for future memoization
|
||||
assert.deepEqual(foo, req._parsedUrl); //=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### url(req)
|
||||
Returns: `Object` or `undefined`
|
||||
|
||||
> **Important:** The `req` must have a `url` key, otherwise `undefined` will be returned.<br>If no input is provided at all, a `TypeError` will be thrown.
|
||||
|
||||
#### req
|
||||
Type: `IncomingMessage` or `Object`
|
||||
|
||||
The incoming HTTP request (`req`) or a plain `Object` with a `url` key.
|
||||
|
||||
> **Note:** In Node.js servers, the [`req.url`](https://nodejs.org/api/http.html#http_message_url) begins with a pathname & does not include a `hash`.
|
||||
|
||||
|
||||
## Benchmarks
|
||||
|
||||
> Running the `parseurl` benchmark suite on Node 10.9.0
|
||||
|
||||
```
|
||||
Parsing: "/foo/bar?user=tj&pet=fluffy"
|
||||
nativeurl x 3,496,593 ops/sec ±0.78% (194 runs sampled)
|
||||
parseurl x 5,702,515 ops/sec ±0.59% (194 runs sampled)
|
||||
@polka/url x 11,510,281 ops/sec ±1.93% (192 runs sampled)
|
||||
|
||||
REPEAT: "/foo/bar?user=tj&pet=fluffy"
|
||||
nativeurl x 3,344,884 ops/sec ±0.13% (191 runs sampled)
|
||||
parseurl x 20,386,848 ops/sec ±0.22% (192 runs sampled)
|
||||
@polka/url x 21,088,923 ops/sec ±0.58% (191 runs sampled)
|
||||
|
||||
Parsing: "/foo/bar"
|
||||
nativeurl x 9,808,119 ops/sec ±0.51% (190 runs sampled)
|
||||
parseurl x 26,186,627 ops/sec ±0.16% (195 runs sampled)
|
||||
@polka/url x 43,946,765 ops/sec ±0.55% (194 runs sampled)
|
||||
|
||||
Parsing: "/"
|
||||
nativeurl x 15,698,746 ops/sec ±0.79% (192 runs sampled)
|
||||
parseurl x 36,861,339 ops/sec ±0.19% (195 runs sampled)
|
||||
@polka/url x 48,295,119 ops/sec ±0.51% (194 runs sampled)
|
||||
```
|
||||
|
||||
|
||||
## Support
|
||||
|
||||
Any issues or questions can be sent to the [Polka][polka] repository.<br>However, please specify that your inquiry is about `@polka/url` specifically.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
||||
|
||||
[polka]: https://github.com/lukeed/polka
|
236
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
236
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
1.3.7 / 2019-04-29
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.6.2
|
||||
- Fix sorting charset, encoding, and language with extra parameters
|
||||
|
||||
1.3.6 / 2019-04-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.24
|
||||
- deps: mime-db@~1.40.0
|
||||
|
||||
1.3.5 / 2018-02-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.18
|
||||
- deps: mime-db@~1.33.0
|
||||
|
||||
1.3.4 / 2017-08-22
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.16
|
||||
- deps: mime-db@~1.29.0
|
||||
|
||||
1.3.3 / 2016-05-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.11
|
||||
- deps: mime-db@~1.23.0
|
||||
* deps: negotiator@0.6.1
|
||||
- perf: improve `Accept` parsing speed
|
||||
- perf: improve `Accept-Charset` parsing speed
|
||||
- perf: improve `Accept-Encoding` parsing speed
|
||||
- perf: improve `Accept-Language` parsing speed
|
||||
|
||||
1.3.2 / 2016-03-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.10
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
- deps: mime-db@~1.22.0
|
||||
|
||||
1.3.1 / 2016-01-19
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.9
|
||||
- deps: mime-db@~1.21.0
|
||||
|
||||
1.3.0 / 2015-09-29
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.7
|
||||
- deps: mime-db@~1.19.0
|
||||
* deps: negotiator@0.6.0
|
||||
- Fix including type extensions in parameters in `Accept` parsing
|
||||
- Fix parsing `Accept` parameters with quoted equals
|
||||
- Fix parsing `Accept` parameters with quoted semicolons
|
||||
- Lazy-load modules from main entry point
|
||||
- perf: delay type concatenation until needed
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expressions
|
||||
- perf: remove closures getting spec properties
|
||||
- perf: remove a closure from media type parsing
|
||||
- perf: remove property delete from media type parsing
|
||||
|
||||
1.2.13 / 2015-09-06
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.6
|
||||
- deps: mime-db@~1.18.0
|
||||
|
||||
1.2.12 / 2015-07-30
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.4
|
||||
- deps: mime-db@~1.16.0
|
||||
|
||||
1.2.11 / 2015-07-16
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.3
|
||||
- deps: mime-db@~1.15.0
|
||||
|
||||
1.2.10 / 2015-07-01
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.2
|
||||
- deps: mime-db@~1.14.0
|
||||
|
||||
1.2.9 / 2015-06-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.1
|
||||
- perf: fix deopt during mapping
|
||||
|
||||
1.2.8 / 2015-06-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.0
|
||||
- deps: mime-db@~1.13.0
|
||||
* perf: avoid argument reassignment & argument slice
|
||||
* perf: avoid negotiator recursive construction
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary bitwise operator
|
||||
|
||||
1.2.7 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.3
|
||||
- Fix media type parameter matching to be case-insensitive
|
||||
|
||||
1.2.6 / 2015-05-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.11
|
||||
- deps: mime-db@~1.9.1
|
||||
* deps: negotiator@0.5.2
|
||||
- Fix comparing media types with quoted values
|
||||
- Fix splitting media types with quoted commas
|
||||
|
||||
1.2.5 / 2015-03-13
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.10
|
||||
- deps: mime-db@~1.8.0
|
||||
|
||||
1.2.4 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* deps: mime-types@~2.0.9
|
||||
- deps: mime-db@~1.7.0
|
||||
* deps: negotiator@0.5.1
|
||||
- Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
1.2.3 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.8
|
||||
- deps: mime-db@~1.6.0
|
||||
|
||||
1.2.2 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.7
|
||||
- deps: mime-db@~1.5.0
|
||||
|
||||
1.2.1 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.5
|
||||
- deps: mime-db@~1.3.1
|
||||
|
||||
1.2.0 / 2014-12-19
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.0
|
||||
- Fix list return order when large accepted list
|
||||
- Fix missing identity encoding when q=0 exists
|
||||
- Remove dynamic building of Negotiator class
|
||||
|
||||
1.1.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.4
|
||||
- deps: mime-db@~1.3.0
|
||||
|
||||
1.1.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.3
|
||||
- deps: mime-db@~1.2.0
|
||||
|
||||
1.1.2 / 2014-10-14
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.9
|
||||
- Fix error when media type has invalid parameter
|
||||
|
||||
1.1.1 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.2
|
||||
- deps: mime-db@~1.1.0
|
||||
* deps: negotiator@0.4.8
|
||||
- Fix all negotiations to be case-insensitive
|
||||
- Stable sort preferences of same quality according to client order
|
||||
|
||||
1.1.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* update `mime-types`
|
||||
|
||||
1.0.7 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix wrong type returned from `type` when match after unknown extension
|
||||
|
||||
1.0.6 / 2014-06-24
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.7
|
||||
|
||||
1.0.5 / 2014-06-20
|
||||
==================
|
||||
|
||||
* fix crash when unknown extension given
|
||||
|
||||
1.0.4 / 2014-06-19
|
||||
==================
|
||||
|
||||
* use `mime-types`
|
||||
|
||||
1.0.3 / 2014-06-11
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.6
|
||||
- Order by specificity when quality is the same
|
||||
|
||||
1.0.2 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix interpretation when header not in request
|
||||
* deps: pin negotiator@0.4.5
|
||||
|
||||
1.0.1 / 2014-01-18
|
||||
==================
|
||||
|
||||
* Identity encoding isn't always acceptable
|
||||
* deps: negotiator@~0.4.0
|
||||
|
||||
1.0.0 / 2013-12-27
|
||||
==================
|
||||
|
||||
* Genesis
|
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
142
node_modules/accepts/README.md
generated
vendored
Normal file
142
node_modules/accepts/README.md
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
# accepts
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||
|
||||
In addition to negotiator, it allows:
|
||||
|
||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||
as well as `('text/html', 'application/json')`.
|
||||
- Allows type shorthands such as `json`.
|
||||
- Returns `false` when no types match
|
||||
- Treats non-existent headers as `*`
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install accepts
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
```
|
||||
|
||||
### accepts(req)
|
||||
|
||||
Create a new `Accepts` object for the given `req`.
|
||||
|
||||
#### .charset(charsets)
|
||||
|
||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .charsets()
|
||||
|
||||
Return the charsets that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .encoding(encodings)
|
||||
|
||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .encodings()
|
||||
|
||||
Return the encodings that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .language(languages)
|
||||
|
||||
Return the first accepted language. If nothing in `languages` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .languages()
|
||||
|
||||
Return the languages that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .type(types)
|
||||
|
||||
Return the first accepted type (and it is returned as the same text as what
|
||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||
is returned.
|
||||
|
||||
The `types` array can contain full MIME types or file extensions. Any value
|
||||
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||
|
||||
#### .types()
|
||||
|
||||
Return the types that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple type negotiation
|
||||
|
||||
This simple example shows how to use `accepts` to return a different typed
|
||||
respond body based on what the client wants to accept. The server lists it's
|
||||
preferences in order and will get back the best match between the client and
|
||||
server.
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
var http = require('http')
|
||||
|
||||
function app (req, res) {
|
||||
var accept = accepts(req)
|
||||
|
||||
// the order of this list is significant; should be server preferred order
|
||||
switch (accept.type(['json', 'html'])) {
|
||||
case 'json':
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.write('{"hello":"world!"}')
|
||||
break
|
||||
case 'html':
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<b>hello, world!</b>')
|
||||
break
|
||||
default:
|
||||
// the fallback is text/plain, so no need to specify it above
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('hello, world!')
|
||||
break
|
||||
}
|
||||
|
||||
res.end()
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000)
|
||||
```
|
||||
|
||||
You can test this out with the cURL program:
|
||||
```sh
|
||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||
[npm-url]: https://npmjs.org/package/accepts
|
||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||
[travis-image]: https://badgen.net/travis/jshttp/accepts/master
|
||||
[travis-url]: https://travis-ci.org/jshttp/accepts
|
238
node_modules/accepts/index.js
generated
vendored
Normal file
238
node_modules/accepts/index.js
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
/*!
|
||||
* accepts
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var Negotiator = require('negotiator')
|
||||
var mime = require('mime-types')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = Accepts
|
||||
|
||||
/**
|
||||
* Create a new Accepts object for the given req.
|
||||
*
|
||||
* @param {object} req
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Accepts (req) {
|
||||
if (!(this instanceof Accepts)) {
|
||||
return new Accepts(req)
|
||||
}
|
||||
|
||||
this.headers = req.headers
|
||||
this.negotiator = new Negotiator(req)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
* the best match when true, otherwise `undefined`, in which
|
||||
* case you should respond with 406 "Not Acceptable".
|
||||
*
|
||||
* The `type` value may be a single mime type string
|
||||
* such as "application/json", the extension name
|
||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||
* or array is given the _best_ match, if any is returned.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // Accept: text/html
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
* this.types('text/html');
|
||||
* // => "text/html"
|
||||
* this.types('json', 'text');
|
||||
* // => "json"
|
||||
* this.types('application/json');
|
||||
* // => "application/json"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('image/png');
|
||||
* this.types('png');
|
||||
* // => undefined
|
||||
*
|
||||
* // Accept: text/*;q=.5, application/json
|
||||
* this.types(['html', 'json']);
|
||||
* this.types('html', 'json');
|
||||
* // => "json"
|
||||
*
|
||||
* @param {String|Array} types...
|
||||
* @return {String|Array|Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.type =
|
||||
Accepts.prototype.types = function (types_) {
|
||||
var types = types_
|
||||
|
||||
// support flattened arguments
|
||||
if (types && !Array.isArray(types)) {
|
||||
types = new Array(arguments.length)
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no types, return all requested types
|
||||
if (!types || types.length === 0) {
|
||||
return this.negotiator.mediaTypes()
|
||||
}
|
||||
|
||||
// no accept header, return first given type
|
||||
if (!this.headers.accept) {
|
||||
return types[0]
|
||||
}
|
||||
|
||||
var mimes = types.map(extToMime)
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||
var first = accepts[0]
|
||||
|
||||
return first
|
||||
? types[mimes.indexOf(first)]
|
||||
: false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted encodings or best fit based on `encodings`.
|
||||
*
|
||||
* Given `Accept-Encoding: gzip, deflate`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['gzip', 'deflate']
|
||||
*
|
||||
* @param {String|Array} encodings...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.encoding =
|
||||
Accepts.prototype.encodings = function (encodings_) {
|
||||
var encodings = encodings_
|
||||
|
||||
// support flattened arguments
|
||||
if (encodings && !Array.isArray(encodings)) {
|
||||
encodings = new Array(arguments.length)
|
||||
for (var i = 0; i < encodings.length; i++) {
|
||||
encodings[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no encodings, return all requested encodings
|
||||
if (!encodings || encodings.length === 0) {
|
||||
return this.negotiator.encodings()
|
||||
}
|
||||
|
||||
return this.negotiator.encodings(encodings)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted charsets or best fit based on `charsets`.
|
||||
*
|
||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||
*
|
||||
* @param {String|Array} charsets...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.charset =
|
||||
Accepts.prototype.charsets = function (charsets_) {
|
||||
var charsets = charsets_
|
||||
|
||||
// support flattened arguments
|
||||
if (charsets && !Array.isArray(charsets)) {
|
||||
charsets = new Array(arguments.length)
|
||||
for (var i = 0; i < charsets.length; i++) {
|
||||
charsets[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no charsets, return all requested charsets
|
||||
if (!charsets || charsets.length === 0) {
|
||||
return this.negotiator.charsets()
|
||||
}
|
||||
|
||||
return this.negotiator.charsets(charsets)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted languages or best fit based on `langs`.
|
||||
*
|
||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['es', 'pt', 'en']
|
||||
*
|
||||
* @param {String|Array} langs...
|
||||
* @return {Array|String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.lang =
|
||||
Accepts.prototype.langs =
|
||||
Accepts.prototype.language =
|
||||
Accepts.prototype.languages = function (languages_) {
|
||||
var languages = languages_
|
||||
|
||||
// support flattened arguments
|
||||
if (languages && !Array.isArray(languages)) {
|
||||
languages = new Array(arguments.length)
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
languages[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no languages, return all requested languages
|
||||
if (!languages || languages.length === 0) {
|
||||
return this.negotiator.languages()
|
||||
}
|
||||
|
||||
return this.negotiator.languages(languages)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert extnames to mime.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function extToMime (type) {
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mime is valid.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function validMime (type) {
|
||||
return typeof type === 'string'
|
||||
}
|
86
node_modules/accepts/package.json
generated
vendored
Normal file
86
node_modules/accepts/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"_from": "accepts@~1.3.5",
|
||||
"_id": "accepts@1.3.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||
"_location": "/accepts",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "accepts@~1.3.5",
|
||||
"name": "accepts",
|
||||
"escapedName": "accepts",
|
||||
"rawSpec": "~1.3.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.3.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/compression"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||
"_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
|
||||
"_spec": "accepts@~1.3.5",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/compression",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/accepts/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.24",
|
||||
"negotiator": "0.6.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Higher-level content negotiation",
|
||||
"devDependencies": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint": "5.16.0",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-import": "2.17.2",
|
||||
"eslint-plugin-markdown": "1.0.0",
|
||||
"eslint-plugin-node": "8.0.1",
|
||||
"eslint-plugin-promise": "4.1.1",
|
||||
"eslint-plugin-standard": "4.0.0",
|
||||
"mocha": "6.1.4",
|
||||
"nyc": "14.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/accepts#readme",
|
||||
"keywords": [
|
||||
"content",
|
||||
"negotiation",
|
||||
"accept",
|
||||
"accepts"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "accepts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/accepts.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"test-travis": "nyc --reporter=text npm test"
|
||||
},
|
||||
"version": "1.3.7"
|
||||
}
|
82
node_modules/bytes/History.md
generated
vendored
Normal file
82
node_modules/bytes/History.md
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
3.0.0 / 2017-08-31
|
||||
==================
|
||||
|
||||
* Change "kB" to "KB" in format output
|
||||
* Remove support for Node.js 0.6
|
||||
* Remove support for ComponentJS
|
||||
|
||||
2.5.0 / 2017-03-24
|
||||
==================
|
||||
|
||||
* Add option "unit"
|
||||
|
||||
2.4.0 / 2016-06-01
|
||||
==================
|
||||
|
||||
* Add option "unitSeparator"
|
||||
|
||||
2.3.0 / 2016-02-15
|
||||
==================
|
||||
|
||||
* Drop partial bytes on all parsed units
|
||||
* Fix non-finite numbers to `.format` to return `null`
|
||||
* Fix parsing byte string that looks like hex
|
||||
* perf: hoist regular expressions
|
||||
|
||||
2.2.0 / 2015-11-13
|
||||
==================
|
||||
|
||||
* add option "decimalPlaces"
|
||||
* add option "fixedDecimals"
|
||||
|
||||
2.1.0 / 2015-05-21
|
||||
==================
|
||||
|
||||
* add `.format` export
|
||||
* add `.parse` export
|
||||
|
||||
2.0.2 / 2015-05-20
|
||||
==================
|
||||
|
||||
* remove map recreation
|
||||
* remove unnecessary object construction
|
||||
|
||||
2.0.1 / 2015-05-07
|
||||
==================
|
||||
|
||||
* fix browserify require
|
||||
* remove node.extend dependency
|
||||
|
||||
2.0.0 / 2015-04-12
|
||||
==================
|
||||
|
||||
* add option "case"
|
||||
* add option "thousandsSeparator"
|
||||
* return "null" on invalid parse input
|
||||
* support proper round-trip: bytes(bytes(num)) === num
|
||||
* units no longer case sensitive when parsing
|
||||
|
||||
1.0.0 / 2014-05-05
|
||||
==================
|
||||
|
||||
* add negative support. fixes #6
|
||||
|
||||
0.3.0 / 2014-03-19
|
||||
==================
|
||||
|
||||
* added terabyte support
|
||||
|
||||
0.2.1 / 2013-04-01
|
||||
==================
|
||||
|
||||
* add .component
|
||||
|
||||
0.2.0 / 2012-10-28
|
||||
==================
|
||||
|
||||
* bytes(200).should.eql('200b')
|
||||
|
||||
0.1.0 / 2012-07-04
|
||||
==================
|
||||
|
||||
* add bytes to string conversion [yields]
|
23
node_modules/bytes/LICENSE
generated
vendored
Normal file
23
node_modules/bytes/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2015 Jed Watson <jed.watson@me.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.
|
125
node_modules/bytes/Readme.md
generated
vendored
Normal file
125
node_modules/bytes/Readme.md
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
# Bytes utility
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```bash
|
||||
$ npm install bytes
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var bytes = require('bytes');
|
||||
```
|
||||
|
||||
#### bytes.format(number value, [options]): string|null
|
||||
|
||||
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
|
||||
rounded.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|----------|--------------------|
|
||||
| value | `number` | Value in bytes |
|
||||
| options | `Object` | Conversion options |
|
||||
|
||||
**Options**
|
||||
|
||||
| Property | Type | Description |
|
||||
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
||||
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
||||
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
||||
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `''`. |
|
||||
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
|
||||
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|------------------|-------------------------------------------------|
|
||||
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes(1024);
|
||||
// output: '1KB'
|
||||
|
||||
bytes(1000);
|
||||
// output: '1000B'
|
||||
|
||||
bytes(1000, {thousandsSeparator: ' '});
|
||||
// output: '1 000B'
|
||||
|
||||
bytes(1024 * 1.7, {decimalPlaces: 0});
|
||||
// output: '2KB'
|
||||
|
||||
bytes(1024, {unitSeparator: ' '});
|
||||
// output: '1 KB'
|
||||
|
||||
```
|
||||
|
||||
#### bytes.parse(string|number value): number|null
|
||||
|
||||
Parse the string value into an integer in bytes. If no unit is given, or `value`
|
||||
is a number, it is assumed the value is in bytes.
|
||||
|
||||
Supported units and abbreviations are as follows and are case-insensitive:
|
||||
|
||||
* `b` for bytes
|
||||
* `kb` for kilobytes
|
||||
* `mb` for megabytes
|
||||
* `gb` for gigabytes
|
||||
* `tb` for terabytes
|
||||
|
||||
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------|--------|--------------------|
|
||||
| value | `string`|`number` | String to parse, or number in bytes. |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|-------------|-------------------------|
|
||||
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes('1KB');
|
||||
// output: 1024
|
||||
|
||||
bytes('1024');
|
||||
// output: 1024
|
||||
|
||||
bytes(1024);
|
||||
// output: 1024
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[downloads-image]: https://img.shields.io/npm/dm/bytes.svg
|
||||
[downloads-url]: https://npmjs.org/package/bytes
|
||||
[npm-image]: https://img.shields.io/npm/v/bytes.svg
|
||||
[npm-url]: https://npmjs.org/package/bytes
|
||||
[travis-image]: https://img.shields.io/travis/visionmedia/bytes.js/master.svg
|
||||
[travis-url]: https://travis-ci.org/visionmedia/bytes.js
|
||||
[coveralls-image]: https://img.shields.io/coveralls/visionmedia/bytes.js/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
|
159
node_modules/bytes/index.js
generated
vendored
Normal file
159
node_modules/bytes/index.js
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
/*!
|
||||
* bytes
|
||||
* Copyright(c) 2012-2014 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Jed Watson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = bytes;
|
||||
module.exports.format = format;
|
||||
module.exports.parse = parse;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
||||
|
||||
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
||||
|
||||
var map = {
|
||||
b: 1,
|
||||
kb: 1 << 10,
|
||||
mb: 1 << 20,
|
||||
gb: 1 << 30,
|
||||
tb: ((1 << 30) * 1024)
|
||||
};
|
||||
|
||||
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i;
|
||||
|
||||
/**
|
||||
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
||||
*
|
||||
* @param {string|number} value
|
||||
* @param {{
|
||||
* case: [string],
|
||||
* decimalPlaces: [number]
|
||||
* fixedDecimals: [boolean]
|
||||
* thousandsSeparator: [string]
|
||||
* unitSeparator: [string]
|
||||
* }} [options] bytes options.
|
||||
*
|
||||
* @returns {string|number|null}
|
||||
*/
|
||||
|
||||
function bytes(value, options) {
|
||||
if (typeof value === 'string') {
|
||||
return parse(value);
|
||||
}
|
||||
|
||||
if (typeof value === 'number') {
|
||||
return format(value, options);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given value in bytes into a string.
|
||||
*
|
||||
* If the value is negative, it is kept as such. If it is a float,
|
||||
* it is rounded.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {object} [options]
|
||||
* @param {number} [options.decimalPlaces=2]
|
||||
* @param {number} [options.fixedDecimals=false]
|
||||
* @param {string} [options.thousandsSeparator=]
|
||||
* @param {string} [options.unit=]
|
||||
* @param {string} [options.unitSeparator=]
|
||||
*
|
||||
* @returns {string|null}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function format(value, options) {
|
||||
if (!Number.isFinite(value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mag = Math.abs(value);
|
||||
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
||||
var unitSeparator = (options && options.unitSeparator) || '';
|
||||
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
||||
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
||||
var unit = (options && options.unit) || '';
|
||||
|
||||
if (!unit || !map[unit.toLowerCase()]) {
|
||||
if (mag >= map.tb) {
|
||||
unit = 'TB';
|
||||
} else if (mag >= map.gb) {
|
||||
unit = 'GB';
|
||||
} else if (mag >= map.mb) {
|
||||
unit = 'MB';
|
||||
} else if (mag >= map.kb) {
|
||||
unit = 'KB';
|
||||
} else {
|
||||
unit = 'B';
|
||||
}
|
||||
}
|
||||
|
||||
var val = value / map[unit.toLowerCase()];
|
||||
var str = val.toFixed(decimalPlaces);
|
||||
|
||||
if (!fixedDecimals) {
|
||||
str = str.replace(formatDecimalsRegExp, '$1');
|
||||
}
|
||||
|
||||
if (thousandsSeparator) {
|
||||
str = str.replace(formatThousandsRegExp, thousandsSeparator);
|
||||
}
|
||||
|
||||
return str + unitSeparator + unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the string value into an integer in bytes.
|
||||
*
|
||||
* If no unit is given, it is assumed the value is in bytes.
|
||||
*
|
||||
* @param {number|string} val
|
||||
*
|
||||
* @returns {number|null}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parse(val) {
|
||||
if (typeof val === 'number' && !isNaN(val)) {
|
||||
return val;
|
||||
}
|
||||
|
||||
if (typeof val !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Test if the string passed is valid
|
||||
var results = parseRegExp.exec(val);
|
||||
var floatValue;
|
||||
var unit = 'b';
|
||||
|
||||
if (!results) {
|
||||
// Nothing could be extracted from the given string
|
||||
floatValue = parseInt(val, 10);
|
||||
unit = 'b'
|
||||
} else {
|
||||
// Retrieve the value and the unit
|
||||
floatValue = parseFloat(results[1]);
|
||||
unit = results[4].toLowerCase();
|
||||
}
|
||||
|
||||
return Math.floor(map[unit] * floatValue);
|
||||
}
|
81
node_modules/bytes/package.json
generated
vendored
Normal file
81
node_modules/bytes/package.json
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"_from": "bytes@3.0.0",
|
||||
"_id": "bytes@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=",
|
||||
"_location": "/bytes",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "bytes@3.0.0",
|
||||
"name": "bytes",
|
||||
"escapedName": "bytes",
|
||||
"rawSpec": "3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/compression"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
|
||||
"_shasum": "d32815404d689699f85a4ea4fa8755dd13a96048",
|
||||
"_spec": "bytes@3.0.0",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/compression",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/bytes.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jed Watson",
|
||||
"email": "jed.watson@me.com"
|
||||
},
|
||||
{
|
||||
"name": "Théo FIDRY",
|
||||
"email": "theo.fidry@gmail.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
||||
"devDependencies": {
|
||||
"mocha": "2.5.3",
|
||||
"nyc": "10.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"History.md",
|
||||
"LICENSE",
|
||||
"Readme.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/visionmedia/bytes.js#readme",
|
||||
"keywords": [
|
||||
"byte",
|
||||
"bytes",
|
||||
"utility",
|
||||
"parse",
|
||||
"parser",
|
||||
"convert",
|
||||
"converter"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "bytes",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/visionmedia/bytes.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --check-leaks --reporter spec",
|
||||
"test-ci": "nyc --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
3
node_modules/compress/README.md
generated
vendored
Normal file
3
node_modules/compress/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# compress
|
||||
|
||||
Compress a HTTP message
|
10
node_modules/compress/index.js
generated
vendored
Normal file
10
node_modules/compress/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/*!
|
||||
* compress
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = {}
|
36
node_modules/compress/package.json
generated
vendored
Normal file
36
node_modules/compress/package.json
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"_from": "compress",
|
||||
"_id": "compress@0.99.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-l+MBwlxNAfCX2FED9l7Msud5ZQI=",
|
||||
"_location": "/compress",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "compress",
|
||||
"name": "compress",
|
||||
"escapedName": "compress",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/compress/-/compress-0.99.0.tgz",
|
||||
"_shasum": "97e301c25c4d01f097d85103f65eccb2e7796502",
|
||||
"_spec": "compress",
|
||||
"_where": "/home/martin/dev/multiview",
|
||||
"author": {
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Compress a HTTP message",
|
||||
"license": "MIT",
|
||||
"name": "compress",
|
||||
"version": "0.99.0"
|
||||
}
|
111
node_modules/compressible/HISTORY.md
generated
vendored
Normal file
111
node_modules/compressible/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
2.0.18 / 2020-01-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.43.0 < 2'
|
||||
- Mark `font/ttf` as compressible
|
||||
- Remove compressible from `multipart/mixed`
|
||||
|
||||
2.0.17 / 2019-04-24
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.40.0 < 2'
|
||||
|
||||
2.0.16 / 2019-02-18
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.38.0 < 2'
|
||||
- Mark `text/less` as compressible
|
||||
|
||||
2.0.15 / 2018-09-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.36.0 < 2'
|
||||
|
||||
2.0.14 / 2018-06-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.34.0 < 2'
|
||||
- Mark all XML-derived types as compressible
|
||||
|
||||
2.0.13 / 2018-02-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.33.0 < 2'
|
||||
|
||||
2.0.12 / 2017-10-20
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.30.0 < 2'
|
||||
|
||||
2.0.11 / 2017-07-27
|
||||
===================
|
||||
|
||||
* deps: mime-db@'>= 1.29.0 < 2'
|
||||
|
||||
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
node_modules/compressible/LICENSE
generated
vendored
Normal file
24
node_modules/compressible/LICENSE
generated
vendored
Normal 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.
|
61
node_modules/compressible/README.md
generated
vendored
Normal file
61
node_modules/compressible/README.md
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
# compressible
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
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)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/compressible/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/compressible?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/compressible
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/compressible
|
||||
[npm-url]: https://npmjs.org/package/compressible
|
||||
[npm-version-image]: https://badgen.net/npm/v/compressible
|
||||
[travis-image]: https://badgen.net/travis/jshttp/compressible/master
|
||||
[travis-url]: https://travis-ci.org/jshttp/compressible
|
58
node_modules/compressible/index.js
generated
vendored
Normal file
58
node_modules/compressible/index.js
generated
vendored
Normal 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 COMPRESSIBLE_TYPE_REGEXP = /^text\/|\+(?:json|text|xml)$/i
|
||||
var EXTRACT_TYPE_REGEXP = /^\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 = EXTRACT_TYPE_REGEXP.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 COMPRESSIBLE_TYPE_REGEXP.test(mime) || undefined
|
||||
}
|
91
node_modules/compressible/package.json
generated
vendored
Normal file
91
node_modules/compressible/package.json
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"_from": "compressible@~2.0.16",
|
||||
"_id": "compressible@2.0.18",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
|
||||
"_location": "/compressible",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "compressible@~2.0.16",
|
||||
"name": "compressible",
|
||||
"escapedName": "compressible",
|
||||
"rawSpec": "~2.0.16",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~2.0.16"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/compression"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
|
||||
"_shasum": "af53cca6b070d4c3c0750fbd77286a6d7cc46fba",
|
||||
"_spec": "compressible@~2.0.16",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/compression",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/compressible/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"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.43.0 < 2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Compressible Content-Type / mime checking",
|
||||
"devDependencies": {
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-standard": "14.1.0",
|
||||
"eslint-plugin-import": "2.19.1",
|
||||
"eslint-plugin-markdown": "1.0.1",
|
||||
"eslint-plugin-node": "11.0.0",
|
||||
"eslint-plugin-promise": "4.2.1",
|
||||
"eslint-plugin-standard": "4.0.1",
|
||||
"mocha": "7.0.0",
|
||||
"nyc": "15.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/compressible#readme",
|
||||
"keywords": [
|
||||
"compress",
|
||||
"gzip",
|
||||
"mime",
|
||||
"content-type"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "compressible",
|
||||
"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": "nyc --reporter=html --reporter=text npm test",
|
||||
"test-travis": "nyc --reporter=text npm test",
|
||||
"version": "node scripts/version-history.js && git add HISTORY.md"
|
||||
},
|
||||
"version": "2.0.18"
|
||||
}
|
307
node_modules/compression/HISTORY.md
generated
vendored
Normal file
307
node_modules/compression/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,307 @@
|
||||
1.7.4 / 2019-03-18
|
||||
==================
|
||||
|
||||
* deps: compressible@~2.0.16
|
||||
- Mark `text/less` as compressible
|
||||
- deps: mime-db@'>= 1.38.0 < 2'
|
||||
* deps: on-headers@~1.0.2
|
||||
- Fix `res.writeHead` patch missing return value
|
||||
* perf: prevent unnecessary buffer copy
|
||||
|
||||
1.7.3 / 2018-07-15
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.3.5
|
||||
- deps: mime-types@~2.1.18
|
||||
* deps: compressible@~2.0.14
|
||||
- Mark all XML-derived types as compressible
|
||||
- deps: mime-db@'>= 1.34.0 < 2'
|
||||
* deps: safe-buffer@5.1.2
|
||||
|
||||
1.7.2 / 2018-02-18
|
||||
==================
|
||||
|
||||
* deps: compressible@~2.0.13
|
||||
- deps: mime-db@'>= 1.33.0 < 2'
|
||||
|
||||
1.7.1 / 2017-09-26
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.3.4
|
||||
- deps: mime-types@~2.1.16
|
||||
* deps: bytes@3.0.0
|
||||
* deps: compressible@~2.0.11
|
||||
- deps: mime-db@'>= 1.29.0 < 2'
|
||||
* deps: debug@2.6.9
|
||||
* deps: vary@~1.1.2
|
||||
- perf: improve header token parsing speed
|
||||
|
||||
1.7.0 / 2017-07-10
|
||||
==================
|
||||
|
||||
* Use `safe-buffer` for improved Buffer API
|
||||
* deps: bytes@2.5.0
|
||||
* deps: compressible@~2.0.10
|
||||
- Fix regex fallback to not override `compressible: false` in db
|
||||
- deps: mime-db@'>= 1.27.0 < 2'
|
||||
* deps: debug@2.6.8
|
||||
- Allow colors in workers
|
||||
- Deprecated `DEBUG_FD` environment variable set to `3` or higher
|
||||
- Fix error when running under React Native
|
||||
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||
- Use same color for same namespace
|
||||
- deps: ms@2.0.0
|
||||
* deps: vary@~1.1.1
|
||||
- perf: hoist regular expression
|
||||
|
||||
1.6.2 / 2016-05-12
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.3.3
|
||||
- deps: mime-types@~2.1.11
|
||||
- deps: negotiator@0.6.1
|
||||
* deps: bytes@2.3.0
|
||||
- Drop partial bytes on all parsed units
|
||||
- Fix parsing byte string that looks like hex
|
||||
- perf: hoist regular expressions
|
||||
* deps: compressible@~2.0.8
|
||||
- deps: mime-db@'>= 1.23.0 < 2'
|
||||
|
||||
1.6.1 / 2016-01-19
|
||||
==================
|
||||
|
||||
* deps: bytes@2.2.0
|
||||
* deps: compressible@~2.0.7
|
||||
- deps: mime-db@'>= 1.21.0 < 2'
|
||||
* deps: accepts@~1.3.1
|
||||
- deps: mime-types@~2.1.9
|
||||
|
||||
1.6.0 / 2015-09-29
|
||||
==================
|
||||
|
||||
* Skip compression when response has `Cache-Control: no-transform`
|
||||
* deps: accepts@~1.3.0
|
||||
- deps: mime-types@~2.1.7
|
||||
- deps: negotiator@0.6.0
|
||||
* deps: compressible@~2.0.6
|
||||
- deps: mime-db@'>= 1.19.0 < 2'
|
||||
* deps: on-headers@~1.0.1
|
||||
- perf: enable strict mode
|
||||
* deps: vary@~1.1.0
|
||||
- Only accept valid field names in the `field` argument
|
||||
|
||||
1.5.2 / 2015-07-30
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.12
|
||||
- deps: mime-types@~2.1.4
|
||||
* deps: compressible@~2.0.5
|
||||
- deps: mime-db@'>= 1.16.0 < 2'
|
||||
* deps: vary@~1.0.1
|
||||
- Fix setting empty header from empty `field`
|
||||
- perf: enable strict mode
|
||||
- perf: remove argument reassignments
|
||||
|
||||
1.5.1 / 2015-07-05
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.10
|
||||
- deps: mime-types@~2.1.2
|
||||
* deps: compressible@~2.0.4
|
||||
- deps: mime-db@'>= 1.14.0 < 2'
|
||||
- perf: enable strict mode
|
||||
|
||||
1.5.0 / 2015-06-09
|
||||
==================
|
||||
|
||||
* Fix return value from `.end` and `.write` after end
|
||||
* Improve detection of zero-length body without `Content-Length`
|
||||
* deps: accepts@~1.2.9
|
||||
- deps: mime-types@~2.1.1
|
||||
- perf: avoid argument reassignment & argument slice
|
||||
- perf: avoid negotiator recursive construction
|
||||
- perf: enable strict mode
|
||||
- perf: remove unnecessary bitwise operator
|
||||
* deps: bytes@2.1.0
|
||||
- Slight optimizations
|
||||
- Units no longer case sensitive when parsing
|
||||
* deps: compressible@~2.0.3
|
||||
- Fix regex fallback to work if type exists, but is undefined
|
||||
- deps: mime-db@'>= 1.13.0 < 2'
|
||||
- perf: hoist regex declaration
|
||||
- perf: use regex to extract mime
|
||||
* perf: enable strict mode
|
||||
* perf: remove flush reassignment
|
||||
* perf: simplify threshold detection
|
||||
|
||||
1.4.4 / 2015-05-11
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.7
|
||||
- deps: mime-types@~2.0.11
|
||||
- deps: negotiator@0.5.3
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
|
||||
1.4.3 / 2015-03-14
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.5
|
||||
- deps: mime-types@~2.0.10
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
1.4.2 / 2015-03-11
|
||||
==================
|
||||
|
||||
* Fix error when code calls `res.end(str, encoding)`
|
||||
- Specific to Node.js 0.8
|
||||
* deps: debug@~2.1.2
|
||||
- deps: ms@0.7.0
|
||||
|
||||
1.4.1 / 2015-02-15
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.4
|
||||
- deps: mime-types@~2.0.9
|
||||
- deps: negotiator@0.5.1
|
||||
|
||||
1.4.0 / 2015-02-01
|
||||
==================
|
||||
|
||||
* Prefer `gzip` over `deflate` on the server
|
||||
- Not all clients agree on what "deflate" coding means
|
||||
|
||||
1.3.1 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.3
|
||||
- deps: mime-types@~2.0.8
|
||||
* deps: compressible@~2.0.2
|
||||
- deps: mime-db@'>= 1.1.2 < 2'
|
||||
|
||||
1.3.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* Export the default `filter` function for wrapping
|
||||
* deps: accepts@~1.2.2
|
||||
- deps: mime-types@~2.0.7
|
||||
- deps: negotiator@0.5.0
|
||||
* deps: debug@~2.1.1
|
||||
|
||||
1.2.2 / 2014-12-10
|
||||
==================
|
||||
|
||||
* Fix `.end` to only proxy to `.end`
|
||||
- Fixes an issue with Node.js 0.11.14
|
||||
* deps: accepts@~1.1.4
|
||||
- deps: mime-types@~2.0.4
|
||||
|
||||
1.2.1 / 2014-11-23
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.3
|
||||
- deps: mime-types@~2.0.3
|
||||
|
||||
1.2.0 / 2014-10-16
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
|
||||
1.1.2 / 2014-10-15
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.2
|
||||
- Fix error when media type has invalid parameter
|
||||
- deps: negotiator@0.4.9
|
||||
|
||||
1.1.1 / 2014-10-12
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.1
|
||||
- deps: mime-types@~2.0.2
|
||||
- deps: negotiator@0.4.8
|
||||
* deps: compressible@~2.0.1
|
||||
- deps: mime-db@1.x
|
||||
|
||||
1.1.0 / 2014-09-07
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.0
|
||||
* deps: compressible@~2.0.0
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
1.0.11 / 2014-08-10
|
||||
===================
|
||||
|
||||
* deps: on-headers@~1.0.0
|
||||
* deps: vary@~1.0.0
|
||||
|
||||
1.0.10 / 2014-08-05
|
||||
===================
|
||||
|
||||
* deps: compressible@~1.1.1
|
||||
- Fix upper-case Content-Type characters prevent compression
|
||||
|
||||
1.0.9 / 2014-07-20
|
||||
==================
|
||||
|
||||
* Add `debug` messages
|
||||
* deps: accepts@~1.0.7
|
||||
- deps: negotiator@0.4.7
|
||||
|
||||
1.0.8 / 2014-06-20
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.0.5
|
||||
- use `mime-types`
|
||||
|
||||
1.0.7 / 2014-06-11
|
||||
==================
|
||||
|
||||
* use vary module for better `Vary` behavior
|
||||
* deps: accepts@1.0.3
|
||||
* deps: compressible@1.1.0
|
||||
|
||||
1.0.6 / 2014-06-03
|
||||
==================
|
||||
|
||||
* fix regression when negotiation fails
|
||||
|
||||
1.0.5 / 2014-06-03
|
||||
==================
|
||||
|
||||
* fix listeners for delayed stream creation
|
||||
- fixes regression for certain `stream.pipe(res)` situations
|
||||
|
||||
1.0.4 / 2014-06-03
|
||||
==================
|
||||
|
||||
* fix adding `Vary` when value stored as array
|
||||
* fix back-pressure behavior
|
||||
* fix length check for `res.end`
|
||||
|
||||
1.0.3 / 2014-05-29
|
||||
==================
|
||||
|
||||
* use `accepts` for negotiation
|
||||
* use `on-headers` to handle header checking
|
||||
* deps: bytes@1.0.0
|
||||
|
||||
1.0.2 / 2014-04-29
|
||||
==================
|
||||
|
||||
* only version compatible with node.js 0.8
|
||||
* support headers given to `res.writeHead`
|
||||
* deps: bytes@0.3.0
|
||||
* deps: negotiator@0.4.3
|
||||
|
||||
1.0.1 / 2014-03-08
|
||||
==================
|
||||
|
||||
* bump negotiator
|
||||
* use compressible
|
||||
* use .headersSent (drops 0.8 support)
|
||||
* handle identity;q=0 case
|
23
node_modules/compression/LICENSE
generated
vendored
Normal file
23
node_modules/compression/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
240
node_modules/compression/README.md
generated
vendored
Normal file
240
node_modules/compression/README.md
generated
vendored
Normal file
@ -0,0 +1,240 @@
|
||||
# compression
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Node.js compression middleware.
|
||||
|
||||
The following compression codings are supported:
|
||||
|
||||
- deflate
|
||||
- gzip
|
||||
|
||||
## 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):
|
||||
|
||||
```bash
|
||||
$ npm install compression
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var compression = require('compression')
|
||||
```
|
||||
|
||||
### compression([options])
|
||||
|
||||
Returns the compression middleware using the given `options`. The middleware
|
||||
will attempt to compress response bodies for all request that traverse through
|
||||
the middleware, based on the given `options`.
|
||||
|
||||
This middleware will never compress responses that include a `Cache-Control`
|
||||
header with the [`no-transform` directive](https://tools.ietf.org/html/rfc7234#section-5.2.2.4),
|
||||
as compressing will transform the body.
|
||||
|
||||
#### Options
|
||||
|
||||
`compression()` accepts these properties in the options object. In addition to
|
||||
those listed below, [zlib](http://nodejs.org/api/zlib.html) options may be
|
||||
passed in to the options object.
|
||||
|
||||
##### chunkSize
|
||||
|
||||
The default value is `zlib.Z_DEFAULT_CHUNK`, or `16384`.
|
||||
|
||||
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
|
||||
regarding the usage.
|
||||
|
||||
##### filter
|
||||
|
||||
A function to decide if the response should be considered for compression.
|
||||
This function is called as `filter(req, res)` and is expected to return
|
||||
`true` to consider the response for compression, or `false` to not compress
|
||||
the response.
|
||||
|
||||
The default filter function uses the [compressible](https://www.npmjs.com/package/compressible)
|
||||
module to determine if `res.getHeader('Content-Type')` is compressible.
|
||||
|
||||
##### level
|
||||
|
||||
The level of zlib compression to apply to responses. A higher level will result
|
||||
in better compression, but will take longer to complete. A lower level will
|
||||
result in less compression, but will be much faster.
|
||||
|
||||
This is an integer in the range of `0` (no compression) to `9` (maximum
|
||||
compression). The special value `-1` can be used to mean the "default
|
||||
compression level", which is a default compromise between speed and
|
||||
compression (currently equivalent to level 6).
|
||||
|
||||
- `-1` Default compression level (also `zlib.Z_DEFAULT_COMPRESSION`).
|
||||
- `0` No compression (also `zlib.Z_NO_COMPRESSION`).
|
||||
- `1` Fastest compression (also `zlib.Z_BEST_SPEED`).
|
||||
- `2`
|
||||
- `3`
|
||||
- `4`
|
||||
- `5`
|
||||
- `6` (currently what `zlib.Z_DEFAULT_COMPRESSION` points to).
|
||||
- `7`
|
||||
- `8`
|
||||
- `9` Best compression (also `zlib.Z_BEST_COMPRESSION`).
|
||||
|
||||
The default value is `zlib.Z_DEFAULT_COMPRESSION`, or `-1`.
|
||||
|
||||
**Note** in the list above, `zlib` is from `zlib = require('zlib')`.
|
||||
|
||||
##### memLevel
|
||||
|
||||
This specifies how much memory should be allocated for the internal compression
|
||||
state and is an integer in the range of `1` (minimum level) and `9` (maximum
|
||||
level).
|
||||
|
||||
The default value is `zlib.Z_DEFAULT_MEMLEVEL`, or `8`.
|
||||
|
||||
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
|
||||
regarding the usage.
|
||||
|
||||
##### strategy
|
||||
|
||||
This is used to tune the compression algorithm. This value only affects the
|
||||
compression ratio, not the correctness of the compressed output, even if it
|
||||
is not set appropriately.
|
||||
|
||||
- `zlib.Z_DEFAULT_STRATEGY` Use for normal data.
|
||||
- `zlib.Z_FILTERED` Use for data produced by a filter (or predictor).
|
||||
Filtered data consists mostly of small values with a somewhat random
|
||||
distribution. In this case, the compression algorithm is tuned to
|
||||
compress them better. The effect is to force more Huffman coding and less
|
||||
string matching; it is somewhat intermediate between `zlib.Z_DEFAULT_STRATEGY`
|
||||
and `zlib.Z_HUFFMAN_ONLY`.
|
||||
- `zlib.Z_FIXED` Use to prevent the use of dynamic Huffman codes, allowing
|
||||
for a simpler decoder for special applications.
|
||||
- `zlib.Z_HUFFMAN_ONLY` Use to force Huffman encoding only (no string match).
|
||||
- `zlib.Z_RLE` Use to limit match distances to one (run-length encoding).
|
||||
This is designed to be almost as fast as `zlib.Z_HUFFMAN_ONLY`, but give
|
||||
better compression for PNG image data.
|
||||
|
||||
**Note** in the list above, `zlib` is from `zlib = require('zlib')`.
|
||||
|
||||
##### threshold
|
||||
|
||||
The byte threshold for the response body size before compression is considered
|
||||
for the response, defaults to `1kb`. This is a number of bytes or any string
|
||||
accepted by the [bytes](https://www.npmjs.com/package/bytes) module.
|
||||
|
||||
**Note** this is only an advisory setting; if the response size cannot be determined
|
||||
at the time the response headers are written, then it is assumed the response is
|
||||
_over_ the threshold. To guarantee the response size can be determined, be sure
|
||||
set a `Content-Length` response header.
|
||||
|
||||
##### windowBits
|
||||
|
||||
The default value is `zlib.Z_DEFAULT_WINDOWBITS`, or `15`.
|
||||
|
||||
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
|
||||
regarding the usage.
|
||||
|
||||
#### .filter
|
||||
|
||||
The default `filter` function. This is used to construct a custom filter
|
||||
function that is an extension of the default function.
|
||||
|
||||
```js
|
||||
var compression = require('compression')
|
||||
var express = require('express')
|
||||
|
||||
var app = express()
|
||||
app.use(compression({ filter: shouldCompress }))
|
||||
|
||||
function shouldCompress (req, res) {
|
||||
if (req.headers['x-no-compression']) {
|
||||
// don't compress responses with this request header
|
||||
return false
|
||||
}
|
||||
|
||||
// fallback to standard filter function
|
||||
return compression.filter(req, res)
|
||||
}
|
||||
```
|
||||
|
||||
### res.flush
|
||||
|
||||
This module adds a `res.flush()` method to force the partially-compressed
|
||||
response to be flushed to the client.
|
||||
|
||||
## Examples
|
||||
|
||||
### express/connect
|
||||
|
||||
When using this module with express or connect, simply `app.use` the module as
|
||||
high as you like. Requests that pass through the middleware will be compressed.
|
||||
|
||||
```js
|
||||
var compression = require('compression')
|
||||
var express = require('express')
|
||||
|
||||
var app = express()
|
||||
|
||||
// compress all responses
|
||||
app.use(compression())
|
||||
|
||||
// add all routes
|
||||
```
|
||||
|
||||
### Server-Sent Events
|
||||
|
||||
Because of the nature of compression this module does not work out of the box
|
||||
with server-sent events. To compress content, a window of the output needs to
|
||||
be buffered up in order to get good compression. Typically when using server-sent
|
||||
events, there are certain block of data that need to reach the client.
|
||||
|
||||
You can achieve this by calling `res.flush()` when you need the data written to
|
||||
actually make it to the client.
|
||||
|
||||
```js
|
||||
var compression = require('compression')
|
||||
var express = require('express')
|
||||
|
||||
var app = express()
|
||||
|
||||
// compress responses
|
||||
app.use(compression())
|
||||
|
||||
// server-sent event stream
|
||||
app.get('/events', function (req, res) {
|
||||
res.setHeader('Content-Type', 'text/event-stream')
|
||||
res.setHeader('Cache-Control', 'no-cache')
|
||||
|
||||
// send a ping approx every 2 seconds
|
||||
var timer = setInterval(function () {
|
||||
res.write('data: ping\n\n')
|
||||
|
||||
// !!! this is the important part
|
||||
res.flush()
|
||||
}, 2000)
|
||||
|
||||
res.on('close', function () {
|
||||
clearInterval(timer)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/compression.svg
|
||||
[npm-url]: https://npmjs.org/package/compression
|
||||
[travis-image]: https://img.shields.io/travis/expressjs/compression/master.svg
|
||||
[travis-url]: https://travis-ci.org/expressjs/compression
|
||||
[coveralls-image]: https://img.shields.io/coveralls/expressjs/compression/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/compression?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/compression.svg
|
||||
[downloads-url]: https://npmjs.org/package/compression
|
288
node_modules/compression/index.js
generated
vendored
Normal file
288
node_modules/compression/index.js
generated
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
/*!
|
||||
* compression
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var accepts = require('accepts')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var bytes = require('bytes')
|
||||
var compressible = require('compressible')
|
||||
var debug = require('debug')('compression')
|
||||
var onHeaders = require('on-headers')
|
||||
var vary = require('vary')
|
||||
var zlib = require('zlib')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = compression
|
||||
module.exports.filter = shouldCompress
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/
|
||||
|
||||
/**
|
||||
* Compress response data with gzip / deflate.
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @return {Function} middleware
|
||||
* @public
|
||||
*/
|
||||
|
||||
function compression (options) {
|
||||
var opts = options || {}
|
||||
|
||||
// options
|
||||
var filter = opts.filter || shouldCompress
|
||||
var threshold = bytes.parse(opts.threshold)
|
||||
|
||||
if (threshold == null) {
|
||||
threshold = 1024
|
||||
}
|
||||
|
||||
return function compression (req, res, next) {
|
||||
var ended = false
|
||||
var length
|
||||
var listeners = []
|
||||
var stream
|
||||
|
||||
var _end = res.end
|
||||
var _on = res.on
|
||||
var _write = res.write
|
||||
|
||||
// flush
|
||||
res.flush = function flush () {
|
||||
if (stream) {
|
||||
stream.flush()
|
||||
}
|
||||
}
|
||||
|
||||
// proxy
|
||||
|
||||
res.write = function write (chunk, encoding) {
|
||||
if (ended) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!this._header) {
|
||||
this._implicitHeader()
|
||||
}
|
||||
|
||||
return stream
|
||||
? stream.write(toBuffer(chunk, encoding))
|
||||
: _write.call(this, chunk, encoding)
|
||||
}
|
||||
|
||||
res.end = function end (chunk, encoding) {
|
||||
if (ended) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!this._header) {
|
||||
// estimate the length
|
||||
if (!this.getHeader('Content-Length')) {
|
||||
length = chunkLength(chunk, encoding)
|
||||
}
|
||||
|
||||
this._implicitHeader()
|
||||
}
|
||||
|
||||
if (!stream) {
|
||||
return _end.call(this, chunk, encoding)
|
||||
}
|
||||
|
||||
// mark ended
|
||||
ended = true
|
||||
|
||||
// write Buffer for Node.js 0.8
|
||||
return chunk
|
||||
? stream.end(toBuffer(chunk, encoding))
|
||||
: stream.end()
|
||||
}
|
||||
|
||||
res.on = function on (type, listener) {
|
||||
if (!listeners || type !== 'drain') {
|
||||
return _on.call(this, type, listener)
|
||||
}
|
||||
|
||||
if (stream) {
|
||||
return stream.on(type, listener)
|
||||
}
|
||||
|
||||
// buffer listeners for future stream
|
||||
listeners.push([type, listener])
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
function nocompress (msg) {
|
||||
debug('no compression: %s', msg)
|
||||
addListeners(res, _on, listeners)
|
||||
listeners = null
|
||||
}
|
||||
|
||||
onHeaders(res, function onResponseHeaders () {
|
||||
// determine if request is filtered
|
||||
if (!filter(req, res)) {
|
||||
nocompress('filtered')
|
||||
return
|
||||
}
|
||||
|
||||
// determine if the entity should be transformed
|
||||
if (!shouldTransform(req, res)) {
|
||||
nocompress('no transform')
|
||||
return
|
||||
}
|
||||
|
||||
// vary
|
||||
vary(res, 'Accept-Encoding')
|
||||
|
||||
// content-length below threshold
|
||||
if (Number(res.getHeader('Content-Length')) < threshold || length < threshold) {
|
||||
nocompress('size below threshold')
|
||||
return
|
||||
}
|
||||
|
||||
var encoding = res.getHeader('Content-Encoding') || 'identity'
|
||||
|
||||
// already encoded
|
||||
if (encoding !== 'identity') {
|
||||
nocompress('already encoded')
|
||||
return
|
||||
}
|
||||
|
||||
// head
|
||||
if (req.method === 'HEAD') {
|
||||
nocompress('HEAD request')
|
||||
return
|
||||
}
|
||||
|
||||
// compression method
|
||||
var accept = accepts(req)
|
||||
var method = accept.encoding(['gzip', 'deflate', 'identity'])
|
||||
|
||||
// we really don't prefer deflate
|
||||
if (method === 'deflate' && accept.encoding(['gzip'])) {
|
||||
method = accept.encoding(['gzip', 'identity'])
|
||||
}
|
||||
|
||||
// negotiation failed
|
||||
if (!method || method === 'identity') {
|
||||
nocompress('not acceptable')
|
||||
return
|
||||
}
|
||||
|
||||
// compression stream
|
||||
debug('%s compression', method)
|
||||
stream = method === 'gzip'
|
||||
? zlib.createGzip(opts)
|
||||
: zlib.createDeflate(opts)
|
||||
|
||||
// add buffered listeners to stream
|
||||
addListeners(stream, stream.on, listeners)
|
||||
|
||||
// header fields
|
||||
res.setHeader('Content-Encoding', method)
|
||||
res.removeHeader('Content-Length')
|
||||
|
||||
// compression
|
||||
stream.on('data', function onStreamData (chunk) {
|
||||
if (_write.call(res, chunk) === false) {
|
||||
stream.pause()
|
||||
}
|
||||
})
|
||||
|
||||
stream.on('end', function onStreamEnd () {
|
||||
_end.call(res)
|
||||
})
|
||||
|
||||
_on.call(res, 'drain', function onResponseDrain () {
|
||||
stream.resume()
|
||||
})
|
||||
})
|
||||
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add bufferred listeners to stream
|
||||
* @private
|
||||
*/
|
||||
|
||||
function addListeners (stream, on, listeners) {
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
on.apply(stream, listeners[i])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of a given chunk
|
||||
*/
|
||||
|
||||
function chunkLength (chunk, encoding) {
|
||||
if (!chunk) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return !Buffer.isBuffer(chunk)
|
||||
? Buffer.byteLength(chunk, encoding)
|
||||
: chunk.length
|
||||
}
|
||||
|
||||
/**
|
||||
* Default filter function.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function shouldCompress (req, res) {
|
||||
var type = res.getHeader('Content-Type')
|
||||
|
||||
if (type === undefined || !compressible(type)) {
|
||||
debug('%s not compressible', type)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the entity should be transformed.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function shouldTransform (req, res) {
|
||||
var cacheControl = res.getHeader('Cache-Control')
|
||||
|
||||
// Don't compress for Cache-Control: no-transform
|
||||
// https://tools.ietf.org/html/rfc7234#section-5.2.2.4
|
||||
return !cacheControl ||
|
||||
!cacheControlNoTransformRegExp.test(cacheControl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce arguments to Buffer
|
||||
* @private
|
||||
*/
|
||||
|
||||
function toBuffer (chunk, encoding) {
|
||||
return !Buffer.isBuffer(chunk)
|
||||
? Buffer.from(chunk, encoding)
|
||||
: chunk
|
||||
}
|
87
node_modules/compression/package.json
generated
vendored
Normal file
87
node_modules/compression/package.json
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"_from": "compression",
|
||||
"_id": "compression@1.7.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
|
||||
"_location": "/compression",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "compression",
|
||||
"name": "compression",
|
||||
"escapedName": "compression",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
|
||||
"_shasum": "95523eff170ca57c29a0ca41e6fe131f41e5bb8f",
|
||||
"_spec": "compression",
|
||||
"_where": "/home/martin/dev/multiview",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/compression/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.5",
|
||||
"bytes": "3.0.0",
|
||||
"compressible": "~2.0.16",
|
||||
"debug": "2.6.9",
|
||||
"on-headers": "~1.0.2",
|
||||
"safe-buffer": "5.1.2",
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Node.js compression middleware",
|
||||
"devDependencies": {
|
||||
"after": "0.8.2",
|
||||
"eslint": "5.15.1",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-import": "2.16.0",
|
||||
"eslint-plugin-markdown": "1.0.0",
|
||||
"eslint-plugin-node": "7.0.1",
|
||||
"eslint-plugin-promise": "4.0.1",
|
||||
"eslint-plugin-standard": "4.0.0",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "6.0.2",
|
||||
"supertest": "4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/expressjs/compression#readme",
|
||||
"license": "MIT",
|
||||
"name": "compression",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expressjs/compression.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --check-leaks --reporter spec --bail",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec"
|
||||
},
|
||||
"version": "1.7.4"
|
||||
}
|
1
node_modules/debug/.coveralls.yml
generated
vendored
Normal file
1
node_modules/debug/.coveralls.yml
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
11
node_modules/debug/.eslintrc
generated
vendored
Normal file
11
node_modules/debug/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
9
node_modules/debug/.npmignore
generated
vendored
Normal file
9
node_modules/debug/.npmignore
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
||||
coverage
|
||||
bower.json
|
14
node_modules/debug/.travis.yml
generated
vendored
Normal file
14
node_modules/debug/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "5"
|
||||
- "4"
|
||||
|
||||
install:
|
||||
- make node_modules
|
||||
|
||||
script:
|
||||
- make lint
|
||||
- make test
|
||||
- make coveralls
|
362
node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
362
node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,362 @@
|
||||
|
||||
2.6.9 / 2017-09-22
|
||||
==================
|
||||
|
||||
* remove ReDoS regexp in %o formatter (#504)
|
||||
|
||||
2.6.8 / 2017-05-18
|
||||
==================
|
||||
|
||||
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||
|
||||
2.6.7 / 2017-05-16
|
||||
==================
|
||||
|
||||
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||
* Docs: Fix typo (#455, @msasad)
|
||||
|
||||
2.6.5 / 2017-04-27
|
||||
==================
|
||||
|
||||
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||
|
||||
|
||||
2.6.4 / 2017-04-20
|
||||
==================
|
||||
|
||||
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||
|
||||
2.6.3 / 2017-03-13
|
||||
==================
|
||||
|
||||
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||
* Docs: Changelog fix (@thebigredgeek)
|
||||
|
||||
2.6.2 / 2017-03-10
|
||||
==================
|
||||
|
||||
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||
* Docs: Add Slackin invite badge (@tootallnate)
|
||||
|
||||
2.6.1 / 2017-02-10
|
||||
==================
|
||||
|
||||
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||
|
||||
2.6.0 / 2016-12-28
|
||||
==================
|
||||
|
||||
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||
|
||||
2.5.2 / 2016-12-25
|
||||
==================
|
||||
|
||||
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||
* Docs: fixed README typo (#391, @lurch)
|
||||
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||
|
||||
2.5.1 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: babel-core compatibility
|
||||
|
||||
2.5.0 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||
* Fix: webworker compatibility (@thebigredgeek)
|
||||
* Fix: output formatting issue (#388, @kribblo)
|
||||
* Fix: babel-loader compatibility (#383, @escwald)
|
||||
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||
* Test: coveralls integration (#378, @yamikuronue)
|
||||
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||
|
||||
2.4.5 / 2016-12-17
|
||||
==================
|
||||
|
||||
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||
* Fix: custom log function (#379, @hsiliev)
|
||||
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||
|
||||
2.4.4 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||
|
||||
2.4.3 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||
|
||||
2.4.2 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: browser colors (#367, @tootallnate)
|
||||
* Misc: travis ci integration (@thebigredgeek)
|
||||
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||
|
||||
2.4.1 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: typo that broke the package (#356)
|
||||
|
||||
2.4.0 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||
* Improvement: allow colors in workers (#335, @botverse)
|
||||
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
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
|
19
node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/debug/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
(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.
|
||||
|
50
node_modules/debug/Makefile
generated
vendored
Normal file
50
node_modules/debug/Makefile
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# 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
|
||||
|
||||
# Path
|
||||
PATH := node_modules/.bin:$(PATH)
|
||||
SHELL := /bin/bash
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
YARN ?= $(shell which yarn)
|
||||
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
.FORCE:
|
||||
|
||||
install: node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(PKG) install
|
||||
@touch node_modules
|
||||
|
||||
lint: .FORCE
|
||||
eslint browser.js debug.js index.js node.js
|
||||
|
||||
test-node: .FORCE
|
||||
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||
|
||||
test-browser: .FORCE
|
||||
mkdir -p dist
|
||||
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > dist/debug.js
|
||||
|
||||
karma start --single-run
|
||||
rimraf dist
|
||||
|
||||
test: .FORCE
|
||||
concurrently \
|
||||
"make test-node" \
|
||||
"make test-browser"
|
||||
|
||||
coveralls:
|
||||
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
.PHONY: all install clean distclean
|
312
node_modules/debug/README.md
generated
vendored
Normal file
312
node_modules/debug/README.md
generated
vendored
Normal file
@ -0,0 +1,312 @@
|
||||
# debug
|
||||
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
|
||||
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
|
||||
|
||||
|
||||
|
||||
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
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:
|
||||
|
||||
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
|
||||
|
||||
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env: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.
|
||||
|
||||
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
|
||||
|
||||
## 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:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
## Browser support
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```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:
|
||||
|
||||
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
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');
|
||||
```
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2016 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.
|
19
node_modules/debug/component.json
generated
vendored
Normal file
19
node_modules/debug/component.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.6.9",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "src/browser.js",
|
||||
"scripts": [
|
||||
"src/browser.js",
|
||||
"src/debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"rauchg/ms.js": "0.7.1"
|
||||
}
|
||||
}
|
70
node_modules/debug/karma.conf.js
generated
vendored
Normal file
70
node_modules/debug/karma.conf.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
// Karma configuration
|
||||
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha', 'chai', 'sinon'],
|
||||
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'dist/debug.js',
|
||||
'test/*spec.js'
|
||||
],
|
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'src/node.js'
|
||||
],
|
||||
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
1
node_modules/debug/node.js
generated
vendored
Normal file
1
node_modules/debug/node.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./src/node');
|
88
node_modules/debug/package.json
generated
vendored
Normal file
88
node_modules/debug/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"_from": "debug@2.6.9",
|
||||
"_id": "debug@2.6.9",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"_location": "/debug",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "debug@2.6.9",
|
||||
"name": "debug",
|
||||
"escapedName": "debug",
|
||||
"rawSpec": "2.6.9",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.6.9"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/compression"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"_shasum": "5d128515df134ff327e90a4c93f4e077a536341f",
|
||||
"_spec": "debug@2.6.9",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/compression",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"browser": "./src/browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Rhyne",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.12.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^1.3.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"sinon": "^1.17.6",
|
||||
"sinon-chai": "^2.8.0"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./src/index.js",
|
||||
"name": "debug",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"version": "2.6.9"
|
||||
}
|
185
node_modules/debug/src/browser.js
generated
vendored
Normal file
185
node_modules/debug/src/browser.js
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
/**
|
||||
* 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() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (err) {
|
||||
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit')
|
||||
|
||||
// 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-zA-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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
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) {}
|
||||
}
|
202
node_modules/debug/src/debug.js
generated
vendored
Normal file
202
node_modules/debug/src/debug.js
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||
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, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
* @param {String} namespace
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0, i;
|
||||
|
||||
for (i in namespace) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
|
||||
function debug() {
|
||||
// disabled?
|
||||
if (!debug.enabled) return;
|
||||
|
||||
var self = debug;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// turn the `arguments` into a proper Array
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-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;
|
||||
});
|
||||
|
||||
// apply env-specific formatting (colors, etc.)
|
||||
exports.formatArgs.call(self, args);
|
||||
|
||||
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = exports.enabled(namespace);
|
||||
debug.useColors = exports.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
|
||||
// env-specific initialization logic for debug instances
|
||||
if ('function' === typeof exports.init) {
|
||||
exports.init(debug);
|
||||
}
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
var split = (typeof namespaces === 'string' ? 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;
|
||||
}
|
10
node_modules/debug/src/index.js
generated
vendored
Normal file
10
node_modules/debug/src/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Detect Electron renderer process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
15
node_modules/debug/src/inspector-log.js
generated
vendored
Normal file
15
node_modules/debug/src/inspector-log.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
module.exports = inspectorLog;
|
||||
|
||||
// black hole
|
||||
const nullStream = new (require('stream').Writable)();
|
||||
nullStream._write = () => {};
|
||||
|
||||
/**
|
||||
* Outputs a `console.log()` to the Node.js Inspector console *only*.
|
||||
*/
|
||||
function inspectorLog() {
|
||||
const stdout = console._stdout;
|
||||
console._stdout = nullStream;
|
||||
console.log.apply(console, arguments);
|
||||
console._stdout = stdout;
|
||||
}
|
248
node_modules/debug/src/node.js
generated
vendored
Normal file
248
node_modules/debug/src/node.js
generated
vendored
Normal file
@ -0,0 +1,248 @@
|
||||
/**
|
||||
* 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.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce(function (obj, key) {
|
||||
// camel-case
|
||||
var prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||
|
||||
// coerce string value into JS value
|
||||
var val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||
else if (val === 'null') val = null;
|
||||
else val = Number(val);
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
if (1 !== fd && 2 !== fd) {
|
||||
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
|
||||
}
|
||||
|
||||
var stream = 1 === fd ? process.stdout :
|
||||
2 === fd ? process.stderr :
|
||||
createWritableStdioStream(fd);
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts
|
||||
? Boolean(exports.inspectOpts.colors)
|
||||
: tty.isatty(fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n').map(function(str) {
|
||||
return str.trim()
|
||||
}).join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
exports.formatters.O = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var name = this.namespace;
|
||||
var useColors = this.useColors;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return stream.write(util.format.apply(util, 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init (debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
var keys = Object.keys(exports.inspectOpts);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
119
node_modules/matchit/lib/matchit.js
generated
vendored
Normal file
119
node_modules/matchit/lib/matchit.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
'use strict';
|
||||
|
||||
const every = require('@arr/every');
|
||||
|
||||
const SEP = '/';
|
||||
// Types ~> static, param, any, optional
|
||||
const STYPE=0, PTYPE=1, ATYPE=2, OTYPE=3;
|
||||
// Char Codes ~> / : *
|
||||
const SLASH=47, COLON=58, ASTER=42, QMARK=63;
|
||||
|
||||
function strip(str) {
|
||||
if (str === SEP) return str;
|
||||
(str.charCodeAt(0) === SLASH) && (str=str.substring(1));
|
||||
var len = str.length - 1;
|
||||
return str.charCodeAt(len) === SLASH ? str.substring(0, len) : str;
|
||||
}
|
||||
|
||||
function split(str) {
|
||||
return (str=strip(str)) === SEP ? [SEP] : str.split(SEP);
|
||||
}
|
||||
|
||||
function isMatch(arr, obj, idx) {
|
||||
idx = arr[idx];
|
||||
return (obj.val === idx && obj.type === STYPE) || (idx === SEP ? obj.type > PTYPE : obj.type !== STYPE && (idx || '').endsWith(obj.end));
|
||||
}
|
||||
|
||||
function match(str, all) {
|
||||
var i=0, tmp, segs=split(str), len=segs.length, l;
|
||||
var fn = isMatch.bind(isMatch, segs);
|
||||
|
||||
for (; i < all.length; i++) {
|
||||
tmp = all[i];
|
||||
if ((l=tmp.length) === len || (l < len && tmp[l-1].type === ATYPE) || (l > len && tmp[l-1].type === OTYPE)) {
|
||||
if (every(tmp, fn)) return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function parse(str) {
|
||||
if (str === SEP) {
|
||||
return [{ old:str, type:STYPE, val:str, end:'' }];
|
||||
}
|
||||
|
||||
var c, x, t, sfx, nxt=strip(str), i=-1, j=0, len=nxt.length, out=[];
|
||||
|
||||
while (++i < len) {
|
||||
c = nxt.charCodeAt(i);
|
||||
|
||||
if (c === COLON) {
|
||||
j = i + 1; // begining of param
|
||||
t = PTYPE; // set type
|
||||
x = 0; // reset mark
|
||||
sfx = '';
|
||||
|
||||
while (i < len && nxt.charCodeAt(i) !== SLASH) {
|
||||
c = nxt.charCodeAt(i);
|
||||
if (c === QMARK) {
|
||||
x=i; t=OTYPE;
|
||||
} else if (c === 46 && sfx.length === 0) {
|
||||
sfx = nxt.substring(x=i);
|
||||
}
|
||||
i++; // move on
|
||||
}
|
||||
|
||||
out.push({
|
||||
old: str,
|
||||
type: t,
|
||||
val: nxt.substring(j, x||i),
|
||||
end: sfx
|
||||
});
|
||||
|
||||
// shorten string & update pointers
|
||||
nxt=nxt.substring(i); len-=i; i=0;
|
||||
|
||||
continue; // loop
|
||||
} else if (c === ASTER) {
|
||||
out.push({
|
||||
old: str,
|
||||
type: ATYPE,
|
||||
val: nxt.substring(i),
|
||||
end: ''
|
||||
});
|
||||
continue; // loop
|
||||
} else {
|
||||
j = i;
|
||||
while (i < len && nxt.charCodeAt(i) !== SLASH) {
|
||||
++i; // skip to next slash
|
||||
}
|
||||
out.push({
|
||||
old: str,
|
||||
type: STYPE,
|
||||
val: nxt.substring(j, i),
|
||||
end: ''
|
||||
});
|
||||
// shorten string & update pointers
|
||||
nxt=nxt.substring(i); len-=i; i=j=0;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function exec(str, arr) {
|
||||
var i=0, x, y, segs=split(str), out={};
|
||||
for (; i < arr.length; i++) {
|
||||
x=segs[i]; y=arr[i];
|
||||
if (x === SEP) continue;
|
||||
if (x !== void 0 && y.type | 2 === OTYPE) {
|
||||
out[ y.val ] = x.replace(y.end, '');
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
exports.exec = exec;
|
||||
exports.match = match;
|
||||
exports.parse = parse;
|
115
node_modules/matchit/lib/matchit.mjs
generated
vendored
Normal file
115
node_modules/matchit/lib/matchit.mjs
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
'use strict';
|
||||
|
||||
import every from '@arr/every';
|
||||
|
||||
const SEP = '/';
|
||||
// Types ~> static, param, any, optional
|
||||
const STYPE=0, PTYPE=1, ATYPE=2, OTYPE=3;
|
||||
// Char Codes ~> / : *
|
||||
const SLASH=47, COLON=58, ASTER=42, QMARK=63;
|
||||
|
||||
function strip(str) {
|
||||
if (str === SEP) return str;
|
||||
(str.charCodeAt(0) === SLASH) && (str=str.substring(1));
|
||||
var len = str.length - 1;
|
||||
return str.charCodeAt(len) === SLASH ? str.substring(0, len) : str;
|
||||
}
|
||||
|
||||
function split(str) {
|
||||
return (str=strip(str)) === SEP ? [SEP] : str.split(SEP);
|
||||
}
|
||||
|
||||
function isMatch(arr, obj, idx) {
|
||||
idx = arr[idx];
|
||||
return (obj.val === idx && obj.type === STYPE) || (idx === SEP ? obj.type > PTYPE : obj.type !== STYPE && (idx || '').endsWith(obj.end));
|
||||
}
|
||||
|
||||
export function match(str, all) {
|
||||
var i=0, tmp, segs=split(str), len=segs.length, l;
|
||||
var fn = isMatch.bind(isMatch, segs);
|
||||
|
||||
for (; i < all.length; i++) {
|
||||
tmp = all[i];
|
||||
if ((l=tmp.length) === len || (l < len && tmp[l-1].type === ATYPE) || (l > len && tmp[l-1].type === OTYPE)) {
|
||||
if (every(tmp, fn)) return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
export function parse(str) {
|
||||
if (str === SEP) {
|
||||
return [{ old:str, type:STYPE, val:str, end:'' }];
|
||||
}
|
||||
|
||||
var c, x, t, sfx, nxt=strip(str), i=-1, j=0, len=nxt.length, out=[];
|
||||
|
||||
while (++i < len) {
|
||||
c = nxt.charCodeAt(i);
|
||||
|
||||
if (c === COLON) {
|
||||
j = i + 1; // begining of param
|
||||
t = PTYPE; // set type
|
||||
x = 0; // reset mark
|
||||
sfx = '';
|
||||
|
||||
while (i < len && nxt.charCodeAt(i) !== SLASH) {
|
||||
c = nxt.charCodeAt(i);
|
||||
if (c === QMARK) {
|
||||
x=i; t=OTYPE;
|
||||
} else if (c === 46 && sfx.length === 0) {
|
||||
sfx = nxt.substring(x=i);
|
||||
}
|
||||
i++; // move on
|
||||
}
|
||||
|
||||
out.push({
|
||||
old: str,
|
||||
type: t,
|
||||
val: nxt.substring(j, x||i),
|
||||
end: sfx
|
||||
});
|
||||
|
||||
// shorten string & update pointers
|
||||
nxt=nxt.substring(i); len-=i; i=0;
|
||||
|
||||
continue; // loop
|
||||
} else if (c === ASTER) {
|
||||
out.push({
|
||||
old: str,
|
||||
type: ATYPE,
|
||||
val: nxt.substring(i),
|
||||
end: ''
|
||||
});
|
||||
continue; // loop
|
||||
} else {
|
||||
j = i;
|
||||
while (i < len && nxt.charCodeAt(i) !== SLASH) {
|
||||
++i; // skip to next slash
|
||||
}
|
||||
out.push({
|
||||
old: str,
|
||||
type: STYPE,
|
||||
val: nxt.substring(j, i),
|
||||
end: ''
|
||||
});
|
||||
// shorten string & update pointers
|
||||
nxt=nxt.substring(i); len-=i; i=j=0;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
export function exec(str, arr) {
|
||||
var i=0, x, y, segs=split(str), out={};
|
||||
for (; i < arr.length; i++) {
|
||||
x=segs[i]; y=arr[i];
|
||||
if (x === SEP) continue;
|
||||
if (x !== void 0 && y.type | 2 === OTYPE) {
|
||||
out[ y.val ] = x.replace(y.end, '');
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
21
node_modules/matchit/license.md
generated
vendored
Normal file
21
node_modules/matchit/license.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.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.
|
76
node_modules/matchit/package.json
generated
vendored
Normal file
76
node_modules/matchit/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "matchit@^1.0.0",
|
||||
"_id": "matchit@1.0.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CwPPICzozd/ezCzpVwGYG5bMVieaapnA0vvHDQnmQ2u2vZtVLynoPmvFsZjL67hFOvTBhhpqSR0bq3uloDP/Rw==",
|
||||
"_location": "/matchit",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "matchit@^1.0.0",
|
||||
"name": "matchit",
|
||||
"escapedName": "matchit",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/trouter"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/matchit/-/matchit-1.0.8.tgz",
|
||||
"_shasum": "9a129e38f79b2053dd75339215b19e1f6bb88efb",
|
||||
"_spec": "matchit@^1.0.0",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/trouter",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "lukeed.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lukeed/matchit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@arr/every": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Quickly parse & match URLs",
|
||||
"devDependencies": {
|
||||
"bundt": "^0.3.0",
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/lukeed/matchit#readme",
|
||||
"keywords": [
|
||||
"route",
|
||||
"regexp",
|
||||
"routing",
|
||||
"pattern",
|
||||
"match",
|
||||
"parse",
|
||||
"url"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/matchit.js",
|
||||
"module": "lib/matchit.mjs",
|
||||
"name": "matchit",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lukeed/matchit.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench",
|
||||
"build": "bundt",
|
||||
"prebench": "npm run build",
|
||||
"pretest": "npm run build",
|
||||
"test": "tape test/*.js | tap-spec"
|
||||
},
|
||||
"version": "1.0.8"
|
||||
}
|
166
node_modules/matchit/readme.md
generated
vendored
Normal file
166
node_modules/matchit/readme.md
generated
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
# matchit [![Build Status](https://travis-ci.org/lukeed/matchit.svg?branch=master)](https://travis-ci.org/lukeed/matchit)
|
||||
|
||||
> Quickly parse & match URLs
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save matchit
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const { exec, match, parse } = require('matchit');
|
||||
|
||||
parse('/foo/:bar/:baz?');
|
||||
//=> [
|
||||
//=> { old:'/foo/:bar', type:0, val:'foo' },
|
||||
//=> { old:'/foo/:bar', type:1, val:'bar' },
|
||||
//=> { old:'/foo/:bar', type:3, val:'baz' }
|
||||
//=> ]
|
||||
|
||||
const routes = ['/', '/foo', 'bar', '/baz', '/baz/:title','/bat/*'].map(parse);
|
||||
|
||||
match('/', routes);
|
||||
//=> [{ old:'/', type:0, val:'/' }]
|
||||
|
||||
match('/foo', routes);
|
||||
//=> [{ old:'/foo', type:0, val:'foo' }]
|
||||
|
||||
match('/bar', routes);
|
||||
//=> [{ old:'bar', type:0, val:'bar' }]
|
||||
|
||||
match('/baz', routes);
|
||||
//=> [{ old:'/baz', type:0, val:'baz' }]
|
||||
|
||||
let a = match('/baz/hello', routes);
|
||||
//=> [{...}, {...}]
|
||||
let b = exec('/baz/hello', a);
|
||||
//=> { title:'hello' }
|
||||
|
||||
match('/bat/quz/qut', routes);
|
||||
//=> [
|
||||
//=> { old:'/bat/*', type:0, val:'bat' },
|
||||
//=> { old:'/bat/*', type:2, val:'*' }
|
||||
//=> ]
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### matchit.parse(route)
|
||||
|
||||
Returns: `Array`
|
||||
|
||||
The `route` is `split` and parsed into a "definition" array of objects. Each object ("segment") contains a `val`, `type`, and `old` key:
|
||||
|
||||
* `old` — The [`route`](#route)'s original value
|
||||
* `type` — An numerical representation of the segment type.
|
||||
* `0` - static
|
||||
* `1` - parameter
|
||||
* `2` - any/wildcard
|
||||
* `3` - optional param
|
||||
* `val` — The current segment's value. This is either a static value of the name of a parameter
|
||||
|
||||
#### route
|
||||
|
||||
Type: `String`
|
||||
|
||||
A single URL pattern.
|
||||
|
||||
> **Note:** Input will be stripped of all leading & trailing `/` characters, so there's no need to normalize your own URLs before passing it to `parse`!
|
||||
|
||||
|
||||
### matchit.match(url, routes)
|
||||
|
||||
Returns: `Array`
|
||||
|
||||
Returns the [`route`](#route)'s encoded definition. See [`matchit.parse`](#matchitparseroute).
|
||||
|
||||
#### url
|
||||
|
||||
Type: `String`
|
||||
|
||||
The true URL you want to be matched.
|
||||
|
||||
#### routes
|
||||
|
||||
Type: `Array`
|
||||
|
||||
_All_ "parsed" route definitions, via [`matchit.parse`](#matchitparseroute).
|
||||
|
||||
> **Important:** Multiple routes will require an Array of `matchit.parse` outputs.
|
||||
|
||||
|
||||
### matchit.exec(url, match)
|
||||
|
||||
Returns: `Object`
|
||||
|
||||
Returns an object an object of `key:val` pairs, as defined by your [`route`](#route) pattern.
|
||||
|
||||
#### url
|
||||
|
||||
Type: `String`
|
||||
|
||||
The URL (`pathname`) to evaluate.
|
||||
|
||||
> **Important:** This should be `pathname`s only as any `querystring`s will be included the response.
|
||||
|
||||
#### match
|
||||
|
||||
Type: `Array`
|
||||
|
||||
The route definition to use, via [`matchit.match`](#matchitmatchurl-routes).
|
||||
|
||||
|
||||
## Benchmarks
|
||||
|
||||
> Running Node v10.13.0
|
||||
|
||||
```
|
||||
# Parsing
|
||||
matchit x 1,489,482 ops/sec ±2.89% (97 runs sampled)
|
||||
regexparam x 406,824 ops/sec ±1.38% (96 runs sampled)
|
||||
path-to-regexp x 83,439 ops/sec ±0.89% (96 runs sampled)
|
||||
path-to-regexp.parse x 421,266 ops/sec ±0.13% (97 runs sampled)
|
||||
|
||||
# Match (index)
|
||||
matchit x 132,338,546 ops/sec ±0.14% (96 runs sampled)
|
||||
regexparam x 49,889,162 ops/sec ±0.21% (95 runs sampled)
|
||||
path-to-regexp.exec x 7,176,721 ops/sec ±1.23% (94 runs sampled)
|
||||
path-to-regexp.tokens x 102,021 ops/sec ±0.21% (96 runs sampled)
|
||||
|
||||
# Match (param)
|
||||
matchit x 2,700,618 ops/sec ±0.92% (95 runs sampled)
|
||||
regexparam x 6,924,653 ops/sec ±0.33% (94 runs sampled)
|
||||
path-to-regexp.exec x 4,715,483 ops/sec ±0.28% (96 runs sampled)
|
||||
path-to-regexp.tokens x 98,182 ops/sec ±0.45% (93 runs sampled)
|
||||
|
||||
# Match (optional)
|
||||
matchit x 2,816,313 ops/sec ±0.64% (93 runs sampled)
|
||||
regexparam x 8,437,064 ops/sec ±0.41% (93 runs sampled)
|
||||
path-to-regexp.exec x 5,909,510 ops/sec ±0.22% (97 runs sampled)
|
||||
path-to-regexp.tokens x 101,832 ops/sec ±0.43% (98 runs sampled)
|
||||
|
||||
# Match (wildcard)
|
||||
matchit x 3,409,100 ops/sec ±0.34% (98 runs sampled)
|
||||
regexparam x 9,740,429 ops/sec ±0.49% (95 runs sampled)
|
||||
path-to-regexp.exec x 8,740,590 ops/sec ±0.43% (89 runs sampled)
|
||||
path-to-regexp.tokens x 102,109 ops/sec ±0.35% (96 runs sampled)
|
||||
|
||||
# Exec
|
||||
matchit x 1,558,321 ops/sec ±0.33% (96 runs sampled)
|
||||
regexparam x 6,966,297 ops/sec ±0.21% (97 runs sampled)
|
||||
path-to-regexp x 102,250 ops/sec ±0.45% (95 runs sampled)
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [regexparam](https://github.com/lukeed/regexparam) - A similar (285B) utility, but relies on `RegExp` instead of String comparisons.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
446
node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
446
node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,446 @@
|
||||
1.44.0 / 2020-04-22
|
||||
===================
|
||||
|
||||
* Add charsets from IANA
|
||||
* Add extension `.cjs` to `application/node`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.43.0 / 2020-01-05
|
||||
===================
|
||||
|
||||
* Add `application/x-keepass2` with extension `.kdbx`
|
||||
* Add extension `.mxmf` to `audio/mobile-xmf`
|
||||
* Add extensions from IANA for `application/*+xml` types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.42.0 / 2019-09-25
|
||||
===================
|
||||
|
||||
* Add `image/vnd.ms-dds` with extension `.dds`
|
||||
* Add new upstream MIME types
|
||||
* Remove compressible from `multipart/mixed`
|
||||
|
||||
1.41.0 / 2019-08-30
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add `application/toml` with extension `.toml`
|
||||
* Mark `font/ttf` as compressible
|
||||
|
||||
1.40.0 / 2019-04-20
|
||||
===================
|
||||
|
||||
* Add extensions from IANA for `model/*` types
|
||||
* Add `text/mdx` with extension `.mdx`
|
||||
|
||||
1.39.0 / 2019-04-04
|
||||
===================
|
||||
|
||||
* Add extensions `.siv` and `.sieve` to `application/sieve`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.38.0 / 2019-02-04
|
||||
===================
|
||||
|
||||
* Add extension `.nq` to `application/n-quads`
|
||||
* Add extension `.nt` to `application/n-triples`
|
||||
* Add new upstream MIME types
|
||||
* Mark `text/less` as compressible
|
||||
|
||||
1.37.0 / 2018-10-19
|
||||
===================
|
||||
|
||||
* Add extensions to HEIC image types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.36.0 / 2018-08-20
|
||||
===================
|
||||
|
||||
* Add Apple file extensions from IANA
|
||||
* Add extensions from IANA for `image/*` types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.35.0 / 2018-07-15
|
||||
===================
|
||||
|
||||
* Add extension `.owl` to `application/rdf+xml`
|
||||
* Add new upstream MIME types
|
||||
- Removes extension `.woff` from `application/font-woff`
|
||||
|
||||
1.34.0 / 2018-06-03
|
||||
===================
|
||||
|
||||
* Add extension `.csl` to `application/vnd.citationstyles.style+xml`
|
||||
* Add extension `.es` to `application/ecmascript`
|
||||
* Add new upstream MIME types
|
||||
* Add `UTF-8` as default charset for `text/turtle`
|
||||
* Mark all XML-derived types as compressible
|
||||
|
||||
1.33.0 / 2018-02-15
|
||||
===================
|
||||
|
||||
* Add extensions from IANA for `message/*` types
|
||||
* Add new upstream MIME types
|
||||
* Fix some incorrect OOXML types
|
||||
* Remove `application/font-woff2`
|
||||
|
||||
1.32.0 / 2017-11-29
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Update `text/hjson` to registered `application/hjson`
|
||||
* Add `text/shex` with extension `.shex`
|
||||
|
||||
1.31.0 / 2017-10-25
|
||||
===================
|
||||
|
||||
* Add `application/raml+yaml` with extension `.raml`
|
||||
* Add `application/wasm` with extension `.wasm`
|
||||
* Add new `font` type from IANA
|
||||
* Add new upstream font extensions
|
||||
* Add new upstream MIME types
|
||||
* Add extensions for JPEG-2000 images
|
||||
|
||||
1.30.0 / 2017-08-27
|
||||
===================
|
||||
|
||||
* Add `application/vnd.ms-outlook`
|
||||
* Add `application/x-arj`
|
||||
* Add extension `.mjs` to `application/javascript`
|
||||
* Add glTF types and extensions
|
||||
* Add new upstream MIME types
|
||||
* Add `text/x-org`
|
||||
* Add VirtualBox MIME types
|
||||
* Fix `source` records for `video/*` types that are IANA
|
||||
* Update `font/opentype` to registered `font/otf`
|
||||
|
||||
1.29.0 / 2017-07-10
|
||||
===================
|
||||
|
||||
* Add `application/fido.trusted-apps+json`
|
||||
* Add extension `.wadl` to `application/vnd.sun.wadl+xml`
|
||||
* Add new upstream MIME types
|
||||
* Add `UTF-8` as default charset for `text/css`
|
||||
|
||||
1.28.0 / 2017-05-14
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add extension `.gz` to `application/gzip`
|
||||
* Update extensions `.md` and `.markdown` to be `text/markdown`
|
||||
|
||||
1.27.0 / 2017-03-16
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add `image/apng` with extension `.apng`
|
||||
|
||||
1.26.0 / 2017-01-14
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add extension `.geojson` to `application/geo+json`
|
||||
|
||||
1.25.0 / 2016-11-11
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.24.0 / 2016-09-18
|
||||
===================
|
||||
|
||||
* Add `audio/mp3`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.23.0 / 2016-05-01
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add extension `.3gpp` to `audio/3gpp`
|
||||
|
||||
1.22.0 / 2016-02-15
|
||||
===================
|
||||
|
||||
* Add `text/slim`
|
||||
* Add extension `.rng` to `application/xml`
|
||||
* Add new upstream MIME types
|
||||
* Fix extension of `application/dash+xml` to be `.mpd`
|
||||
* Update primary extension to `.m4a` for `audio/mp4`
|
||||
|
||||
1.21.0 / 2016-01-06
|
||||
===================
|
||||
|
||||
* Add Google document types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.20.0 / 2015-11-10
|
||||
===================
|
||||
|
||||
* Add `text/x-suse-ymp`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.19.0 / 2015-09-17
|
||||
===================
|
||||
|
||||
* Add `application/vnd.apple.pkpass`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.18.0 / 2015-09-03
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.17.0 / 2015-08-13
|
||||
===================
|
||||
|
||||
* Add `application/x-msdos-program`
|
||||
* Add `audio/g711-0`
|
||||
* Add `image/vnd.mozilla.apng`
|
||||
* Add extension `.exe` to `application/x-msdos-program`
|
||||
|
||||
1.16.0 / 2015-07-29
|
||||
===================
|
||||
|
||||
* Add `application/vnd.uri-map`
|
||||
|
||||
1.15.0 / 2015-07-13
|
||||
===================
|
||||
|
||||
* Add `application/x-httpd-php`
|
||||
|
||||
1.14.0 / 2015-06-25
|
||||
===================
|
||||
|
||||
* Add `application/scim+json`
|
||||
* Add `application/vnd.3gpp.ussd+xml`
|
||||
* Add `application/vnd.biopax.rdf+xml`
|
||||
* Add `text/x-processing`
|
||||
|
||||
1.13.0 / 2015-06-07
|
||||
===================
|
||||
|
||||
* Add nginx as a source
|
||||
* Add `application/x-cocoa`
|
||||
* Add `application/x-java-archive-diff`
|
||||
* Add `application/x-makeself`
|
||||
* Add `application/x-perl`
|
||||
* Add `application/x-pilot`
|
||||
* Add `application/x-redhat-package-manager`
|
||||
* Add `application/x-sea`
|
||||
* Add `audio/x-m4a`
|
||||
* Add `audio/x-realaudio`
|
||||
* Add `image/x-jng`
|
||||
* Add `text/mathml`
|
||||
|
||||
1.12.0 / 2015-06-05
|
||||
===================
|
||||
|
||||
* Add `application/bdoc`
|
||||
* Add `application/vnd.hyperdrive+json`
|
||||
* Add `application/x-bdoc`
|
||||
* Add extension `.rtf` to `text/rtf`
|
||||
|
||||
1.11.0 / 2015-05-31
|
||||
===================
|
||||
|
||||
* Add `audio/wav`
|
||||
* Add `audio/wave`
|
||||
* Add extension `.litcoffee` to `text/coffeescript`
|
||||
* Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data`
|
||||
* Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install`
|
||||
|
||||
1.10.0 / 2015-05-19
|
||||
===================
|
||||
|
||||
* Add `application/vnd.balsamiq.bmpr`
|
||||
* Add `application/vnd.microsoft.portable-executable`
|
||||
* Add `application/x-ns-proxy-autoconfig`
|
||||
|
||||
1.9.1 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Remove `.json` extension from `application/manifest+json`
|
||||
- This is causing bugs downstream
|
||||
|
||||
1.9.0 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Add `application/manifest+json`
|
||||
* Add `application/vnd.micro+json`
|
||||
* Add `image/vnd.zbrush.pcx`
|
||||
* Add `image/x-ms-bmp`
|
||||
|
||||
1.8.0 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Add `application/vnd.citationstyles.style+xml`
|
||||
* Add `application/vnd.fastcopy-disk-image`
|
||||
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
|
||||
* Add extension `.jsonld` to `application/ld+json`
|
||||
|
||||
1.7.0 / 2015-02-08
|
||||
==================
|
||||
|
||||
* Add `application/vnd.gerber`
|
||||
* Add `application/vnd.msa-disk-image`
|
||||
|
||||
1.6.1 / 2015-02-05
|
||||
==================
|
||||
|
||||
* Community extensions ownership transferred from `node-mime`
|
||||
|
||||
1.6.0 / 2015-01-29
|
||||
==================
|
||||
|
||||
* Add `application/jose`
|
||||
* Add `application/jose+json`
|
||||
* Add `application/json-seq`
|
||||
* Add `application/jwk+json`
|
||||
* Add `application/jwk-set+json`
|
||||
* Add `application/jwt`
|
||||
* Add `application/rdap+json`
|
||||
* Add `application/vnd.gov.sk.e-form+xml`
|
||||
* Add `application/vnd.ims.imsccv1p3`
|
||||
|
||||
1.5.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* Add `application/vnd.oracle.resource+json`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/mbox+xml`
|
||||
- `application/oscp-response`
|
||||
- `application/vwg-multiplexed`
|
||||
- `audio/g721`
|
||||
|
||||
1.4.0 / 2014-12-21
|
||||
==================
|
||||
|
||||
* Add `application/vnd.ims.imsccv1p2`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/vnd-acucobol`
|
||||
- `application/vnd-curl`
|
||||
- `application/vnd-dart`
|
||||
- `application/vnd-dxr`
|
||||
- `application/vnd-fdf`
|
||||
- `application/vnd-mif`
|
||||
- `application/vnd-sema`
|
||||
- `application/vnd-wap-wmlc`
|
||||
- `application/vnd.adobe.flash-movie`
|
||||
- `application/vnd.dece-zip`
|
||||
- `application/vnd.dvb_service`
|
||||
- `application/vnd.micrografx-igx`
|
||||
- `application/vnd.sealed-doc`
|
||||
- `application/vnd.sealed-eml`
|
||||
- `application/vnd.sealed-mht`
|
||||
- `application/vnd.sealed-ppt`
|
||||
- `application/vnd.sealed-tiff`
|
||||
- `application/vnd.sealed-xls`
|
||||
- `application/vnd.sealedmedia.softseal-html`
|
||||
- `application/vnd.sealedmedia.softseal-pdf`
|
||||
- `application/vnd.wap-slc`
|
||||
- `application/vnd.wap-wbxml`
|
||||
- `audio/vnd.sealedmedia.softseal-mpeg`
|
||||
- `image/vnd-djvu`
|
||||
- `image/vnd-svf`
|
||||
- `image/vnd-wap-wbmp`
|
||||
- `image/vnd.sealed-png`
|
||||
- `image/vnd.sealedmedia.softseal-gif`
|
||||
- `image/vnd.sealedmedia.softseal-jpg`
|
||||
- `model/vnd-dwf`
|
||||
- `model/vnd.parasolid.transmit-binary`
|
||||
- `model/vnd.parasolid.transmit-text`
|
||||
- `text/vnd-a`
|
||||
- `text/vnd-curl`
|
||||
- `text/vnd.wap-wml`
|
||||
* Remove example template MIME types
|
||||
- `application/example`
|
||||
- `audio/example`
|
||||
- `image/example`
|
||||
- `message/example`
|
||||
- `model/example`
|
||||
- `multipart/example`
|
||||
- `text/example`
|
||||
- `video/example`
|
||||
|
||||
1.3.1 / 2014-12-16
|
||||
==================
|
||||
|
||||
* Fix missing extensions
|
||||
- `application/json5`
|
||||
- `text/hjson`
|
||||
|
||||
1.3.0 / 2014-12-07
|
||||
==================
|
||||
|
||||
* Add `application/a2l`
|
||||
* Add `application/aml`
|
||||
* Add `application/atfx`
|
||||
* Add `application/atxml`
|
||||
* Add `application/cdfx+xml`
|
||||
* Add `application/dii`
|
||||
* Add `application/json5`
|
||||
* Add `application/lxf`
|
||||
* Add `application/mf4`
|
||||
* Add `application/vnd.apache.thrift.compact`
|
||||
* Add `application/vnd.apache.thrift.json`
|
||||
* Add `application/vnd.coffeescript`
|
||||
* Add `application/vnd.enphase.envoy`
|
||||
* Add `application/vnd.ims.imsccv1p1`
|
||||
* Add `text/csv-schema`
|
||||
* Add `text/hjson`
|
||||
* Add `text/markdown`
|
||||
* Add `text/yaml`
|
||||
|
||||
1.2.0 / 2014-11-09
|
||||
==================
|
||||
|
||||
* Add `application/cea`
|
||||
* Add `application/dit`
|
||||
* Add `application/vnd.gov.sk.e-form+zip`
|
||||
* Add `application/vnd.tmd.mediaflex.api+xml`
|
||||
* Type `application/epub+zip` is now IANA-registered
|
||||
|
||||
1.1.2 / 2014-10-23
|
||||
==================
|
||||
|
||||
* Rebuild database for `application/x-www-form-urlencoded` change
|
||||
|
||||
1.1.1 / 2014-10-20
|
||||
==================
|
||||
|
||||
* Mark `application/x-www-form-urlencoded` as compressible.
|
||||
|
||||
1.1.0 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Add `application/font-woff2`
|
||||
|
||||
1.0.3 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Fix engine requirement in package
|
||||
|
||||
1.0.2 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Add `application/coap-group+json`
|
||||
* Add `application/dcd`
|
||||
* Add `application/vnd.apache.thrift.binary`
|
||||
* Add `image/vnd.tencent.tap`
|
||||
* Mark all JSON-derived types as compressible
|
||||
* Update `text/vtt` data
|
||||
|
||||
1.0.1 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Fix extension ordering
|
||||
|
||||
1.0.0 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Add `application/atf`
|
||||
* Add `application/merge-patch+json`
|
||||
* Add `multipart/x-mixed-replace`
|
||||
* Add `source: 'apache'` metadata
|
||||
* Add `source: 'iana'` metadata
|
||||
* Remove badly-assumed charset data
|
22
node_modules/mime-db/LICENSE
generated
vendored
Normal file
22
node_modules/mime-db/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.
|
102
node_modules/mime-db/README.md
generated
vendored
Normal file
102
node_modules/mime-db/README.md
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
# mime-db
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
This is a database of all mime types.
|
||||
It consists of a single, public JSON file and does not include any logic,
|
||||
allowing it to remain as un-opinionated as possible with an API.
|
||||
It aggregates data from the following sources:
|
||||
|
||||
- http://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
||||
- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install mime-db
|
||||
```
|
||||
|
||||
### Database Download
|
||||
|
||||
If you're crazy enough to use this in the browser, you can just grab the
|
||||
JSON file using [jsDelivr](https://www.jsdelivr.com/). It is recommended to
|
||||
replace `master` with [a release tag](https://github.com/jshttp/mime-db/tags)
|
||||
as the JSON format may change in the future.
|
||||
|
||||
```
|
||||
https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var db = require('mime-db')
|
||||
|
||||
// grab data on .js files
|
||||
var data = db['application/javascript']
|
||||
```
|
||||
|
||||
## Data Structure
|
||||
|
||||
The JSON file is a map lookup for lowercased mime types.
|
||||
Each mime type has the following properties:
|
||||
|
||||
- `.source` - where the mime type is defined.
|
||||
If not set, it's probably a custom media type.
|
||||
- `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
|
||||
- `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml)
|
||||
- `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types)
|
||||
- `.extensions[]` - known extensions associated with this mime type.
|
||||
- `.compressible` - whether a file of this type can be gzipped.
|
||||
- `.charset` - the default charset associated with this type, if any.
|
||||
|
||||
If unknown, every property could be `undefined`.
|
||||
|
||||
## Contributing
|
||||
|
||||
To edit the database, only make PRs against `src/custom.json` or
|
||||
`src/custom-suffix.json`.
|
||||
|
||||
The `src/custom.json` file is a JSON object with the MIME type as the keys
|
||||
and the values being an object with the following keys:
|
||||
|
||||
- `compressible` - leave out if you don't know, otherwise `true`/`false` to
|
||||
indicate whether the data represented by the type is typically compressible.
|
||||
- `extensions` - include an array of file extensions that are associated with
|
||||
the type.
|
||||
- `notes` - human-readable notes about the type, typically what the type is.
|
||||
- `sources` - include an array of URLs of where the MIME type and the associated
|
||||
extensions are sourced from. This needs to be a [primary source](https://en.wikipedia.org/wiki/Primary_source);
|
||||
links to type aggregating sites and Wikipedia are _not acceptable_.
|
||||
|
||||
To update the build, run `npm run build`.
|
||||
|
||||
### Adding Custom Media Types
|
||||
|
||||
The best way to get new media types included in this library is to register
|
||||
them with the IANA. The community registration procedure is outlined in
|
||||
[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types
|
||||
registered with the IANA are automatically pulled into this library.
|
||||
|
||||
If that is not possible / feasible, they can be added directly here as a
|
||||
"custom" type. To do this, it is required to have a primary source that
|
||||
definitively lists the media type. If an extension is going to be listed as
|
||||
associateed with this media type, the source must definitively link the
|
||||
media type and extension as well.
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
|
||||
[node-image]: https://badgen.net/npm/node/mime-db
|
||||
[node-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/mime-db
|
||||
[npm-url]: https://npmjs.org/package/mime-db
|
||||
[npm-version-image]: https://badgen.net/npm/v/mime-db
|
||||
[travis-image]: https://badgen.net/travis/jshttp/mime-db/master
|
||||
[travis-url]: https://travis-ci.org/jshttp/mime-db
|
8176
node_modules/mime-db/db.json
generated
vendored
Normal file
8176
node_modules/mime-db/db.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/mime-db/index.js
generated
vendored
Normal file
11
node_modules/mime-db/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* mime-db
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = require('./db.json')
|
103
node_modules/mime-db/package.json
generated
vendored
Normal file
103
node_modules/mime-db/package.json
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
{
|
||||
"_from": "mime-db@1.44.0",
|
||||
"_id": "mime-db@1.44.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
|
||||
"_location": "/mime-db",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "mime-db@1.44.0",
|
||||
"name": "mime-db",
|
||||
"escapedName": "mime-db",
|
||||
"rawSpec": "1.44.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.44.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/compressible",
|
||||
"/mime-types"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
|
||||
"_shasum": "fa11c5eb0aca1334b4233cb4d52f10c5a6272f92",
|
||||
"_spec": "mime-db@1.44.0",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/mime-types",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/mime-db/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
{
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com",
|
||||
"url": "http://github.com/broofa"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Media Type Database",
|
||||
"devDependencies": {
|
||||
"bluebird": "3.7.2",
|
||||
"co": "4.6.0",
|
||||
"cogent": "1.0.1",
|
||||
"csv-parse": "4.8.9",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.20.2",
|
||||
"eslint-plugin-markdown": "1.0.2",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.2.1",
|
||||
"eslint-plugin-standard": "4.0.1",
|
||||
"gnode": "0.1.2",
|
||||
"mocha": "7.1.1",
|
||||
"nyc": "15.0.1",
|
||||
"raw-body": "2.4.1",
|
||||
"stream-to-array": "2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"db.json",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/mime-db#readme",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"db",
|
||||
"type",
|
||||
"types",
|
||||
"database",
|
||||
"charset",
|
||||
"charsets"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "mime-db",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/mime-db.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build",
|
||||
"fetch": "node scripts/fetch-apache && gnode scripts/fetch-iana && node scripts/fetch-nginx",
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"test-travis": "nyc --reporter=text npm test",
|
||||
"update": "npm run fetch && npm run build",
|
||||
"version": "node scripts/version-history.js && git add HISTORY.md"
|
||||
},
|
||||
"version": "1.44.0"
|
||||
}
|
333
node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
333
node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,333 @@
|
||||
2.1.27 / 2020-04-23
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.44.0
|
||||
- Add charsets from IANA
|
||||
- Add extension `.cjs` to `application/node`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.26 / 2020-01-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.43.0
|
||||
- Add `application/x-keepass2` with extension `.kdbx`
|
||||
- Add extension `.mxmf` to `audio/mobile-xmf`
|
||||
- Add extensions from IANA for `application/*+xml` types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.25 / 2019-11-12
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.42.0
|
||||
- Add new upstream MIME types
|
||||
- Add `application/toml` with extension `.toml`
|
||||
- Add `image/vnd.ms-dds` with extension `.dds`
|
||||
|
||||
2.1.24 / 2019-04-20
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.40.0
|
||||
- Add extensions from IANA for `model/*` types
|
||||
- Add `text/mdx` with extension `.mdx`
|
||||
|
||||
2.1.23 / 2019-04-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.39.0
|
||||
- Add extensions `.siv` and `.sieve` to `application/sieve`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.22 / 2019-02-14
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.38.0
|
||||
- Add extension `.nq` to `application/n-quads`
|
||||
- Add extension `.nt` to `application/n-triples`
|
||||
- Add new upstream MIME types
|
||||
- Mark `text/less` as compressible
|
||||
|
||||
2.1.21 / 2018-10-19
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.37.0
|
||||
- Add extensions to HEIC image types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.20 / 2018-08-26
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.36.0
|
||||
- Add Apple file extensions from IANA
|
||||
- Add extensions from IANA for `image/*` types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.19 / 2018-07-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.35.0
|
||||
- Add extension `.csl` to `application/vnd.citationstyles.style+xml`
|
||||
- Add extension `.es` to `application/ecmascript`
|
||||
- Add extension `.owl` to `application/rdf+xml`
|
||||
- Add new upstream MIME types
|
||||
- Add UTF-8 as default charset for `text/turtle`
|
||||
|
||||
2.1.18 / 2018-02-16
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.33.0
|
||||
- Add `application/raml+yaml` with extension `.raml`
|
||||
- Add `application/wasm` with extension `.wasm`
|
||||
- Add `text/shex` with extension `.shex`
|
||||
- Add extensions for JPEG-2000 images
|
||||
- Add extensions from IANA for `message/*` types
|
||||
- Add new upstream MIME types
|
||||
- Update font MIME types
|
||||
- Update `text/hjson` to registered `application/hjson`
|
||||
|
||||
2.1.17 / 2017-09-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.30.0
|
||||
- Add `application/vnd.ms-outlook`
|
||||
- Add `application/x-arj`
|
||||
- Add extension `.mjs` to `application/javascript`
|
||||
- Add glTF types and extensions
|
||||
- Add new upstream MIME types
|
||||
- Add `text/x-org`
|
||||
- Add VirtualBox MIME types
|
||||
- Fix `source` records for `video/*` types that are IANA
|
||||
- Update `font/opentype` to registered `font/otf`
|
||||
|
||||
2.1.16 / 2017-07-24
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.29.0
|
||||
- Add `application/fido.trusted-apps+json`
|
||||
- Add extension `.wadl` to `application/vnd.sun.wadl+xml`
|
||||
- Add extension `.gz` to `application/gzip`
|
||||
- Add new upstream MIME types
|
||||
- Update extensions `.md` and `.markdown` to be `text/markdown`
|
||||
|
||||
2.1.15 / 2017-03-23
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.27.0
|
||||
- Add new mime types
|
||||
- Add `image/apng`
|
||||
|
||||
2.1.14 / 2017-01-14
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.26.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.13 / 2016-11-18
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.25.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.12 / 2016-09-18
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.24.0
|
||||
- Add new mime types
|
||||
- Add `audio/mp3`
|
||||
|
||||
2.1.11 / 2016-05-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.23.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.10 / 2016-02-15
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.22.0
|
||||
- Add new mime types
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
|
||||
2.1.9 / 2016-01-06
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.21.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.8 / 2015-11-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.20.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.7 / 2015-09-20
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.19.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.6 / 2015-09-03
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.18.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.5 / 2015-08-20
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.17.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.4 / 2015-07-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.16.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.3 / 2015-07-13
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.15.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.2 / 2015-06-25
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.14.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.1 / 2015-06-08
|
||||
==================
|
||||
|
||||
* perf: fix deopt during mapping
|
||||
|
||||
2.1.0 / 2015-06-07
|
||||
==================
|
||||
|
||||
* Fix incorrectly treating extension-less file name as extension
|
||||
- i.e. `'path/to/json'` will no longer return `application/json`
|
||||
* Fix `.charset(type)` to accept parameters
|
||||
* Fix `.charset(type)` to match case-insensitive
|
||||
* Improve generation of extension to MIME mapping
|
||||
* Refactor internals for readability and no argument reassignment
|
||||
* Prefer `application/*` MIME types from the same source
|
||||
* Prefer any type over `application/octet-stream`
|
||||
* deps: mime-db@~1.13.0
|
||||
- Add nginx as a source
|
||||
- Add new mime types
|
||||
|
||||
2.0.14 / 2015-06-06
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.12.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.13 / 2015-05-31
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.11.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.12 / 2015-05-19
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.10.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.11 / 2015-05-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.9.1
|
||||
- Add new mime types
|
||||
|
||||
2.0.10 / 2015-03-13
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.8.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.9 / 2015-02-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.7.0
|
||||
- Add new mime types
|
||||
- Community extensions ownership transferred from `node-mime`
|
||||
|
||||
2.0.8 / 2015-01-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.6.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.7 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.5.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
|
||||
2.0.6 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.4.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
- Remove example template MIME types
|
||||
|
||||
2.0.5 / 2014-12-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.1
|
||||
- Fix missing extensions
|
||||
|
||||
2.0.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.2.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.2 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.1.0
|
||||
- Add new mime types
|
||||
- Add additional compressible
|
||||
- Update charsets
|
||||
|
||||
2.0.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
|
||||
2.0.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* Use `mime-db`
|
||||
* Remove `.define()`
|
||||
|
||||
1.0.2 / 2014-08-04
|
||||
==================
|
||||
|
||||
* Set charset=utf-8 for `text/javascript`
|
||||
|
||||
1.0.1 / 2014-06-24
|
||||
==================
|
||||
|
||||
* Add `text/jsx` type
|
||||
|
||||
1.0.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Return `false` for unknown types
|
||||
* Set charset=utf-8 for `application/json`
|
||||
|
||||
0.1.0 / 2014-05-02
|
||||
==================
|
||||
|
||||
* Initial release
|
23
node_modules/mime-types/LICENSE
generated
vendored
Normal file
23
node_modules/mime-types/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
123
node_modules/mime-types/README.md
generated
vendored
Normal file
123
node_modules/mime-types/README.md
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
# mime-types
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
The ultimate javascript content-type utility.
|
||||
|
||||
Similar to [the `mime@1.x` module](https://www.npmjs.com/package/mime), except:
|
||||
|
||||
- __No fallbacks.__ Instead of naively returning the first available type,
|
||||
`mime-types` simply returns `false`, so do
|
||||
`var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
|
||||
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
|
||||
- No `.define()` functionality
|
||||
- Bug fixes for `.lookup(path)`
|
||||
|
||||
Otherwise, the API is compatible with `mime` 1.x.
|
||||
|
||||
## 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 mime-types
|
||||
```
|
||||
|
||||
## Adding Types
|
||||
|
||||
All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db),
|
||||
so open a PR there if you'd like to add mime types.
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var mime = require('mime-types')
|
||||
```
|
||||
|
||||
All functions return `false` if input is invalid or not found.
|
||||
|
||||
### mime.lookup(path)
|
||||
|
||||
Lookup the content-type associated with a file.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
mime.lookup('json') // 'application/json'
|
||||
mime.lookup('.md') // 'text/markdown'
|
||||
mime.lookup('file.html') // 'text/html'
|
||||
mime.lookup('folder/file.js') // 'application/javascript'
|
||||
mime.lookup('folder/.htaccess') // false
|
||||
|
||||
mime.lookup('cats') // false
|
||||
```
|
||||
|
||||
### mime.contentType(type)
|
||||
|
||||
Create a full content-type header given a content-type or extension.
|
||||
When given an extension, `mime.lookup` is used to get the matching
|
||||
content-type, otherwise the given content-type is used. Then if the
|
||||
content-type does not already have a `charset` parameter, `mime.charset`
|
||||
is used to get the default charset and add to the returned content-type.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
|
||||
mime.contentType('file.json') // 'application/json; charset=utf-8'
|
||||
mime.contentType('text/html') // 'text/html; charset=utf-8'
|
||||
mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1'
|
||||
|
||||
// from a full path
|
||||
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
|
||||
```
|
||||
|
||||
### mime.extension(type)
|
||||
|
||||
Get the default extension for a content-type.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
mime.extension('application/octet-stream') // 'bin'
|
||||
```
|
||||
|
||||
### mime.charset(type)
|
||||
|
||||
Lookup the implied default charset of a content-type.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
mime.charset('text/markdown') // 'UTF-8'
|
||||
```
|
||||
|
||||
### var type = mime.types[extension]
|
||||
|
||||
A map of content-types by extension.
|
||||
|
||||
### [extensions...] = mime.extensions[type]
|
||||
|
||||
A map of extensions by content-type.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/mime-types
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/mime-types
|
||||
[npm-url]: https://npmjs.org/package/mime-types
|
||||
[npm-version-image]: https://badgen.net/npm/v/mime-types
|
||||
[travis-image]: https://badgen.net/travis/jshttp/mime-types/master
|
||||
[travis-url]: https://travis-ci.org/jshttp/mime-types
|
188
node_modules/mime-types/index.js
generated
vendored
Normal file
188
node_modules/mime-types/index.js
generated
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
/*!
|
||||
* mime-types
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var db = require('mime-db')
|
||||
var extname = require('path').extname
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
|
||||
var TEXT_TYPE_REGEXP = /^text\//i
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.charset = charset
|
||||
exports.charsets = { lookup: charset }
|
||||
exports.contentType = contentType
|
||||
exports.extension = extension
|
||||
exports.extensions = Object.create(null)
|
||||
exports.lookup = lookup
|
||||
exports.types = Object.create(null)
|
||||
|
||||
// Populate the extensions/types maps
|
||||
populateMaps(exports.extensions, exports.types)
|
||||
|
||||
/**
|
||||
* Get the default charset for a MIME type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function charset (type) {
|
||||
if (!type || typeof type !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use media-typer
|
||||
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
||||
var mime = match && db[match[1].toLowerCase()]
|
||||
|
||||
if (mime && mime.charset) {
|
||||
return mime.charset
|
||||
}
|
||||
|
||||
// default text/* to utf-8
|
||||
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
||||
return 'UTF-8'
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a full Content-Type header given a MIME type or extension.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function contentType (str) {
|
||||
// TODO: should this even be in this module?
|
||||
if (!str || typeof str !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
var mime = str.indexOf('/') === -1
|
||||
? exports.lookup(str)
|
||||
: str
|
||||
|
||||
if (!mime) {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use content-type or other module
|
||||
if (mime.indexOf('charset') === -1) {
|
||||
var charset = exports.charset(mime)
|
||||
if (charset) mime += '; charset=' + charset.toLowerCase()
|
||||
}
|
||||
|
||||
return mime
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default extension for a MIME type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function extension (type) {
|
||||
if (!type || typeof type !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use media-typer
|
||||
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
||||
|
||||
// get extensions
|
||||
var exts = match && exports.extensions[match[1].toLowerCase()]
|
||||
|
||||
if (!exts || !exts.length) {
|
||||
return false
|
||||
}
|
||||
|
||||
return exts[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup the MIME type for a file path/extension.
|
||||
*
|
||||
* @param {string} path
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function lookup (path) {
|
||||
if (!path || typeof path !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// get the extension ("ext" or ".ext" or full path)
|
||||
var extension = extname('x.' + path)
|
||||
.toLowerCase()
|
||||
.substr(1)
|
||||
|
||||
if (!extension) {
|
||||
return false
|
||||
}
|
||||
|
||||
return exports.types[extension] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the extensions and types maps.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function populateMaps (extensions, types) {
|
||||
// source preference (least -> most)
|
||||
var preference = ['nginx', 'apache', undefined, 'iana']
|
||||
|
||||
Object.keys(db).forEach(function forEachMimeType (type) {
|
||||
var mime = db[type]
|
||||
var exts = mime.extensions
|
||||
|
||||
if (!exts || !exts.length) {
|
||||
return
|
||||
}
|
||||
|
||||
// mime -> extensions
|
||||
extensions[type] = exts
|
||||
|
||||
// extension -> mime
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
var extension = exts[i]
|
||||
|
||||
if (types[extension]) {
|
||||
var from = preference.indexOf(db[types[extension]].source)
|
||||
var to = preference.indexOf(mime.source)
|
||||
|
||||
if (types[extension] !== 'application/octet-stream' &&
|
||||
(from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
|
||||
// skip the remapping
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// set the extension -> mime
|
||||
types[extension] = type
|
||||
}
|
||||
})
|
||||
}
|
87
node_modules/mime-types/package.json
generated
vendored
Normal file
87
node_modules/mime-types/package.json
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"_from": "mime-types@~2.1.24",
|
||||
"_id": "mime-types@2.1.27",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
|
||||
"_location": "/mime-types",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "mime-types@~2.1.24",
|
||||
"name": "mime-types",
|
||||
"escapedName": "mime-types",
|
||||
"rawSpec": "~2.1.24",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~2.1.24"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/accepts"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
|
||||
"_shasum": "47949f98e279ea53119f5722e0f34e529bec009f",
|
||||
"_spec": "mime-types@~2.1.24",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/accepts",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/mime-types/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jeremiah Senkpiel",
|
||||
"email": "fishrock123@rocketmail.com",
|
||||
"url": "https://searchbeam.jit.su"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mime-db": "1.44.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "The ultimate javascript content-type utility.",
|
||||
"devDependencies": {
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.20.2",
|
||||
"eslint-plugin-markdown": "1.0.2",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.2.1",
|
||||
"eslint-plugin-standard": "4.0.1",
|
||||
"mocha": "7.1.1",
|
||||
"nyc": "15.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/mime-types#readme",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"types"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "mime-types",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/mime-types.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec test/test.js",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"test-travis": "nyc --reporter=text npm test"
|
||||
},
|
||||
"version": "2.1.27"
|
||||
}
|
270
node_modules/mime/CHANGELOG.md
generated
vendored
Normal file
270
node_modules/mime/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,270 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [2.4.5](https://github.com/broofa/node-mime/compare/v2.4.4...v2.4.5) (2020-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix [#236](https://github.com/broofa/node-mime/issues/236) ([7f4ecd0](https://github.com/broofa/node-mime/commit/7f4ecd0d850ed22c9e3bfda2c11fc74e4dde12a7))
|
||||
* update to latest mime-db ([c5cb3f2](https://github.com/broofa/node-mime/commit/c5cb3f2ab8b07642a066efbde1142af1b90c927b))
|
||||
|
||||
### [2.4.4](https://github.com/broofa/node-mime/compare/v2.4.3...v2.4.4) (2019-06-07)
|
||||
|
||||
|
||||
|
||||
## [2.4.3](https://github.com/broofa/node-mime/compare/v2.4.2...v2.4.3) (2019-05-15)
|
||||
|
||||
|
||||
|
||||
## [2.4.2](https://github.com/broofa/node-mime/compare/v2.4.1...v2.4.2) (2019-04-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't use arrow function introduced in 2.4.1 ([2e00b5c](https://github.com/broofa/node-mime/commit/2e00b5c))
|
||||
|
||||
|
||||
|
||||
## [2.4.1](https://github.com/broofa/node-mime/compare/v2.4.0...v2.4.1) (2019-04-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update MDN and mime-db types ([3e567a9](https://github.com/broofa/node-mime/commit/3e567a9))
|
||||
|
||||
|
||||
|
||||
<a name="2.4.0"></a>
|
||||
# [2.4.0](https://github.com/broofa/node-mime/compare/v2.3.1...v2.4.0) (2018-11-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Bind exported methods ([9d2a7b8](https://github.com/broofa/node-mime/commit/9d2a7b8))
|
||||
* update to mime-db@1.37.0 ([49e6e41](https://github.com/broofa/node-mime/commit/49e6e41))
|
||||
|
||||
|
||||
|
||||
<a name="2.3.1"></a>
|
||||
## [2.3.1](https://github.com/broofa/node-mime/compare/v2.3.0...v2.3.1) (2018-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix [#198](https://github.com/broofa/node-mime/issues/198) ([25ca180](https://github.com/broofa/node-mime/commit/25ca180))
|
||||
|
||||
|
||||
|
||||
<a name="2.3.0"></a>
|
||||
# [2.3.0](https://github.com/broofa/node-mime/compare/v2.2.2...v2.3.0) (2018-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix [#192](https://github.com/broofa/node-mime/issues/192) ([5c35df6](https://github.com/broofa/node-mime/commit/5c35df6))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add travis-ci testing ([d64160f](https://github.com/broofa/node-mime/commit/d64160f))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.2"></a>
|
||||
## [2.2.2](https://github.com/broofa/node-mime/compare/v2.2.1...v2.2.2) (2018-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update types files to mime-db@1.32.0 ([85aac16](https://github.com/broofa/node-mime/commit/85aac16))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.1"></a>
|
||||
## [2.2.1](https://github.com/broofa/node-mime/compare/v2.2.0...v2.2.1) (2018-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Retain type->extension mappings for non-default types. Fixes [#180](https://github.com/broofa/node-mime/issues/180) ([b5c83fb](https://github.com/broofa/node-mime/commit/b5c83fb))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.0"></a>
|
||||
# [2.2.0](https://github.com/broofa/node-mime/compare/v2.1.0...v2.2.0) (2018-01-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Retain type->extension mappings for non-default types. Fixes [#180](https://github.com/broofa/node-mime/issues/180) ([10f82ac](https://github.com/broofa/node-mime/commit/10f82ac))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/broofa/node-mime/compare/v2.0.5...v2.1.0) (2017-12-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Upgrade to mime-db@1.32.0. Fixes [#185](https://github.com/broofa/node-mime/issues/185) ([3f775ba](https://github.com/broofa/node-mime/commit/3f775ba))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.5"></a>
|
||||
## [2.0.5](https://github.com/broofa/node-mime/compare/v2.0.1...v2.0.5) (2017-12-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ES5 support (back to node v0.4) ([f14ccb6](https://github.com/broofa/node-mime/commit/f14ccb6))
|
||||
|
||||
|
||||
|
||||
# Changelog
|
||||
|
||||
## v2.0.4 (24/11/2017)
|
||||
- [**closed**] Switch to mime-score module for resolving extension contention issues. [#182](https://github.com/broofa/node-mime/issues/182)
|
||||
- [**closed**] Update mime-db to 1.31.0 in v1.x branch [#181](https://github.com/broofa/node-mime/issues/181)
|
||||
|
||||
---
|
||||
|
||||
## v1.5.0 (22/11/2017)
|
||||
- [**closed**] need ES5 version ready in npm package [#179](https://github.com/broofa/node-mime/issues/179)
|
||||
- [**closed**] mime-db no trace of iWork - pages / numbers / etc. [#178](https://github.com/broofa/node-mime/issues/178)
|
||||
- [**closed**] How it works in brownser ? [#176](https://github.com/broofa/node-mime/issues/176)
|
||||
- [**closed**] Missing `./Mime` [#175](https://github.com/broofa/node-mime/issues/175)
|
||||
- [**closed**] Vulnerable Regular Expression [#167](https://github.com/broofa/node-mime/issues/167)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.3 (25/09/2017)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v1.4.1 (25/09/2017)
|
||||
- [**closed**] Issue when bundling with webpack [#172](https://github.com/broofa/node-mime/issues/172)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.2 (15/09/2017)
|
||||
- [**V2**] fs.readFileSync is not a function [#165](https://github.com/broofa/node-mime/issues/165)
|
||||
- [**closed**] The extension for video/quicktime should map to .mov, not .qt [#164](https://github.com/broofa/node-mime/issues/164)
|
||||
- [**V2**] [v2 Feedback request] Mime class API [#163](https://github.com/broofa/node-mime/issues/163)
|
||||
- [**V2**] [v2 Feedback request] Resolving conflicts over extensions [#162](https://github.com/broofa/node-mime/issues/162)
|
||||
- [**V2**] Allow callers to load module with official, full, or no defined types. [#161](https://github.com/broofa/node-mime/issues/161)
|
||||
- [**V2**] Use "facets" to resolve extension conflicts [#160](https://github.com/broofa/node-mime/issues/160)
|
||||
- [**V2**] Remove fs and path dependencies [#152](https://github.com/broofa/node-mime/issues/152)
|
||||
- [**V2**] Default content-type should not be application/octet-stream [#139](https://github.com/broofa/node-mime/issues/139)
|
||||
- [**V2**] reset mime-types [#124](https://github.com/broofa/node-mime/issues/124)
|
||||
- [**V2**] Extensionless paths should return null or false [#113](https://github.com/broofa/node-mime/issues/113)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.1 (14/09/2017)
|
||||
- [**closed**] Changelog for v2.0 does not mention breaking changes [#171](https://github.com/broofa/node-mime/issues/171)
|
||||
- [**closed**] MIME breaking with 'class' declaration as it is without 'use strict mode' [#170](https://github.com/broofa/node-mime/issues/170)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.0 (12/09/2017)
|
||||
- [**closed**] woff and woff2 [#168](https://github.com/broofa/node-mime/issues/168)
|
||||
|
||||
---
|
||||
|
||||
## v1.4.0 (28/08/2017)
|
||||
- [**closed**] support for ac3 voc files [#159](https://github.com/broofa/node-mime/issues/159)
|
||||
- [**closed**] Help understanding change from application/xml to text/xml [#158](https://github.com/broofa/node-mime/issues/158)
|
||||
- [**closed**] no longer able to override mimetype [#157](https://github.com/broofa/node-mime/issues/157)
|
||||
- [**closed**] application/vnd.adobe.photoshop [#147](https://github.com/broofa/node-mime/issues/147)
|
||||
- [**closed**] Directories should appear as something other than application/octet-stream [#135](https://github.com/broofa/node-mime/issues/135)
|
||||
- [**closed**] requested features [#131](https://github.com/broofa/node-mime/issues/131)
|
||||
- [**closed**] Make types.json loading optional? [#129](https://github.com/broofa/node-mime/issues/129)
|
||||
- [**closed**] Cannot find module './types.json' [#120](https://github.com/broofa/node-mime/issues/120)
|
||||
- [**V2**] .wav files show up as "audio/x-wav" instead of "audio/x-wave" [#118](https://github.com/broofa/node-mime/issues/118)
|
||||
- [**closed**] Don't be a pain in the ass for node community [#108](https://github.com/broofa/node-mime/issues/108)
|
||||
- [**closed**] don't make default_type global [#78](https://github.com/broofa/node-mime/issues/78)
|
||||
- [**closed**] mime.extension() fails if the content-type is parameterized [#74](https://github.com/broofa/node-mime/issues/74)
|
||||
|
||||
---
|
||||
|
||||
## v1.3.6 (11/05/2017)
|
||||
- [**closed**] .md should be text/markdown as of March 2016 [#154](https://github.com/broofa/node-mime/issues/154)
|
||||
- [**closed**] Error while installing mime [#153](https://github.com/broofa/node-mime/issues/153)
|
||||
- [**closed**] application/manifest+json [#149](https://github.com/broofa/node-mime/issues/149)
|
||||
- [**closed**] Dynamic adaptive streaming over HTTP (DASH) file extension typo [#141](https://github.com/broofa/node-mime/issues/141)
|
||||
- [**closed**] charsets image/png undefined [#140](https://github.com/broofa/node-mime/issues/140)
|
||||
- [**closed**] Mime-db dependency out of date [#130](https://github.com/broofa/node-mime/issues/130)
|
||||
- [**closed**] how to support plist? [#126](https://github.com/broofa/node-mime/issues/126)
|
||||
- [**closed**] how does .types file format look like? [#123](https://github.com/broofa/node-mime/issues/123)
|
||||
- [**closed**] Feature: support for expanding MIME patterns [#121](https://github.com/broofa/node-mime/issues/121)
|
||||
- [**closed**] DEBUG_MIME doesn't work [#117](https://github.com/broofa/node-mime/issues/117)
|
||||
|
||||
---
|
||||
|
||||
## v1.3.4 (06/02/2015)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v1.3.3 (06/02/2015)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v1.3.1 (05/02/2015)
|
||||
- [**closed**] Consider adding support for Handlebars .hbs file ending [#111](https://github.com/broofa/node-mime/issues/111)
|
||||
- [**closed**] Consider adding support for hjson. [#110](https://github.com/broofa/node-mime/issues/110)
|
||||
- [**closed**] Add mime type for Opus audio files [#94](https://github.com/broofa/node-mime/issues/94)
|
||||
- [**closed**] Consider making the `Requesting New Types` information more visible [#77](https://github.com/broofa/node-mime/issues/77)
|
||||
|
||||
---
|
||||
|
||||
## v1.3.0 (05/02/2015)
|
||||
- [**closed**] Add common name? [#114](https://github.com/broofa/node-mime/issues/114)
|
||||
- [**closed**] application/x-yaml [#104](https://github.com/broofa/node-mime/issues/104)
|
||||
- [**closed**] Add mime type for WOFF file format 2.0 [#102](https://github.com/broofa/node-mime/issues/102)
|
||||
- [**closed**] application/x-msi for .msi [#99](https://github.com/broofa/node-mime/issues/99)
|
||||
- [**closed**] Add mimetype for gettext translation files [#98](https://github.com/broofa/node-mime/issues/98)
|
||||
- [**closed**] collaborators [#88](https://github.com/broofa/node-mime/issues/88)
|
||||
- [**closed**] getting errot in installation of mime module...any1 can help? [#87](https://github.com/broofa/node-mime/issues/87)
|
||||
- [**closed**] should application/json's charset be utf8? [#86](https://github.com/broofa/node-mime/issues/86)
|
||||
- [**closed**] Add "license" and "licenses" to package.json [#81](https://github.com/broofa/node-mime/issues/81)
|
||||
- [**closed**] lookup with extension-less file on Windows returns wrong type [#68](https://github.com/broofa/node-mime/issues/68)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.11 (15/08/2013)
|
||||
- [**closed**] Update mime.types [#65](https://github.com/broofa/node-mime/issues/65)
|
||||
- [**closed**] Publish a new version [#63](https://github.com/broofa/node-mime/issues/63)
|
||||
- [**closed**] README should state upfront that "application/octet-stream" is default for unknown extension [#55](https://github.com/broofa/node-mime/issues/55)
|
||||
- [**closed**] Suggested improvement to the charset API [#52](https://github.com/broofa/node-mime/issues/52)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.10 (25/07/2013)
|
||||
- [**closed**] Mime type for woff files should be application/font-woff and not application/x-font-woff [#62](https://github.com/broofa/node-mime/issues/62)
|
||||
- [**closed**] node.types in conflict with mime.types [#51](https://github.com/broofa/node-mime/issues/51)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.9 (17/01/2013)
|
||||
- [**closed**] Please update "mime" NPM [#49](https://github.com/broofa/node-mime/issues/49)
|
||||
- [**closed**] Please add semicolon [#46](https://github.com/broofa/node-mime/issues/46)
|
||||
- [**closed**] parse full mime types [#43](https://github.com/broofa/node-mime/issues/43)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.8 (10/01/2013)
|
||||
- [**closed**] /js directory mime is application/javascript. Is it correct? [#47](https://github.com/broofa/node-mime/issues/47)
|
||||
- [**closed**] Add mime types for lua code. [#45](https://github.com/broofa/node-mime/issues/45)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.7 (19/10/2012)
|
||||
- [**closed**] cannot install 1.2.7 via npm [#41](https://github.com/broofa/node-mime/issues/41)
|
||||
- [**closed**] Transfer ownership to @broofa [#36](https://github.com/broofa/node-mime/issues/36)
|
||||
- [**closed**] it's wrong to set charset to UTF-8 for text [#30](https://github.com/broofa/node-mime/issues/30)
|
||||
- [**closed**] Allow multiple instances of MIME types container [#27](https://github.com/broofa/node-mime/issues/27)
|
21
node_modules/mime/LICENSE
generated
vendored
Normal file
21
node_modules/mime/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
|
||||
|
||||
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.
|
95
node_modules/mime/Mime.js
generated
vendored
Normal file
95
node_modules/mime/Mime.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @param typeMap [Object] Map of MIME type -> Array[extensions]
|
||||
* @param ...
|
||||
*/
|
||||
function Mime() {
|
||||
this._types = Object.create(null);
|
||||
this._extensions = Object.create(null);
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
this.define(arguments[i]);
|
||||
}
|
||||
|
||||
this.define = this.define.bind(this);
|
||||
this.getType = this.getType.bind(this);
|
||||
this.getExtension = this.getExtension.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define mimetype -> extension mappings. Each key is a mime-type that maps
|
||||
* to an array of extensions associated with the type. The first extension is
|
||||
* used as the default extension for the type.
|
||||
*
|
||||
* e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
|
||||
*
|
||||
* If a type declares an extension that has already been defined, an error will
|
||||
* be thrown. To suppress this error and force the extension to be associated
|
||||
* with the new type, pass `force`=true. Alternatively, you may prefix the
|
||||
* extension with "*" to map the type to extension, without mapping the
|
||||
* extension to the type.
|
||||
*
|
||||
* e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});
|
||||
*
|
||||
*
|
||||
* @param map (Object) type definitions
|
||||
* @param force (Boolean) if true, force overriding of existing definitions
|
||||
*/
|
||||
Mime.prototype.define = function(typeMap, force) {
|
||||
for (var type in typeMap) {
|
||||
var extensions = typeMap[type].map(function(t) {return t.toLowerCase()});
|
||||
type = type.toLowerCase();
|
||||
|
||||
for (var i = 0; i < extensions.length; i++) {
|
||||
var ext = extensions[i];
|
||||
|
||||
// '*' prefix = not the preferred type for this extension. So fixup the
|
||||
// extension, and skip it.
|
||||
if (ext[0] == '*') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!force && (ext in this._types)) {
|
||||
throw new Error(
|
||||
'Attempt to change mapping for "' + ext +
|
||||
'" extension from "' + this._types[ext] + '" to "' + type +
|
||||
'". Pass `force=true` to allow this, otherwise remove "' + ext +
|
||||
'" from the list of extensions for "' + type + '".'
|
||||
);
|
||||
}
|
||||
|
||||
this._types[ext] = type;
|
||||
}
|
||||
|
||||
// Use first extension as default
|
||||
if (force || !this._extensions[type]) {
|
||||
var ext = extensions[0];
|
||||
this._extensions[type] = (ext[0] != '*') ? ext : ext.substr(1)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup a mime type based on extension
|
||||
*/
|
||||
Mime.prototype.getType = function(path) {
|
||||
path = String(path);
|
||||
var last = path.replace(/^.*[/\\]/, '').toLowerCase();
|
||||
var ext = last.replace(/^.*\./, '').toLowerCase();
|
||||
|
||||
var hasPath = last.length < path.length;
|
||||
var hasDot = ext.length < last.length - 1;
|
||||
|
||||
return (hasDot || !hasPath) && this._types[ext] || null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return file extension associated with a mime type
|
||||
*/
|
||||
Mime.prototype.getExtension = function(type) {
|
||||
type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
|
||||
return type && this._extensions[type.toLowerCase()] || null;
|
||||
};
|
||||
|
||||
module.exports = Mime;
|
187
node_modules/mime/README.md
generated
vendored
Normal file
187
node_modules/mime/README.md
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
<!--
|
||||
-- This file is auto-generated from src/README_js.md. Changes should be made there.
|
||||
-->
|
||||
# Mime
|
||||
|
||||
A comprehensive, compact MIME type module.
|
||||
|
||||
[![Build Status](https://travis-ci.org/broofa/node-mime.svg?branch=master)](https://travis-ci.org/broofa/node-mime)
|
||||
|
||||
## Version 2 Notes
|
||||
|
||||
Version 2 is a breaking change from 1.x as the semver implies. Specifically:
|
||||
|
||||
* `lookup()` renamed to `getType()`
|
||||
* `extension()` renamed to `getExtension()`
|
||||
* `charset()` and `load()` methods have been removed
|
||||
|
||||
If you prefer the legacy version of this module please `npm install mime@^1`. Version 1 docs may be found [here](https://github.com/broofa/node-mime/tree/v1.4.0).
|
||||
|
||||
## Install
|
||||
|
||||
### NPM
|
||||
```
|
||||
npm install mime
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
It is recommended that you use a bundler such as
|
||||
[webpack](https://webpack.github.io/) or [browserify](http://browserify.org/) to
|
||||
package your code. However, browser-ready versions are available via wzrd.in.
|
||||
E.g. For the full version:
|
||||
|
||||
<script src="https://wzrd.in/standalone/mime@latest"></script>
|
||||
<script>
|
||||
mime.getType(...); // etc.
|
||||
<script>
|
||||
|
||||
Or, for the `mime/lite` version:
|
||||
|
||||
<script src="https://wzrd.in/standalone/mime%2flite@latest"></script>
|
||||
<script>
|
||||
mimelite.getType(...); // (Note `mimelite` here)
|
||||
<script>
|
||||
|
||||
## Quick Start
|
||||
|
||||
For the full version (800+ MIME types, 1,000+ extensions):
|
||||
|
||||
```javascript
|
||||
const mime = require('mime');
|
||||
|
||||
mime.getType('txt'); // ⇨ 'text/plain'
|
||||
mime.getExtension('text/plain'); // ⇨ 'txt'
|
||||
```
|
||||
|
||||
See [Mime API](#mime-api) below for API details.
|
||||
|
||||
## Lite Version
|
||||
|
||||
There is also a "lite" version of this module that omits vendor-specific
|
||||
(`*/vnd.*`) and experimental (`*/x-*`) types. It weighs in at ~2.5KB, compared
|
||||
to 8KB for the full version. To load the lite version:
|
||||
|
||||
```javascript
|
||||
const mime = require('mime/lite');
|
||||
```
|
||||
|
||||
## Mime .vs. mime-types .vs. mime-db modules
|
||||
|
||||
For those of you wondering about the difference between these [popular] NPM modules,
|
||||
here's a brief rundown ...
|
||||
|
||||
[`mime-db`](https://github.com/jshttp/mime-db) is "the source of
|
||||
truth" for MIME type information. It is not an API. Rather, it is a canonical
|
||||
dataset of mime type definitions pulled from IANA, Apache, NGINX, and custom mappings
|
||||
submitted by the Node.js community.
|
||||
|
||||
[`mime-types`](https://github.com/jshttp/mime-types) is a thin
|
||||
wrapper around mime-db that provides an API drop-in compatible(ish) with `mime @ < v1.3.6` API.
|
||||
|
||||
`mime` is, as of v2, a self-contained module bundled with a pre-optimized version
|
||||
of the `mime-db` dataset. It provides a simplified API with the following characteristics:
|
||||
|
||||
* Intelligently resolved type conflicts (See [mime-score](https://github.com/broofa/mime-score) for details)
|
||||
* Method naming consistent with industry best-practices
|
||||
* Compact footprint. E.g. The minified+compressed sizes of the various modules:
|
||||
|
||||
Module | Size
|
||||
--- | ---
|
||||
`mime-db` | 18 KB
|
||||
`mime-types` | same as mime-db
|
||||
`mime` | 8 KB
|
||||
`mime/lite` | 2 KB
|
||||
|
||||
## Mime API
|
||||
|
||||
Both `require('mime')` and `require('mime/lite')` return instances of the MIME
|
||||
class, documented below.
|
||||
|
||||
Note: Inputs to this API are case-insensitive. Outputs (returned values) will
|
||||
be lowercase.
|
||||
|
||||
### new Mime(typeMap, ... more maps)
|
||||
|
||||
Most users of this module will not need to create Mime instances directly.
|
||||
However if you would like to create custom mappings, you may do so as follows
|
||||
...
|
||||
|
||||
```javascript
|
||||
// Require Mime class
|
||||
const Mime = require('mime/Mime');
|
||||
|
||||
// Define mime type -> extensions map
|
||||
const typeMap = {
|
||||
'text/abc': ['abc', 'alpha', 'bet'],
|
||||
'text/def': ['leppard']
|
||||
};
|
||||
|
||||
// Create and use Mime instance
|
||||
const myMime = new Mime(typeMap);
|
||||
myMime.getType('abc'); // ⇨ 'text/abc'
|
||||
myMime.getExtension('text/def'); // ⇨ 'leppard'
|
||||
```
|
||||
|
||||
If more than one map argument is provided, each map is `define()`ed (see below), in order.
|
||||
|
||||
### mime.getType(pathOrExtension)
|
||||
|
||||
Get mime type for the given path or extension. E.g.
|
||||
|
||||
```javascript
|
||||
mime.getType('js'); // ⇨ 'application/javascript'
|
||||
mime.getType('json'); // ⇨ 'application/json'
|
||||
|
||||
mime.getType('txt'); // ⇨ 'text/plain'
|
||||
mime.getType('dir/text.txt'); // ⇨ 'text/plain'
|
||||
mime.getType('dir\\text.txt'); // ⇨ 'text/plain'
|
||||
mime.getType('.text.txt'); // ⇨ 'text/plain'
|
||||
mime.getType('.txt'); // ⇨ 'text/plain'
|
||||
```
|
||||
|
||||
`null` is returned in cases where an extension is not detected or recognized
|
||||
|
||||
```javascript
|
||||
mime.getType('foo/txt'); // ⇨ null
|
||||
mime.getType('bogus_type'); // ⇨ null
|
||||
```
|
||||
|
||||
### mime.getExtension(type)
|
||||
Get extension for the given mime type. Charset options (often included in
|
||||
Content-Type headers) are ignored.
|
||||
|
||||
```javascript
|
||||
mime.getExtension('text/plain'); // ⇨ 'txt'
|
||||
mime.getExtension('application/json'); // ⇨ 'json'
|
||||
mime.getExtension('text/html; charset=utf8'); // ⇨ 'html'
|
||||
```
|
||||
|
||||
### mime.define(typeMap[, force = false])
|
||||
|
||||
Define [more] type mappings.
|
||||
|
||||
`typeMap` is a map of type -> extensions, as documented in `new Mime`, above.
|
||||
|
||||
By default this method will throw an error if you try to map a type to an
|
||||
extension that is already assigned to another type. Passing `true` for the
|
||||
`force` argument will suppress this behavior (overriding any previous mapping).
|
||||
|
||||
```javascript
|
||||
mime.define({'text/x-abc': ['abc', 'abcd']});
|
||||
|
||||
mime.getType('abcd'); // ⇨ 'text/x-abc'
|
||||
mime.getExtension('text/x-abc') // ⇨ 'abc'
|
||||
```
|
||||
|
||||
## Command Line
|
||||
|
||||
mime [path_or_extension]
|
||||
|
||||
E.g.
|
||||
|
||||
> mime scripts/jquery.js
|
||||
application/javascript
|
||||
|
||||
----
|
||||
Markdown generated from [src/README_js.md](src/README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd)
|
10
node_modules/mime/cli.js
generated
vendored
Executable file
10
node_modules/mime/cli.js
generated
vendored
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var mime = require('.');
|
||||
var file = process.argv[2];
|
||||
var type = mime.getType(file);
|
||||
|
||||
process.stdout.write(type + '\n');
|
||||
|
4
node_modules/mime/index.js
generated
vendored
Normal file
4
node_modules/mime/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
var Mime = require('./Mime');
|
||||
module.exports = new Mime(require('./types/standard'), require('./types/other'));
|
4
node_modules/mime/lite.js
generated
vendored
Normal file
4
node_modules/mime/lite.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
var Mime = require('./Mime');
|
||||
module.exports = new Mime(require('./types/standard'));
|
80
node_modules/mime/package.json
generated
vendored
Normal file
80
node_modules/mime/package.json
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "mime@^2.3.1",
|
||||
"_id": "mime@2.4.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-3hQhEUF027BuxZjQA3s7rIv/7VCQPa27hN9u9g87sEkWaKwQPuXOkVKtOeiyUrnWqTDiOs8Ed2rwg733mB0R5w==",
|
||||
"_location": "/mime",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "mime@^2.3.1",
|
||||
"name": "mime",
|
||||
"escapedName": "mime",
|
||||
"rawSpec": "^2.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sirv"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime/-/mime-2.4.5.tgz",
|
||||
"_shasum": "d8de2ecb92982dedbb6541c9b6841d7f218ea009",
|
||||
"_spec": "mime@^2.3.1",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/sirv",
|
||||
"author": {
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com",
|
||||
"url": "http://github.com/broofa"
|
||||
},
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/broofa/node-mime/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "A comprehensive library for mime-type mapping",
|
||||
"devDependencies": {
|
||||
"benchmark": "*",
|
||||
"chalk": "*",
|
||||
"eslint": "*",
|
||||
"mime-db": "1.44.0",
|
||||
"mime-score": "1.2.0",
|
||||
"mime-types": "2.1.27",
|
||||
"mocha": "7.1.2",
|
||||
"runmd": "*",
|
||||
"standard-version": "7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lite.js",
|
||||
"Mime.js",
|
||||
"/types"
|
||||
],
|
||||
"homepage": "https://github.com/broofa/node-mime#readme",
|
||||
"keywords": [
|
||||
"util",
|
||||
"mime"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "mime",
|
||||
"repository": {
|
||||
"url": "git+https://github.com/broofa/node-mime.git",
|
||||
"type": "git"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "node src/benchmark.js",
|
||||
"md": "runmd --watch --output README.md src/README_js.md",
|
||||
"prepare": "node src/build.js && runmd --output README.md src/README_js.md",
|
||||
"release": "standard-version",
|
||||
"test": "mocha src/test.js"
|
||||
},
|
||||
"version": "2.4.5"
|
||||
}
|
1
node_modules/mime/types/other.js
generated
vendored
Normal file
1
node_modules/mime/types/other.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/mime/types/standard.js
generated
vendored
Normal file
1
node_modules/mime/types/standard.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
152
node_modules/ms/index.js
generated
vendored
Normal file
152
node_modules/ms/index.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
/**
|
||||
* 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]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isNaN(val) === false) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
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;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(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 fmtLong(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';
|
||||
}
|
21
node_modules/ms/license.md
generated
vendored
Normal file
21
node_modules/ms/license.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
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.
|
69
node_modules/ms/package.json
generated
vendored
Normal file
69
node_modules/ms/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "ms@2.0.0",
|
||||
"_id": "ms@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||
"_location": "/ms",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "ms@2.0.0",
|
||||
"name": "ms",
|
||||
"escapedName": "ms",
|
||||
"rawSpec": "2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/debug"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8",
|
||||
"_spec": "ms@2.0.0",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/debug",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeit/ms/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny milisecond conversion utility",
|
||||
"devDependencies": {
|
||||
"eslint": "3.19.0",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.13.3",
|
||||
"lint-staged": "3.4.1",
|
||||
"mocha": "3.4.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/zeit/ms#readme",
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "./index",
|
||||
"name": "ms",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zeit/ms.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"precommit": "lint-staged",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
51
node_modules/ms/readme.md
generated
vendored
Normal file
51
node_modules/ms/readme.md
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# ms
|
||||
|
||||
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
|
||||
[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```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('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
```
|
||||
|
||||
### Convert from milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time format written-out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [node](https://nodejs.org) and in the browser.
|
||||
- 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.
|
||||
|
||||
## Caught a bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
103
node_modules/negotiator/HISTORY.md
generated
vendored
Normal file
103
node_modules/negotiator/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
0.6.2 / 2019-04-29
|
||||
==================
|
||||
|
||||
* Fix sorting charset, encoding, and language with extra parameters
|
||||
|
||||
0.6.1 / 2016-05-02
|
||||
==================
|
||||
|
||||
* perf: improve `Accept` parsing speed
|
||||
* perf: improve `Accept-Charset` parsing speed
|
||||
* perf: improve `Accept-Encoding` parsing speed
|
||||
* perf: improve `Accept-Language` parsing speed
|
||||
|
||||
0.6.0 / 2015-09-29
|
||||
==================
|
||||
|
||||
* Fix including type extensions in parameters in `Accept` parsing
|
||||
* Fix parsing `Accept` parameters with quoted equals
|
||||
* Fix parsing `Accept` parameters with quoted semicolons
|
||||
* Lazy-load modules from main entry point
|
||||
* perf: delay type concatenation until needed
|
||||
* perf: enable strict mode
|
||||
* perf: hoist regular expressions
|
||||
* perf: remove closures getting spec properties
|
||||
* perf: remove a closure from media type parsing
|
||||
* perf: remove property delete from media type parsing
|
||||
|
||||
0.5.3 / 2015-05-10
|
||||
==================
|
||||
|
||||
* Fix media type parameter matching to be case-insensitive
|
||||
|
||||
0.5.2 / 2015-05-06
|
||||
==================
|
||||
|
||||
* Fix comparing media types with quoted values
|
||||
* Fix splitting media types with quoted commas
|
||||
|
||||
0.5.1 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
0.5.0 / 2014-12-18
|
||||
==================
|
||||
|
||||
* Fix list return order when large accepted list
|
||||
* Fix missing identity encoding when q=0 exists
|
||||
* Remove dynamic building of Negotiator class
|
||||
|
||||
0.4.9 / 2014-10-14
|
||||
==================
|
||||
|
||||
* Fix error when media type has invalid parameter
|
||||
|
||||
0.4.8 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Fix all negotiations to be case-insensitive
|
||||
* Stable sort preferences of same quality according to client order
|
||||
* Support Node.js 0.6
|
||||
|
||||
0.4.7 / 2014-06-24
|
||||
==================
|
||||
|
||||
* Handle invalid provided languages
|
||||
* Handle invalid provided media types
|
||||
|
||||
0.4.6 / 2014-06-11
|
||||
==================
|
||||
|
||||
* Order by specificity when quality is the same
|
||||
|
||||
0.4.5 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix regression in empty header handling
|
||||
|
||||
0.4.4 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix behaviors when headers are not present
|
||||
|
||||
0.4.3 / 2014-04-16
|
||||
==================
|
||||
|
||||
* Handle slashes on media params correctly
|
||||
|
||||
0.4.2 / 2014-02-28
|
||||
==================
|
||||
|
||||
* Fix media type sorting
|
||||
* Handle media types params strictly
|
||||
|
||||
0.4.1 / 2014-01-16
|
||||
==================
|
||||
|
||||
* Use most specific matches
|
||||
|
||||
0.4.0 / 2014-01-09
|
||||
==================
|
||||
|
||||
* Remove preferred prefix from methods
|
24
node_modules/negotiator/LICENSE
generated
vendored
Normal file
24
node_modules/negotiator/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 Federico Romero
|
||||
Copyright (c) 2012-2014 Isaac Z. Schlueter
|
||||
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.
|
203
node_modules/negotiator/README.md
generated
vendored
Normal file
203
node_modules/negotiator/README.md
generated
vendored
Normal file
@ -0,0 +1,203 @@
|
||||
# negotiator
|
||||
|
||||
[![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]
|
||||
|
||||
An HTTP content negotiator for Node.js
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install negotiator
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var Negotiator = require('negotiator')
|
||||
```
|
||||
|
||||
### Accept Negotiation
|
||||
|
||||
```js
|
||||
availableMediaTypes = ['text/html', 'text/plain', 'application/json']
|
||||
|
||||
// The negotiator constructor receives a request object
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'
|
||||
|
||||
negotiator.mediaTypes()
|
||||
// -> ['text/html', 'image/jpeg', 'application/*']
|
||||
|
||||
negotiator.mediaTypes(availableMediaTypes)
|
||||
// -> ['text/html', 'application/json']
|
||||
|
||||
negotiator.mediaType(availableMediaTypes)
|
||||
// -> 'text/html'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/accept.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### mediaType()
|
||||
|
||||
Returns the most preferred media type from the client.
|
||||
|
||||
##### mediaType(availableMediaType)
|
||||
|
||||
Returns the most preferred media type from a list of available media types.
|
||||
|
||||
##### mediaTypes()
|
||||
|
||||
Returns an array of preferred media types ordered by the client preference.
|
||||
|
||||
##### mediaTypes(availableMediaTypes)
|
||||
|
||||
Returns an array of preferred media types ordered by priority from a list of
|
||||
available media types.
|
||||
|
||||
### Accept-Language Negotiation
|
||||
|
||||
```js
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
availableLanguages = ['en', 'es', 'fr']
|
||||
|
||||
// Let's say Accept-Language header is 'en;q=0.8, es, pt'
|
||||
|
||||
negotiator.languages()
|
||||
// -> ['es', 'pt', 'en']
|
||||
|
||||
negotiator.languages(availableLanguages)
|
||||
// -> ['es', 'en']
|
||||
|
||||
language = negotiator.language(availableLanguages)
|
||||
// -> 'es'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/language.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### language()
|
||||
|
||||
Returns the most preferred language from the client.
|
||||
|
||||
##### language(availableLanguages)
|
||||
|
||||
Returns the most preferred language from a list of available languages.
|
||||
|
||||
##### languages()
|
||||
|
||||
Returns an array of preferred languages ordered by the client preference.
|
||||
|
||||
##### languages(availableLanguages)
|
||||
|
||||
Returns an array of preferred languages ordered by priority from a list of
|
||||
available languages.
|
||||
|
||||
### Accept-Charset Negotiation
|
||||
|
||||
```js
|
||||
availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']
|
||||
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'
|
||||
|
||||
negotiator.charsets()
|
||||
// -> ['utf-8', 'iso-8859-1', 'utf-7']
|
||||
|
||||
negotiator.charsets(availableCharsets)
|
||||
// -> ['utf-8', 'iso-8859-1']
|
||||
|
||||
negotiator.charset(availableCharsets)
|
||||
// -> 'utf-8'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/charset.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### charset()
|
||||
|
||||
Returns the most preferred charset from the client.
|
||||
|
||||
##### charset(availableCharsets)
|
||||
|
||||
Returns the most preferred charset from a list of available charsets.
|
||||
|
||||
##### charsets()
|
||||
|
||||
Returns an array of preferred charsets ordered by the client preference.
|
||||
|
||||
##### charsets(availableCharsets)
|
||||
|
||||
Returns an array of preferred charsets ordered by priority from a list of
|
||||
available charsets.
|
||||
|
||||
### Accept-Encoding Negotiation
|
||||
|
||||
```js
|
||||
availableEncodings = ['identity', 'gzip']
|
||||
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'
|
||||
|
||||
negotiator.encodings()
|
||||
// -> ['gzip', 'identity', 'compress']
|
||||
|
||||
negotiator.encodings(availableEncodings)
|
||||
// -> ['gzip', 'identity']
|
||||
|
||||
negotiator.encoding(availableEncodings)
|
||||
// -> 'gzip'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/encoding.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### encoding()
|
||||
|
||||
Returns the most preferred encoding from the client.
|
||||
|
||||
##### encoding(availableEncodings)
|
||||
|
||||
Returns the most preferred encoding from a list of available encodings.
|
||||
|
||||
##### encodings()
|
||||
|
||||
Returns an array of preferred encodings ordered by the client preference.
|
||||
|
||||
##### encodings(availableEncodings)
|
||||
|
||||
Returns an array of preferred encodings ordered by priority from a list of
|
||||
available encodings.
|
||||
|
||||
## See Also
|
||||
|
||||
The [accepts](https://npmjs.org/package/accepts#readme) module builds on
|
||||
this module and provides an alternative interface, mime type validation,
|
||||
and more.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/negotiator.svg
|
||||
[npm-url]: https://npmjs.org/package/negotiator
|
||||
[node-version-image]: https://img.shields.io/node/v/negotiator.svg
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/negotiator/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/negotiator
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg
|
||||
[downloads-url]: https://npmjs.org/package/negotiator
|
124
node_modules/negotiator/index.js
generated
vendored
Normal file
124
node_modules/negotiator/index.js
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
/*!
|
||||
* negotiator
|
||||
* Copyright(c) 2012 Federico Romero
|
||||
* Copyright(c) 2012-2014 Isaac Z. Schlueter
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Cached loaded submodules.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var modules = Object.create(null);
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = Negotiator;
|
||||
module.exports.Negotiator = Negotiator;
|
||||
|
||||
/**
|
||||
* Create a Negotiator instance from a request.
|
||||
* @param {object} request
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Negotiator(request) {
|
||||
if (!(this instanceof Negotiator)) {
|
||||
return new Negotiator(request);
|
||||
}
|
||||
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
Negotiator.prototype.charset = function charset(available) {
|
||||
var set = this.charsets(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.charsets = function charsets(available) {
|
||||
var preferredCharsets = loadModule('charset').preferredCharsets;
|
||||
return preferredCharsets(this.request.headers['accept-charset'], available);
|
||||
};
|
||||
|
||||
Negotiator.prototype.encoding = function encoding(available) {
|
||||
var set = this.encodings(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.encodings = function encodings(available) {
|
||||
var preferredEncodings = loadModule('encoding').preferredEncodings;
|
||||
return preferredEncodings(this.request.headers['accept-encoding'], available);
|
||||
};
|
||||
|
||||
Negotiator.prototype.language = function language(available) {
|
||||
var set = this.languages(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.languages = function languages(available) {
|
||||
var preferredLanguages = loadModule('language').preferredLanguages;
|
||||
return preferredLanguages(this.request.headers['accept-language'], available);
|
||||
};
|
||||
|
||||
Negotiator.prototype.mediaType = function mediaType(available) {
|
||||
var set = this.mediaTypes(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.mediaTypes = function mediaTypes(available) {
|
||||
var preferredMediaTypes = loadModule('mediaType').preferredMediaTypes;
|
||||
return preferredMediaTypes(this.request.headers.accept, available);
|
||||
};
|
||||
|
||||
// Backwards compatibility
|
||||
Negotiator.prototype.preferredCharset = Negotiator.prototype.charset;
|
||||
Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets;
|
||||
Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding;
|
||||
Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings;
|
||||
Negotiator.prototype.preferredLanguage = Negotiator.prototype.language;
|
||||
Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages;
|
||||
Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType;
|
||||
Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes;
|
||||
|
||||
/**
|
||||
* Load the given module.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function loadModule(moduleName) {
|
||||
var module = modules[moduleName];
|
||||
|
||||
if (module !== undefined) {
|
||||
return module;
|
||||
}
|
||||
|
||||
// This uses a switch for static require analysis
|
||||
switch (moduleName) {
|
||||
case 'charset':
|
||||
module = require('./lib/charset');
|
||||
break;
|
||||
case 'encoding':
|
||||
module = require('./lib/encoding');
|
||||
break;
|
||||
case 'language':
|
||||
module = require('./lib/language');
|
||||
break;
|
||||
case 'mediaType':
|
||||
module = require('./lib/mediaType');
|
||||
break;
|
||||
default:
|
||||
throw new Error('Cannot find module \'' + moduleName + '\'');
|
||||
}
|
||||
|
||||
// Store to prevent invoking require()
|
||||
modules[moduleName] = module;
|
||||
|
||||
return module;
|
||||
}
|
169
node_modules/negotiator/lib/charset.js
generated
vendored
Normal file
169
node_modules/negotiator/lib/charset.js
generated
vendored
Normal file
@ -0,0 +1,169 @@
|
||||
/**
|
||||
* negotiator
|
||||
* Copyright(c) 2012 Isaac Z. Schlueter
|
||||
* Copyright(c) 2014 Federico Romero
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = preferredCharsets;
|
||||
module.exports.preferredCharsets = preferredCharsets;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
|
||||
|
||||
/**
|
||||
* Parse the Accept-Charset header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseAcceptCharset(accept) {
|
||||
var accepts = accept.split(',');
|
||||
|
||||
for (var i = 0, j = 0; i < accepts.length; i++) {
|
||||
var charset = parseCharset(accepts[i].trim(), i);
|
||||
|
||||
if (charset) {
|
||||
accepts[j++] = charset;
|
||||
}
|
||||
}
|
||||
|
||||
// trim accepts
|
||||
accepts.length = j;
|
||||
|
||||
return accepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a charset from the Accept-Charset header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseCharset(str, i) {
|
||||
var match = simpleCharsetRegExp.exec(str);
|
||||
if (!match) return null;
|
||||
|
||||
var charset = match[1];
|
||||
var q = 1;
|
||||
if (match[2]) {
|
||||
var params = match[2].split(';')
|
||||
for (var j = 0; j < params.length; j++) {
|
||||
var p = params[j].trim().split('=');
|
||||
if (p[0] === 'q') {
|
||||
q = parseFloat(p[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
charset: charset,
|
||||
q: q,
|
||||
i: i
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the priority of a charset.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getCharsetPriority(charset, accepted, index) {
|
||||
var priority = {o: -1, q: 0, s: 0};
|
||||
|
||||
for (var i = 0; i < accepted.length; i++) {
|
||||
var spec = specify(charset, accepted[i], index);
|
||||
|
||||
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
||||
priority = spec;
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specificity of the charset.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function specify(charset, spec, index) {
|
||||
var s = 0;
|
||||
if(spec.charset.toLowerCase() === charset.toLowerCase()){
|
||||
s |= 1;
|
||||
} else if (spec.charset !== '*' ) {
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
i: index,
|
||||
o: spec.i,
|
||||
q: spec.q,
|
||||
s: s
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preferred charsets from an Accept-Charset header.
|
||||
* @public
|
||||
*/
|
||||
|
||||
function preferredCharsets(accept, provided) {
|
||||
// RFC 2616 sec 14.2: no header = *
|
||||
var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || '');
|
||||
|
||||
if (!provided) {
|
||||
// sorted list of all charsets
|
||||
return accepts
|
||||
.filter(isQuality)
|
||||
.sort(compareSpecs)
|
||||
.map(getFullCharset);
|
||||
}
|
||||
|
||||
var priorities = provided.map(function getPriority(type, index) {
|
||||
return getCharsetPriority(type, accepts, index);
|
||||
});
|
||||
|
||||
// sorted list of accepted charsets
|
||||
return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) {
|
||||
return provided[priorities.indexOf(priority)];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two specs.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function compareSpecs(a, b) {
|
||||
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full charset string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getFullCharset(spec) {
|
||||
return spec.charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a spec has any quality.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function isQuality(spec) {
|
||||
return spec.q > 0;
|
||||
}
|
184
node_modules/negotiator/lib/encoding.js
generated
vendored
Normal file
184
node_modules/negotiator/lib/encoding.js
generated
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
/**
|
||||
* negotiator
|
||||
* Copyright(c) 2012 Isaac Z. Schlueter
|
||||
* Copyright(c) 2014 Federico Romero
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = preferredEncodings;
|
||||
module.exports.preferredEncodings = preferredEncodings;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
|
||||
|
||||
/**
|
||||
* Parse the Accept-Encoding header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseAcceptEncoding(accept) {
|
||||
var accepts = accept.split(',');
|
||||
var hasIdentity = false;
|
||||
var minQuality = 1;
|
||||
|
||||
for (var i = 0, j = 0; i < accepts.length; i++) {
|
||||
var encoding = parseEncoding(accepts[i].trim(), i);
|
||||
|
||||
if (encoding) {
|
||||
accepts[j++] = encoding;
|
||||
hasIdentity = hasIdentity || specify('identity', encoding);
|
||||
minQuality = Math.min(minQuality, encoding.q || 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasIdentity) {
|
||||
/*
|
||||
* If identity doesn't explicitly appear in the accept-encoding header,
|
||||
* it's added to the list of acceptable encoding with the lowest q
|
||||
*/
|
||||
accepts[j++] = {
|
||||
encoding: 'identity',
|
||||
q: minQuality,
|
||||
i: i
|
||||
};
|
||||
}
|
||||
|
||||
// trim accepts
|
||||
accepts.length = j;
|
||||
|
||||
return accepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an encoding from the Accept-Encoding header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseEncoding(str, i) {
|
||||
var match = simpleEncodingRegExp.exec(str);
|
||||
if (!match) return null;
|
||||
|
||||
var encoding = match[1];
|
||||
var q = 1;
|
||||
if (match[2]) {
|
||||
var params = match[2].split(';');
|
||||
for (var j = 0; j < params.length; j++) {
|
||||
var p = params[j].trim().split('=');
|
||||
if (p[0] === 'q') {
|
||||
q = parseFloat(p[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
encoding: encoding,
|
||||
q: q,
|
||||
i: i
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the priority of an encoding.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getEncodingPriority(encoding, accepted, index) {
|
||||
var priority = {o: -1, q: 0, s: 0};
|
||||
|
||||
for (var i = 0; i < accepted.length; i++) {
|
||||
var spec = specify(encoding, accepted[i], index);
|
||||
|
||||
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
||||
priority = spec;
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specificity of the encoding.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function specify(encoding, spec, index) {
|
||||
var s = 0;
|
||||
if(spec.encoding.toLowerCase() === encoding.toLowerCase()){
|
||||
s |= 1;
|
||||
} else if (spec.encoding !== '*' ) {
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
i: index,
|
||||
o: spec.i,
|
||||
q: spec.q,
|
||||
s: s
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the preferred encodings from an Accept-Encoding header.
|
||||
* @public
|
||||
*/
|
||||
|
||||
function preferredEncodings(accept, provided) {
|
||||
var accepts = parseAcceptEncoding(accept || '');
|
||||
|
||||
if (!provided) {
|
||||
// sorted list of all encodings
|
||||
return accepts
|
||||
.filter(isQuality)
|
||||
.sort(compareSpecs)
|
||||
.map(getFullEncoding);
|
||||
}
|
||||
|
||||
var priorities = provided.map(function getPriority(type, index) {
|
||||
return getEncodingPriority(type, accepts, index);
|
||||
});
|
||||
|
||||
// sorted list of accepted encodings
|
||||
return priorities.filter(isQuality).sort(compareSpecs).map(function getEncoding(priority) {
|
||||
return provided[priorities.indexOf(priority)];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two specs.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function compareSpecs(a, b) {
|
||||
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full encoding string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getFullEncoding(spec) {
|
||||
return spec.encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a spec has any quality.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function isQuality(spec) {
|
||||
return spec.q > 0;
|
||||
}
|
179
node_modules/negotiator/lib/language.js
generated
vendored
Normal file
179
node_modules/negotiator/lib/language.js
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
/**
|
||||
* negotiator
|
||||
* Copyright(c) 2012 Isaac Z. Schlueter
|
||||
* Copyright(c) 2014 Federico Romero
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = preferredLanguages;
|
||||
module.exports.preferredLanguages = preferredLanguages;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
|
||||
|
||||
/**
|
||||
* Parse the Accept-Language header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseAcceptLanguage(accept) {
|
||||
var accepts = accept.split(',');
|
||||
|
||||
for (var i = 0, j = 0; i < accepts.length; i++) {
|
||||
var language = parseLanguage(accepts[i].trim(), i);
|
||||
|
||||
if (language) {
|
||||
accepts[j++] = language;
|
||||
}
|
||||
}
|
||||
|
||||
// trim accepts
|
||||
accepts.length = j;
|
||||
|
||||
return accepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a language from the Accept-Language header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseLanguage(str, i) {
|
||||
var match = simpleLanguageRegExp.exec(str);
|
||||
if (!match) return null;
|
||||
|
||||
var prefix = match[1],
|
||||
suffix = match[2],
|
||||
full = prefix;
|
||||
|
||||
if (suffix) full += "-" + suffix;
|
||||
|
||||
var q = 1;
|
||||
if (match[3]) {
|
||||
var params = match[3].split(';')
|
||||
for (var j = 0; j < params.length; j++) {
|
||||
var p = params[j].split('=');
|
||||
if (p[0] === 'q') q = parseFloat(p[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
prefix: prefix,
|
||||
suffix: suffix,
|
||||
q: q,
|
||||
i: i,
|
||||
full: full
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the priority of a language.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getLanguagePriority(language, accepted, index) {
|
||||
var priority = {o: -1, q: 0, s: 0};
|
||||
|
||||
for (var i = 0; i < accepted.length; i++) {
|
||||
var spec = specify(language, accepted[i], index);
|
||||
|
||||
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
||||
priority = spec;
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specificity of the language.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function specify(language, spec, index) {
|
||||
var p = parseLanguage(language)
|
||||
if (!p) return null;
|
||||
var s = 0;
|
||||
if(spec.full.toLowerCase() === p.full.toLowerCase()){
|
||||
s |= 4;
|
||||
} else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) {
|
||||
s |= 2;
|
||||
} else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) {
|
||||
s |= 1;
|
||||
} else if (spec.full !== '*' ) {
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
i: index,
|
||||
o: spec.i,
|
||||
q: spec.q,
|
||||
s: s
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the preferred languages from an Accept-Language header.
|
||||
* @public
|
||||
*/
|
||||
|
||||
function preferredLanguages(accept, provided) {
|
||||
// RFC 2616 sec 14.4: no header = *
|
||||
var accepts = parseAcceptLanguage(accept === undefined ? '*' : accept || '');
|
||||
|
||||
if (!provided) {
|
||||
// sorted list of all languages
|
||||
return accepts
|
||||
.filter(isQuality)
|
||||
.sort(compareSpecs)
|
||||
.map(getFullLanguage);
|
||||
}
|
||||
|
||||
var priorities = provided.map(function getPriority(type, index) {
|
||||
return getLanguagePriority(type, accepts, index);
|
||||
});
|
||||
|
||||
// sorted list of accepted languages
|
||||
return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) {
|
||||
return provided[priorities.indexOf(priority)];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two specs.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function compareSpecs(a, b) {
|
||||
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full language string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getFullLanguage(spec) {
|
||||
return spec.full;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a spec has any quality.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function isQuality(spec) {
|
||||
return spec.q > 0;
|
||||
}
|
294
node_modules/negotiator/lib/mediaType.js
generated
vendored
Normal file
294
node_modules/negotiator/lib/mediaType.js
generated
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
/**
|
||||
* negotiator
|
||||
* Copyright(c) 2012 Isaac Z. Schlueter
|
||||
* Copyright(c) 2014 Federico Romero
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = preferredMediaTypes;
|
||||
module.exports.preferredMediaTypes = preferredMediaTypes;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;
|
||||
|
||||
/**
|
||||
* Parse the Accept header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseAccept(accept) {
|
||||
var accepts = splitMediaTypes(accept);
|
||||
|
||||
for (var i = 0, j = 0; i < accepts.length; i++) {
|
||||
var mediaType = parseMediaType(accepts[i].trim(), i);
|
||||
|
||||
if (mediaType) {
|
||||
accepts[j++] = mediaType;
|
||||
}
|
||||
}
|
||||
|
||||
// trim accepts
|
||||
accepts.length = j;
|
||||
|
||||
return accepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a media type from the Accept header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseMediaType(str, i) {
|
||||
var match = simpleMediaTypeRegExp.exec(str);
|
||||
if (!match) return null;
|
||||
|
||||
var params = Object.create(null);
|
||||
var q = 1;
|
||||
var subtype = match[2];
|
||||
var type = match[1];
|
||||
|
||||
if (match[3]) {
|
||||
var kvps = splitParameters(match[3]).map(splitKeyValuePair);
|
||||
|
||||
for (var j = 0; j < kvps.length; j++) {
|
||||
var pair = kvps[j];
|
||||
var key = pair[0].toLowerCase();
|
||||
var val = pair[1];
|
||||
|
||||
// get the value, unwrapping quotes
|
||||
var value = val && val[0] === '"' && val[val.length - 1] === '"'
|
||||
? val.substr(1, val.length - 2)
|
||||
: val;
|
||||
|
||||
if (key === 'q') {
|
||||
q = parseFloat(value);
|
||||
break;
|
||||
}
|
||||
|
||||
// store parameter
|
||||
params[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: type,
|
||||
subtype: subtype,
|
||||
params: params,
|
||||
q: q,
|
||||
i: i
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the priority of a media type.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getMediaTypePriority(type, accepted, index) {
|
||||
var priority = {o: -1, q: 0, s: 0};
|
||||
|
||||
for (var i = 0; i < accepted.length; i++) {
|
||||
var spec = specify(type, accepted[i], index);
|
||||
|
||||
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
||||
priority = spec;
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specificity of the media type.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function specify(type, spec, index) {
|
||||
var p = parseMediaType(type);
|
||||
var s = 0;
|
||||
|
||||
if (!p) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(spec.type.toLowerCase() == p.type.toLowerCase()) {
|
||||
s |= 4
|
||||
} else if(spec.type != '*') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(spec.subtype.toLowerCase() == p.subtype.toLowerCase()) {
|
||||
s |= 2
|
||||
} else if(spec.subtype != '*') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var keys = Object.keys(spec.params);
|
||||
if (keys.length > 0) {
|
||||
if (keys.every(function (k) {
|
||||
return spec.params[k] == '*' || (spec.params[k] || '').toLowerCase() == (p.params[k] || '').toLowerCase();
|
||||
})) {
|
||||
s |= 1
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
i: index,
|
||||
o: spec.i,
|
||||
q: spec.q,
|
||||
s: s,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preferred media types from an Accept header.
|
||||
* @public
|
||||
*/
|
||||
|
||||
function preferredMediaTypes(accept, provided) {
|
||||
// RFC 2616 sec 14.2: no header = */*
|
||||
var accepts = parseAccept(accept === undefined ? '*/*' : accept || '');
|
||||
|
||||
if (!provided) {
|
||||
// sorted list of all types
|
||||
return accepts
|
||||
.filter(isQuality)
|
||||
.sort(compareSpecs)
|
||||
.map(getFullType);
|
||||
}
|
||||
|
||||
var priorities = provided.map(function getPriority(type, index) {
|
||||
return getMediaTypePriority(type, accepts, index);
|
||||
});
|
||||
|
||||
// sorted list of accepted types
|
||||
return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) {
|
||||
return provided[priorities.indexOf(priority)];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two specs.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function compareSpecs(a, b) {
|
||||
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full type string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getFullType(spec) {
|
||||
return spec.type + '/' + spec.subtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a spec has any quality.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function isQuality(spec) {
|
||||
return spec.q > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of quotes in a string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function quoteCount(string) {
|
||||
var count = 0;
|
||||
var index = 0;
|
||||
|
||||
while ((index = string.indexOf('"', index)) !== -1) {
|
||||
count++;
|
||||
index++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a key value pair.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function splitKeyValuePair(str) {
|
||||
var index = str.indexOf('=');
|
||||
var key;
|
||||
var val;
|
||||
|
||||
if (index === -1) {
|
||||
key = str;
|
||||
} else {
|
||||
key = str.substr(0, index);
|
||||
val = str.substr(index + 1);
|
||||
}
|
||||
|
||||
return [key, val];
|
||||
}
|
||||
|
||||
/**
|
||||
* Split an Accept header into media types.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function splitMediaTypes(accept) {
|
||||
var accepts = accept.split(',');
|
||||
|
||||
for (var i = 1, j = 0; i < accepts.length; i++) {
|
||||
if (quoteCount(accepts[j]) % 2 == 0) {
|
||||
accepts[++j] = accepts[i];
|
||||
} else {
|
||||
accepts[j] += ',' + accepts[i];
|
||||
}
|
||||
}
|
||||
|
||||
// trim accepts
|
||||
accepts.length = j + 1;
|
||||
|
||||
return accepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a string of parameters.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function splitParameters(str) {
|
||||
var parameters = str.split(';');
|
||||
|
||||
for (var i = 1, j = 0; i < parameters.length; i++) {
|
||||
if (quoteCount(parameters[j]) % 2 == 0) {
|
||||
parameters[++j] = parameters[i];
|
||||
} else {
|
||||
parameters[j] += ';' + parameters[i];
|
||||
}
|
||||
}
|
||||
|
||||
// trim parameters
|
||||
parameters.length = j + 1;
|
||||
|
||||
for (var i = 0; i < parameters.length; i++) {
|
||||
parameters[i] = parameters[i].trim();
|
||||
}
|
||||
|
||||
return parameters;
|
||||
}
|
84
node_modules/negotiator/package.json
generated
vendored
Normal file
84
node_modules/negotiator/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"_from": "negotiator@0.6.2",
|
||||
"_id": "negotiator@0.6.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
|
||||
"_location": "/negotiator",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "negotiator@0.6.2",
|
||||
"name": "negotiator",
|
||||
"escapedName": "negotiator",
|
||||
"rawSpec": "0.6.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.6.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/accepts"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
|
||||
"_shasum": "feacf7ccf525a77ae9634436a64883ffeca346fb",
|
||||
"_spec": "negotiator@0.6.2",
|
||||
"_where": "/home/martin/dev/multiview/node_modules/accepts",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/negotiator/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Federico Romero",
|
||||
"email": "federico.romero@outboxlabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "HTTP content negotiation",
|
||||
"devDependencies": {
|
||||
"eslint": "5.16.0",
|
||||
"eslint-plugin-markdown": "1.0.0",
|
||||
"mocha": "6.1.4",
|
||||
"nyc": "14.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/negotiator#readme",
|
||||
"keywords": [
|
||||
"http",
|
||||
"content negotiation",
|
||||
"accept",
|
||||
"accept-language",
|
||||
"accept-encoding",
|
||||
"accept-charset"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "negotiator",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/negotiator.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"test-travis": "nyc --reporter=text npm test"
|
||||
},
|
||||
"version": "0.6.2"
|
||||
}
|
21
node_modules/on-headers/HISTORY.md
generated
vendored
Normal file
21
node_modules/on-headers/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
1.0.2 / 2019-02-21
|
||||
==================
|
||||
|
||||
* Fix `res.writeHead` patch missing return value
|
||||
|
||||
1.0.1 / 2015-09-29
|
||||
==================
|
||||
|
||||
* perf: enable strict mode
|
||||
|
||||
1.0.0 / 2014-08-10
|
||||
==================
|
||||
|
||||
* Honor `res.statusCode` change in `listener`
|
||||
* Move to `jshttp` organization
|
||||
* Prevent `arguments`-related de-opt
|
||||
|
||||
0.0.0 / 2014-05-13
|
||||
==================
|
||||
|
||||
* Initial implementation
|
22
node_modules/on-headers/LICENSE
generated
vendored
Normal file
22
node_modules/on-headers/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 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.
|
81
node_modules/on-headers/README.md
generated
vendored
Normal file
81
node_modules/on-headers/README.md
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
# on-headers
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Execute a listener when a response is about to write headers.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install on-headers
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var onHeaders = require('on-headers')
|
||||
```
|
||||
|
||||
### onHeaders(res, listener)
|
||||
|
||||
This will add the listener `listener` to fire when headers are emitted for `res`.
|
||||
The listener is passed the `response` object as it's context (`this`). Headers are
|
||||
considered to be emitted only once, right before they are sent to the client.
|
||||
|
||||
When this is called multiple times on the same `res`, the `listener`s are fired
|
||||
in the reverse order they were added.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var onHeaders = require('on-headers')
|
||||
|
||||
http
|
||||
.createServer(onRequest)
|
||||
.listen(3000)
|
||||
|
||||
function addPoweredBy () {
|
||||
// set if not set by end of request
|
||||
if (!this.getHeader('X-Powered-By')) {
|
||||
this.setHeader('X-Powered-By', 'Node.js')
|
||||
}
|
||||
}
|
||||
|
||||
function onRequest (req, res) {
|
||||
onHeaders(res, addPoweredBy)
|
||||
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.end('hello!')
|
||||
}
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```sh
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-headers/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/on-headers
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/on-headers
|
||||
[npm-url]: https://npmjs.org/package/on-headers
|
||||
[npm-version-image]: https://badgen.net/npm/v/on-headers
|
||||
[travis-image]: https://badgen.net/travis/jshttp/on-headers/master
|
||||
[travis-url]: https://travis-ci.org/jshttp/on-headers
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user