Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
317570fe9d | ||
|
7ff47d8efc | ||
|
8d50dc1d54 | ||
|
075b55d5ec | ||
|
f83ca3dc04 | ||
|
c18d656eb1 | ||
|
d86454ffc4 | ||
|
57efbb5837 | ||
|
c65cfe14b2 | ||
|
01b0b5833c | ||
|
6949374b8e | ||
|
fab29a8f75 | ||
|
8352433fa5 | ||
|
e8fd5d1f7c | ||
|
cb1740c117 | ||
|
87054842de | ||
|
bdfc2984ee | ||
|
134d4e4cc0 | ||
|
6bc7ef86cc | ||
|
f902663904 | ||
|
88a6195fe8 | ||
|
916c50e162 | ||
|
52dc9a068f | ||
|
209e4da6f9 | ||
|
777a76e94e | ||
|
7e6f2505b4 | ||
|
4a0bd33a44 | ||
|
6e9377387d | ||
|
370d13cdc8 | ||
|
6a793007a3 | ||
|
d4c82cbff2 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/node_modules
|
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2016 Zeit, Inc.
|
Copyright (c) 2017 theKidOfArcrania
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
14
README.md
Normal file
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Blockly.IO
|
||||||
|
|
||||||
|
This is a clone of the original Paper-IO released by Voodoo, except for one aspect. This will attempt to implement a multi-player aspect of the game (like a real IO game). Currently this has a playground at this [link](https://thekidofarcrania.github.io/BlocklyIO). It's a demo version of what to come. Hopefully by that time, the necessary server infrastructure could be obtained.
|
||||||
|
|
||||||
|
This is just a fun side-project for me. If you would want to use this code, it would be nice to let me know.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
After cloning this repository, run the follow commands to install dependencies and set up server. Enjoy!
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
15
color.js
15
color.js
@@ -14,6 +14,10 @@ function Color(h, s, l, a)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color.fromData = function(data) {
|
||||||
|
return new Color(data.hue, data.sat, data.lum, data.alpha);
|
||||||
|
};
|
||||||
|
|
||||||
function verifyRange()
|
function verifyRange()
|
||||||
{
|
{
|
||||||
for (var i = 0; i < arguments.length; i++)
|
for (var i = 0; i < arguments.length; i++)
|
||||||
@@ -23,6 +27,17 @@ function verifyRange()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color.prototype.interpolateToString = function(color, amount)
|
||||||
|
{
|
||||||
|
var rgbThis = hslToRgb(this.hue, this.sat, this.lum);
|
||||||
|
var rgbThat = hslToRgb(color.hue, color.sat, color.lum);
|
||||||
|
var rgb = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < 3; i++)
|
||||||
|
rgb[i] = Math.floor((rgbThat[i] - rgbThis[i]) * amount + rgbThis[i]);
|
||||||
|
return {rgbString: function() {return 'rgb(' + rgb[0] + ', ' + rgb[1] + ', ' + rgb[2] + ')'}};
|
||||||
|
}
|
||||||
|
|
||||||
Color.prototype.deriveLumination = function(amount)
|
Color.prototype.deriveLumination = function(amount)
|
||||||
{
|
{
|
||||||
var lum = this.lum + amount;
|
var lum = this.lum + amount;
|
||||||
|
740
game-client.js
740
game-client.js
@@ -1,5 +1,15 @@
|
|||||||
|
/* global $ */
|
||||||
var Player = require("./player.js");
|
var Player = require("./player.js");
|
||||||
var Grid = require("./grid.js");
|
var client = require("./player-client.js");
|
||||||
|
var renderer = require("./game-renderer.js");
|
||||||
|
var consts = require("./game-consts.js");
|
||||||
|
var core = require("./game-core.js");
|
||||||
|
var io = require('socket.io-client');
|
||||||
|
|
||||||
|
var GRID_SIZE = consts.GRID_SIZE;
|
||||||
|
var CELL_WIDTH = consts.CELL_WIDTH;
|
||||||
|
|
||||||
|
renderer.allowAnimation = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides requestAnimationFrame in a cross browser way.
|
* Provides requestAnimationFrame in a cross browser way.
|
||||||
@@ -20,469 +30,73 @@ if ( !window.requestAnimationFrame ) {
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
client.connect(function(success, msg) {
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
console.info("Connected to game!");
|
||||||
|
$("#begin").addClass("hidden");
|
||||||
|
$("#begin").animate({
|
||||||
|
opacity: 0
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.error("Unable to connect to game: " + msg);
|
||||||
|
var error = $("#error");
|
||||||
|
error.text(msg);
|
||||||
|
norun = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var BORDER_WIDTH = 20;
|
var error = $("#error");
|
||||||
var GRID_SIZE = 80;
|
|
||||||
var CELL_WIDTH = 40;
|
|
||||||
var SPEED = 5;
|
|
||||||
var SHADOW_OFFSET = 5;
|
|
||||||
var ANIMATE_FRAMES = 24;
|
|
||||||
var BOUNCE_FRAMES = [8, 4];
|
|
||||||
var DROP_HEIGHT = 24;
|
|
||||||
var DROP_SPEED = 2;
|
|
||||||
var MIN_BAR_WIDTH = 65;
|
|
||||||
var BAR_HEIGHT = SHADOW_OFFSET + CELL_WIDTH;
|
|
||||||
var BAR_WIDTH = 400;
|
|
||||||
var canvas = $("#main-ui")[0];
|
|
||||||
var ctx = canvas.getContext('2d');
|
|
||||||
|
|
||||||
var canvasWidth = canvas.width = window.innerWidth;
|
if (!window.WebSocket)
|
||||||
var canvasHeight = canvas.height = window.innerHeight - 20;
|
{
|
||||||
canvas.style.marginTop = 20 / 2;
|
error.text("Your browser does not support WebSockets!");
|
||||||
|
|
||||||
var gameWidth = canvasWidth;
|
|
||||||
var gameHeight = canvasHeight - BAR_HEIGHT;
|
|
||||||
|
|
||||||
var newPlayerFrames = [];
|
|
||||||
var playerPortion = [];
|
|
||||||
var allPlayers = [];
|
|
||||||
var players = [];
|
|
||||||
var animateOff = false;
|
|
||||||
var animateGrid = new Grid(GRID_SIZE);
|
|
||||||
var grid = new Grid(GRID_SIZE, function(row, col, before, after) {
|
|
||||||
//Keep track of areas.
|
|
||||||
if (before)
|
|
||||||
playerPortion[before.num]--;
|
|
||||||
if (after)
|
|
||||||
playerPortion[after.num]++;
|
|
||||||
|
|
||||||
//Queue animation
|
|
||||||
if (before === after || animateOff)
|
|
||||||
return;
|
return;
|
||||||
animateGrid.set(row, col, {
|
}
|
||||||
before: before,
|
|
||||||
after: after,
|
error.text("Loading..."); //TODO: show loading screen.
|
||||||
frame: 0
|
var success = false;
|
||||||
});
|
var socket = io('http://' + window.location.hostname + ':8081', {
|
||||||
|
'forceNew': true,
|
||||||
|
upgrade: false,
|
||||||
|
transports: ['websocket']
|
||||||
});
|
});
|
||||||
|
|
||||||
//Load players.
|
socket.on('connect_error', function() {
|
||||||
for (var p = 0; p < 9; p++)
|
if (!success)
|
||||||
{
|
error.text("Cannot connect with server. This probably is due to misconfigured proxy server. (Try using a different browser)");
|
||||||
//TODO: socket loading.
|
})
|
||||||
var pRow = getRandomInt(0, GRID_SIZE);
|
socket.emit("checkConn", function() {
|
||||||
var pCol = getRandomInt(0, GRID_SIZE);
|
success = true;
|
||||||
var sdata = {
|
socket.disconnect();
|
||||||
posX: pCol * CELL_WIDTH,
|
});
|
||||||
posY: pRow * CELL_WIDTH,
|
setTimeout(function() {
|
||||||
currentHeading: getRandomInt(0, 4),
|
if (!success)
|
||||||
//name: ...,
|
error.text("Cannot connect with server. This probably is due to misconfigured proxy server. (Try using a different browser)");
|
||||||
num: p
|
|
||||||
}
|
|
||||||
|
|
||||||
playerPortion[p] = 0;
|
|
||||||
allPlayers[p] = players[p] = new Player(true, grid, sdata);
|
|
||||||
|
|
||||||
for (var dr = -1; dr <= 1; dr++)
|
|
||||||
for (var dc = -1; dc <= 1; dc++)
|
|
||||||
if (!grid.isOutOfBounds(dr + pRow, dc + pCol))
|
|
||||||
grid.set(dr + pRow, dc + pCol, players[p]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Load grid.
|
|
||||||
for (var r = 0; r < grid.size; r++)
|
|
||||||
{
|
|
||||||
for (var c = 0; c < grid.size; c++)
|
|
||||||
{
|
|
||||||
//TODO: load data.
|
|
||||||
//if (Math.random() > .9)
|
|
||||||
// grid.set(r, c, players[getRandomInt(0, players.length)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
animateOff = false;
|
|
||||||
|
|
||||||
var frameCount = 0;
|
|
||||||
var animateTo = [0, 0];
|
|
||||||
var offset = [0, 0];
|
|
||||||
|
|
||||||
var userPortion = 0;
|
|
||||||
var lagPortion = 0;
|
|
||||||
var portionSpeed = 0;
|
|
||||||
|
|
||||||
//TODO: current player index
|
|
||||||
var user = players[0];
|
|
||||||
|
|
||||||
centerOnPlayer(user, offset);
|
|
||||||
|
|
||||||
function update()
|
|
||||||
{
|
|
||||||
//Change grid offsets.
|
|
||||||
for (var i = 0; i <= 1; i++)
|
|
||||||
{
|
|
||||||
if (animateTo[i] !== offset[i])
|
|
||||||
{
|
|
||||||
var delta = animateTo[i] - offset[i];
|
|
||||||
var dir = Math.sign(delta);
|
|
||||||
var mag = Math.min(SPEED, Math.abs(delta));
|
|
||||||
offset[i] += dir * mag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Change area percentage
|
|
||||||
if (lagPortion !== userPortion)
|
|
||||||
{
|
|
||||||
delta = userPortion - lagPortion;
|
|
||||||
dir = Math.sign(delta);
|
|
||||||
mag = Math.min(Math.abs(portionSpeed), Math.abs(delta));
|
|
||||||
lagPortion += dir * mag;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Move players.
|
|
||||||
var dead = [];
|
|
||||||
players = players.filter(function(val) {
|
|
||||||
if (!newPlayerFrames[val.num])
|
|
||||||
newPlayerFrames[val.num] = 0;
|
|
||||||
|
|
||||||
if (newPlayerFrames[val.num] < ANIMATE_FRAMES)
|
|
||||||
newPlayerFrames[val.num]++;
|
|
||||||
else
|
else
|
||||||
val.move();
|
{
|
||||||
|
error.text("");
|
||||||
if (val.dead)
|
$("input").keypress(function(evt) {
|
||||||
dead.push(val);
|
if (evt.which === 13)
|
||||||
return !val.dead;
|
requestAnimationFrame(run);
|
||||||
|
});
|
||||||
|
$("button").click(function(evt) {
|
||||||
|
requestAnimationFrame(run);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Remove players with collisions.
|
var user, socket, frame;
|
||||||
var removing = [];
|
|
||||||
for (var i = 0; i < players.length; i++)
|
|
||||||
{
|
|
||||||
for (var j = i; j < players.length; j++)
|
|
||||||
{
|
|
||||||
|
|
||||||
//Remove those players when other players have hit their tail.
|
|
||||||
if (!removing[j] && players[j].tail.hitsTail(players[i]))
|
|
||||||
removing[j] = true;
|
|
||||||
if (!removing[i] && players[i].tail.hitsTail(players[j]))
|
|
||||||
removing[i] = true;
|
|
||||||
|
|
||||||
//Remove players with collisons...
|
|
||||||
if (i !== j && squaresIntersect(players[i].startX, players[j].startX) &&
|
|
||||||
squaresIntersect(players[i].startY, players[j].startY))
|
|
||||||
{
|
|
||||||
//...if one player is own his own territory, the other is out.
|
|
||||||
if (grid.get(players[i].row, players[i].col) === players[i])
|
|
||||||
removing[j] = true;
|
|
||||||
else if (grid.get(players[j].row, players[j].col) === players[j])
|
|
||||||
removing[i] = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//...otherwise, the one that sustains most of the collision will be removed.
|
|
||||||
var areaI = area(players[i]);
|
|
||||||
var areaJ = area(players[j]);
|
|
||||||
|
|
||||||
if (areaI === areaJ)
|
|
||||||
removing[i] = removing[j] = true;
|
|
||||||
else if (areaI > areaJ)
|
|
||||||
removing[i] = true;
|
|
||||||
else
|
|
||||||
removing[j] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
players = players.filter(function(val, i) {
|
|
||||||
if (removing[i])
|
|
||||||
{
|
|
||||||
dead.push(val);
|
|
||||||
val.die();
|
|
||||||
}
|
|
||||||
return !removing[i];
|
|
||||||
});
|
|
||||||
|
|
||||||
dead.forEach(function(val) {
|
|
||||||
console.log(val.name + " is dead");
|
|
||||||
allPlayers[val.num] = undefined;
|
|
||||||
});
|
|
||||||
for (var r = 0; r < grid.size; r++)
|
|
||||||
{
|
|
||||||
for (var c = 0; c < grid.size; c++)
|
|
||||||
{
|
|
||||||
if (dead.indexOf(grid.get(r, c)) !== -1)
|
|
||||||
grid.set(r, c, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update user's portions and top ranks.
|
|
||||||
userPortion = playerPortion[user.num] / (GRID_SIZE * GRID_SIZE);
|
|
||||||
portionSpeed = Math.abs(userPortion - lagPortion) / ANIMATE_FRAMES;
|
|
||||||
|
|
||||||
//TODO: animate player is dead. (maybe explosion?)
|
|
||||||
//TODO: show when this player is dead
|
|
||||||
centerOnPlayer(user, animateTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
function centerOnPlayer(player, pos)
|
|
||||||
{
|
|
||||||
var xOff = Math.floor(player.posX - (gameWidth - CELL_WIDTH) / 2);
|
|
||||||
var yOff = Math.floor(player.posY - (gameHeight - CELL_WIDTH) / 2);
|
|
||||||
pos[0] = Math.max(Math.min(xOff, grid.size * CELL_WIDTH + BORDER_WIDTH * 2 - gameWidth), 0);
|
|
||||||
pos[1] = Math.max(Math.min(yOff, grid.size * CELL_WIDTH + BORDER_WIDTH * 2 - gameHeight), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function area(player)
|
|
||||||
{
|
|
||||||
var xDest = player.col * CELL_WIDTH;
|
|
||||||
var yDest = player.row * CELL_WIDTH;
|
|
||||||
|
|
||||||
if (player.startX === xDest)
|
|
||||||
return Math.abs(player.startY - yDest);
|
|
||||||
else
|
|
||||||
return Math.abs(player.startX - xDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Thanks to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
|
|
||||||
function getRandomInt(min, max) {
|
|
||||||
min = Math.ceil(min);
|
|
||||||
max = Math.floor(max);
|
|
||||||
return Math.floor(Math.random() * (max - min)) + min;
|
|
||||||
}
|
|
||||||
|
|
||||||
function squaresIntersect(a, b)
|
|
||||||
{
|
|
||||||
if (a < b)
|
|
||||||
return b < a + CELL_WIDTH;
|
|
||||||
else
|
|
||||||
return a < b + CELL_WIDTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
function paintGridBorder()
|
|
||||||
{
|
|
||||||
ctx.fillStyle = 'lightgray';
|
|
||||||
var gridWidth = CELL_WIDTH * GRID_SIZE;
|
|
||||||
|
|
||||||
ctx.fillRect(-BORDER_WIDTH, 0, BORDER_WIDTH, gridWidth);
|
|
||||||
ctx.fillRect(-BORDER_WIDTH, -BORDER_WIDTH, gridWidth + BORDER_WIDTH * 2, BORDER_WIDTH);
|
|
||||||
ctx.fillRect(gridWidth, 0, BORDER_WIDTH, gridWidth);
|
|
||||||
ctx.fillRect(-BORDER_WIDTH, gridWidth, gridWidth + BORDER_WIDTH * 2, BORDER_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
function paintGridLines()
|
|
||||||
{
|
|
||||||
ctx.fillStyle = 'lightgray';
|
|
||||||
ctx.beginPath();
|
|
||||||
for (var x = modRotate(-offset[0], CELL_WIDTH); x < gameWidth; x += CELL_WIDTH)
|
|
||||||
{
|
|
||||||
ctx.moveTo(x, 0);
|
|
||||||
ctx.lineTo(x, gameHeight);
|
|
||||||
}
|
|
||||||
for (var y = modRotate(-offset[1], CELL_WIDTH); y < gameHeight; y+= CELL_WIDTH)
|
|
||||||
{
|
|
||||||
ctx.moveTo(0, y);
|
|
||||||
ctx.lineTo(gameWidth, y);
|
|
||||||
}
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function modRotate(val, mod)
|
|
||||||
{
|
|
||||||
var res = val % mod;
|
|
||||||
if (res >= 0)
|
|
||||||
return res;
|
|
||||||
else
|
|
||||||
return mod + res;
|
|
||||||
}
|
|
||||||
|
|
||||||
function paintGrid()
|
|
||||||
{
|
|
||||||
//Paint background.
|
|
||||||
ctx.fillStyle = "#e2ebf3";
|
|
||||||
ctx.fillRect(0, 0, CELL_WIDTH * GRID_SIZE, CELL_WIDTH * GRID_SIZE);
|
|
||||||
|
|
||||||
paintGridBorder();
|
|
||||||
//paintGridLines();
|
|
||||||
|
|
||||||
//Get viewing limits
|
|
||||||
var minRow = Math.max(Math.floor((offset[1] - BORDER_WIDTH) / CELL_WIDTH), 0);
|
|
||||||
var minCol = Math.max(Math.floor((offset[0] - BORDER_WIDTH) / CELL_WIDTH), 0);
|
|
||||||
var maxRow = Math.min(Math.ceil((offset[1] + gameHeight) / CELL_WIDTH), grid.size);
|
|
||||||
var maxCol = Math.min(Math.ceil((offset[0] + gameWidth) / CELL_WIDTH), grid.size);
|
|
||||||
|
|
||||||
//Paint occupied areas. (and fading ones).
|
|
||||||
for (var r = minRow; r < maxRow; r++)
|
|
||||||
{
|
|
||||||
for (var c = minCol; c < maxCol; c++)
|
|
||||||
{
|
|
||||||
var p = grid.get(r, c);
|
|
||||||
var x = c * CELL_WIDTH, y = r * CELL_WIDTH, baseColor, shadowColor;
|
|
||||||
|
|
||||||
var animateSpec = animateGrid.get(r, c);
|
|
||||||
if (!animateOff && animateSpec)
|
|
||||||
{
|
|
||||||
if (animateSpec.before) //fading animation
|
|
||||||
{
|
|
||||||
var alpha = 1 - (animateSpec.frame / ANIMATE_FRAMES);
|
|
||||||
baseColor = animateSpec.before.baseColor.deriveAlpha(alpha);
|
|
||||||
shadowColor = animateSpec.before.shadowColor.deriveAlpha(alpha);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (p)
|
|
||||||
{
|
|
||||||
baseColor = p.baseColor;
|
|
||||||
shadowColor = p.shadowColor;
|
|
||||||
}
|
|
||||||
else //No animation nor is this player owned.
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var hasBottom = !grid.isOutOfBounds(r + 1, c);
|
|
||||||
var bottomAnimate = hasBottom && animateGrid.get(r + 1, c);
|
|
||||||
var bottomEmpty = !bottomAnimate || (bottomAnimate.after && bottomAnimate.before);
|
|
||||||
if (hasBottom && ((!!bottomAnimate ^ !!animateSpec) || bottomEmpty))
|
|
||||||
{
|
|
||||||
ctx.fillStyle = shadowColor.rgbString();
|
|
||||||
ctx.fillRect(x, y + CELL_WIDTH, CELL_WIDTH, SHADOW_OFFSET);
|
|
||||||
}
|
|
||||||
ctx.fillStyle = baseColor.rgbString();
|
|
||||||
ctx.fillRect(x, y, CELL_WIDTH, CELL_WIDTH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (animateOff)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//Paint squares with drop in animation.
|
|
||||||
for (var r = 0; r < grid.size; r++)
|
|
||||||
{
|
|
||||||
for (var c = 0; c < grid.size; c++)
|
|
||||||
{
|
|
||||||
animateSpec = animateGrid.get(r, c);
|
|
||||||
x = c * CELL_WIDTH, y = r * CELL_WIDTH;
|
|
||||||
|
|
||||||
if (animateSpec && !animateOff)
|
|
||||||
{
|
|
||||||
var viewable = r >= minRow && r < maxRow && c >= minCol && c < maxCol;
|
|
||||||
if (animateSpec.after && viewable)
|
|
||||||
{
|
|
||||||
//Bouncing the squares.
|
|
||||||
var offsetBounce = getBounceOffset(animateSpec.frame);
|
|
||||||
y -= offsetBounce;
|
|
||||||
|
|
||||||
shadowColor = animateSpec.after.shadowColor;
|
|
||||||
baseColor = animateSpec.after.baseColor.deriveLumination(-(offsetBounce / DROP_HEIGHT) * .1);
|
|
||||||
|
|
||||||
ctx.fillStyle = shadowColor.rgbString();
|
|
||||||
ctx.fillRect(x, y + SHADOW_OFFSET, CELL_WIDTH, CELL_WIDTH);
|
|
||||||
ctx.fillStyle = baseColor.rgbString();
|
|
||||||
ctx.fillRect(x, y, CELL_WIDTH, CELL_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
animateSpec.frame++;
|
|
||||||
if (animateSpec.frame >= ANIMATE_FRAMES)
|
|
||||||
animateGrid.set(r, c, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBounceOffset(frame)
|
|
||||||
{
|
|
||||||
var offsetBounce = ANIMATE_FRAMES;
|
|
||||||
var bounceNum = BOUNCE_FRAMES.length - 1;
|
|
||||||
while (bounceNum >= 0 && frame < offsetBounce - BOUNCE_FRAMES[bounceNum])
|
|
||||||
{
|
|
||||||
offsetBounce -= BOUNCE_FRAMES[bounceNum];
|
|
||||||
bounceNum--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bounceNum === -1)
|
|
||||||
{
|
|
||||||
return (offsetBounce - frame) * DROP_SPEED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offsetBounce -= BOUNCE_FRAMES[bounceNum];
|
|
||||||
frame = frame - offsetBounce;
|
|
||||||
var midFrame = BOUNCE_FRAMES[bounceNum] / 2;
|
|
||||||
if (frame >= midFrame)
|
|
||||||
return (BOUNCE_FRAMES[bounceNum] - frame) * DROP_SPEED;
|
|
||||||
else
|
|
||||||
return frame * DROP_SPEED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var showedDead = false;
|
|
||||||
function paintLoop()
|
|
||||||
{
|
|
||||||
ctx.fillStyle = 'whitesmoke';
|
|
||||||
ctx.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
||||||
|
|
||||||
//Draw the grid items.
|
|
||||||
ctx.save();
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.translate(-offset[0] + BORDER_WIDTH, -offset[1] + BORDER_WIDTH + BAR_HEIGHT);
|
|
||||||
ctx.rect(offset[0] - BORDER_WIDTH, offset[1] - BORDER_WIDTH, canvasWidth, canvasHeight);
|
|
||||||
ctx.clip();
|
|
||||||
paintGrid();
|
|
||||||
players.forEach(function (p) {
|
|
||||||
var fr = newPlayerFrames[p.num] || 0;
|
|
||||||
if (fr < ANIMATE_FRAMES)
|
|
||||||
p.render(ctx, fr / ANIMATE_FRAMES);
|
|
||||||
else
|
|
||||||
p.render(ctx);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Reset transform to paint fixed UI elements
|
|
||||||
ctx.restore();
|
|
||||||
|
|
||||||
//UI Bar background
|
|
||||||
ctx.fillStyle = "#24422c";
|
|
||||||
ctx.fillRect(0, 0, canvasWidth, BAR_HEIGHT);
|
|
||||||
|
|
||||||
var barOffset;
|
|
||||||
ctx.fillStyle = "white";
|
|
||||||
ctx.font = "24px Arial";
|
|
||||||
barOffset = ctx.measureText(user.name).width + 10;
|
|
||||||
ctx.fillText(user.name, 5, CELL_WIDTH - 5);
|
|
||||||
|
|
||||||
//Draw filled bar.
|
|
||||||
ctx.fillStyle = "rgba(180, 180, 180, .3)";
|
|
||||||
ctx.fillRect(barOffset, 0, BAR_WIDTH, BAR_HEIGHT);
|
|
||||||
|
|
||||||
var barSize = Math.ceil((BAR_WIDTH - MIN_BAR_WIDTH) * lagPortion + MIN_BAR_WIDTH);
|
|
||||||
ctx.fillStyle = user.baseColor.rgbString();
|
|
||||||
ctx.fillRect(barOffset, 0, barSize, CELL_WIDTH);
|
|
||||||
ctx.fillStyle = user.shadowColor.rgbString();
|
|
||||||
ctx.fillRect(barOffset, CELL_WIDTH, barSize, SHADOW_OFFSET);
|
|
||||||
|
|
||||||
//Percentage
|
|
||||||
ctx.fillStyle = "white";
|
|
||||||
ctx.font = "18px Arial";
|
|
||||||
ctx.fillText((lagPortion * 100).toFixed(3) + "%", 5 + barOffset, CELL_WIDTH - 5);
|
|
||||||
|
|
||||||
if (user.dead && !showedDead)
|
|
||||||
{
|
|
||||||
showedDead = true;
|
|
||||||
console.log("You died!");
|
|
||||||
//return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: sync each loop with server. (server will give frame count.)
|
|
||||||
frameCount++;
|
|
||||||
update();
|
|
||||||
requestAnimationFrame(paintLoop);
|
|
||||||
}
|
|
||||||
paintLoop();
|
|
||||||
|
|
||||||
|
|
||||||
//Event listeners
|
//Event listeners
|
||||||
$(document).keydown(function(e) {
|
$(document).keydown(function(e) {
|
||||||
if (user.dead)
|
if (!user || user.dead)
|
||||||
return;
|
return;
|
||||||
var newHeading = -1;
|
var newHeading = -1;
|
||||||
switch (e.which)
|
switch (e.which)
|
||||||
@@ -497,9 +111,227 @@ $(function() {
|
|||||||
if (newHeading === user.currentHeading || ((newHeading % 2 === 0) ^
|
if (newHeading === user.currentHeading || ((newHeading % 2 === 0) ^
|
||||||
(user.currentHeading % 2 === 0)))
|
(user.currentHeading % 2 === 0)))
|
||||||
{
|
{
|
||||||
//TODO: notify server.
|
//user.heading = newHeading;
|
||||||
user.heading = newHeading;
|
if (socket)
|
||||||
|
socket.emit("frame", {
|
||||||
|
frame: frame,
|
||||||
|
heading: newHeading
|
||||||
|
}, function(success, msg) {
|
||||||
|
if (!success)
|
||||||
|
console.error(msg);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var grid = renderer.grid;
|
||||||
|
var timeout = undefined;
|
||||||
|
var dirty = false;
|
||||||
|
var deadFrames = 0;
|
||||||
|
var requesting = -1; //frame that we are requesting at.
|
||||||
|
var frameCache = []; //Frames after our request.
|
||||||
|
|
||||||
|
function connectServer() {
|
||||||
|
io.j = [];
|
||||||
|
io.sockets = [];
|
||||||
|
socket = io('http://' + window.location.hostname + ':8081', {
|
||||||
|
'forceNew': true,
|
||||||
|
upgrade: false,
|
||||||
|
transports: ['websocket']
|
||||||
});
|
});
|
||||||
|
socket.on('connect', function(){
|
||||||
|
console.info("Connected to server.");
|
||||||
|
});
|
||||||
|
socket.on('game', function(data) {
|
||||||
|
if (timeout != undefined)
|
||||||
|
clearTimeout(timeout);
|
||||||
|
|
||||||
|
//Initialize game.
|
||||||
|
//TODO: display data.gameid --- game id #
|
||||||
|
frame = data.frame;
|
||||||
|
renderer.reset();
|
||||||
|
|
||||||
|
//Load players.
|
||||||
|
data.players.forEach(function(p) {
|
||||||
|
var pl = new Player(grid, p);
|
||||||
|
renderer.addPlayer(pl);
|
||||||
|
});
|
||||||
|
user = renderer.getPlayerFromNum(data.num);
|
||||||
|
if (!user) throw new Error();
|
||||||
|
renderer.setUser(user);
|
||||||
|
|
||||||
|
//Load grid.
|
||||||
|
var gridData = new Uint8Array(data.grid);
|
||||||
|
for (var r = 0; r < grid.size; r++)
|
||||||
|
for (var c = 0; c < grid.size; c++)
|
||||||
|
{
|
||||||
|
var ind = gridData[r * grid.size + c] - 1;
|
||||||
|
grid.set(r, c, ind === -1 ? null : renderer.getPlayer(ind));
|
||||||
|
}
|
||||||
|
|
||||||
|
renderer.paint();
|
||||||
|
frame = data.frame;
|
||||||
|
|
||||||
|
if (requesting !== -1)
|
||||||
|
{
|
||||||
|
//Update those cache frames after we updated game.
|
||||||
|
var minFrame = requesting;
|
||||||
|
requesting = -1;
|
||||||
|
while (frameCache.length > frame - minFrame)
|
||||||
|
processFrame(frameCache[frame - minFrame]);
|
||||||
|
frameCache = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('notifyFrame', processFrame);
|
||||||
|
|
||||||
|
socket.on('dead', function() {
|
||||||
|
socket.disconnect(); //In case we didn't get the disconnect call.
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('disconnect', function(){
|
||||||
|
if (!user)
|
||||||
|
return;
|
||||||
|
console.info("Server has disconnected. Creating new game.");
|
||||||
|
socket.disconnect();
|
||||||
|
user.die();
|
||||||
|
dirty = true;
|
||||||
|
paintLoop();
|
||||||
|
|
||||||
|
//TODO: Show score stats.
|
||||||
|
//Show score stats.
|
||||||
|
$("#stats").removeClass("hidden");
|
||||||
|
$("#stats").animate({
|
||||||
|
opacity: .9999
|
||||||
|
}, 3000, function() {
|
||||||
|
showStats();
|
||||||
|
});
|
||||||
|
|
||||||
|
//Then fade back into the login screen.
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showStats() {
|
||||||
|
$("#begin").removeClass("hidden");
|
||||||
|
$("#begin").animate({
|
||||||
|
opacity: .9999
|
||||||
|
}, 1000, function() {
|
||||||
|
$("#stats").addClass("hidden").css("opacity", 0);
|
||||||
|
norun = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function processFrame(data)
|
||||||
|
{
|
||||||
|
if (timeout != undefined)
|
||||||
|
clearTimeout(timeout);
|
||||||
|
|
||||||
|
if (requesting !== -1 && requesting < data.frame)
|
||||||
|
{
|
||||||
|
frameCache.push(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.frame - 1 !== frame)
|
||||||
|
{
|
||||||
|
console.error("Frames don't match up!");
|
||||||
|
socket.emit('requestFrame'); //Restore data.
|
||||||
|
requesting = data.frame;
|
||||||
|
frameCache.push(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
if (data.newPlayers)
|
||||||
|
{
|
||||||
|
data.newPlayers.forEach(function(p) {
|
||||||
|
if (p.num === user.num)
|
||||||
|
return;
|
||||||
|
var pl = new Player(grid, p);
|
||||||
|
renderer.addPlayer(pl);
|
||||||
|
core.initPlayer(grid, pl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var found = new Array(renderer.playerSize());
|
||||||
|
data.moves.forEach(function(val, i) {
|
||||||
|
var player = renderer.getPlayerFromNum(val.num);
|
||||||
|
if (!player) return;
|
||||||
|
if (val.left) player.die();
|
||||||
|
found[i] = true;
|
||||||
|
player.heading = val.heading;
|
||||||
|
});
|
||||||
|
for (var i = 0; i < renderer.playerSize(); i++)
|
||||||
|
{
|
||||||
|
//Implicitly leaving game.
|
||||||
|
if (!found[i])
|
||||||
|
{
|
||||||
|
var player = renderer.getPlayer();
|
||||||
|
player && player.die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderer.update();
|
||||||
|
|
||||||
|
var locs = {};
|
||||||
|
for (var i = 0; i < renderer.playerSize(); i++)
|
||||||
|
{
|
||||||
|
var p = renderer.getPlayer(i);
|
||||||
|
locs[p.num] = [p.posX, p.posY, p.waitLag];
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.emit("verify", {
|
||||||
|
frame: frame,
|
||||||
|
locs: locs
|
||||||
|
}, function(frame, success, adviceFix, msg) {
|
||||||
|
if (!success && requesting === -1)
|
||||||
|
{
|
||||||
|
console.error(frame + ": " + msg);
|
||||||
|
if (adviceFix)
|
||||||
|
socket.emit('requestFrame');
|
||||||
|
}
|
||||||
|
}.bind(this, frame));
|
||||||
|
|
||||||
|
dirty = true;
|
||||||
|
requestAnimationFrame(function() {
|
||||||
|
paintLoop();
|
||||||
|
});
|
||||||
|
timeout = setTimeout(function() {
|
||||||
|
console.warn("Server has timed-out. Disconnecting.");
|
||||||
|
socket.disconnect();
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function paintLoop()
|
||||||
|
{
|
||||||
|
if (!dirty)
|
||||||
|
return;
|
||||||
|
renderer.paint();
|
||||||
|
dirty = false;
|
||||||
|
|
||||||
|
if (user.dead)
|
||||||
|
{
|
||||||
|
if (timeout)
|
||||||
|
clearTimeout(timeout);
|
||||||
|
if (deadFrames === 60) //One second of frame
|
||||||
|
{
|
||||||
|
var before = renderer.allowAnimation;
|
||||||
|
renderer.allowAnimation = false;
|
||||||
|
renderer.update();
|
||||||
|
renderer.paint();
|
||||||
|
renderer.allowAnimation = before;
|
||||||
|
user = null;
|
||||||
|
deadFrames = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.disconnect();
|
||||||
|
deadFrames++;
|
||||||
|
dirty = true;
|
||||||
|
renderer.update();
|
||||||
|
requestAnimationFrame(paintLoop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
17
game-consts.js
Normal file
17
game-consts.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
function constant(val)
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
value: val,
|
||||||
|
enumerable: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var consts = {
|
||||||
|
GRID_SIZE: constant(80),
|
||||||
|
CELL_WIDTH: constant(40),
|
||||||
|
SPEED: constant(5),
|
||||||
|
BORDER_WIDTH: constant(20),
|
||||||
|
MAX_PLAYERS: constant(81)
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.defineProperties(module.exports, consts);
|
135
game-core.js
Normal file
135
game-core.js
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
var ANIMATE_FRAMES = 24;
|
||||||
|
var CELL_WIDTH = 40;
|
||||||
|
|
||||||
|
//TODO: remove constants.
|
||||||
|
exports.initPlayer = function(grid, player)
|
||||||
|
{
|
||||||
|
for (var dr = -1; dr <= 1; dr++)
|
||||||
|
for (var dc = -1; dc <= 1; dc++)
|
||||||
|
if (!grid.isOutOfBounds(dr + player.row, dc + player.col))
|
||||||
|
grid.set(dr + player.row, dc + player.col, player);
|
||||||
|
};
|
||||||
|
exports.updateFrame = function(grid, players, dead, notifyKill)
|
||||||
|
{
|
||||||
|
var adead = [];
|
||||||
|
if (dead instanceof Array)
|
||||||
|
adead = dead;
|
||||||
|
|
||||||
|
var kill;
|
||||||
|
if (!notifyKill)
|
||||||
|
kill = function() {};
|
||||||
|
else
|
||||||
|
kill = function(killer, other) {if (!removing[other]) notifyKill(killer, other);};
|
||||||
|
|
||||||
|
//Move players.
|
||||||
|
var tmp = players.filter(function(val) {
|
||||||
|
val.move();
|
||||||
|
if (val.dead)
|
||||||
|
adead.push(val);
|
||||||
|
return !val.dead;
|
||||||
|
});
|
||||||
|
|
||||||
|
//Remove players with collisions.
|
||||||
|
var removing = new Array(players.length);
|
||||||
|
for (var i = 0; i < players.length; i++)
|
||||||
|
{
|
||||||
|
for (var j = i; j < players.length; j++)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Remove those players when other players have hit their tail.
|
||||||
|
if (!removing[j] && players[j].tail.hitsTail(players[i]))
|
||||||
|
{
|
||||||
|
kill(i, j);
|
||||||
|
removing[j] = true;
|
||||||
|
//console.log("TAIL");
|
||||||
|
}
|
||||||
|
if (!removing[i] && players[i].tail.hitsTail(players[j]))
|
||||||
|
{
|
||||||
|
kill(j, i);
|
||||||
|
removing[i] = true;
|
||||||
|
//console.log("TAIL");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Remove players with collisons...
|
||||||
|
if (i !== j && squaresIntersect(players[i].posX, players[j].posX) &&
|
||||||
|
squaresIntersect(players[i].posY, players[j].posY))
|
||||||
|
{
|
||||||
|
//...if one player is own his own territory, the other is out.
|
||||||
|
if (grid.get(players[i].row, players[i].col) === players[i])
|
||||||
|
{
|
||||||
|
kill(i, j);
|
||||||
|
removing[j] = true;
|
||||||
|
}
|
||||||
|
else if (grid.get(players[j].row, players[j].col) === players[j])
|
||||||
|
{
|
||||||
|
kill(j, i);
|
||||||
|
removing[i] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//...otherwise, the one that sustains most of the collision will be removed.
|
||||||
|
var areaI = area(players[i]);
|
||||||
|
var areaJ = area(players[j]);
|
||||||
|
|
||||||
|
if (areaI === areaJ)
|
||||||
|
{
|
||||||
|
kill(i, j);
|
||||||
|
kill(j, i);
|
||||||
|
removing[i] = removing[j] = true;
|
||||||
|
}
|
||||||
|
else if (areaI > areaJ)
|
||||||
|
{
|
||||||
|
kill(j, i);
|
||||||
|
removing[i] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kill(i, j);
|
||||||
|
removing[j] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = tmp.filter(function(val, i) {
|
||||||
|
if (removing[i])
|
||||||
|
{
|
||||||
|
adead.push(val);
|
||||||
|
val.die();
|
||||||
|
}
|
||||||
|
return !removing[i];
|
||||||
|
});
|
||||||
|
players.length = tmp.length;
|
||||||
|
for (var i = 0; i < tmp.length; i++)
|
||||||
|
players[i] = tmp[i];
|
||||||
|
|
||||||
|
//Remove dead squares.
|
||||||
|
for (var r = 0; r < grid.size; r++)
|
||||||
|
{
|
||||||
|
for (var c = 0; c < grid.size; c++)
|
||||||
|
{
|
||||||
|
if (adead.indexOf(grid.get(r, c)) !== -1)
|
||||||
|
grid.set(r, c, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function squaresIntersect(a, b)
|
||||||
|
{
|
||||||
|
if (a < b)
|
||||||
|
return b < a + CELL_WIDTH;
|
||||||
|
else
|
||||||
|
return a < b + CELL_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
function area(player)
|
||||||
|
{
|
||||||
|
var xDest = player.col * CELL_WIDTH;
|
||||||
|
var yDest = player.row * CELL_WIDTH;
|
||||||
|
|
||||||
|
if (player.posX === xDest)
|
||||||
|
return Math.abs(player.posY - yDest);
|
||||||
|
else
|
||||||
|
return Math.abs(player.posX - xDest);
|
||||||
|
}
|
478
game-renderer.js
Normal file
478
game-renderer.js
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
/* global $ */
|
||||||
|
var Rolling = require("./rolling.js");
|
||||||
|
var Color = require("./color.js");
|
||||||
|
var Grid = require("./grid.js");
|
||||||
|
var consts = require("./game-consts.js");
|
||||||
|
var core = require("./game-core.js");
|
||||||
|
|
||||||
|
var GRID_SIZE = consts.GRID_SIZE;
|
||||||
|
var CELL_WIDTH = consts.CELL_WIDTH;
|
||||||
|
var SPEED = consts.SPEED;
|
||||||
|
var BORDER_WIDTH = consts.BORDER_WIDTH;
|
||||||
|
var SHADOW_OFFSET = 5;
|
||||||
|
var ANIMATE_FRAMES = 24;
|
||||||
|
var BOUNCE_FRAMES = [8, 4];
|
||||||
|
var DROP_HEIGHT = 24;
|
||||||
|
var DROP_SPEED = 2;
|
||||||
|
var MIN_BAR_WIDTH = 65;
|
||||||
|
var BAR_HEIGHT = SHADOW_OFFSET + CELL_WIDTH;
|
||||||
|
var BAR_WIDTH = 400;
|
||||||
|
|
||||||
|
|
||||||
|
var canvas, canvasWidth, canvasHeight, gameWidth, gameHeight, ctx, offctx, offscreenCanvas;
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
canvas = $("#main-ui")[0];
|
||||||
|
ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
offscreenCanvas = document.createElement("canvas");
|
||||||
|
offctx = offscreenCanvas.getContext('2d');
|
||||||
|
|
||||||
|
canvas.style.marginTop = 10;
|
||||||
|
updateSize();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var allowAnimation = true;
|
||||||
|
var animateGrid, players, allPlayers, playerPortion, portionsRolling,
|
||||||
|
barProportionRolling, grid, animateTo, offset, user, zoom, kills, showedDead;
|
||||||
|
|
||||||
|
grid = new Grid(GRID_SIZE, function(row, col, before, after) {
|
||||||
|
//Keep track of areas.
|
||||||
|
if (before)
|
||||||
|
playerPortion[before.num]--;
|
||||||
|
if (after)
|
||||||
|
playerPortion[after.num]++;
|
||||||
|
|
||||||
|
//Queue animation
|
||||||
|
if (before === after || !allowAnimation)
|
||||||
|
return;
|
||||||
|
animateGrid.set(row, col, {
|
||||||
|
before: before,
|
||||||
|
after: after,
|
||||||
|
frame: 0
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateSize()
|
||||||
|
{
|
||||||
|
var changed = false;
|
||||||
|
if (canvasWidth != window.innerWidth)
|
||||||
|
{
|
||||||
|
gameWidth = canvasWidth = offscreenCanvas.width = canvas.width = window.innerWidth;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canvasHeight != window.innerHeight - 20)
|
||||||
|
{
|
||||||
|
canvasHeight = offscreenCanvas.height = canvas.height = window.innerHeight - 20;
|
||||||
|
gameHeight = canvasHeight - BAR_HEIGHT;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed && user)
|
||||||
|
centerOnPlayer(user, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
animateGrid = new Grid(GRID_SIZE);
|
||||||
|
grid.reset();
|
||||||
|
|
||||||
|
players = [];
|
||||||
|
allPlayers = [];
|
||||||
|
playerPortion = [];
|
||||||
|
portionsRolling = [];
|
||||||
|
barProportionRolling = [];
|
||||||
|
|
||||||
|
animateTo = [0, 0];
|
||||||
|
offset = [0, 0];
|
||||||
|
|
||||||
|
user = null;
|
||||||
|
zoom = 1;
|
||||||
|
kills = 0;
|
||||||
|
showedDead = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
//Paint methods.
|
||||||
|
function paintGridBorder(ctx)
|
||||||
|
{
|
||||||
|
ctx.fillStyle = 'lightgray';
|
||||||
|
var gridWidth = CELL_WIDTH * GRID_SIZE;
|
||||||
|
|
||||||
|
ctx.fillRect(-BORDER_WIDTH, 0, BORDER_WIDTH, gridWidth);
|
||||||
|
ctx.fillRect(-BORDER_WIDTH, -BORDER_WIDTH, gridWidth + BORDER_WIDTH * 2, BORDER_WIDTH);
|
||||||
|
ctx.fillRect(gridWidth, 0, BORDER_WIDTH, gridWidth);
|
||||||
|
ctx.fillRect(-BORDER_WIDTH, gridWidth, gridWidth + BORDER_WIDTH * 2, BORDER_WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
function paintGrid(ctx)
|
||||||
|
{
|
||||||
|
//Paint background.
|
||||||
|
ctx.fillStyle = "rgb(211, 225, 237)";
|
||||||
|
ctx.fillRect(0, 0, CELL_WIDTH * GRID_SIZE, CELL_WIDTH * GRID_SIZE);
|
||||||
|
|
||||||
|
paintGridBorder(ctx);
|
||||||
|
//paintGridLines(ctx);
|
||||||
|
|
||||||
|
//Get viewing limits
|
||||||
|
var offsetX = (offset[0] - BORDER_WIDTH);
|
||||||
|
var offsetY = (offset[1] - BORDER_WIDTH);
|
||||||
|
|
||||||
|
var minRow = Math.max(Math.floor(offsetY / CELL_WIDTH), 0);
|
||||||
|
var minCol = Math.max(Math.floor(offsetX / CELL_WIDTH), 0);
|
||||||
|
var maxRow = Math.min(Math.ceil((offsetY + gameHeight / zoom) / CELL_WIDTH), grid.size);
|
||||||
|
var maxCol = Math.min(Math.ceil((offsetX + gameWidth / zoom) / CELL_WIDTH), grid.size);
|
||||||
|
|
||||||
|
//Paint occupied areas. (and fading ones).
|
||||||
|
for (var r = minRow; r < maxRow; r++)
|
||||||
|
{
|
||||||
|
for (var c = minCol; c < maxCol; c++)
|
||||||
|
{
|
||||||
|
var p = grid.get(r, c);
|
||||||
|
var x = c * CELL_WIDTH, y = r * CELL_WIDTH, baseColor, shadowColor;
|
||||||
|
|
||||||
|
var animateSpec = animateGrid.get(r, c);
|
||||||
|
if (allowAnimation && animateSpec)
|
||||||
|
{
|
||||||
|
if (animateSpec.before) //fading animation
|
||||||
|
{
|
||||||
|
var frac = (animateSpec.frame / ANIMATE_FRAMES);
|
||||||
|
var back = new Color(.58, .41, .92, 1);
|
||||||
|
baseColor = animateSpec.before.lightBaseColor.interpolateToString(back, frac);
|
||||||
|
shadowColor = animateSpec.before.shadowColor.interpolateToString(back, frac);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (p)
|
||||||
|
{
|
||||||
|
baseColor = p.lightBaseColor;
|
||||||
|
shadowColor = p.shadowColor;
|
||||||
|
}
|
||||||
|
else //No animation nor is this player owned.
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var hasBottom = !grid.isOutOfBounds(r + 1, c);
|
||||||
|
var bottomAnimate = hasBottom && animateGrid.get(r + 1, c);
|
||||||
|
var totalStatic = !bottomAnimate && !animateSpec;
|
||||||
|
var bottomEmpty = totalStatic ? (hasBottom && !grid.get(r + 1, c)) :
|
||||||
|
(!bottomAnimate || (bottomAnimate.after && bottomAnimate.before));
|
||||||
|
if (hasBottom && ((!!bottomAnimate ^ !!animateSpec) || bottomEmpty))
|
||||||
|
{
|
||||||
|
|
||||||
|
ctx.fillStyle = shadowColor.rgbString();
|
||||||
|
ctx.fillRect(x, y + CELL_WIDTH, CELL_WIDTH + 1, SHADOW_OFFSET);
|
||||||
|
}
|
||||||
|
ctx.fillStyle = baseColor.rgbString();
|
||||||
|
ctx.fillRect(x, y, CELL_WIDTH + 1, CELL_WIDTH + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allowAnimation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Paint squares with drop in animation.
|
||||||
|
for (var r = 0; r < grid.size; r++)
|
||||||
|
{
|
||||||
|
for (var c = 0; c < grid.size; c++)
|
||||||
|
{
|
||||||
|
animateSpec = animateGrid.get(r, c);
|
||||||
|
x = c * CELL_WIDTH, y = r * CELL_WIDTH;
|
||||||
|
|
||||||
|
if (animateSpec && allowAnimation)
|
||||||
|
{
|
||||||
|
var viewable = r >= minRow && r < maxRow && c >= minCol && c < maxCol;
|
||||||
|
if (animateSpec.after && viewable)
|
||||||
|
{
|
||||||
|
//Bouncing the squares.
|
||||||
|
var offsetBounce = getBounceOffset(animateSpec.frame);
|
||||||
|
y -= offsetBounce;
|
||||||
|
|
||||||
|
shadowColor = animateSpec.after.shadowColor;
|
||||||
|
baseColor = animateSpec.after.lightBaseColor.deriveLumination(-(offsetBounce / DROP_HEIGHT) * .1);
|
||||||
|
|
||||||
|
ctx.fillStyle = shadowColor.rgbString();
|
||||||
|
ctx.fillRect(x, y + CELL_WIDTH, CELL_WIDTH, SHADOW_OFFSET);
|
||||||
|
ctx.fillStyle = baseColor.rgbString();
|
||||||
|
ctx.fillRect(x, y, CELL_WIDTH + 1, CELL_WIDTH + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
animateSpec.frame++;
|
||||||
|
if (animateSpec.frame >= ANIMATE_FRAMES)
|
||||||
|
animateGrid.set(r, c, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function paintUIBar(ctx)
|
||||||
|
{
|
||||||
|
//UI Bar background
|
||||||
|
ctx.fillStyle = "#24422c";
|
||||||
|
ctx.fillRect(0, 0, canvasWidth, BAR_HEIGHT);
|
||||||
|
|
||||||
|
var barOffset;
|
||||||
|
ctx.fillStyle = "white";
|
||||||
|
ctx.font = "24px Changa";
|
||||||
|
barOffset = (user && user.name) ? (ctx.measureText(user.name).width + 20) : 0;
|
||||||
|
ctx.fillText(user ? user.name : "", 5, CELL_WIDTH - 5);
|
||||||
|
|
||||||
|
//Draw filled bar.
|
||||||
|
ctx.fillStyle = "rgba(180, 180, 180, .3)";
|
||||||
|
ctx.fillRect(barOffset, 0, BAR_WIDTH, BAR_HEIGHT);
|
||||||
|
|
||||||
|
var userPortions = portionsRolling[user.num] ? portionsRolling[user.num].lag : 0;
|
||||||
|
var barSize = Math.ceil((BAR_WIDTH - MIN_BAR_WIDTH) * userPortions + MIN_BAR_WIDTH);
|
||||||
|
ctx.fillStyle = user ? user.baseColor.rgbString() : "";
|
||||||
|
ctx.fillRect(barOffset, 0, barSize, CELL_WIDTH);
|
||||||
|
ctx.fillStyle = user ? user.shadowColor.rgbString() : "";
|
||||||
|
ctx.fillRect(barOffset, CELL_WIDTH, barSize, SHADOW_OFFSET);
|
||||||
|
|
||||||
|
//TODO: dont reset kill count and zoom when we request frames.
|
||||||
|
//Percentage
|
||||||
|
ctx.fillStyle = "white";
|
||||||
|
ctx.font = "18px Changa";
|
||||||
|
ctx.fillText((userPortions * 100).toFixed(3) + "%", 5 + barOffset, CELL_WIDTH - 5);
|
||||||
|
|
||||||
|
//Number of kills
|
||||||
|
var killsText = "Kills: " + kills;
|
||||||
|
var killsOffset = 20 + BAR_WIDTH + barOffset;
|
||||||
|
ctx.fillText(killsText, killsOffset, CELL_WIDTH - 5);
|
||||||
|
|
||||||
|
//Calcuate rank
|
||||||
|
var sorted = [];
|
||||||
|
players.forEach(function(val) {
|
||||||
|
sorted.push({player: val, portion: playerPortion[val.num]});
|
||||||
|
});
|
||||||
|
sorted.sort(function(a, b) {
|
||||||
|
if (a.portion === b.portion) return a.player.num - b.player.num;
|
||||||
|
else return b.portion - a.portion;
|
||||||
|
});
|
||||||
|
|
||||||
|
var rank = sorted.findIndex(function(val) {return val.player === user});
|
||||||
|
ctx.fillText("Rank: " + (rank === -1 ? "--" : rank + 1) + " of " + sorted.length,
|
||||||
|
ctx.measureText(killsText).width + killsOffset + 20, CELL_WIDTH - 5);
|
||||||
|
|
||||||
|
//Rolling the leaderboard bars.
|
||||||
|
if (sorted.length > 0)
|
||||||
|
{
|
||||||
|
var maxPortion = sorted[0].portion;
|
||||||
|
for (var i = 0; i < players.length; i++)
|
||||||
|
{
|
||||||
|
var rolling = barProportionRolling[players[i].num];
|
||||||
|
rolling.value = playerPortion[players[i].num] / maxPortion;
|
||||||
|
rolling.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Show leaderboard.
|
||||||
|
var leaderboardNum = Math.min(5, sorted.length);
|
||||||
|
for (var i = 0; i < leaderboardNum; i++)
|
||||||
|
{
|
||||||
|
var player = sorted[i].player;
|
||||||
|
var name = player.name || "Unnamed";
|
||||||
|
var portion = barProportionRolling[player.num].lag;
|
||||||
|
|
||||||
|
var nameWidth = ctx.measureText(name).width;
|
||||||
|
barSize = Math.ceil((BAR_WIDTH - MIN_BAR_WIDTH) * portion + MIN_BAR_WIDTH);
|
||||||
|
var barX = canvasWidth - barSize;
|
||||||
|
var barY = BAR_HEIGHT * (i + 1);
|
||||||
|
var offset = i == 0 ? 10 : 0;
|
||||||
|
|
||||||
|
ctx.fillStyle = 'rgba(10, 10, 10, .3)';
|
||||||
|
ctx.fillRect(barX - 10, barY + 10 - offset, barSize + 10, BAR_HEIGHT + offset);
|
||||||
|
ctx.fillStyle = player.baseColor.rgbString();
|
||||||
|
ctx.fillRect(barX, barY, barSize, CELL_WIDTH);
|
||||||
|
ctx.fillStyle = player.shadowColor.rgbString();
|
||||||
|
ctx.fillRect(barX, barY + CELL_WIDTH, barSize, SHADOW_OFFSET);
|
||||||
|
|
||||||
|
ctx.fillStyle = "black";
|
||||||
|
ctx.fillText(name, barX - nameWidth - 15, barY + 27);
|
||||||
|
|
||||||
|
var percentage = (portionsRolling[player.num].lag * 100).toFixed(3) + "%";
|
||||||
|
ctx.fillStyle = "white";
|
||||||
|
ctx.fillText(percentage, barX + 5, barY + CELL_WIDTH - 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function paint(ctx)
|
||||||
|
{
|
||||||
|
ctx.fillStyle = '#e2ebf3'; //'whitesmoke';
|
||||||
|
ctx.fillRect(0, 0, canvasWidth, canvasHeight);
|
||||||
|
|
||||||
|
//Move grid to viewport as said with the offsets, below the stats
|
||||||
|
ctx.save();
|
||||||
|
ctx.translate(0, BAR_HEIGHT);
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.rect(0, 0, gameWidth, gameHeight);
|
||||||
|
ctx.clip();
|
||||||
|
|
||||||
|
//Zoom in/out based on player stats.
|
||||||
|
ctx.scale(zoom, zoom);
|
||||||
|
ctx.translate(-offset[0] + BORDER_WIDTH, -offset[1] + BORDER_WIDTH);
|
||||||
|
|
||||||
|
paintGrid(ctx);
|
||||||
|
players.forEach(function (p) {
|
||||||
|
var fr = p.waitLag;
|
||||||
|
if (fr < ANIMATE_FRAMES)
|
||||||
|
p.render(ctx, fr / ANIMATE_FRAMES);
|
||||||
|
else
|
||||||
|
p.render(ctx);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Reset transform to paint fixed UI elements
|
||||||
|
ctx.restore();
|
||||||
|
paintUIBar(ctx);
|
||||||
|
|
||||||
|
if ((!user || user.dead) && !showedDead)
|
||||||
|
{
|
||||||
|
showedDead = true;
|
||||||
|
console.log("You died!");
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function paintDoubleBuff()
|
||||||
|
{
|
||||||
|
paint(offctx);
|
||||||
|
ctx.drawImage(offscreenCanvas, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
updateSize();
|
||||||
|
|
||||||
|
//Change grid offsets.
|
||||||
|
for (var i = 0; i <= 1; i++)
|
||||||
|
{
|
||||||
|
if (animateTo[i] !== offset[i])
|
||||||
|
{
|
||||||
|
if (allowAnimation)
|
||||||
|
{
|
||||||
|
var delta = animateTo[i] - offset[i];
|
||||||
|
var dir = Math.sign(delta);
|
||||||
|
var mag = Math.min(SPEED, Math.abs(delta));
|
||||||
|
offset[i] += dir * mag;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
offset[i] = animateTo[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Calculate player portions.
|
||||||
|
for (var i = 0; i < players.length; i++)
|
||||||
|
{
|
||||||
|
var roll = portionsRolling[players[i].num];
|
||||||
|
roll.value = playerPortion[players[i].num] / GRID_SIZE / GRID_SIZE;
|
||||||
|
roll.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Zoom goes from 1 to .5, decreasing as portion goes up. TODO: maybe can modify this?
|
||||||
|
if (portionsRolling[user.num])
|
||||||
|
zoom = 1 / (portionsRolling[user.num].lag + 1);
|
||||||
|
|
||||||
|
var dead = [];
|
||||||
|
core.updateFrame(grid, players, dead, function addKill(killer, other)
|
||||||
|
{
|
||||||
|
if (players[killer] === user && killer !== other)
|
||||||
|
kills++;
|
||||||
|
});
|
||||||
|
dead.forEach(function(val) {
|
||||||
|
console.log(val.name || "Unnamed" + " is dead");
|
||||||
|
delete allPlayers[val.num];
|
||||||
|
delete portionsRolling[val.num];
|
||||||
|
});
|
||||||
|
|
||||||
|
//TODO: animate player is dead. (maybe explosion?), and tail rewinds itself.
|
||||||
|
if (user) centerOnPlayer(user, animateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Helper methods.
|
||||||
|
function centerOnPlayer(player, pos)
|
||||||
|
{
|
||||||
|
var xOff = Math.floor(player.posX - (gameWidth / zoom - CELL_WIDTH) / 2);
|
||||||
|
var yOff = Math.floor(player.posY - (gameHeight / zoom - CELL_WIDTH) / 2);
|
||||||
|
var gridWidth = grid.size * CELL_WIDTH + BORDER_WIDTH * 2;
|
||||||
|
pos[0] = xOff; //Math.max(Math.min(xOff, gridWidth + (BAR_WIDTH + 100) / zoom - gameWidth / zoom), 0);
|
||||||
|
pos[1] = yOff; //Math.max(Math.min(yOff, gridWidth - gameHeight / zoom), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBounceOffset(frame)
|
||||||
|
{
|
||||||
|
var offsetBounce = ANIMATE_FRAMES;
|
||||||
|
var bounceNum = BOUNCE_FRAMES.length - 1;
|
||||||
|
while (bounceNum >= 0 && frame < offsetBounce - BOUNCE_FRAMES[bounceNum])
|
||||||
|
{
|
||||||
|
offsetBounce -= BOUNCE_FRAMES[bounceNum];
|
||||||
|
bounceNum--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bounceNum === -1)
|
||||||
|
{
|
||||||
|
return (offsetBounce - frame) * DROP_SPEED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offsetBounce -= BOUNCE_FRAMES[bounceNum];
|
||||||
|
frame = frame - offsetBounce;
|
||||||
|
var midFrame = BOUNCE_FRAMES[bounceNum] / 2;
|
||||||
|
if (frame >= midFrame)
|
||||||
|
return (BOUNCE_FRAMES[bounceNum] - frame) * DROP_SPEED;
|
||||||
|
else
|
||||||
|
return frame * DROP_SPEED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = exports = {
|
||||||
|
addPlayer: function(player) {
|
||||||
|
if (allPlayers[player.num])
|
||||||
|
return; //Already added.
|
||||||
|
allPlayers[player.num] = players[players.length] = player;
|
||||||
|
playerPortion[player.num] = 0;
|
||||||
|
portionsRolling[player.num] = new Rolling(9 / GRID_SIZE / GRID_SIZE, ANIMATE_FRAMES);
|
||||||
|
barProportionRolling[player.num] = new Rolling(0, ANIMATE_FRAMES);
|
||||||
|
return players.length - 1;
|
||||||
|
},
|
||||||
|
getPlayer: function(ind) {
|
||||||
|
if (ind < 0 || ind >= players.length)
|
||||||
|
throw new RangeError("Player index out of bounds (" + ind + ").");
|
||||||
|
return players[ind];
|
||||||
|
},
|
||||||
|
getPlayerFromNum: function(num) {
|
||||||
|
return allPlayers[num];
|
||||||
|
},
|
||||||
|
playerSize: function() {
|
||||||
|
return players.length;
|
||||||
|
},
|
||||||
|
setUser: function(player) {
|
||||||
|
user = player;
|
||||||
|
centerOnPlayer(user, offset);
|
||||||
|
},
|
||||||
|
incrementKill: function() {
|
||||||
|
kills++;
|
||||||
|
},
|
||||||
|
reset: function() {
|
||||||
|
init();
|
||||||
|
},
|
||||||
|
paint: paintDoubleBuff,
|
||||||
|
update: update
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.defineProperties(exports, {
|
||||||
|
allowAnimation: {
|
||||||
|
get: function() { return allowAnimation; },
|
||||||
|
set: function(val) { allowAnimation = !!val; },
|
||||||
|
enumerable: true
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
get: function() { return grid; },
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
});
|
299
game-server.js
299
game-server.js
@@ -1,20 +1,311 @@
|
|||||||
var Player = require("./player-server.js");
|
|
||||||
|
var Color = require("./color");
|
||||||
|
var Grid = require("./grid");
|
||||||
|
var Player = require("./player");
|
||||||
|
//var Gate = require("./gate");
|
||||||
|
var core = require("./game-core");
|
||||||
|
var consts = require("./game-consts");
|
||||||
|
|
||||||
|
var GRID_SIZE = consts.GRID_SIZE;
|
||||||
|
var CELL_WIDTH = consts.CELL_WIDTH;
|
||||||
|
var MAX_PLAYERS = consts.MAX_PLAYERS;
|
||||||
|
|
||||||
|
var HUES = [0, 10, 20, 25, 30, 35, 40, 45, 50, 60, 70, 100, 110, 120, 125, 130, 135, 140, 145, 150, 160, 170, 180, 190, 200, 210, 220].map(function(val) {return val / 240});
|
||||||
|
var SATS = [192, 150, 100].map(function(val) {return val / 240});
|
||||||
|
|
||||||
|
|
||||||
function Game(id)
|
function Game(id)
|
||||||
{
|
{
|
||||||
|
//Shuffle the hues.
|
||||||
|
for (var i = 0; i < HUES.length * 50; i++)
|
||||||
|
{
|
||||||
|
var a = Math.floor(Math.random() * HUES.length);
|
||||||
|
var b = Math.floor(Math.random() * HUES.length);
|
||||||
|
var tmp = HUES[a];
|
||||||
|
HUES[a] = HUES[b];
|
||||||
|
HUES[b] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
var possColors = new Array(SATS.length * HUES.length);
|
||||||
|
i = 0;
|
||||||
|
for (var s = 0; s < SATS.length; s++)
|
||||||
|
for (var h = 0; h < HUES.length; h++)
|
||||||
|
possColors[i++] = new Color(HUES[h], SATS[s], .5, 1);
|
||||||
|
|
||||||
|
var nextInd = 0;
|
||||||
var players = [];
|
var players = [];
|
||||||
var newPlayers = [];
|
var newPlayers = [];
|
||||||
|
var frameLocs = [];
|
||||||
var frame = 0;
|
var frame = 0;
|
||||||
|
|
||||||
|
var filled = 0;
|
||||||
|
var grid = new Grid(GRID_SIZE, function(row, col, before, after) {
|
||||||
|
if (!!after ^ !!before)
|
||||||
|
{
|
||||||
|
if (after)
|
||||||
|
filled++;
|
||||||
|
else
|
||||||
|
filled--;
|
||||||
|
if (filled === GRID_SIZE * GRID_SIZE)
|
||||||
|
console.log("FULL GAME");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
this.addPlayer = function(client) {
|
this.addPlayer = function(client, name) {
|
||||||
var p = {num: players.length, client: client};
|
if (players.length >= MAX_PLAYERS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var start = findEmpty(grid);
|
||||||
|
if (!start)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var params = {
|
||||||
|
posX: start.col * CELL_WIDTH,
|
||||||
|
posY: start.row * CELL_WIDTH,
|
||||||
|
currentHeading: Math.floor(Math.random() * 4),
|
||||||
|
name: name,
|
||||||
|
num: nextInd,
|
||||||
|
base: possColors.shift()
|
||||||
|
};
|
||||||
|
|
||||||
|
var p = new Player(grid, params);
|
||||||
|
p.tmpHeading = params.currentHeading;
|
||||||
|
p.client = client;
|
||||||
players.push(p);
|
players.push(p);
|
||||||
newPlayers.push(p);
|
newPlayers.push(p);
|
||||||
|
nextInd++;
|
||||||
|
core.initPlayer(grid, p);
|
||||||
|
|
||||||
client.emit("game", {players, })
|
console.log((p.name || "Unnamed") + " (" + p.num + ") joined.");
|
||||||
|
|
||||||
|
client.on("requestFrame", function () {
|
||||||
|
if (p.frame === frame)
|
||||||
|
return;
|
||||||
|
p.frame = frame; //Limit number of requests per frame. (One per frame);
|
||||||
|
|
||||||
|
var splayers = players.map(function(val) {return val.serialData();});
|
||||||
|
client.emit("game", {
|
||||||
|
"num": p.num,
|
||||||
|
"gameid": id,
|
||||||
|
"frame": frame,
|
||||||
|
"players": splayers,
|
||||||
|
"grid": gridSerialData(grid, players)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Verifies that this client has executed this frame properly.
|
||||||
|
client.on("verify", function(data, resp) {
|
||||||
|
if (typeof resp !== "function")
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!data.frame)
|
||||||
|
resp(false, false, "No frame supplied");
|
||||||
|
else if (!checkInt(data.frame, 0, frame + 1))
|
||||||
|
resp(false, false, "Must be a valid frame number");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
verifyPlayerLocations(data.frame, data.locs, resp);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on("frame", function(data, errorHan){
|
||||||
|
if (typeof data === "function")
|
||||||
|
{
|
||||||
|
errorHan(false, "No data supplied.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof errorHan !== "function")
|
||||||
|
errorHan = function() {};
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
errorHan(false, "No data supplied.");
|
||||||
|
else if (!checkInt(data.frame, 0, Infinity))
|
||||||
|
errorHan(false, "Requires a valid non-negative frame integer.");
|
||||||
|
else if (data.frame > frame)
|
||||||
|
errorHan(false, "Invalid frame received.");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (data.heading !== undefined)
|
||||||
|
{
|
||||||
|
if (checkInt(data.heading, 0, 4))
|
||||||
|
{
|
||||||
|
p.tmpHeading = data.heading;
|
||||||
|
errorHan(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
errorHan(false, "New heading must be an integer of range [0, 4).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('disconnect', function() {
|
||||||
|
p.die(); //Die immediately if not already.
|
||||||
|
p.disconnected = true;
|
||||||
|
console.log((p.name || "Unnamed") + " (" + p.num + ") left.");
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
function pushPlayerLocations()
|
||||||
|
{
|
||||||
|
var locs = [];
|
||||||
|
for (var p of players)
|
||||||
|
locs[p.num] = [p.posX, p.posY, p.waitLag];
|
||||||
|
locs.frame = frame;
|
||||||
|
|
||||||
|
if (frameLocs.length >= 300) //Give it 5 seconds of lag.
|
||||||
|
frameLocs.shift();
|
||||||
|
frameLocs.push(locs);
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyPlayerLocations(fr, verify, resp)
|
||||||
|
{
|
||||||
|
var minFrame = frame - frameLocs.length + 1;
|
||||||
|
if (fr < minFrame || fr > frame)
|
||||||
|
{
|
||||||
|
resp(false, false, "Frames out of reference");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function string(loc)
|
||||||
|
{
|
||||||
|
return '(' + loc[0] + ', ' + loc[1] + ') [' + loc[2] + ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
var locs = frameLocs[fr - minFrame];
|
||||||
|
if (locs.frame !== fr)
|
||||||
|
{
|
||||||
|
resp(false, false, locs.frame + " != " + fr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var num in verify)
|
||||||
|
{
|
||||||
|
if (locs[num][0] !== verify[num][0] || locs[num][1] !== verify[num][1] || locs[num][2] !== verify[num][2])
|
||||||
|
{
|
||||||
|
resp(false, true, 'P' + num + ' ' + string(locs[num]) + ' !== ' + string(verify[num]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tick() {
|
||||||
|
|
||||||
|
//TODO: notify those players that this server automatically drops out.
|
||||||
|
var splayers = players.map(function(val) {return val.serialData();});
|
||||||
|
var snews = newPlayers.map(function(val) {
|
||||||
|
//Emit game stats.
|
||||||
|
val.client.emit("game", {
|
||||||
|
"num": val.num,
|
||||||
|
"gameid": id,
|
||||||
|
"frame": frame,
|
||||||
|
"players": splayers,
|
||||||
|
"grid": gridSerialData(grid, players),
|
||||||
|
});
|
||||||
|
return val.serialData();
|
||||||
|
});
|
||||||
|
var moves = players.map(function(val) {
|
||||||
|
//Account for race condition (when heading is set after emitting frames, and before updating).
|
||||||
|
val.heading = val.tmpHeading;
|
||||||
|
return {num: val.num, left: !!val.disconnected, heading: val.heading};
|
||||||
|
});
|
||||||
|
|
||||||
|
update();
|
||||||
|
|
||||||
|
var data = {frame: frame + 1, moves: moves};
|
||||||
|
if (snews.length > 0)
|
||||||
|
{
|
||||||
|
data.newPlayers = snews;
|
||||||
|
newPlayers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var pl of players)
|
||||||
|
pl.client.emit("notifyFrame", data);
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
pushPlayerLocations();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tickFrame = tick;
|
||||||
|
|
||||||
|
function update()
|
||||||
|
{
|
||||||
|
var dead = [];
|
||||||
|
core.updateFrame(grid, players, dead);
|
||||||
|
for (var pl of dead)
|
||||||
|
{
|
||||||
|
if (!pl.handledDead)
|
||||||
|
{
|
||||||
|
possColors.unshift(pl.baseColor);
|
||||||
|
pl.handledDead = true;
|
||||||
|
}
|
||||||
|
console.log((pl.name || "Unnamed") + " (" + pl.num + ") died.");
|
||||||
|
pl.client.emit("dead");
|
||||||
|
pl.client.disconnect(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkInt(value, min, max)
|
||||||
|
{
|
||||||
|
if (typeof value !== "number")
|
||||||
|
return false;
|
||||||
|
if (value < min || value >= max)
|
||||||
|
return false;
|
||||||
|
if (Math.floor(value) !== value)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gridSerialData(grid, players)
|
||||||
|
{
|
||||||
|
var buff = Buffer.alloc(grid.size * grid.size);
|
||||||
|
|
||||||
|
var numToIndex = new Array(players.length > 0 ? players[players.length - 1].num + 1 : 0);
|
||||||
|
for (var i = 0; i < players.length; i++)
|
||||||
|
numToIndex[players[i].num] = i + 1;
|
||||||
|
|
||||||
|
for (var r = 0; r < grid.size; r++)
|
||||||
|
for (var c = 0; c < grid.size; c++)
|
||||||
|
{
|
||||||
|
var ele = grid.get(r, c);
|
||||||
|
buff[r * grid.size + c] = ele ? numToIndex[ele.num] : 0;
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findEmpty(grid)
|
||||||
|
{
|
||||||
|
var available = [];
|
||||||
|
|
||||||
|
for (var r = 1; r < grid.size - 1; r++)
|
||||||
|
for (var c = 1; c < grid.size - 1; c++)
|
||||||
|
{
|
||||||
|
var cluttered = false;
|
||||||
|
checkclutter: for (var dr = -1; dr <= 1; dr++)
|
||||||
|
{
|
||||||
|
for (var dc = -1; dc <= 1; dc++)
|
||||||
|
{
|
||||||
|
if (grid.get(r + dr, c + dc))
|
||||||
|
{
|
||||||
|
cluttered = true;
|
||||||
|
break checkclutter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!cluttered)
|
||||||
|
available.push({row: r, col: c});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (available.length === 0)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return available[Math.floor(available.length * Math.random())];
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Game;
|
module.exports = Game;
|
47
gate.js
Normal file
47
gate.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
var inherits = require('util').inherits;
|
||||||
|
var EventEmitter = require('events').EventEmitter;
|
||||||
|
|
||||||
|
module.exports = Gate;
|
||||||
|
|
||||||
|
function Gate(awaiting)
|
||||||
|
{
|
||||||
|
var _this = this;
|
||||||
|
if (!(this instanceof Gate))
|
||||||
|
return new Gate(awaiting);
|
||||||
|
|
||||||
|
if (typeof awaiting !== "number")
|
||||||
|
awaiting = 0;
|
||||||
|
|
||||||
|
var currentAwaiting = awaiting;
|
||||||
|
var readyCount = 0;
|
||||||
|
var ready = new Array(currentAwaiting);
|
||||||
|
|
||||||
|
this.setAwaiting = function(count) {
|
||||||
|
awaiting = count;
|
||||||
|
};
|
||||||
|
this.ready = function(ind) {
|
||||||
|
if (Math.floor(ind) != ind || ind >= readyCount)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ready[ind] = true;
|
||||||
|
readyCount++;
|
||||||
|
|
||||||
|
_this.emit("ready", ind);
|
||||||
|
if (readyCount >= currentAwaiting)
|
||||||
|
{
|
||||||
|
_this.emit("allReady");
|
||||||
|
_this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
this.reset = function() {
|
||||||
|
_this.emit("reset");
|
||||||
|
ready = new Array(currentAwaiting = awaiting);
|
||||||
|
readyCount = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
EventEmitter.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
inherits(Gate, EventEmitter);
|
10
grid.js
10
grid.js
@@ -1,6 +1,7 @@
|
|||||||
function Grid(size, changeCallback)
|
function Grid(size, changeCallback)
|
||||||
{
|
{
|
||||||
var grid = new Array(size);
|
var grid = new Array(size);
|
||||||
|
var modified = false;
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
grid: grid,
|
grid: grid,
|
||||||
@@ -26,8 +27,17 @@ function Grid(size, changeCallback)
|
|||||||
if (typeof changeCallback === "function")
|
if (typeof changeCallback === "function")
|
||||||
changeCallback(row, col, before, value);
|
changeCallback(row, col, before, value);
|
||||||
|
|
||||||
|
modified = true;
|
||||||
|
|
||||||
return before;
|
return before;
|
||||||
}
|
}
|
||||||
|
this.reset = function() {
|
||||||
|
if (modified)
|
||||||
|
{
|
||||||
|
grid = new Array(size);
|
||||||
|
modified = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.isOutOfBounds = isOutOfBounds.bind(this, data);
|
this.isOutOfBounds = isOutOfBounds.bind(this, data);
|
||||||
|
|
||||||
|
1
node_modules/.bin/mime
generated
vendored
1
node_modules/.bin/mime
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../mime/cli.js
|
|
3
node_modules/debug/.jshintrc
generated
vendored
3
node_modules/debug/.jshintrc
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"laxbreak": true
|
|
||||||
}
|
|
6
node_modules/debug/.npmignore
generated
vendored
6
node_modules/debug/.npmignore
generated
vendored
@@ -1,6 +0,0 @@
|
|||||||
support
|
|
||||||
test
|
|
||||||
examples
|
|
||||||
example
|
|
||||||
*.sock
|
|
||||||
dist
|
|
195
node_modules/debug/History.md
generated
vendored
195
node_modules/debug/History.md
generated
vendored
@@ -1,195 +0,0 @@
|
|||||||
|
|
||||||
2.2.0 / 2015-05-09
|
|
||||||
==================
|
|
||||||
|
|
||||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
|
||||||
* README: add logging to file example (#193, @DanielOchoa)
|
|
||||||
* README: fixed a typo (#191, @amir-s)
|
|
||||||
* browser: expose `storage` (#190, @stephenmathieson)
|
|
||||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
|
||||||
|
|
||||||
2.1.3 / 2015-03-13
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Updated stdout/stderr example (#186)
|
|
||||||
* Updated example/stdout.js to match debug current behaviour
|
|
||||||
* Renamed example/stderr.js to stdout.js
|
|
||||||
* Update Readme.md (#184)
|
|
||||||
* replace high intensity foreground color for bold (#182, #183)
|
|
||||||
|
|
||||||
2.1.2 / 2015-03-01
|
|
||||||
==================
|
|
||||||
|
|
||||||
* dist: recompile
|
|
||||||
* update "ms" to v0.7.0
|
|
||||||
* package: update "browserify" to v9.0.3
|
|
||||||
* component: fix "ms.js" repo location
|
|
||||||
* changed bower package name
|
|
||||||
* updated documentation about using debug in a browser
|
|
||||||
* fix: security error on safari (#167, #168, @yields)
|
|
||||||
|
|
||||||
2.1.1 / 2014-12-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* browser: use `typeof` to check for `console` existence
|
|
||||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
|
||||||
* browser: add support for Chrome apps
|
|
||||||
* Readme: added Windows usage remarks
|
|
||||||
* Add `bower.json` to properly support bower install
|
|
||||||
|
|
||||||
2.1.0 / 2014-10-15
|
|
||||||
==================
|
|
||||||
|
|
||||||
* node: implement `DEBUG_FD` env variable support
|
|
||||||
* package: update "browserify" to v6.1.0
|
|
||||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
|
||||||
|
|
||||||
2.0.0 / 2014-09-01
|
|
||||||
==================
|
|
||||||
|
|
||||||
* package: update "browserify" to v5.11.0
|
|
||||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
|
||||||
|
|
||||||
1.0.4 / 2014-07-15
|
|
||||||
==================
|
|
||||||
|
|
||||||
* dist: recompile
|
|
||||||
* example: remove `console.info()` log usage
|
|
||||||
* example: add "Content-Type" UTF-8 header to browser example
|
|
||||||
* browser: place %c marker after the space character
|
|
||||||
* browser: reset the "content" color via `color: inherit`
|
|
||||||
* browser: add colors support for Firefox >= v31
|
|
||||||
* debug: prefer an instance `log()` function over the global one (#119)
|
|
||||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
|
||||||
|
|
||||||
1.0.3 / 2014-07-09
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
|
||||||
* browser: fix lint
|
|
||||||
|
|
||||||
1.0.2 / 2014-06-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* browser: update color palette (#113, @gscottolson)
|
|
||||||
* common: make console logging function configurable (#108, @timoxley)
|
|
||||||
* node: fix %o colors on old node <= 0.8.x
|
|
||||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
|
||||||
|
|
||||||
1.0.1 / 2014-06-06
|
|
||||||
==================
|
|
||||||
|
|
||||||
* browser: use `removeItem()` to clear localStorage
|
|
||||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
|
||||||
* package: add "contributors" section
|
|
||||||
* node: fix comment typo
|
|
||||||
* README: list authors
|
|
||||||
|
|
||||||
1.0.0 / 2014-06-04
|
|
||||||
==================
|
|
||||||
|
|
||||||
* make ms diff be global, not be scope
|
|
||||||
* debug: ignore empty strings in enable()
|
|
||||||
* node: make DEBUG_COLORS able to disable coloring
|
|
||||||
* *: export the `colors` array
|
|
||||||
* npmignore: don't publish the `dist` dir
|
|
||||||
* Makefile: refactor to use browserify
|
|
||||||
* package: add "browserify" as a dev dependency
|
|
||||||
* Readme: add Web Inspector Colors section
|
|
||||||
* node: reset terminal color for the debug content
|
|
||||||
* node: map "%o" to `util.inspect()`
|
|
||||||
* browser: map "%j" to `JSON.stringify()`
|
|
||||||
* debug: add custom "formatters"
|
|
||||||
* debug: use "ms" module for humanizing the diff
|
|
||||||
* Readme: add "bash" syntax highlighting
|
|
||||||
* browser: add Firebug color support
|
|
||||||
* browser: add colors for WebKit browsers
|
|
||||||
* node: apply log to `console`
|
|
||||||
* rewrite: abstract common logic for Node & browsers
|
|
||||||
* add .jshintrc file
|
|
||||||
|
|
||||||
0.8.1 / 2014-04-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* package: re-add the "component" section
|
|
||||||
|
|
||||||
0.8.0 / 2014-03-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* add `enable()` method for nodejs. Closes #27
|
|
||||||
* change from stderr to stdout
|
|
||||||
* remove unnecessary index.js file
|
|
||||||
|
|
||||||
0.7.4 / 2013-11-13
|
|
||||||
==================
|
|
||||||
|
|
||||||
* remove "browserify" key from package.json (fixes something in browserify)
|
|
||||||
|
|
||||||
0.7.3 / 2013-10-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
|
||||||
* add debug(err) support. Closes #46
|
|
||||||
* add .browser prop to package.json. Closes #42
|
|
||||||
|
|
||||||
0.7.2 / 2013-02-06
|
|
||||||
==================
|
|
||||||
|
|
||||||
* fix package.json
|
|
||||||
* fix: Mobile Safari (private mode) is broken with debug
|
|
||||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
|
||||||
|
|
||||||
0.7.1 / 2013-02-05
|
|
||||||
==================
|
|
||||||
|
|
||||||
* add repository URL to package.json
|
|
||||||
* add DEBUG_COLORED to force colored output
|
|
||||||
* add browserify support
|
|
||||||
* fix component. Closes #24
|
|
||||||
|
|
||||||
0.7.0 / 2012-05-04
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added .component to package.json
|
|
||||||
* Added debug.component.js build
|
|
||||||
|
|
||||||
0.6.0 / 2012-03-16
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
|
||||||
* Added `.enabled` flag to the node version [TooTallNate]
|
|
||||||
|
|
||||||
0.5.0 / 2012-02-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added: humanize diffs. Closes #8
|
|
||||||
* Added `debug.disable()` to the CS variant
|
|
||||||
* Removed padding. Closes #10
|
|
||||||
* Fixed: persist client-side variant again. Closes #9
|
|
||||||
|
|
||||||
0.4.0 / 2012-02-01
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added browser variant support for older browsers [TooTallNate]
|
|
||||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
|
||||||
* Added padding to diff (moved it to the right)
|
|
||||||
|
|
||||||
0.3.0 / 2012-01-26
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added millisecond diff when isatty, otherwise UTC string
|
|
||||||
|
|
||||||
0.2.0 / 2012-01-22
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added wildcard support
|
|
||||||
|
|
||||||
0.1.0 / 2011-12-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
|
||||||
|
|
||||||
0.0.1 / 2010-01-03
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Initial release
|
|
36
node_modules/debug/Makefile
generated
vendored
36
node_modules/debug/Makefile
generated
vendored
@@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
|
||||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
|
||||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
|
||||||
|
|
||||||
# BIN directory
|
|
||||||
BIN := $(THIS_DIR)/node_modules/.bin
|
|
||||||
|
|
||||||
# applications
|
|
||||||
NODE ?= $(shell which node)
|
|
||||||
NPM ?= $(NODE) $(shell which npm)
|
|
||||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
|
||||||
|
|
||||||
all: dist/debug.js
|
|
||||||
|
|
||||||
install: node_modules
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@rm -rf dist
|
|
||||||
|
|
||||||
dist:
|
|
||||||
@mkdir -p $@
|
|
||||||
|
|
||||||
dist/debug.js: node_modules browser.js debug.js dist
|
|
||||||
@$(BROWSERIFY) \
|
|
||||||
--standalone debug \
|
|
||||||
. > $@
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
@rm -rf node_modules
|
|
||||||
|
|
||||||
node_modules: package.json
|
|
||||||
@NODE_ENV= $(NPM) install
|
|
||||||
@touch node_modules
|
|
||||||
|
|
||||||
.PHONY: all install clean distclean
|
|
188
node_modules/debug/Readme.md
generated
vendored
188
node_modules/debug/Readme.md
generated
vendored
@@ -1,188 +0,0 @@
|
|||||||
# debug
|
|
||||||
|
|
||||||
tiny node.js debugging utility modelled after node core's debugging technique.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm install debug
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
|
|
||||||
|
|
||||||
Example _app.js_:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var debug = require('debug')('http')
|
|
||||||
, http = require('http')
|
|
||||||
, name = 'My App';
|
|
||||||
|
|
||||||
// fake app
|
|
||||||
|
|
||||||
debug('booting %s', name);
|
|
||||||
|
|
||||||
http.createServer(function(req, res){
|
|
||||||
debug(req.method + ' ' + req.url);
|
|
||||||
res.end('hello\n');
|
|
||||||
}).listen(3000, function(){
|
|
||||||
debug('listening');
|
|
||||||
});
|
|
||||||
|
|
||||||
// fake worker of some kind
|
|
||||||
|
|
||||||
require('./worker');
|
|
||||||
```
|
|
||||||
|
|
||||||
Example _worker.js_:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var debug = require('debug')('worker');
|
|
||||||
|
|
||||||
setInterval(function(){
|
|
||||||
debug('doing some work');
|
|
||||||
}, 1000);
|
|
||||||
```
|
|
||||||
|
|
||||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

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

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

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

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

|
|
||||||
|
|
||||||
When a user calls a function in your library that you mark deprecated, they
|
|
||||||
will see the following written to STDERR (in the given colors, similar colors
|
|
||||||
and layout to the `debug` module):
|
|
||||||
|
|
||||||
```
|
|
||||||
bright cyan bright yellow
|
|
||||||
| | reset cyan
|
|
||||||
| | | |
|
|
||||||
▼ ▼ ▼ ▼
|
|
||||||
my-cool-module deprecated oldfunction [eval]-wrapper:6:22
|
|
||||||
▲ ▲ ▲ ▲
|
|
||||||
| | | |
|
|
||||||
namespace | | location of mycoolmod.oldfunction() call
|
|
||||||
| deprecation message
|
|
||||||
the word "deprecated"
|
|
||||||
```
|
|
||||||
|
|
||||||
If the user redirects their STDERR to a file or somewhere that does not support
|
|
||||||
colors, they see (similar layout to the `debug` module):
|
|
||||||
|
|
||||||
```
|
|
||||||
Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22
|
|
||||||
▲ ▲ ▲ ▲ ▲
|
|
||||||
| | | | |
|
|
||||||
timestamp of message namespace | | location of mycoolmod.oldfunction() call
|
|
||||||
| deprecation message
|
|
||||||
the word "deprecated"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Deprecating all calls to a function
|
|
||||||
|
|
||||||
This will display a deprecated message about "oldfunction" being deprecated
|
|
||||||
from "my-module" on STDERR.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var deprecate = require('depd')('my-cool-module')
|
|
||||||
|
|
||||||
// message automatically derived from function name
|
|
||||||
// Object.oldfunction
|
|
||||||
exports.oldfunction = deprecate.function(function oldfunction() {
|
|
||||||
// all calls to function are deprecated
|
|
||||||
})
|
|
||||||
|
|
||||||
// specific message
|
|
||||||
exports.oldfunction = deprecate.function(function () {
|
|
||||||
// all calls to function are deprecated
|
|
||||||
}, 'oldfunction')
|
|
||||||
```
|
|
||||||
|
|
||||||
### Conditionally deprecating a function call
|
|
||||||
|
|
||||||
This will display a deprecated message about "weirdfunction" being deprecated
|
|
||||||
from "my-module" on STDERR when called with less than 2 arguments.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var deprecate = require('depd')('my-cool-module')
|
|
||||||
|
|
||||||
exports.weirdfunction = function () {
|
|
||||||
if (arguments.length < 2) {
|
|
||||||
// calls with 0 or 1 args are deprecated
|
|
||||||
deprecate('weirdfunction args < 2')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
When calling `deprecate` as a function, the warning is counted per call site
|
|
||||||
within your own module, so you can display different deprecations depending
|
|
||||||
on different situations and the users will still get all the warnings:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var deprecate = require('depd')('my-cool-module')
|
|
||||||
|
|
||||||
exports.weirdfunction = function () {
|
|
||||||
if (arguments.length < 2) {
|
|
||||||
// calls with 0 or 1 args are deprecated
|
|
||||||
deprecate('weirdfunction args < 2')
|
|
||||||
} else if (typeof arguments[0] !== 'string') {
|
|
||||||
// calls with non-string first argument are deprecated
|
|
||||||
deprecate('weirdfunction non-string first arg')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deprecating property access
|
|
||||||
|
|
||||||
This will display a deprecated message about "oldprop" being deprecated
|
|
||||||
from "my-module" on STDERR when accessed. A deprecation will be displayed
|
|
||||||
when setting the value and when getting the value.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var deprecate = require('depd')('my-cool-module')
|
|
||||||
|
|
||||||
exports.oldprop = 'something'
|
|
||||||
|
|
||||||
// message automatically derives from property name
|
|
||||||
deprecate.property(exports, 'oldprop')
|
|
||||||
|
|
||||||
// explicit message
|
|
||||||
deprecate.property(exports, 'oldprop', 'oldprop >= 0.10')
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[npm-version-image]: https://img.shields.io/npm/v/depd.svg
|
|
||||||
[npm-downloads-image]: https://img.shields.io/npm/dm/depd.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/depd
|
|
||||||
[travis-image]: https://img.shields.io/travis/dougwilson/nodejs-depd/master.svg?label=linux
|
|
||||||
[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd
|
|
||||||
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/nodejs-depd/master.svg?label=windows
|
|
||||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd/master.svg
|
|
||||||
[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master
|
|
||||||
[node-image]: https://img.shields.io/node/v/depd.svg
|
|
||||||
[node-url]: http://nodejs.org/download/
|
|
||||||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
|
||||||
[gratipay-url]: https://www.gratipay.com/dougwilson/
|
|
521
node_modules/depd/index.js
generated
vendored
521
node_modules/depd/index.js
generated
vendored
@@ -1,521 +0,0 @@
|
|||||||
/*!
|
|
||||||
* depd
|
|
||||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var callSiteToString = require('./lib/compat').callSiteToString
|
|
||||||
var eventListenerCount = require('./lib/compat').eventListenerCount
|
|
||||||
var relative = require('path').relative
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = depd
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the path to base files on.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var basePath = process.cwd()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if namespace is contained in the string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function containsNamespace(str, namespace) {
|
|
||||||
var val = str.split(/[ ,]+/)
|
|
||||||
|
|
||||||
namespace = String(namespace).toLowerCase()
|
|
||||||
|
|
||||||
for (var i = 0 ; i < val.length; i++) {
|
|
||||||
if (!(str = val[i])) continue;
|
|
||||||
|
|
||||||
// namespace contained
|
|
||||||
if (str === '*' || str.toLowerCase() === namespace) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a data descriptor to accessor descriptor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function convertDataDescriptorToAccessor(obj, prop, message) {
|
|
||||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
|
||||||
var value = descriptor.value
|
|
||||||
|
|
||||||
descriptor.get = function getter() { return value }
|
|
||||||
|
|
||||||
if (descriptor.writable) {
|
|
||||||
descriptor.set = function setter(val) { return value = val }
|
|
||||||
}
|
|
||||||
|
|
||||||
delete descriptor.value
|
|
||||||
delete descriptor.writable
|
|
||||||
|
|
||||||
Object.defineProperty(obj, prop, descriptor)
|
|
||||||
|
|
||||||
return descriptor
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create arguments string to keep arity.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createArgumentsString(arity) {
|
|
||||||
var str = ''
|
|
||||||
|
|
||||||
for (var i = 0; i < arity; i++) {
|
|
||||||
str += ', arg' + i
|
|
||||||
}
|
|
||||||
|
|
||||||
return str.substr(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create stack string from stack.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createStackString(stack) {
|
|
||||||
var str = this.name + ': ' + this.namespace
|
|
||||||
|
|
||||||
if (this.message) {
|
|
||||||
str += ' deprecated ' + this.message
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < stack.length; i++) {
|
|
||||||
str += '\n at ' + callSiteToString(stack[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create deprecate for namespace in caller.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function depd(namespace) {
|
|
||||||
if (!namespace) {
|
|
||||||
throw new TypeError('argument namespace is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
var stack = getStack()
|
|
||||||
var site = callSiteLocation(stack[1])
|
|
||||||
var file = site[0]
|
|
||||||
|
|
||||||
function deprecate(message) {
|
|
||||||
// call to self as log
|
|
||||||
log.call(deprecate, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecate._file = file
|
|
||||||
deprecate._ignored = isignored(namespace)
|
|
||||||
deprecate._namespace = namespace
|
|
||||||
deprecate._traced = istraced(namespace)
|
|
||||||
deprecate._warned = Object.create(null)
|
|
||||||
|
|
||||||
deprecate.function = wrapfunction
|
|
||||||
deprecate.property = wrapproperty
|
|
||||||
|
|
||||||
return deprecate
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if namespace is ignored.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function isignored(namespace) {
|
|
||||||
/* istanbul ignore next: tested in a child processs */
|
|
||||||
if (process.noDeprecation) {
|
|
||||||
// --no-deprecation support
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
var str = process.env.NO_DEPRECATION || ''
|
|
||||||
|
|
||||||
// namespace ignored
|
|
||||||
return containsNamespace(str, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if namespace is traced.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function istraced(namespace) {
|
|
||||||
/* istanbul ignore next: tested in a child processs */
|
|
||||||
if (process.traceDeprecation) {
|
|
||||||
// --trace-deprecation support
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
var str = process.env.TRACE_DEPRECATION || ''
|
|
||||||
|
|
||||||
// namespace traced
|
|
||||||
return containsNamespace(str, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display deprecation message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function log(message, site) {
|
|
||||||
var haslisteners = eventListenerCount(process, 'deprecation') !== 0
|
|
||||||
|
|
||||||
// abort early if no destination
|
|
||||||
if (!haslisteners && this._ignored) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var caller
|
|
||||||
var callFile
|
|
||||||
var callSite
|
|
||||||
var i = 0
|
|
||||||
var seen = false
|
|
||||||
var stack = getStack()
|
|
||||||
var file = this._file
|
|
||||||
|
|
||||||
if (site) {
|
|
||||||
// provided site
|
|
||||||
callSite = callSiteLocation(stack[1])
|
|
||||||
callSite.name = site.name
|
|
||||||
file = callSite[0]
|
|
||||||
} else {
|
|
||||||
// get call site
|
|
||||||
i = 2
|
|
||||||
site = callSiteLocation(stack[i])
|
|
||||||
callSite = site
|
|
||||||
}
|
|
||||||
|
|
||||||
// get caller of deprecated thing in relation to file
|
|
||||||
for (; i < stack.length; i++) {
|
|
||||||
caller = callSiteLocation(stack[i])
|
|
||||||
callFile = caller[0]
|
|
||||||
|
|
||||||
if (callFile === file) {
|
|
||||||
seen = true
|
|
||||||
} else if (callFile === this._file) {
|
|
||||||
file = this._file
|
|
||||||
} else if (seen) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var key = caller
|
|
||||||
? site.join(':') + '__' + caller.join(':')
|
|
||||||
: undefined
|
|
||||||
|
|
||||||
if (key !== undefined && key in this._warned) {
|
|
||||||
// already warned
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this._warned[key] = true
|
|
||||||
|
|
||||||
// generate automatic message from call site
|
|
||||||
if (!message) {
|
|
||||||
message = callSite === site || !callSite.name
|
|
||||||
? defaultMessage(site)
|
|
||||||
: defaultMessage(callSite)
|
|
||||||
}
|
|
||||||
|
|
||||||
// emit deprecation if listeners exist
|
|
||||||
if (haslisteners) {
|
|
||||||
var err = DeprecationError(this._namespace, message, stack.slice(i))
|
|
||||||
process.emit('deprecation', err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// format and write message
|
|
||||||
var format = process.stderr.isTTY
|
|
||||||
? formatColor
|
|
||||||
: formatPlain
|
|
||||||
var msg = format.call(this, message, caller, stack.slice(i))
|
|
||||||
process.stderr.write(msg + '\n', 'utf8')
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get call site location as array.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function callSiteLocation(callSite) {
|
|
||||||
var file = callSite.getFileName() || '<anonymous>'
|
|
||||||
var line = callSite.getLineNumber()
|
|
||||||
var colm = callSite.getColumnNumber()
|
|
||||||
|
|
||||||
if (callSite.isEval()) {
|
|
||||||
file = callSite.getEvalOrigin() + ', ' + file
|
|
||||||
}
|
|
||||||
|
|
||||||
var site = [file, line, colm]
|
|
||||||
|
|
||||||
site.callSite = callSite
|
|
||||||
site.name = callSite.getFunctionName()
|
|
||||||
|
|
||||||
return site
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a default message from the site.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function defaultMessage(site) {
|
|
||||||
var callSite = site.callSite
|
|
||||||
var funcName = site.name
|
|
||||||
|
|
||||||
// make useful anonymous name
|
|
||||||
if (!funcName) {
|
|
||||||
funcName = '<anonymous@' + formatLocation(site) + '>'
|
|
||||||
}
|
|
||||||
|
|
||||||
var context = callSite.getThis()
|
|
||||||
var typeName = context && callSite.getTypeName()
|
|
||||||
|
|
||||||
// ignore useless type name
|
|
||||||
if (typeName === 'Object') {
|
|
||||||
typeName = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
// make useful type name
|
|
||||||
if (typeName === 'Function') {
|
|
||||||
typeName = context.name || typeName
|
|
||||||
}
|
|
||||||
|
|
||||||
return typeName && callSite.getMethodName()
|
|
||||||
? typeName + '.' + funcName
|
|
||||||
: funcName
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format deprecation message without color.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function formatPlain(msg, caller, stack) {
|
|
||||||
var timestamp = new Date().toUTCString()
|
|
||||||
|
|
||||||
var formatted = timestamp
|
|
||||||
+ ' ' + this._namespace
|
|
||||||
+ ' deprecated ' + msg
|
|
||||||
|
|
||||||
// add stack trace
|
|
||||||
if (this._traced) {
|
|
||||||
for (var i = 0; i < stack.length; i++) {
|
|
||||||
formatted += '\n at ' + callSiteToString(stack[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatted
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller) {
|
|
||||||
formatted += ' at ' + formatLocation(caller)
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatted
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format deprecation message with color.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function formatColor(msg, caller, stack) {
|
|
||||||
var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan
|
|
||||||
+ ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow
|
|
||||||
+ ' \x1b[0m' + msg + '\x1b[39m' // reset
|
|
||||||
|
|
||||||
// add stack trace
|
|
||||||
if (this._traced) {
|
|
||||||
for (var i = 0; i < stack.length; i++) {
|
|
||||||
formatted += '\n \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatted
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller) {
|
|
||||||
formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatted
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format call site location.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function formatLocation(callSite) {
|
|
||||||
return relative(basePath, callSite[0])
|
|
||||||
+ ':' + callSite[1]
|
|
||||||
+ ':' + callSite[2]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the stack as array of call sites.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getStack() {
|
|
||||||
var limit = Error.stackTraceLimit
|
|
||||||
var obj = {}
|
|
||||||
var prep = Error.prepareStackTrace
|
|
||||||
|
|
||||||
Error.prepareStackTrace = prepareObjectStackTrace
|
|
||||||
Error.stackTraceLimit = Math.max(10, limit)
|
|
||||||
|
|
||||||
// capture the stack
|
|
||||||
Error.captureStackTrace(obj)
|
|
||||||
|
|
||||||
// slice this function off the top
|
|
||||||
var stack = obj.stack.slice(1)
|
|
||||||
|
|
||||||
Error.prepareStackTrace = prep
|
|
||||||
Error.stackTraceLimit = limit
|
|
||||||
|
|
||||||
return stack
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Capture call site stack from v8.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function prepareObjectStackTrace(obj, stack) {
|
|
||||||
return stack
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a wrapped function in a deprecation message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function wrapfunction(fn, message) {
|
|
||||||
if (typeof fn !== 'function') {
|
|
||||||
throw new TypeError('argument fn must be a function')
|
|
||||||
}
|
|
||||||
|
|
||||||
var args = createArgumentsString(fn.length)
|
|
||||||
var deprecate = this
|
|
||||||
var stack = getStack()
|
|
||||||
var site = callSiteLocation(stack[1])
|
|
||||||
|
|
||||||
site.name = fn.name
|
|
||||||
|
|
||||||
var deprecatedfn = eval('(function (' + args + ') {\n'
|
|
||||||
+ '"use strict"\n'
|
|
||||||
+ 'log.call(deprecate, message, site)\n'
|
|
||||||
+ 'return fn.apply(this, arguments)\n'
|
|
||||||
+ '})')
|
|
||||||
|
|
||||||
return deprecatedfn
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrap property in a deprecation message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function wrapproperty(obj, prop, message) {
|
|
||||||
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
||||||
throw new TypeError('argument obj must be object')
|
|
||||||
}
|
|
||||||
|
|
||||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
|
||||||
|
|
||||||
if (!descriptor) {
|
|
||||||
throw new TypeError('must call property on owner object')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!descriptor.configurable) {
|
|
||||||
throw new TypeError('property must be configurable')
|
|
||||||
}
|
|
||||||
|
|
||||||
var deprecate = this
|
|
||||||
var stack = getStack()
|
|
||||||
var site = callSiteLocation(stack[1])
|
|
||||||
|
|
||||||
// set site name
|
|
||||||
site.name = prop
|
|
||||||
|
|
||||||
// convert data descriptor
|
|
||||||
if ('value' in descriptor) {
|
|
||||||
descriptor = convertDataDescriptorToAccessor(obj, prop, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
var get = descriptor.get
|
|
||||||
var set = descriptor.set
|
|
||||||
|
|
||||||
// wrap getter
|
|
||||||
if (typeof get === 'function') {
|
|
||||||
descriptor.get = function getter() {
|
|
||||||
log.call(deprecate, message, site)
|
|
||||||
return get.apply(this, arguments)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// wrap setter
|
|
||||||
if (typeof set === 'function') {
|
|
||||||
descriptor.set = function setter() {
|
|
||||||
log.call(deprecate, message, site)
|
|
||||||
return set.apply(this, arguments)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(obj, prop, descriptor)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create DeprecationError for deprecation
|
|
||||||
*/
|
|
||||||
|
|
||||||
function DeprecationError(namespace, message, stack) {
|
|
||||||
var error = new Error()
|
|
||||||
var stackString
|
|
||||||
|
|
||||||
Object.defineProperty(error, 'constructor', {
|
|
||||||
value: DeprecationError
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.defineProperty(error, 'message', {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false,
|
|
||||||
value: message,
|
|
||||||
writable: true
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.defineProperty(error, 'name', {
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
value: 'DeprecationError',
|
|
||||||
writable: true
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.defineProperty(error, 'namespace', {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false,
|
|
||||||
value: namespace,
|
|
||||||
writable: true
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.defineProperty(error, 'stack', {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false,
|
|
||||||
get: function () {
|
|
||||||
if (stackString !== undefined) {
|
|
||||||
return stackString
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepare stack trace
|
|
||||||
return stackString = createStackString.call(this, stack)
|
|
||||||
},
|
|
||||||
set: function setter(val) {
|
|
||||||
stackString = val
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return error
|
|
||||||
}
|
|
79
node_modules/depd/lib/browser/index.js
generated
vendored
79
node_modules/depd/lib/browser/index.js
generated
vendored
@@ -1,79 +0,0 @@
|
|||||||
/*!
|
|
||||||
* depd
|
|
||||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = depd
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create deprecate for namespace in caller.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function depd(namespace) {
|
|
||||||
if (!namespace) {
|
|
||||||
throw new TypeError('argument namespace is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
function deprecate(message) {
|
|
||||||
// no-op in browser
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecate._file = undefined
|
|
||||||
deprecate._ignored = true
|
|
||||||
deprecate._namespace = namespace
|
|
||||||
deprecate._traced = false
|
|
||||||
deprecate._warned = Object.create(null)
|
|
||||||
|
|
||||||
deprecate.function = wrapfunction
|
|
||||||
deprecate.property = wrapproperty
|
|
||||||
|
|
||||||
return deprecate
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a wrapped function in a deprecation message.
|
|
||||||
*
|
|
||||||
* This is a no-op version of the wrapper, which does nothing but call
|
|
||||||
* validation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function wrapfunction(fn, message) {
|
|
||||||
if (typeof fn !== 'function') {
|
|
||||||
throw new TypeError('argument fn must be a function')
|
|
||||||
}
|
|
||||||
|
|
||||||
return fn
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrap property in a deprecation message.
|
|
||||||
*
|
|
||||||
* This is a no-op version of the wrapper, which does nothing but call
|
|
||||||
* validation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function wrapproperty(obj, prop, message) {
|
|
||||||
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
||||||
throw new TypeError('argument obj must be object')
|
|
||||||
}
|
|
||||||
|
|
||||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
|
||||||
|
|
||||||
if (!descriptor) {
|
|
||||||
throw new TypeError('must call property on owner object')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!descriptor.configurable) {
|
|
||||||
throw new TypeError('property must be configurable')
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
35
node_modules/depd/lib/compat/buffer-concat.js
generated
vendored
35
node_modules/depd/lib/compat/buffer-concat.js
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
/*!
|
|
||||||
* depd
|
|
||||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = bufferConcat
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Concatenate an array of Buffers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function bufferConcat(bufs) {
|
|
||||||
var length = 0
|
|
||||||
|
|
||||||
for (var i = 0, len = bufs.length; i < len; i++) {
|
|
||||||
length += bufs[i].length
|
|
||||||
}
|
|
||||||
|
|
||||||
var buf = new Buffer(length)
|
|
||||||
var pos = 0
|
|
||||||
|
|
||||||
for (var i = 0, len = bufs.length; i < len; i++) {
|
|
||||||
bufs[i].copy(buf, pos)
|
|
||||||
pos += bufs[i].length
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
103
node_modules/depd/lib/compat/callsite-tostring.js
generated
vendored
103
node_modules/depd/lib/compat/callsite-tostring.js
generated
vendored
@@ -1,103 +0,0 @@
|
|||||||
/*!
|
|
||||||
* depd
|
|
||||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = callSiteToString
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format a CallSite file location to a string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function callSiteFileLocation(callSite) {
|
|
||||||
var fileName
|
|
||||||
var fileLocation = ''
|
|
||||||
|
|
||||||
if (callSite.isNative()) {
|
|
||||||
fileLocation = 'native'
|
|
||||||
} else if (callSite.isEval()) {
|
|
||||||
fileName = callSite.getScriptNameOrSourceURL()
|
|
||||||
if (!fileName) {
|
|
||||||
fileLocation = callSite.getEvalOrigin()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fileName = callSite.getFileName()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileName) {
|
|
||||||
fileLocation += fileName
|
|
||||||
|
|
||||||
var lineNumber = callSite.getLineNumber()
|
|
||||||
if (lineNumber != null) {
|
|
||||||
fileLocation += ':' + lineNumber
|
|
||||||
|
|
||||||
var columnNumber = callSite.getColumnNumber()
|
|
||||||
if (columnNumber) {
|
|
||||||
fileLocation += ':' + columnNumber
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fileLocation || 'unknown source'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format a CallSite to a string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function callSiteToString(callSite) {
|
|
||||||
var addSuffix = true
|
|
||||||
var fileLocation = callSiteFileLocation(callSite)
|
|
||||||
var functionName = callSite.getFunctionName()
|
|
||||||
var isConstructor = callSite.isConstructor()
|
|
||||||
var isMethodCall = !(callSite.isToplevel() || isConstructor)
|
|
||||||
var line = ''
|
|
||||||
|
|
||||||
if (isMethodCall) {
|
|
||||||
var methodName = callSite.getMethodName()
|
|
||||||
var typeName = getConstructorName(callSite)
|
|
||||||
|
|
||||||
if (functionName) {
|
|
||||||
if (typeName && functionName.indexOf(typeName) !== 0) {
|
|
||||||
line += typeName + '.'
|
|
||||||
}
|
|
||||||
|
|
||||||
line += functionName
|
|
||||||
|
|
||||||
if (methodName && functionName.lastIndexOf('.' + methodName) !== functionName.length - methodName.length - 1) {
|
|
||||||
line += ' [as ' + methodName + ']'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
line += typeName + '.' + (methodName || '<anonymous>')
|
|
||||||
}
|
|
||||||
} else if (isConstructor) {
|
|
||||||
line += 'new ' + (functionName || '<anonymous>')
|
|
||||||
} else if (functionName) {
|
|
||||||
line += functionName
|
|
||||||
} else {
|
|
||||||
addSuffix = false
|
|
||||||
line += fileLocation
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addSuffix) {
|
|
||||||
line += ' (' + fileLocation + ')'
|
|
||||||
}
|
|
||||||
|
|
||||||
return line
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get constructor name of reviver.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getConstructorName(obj) {
|
|
||||||
var receiver = obj.receiver
|
|
||||||
return (receiver.constructor && receiver.constructor.name) || null
|
|
||||||
}
|
|
22
node_modules/depd/lib/compat/event-listener-count.js
generated
vendored
22
node_modules/depd/lib/compat/event-listener-count.js
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
/*!
|
|
||||||
* depd
|
|
||||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = eventListenerCount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the count of listeners on an event emitter of a specific type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function eventListenerCount(emitter, type) {
|
|
||||||
return emitter.listeners(type).length
|
|
||||||
}
|
|
84
node_modules/depd/lib/compat/index.js
generated
vendored
84
node_modules/depd/lib/compat/index.js
generated
vendored
@@ -1,84 +0,0 @@
|
|||||||
/*!
|
|
||||||
* depd
|
|
||||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Buffer = require('buffer')
|
|
||||||
var EventEmitter = require('events').EventEmitter
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
lazyProperty(module.exports, 'bufferConcat', function bufferConcat() {
|
|
||||||
return Buffer.concat || require('./buffer-concat')
|
|
||||||
})
|
|
||||||
|
|
||||||
lazyProperty(module.exports, 'callSiteToString', function callSiteToString() {
|
|
||||||
var limit = Error.stackTraceLimit
|
|
||||||
var obj = {}
|
|
||||||
var prep = Error.prepareStackTrace
|
|
||||||
|
|
||||||
function prepareObjectStackTrace(obj, stack) {
|
|
||||||
return stack
|
|
||||||
}
|
|
||||||
|
|
||||||
Error.prepareStackTrace = prepareObjectStackTrace
|
|
||||||
Error.stackTraceLimit = 2
|
|
||||||
|
|
||||||
// capture the stack
|
|
||||||
Error.captureStackTrace(obj)
|
|
||||||
|
|
||||||
// slice the stack
|
|
||||||
var stack = obj.stack.slice()
|
|
||||||
|
|
||||||
Error.prepareStackTrace = prep
|
|
||||||
Error.stackTraceLimit = limit
|
|
||||||
|
|
||||||
return stack[0].toString ? toString : require('./callsite-tostring')
|
|
||||||
})
|
|
||||||
|
|
||||||
lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount() {
|
|
||||||
return EventEmitter.listenerCount || require('./event-listener-count')
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a lazy property.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function lazyProperty(obj, prop, getter) {
|
|
||||||
function get() {
|
|
||||||
var val = getter()
|
|
||||||
|
|
||||||
Object.defineProperty(obj, prop, {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: true,
|
|
||||||
value: val
|
|
||||||
})
|
|
||||||
|
|
||||||
return val
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(obj, prop, {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: true,
|
|
||||||
get: get
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call toString() on the obj
|
|
||||||
*/
|
|
||||||
|
|
||||||
function toString(obj) {
|
|
||||||
return obj.toString()
|
|
||||||
}
|
|
93
node_modules/depd/package.json
generated
vendored
93
node_modules/depd/package.json
generated
vendored
@@ -1,93 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"depd@~1.1.0",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "depd@>=1.1.0 <1.2.0",
|
|
||||||
"_id": "depd@1.1.0",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/depd",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "depd",
|
|
||||||
"raw": "depd@~1.1.0",
|
|
||||||
"rawSpec": "~1.1.0",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=1.1.0 <1.2.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz",
|
|
||||||
"_shasum": "e1bd82c6aab6ced965b97b88b17ed3e528ca18c3",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "depd@~1.1.0",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send",
|
|
||||||
"author": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
},
|
|
||||||
"browser": "lib/browser/index.js",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/dougwilson/nodejs-depd/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "Deprecate all the things",
|
|
||||||
"devDependencies": {
|
|
||||||
"beautify-benchmark": "0.2.4",
|
|
||||||
"benchmark": "1.0.0",
|
|
||||||
"istanbul": "0.3.5",
|
|
||||||
"mocha": "~1.21.5"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "e1bd82c6aab6ced965b97b88b17ed3e528ca18c3",
|
|
||||||
"tarball": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib/",
|
|
||||||
"History.md",
|
|
||||||
"LICENSE",
|
|
||||||
"index.js",
|
|
||||||
"Readme.md"
|
|
||||||
],
|
|
||||||
"gitHead": "78c659de20283e3a6bee92bda455e6daff01686a",
|
|
||||||
"homepage": "https://github.com/dougwilson/nodejs-depd",
|
|
||||||
"keywords": [
|
|
||||||
"deprecate",
|
|
||||||
"deprecated"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "depd",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/dougwilson/nodejs-depd.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"bench": "node benchmark/index.js",
|
|
||||||
"test": "mocha --reporter spec --bail test/",
|
|
||||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --no-exit test/",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/"
|
|
||||||
},
|
|
||||||
"version": "1.1.0"
|
|
||||||
}
|
|
22
node_modules/destroy/LICENSE
generated
vendored
22
node_modules/destroy/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
60
node_modules/destroy/README.md
generated
vendored
60
node_modules/destroy/README.md
generated
vendored
@@ -1,60 +0,0 @@
|
|||||||
# Destroy
|
|
||||||
|
|
||||||
[![NPM version][npm-image]][npm-url]
|
|
||||||
[![Build status][travis-image]][travis-url]
|
|
||||||
[![Test coverage][coveralls-image]][coveralls-url]
|
|
||||||
[![License][license-image]][license-url]
|
|
||||||
[![Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Gittip][gittip-image]][gittip-url]
|
|
||||||
|
|
||||||
Destroy a stream.
|
|
||||||
|
|
||||||
This module is meant to ensure a stream gets destroyed, handling different APIs
|
|
||||||
and Node.js bugs.
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var destroy = require('destroy')
|
|
||||||
```
|
|
||||||
|
|
||||||
### destroy(stream)
|
|
||||||
|
|
||||||
Destroy the given stream. In most cases, this is identical to a simple
|
|
||||||
`stream.destroy()` call. The rules are as follows for a given stream:
|
|
||||||
|
|
||||||
1. If the `stream` is an instance of `ReadStream`, then call `stream.destroy()`
|
|
||||||
and add a listener to the `open` event to call `stream.close()` if it is
|
|
||||||
fired. This is for a Node.js bug that will leak a file descriptor if
|
|
||||||
`.destroy()` is called before `open`.
|
|
||||||
2. If the `stream` is not an instance of `Stream`, then nothing happens.
|
|
||||||
3. If the `stream` has a `.destroy()` method, then call it.
|
|
||||||
|
|
||||||
The function returns the `stream` passed in as the argument.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
var destroy = require('destroy')
|
|
||||||
|
|
||||||
var fs = require('fs')
|
|
||||||
var stream = fs.createReadStream('package.json')
|
|
||||||
|
|
||||||
// ... and later
|
|
||||||
destroy(stream)
|
|
||||||
```
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square
|
|
||||||
[npm-url]: https://npmjs.org/package/destroy
|
|
||||||
[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square
|
|
||||||
[github-url]: https://github.com/stream-utils/destroy/tags
|
|
||||||
[travis-image]: https://img.shields.io/travis/stream-utils/destroy.svg?style=flat-square
|
|
||||||
[travis-url]: https://travis-ci.org/stream-utils/destroy
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square
|
|
||||||
[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master
|
|
||||||
[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square
|
|
||||||
[license-url]: LICENSE.md
|
|
||||||
[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square
|
|
||||||
[downloads-url]: https://npmjs.org/package/destroy
|
|
||||||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
|
|
||||||
[gittip-url]: https://www.gittip.com/jonathanong/
|
|
75
node_modules/destroy/index.js
generated
vendored
75
node_modules/destroy/index.js
generated
vendored
@@ -1,75 +0,0 @@
|
|||||||
/*!
|
|
||||||
* destroy
|
|
||||||
* Copyright(c) 2014 Jonathan Ong
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var ReadStream = require('fs').ReadStream
|
|
||||||
var Stream = require('stream')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = destroy
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy a stream.
|
|
||||||
*
|
|
||||||
* @param {object} stream
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function destroy(stream) {
|
|
||||||
if (stream instanceof ReadStream) {
|
|
||||||
return destroyReadStream(stream)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(stream instanceof Stream)) {
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof stream.destroy === 'function') {
|
|
||||||
stream.destroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy a ReadStream.
|
|
||||||
*
|
|
||||||
* @param {object} stream
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function destroyReadStream(stream) {
|
|
||||||
stream.destroy()
|
|
||||||
|
|
||||||
if (typeof stream.close === 'function') {
|
|
||||||
// node.js core bug work-around
|
|
||||||
stream.on('open', onOpenClose)
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On open handler to close stream.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function onOpenClose() {
|
|
||||||
if (typeof this.fd === 'number') {
|
|
||||||
// actually close down the fd
|
|
||||||
this.close()
|
|
||||||
}
|
|
||||||
}
|
|
98
node_modules/destroy/package.json
generated
vendored
98
node_modules/destroy/package.json
generated
vendored
@@ -1,98 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"destroy@~1.0.4",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "destroy@>=1.0.4 <1.1.0",
|
|
||||||
"_id": "destroy@1.0.4",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/destroy",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "destroy",
|
|
||||||
"raw": "destroy@~1.0.4",
|
|
||||||
"rawSpec": "~1.0.4",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=1.0.4 <1.1.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
|
||||||
"_shasum": "978857442c44749e4206613e37946205826abd80",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "destroy@~1.0.4",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send",
|
|
||||||
"author": {
|
|
||||||
"email": "me@jongleberry.com",
|
|
||||||
"name": "Jonathan Ong",
|
|
||||||
"url": "http://jongleberry.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/stream-utils/destroy/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "destroy a stream if possible",
|
|
||||||
"devDependencies": {
|
|
||||||
"istanbul": "0.4.2",
|
|
||||||
"mocha": "2.3.4"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "978857442c44749e4206613e37946205826abd80",
|
|
||||||
"tarball": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"index.js",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
|
||||||
"gitHead": "86edea01456f5fa1027f6a47250c34c713cbcc3b",
|
|
||||||
"homepage": "https://github.com/stream-utils/destroy",
|
|
||||||
"keywords": [
|
|
||||||
"stream",
|
|
||||||
"streams",
|
|
||||||
"destroy",
|
|
||||||
"cleanup",
|
|
||||||
"leak",
|
|
||||||
"fd"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "jonathanrichardong@gmail.com",
|
|
||||||
"name": "jongleberry"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "destroy",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/stream-utils/destroy.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "mocha --reporter spec",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
|
||||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
|
||||||
},
|
|
||||||
"version": "1.0.4"
|
|
||||||
}
|
|
22
node_modules/ee-first/LICENSE
generated
vendored
22
node_modules/ee-first/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
80
node_modules/ee-first/README.md
generated
vendored
80
node_modules/ee-first/README.md
generated
vendored
@@ -1,80 +0,0 @@
|
|||||||
# EE First
|
|
||||||
|
|
||||||
[![NPM version][npm-image]][npm-url]
|
|
||||||
[![Build status][travis-image]][travis-url]
|
|
||||||
[![Test coverage][coveralls-image]][coveralls-url]
|
|
||||||
[![License][license-image]][license-url]
|
|
||||||
[![Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Gittip][gittip-image]][gittip-url]
|
|
||||||
|
|
||||||
Get the first event in a set of event emitters and event pairs,
|
|
||||||
then clean up after itself.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install ee-first
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var first = require('ee-first')
|
|
||||||
```
|
|
||||||
|
|
||||||
### first(arr, listener)
|
|
||||||
|
|
||||||
Invoke `listener` on the first event from the list specified in `arr`. `arr` is
|
|
||||||
an array of arrays, with each array in the format `[ee, ...event]`. `listener`
|
|
||||||
will be called only once, the first time any of the given events are emitted. If
|
|
||||||
`error` is one of the listened events, then if that fires first, the `listener`
|
|
||||||
will be given the `err` argument.
|
|
||||||
|
|
||||||
The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the
|
|
||||||
first argument emitted from an `error` event, if applicable; `ee` is the event
|
|
||||||
emitter that fired; `event` is the string event name that fired; and `args` is an
|
|
||||||
array of the arguments that were emitted on the event.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var ee1 = new EventEmitter()
|
|
||||||
var ee2 = new EventEmitter()
|
|
||||||
|
|
||||||
first([
|
|
||||||
[ee1, 'close', 'end', 'error'],
|
|
||||||
[ee2, 'error']
|
|
||||||
], function (err, ee, event, args) {
|
|
||||||
// listener invoked
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### .cancel()
|
|
||||||
|
|
||||||
The group of listeners can be cancelled before being invoked and have all the event
|
|
||||||
listeners removed from the underlying event emitters.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var thunk = first([
|
|
||||||
[ee1, 'close', 'end', 'error'],
|
|
||||||
[ee2, 'error']
|
|
||||||
], function (err, ee, event, args) {
|
|
||||||
// listener invoked
|
|
||||||
})
|
|
||||||
|
|
||||||
// cancel and clean up
|
|
||||||
thunk.cancel()
|
|
||||||
```
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square
|
|
||||||
[npm-url]: https://npmjs.org/package/ee-first
|
|
||||||
[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square
|
|
||||||
[github-url]: https://github.com/jonathanong/ee-first/tags
|
|
||||||
[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square
|
|
||||||
[travis-url]: https://travis-ci.org/jonathanong/ee-first
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master
|
|
||||||
[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square
|
|
||||||
[license-url]: LICENSE.md
|
|
||||||
[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square
|
|
||||||
[downloads-url]: https://npmjs.org/package/ee-first
|
|
||||||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
|
|
||||||
[gittip-url]: https://www.gittip.com/jonathanong/
|
|
95
node_modules/ee-first/index.js
generated
vendored
95
node_modules/ee-first/index.js
generated
vendored
@@ -1,95 +0,0 @@
|
|||||||
/*!
|
|
||||||
* ee-first
|
|
||||||
* Copyright(c) 2014 Jonathan Ong
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = first
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the first event in a set of event emitters and event pairs.
|
|
||||||
*
|
|
||||||
* @param {array} stuff
|
|
||||||
* @param {function} done
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function first(stuff, done) {
|
|
||||||
if (!Array.isArray(stuff))
|
|
||||||
throw new TypeError('arg must be an array of [ee, events...] arrays')
|
|
||||||
|
|
||||||
var cleanups = []
|
|
||||||
|
|
||||||
for (var i = 0; i < stuff.length; i++) {
|
|
||||||
var arr = stuff[i]
|
|
||||||
|
|
||||||
if (!Array.isArray(arr) || arr.length < 2)
|
|
||||||
throw new TypeError('each array member must be [ee, events...]')
|
|
||||||
|
|
||||||
var ee = arr[0]
|
|
||||||
|
|
||||||
for (var j = 1; j < arr.length; j++) {
|
|
||||||
var event = arr[j]
|
|
||||||
var fn = listener(event, callback)
|
|
||||||
|
|
||||||
// listen to the event
|
|
||||||
ee.on(event, fn)
|
|
||||||
// push this listener to the list of cleanups
|
|
||||||
cleanups.push({
|
|
||||||
ee: ee,
|
|
||||||
event: event,
|
|
||||||
fn: fn,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function callback() {
|
|
||||||
cleanup()
|
|
||||||
done.apply(null, arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanup() {
|
|
||||||
var x
|
|
||||||
for (var i = 0; i < cleanups.length; i++) {
|
|
||||||
x = cleanups[i]
|
|
||||||
x.ee.removeListener(x.event, x.fn)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function thunk(fn) {
|
|
||||||
done = fn
|
|
||||||
}
|
|
||||||
|
|
||||||
thunk.cancel = cleanup
|
|
||||||
|
|
||||||
return thunk
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the event listener.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function listener(event, done) {
|
|
||||||
return function onevent(arg1) {
|
|
||||||
var args = new Array(arguments.length)
|
|
||||||
var ee = this
|
|
||||||
var err = event === 'error'
|
|
||||||
? arg1
|
|
||||||
: null
|
|
||||||
|
|
||||||
// copy args to prevent arguments escaping scope
|
|
||||||
for (var i = 0; i < args.length; i++) {
|
|
||||||
args[i] = arguments[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
done(err, ee, event, args)
|
|
||||||
}
|
|
||||||
}
|
|
90
node_modules/ee-first/package.json
generated
vendored
90
node_modules/ee-first/package.json
generated
vendored
@@ -1,90 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"ee-first@1.1.1",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/on-finished"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "ee-first@1.1.1",
|
|
||||||
"_id": "ee-first@1.1.1",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/ee-first",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "ee-first",
|
|
||||||
"raw": "ee-first@1.1.1",
|
|
||||||
"rawSpec": "1.1.1",
|
|
||||||
"scope": null,
|
|
||||||
"spec": "1.1.1",
|
|
||||||
"type": "version"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/on-finished"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
|
||||||
"_shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "ee-first@1.1.1",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/on-finished",
|
|
||||||
"author": {
|
|
||||||
"email": "me@jongleberry.com",
|
|
||||||
"name": "Jonathan Ong",
|
|
||||||
"url": "http://jongleberry.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jonathanong/ee-first/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "return the first event in a set of ee/event pairs",
|
|
||||||
"devDependencies": {
|
|
||||||
"istanbul": "0.3.9",
|
|
||||||
"mocha": "2.2.5"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d",
|
|
||||||
"tarball": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"index.js",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
|
||||||
"gitHead": "512e0ce4cc3643f603708f965a97b61b1a9c0441",
|
|
||||||
"homepage": "https://github.com/jonathanong/ee-first",
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "jonathanrichardong@gmail.com",
|
|
||||||
"name": "jongleberry"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "ee-first",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jonathanong/ee-first.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
|
||||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
|
||||||
},
|
|
||||||
"version": "1.1.1"
|
|
||||||
}
|
|
9
node_modules/encodeurl/HISTORY.md
generated
vendored
9
node_modules/encodeurl/HISTORY.md
generated
vendored
@@ -1,9 +0,0 @@
|
|||||||
1.0.1 / 2016-06-09
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix encoding unpaired surrogates at start/end of string
|
|
||||||
|
|
||||||
1.0.0 / 2016-06-08
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Initial release
|
|
22
node_modules/encodeurl/LICENSE
generated
vendored
22
node_modules/encodeurl/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2016 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.
|
|
124
node_modules/encodeurl/README.md
generated
vendored
124
node_modules/encodeurl/README.md
generated
vendored
@@ -1,124 +0,0 @@
|
|||||||
# encodeurl
|
|
||||||
|
|
||||||
[![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]
|
|
||||||
|
|
||||||
Encode a URL to a percent-encoded form, excluding already-encoded sequences
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install encodeurl
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var encodeUrl = require('encodeurl')
|
|
||||||
```
|
|
||||||
|
|
||||||
### encodeUrl(url)
|
|
||||||
|
|
||||||
Encode a URL to a percent-encoded form, excluding already-encoded sequences.
|
|
||||||
|
|
||||||
This function will take an already-encoded URL and encode all the non-URL
|
|
||||||
code points (as UTF-8 byte sequences). This function will not encode the
|
|
||||||
"%" character unless it is not part of a valid sequence (`%20` will be
|
|
||||||
left as-is, but `%foo` will be encoded as `%25foo`).
|
|
||||||
|
|
||||||
This encode is meant to be "safe" and does not throw errors. It will try as
|
|
||||||
hard as it can to properly encode the given URL, including replacing any raw,
|
|
||||||
unpaired surrogate pairs with the Unicode replacement character prior to
|
|
||||||
encoding.
|
|
||||||
|
|
||||||
This function is _similar_ to the intrinsic function `encodeURI`, except it
|
|
||||||
will not encode the `%` character if that is part of a valid sequence, will
|
|
||||||
not encode `[` and `]` (for IPv6 hostnames) and will replace raw, unpaired
|
|
||||||
surrogate pairs with the Unicode replacement character (instead of throwing).
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Encode a URL containing user-controled data
|
|
||||||
|
|
||||||
```js
|
|
||||||
var encodeUrl = require('encodeurl')
|
|
||||||
var escapeHtml = require('escape-html')
|
|
||||||
|
|
||||||
http.createServer(function onRequest (req, res) {
|
|
||||||
// get encoded form of inbound url
|
|
||||||
var url = encodeUrl(req.url)
|
|
||||||
|
|
||||||
// create html message
|
|
||||||
var body = '<p>Location ' + escapeHtml(url) + ' not found</p>'
|
|
||||||
|
|
||||||
// send a 404
|
|
||||||
res.statusCode = 404
|
|
||||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
|
||||||
res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
|
|
||||||
res.end(body, 'utf-8')
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Encode a URL for use in a header field
|
|
||||||
|
|
||||||
```js
|
|
||||||
var encodeUrl = require('encodeurl')
|
|
||||||
var escapeHtml = require('escape-html')
|
|
||||||
var url = require('url')
|
|
||||||
|
|
||||||
http.createServer(function onRequest (req, res) {
|
|
||||||
// parse inbound url
|
|
||||||
var href = url.parse(req)
|
|
||||||
|
|
||||||
// set new host for redirect
|
|
||||||
href.host = 'localhost'
|
|
||||||
href.protocol = 'https:'
|
|
||||||
href.slashes = true
|
|
||||||
|
|
||||||
// create location header
|
|
||||||
var location = encodeUrl(url.format(href))
|
|
||||||
|
|
||||||
// create html message
|
|
||||||
var body = '<p>Redirecting to new site: ' + escapeHtml(location) + '</p>'
|
|
||||||
|
|
||||||
// send a 301
|
|
||||||
res.statusCode = 301
|
|
||||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
|
||||||
res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
|
|
||||||
res.setHeader('Location', location)
|
|
||||||
res.end(body, 'utf-8')
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm test
|
|
||||||
$ npm run lint
|
|
||||||
```
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax][rfc-3986]
|
|
||||||
- [WHATWG URL Living Standard][whatwg-url]
|
|
||||||
|
|
||||||
[rfc-3986]: https://tools.ietf.org/html/rfc3986
|
|
||||||
[whatwg-url]: https://url.spec.whatwg.org/
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/encodeurl.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/encodeurl
|
|
||||||
[node-version-image]: https://img.shields.io/node/v/encodeurl.svg
|
|
||||||
[node-version-url]: https://nodejs.org/en/download
|
|
||||||
[travis-image]: https://img.shields.io/travis/pillarjs/encodeurl.svg
|
|
||||||
[travis-url]: https://travis-ci.org/pillarjs/encodeurl
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/encodeurl.svg
|
|
||||||
[coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/encodeurl.svg
|
|
||||||
[downloads-url]: https://npmjs.org/package/encodeurl
|
|
60
node_modules/encodeurl/index.js
generated
vendored
60
node_modules/encodeurl/index.js
generated
vendored
@@ -1,60 +0,0 @@
|
|||||||
/*!
|
|
||||||
* encodeurl
|
|
||||||
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = encodeUrl
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
|
|
||||||
* and including invalid escape sequences.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]))+/g
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RegExp to match unmatched surrogate pair.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g
|
|
||||||
|
|
||||||
/**
|
|
||||||
* String to replace unmatched surrogate pair with.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encode a URL to a percent-encoded form, excluding already-encoded sequences.
|
|
||||||
*
|
|
||||||
* This function will take an already-encoded URL and encode all the non-URL
|
|
||||||
* code points. This function will not encode the "%" character unless it is
|
|
||||||
* not part of a valid sequence (`%20` will be left as-is, but `%foo` will
|
|
||||||
* be encoded as `%25foo`).
|
|
||||||
*
|
|
||||||
* This encode is meant to be "safe" and does not throw errors. It will try as
|
|
||||||
* hard as it can to properly encode the given URL, including replacing any raw,
|
|
||||||
* unpaired surrogate pairs with the Unicode replacement character prior to
|
|
||||||
* encoding.
|
|
||||||
*
|
|
||||||
* @param {string} url
|
|
||||||
* @return {string}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function encodeUrl (url) {
|
|
||||||
return String(url)
|
|
||||||
.replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
|
|
||||||
.replace(ENCODE_CHARS_REGEXP, encodeURI)
|
|
||||||
}
|
|
102
node_modules/encodeurl/package.json
generated
vendored
102
node_modules/encodeurl/package.json
generated
vendored
@@ -1,102 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"encodeurl@~1.0.1",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/serve-static"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "encodeurl@>=1.0.1 <1.1.0",
|
|
||||||
"_id": "encodeurl@1.0.1",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/encodeurl",
|
|
||||||
"_nodeVersion": "4.4.3",
|
|
||||||
"_npmOperationalInternal": {
|
|
||||||
"host": "packages-12-west.internal.npmjs.com",
|
|
||||||
"tmp": "tmp/encodeurl-1.0.1.tgz_1465519736251_0.09314409433864057"
|
|
||||||
},
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "2.15.1",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "encodeurl",
|
|
||||||
"raw": "encodeurl@~1.0.1",
|
|
||||||
"rawSpec": "~1.0.1",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=1.0.1 <1.1.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send",
|
|
||||||
"/serve-static"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz",
|
|
||||||
"_shasum": "79e3d58655346909fe6f0f45a5de68103b294d20",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "encodeurl@~1.0.1",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/serve-static",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/pillarjs/encodeurl/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences",
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "2.11.1",
|
|
||||||
"eslint-config-standard": "5.3.1",
|
|
||||||
"eslint-plugin-promise": "1.3.2",
|
|
||||||
"eslint-plugin-standard": "1.3.2",
|
|
||||||
"istanbul": "0.4.3",
|
|
||||||
"mocha": "2.5.3"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "79e3d58655346909fe6f0f45a5de68103b294d20",
|
|
||||||
"tarball": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"LICENSE",
|
|
||||||
"HISTORY.md",
|
|
||||||
"README.md",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"gitHead": "39ed0c235fed4cea7d012038fd6bb0480561d226",
|
|
||||||
"homepage": "https://github.com/pillarjs/encodeurl#readme",
|
|
||||||
"keywords": [
|
|
||||||
"encode",
|
|
||||||
"encodeurl",
|
|
||||||
"url"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "encodeurl",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/pillarjs/encodeurl.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint **/*.js",
|
|
||||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
|
||||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
|
||||||
},
|
|
||||||
"version": "1.0.1"
|
|
||||||
}
|
|
24
node_modules/escape-html/LICENSE
generated
vendored
24
node_modules/escape-html/LICENSE
generated
vendored
@@ -1,24 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2012-2013 TJ Holowaychuk
|
|
||||||
Copyright (c) 2015 Andreas Lubbe
|
|
||||||
Copyright (c) 2015 Tiancheng "Timothy" Gu
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
'Software'), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
43
node_modules/escape-html/Readme.md
generated
vendored
43
node_modules/escape-html/Readme.md
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
|
|
||||||
# escape-html
|
|
||||||
|
|
||||||
Escape string for use in HTML
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
var escape = require('escape-html');
|
|
||||||
var html = escape('foo & bar');
|
|
||||||
// -> foo & bar
|
|
||||||
```
|
|
||||||
|
|
||||||
## Benchmark
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npm run-script bench
|
|
||||||
|
|
||||||
> escape-html@1.0.3 bench nodejs-escape-html
|
|
||||||
> node benchmark/index.js
|
|
||||||
|
|
||||||
|
|
||||||
http_parser@1.0
|
|
||||||
node@0.10.33
|
|
||||||
v8@3.14.5.9
|
|
||||||
ares@1.9.0-DEV
|
|
||||||
uv@0.10.29
|
|
||||||
zlib@1.2.3
|
|
||||||
modules@11
|
|
||||||
openssl@1.0.1j
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
|
|
||||||
no special characters x 19,435,271 ops/sec ±0.85% (187 runs sampled)
|
|
||||||
single special character x 6,132,421 ops/sec ±0.67% (194 runs sampled)
|
|
||||||
many special characters x 3,175,826 ops/sec ±0.65% (193 runs sampled)
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
78
node_modules/escape-html/index.js
generated
vendored
78
node_modules/escape-html/index.js
generated
vendored
@@ -1,78 +0,0 @@
|
|||||||
/*!
|
|
||||||
* escape-html
|
|
||||||
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
||||||
* Copyright(c) 2015 Andreas Lubbe
|
|
||||||
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module variables.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var matchHtmlRegExp = /["'&<>]/;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = escapeHtml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Escape special characters in the given string of html.
|
|
||||||
*
|
|
||||||
* @param {string} string The string to escape for inserting into HTML
|
|
||||||
* @return {string}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function escapeHtml(string) {
|
|
||||||
var str = '' + string;
|
|
||||||
var match = matchHtmlRegExp.exec(str);
|
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
var escape;
|
|
||||||
var html = '';
|
|
||||||
var index = 0;
|
|
||||||
var lastIndex = 0;
|
|
||||||
|
|
||||||
for (index = match.index; index < str.length; index++) {
|
|
||||||
switch (str.charCodeAt(index)) {
|
|
||||||
case 34: // "
|
|
||||||
escape = '"';
|
|
||||||
break;
|
|
||||||
case 38: // &
|
|
||||||
escape = '&';
|
|
||||||
break;
|
|
||||||
case 39: // '
|
|
||||||
escape = ''';
|
|
||||||
break;
|
|
||||||
case 60: // <
|
|
||||||
escape = '<';
|
|
||||||
break;
|
|
||||||
case 62: // >
|
|
||||||
escape = '>';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastIndex !== index) {
|
|
||||||
html += str.substring(lastIndex, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastIndex = index + 1;
|
|
||||||
html += escape;
|
|
||||||
}
|
|
||||||
|
|
||||||
return lastIndex !== index
|
|
||||||
? html + str.substring(lastIndex, index)
|
|
||||||
: html;
|
|
||||||
}
|
|
84
node_modules/escape-html/package.json
generated
vendored
84
node_modules/escape-html/package.json
generated
vendored
@@ -1,84 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"escape-html@~1.0.3",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/serve-static"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "escape-html@>=1.0.3 <1.1.0",
|
|
||||||
"_id": "escape-html@1.0.3",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/escape-html",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "escape-html",
|
|
||||||
"raw": "escape-html@~1.0.3",
|
|
||||||
"rawSpec": "~1.0.3",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=1.0.3 <1.1.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send",
|
|
||||||
"/serve-static"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
|
||||||
"_shasum": "0258eae4d3d0c0974de1c169188ef0051d1d1988",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "escape-html@~1.0.3",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/serve-static",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/component/escape-html/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "Escape string for use in HTML",
|
|
||||||
"devDependencies": {
|
|
||||||
"beautify-benchmark": "0.2.4",
|
|
||||||
"benchmark": "1.0.0"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "0258eae4d3d0c0974de1c169188ef0051d1d1988",
|
|
||||||
"tarball": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"LICENSE",
|
|
||||||
"Readme.md",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"gitHead": "7ac2ea3977fcac3d4c5be8d2a037812820c65f28",
|
|
||||||
"homepage": "https://github.com/component/escape-html",
|
|
||||||
"keywords": [
|
|
||||||
"escape",
|
|
||||||
"html",
|
|
||||||
"utility"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "tj@vision-media.ca",
|
|
||||||
"name": "tjholowaychuk"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "escape-html",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/component/escape-html.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"bench": "node benchmark/index.js"
|
|
||||||
},
|
|
||||||
"version": "1.0.3"
|
|
||||||
}
|
|
71
node_modules/etag/HISTORY.md
generated
vendored
71
node_modules/etag/HISTORY.md
generated
vendored
@@ -1,71 +0,0 @@
|
|||||||
1.7.0 / 2015-06-08
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Always include entity length in ETags for hash length extensions
|
|
||||||
* Generate non-Stats ETags using MD5 only (no longer CRC32)
|
|
||||||
* Improve stat performance by removing hashing
|
|
||||||
* Remove base64 padding in ETags to shorten
|
|
||||||
* Use MD5 instead of MD4 in weak ETags over 1KB
|
|
||||||
|
|
||||||
1.6.0 / 2015-05-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Improve support for JXcore
|
|
||||||
* Remove requirement of `atime` in the stats object
|
|
||||||
* Support "fake" stats objects in environments without `fs`
|
|
||||||
|
|
||||||
1.5.1 / 2014-11-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: crc@3.2.1
|
|
||||||
- Minor fixes
|
|
||||||
|
|
||||||
1.5.0 / 2014-10-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Improve string performance
|
|
||||||
* Slightly improve speed for weak ETags over 1KB
|
|
||||||
|
|
||||||
1.4.0 / 2014-09-21
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support "fake" stats objects
|
|
||||||
* Support Node.js 0.6
|
|
||||||
|
|
||||||
1.3.1 / 2014-09-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Use the (new and improved) `crc` for crc32
|
|
||||||
|
|
||||||
1.3.0 / 2014-08-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Default strings to strong ETags
|
|
||||||
* Improve speed for weak ETags over 1KB
|
|
||||||
|
|
||||||
1.2.1 / 2014-08-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Use the (much faster) `buffer-crc32` for crc32
|
|
||||||
|
|
||||||
1.2.0 / 2014-08-24
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Add support for file stat objects
|
|
||||||
|
|
||||||
1.1.0 / 2014-08-24
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Add fast-path for empty entity
|
|
||||||
* Add weak ETag generation
|
|
||||||
* Shrink size of generated ETags
|
|
||||||
|
|
||||||
1.0.1 / 2014-08-24
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix behavior of string containing Unicode
|
|
||||||
|
|
||||||
1.0.0 / 2014-05-18
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Initial release
|
|
22
node_modules/etag/LICENSE
generated
vendored
22
node_modules/etag/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
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.
|
|
165
node_modules/etag/README.md
generated
vendored
165
node_modules/etag/README.md
generated
vendored
@@ -1,165 +0,0 @@
|
|||||||
# etag
|
|
||||||
|
|
||||||
[![NPM Version][npm-image]][npm-url]
|
|
||||||
[![NPM Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Node.js Version][node-version-image]][node-version-url]
|
|
||||||
[![Build Status][travis-image]][travis-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
Create simple ETags
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install etag
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var etag = require('etag')
|
|
||||||
```
|
|
||||||
|
|
||||||
### etag(entity, [options])
|
|
||||||
|
|
||||||
Generate a strong ETag for the given entity. This should be the complete
|
|
||||||
body of the entity. Strings, `Buffer`s, and `fs.Stats` are accepted. By
|
|
||||||
default, a strong ETag is generated except for `fs.Stats`, which will
|
|
||||||
generate a weak ETag (this can be overwritten by `options.weak`).
|
|
||||||
|
|
||||||
```js
|
|
||||||
res.setHeader('ETag', etag(body))
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
`etag` accepts these properties in the options object.
|
|
||||||
|
|
||||||
##### weak
|
|
||||||
|
|
||||||
Specifies if the generated ETag will include the weak validator mark (that
|
|
||||||
is, the leading `W/`). The actual entity tag is the same. The default value
|
|
||||||
is `false`, unless the `entity` is `fs.Stats`, in which case it is `true`.
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Benchmark
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm run-script bench
|
|
||||||
|
|
||||||
> etag@1.6.0 bench nodejs-etag
|
|
||||||
> node benchmark/index.js
|
|
||||||
|
|
||||||
http_parser@1.0
|
|
||||||
node@0.10.33
|
|
||||||
v8@3.14.5.9
|
|
||||||
ares@1.9.0-DEV
|
|
||||||
uv@0.10.29
|
|
||||||
zlib@1.2.3
|
|
||||||
modules@11
|
|
||||||
openssl@1.0.1j
|
|
||||||
|
|
||||||
> node benchmark/body0-100b.js
|
|
||||||
|
|
||||||
100B body
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
4 tests completed.
|
|
||||||
|
|
||||||
* buffer - strong x 289,198 ops/sec ±1.09% (190 runs sampled)
|
|
||||||
* buffer - weak x 287,838 ops/sec ±0.91% (189 runs sampled)
|
|
||||||
* string - strong x 284,586 ops/sec ±1.05% (192 runs sampled)
|
|
||||||
* string - weak x 287,439 ops/sec ±0.82% (192 runs sampled)
|
|
||||||
|
|
||||||
> node benchmark/body1-1kb.js
|
|
||||||
|
|
||||||
1KB body
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
4 tests completed.
|
|
||||||
|
|
||||||
* buffer - strong x 212,423 ops/sec ±0.75% (193 runs sampled)
|
|
||||||
* buffer - weak x 211,871 ops/sec ±0.74% (194 runs sampled)
|
|
||||||
string - strong x 205,291 ops/sec ±0.86% (194 runs sampled)
|
|
||||||
string - weak x 208,463 ops/sec ±0.79% (192 runs sampled)
|
|
||||||
|
|
||||||
> node benchmark/body2-5kb.js
|
|
||||||
|
|
||||||
5KB body
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
4 tests completed.
|
|
||||||
|
|
||||||
* buffer - strong x 92,901 ops/sec ±0.58% (195 runs sampled)
|
|
||||||
* buffer - weak x 93,045 ops/sec ±0.65% (192 runs sampled)
|
|
||||||
string - strong x 89,621 ops/sec ±0.68% (194 runs sampled)
|
|
||||||
string - weak x 90,070 ops/sec ±0.70% (196 runs sampled)
|
|
||||||
|
|
||||||
> node benchmark/body3-10kb.js
|
|
||||||
|
|
||||||
10KB body
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
4 tests completed.
|
|
||||||
|
|
||||||
* buffer - strong x 54,220 ops/sec ±0.85% (192 runs sampled)
|
|
||||||
* buffer - weak x 54,069 ops/sec ±0.83% (191 runs sampled)
|
|
||||||
string - strong x 53,078 ops/sec ±0.53% (194 runs sampled)
|
|
||||||
string - weak x 53,849 ops/sec ±0.47% (197 runs sampled)
|
|
||||||
|
|
||||||
> node benchmark/body4-100kb.js
|
|
||||||
|
|
||||||
100KB body
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
4 tests completed.
|
|
||||||
|
|
||||||
* buffer - strong x 6,673 ops/sec ±0.15% (197 runs sampled)
|
|
||||||
* buffer - weak x 6,716 ops/sec ±0.12% (198 runs sampled)
|
|
||||||
string - strong x 6,357 ops/sec ±0.14% (197 runs sampled)
|
|
||||||
string - weak x 6,344 ops/sec ±0.21% (197 runs sampled)
|
|
||||||
|
|
||||||
> node benchmark/stats.js
|
|
||||||
|
|
||||||
stats
|
|
||||||
|
|
||||||
1 test completed.
|
|
||||||
2 tests completed.
|
|
||||||
3 tests completed.
|
|
||||||
4 tests completed.
|
|
||||||
|
|
||||||
* real - strong x 1,671,989 ops/sec ±0.13% (197 runs sampled)
|
|
||||||
* real - weak x 1,681,297 ops/sec ±0.12% (198 runs sampled)
|
|
||||||
fake - strong x 927,063 ops/sec ±0.14% (198 runs sampled)
|
|
||||||
fake - weak x 914,461 ops/sec ±0.41% (191 runs sampled)
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/etag.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/etag
|
|
||||||
[node-version-image]: https://img.shields.io/node/v/etag.svg
|
|
||||||
[node-version-url]: http://nodejs.org/download/
|
|
||||||
[travis-image]: https://img.shields.io/travis/jshttp/etag/master.svg
|
|
||||||
[travis-url]: https://travis-ci.org/jshttp/etag
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/etag/master.svg
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jshttp/etag?branch=master
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/etag.svg
|
|
||||||
[downloads-url]: https://npmjs.org/package/etag
|
|
132
node_modules/etag/index.js
generated
vendored
132
node_modules/etag/index.js
generated
vendored
@@ -1,132 +0,0 @@
|
|||||||
/*!
|
|
||||||
* etag
|
|
||||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = etag
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var crypto = require('crypto')
|
|
||||||
var Stats = require('fs').Stats
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module variables.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var base64PadCharRegExp = /=+$/
|
|
||||||
var toString = Object.prototype.toString
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate an entity tag.
|
|
||||||
*
|
|
||||||
* @param {Buffer|string} entity
|
|
||||||
* @return {string}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function entitytag(entity) {
|
|
||||||
if (entity.length === 0) {
|
|
||||||
// fast-path empty
|
|
||||||
return '"0-1B2M2Y8AsgTpgAmY7PhCfg"'
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute hash of entity
|
|
||||||
var hash = crypto
|
|
||||||
.createHash('md5')
|
|
||||||
.update(entity, 'utf8')
|
|
||||||
.digest('base64')
|
|
||||||
.replace(base64PadCharRegExp, '')
|
|
||||||
|
|
||||||
// compute length of entity
|
|
||||||
var len = typeof entity === 'string'
|
|
||||||
? Buffer.byteLength(entity, 'utf8')
|
|
||||||
: entity.length
|
|
||||||
|
|
||||||
return '"' + len.toString(16) + '-' + hash + '"'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a simple ETag.
|
|
||||||
*
|
|
||||||
* @param {string|Buffer|Stats} entity
|
|
||||||
* @param {object} [options]
|
|
||||||
* @param {boolean} [options.weak]
|
|
||||||
* @return {String}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function etag(entity, options) {
|
|
||||||
if (entity == null) {
|
|
||||||
throw new TypeError('argument entity is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
// support fs.Stats object
|
|
||||||
var isStats = isstats(entity)
|
|
||||||
var weak = options && typeof options.weak === 'boolean'
|
|
||||||
? options.weak
|
|
||||||
: isStats
|
|
||||||
|
|
||||||
// validate argument
|
|
||||||
if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) {
|
|
||||||
throw new TypeError('argument entity must be string, Buffer, or fs.Stats')
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate entity tag
|
|
||||||
var tag = isStats
|
|
||||||
? stattag(entity)
|
|
||||||
: entitytag(entity)
|
|
||||||
|
|
||||||
return weak
|
|
||||||
? 'W/' + tag
|
|
||||||
: tag
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if object is a Stats object.
|
|
||||||
*
|
|
||||||
* @param {object} obj
|
|
||||||
* @return {boolean}
|
|
||||||
* @api private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function isstats(obj) {
|
|
||||||
// genuine fs.Stats
|
|
||||||
if (typeof Stats === 'function' && obj instanceof Stats) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// quack quack
|
|
||||||
return obj && typeof obj === 'object'
|
|
||||||
&& 'ctime' in obj && toString.call(obj.ctime) === '[object Date]'
|
|
||||||
&& 'mtime' in obj && toString.call(obj.mtime) === '[object Date]'
|
|
||||||
&& 'ino' in obj && typeof obj.ino === 'number'
|
|
||||||
&& 'size' in obj && typeof obj.size === 'number'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a tag for a stat.
|
|
||||||
*
|
|
||||||
* @param {object} stat
|
|
||||||
* @return {string}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function stattag(stat) {
|
|
||||||
var mtime = stat.mtime.getTime().toString(16)
|
|
||||||
var size = stat.size.toString(16)
|
|
||||||
|
|
||||||
return '"' + size + '-' + mtime + '"'
|
|
||||||
}
|
|
99
node_modules/etag/package.json
generated
vendored
99
node_modules/etag/package.json
generated
vendored
@@ -1,99 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"etag@~1.7.0",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "etag@>=1.7.0 <1.8.0",
|
|
||||||
"_id": "etag@1.7.0",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/etag",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "etag",
|
|
||||||
"raw": "etag@~1.7.0",
|
|
||||||
"rawSpec": "~1.7.0",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=1.7.0 <1.8.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/etag/-/etag-1.7.0.tgz",
|
|
||||||
"_shasum": "03d30b5f67dd6e632d2945d30d6652731a34d5d8",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "etag@~1.7.0",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jshttp/etag/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "david.bjorklund@gmail.com",
|
|
||||||
"name": "David Björklund"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "Create simple ETags",
|
|
||||||
"devDependencies": {
|
|
||||||
"beautify-benchmark": "0.2.4",
|
|
||||||
"benchmark": "1.0.0",
|
|
||||||
"istanbul": "0.3.14",
|
|
||||||
"mocha": "~1.21.4",
|
|
||||||
"seedrandom": "2.3.11"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "03d30b5f67dd6e632d2945d30d6652731a34d5d8",
|
|
||||||
"tarball": "https://registry.npmjs.org/etag/-/etag-1.7.0.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"LICENSE",
|
|
||||||
"HISTORY.md",
|
|
||||||
"README.md",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"gitHead": "a511f5c8c930fd9546dbd88acb080f96bc788cfc",
|
|
||||||
"homepage": "https://github.com/jshttp/etag",
|
|
||||||
"keywords": [
|
|
||||||
"etag",
|
|
||||||
"http",
|
|
||||||
"res"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "etag",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jshttp/etag.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"bench": "node benchmark/index.js",
|
|
||||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
|
||||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
|
||||||
},
|
|
||||||
"version": "1.7.0"
|
|
||||||
}
|
|
131
node_modules/finalhandler/HISTORY.md
generated
vendored
131
node_modules/finalhandler/HISTORY.md
generated
vendored
@@ -1,131 +0,0 @@
|
|||||||
1.0.0 / 2017-02-15
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix exception when `err` cannot be converted to a string
|
|
||||||
* Fully URL-encode the pathname in the 404 message
|
|
||||||
* Only include the pathname in the 404 message
|
|
||||||
* Send complete HTML document
|
|
||||||
* Set `Content-Security-Policy: default-src 'self'` header
|
|
||||||
* deps: debug@2.6.1
|
|
||||||
- Allow colors in workers
|
|
||||||
- Deprecated `DEBUG_FD` environment variable set to `3` or higher
|
|
||||||
- Fix error when running under React Native
|
|
||||||
- Use same color for same namespace
|
|
||||||
- deps: ms@0.7.2
|
|
||||||
|
|
||||||
0.5.1 / 2016-11-12
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix exception when `err.headers` is not an object
|
|
||||||
* deps: statuses@~1.3.1
|
|
||||||
* perf: hoist regular expressions
|
|
||||||
* perf: remove duplicate validation path
|
|
||||||
|
|
||||||
0.5.0 / 2016-06-15
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Change invalid or non-numeric status code to 500
|
|
||||||
* Overwrite status message to match set status code
|
|
||||||
* Prefer `err.statusCode` if `err.status` is invalid
|
|
||||||
* Set response headers from `err.headers` object
|
|
||||||
* Use `statuses` instead of `http` module for status messages
|
|
||||||
- Includes all defined status messages
|
|
||||||
|
|
||||||
0.4.1 / 2015-12-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: escape-html@~1.0.3
|
|
||||||
- perf: enable strict mode
|
|
||||||
- perf: optimize string replacement
|
|
||||||
- perf: use faster string coercion
|
|
||||||
|
|
||||||
0.4.0 / 2015-06-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix a false-positive when unpiping in Node.js 0.8
|
|
||||||
* Support `statusCode` property on `Error` objects
|
|
||||||
* Use `unpipe` module for unpiping requests
|
|
||||||
* deps: escape-html@1.0.2
|
|
||||||
* deps: on-finished@~2.3.0
|
|
||||||
- Add defined behavior for HTTP `CONNECT` requests
|
|
||||||
- Add defined behavior for HTTP `Upgrade` requests
|
|
||||||
- deps: ee-first@1.1.1
|
|
||||||
* perf: enable strict mode
|
|
||||||
* perf: remove argument reassignment
|
|
||||||
|
|
||||||
0.3.6 / 2015-05-11
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: debug@~2.2.0
|
|
||||||
- deps: ms@0.7.1
|
|
||||||
|
|
||||||
0.3.5 / 2015-04-22
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: on-finished@~2.2.1
|
|
||||||
- Fix `isFinished(req)` when data buffered
|
|
||||||
|
|
||||||
0.3.4 / 2015-03-15
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: debug@~2.1.3
|
|
||||||
- Fix high intensity foreground color for bold
|
|
||||||
- deps: ms@0.7.0
|
|
||||||
|
|
||||||
0.3.3 / 2015-01-01
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: debug@~2.1.1
|
|
||||||
* deps: on-finished@~2.2.0
|
|
||||||
|
|
||||||
0.3.2 / 2014-10-22
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: on-finished@~2.1.1
|
|
||||||
- Fix handling of pipelined requests
|
|
||||||
|
|
||||||
0.3.1 / 2014-10-16
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: debug@~2.1.0
|
|
||||||
- Implement `DEBUG_FD` env variable support
|
|
||||||
|
|
||||||
0.3.0 / 2014-09-17
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Terminate in progress response only on error
|
|
||||||
* Use `on-finished` to determine request status
|
|
||||||
|
|
||||||
0.2.0 / 2014-09-03
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Set `X-Content-Type-Options: nosniff` header
|
|
||||||
* deps: debug@~2.0.0
|
|
||||||
|
|
||||||
0.1.0 / 2014-07-16
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Respond after request fully read
|
|
||||||
- prevents hung responses and socket hang ups
|
|
||||||
* deps: debug@1.0.4
|
|
||||||
|
|
||||||
0.0.3 / 2014-07-11
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: debug@1.0.3
|
|
||||||
- Add support for multiple wildcards in namespaces
|
|
||||||
|
|
||||||
0.0.2 / 2014-06-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Handle invalid status codes
|
|
||||||
|
|
||||||
0.0.1 / 2014-06-05
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: debug@1.0.2
|
|
||||||
|
|
||||||
0.0.0 / 2014-06-05
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Extracted from connect/express
|
|
22
node_modules/finalhandler/LICENSE
generated
vendored
22
node_modules/finalhandler/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2014-2017 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.
|
|
146
node_modules/finalhandler/README.md
generated
vendored
146
node_modules/finalhandler/README.md
generated
vendored
@@ -1,146 +0,0 @@
|
|||||||
# finalhandler
|
|
||||||
|
|
||||||
[![NPM Version][npm-image]][npm-url]
|
|
||||||
[![NPM Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Node.js Version][node-image]][node-url]
|
|
||||||
[![Build Status][travis-image]][travis-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
Node.js function to invoke as the final step to respond to HTTP request.
|
|
||||||
|
|
||||||
## 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 finalhandler
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```
|
|
||||||
var finalhandler = require('finalhandler')
|
|
||||||
```
|
|
||||||
|
|
||||||
### finalhandler(req, res, [options])
|
|
||||||
|
|
||||||
Returns function to be invoked as the final step for the given `req` and `res`.
|
|
||||||
This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will
|
|
||||||
write out a 404 response to the `res`. If it is truthy, an error response will
|
|
||||||
be written out to the `res`.
|
|
||||||
|
|
||||||
When an error is written, the following information is added to the response:
|
|
||||||
|
|
||||||
* The `res.statusCode` is set from `err.status` (or `err.statusCode`). If
|
|
||||||
this value is outside the 4xx or 5xx range, it will be set to 500.
|
|
||||||
* The `res.statusMessage` is set according to the status code.
|
|
||||||
* The body will be the HTML of the status code message if `env` is
|
|
||||||
`'production'`, otherwise will be `err.stack`.
|
|
||||||
* Any headers specified in an `err.headers` object.
|
|
||||||
|
|
||||||
The final handler will also unpipe anything from `req` when it is invoked.
|
|
||||||
|
|
||||||
#### options.env
|
|
||||||
|
|
||||||
By default, the environment is determined by `NODE_ENV` variable, but it can be
|
|
||||||
overridden by this option.
|
|
||||||
|
|
||||||
#### options.onerror
|
|
||||||
|
|
||||||
Provide a function to be called with the `err` when it exists. Can be used for
|
|
||||||
writing errors to a central location without excessive function generation. Called
|
|
||||||
as `onerror(err, req, res)`.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### always 404
|
|
||||||
|
|
||||||
```js
|
|
||||||
var finalhandler = require('finalhandler')
|
|
||||||
var http = require('http')
|
|
||||||
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
var done = finalhandler(req, res)
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
|
|
||||||
server.listen(3000)
|
|
||||||
```
|
|
||||||
|
|
||||||
### perform simple action
|
|
||||||
|
|
||||||
```js
|
|
||||||
var finalhandler = require('finalhandler')
|
|
||||||
var fs = require('fs')
|
|
||||||
var http = require('http')
|
|
||||||
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
var done = finalhandler(req, res)
|
|
||||||
|
|
||||||
fs.readFile('index.html', function (err, buf) {
|
|
||||||
if (err) return done(err)
|
|
||||||
res.setHeader('Content-Type', 'text/html')
|
|
||||||
res.end(buf)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
server.listen(3000)
|
|
||||||
```
|
|
||||||
|
|
||||||
### use with middleware-style functions
|
|
||||||
|
|
||||||
```js
|
|
||||||
var finalhandler = require('finalhandler')
|
|
||||||
var http = require('http')
|
|
||||||
var serveStatic = require('serve-static')
|
|
||||||
|
|
||||||
var serve = serveStatic('public')
|
|
||||||
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
var done = finalhandler(req, res)
|
|
||||||
serve(req, res, done)
|
|
||||||
})
|
|
||||||
|
|
||||||
server.listen(3000)
|
|
||||||
```
|
|
||||||
|
|
||||||
### keep log of all errors
|
|
||||||
|
|
||||||
```js
|
|
||||||
var finalhandler = require('finalhandler')
|
|
||||||
var fs = require('fs')
|
|
||||||
var http = require('http')
|
|
||||||
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
var done = finalhandler(req, res, {onerror: logerror})
|
|
||||||
|
|
||||||
fs.readFile('index.html', function (err, buf) {
|
|
||||||
if (err) return done(err)
|
|
||||||
res.setHeader('Content-Type', 'text/html')
|
|
||||||
res.end(buf)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
server.listen(3000)
|
|
||||||
|
|
||||||
function logerror (err) {
|
|
||||||
console.error(err.stack || err.toString())
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/finalhandler.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/finalhandler
|
|
||||||
[node-image]: https://img.shields.io/node/v/finalhandler.svg
|
|
||||||
[node-url]: https://nodejs.org/en/download
|
|
||||||
[travis-image]: https://img.shields.io/travis/pillarjs/finalhandler.svg
|
|
||||||
[travis-url]: https://travis-ci.org/pillarjs/finalhandler
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg
|
|
||||||
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg
|
|
||||||
[downloads-url]: https://npmjs.org/package/finalhandler
|
|
299
node_modules/finalhandler/index.js
generated
vendored
299
node_modules/finalhandler/index.js
generated
vendored
@@ -1,299 +0,0 @@
|
|||||||
/*!
|
|
||||||
* finalhandler
|
|
||||||
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var debug = require('debug')('finalhandler')
|
|
||||||
var encodeUrl = require('encodeurl')
|
|
||||||
var escapeHtml = require('escape-html')
|
|
||||||
var onFinished = require('on-finished')
|
|
||||||
var parseUrl = require('parseurl')
|
|
||||||
var statuses = require('statuses')
|
|
||||||
var unpipe = require('unpipe')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module variables.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var DOUBLE_SPACE_REGEXP = /\x20{2}/g
|
|
||||||
var NEWLINE_REGEXP = /\n/g
|
|
||||||
|
|
||||||
/* istanbul ignore next */
|
|
||||||
var defer = typeof setImmediate === 'function'
|
|
||||||
? setImmediate
|
|
||||||
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
|
|
||||||
var isFinished = onFinished.isFinished
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a minimal HTML document.
|
|
||||||
*
|
|
||||||
* @param {string} message
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createHtmlDocument (message) {
|
|
||||||
var body = escapeHtml(message)
|
|
||||||
.replace(NEWLINE_REGEXP, '<br>')
|
|
||||||
.replace(DOUBLE_SPACE_REGEXP, ' ')
|
|
||||||
|
|
||||||
return '<!DOCTYPE html>\n' +
|
|
||||||
'<html lang="en">\n' +
|
|
||||||
'<head>\n' +
|
|
||||||
'<meta charset="utf-8">\n' +
|
|
||||||
'<title>Error</title>\n' +
|
|
||||||
'</head>\n' +
|
|
||||||
'<body>\n' +
|
|
||||||
'<pre>' + body + '</pre>\n' +
|
|
||||||
'</body>\n'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = finalhandler
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a function to handle the final response.
|
|
||||||
*
|
|
||||||
* @param {Request} req
|
|
||||||
* @param {Response} res
|
|
||||||
* @param {Object} [options]
|
|
||||||
* @return {Function}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function finalhandler (req, res, options) {
|
|
||||||
var opts = options || {}
|
|
||||||
|
|
||||||
// get environment
|
|
||||||
var env = opts.env || process.env.NODE_ENV || 'development'
|
|
||||||
|
|
||||||
// get error callback
|
|
||||||
var onerror = opts.onerror
|
|
||||||
|
|
||||||
return function (err) {
|
|
||||||
var headers
|
|
||||||
var msg
|
|
||||||
var status
|
|
||||||
|
|
||||||
// ignore 404 on in-flight response
|
|
||||||
if (!err && res._header) {
|
|
||||||
debug('cannot 404 after headers sent')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// unhandled error
|
|
||||||
if (err) {
|
|
||||||
// respect status code from error
|
|
||||||
status = getErrorStatusCode(err)
|
|
||||||
|
|
||||||
// respect headers from error
|
|
||||||
if (status !== undefined) {
|
|
||||||
headers = getErrorHeaders(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// fallback to status code on response
|
|
||||||
if (status === undefined) {
|
|
||||||
status = getResponseStatusCode(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// get error message
|
|
||||||
msg = getErrorMessage(err, status, env)
|
|
||||||
} else {
|
|
||||||
// not found
|
|
||||||
status = 404
|
|
||||||
msg = 'Cannot ' + req.method + ' ' + encodeUrl(parseUrl.original(req).pathname)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('default %s', status)
|
|
||||||
|
|
||||||
// schedule onerror callback
|
|
||||||
if (err && onerror) {
|
|
||||||
defer(onerror, err, req, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// cannot actually respond
|
|
||||||
if (res._header) {
|
|
||||||
debug('cannot %d after headers sent', status)
|
|
||||||
req.socket.destroy()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// send response
|
|
||||||
send(req, res, status, headers, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get headers from Error object.
|
|
||||||
*
|
|
||||||
* @param {Error} err
|
|
||||||
* @return {object}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getErrorHeaders (err) {
|
|
||||||
if (!err.headers || typeof err.headers !== 'object') {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
var headers = Object.create(null)
|
|
||||||
var keys = Object.keys(err.headers)
|
|
||||||
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
var key = keys[i]
|
|
||||||
headers[key] = err.headers[key]
|
|
||||||
}
|
|
||||||
|
|
||||||
return headers
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get message from Error object, fallback to status message.
|
|
||||||
*
|
|
||||||
* @param {Error} err
|
|
||||||
* @param {number} status
|
|
||||||
* @param {string} env
|
|
||||||
* @return {string}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getErrorMessage (err, status, env) {
|
|
||||||
var msg
|
|
||||||
|
|
||||||
if (env !== 'production') {
|
|
||||||
// use err.stack, which typically includes err.message
|
|
||||||
msg = err.stack
|
|
||||||
|
|
||||||
// fallback to err.toString() when possible
|
|
||||||
if (!msg && typeof err.toString === 'function') {
|
|
||||||
msg = err.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return msg || statuses[status]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get status code from Error object.
|
|
||||||
*
|
|
||||||
* @param {Error} err
|
|
||||||
* @return {number}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getErrorStatusCode (err) {
|
|
||||||
// check err.status
|
|
||||||
if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) {
|
|
||||||
return err.status
|
|
||||||
}
|
|
||||||
|
|
||||||
// check err.statusCode
|
|
||||||
if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) {
|
|
||||||
return err.statusCode
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get status code from response.
|
|
||||||
*
|
|
||||||
* @param {OutgoingMessage} res
|
|
||||||
* @return {number}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getResponseStatusCode (res) {
|
|
||||||
var status = res.statusCode
|
|
||||||
|
|
||||||
// default status code to 500 if outside valid range
|
|
||||||
if (typeof status !== 'number' || status < 400 || status > 599) {
|
|
||||||
status = 500
|
|
||||||
}
|
|
||||||
|
|
||||||
return status
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send response.
|
|
||||||
*
|
|
||||||
* @param {IncomingMessage} req
|
|
||||||
* @param {OutgoingMessage} res
|
|
||||||
* @param {number} status
|
|
||||||
* @param {object} headers
|
|
||||||
* @param {string} message
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function send (req, res, status, headers, message) {
|
|
||||||
function write () {
|
|
||||||
// response body
|
|
||||||
var body = createHtmlDocument(message)
|
|
||||||
|
|
||||||
// response status
|
|
||||||
res.statusCode = status
|
|
||||||
res.statusMessage = statuses[status]
|
|
||||||
|
|
||||||
// response headers
|
|
||||||
setHeaders(res, headers)
|
|
||||||
|
|
||||||
// security headers
|
|
||||||
res.setHeader('Content-Security-Policy', "default-src 'self'")
|
|
||||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
|
||||||
|
|
||||||
// standard headers
|
|
||||||
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
|
||||||
res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8'))
|
|
||||||
|
|
||||||
if (req.method === 'HEAD') {
|
|
||||||
res.end()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
res.end(body, 'utf8')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFinished(req)) {
|
|
||||||
write()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// unpipe everything from the request
|
|
||||||
unpipe(req)
|
|
||||||
|
|
||||||
// flush the request
|
|
||||||
onFinished(req, write)
|
|
||||||
req.resume()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set response headers from an object.
|
|
||||||
*
|
|
||||||
* @param {OutgoingMessage} res
|
|
||||||
* @param {object} headers
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function setHeaders (res, headers) {
|
|
||||||
if (!headers) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var keys = Object.keys(headers)
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
var key = keys[i]
|
|
||||||
res.setHeader(key, headers[key])
|
|
||||||
}
|
|
||||||
}
|
|
1
node_modules/finalhandler/node_modules/debug/.coveralls.yml
generated
vendored
1
node_modules/finalhandler/node_modules/debug/.coveralls.yml
generated
vendored
@@ -1 +0,0 @@
|
|||||||
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
|
11
node_modules/finalhandler/node_modules/debug/.eslintrc
generated
vendored
11
node_modules/finalhandler/node_modules/debug/.eslintrc
generated
vendored
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-console": 0,
|
|
||||||
"no-empty": [1, { "allowEmptyCatch": true }]
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended"
|
|
||||||
}
|
|
8
node_modules/finalhandler/node_modules/debug/.npmignore
generated
vendored
8
node_modules/finalhandler/node_modules/debug/.npmignore
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
support
|
|
||||||
test
|
|
||||||
examples
|
|
||||||
example
|
|
||||||
*.sock
|
|
||||||
dist
|
|
||||||
yarn.lock
|
|
||||||
coverage
|
|
14
node_modules/finalhandler/node_modules/debug/.travis.yml
generated
vendored
14
node_modules/finalhandler/node_modules/debug/.travis.yml
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- "6"
|
|
||||||
- "5"
|
|
||||||
- "4"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- make node_modules
|
|
||||||
|
|
||||||
script:
|
|
||||||
- make lint
|
|
||||||
- make test
|
|
||||||
- make coveralls
|
|
316
node_modules/finalhandler/node_modules/debug/CHANGELOG.md
generated
vendored
316
node_modules/finalhandler/node_modules/debug/CHANGELOG.md
generated
vendored
@@ -1,316 +0,0 @@
|
|||||||
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/finalhandler/node_modules/debug/LICENSE
generated
vendored
19
node_modules/finalhandler/node_modules/debug/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
|||||||
(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/finalhandler/node_modules/debug/Makefile
generated
vendored
50
node_modules/finalhandler/node_modules/debug/Makefile
generated
vendored
@@ -1,50 +0,0 @@
|
|||||||
# 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
|
|
238
node_modules/finalhandler/node_modules/debug/README.md
generated
vendored
238
node_modules/finalhandler/node_modules/debug/README.md
generated
vendored
@@ -1,238 +0,0 @@
|
|||||||
# debug
|
|
||||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master)
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||

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

|
|
||||||
|
|
||||||
## Conventions
|
|
||||||
|
|
||||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
|
||||||
|
|
||||||
## Wildcards
|
|
||||||
|
|
||||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
|
||||||
|
|
||||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
|
||||||
|
|
||||||
## 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/disabled 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:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
## 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.
|
|
29
node_modules/finalhandler/node_modules/debug/bower.json
generated
vendored
29
node_modules/finalhandler/node_modules/debug/bower.json
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "visionmedia-debug",
|
|
||||||
"main": "./src/browser.js",
|
|
||||||
"homepage": "https://github.com/visionmedia/debug",
|
|
||||||
"authors": [
|
|
||||||
"TJ Holowaychuk <tj@vision-media.ca>",
|
|
||||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
|
||||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
|
||||||
],
|
|
||||||
"description": "visionmedia-debug",
|
|
||||||
"moduleType": [
|
|
||||||
"amd",
|
|
||||||
"es6",
|
|
||||||
"globals",
|
|
||||||
"node"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"visionmedia",
|
|
||||||
"debug"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"ignore": [
|
|
||||||
"**/.*",
|
|
||||||
"node_modules",
|
|
||||||
"bower_components",
|
|
||||||
"test",
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
}
|
|
19
node_modules/finalhandler/node_modules/debug/component.json
generated
vendored
19
node_modules/finalhandler/node_modules/debug/component.json
generated
vendored
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "debug",
|
|
||||||
"repo": "visionmedia/debug",
|
|
||||||
"description": "small debugging utility",
|
|
||||||
"version": "2.6.1",
|
|
||||||
"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/finalhandler/node_modules/debug/karma.conf.js
generated
vendored
70
node_modules/finalhandler/node_modules/debug/karma.conf.js
generated
vendored
@@ -1,70 +0,0 @@
|
|||||||
// 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/finalhandler/node_modules/debug/node.js
generated
vendored
1
node_modules/finalhandler/node_modules/debug/node.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
module.exports = require('./src/node');
|
|
116
node_modules/finalhandler/node_modules/debug/package.json
generated
vendored
116
node_modules/finalhandler/node_modules/debug/package.json
generated
vendored
@@ -1,116 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"debug@2.6.1",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/finalhandler"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "debug@2.6.1",
|
|
||||||
"_id": "debug@2.6.1",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/finalhandler/debug",
|
|
||||||
"_nodeVersion": "6.9.0",
|
|
||||||
"_npmOperationalInternal": {
|
|
||||||
"host": "packages-18-east.internal.npmjs.com",
|
|
||||||
"tmp": "tmp/debug-2.6.1.tgz_1486753226738_0.07569954148493707"
|
|
||||||
},
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "rhyneandrew@gmail.com",
|
|
||||||
"name": "thebigredgeek"
|
|
||||||
},
|
|
||||||
"_npmVersion": "4.0.3",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "debug",
|
|
||||||
"raw": "debug@2.6.1",
|
|
||||||
"rawSpec": "2.6.1",
|
|
||||||
"scope": null,
|
|
||||||
"spec": "2.6.1",
|
|
||||||
"type": "version"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/finalhandler"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.1.tgz",
|
|
||||||
"_shasum": "79855090ba2c4e3115cc7d8769491d58f0491351",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "debug@2.6.1",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/finalhandler",
|
|
||||||
"author": {
|
|
||||||
"email": "tj@vision-media.ca",
|
|
||||||
"name": "TJ Holowaychuk"
|
|
||||||
},
|
|
||||||
"browser": "./src/browser.js",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/visionmedia/debug/issues"
|
|
||||||
},
|
|
||||||
"component": {
|
|
||||||
"scripts": {
|
|
||||||
"debug/debug.js": "debug.js",
|
|
||||||
"debug/index.js": "browser.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "nathan@tootallnate.net",
|
|
||||||
"name": "Nathan Rajlich",
|
|
||||||
"url": "http://n8.io"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "rhyneandrew@gmail.com",
|
|
||||||
"name": "Andrew Rhyne"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ms": "0.7.2"
|
|
||||||
},
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "79855090ba2c4e3115cc7d8769491d58f0491351",
|
|
||||||
"tarball": "https://registry.npmjs.org/debug/-/debug-2.6.1.tgz"
|
|
||||||
},
|
|
||||||
"gitHead": "941653e3334e9e3e2cca87cad9bbf6c5cb245215",
|
|
||||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
|
||||||
"keywords": [
|
|
||||||
"debug",
|
|
||||||
"log",
|
|
||||||
"debugger"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "./src/index.js",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "rhyneandrew@gmail.com",
|
|
||||||
"name": "thebigredgeek"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "debug",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/visionmedia/debug.git"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"version": "2.6.1"
|
|
||||||
}
|
|
182
node_modules/finalhandler/node_modules/debug/src/browser.js
generated
vendored
182
node_modules/finalhandler/node_modules/debug/src/browser.js
generated
vendored
@@ -1,182 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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 && typeof window.process !== 'undefined' && 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 && 'WebkitAppearance' in document.documentElement.style) ||
|
|
||||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
|
||||||
(typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) ||
|
|
||||||
// is firefox >= v31?
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
||||||
(typeof navigator !== 'undefined' && navigator && 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 && 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() {
|
|
||||||
try {
|
|
||||||
return exports.storage.debug;
|
|
||||||
} catch(e) {}
|
|
||||||
|
|
||||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
||||||
if (typeof process !== 'undefined' && 'env' in process) {
|
|
||||||
return process.env.DEBUG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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/finalhandler/node_modules/debug/src/debug.js
generated
vendored
202
node_modules/finalhandler/node_modules/debug/src/debug.js
generated
vendored
@@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
/**
|
|
||||||
* 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 = (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/finalhandler/node_modules/debug/src/index.js
generated
vendored
10
node_modules/finalhandler/node_modules/debug/src/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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');
|
|
||||||
}
|
|
241
node_modules/finalhandler/node_modules/debug/src/node.js
generated
vendored
241
node_modules/finalhandler/node_modules/debug/src/node.js
generated
vendored
@@ -1,241 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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])/, 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)
|
|
||||||
.replace(/\s*\n\s*/g, ' ');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 = util._extend({}, exports.inspectOpts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports.enable(load());
|
|
106
node_modules/finalhandler/package.json
generated
vendored
106
node_modules/finalhandler/package.json
generated
vendored
@@ -1,106 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"finalhandler",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "finalhandler@latest",
|
|
||||||
"_id": "finalhandler@1.0.0",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/finalhandler",
|
|
||||||
"_nodeVersion": "4.7.3",
|
|
||||||
"_npmOperationalInternal": {
|
|
||||||
"host": "packages-18-east.internal.npmjs.com",
|
|
||||||
"tmp": "tmp/finalhandler-1.0.0.tgz_1487228805174_0.0024696807377040386"
|
|
||||||
},
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "2.15.11",
|
|
||||||
"_phantomChildren": {
|
|
||||||
"ms": "0.7.2"
|
|
||||||
},
|
|
||||||
"_requested": {
|
|
||||||
"name": "finalhandler",
|
|
||||||
"raw": "finalhandler",
|
|
||||||
"rawSpec": "",
|
|
||||||
"scope": null,
|
|
||||||
"spec": "latest",
|
|
||||||
"type": "tag"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.0.tgz",
|
|
||||||
"_shasum": "b5691c2c0912092f18ac23e9416bde5cd7dc6755",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "finalhandler",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web",
|
|
||||||
"author": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/pillarjs/finalhandler/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"debug": "2.6.1",
|
|
||||||
"encodeurl": "~1.0.1",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"parseurl": "~1.3.1",
|
|
||||||
"statuses": "~1.3.1",
|
|
||||||
"unpipe": "~1.0.0"
|
|
||||||
},
|
|
||||||
"description": "Node.js final http responder",
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "3.15.0",
|
|
||||||
"eslint-config-standard": "6.2.1",
|
|
||||||
"eslint-plugin-markdown": "1.0.0-beta.3",
|
|
||||||
"eslint-plugin-promise": "3.3.2",
|
|
||||||
"eslint-plugin-standard": "2.0.1",
|
|
||||||
"istanbul": "0.4.5",
|
|
||||||
"mocha": "2.5.3",
|
|
||||||
"readable-stream": "2.1.2",
|
|
||||||
"supertest": "1.1.0"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "b5691c2c0912092f18ac23e9416bde5cd7dc6755",
|
|
||||||
"tarball": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.0.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"LICENSE",
|
|
||||||
"HISTORY.md",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"gitHead": "6e024b1139202f69a537884ea755a0bf1bb72d69",
|
|
||||||
"homepage": "https://github.com/pillarjs/finalhandler#readme",
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "finalhandler",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/pillarjs/finalhandler.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint --plugin markdown --ext js,md .",
|
|
||||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
||||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
|
||||||
},
|
|
||||||
"version": "1.0.0"
|
|
||||||
}
|
|
38
node_modules/fresh/HISTORY.md
generated
vendored
38
node_modules/fresh/HISTORY.md
generated
vendored
@@ -1,38 +0,0 @@
|
|||||||
0.3.0 / 2015-05-12
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Add weak `ETag` matching support
|
|
||||||
|
|
||||||
0.2.4 / 2014-09-07
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support Node.js 0.6
|
|
||||||
|
|
||||||
0.2.3 / 2014-09-07
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Move repository to jshttp
|
|
||||||
|
|
||||||
0.2.2 / 2014-02-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Revert "Fix for blank page on Safari reload"
|
|
||||||
|
|
||||||
0.2.1 / 2014-01-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix for blank page on Safari reload
|
|
||||||
|
|
||||||
0.2.0 / 2013-08-11
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Return stale for `Cache-Control: no-cache`
|
|
||||||
|
|
||||||
0.1.0 / 2012-06-15
|
|
||||||
==================
|
|
||||||
* Add `If-None-Match: *` support
|
|
||||||
|
|
||||||
0.0.1 / 2012-06-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Initial release
|
|
22
node_modules/fresh/LICENSE
generated
vendored
22
node_modules/fresh/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2012 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.
|
|
58
node_modules/fresh/README.md
generated
vendored
58
node_modules/fresh/README.md
generated
vendored
@@ -1,58 +0,0 @@
|
|||||||
# fresh
|
|
||||||
|
|
||||||
[![NPM Version][npm-image]][npm-url]
|
|
||||||
[![NPM Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Node.js Version][node-version-image]][node-version-url]
|
|
||||||
[![Build Status][travis-image]][travis-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
HTTP response freshness testing
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npm install fresh
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var fresh = require('fresh')
|
|
||||||
```
|
|
||||||
|
|
||||||
### fresh(req, res)
|
|
||||||
|
|
||||||
Check freshness of `req` and `res` headers.
|
|
||||||
|
|
||||||
When the cache is "fresh" __true__ is returned,
|
|
||||||
otherwise __false__ is returned to indicate that
|
|
||||||
the cache is now stale.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
var req = { 'if-none-match': 'tobi' };
|
|
||||||
var res = { 'etag': 'luna' };
|
|
||||||
fresh(req, res);
|
|
||||||
// => false
|
|
||||||
|
|
||||||
var req = { 'if-none-match': 'tobi' };
|
|
||||||
var res = { 'etag': 'tobi' };
|
|
||||||
fresh(req, res);
|
|
||||||
// => true
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/fresh.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/fresh
|
|
||||||
[node-version-image]: https://img.shields.io/node/v/fresh.svg
|
|
||||||
[node-version-url]: http://nodejs.org/download/
|
|
||||||
[travis-image]: https://img.shields.io/travis/jshttp/fresh/master.svg
|
|
||||||
[travis-url]: https://travis-ci.org/jshttp/fresh
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh/master.svg
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/fresh.svg
|
|
||||||
[downloads-url]: https://npmjs.org/package/fresh
|
|
57
node_modules/fresh/index.js
generated
vendored
57
node_modules/fresh/index.js
generated
vendored
@@ -1,57 +0,0 @@
|
|||||||
|
|
||||||
/**
|
|
||||||
* Expose `fresh()`.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = fresh;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check freshness of `req` and `res` headers.
|
|
||||||
*
|
|
||||||
* When the cache is "fresh" __true__ is returned,
|
|
||||||
* otherwise __false__ is returned to indicate that
|
|
||||||
* the cache is now stale.
|
|
||||||
*
|
|
||||||
* @param {Object} req
|
|
||||||
* @param {Object} res
|
|
||||||
* @return {Boolean}
|
|
||||||
* @api public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function fresh(req, res) {
|
|
||||||
// defaults
|
|
||||||
var etagMatches = true;
|
|
||||||
var notModified = true;
|
|
||||||
|
|
||||||
// fields
|
|
||||||
var modifiedSince = req['if-modified-since'];
|
|
||||||
var noneMatch = req['if-none-match'];
|
|
||||||
var lastModified = res['last-modified'];
|
|
||||||
var etag = res['etag'];
|
|
||||||
var cc = req['cache-control'];
|
|
||||||
|
|
||||||
// unconditional request
|
|
||||||
if (!modifiedSince && !noneMatch) return false;
|
|
||||||
|
|
||||||
// check for no-cache cache request directive
|
|
||||||
if (cc && cc.indexOf('no-cache') !== -1) return false;
|
|
||||||
|
|
||||||
// parse if-none-match
|
|
||||||
if (noneMatch) noneMatch = noneMatch.split(/ *, */);
|
|
||||||
|
|
||||||
// if-none-match
|
|
||||||
if (noneMatch) {
|
|
||||||
etagMatches = noneMatch.some(function (match) {
|
|
||||||
return match === '*' || match === etag || match === 'W/' + etag;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// if-modified-since
|
|
||||||
if (modifiedSince) {
|
|
||||||
modifiedSince = new Date(modifiedSince);
|
|
||||||
lastModified = new Date(lastModified);
|
|
||||||
notModified = lastModified <= modifiedSince;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !! (etagMatches && notModified);
|
|
||||||
}
|
|
113
node_modules/fresh/package.json
generated
vendored
113
node_modules/fresh/package.json
generated
vendored
@@ -1,113 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"fresh@0.3.0",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "fresh@0.3.0",
|
|
||||||
"_id": "fresh@0.3.0",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/fresh",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "fresh",
|
|
||||||
"raw": "fresh@0.3.0",
|
|
||||||
"rawSpec": "0.3.0",
|
|
||||||
"scope": null,
|
|
||||||
"spec": "0.3.0",
|
|
||||||
"type": "version"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.3.0.tgz",
|
|
||||||
"_shasum": "651f838e22424e7566de161d8358caa199f83d4f",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "fresh@0.3.0",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send",
|
|
||||||
"author": {
|
|
||||||
"email": "tj@vision-media.ca",
|
|
||||||
"name": "TJ Holowaychuk",
|
|
||||||
"url": "http://tjholowaychuk.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jshttp/fresh/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "me@jongleberry.com",
|
|
||||||
"name": "Jonathan Ong",
|
|
||||||
"url": "http://jongleberry.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "HTTP response freshness testing",
|
|
||||||
"devDependencies": {
|
|
||||||
"istanbul": "0.3.9",
|
|
||||||
"mocha": "1.21.5"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "651f838e22424e7566de161d8358caa199f83d4f",
|
|
||||||
"tarball": "https://registry.npmjs.org/fresh/-/fresh-0.3.0.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"HISTORY.md",
|
|
||||||
"LICENSE",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"gitHead": "14616c9748368ca08cd6a955dd88ab659b778634",
|
|
||||||
"homepage": "https://github.com/jshttp/fresh",
|
|
||||||
"keywords": [
|
|
||||||
"fresh",
|
|
||||||
"http",
|
|
||||||
"conditional",
|
|
||||||
"cache"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "tj@vision-media.ca",
|
|
||||||
"name": "tjholowaychuk"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "jonathanrichardong@gmail.com",
|
|
||||||
"name": "jonathanong"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "jonathanrichardong@gmail.com",
|
|
||||||
"name": "jongleberry"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "fresh",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jshttp/fresh.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
|
||||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
|
||||||
},
|
|
||||||
"version": "0.3.0"
|
|
||||||
}
|
|
103
node_modules/http-errors/HISTORY.md
generated
vendored
103
node_modules/http-errors/HISTORY.md
generated
vendored
@@ -1,103 +0,0 @@
|
|||||||
2016-11-16 / 1.5.1
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: inherits@2.0.3
|
|
||||||
- Fix issue loading in browser
|
|
||||||
* deps: setprototypeof@1.0.2
|
|
||||||
* deps: statuses@'>= 1.3.1 < 2'
|
|
||||||
|
|
||||||
2016-05-18 / 1.5.0
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support new code `421 Misdirected Request`
|
|
||||||
* Use `setprototypeof` module to replace `__proto__` setting
|
|
||||||
* deps: statuses@'>= 1.3.0 < 2'
|
|
||||||
- Add `421 Misdirected Request`
|
|
||||||
- perf: enable strict mode
|
|
||||||
* perf: enable strict mode
|
|
||||||
|
|
||||||
2016-01-28 / 1.4.0
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Add `HttpError` export, for `err instanceof createError.HttpError`
|
|
||||||
* deps: inherits@2.0.1
|
|
||||||
* deps: statuses@'>= 1.2.1 < 2'
|
|
||||||
- Fix message for status 451
|
|
||||||
- Remove incorrect nginx status code
|
|
||||||
|
|
||||||
2015-02-02 / 1.3.1
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix regression where status can be overwritten in `createError` `props`
|
|
||||||
|
|
||||||
2015-02-01 / 1.3.0
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Construct errors using defined constructors from `createError`
|
|
||||||
* Fix error names that are not identifiers
|
|
||||||
- `createError["I'mateapot"]` is now `createError.ImATeapot`
|
|
||||||
* Set a meaningful `name` property on constructed errors
|
|
||||||
|
|
||||||
2014-12-09 / 1.2.8
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix stack trace from exported function
|
|
||||||
* Remove `arguments.callee` usage
|
|
||||||
|
|
||||||
2014-10-14 / 1.2.7
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Remove duplicate line
|
|
||||||
|
|
||||||
2014-10-02 / 1.2.6
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix `expose` to be `true` for `ClientError` constructor
|
|
||||||
|
|
||||||
2014-09-28 / 1.2.5
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: statuses@1
|
|
||||||
|
|
||||||
2014-09-21 / 1.2.4
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix dependency version to work with old `npm`s
|
|
||||||
|
|
||||||
2014-09-21 / 1.2.3
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: statuses@~1.1.0
|
|
||||||
|
|
||||||
2014-09-21 / 1.2.2
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix publish error
|
|
||||||
|
|
||||||
2014-09-21 / 1.2.1
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support Node.js 0.6
|
|
||||||
* Use `inherits` instead of `util`
|
|
||||||
|
|
||||||
2014-09-09 / 1.2.0
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix the way inheriting functions
|
|
||||||
* Support `expose` being provided in properties argument
|
|
||||||
|
|
||||||
2014-09-08 / 1.1.0
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Default status to 500
|
|
||||||
* Support provided `error` to extend
|
|
||||||
|
|
||||||
2014-09-08 / 1.0.1
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix accepting string message
|
|
||||||
|
|
||||||
2014-09-08 / 1.0.0
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Initial release
|
|
23
node_modules/http-errors/LICENSE
generated
vendored
23
node_modules/http-errors/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
|
||||||
Copyright (c) 2016 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.
|
|
132
node_modules/http-errors/README.md
generated
vendored
132
node_modules/http-errors/README.md
generated
vendored
@@ -1,132 +0,0 @@
|
|||||||
# http-errors
|
|
||||||
|
|
||||||
[![NPM Version][npm-image]][npm-url]
|
|
||||||
[![NPM Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Node.js Version][node-version-image]][node-version-url]
|
|
||||||
[![Build Status][travis-image]][travis-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
Create HTTP errors for Express, Koa, Connect, etc. with ease.
|
|
||||||
|
|
||||||
## 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 http-errors
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
var createError = require('http-errors')
|
|
||||||
var express = require('express')
|
|
||||||
var app = express()
|
|
||||||
|
|
||||||
app.use(function (req, res, next) {
|
|
||||||
if (!req.user) return next(createError(401, 'Please login to view this page.'))
|
|
||||||
next()
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
This is the current API, currently extracted from Koa and subject to change.
|
|
||||||
|
|
||||||
All errors inherit from JavaScript `Error` and the exported `createError.HttpError`.
|
|
||||||
|
|
||||||
### Error Properties
|
|
||||||
|
|
||||||
- `expose` - can be used to signal if `message` should be sent to the client,
|
|
||||||
defaulting to `false` when `status` >= 500
|
|
||||||
- `headers` - can be an object of header names to values to be sent to the
|
|
||||||
client, defaulting to `undefined`. When defined, the key names should all
|
|
||||||
be lower-cased
|
|
||||||
- `message`
|
|
||||||
- `status` and `statusCode` - the status code of the error, defaulting to `500`
|
|
||||||
|
|
||||||
### createError([status], [message], [properties])
|
|
||||||
|
|
||||||
<!-- eslint-disable no-undef, no-unused-vars -->
|
|
||||||
|
|
||||||
```js
|
|
||||||
var err = createError(404, 'This video does not exist!')
|
|
||||||
```
|
|
||||||
|
|
||||||
- `status: 500` - the status code as a number
|
|
||||||
- `message` - the message of the error, defaulting to node's text for that status code.
|
|
||||||
- `properties` - custom properties to attach to the object
|
|
||||||
|
|
||||||
### new createError\[code || name\](\[msg]\))
|
|
||||||
|
|
||||||
<!-- eslint-disable no-undef, no-unused-vars -->
|
|
||||||
|
|
||||||
```js
|
|
||||||
var err = new createError.NotFound()
|
|
||||||
```
|
|
||||||
|
|
||||||
- `code` - the status code as a number
|
|
||||||
- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
|
|
||||||
|
|
||||||
#### List of all constructors
|
|
||||||
|
|
||||||
|Status Code|Constructor Name |
|
|
||||||
|-----------|-----------------------------|
|
|
||||||
|400 |BadRequest |
|
|
||||||
|401 |Unauthorized |
|
|
||||||
|402 |PaymentRequired |
|
|
||||||
|403 |Forbidden |
|
|
||||||
|404 |NotFound |
|
|
||||||
|405 |MethodNotAllowed |
|
|
||||||
|406 |NotAcceptable |
|
|
||||||
|407 |ProxyAuthenticationRequired |
|
|
||||||
|408 |RequestTimeout |
|
|
||||||
|409 |Conflict |
|
|
||||||
|410 |Gone |
|
|
||||||
|411 |LengthRequired |
|
|
||||||
|412 |PreconditionFailed |
|
|
||||||
|413 |PayloadTooLarge |
|
|
||||||
|414 |URITooLong |
|
|
||||||
|415 |UnsupportedMediaType |
|
|
||||||
|416 |RangeNotSatisfiable |
|
|
||||||
|417 |ExpectationFailed |
|
|
||||||
|418 |ImATeapot |
|
|
||||||
|421 |MisdirectedRequest |
|
|
||||||
|422 |UnprocessableEntity |
|
|
||||||
|423 |Locked |
|
|
||||||
|424 |FailedDependency |
|
|
||||||
|425 |UnorderedCollection |
|
|
||||||
|426 |UpgradeRequired |
|
|
||||||
|428 |PreconditionRequired |
|
|
||||||
|429 |TooManyRequests |
|
|
||||||
|431 |RequestHeaderFieldsTooLarge |
|
|
||||||
|451 |UnavailableForLegalReasons |
|
|
||||||
|500 |InternalServerError |
|
|
||||||
|501 |NotImplemented |
|
|
||||||
|502 |BadGateway |
|
|
||||||
|503 |ServiceUnavailable |
|
|
||||||
|504 |GatewayTimeout |
|
|
||||||
|505 |HTTPVersionNotSupported |
|
|
||||||
|506 |VariantAlsoNegotiates |
|
|
||||||
|507 |InsufficientStorage |
|
|
||||||
|508 |LoopDetected |
|
|
||||||
|509 |BandwidthLimitExceeded |
|
|
||||||
|510 |NotExtended |
|
|
||||||
|511 |NetworkAuthenticationRequired|
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/http-errors.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/http-errors
|
|
||||||
[node-version-image]: https://img.shields.io/node/v/http-errors.svg
|
|
||||||
[node-version-url]: https://nodejs.org/en/download/
|
|
||||||
[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg
|
|
||||||
[travis-url]: https://travis-ci.org/jshttp/http-errors
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jshttp/http-errors
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/http-errors.svg
|
|
||||||
[downloads-url]: https://npmjs.org/package/http-errors
|
|
223
node_modules/http-errors/index.js
generated
vendored
223
node_modules/http-errors/index.js
generated
vendored
@@ -1,223 +0,0 @@
|
|||||||
/*!
|
|
||||||
* http-errors
|
|
||||||
* Copyright(c) 2014 Jonathan Ong
|
|
||||||
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var setPrototypeOf = require('setprototypeof')
|
|
||||||
var statuses = require('statuses')
|
|
||||||
var inherits = require('inherits')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = createError
|
|
||||||
module.exports.HttpError = createHttpErrorConstructor()
|
|
||||||
|
|
||||||
// Populate exports for all constructors
|
|
||||||
populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new HTTP Error.
|
|
||||||
*
|
|
||||||
* @returns {Error}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createError () {
|
|
||||||
// so much arity going on ~_~
|
|
||||||
var err
|
|
||||||
var msg
|
|
||||||
var status = 500
|
|
||||||
var props = {}
|
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
|
||||||
var arg = arguments[i]
|
|
||||||
if (arg instanceof Error) {
|
|
||||||
err = arg
|
|
||||||
status = err.status || err.statusCode || status
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch (typeof arg) {
|
|
||||||
case 'string':
|
|
||||||
msg = arg
|
|
||||||
break
|
|
||||||
case 'number':
|
|
||||||
status = arg
|
|
||||||
break
|
|
||||||
case 'object':
|
|
||||||
props = arg
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof status !== 'number' || !statuses[status]) {
|
|
||||||
status = 500
|
|
||||||
}
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
var HttpError = createError[status]
|
|
||||||
|
|
||||||
if (!err) {
|
|
||||||
// create error
|
|
||||||
err = HttpError
|
|
||||||
? new HttpError(msg)
|
|
||||||
: new Error(msg || statuses[status])
|
|
||||||
Error.captureStackTrace(err, createError)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HttpError || !(err instanceof HttpError)) {
|
|
||||||
// add properties to generic error
|
|
||||||
err.expose = status < 500
|
|
||||||
err.status = err.statusCode = status
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var key in props) {
|
|
||||||
if (key !== 'status' && key !== 'statusCode') {
|
|
||||||
err[key] = props[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create HTTP error abstract base class.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createHttpErrorConstructor () {
|
|
||||||
function HttpError () {
|
|
||||||
throw new TypeError('cannot construct abstract class')
|
|
||||||
}
|
|
||||||
|
|
||||||
inherits(HttpError, Error)
|
|
||||||
|
|
||||||
return HttpError
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a constructor for a client error.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createClientErrorConstructor (HttpError, name, code) {
|
|
||||||
var className = name.match(/Error$/) ? name : name + 'Error'
|
|
||||||
|
|
||||||
function ClientError (message) {
|
|
||||||
// create the error object
|
|
||||||
var err = new Error(message != null ? message : statuses[code])
|
|
||||||
|
|
||||||
// capture a stack trace to the construction point
|
|
||||||
Error.captureStackTrace(err, ClientError)
|
|
||||||
|
|
||||||
// adjust the [[Prototype]]
|
|
||||||
setPrototypeOf(err, ClientError.prototype)
|
|
||||||
|
|
||||||
// redefine the error name
|
|
||||||
Object.defineProperty(err, 'name', {
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
value: className,
|
|
||||||
writable: true
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
inherits(ClientError, HttpError)
|
|
||||||
|
|
||||||
ClientError.prototype.status = code
|
|
||||||
ClientError.prototype.statusCode = code
|
|
||||||
ClientError.prototype.expose = true
|
|
||||||
|
|
||||||
return ClientError
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a constructor for a server error.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createServerErrorConstructor (HttpError, name, code) {
|
|
||||||
var className = name.match(/Error$/) ? name : name + 'Error'
|
|
||||||
|
|
||||||
function ServerError (message) {
|
|
||||||
// create the error object
|
|
||||||
var err = new Error(message != null ? message : statuses[code])
|
|
||||||
|
|
||||||
// capture a stack trace to the construction point
|
|
||||||
Error.captureStackTrace(err, ServerError)
|
|
||||||
|
|
||||||
// adjust the [[Prototype]]
|
|
||||||
setPrototypeOf(err, ServerError.prototype)
|
|
||||||
|
|
||||||
// redefine the error name
|
|
||||||
Object.defineProperty(err, 'name', {
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
value: className,
|
|
||||||
writable: true
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
inherits(ServerError, HttpError)
|
|
||||||
|
|
||||||
ServerError.prototype.status = code
|
|
||||||
ServerError.prototype.statusCode = code
|
|
||||||
ServerError.prototype.expose = false
|
|
||||||
|
|
||||||
return ServerError
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Populate the exports object with constructors for every error class.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function populateConstructorExports (exports, codes, HttpError) {
|
|
||||||
codes.forEach(function forEachCode (code) {
|
|
||||||
var CodeError
|
|
||||||
var name = toIdentifier(statuses[code])
|
|
||||||
|
|
||||||
switch (String(code).charAt(0)) {
|
|
||||||
case '4':
|
|
||||||
CodeError = createClientErrorConstructor(HttpError, name, code)
|
|
||||||
break
|
|
||||||
case '5':
|
|
||||||
CodeError = createServerErrorConstructor(HttpError, name, code)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CodeError) {
|
|
||||||
// export the constructor
|
|
||||||
exports[code] = CodeError
|
|
||||||
exports[name] = CodeError
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// backwards-compatibility
|
|
||||||
exports["I'mateapot"] = exports.ImATeapot
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a string of words to a JavaScript identifier.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function toIdentifier (str) {
|
|
||||||
return str.split(' ').map(function (token) {
|
|
||||||
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
||||||
}).join('').replace(/[^ _0-9a-z]/gi, '')
|
|
||||||
}
|
|
121
node_modules/http-errors/package.json
generated
vendored
121
node_modules/http-errors/package.json
generated
vendored
@@ -1,121 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"http-errors@~1.5.1",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "http-errors@>=1.5.1 <1.6.0",
|
|
||||||
"_id": "http-errors@1.5.1",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/http-errors",
|
|
||||||
"_npmOperationalInternal": {
|
|
||||||
"host": "packages-18-east.internal.npmjs.com",
|
|
||||||
"tmp": "tmp/http-errors-1.5.1.tgz_1479361411507_0.47469806275330484"
|
|
||||||
},
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "http-errors",
|
|
||||||
"raw": "http-errors@~1.5.1",
|
|
||||||
"rawSpec": "~1.5.1",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=1.5.1 <1.6.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/send"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.5.1.tgz",
|
|
||||||
"_shasum": "788c0d2c1de2c81b9e6e8c01843b6b97eb920750",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "http-errors@~1.5.1",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/send",
|
|
||||||
"author": {
|
|
||||||
"email": "me@jongleberry.com",
|
|
||||||
"name": "Jonathan Ong",
|
|
||||||
"url": "http://jongleberry.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jshttp/http-errors/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"email": "me@pluma.io",
|
|
||||||
"name": "Alan Plum"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "Douglas Christopher Wilson"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"inherits": "2.0.3",
|
|
||||||
"setprototypeof": "1.0.2",
|
|
||||||
"statuses": ">= 1.3.1 < 2"
|
|
||||||
},
|
|
||||||
"description": "Create HTTP error objects",
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "3.10.2",
|
|
||||||
"eslint-config-standard": "6.2.1",
|
|
||||||
"eslint-plugin-markdown": "1.0.0-beta.3",
|
|
||||||
"eslint-plugin-promise": "3.3.2",
|
|
||||||
"eslint-plugin-standard": "2.0.1",
|
|
||||||
"istanbul": "0.4.5",
|
|
||||||
"mocha": "1.21.5"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "788c0d2c1de2c81b9e6e8c01843b6b97eb920750",
|
|
||||||
"tarball": "https://registry.npmjs.org/http-errors/-/http-errors-1.5.1.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"index.js",
|
|
||||||
"HISTORY.md",
|
|
||||||
"LICENSE",
|
|
||||||
"README.md"
|
|
||||||
],
|
|
||||||
"gitHead": "a55db90c7a2c0bafedb4bfa35a85eee5f53a37e9",
|
|
||||||
"homepage": "https://github.com/jshttp/http-errors",
|
|
||||||
"keywords": [
|
|
||||||
"http",
|
|
||||||
"error"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "doug@somethingdoug.com",
|
|
||||||
"name": "dougwilson"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "npm@egeste.net",
|
|
||||||
"name": "egeste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "jonathanrichardong@gmail.com",
|
|
||||||
"name": "jongleberry"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "http-errors",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jshttp/http-errors.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint --plugin markdown --ext js,md .",
|
|
||||||
"test": "mocha --reporter spec --bail",
|
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
|
||||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
|
||||||
},
|
|
||||||
"version": "1.5.1"
|
|
||||||
}
|
|
16
node_modules/inherits/LICENSE
generated
vendored
16
node_modules/inherits/LICENSE
generated
vendored
@@ -1,16 +0,0 @@
|
|||||||
The ISC License
|
|
||||||
|
|
||||||
Copyright (c) Isaac Z. Schlueter
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
||||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
||||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
||||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
||||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
42
node_modules/inherits/README.md
generated
vendored
42
node_modules/inherits/README.md
generated
vendored
@@ -1,42 +0,0 @@
|
|||||||
Browser-friendly inheritance fully compatible with standard node.js
|
|
||||||
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
|
|
||||||
|
|
||||||
This package exports standard `inherits` from node.js `util` module in
|
|
||||||
node environment, but also provides alternative browser-friendly
|
|
||||||
implementation through [browser
|
|
||||||
field](https://gist.github.com/shtylman/4339901). Alternative
|
|
||||||
implementation is a literal copy of standard one located in standalone
|
|
||||||
module to avoid requiring of `util`. It also has a shim for old
|
|
||||||
browsers with no `Object.create` support.
|
|
||||||
|
|
||||||
While keeping you sure you are using standard `inherits`
|
|
||||||
implementation in node.js environment, it allows bundlers such as
|
|
||||||
[browserify](https://github.com/substack/node-browserify) to not
|
|
||||||
include full `util` package to your client code if all you need is
|
|
||||||
just `inherits` function. It worth, because browser shim for `util`
|
|
||||||
package is large and `inherits` is often the single function you need
|
|
||||||
from it.
|
|
||||||
|
|
||||||
It's recommended to use this package instead of
|
|
||||||
`require('util').inherits` for any code that has chances to be used
|
|
||||||
not only in node.js but in browser too.
|
|
||||||
|
|
||||||
## usage
|
|
||||||
|
|
||||||
```js
|
|
||||||
var inherits = require('inherits');
|
|
||||||
// then use exactly as the standard one
|
|
||||||
```
|
|
||||||
|
|
||||||
## note on version ~1.0
|
|
||||||
|
|
||||||
Version ~1.0 had completely different motivation and is not compatible
|
|
||||||
neither with 2.0 nor with standard node.js `inherits`.
|
|
||||||
|
|
||||||
If you are using version ~1.0 and planning to switch to ~2.0, be
|
|
||||||
careful:
|
|
||||||
|
|
||||||
* new version uses `super_` instead of `super` for referencing
|
|
||||||
superclass
|
|
||||||
* new version overwrites current prototype while old one preserves any
|
|
||||||
existing fields on it
|
|
7
node_modules/inherits/inherits.js
generated
vendored
7
node_modules/inherits/inherits.js
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
try {
|
|
||||||
var util = require('util');
|
|
||||||
if (typeof util.inherits !== 'function') throw '';
|
|
||||||
module.exports = util.inherits;
|
|
||||||
} catch (e) {
|
|
||||||
module.exports = require('./inherits_browser.js');
|
|
||||||
}
|
|
23
node_modules/inherits/inherits_browser.js
generated
vendored
23
node_modules/inherits/inherits_browser.js
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
if (typeof Object.create === 'function') {
|
|
||||||
// implementation from standard node.js 'util' module
|
|
||||||
module.exports = function inherits(ctor, superCtor) {
|
|
||||||
ctor.super_ = superCtor
|
|
||||||
ctor.prototype = Object.create(superCtor.prototype, {
|
|
||||||
constructor: {
|
|
||||||
value: ctor,
|
|
||||||
enumerable: false,
|
|
||||||
writable: true,
|
|
||||||
configurable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// old school shim for old browsers
|
|
||||||
module.exports = function inherits(ctor, superCtor) {
|
|
||||||
ctor.super_ = superCtor
|
|
||||||
var TempCtor = function () {}
|
|
||||||
TempCtor.prototype = superCtor.prototype
|
|
||||||
ctor.prototype = new TempCtor()
|
|
||||||
ctor.prototype.constructor = ctor
|
|
||||||
}
|
|
||||||
}
|
|
89
node_modules/inherits/package.json
generated
vendored
89
node_modules/inherits/package.json
generated
vendored
@@ -1,89 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"inherits@2.0.3",
|
|
||||||
"/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/http-errors"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "inherits@2.0.3",
|
|
||||||
"_id": "inherits@2.0.3",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/inherits",
|
|
||||||
"_nodeVersion": "6.5.0",
|
|
||||||
"_npmOperationalInternal": {
|
|
||||||
"host": "packages-16-east.internal.npmjs.com",
|
|
||||||
"tmp": "tmp/inherits-2.0.3.tgz_1473295776489_0.08142363070510328"
|
|
||||||
},
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "i@izs.me",
|
|
||||||
"name": "isaacs"
|
|
||||||
},
|
|
||||||
"_npmVersion": "3.10.7",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "inherits",
|
|
||||||
"raw": "inherits@2.0.3",
|
|
||||||
"rawSpec": "2.0.3",
|
|
||||||
"scope": null,
|
|
||||||
"spec": "2.0.3",
|
|
||||||
"type": "version"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/http-errors"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
|
||||||
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "inherits@2.0.3",
|
|
||||||
"_where": "/mnt/c/Users/Henry/git/PaperIO-Web/node_modules/http-errors",
|
|
||||||
"browser": "./inherits_browser.js",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/isaacs/inherits/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
|
||||||
"devDependencies": {
|
|
||||||
"tap": "^7.1.0"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
|
||||||
"tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"inherits.js",
|
|
||||||
"inherits_browser.js"
|
|
||||||
],
|
|
||||||
"gitHead": "e05d0fb27c61a3ec687214f0476386b765364d5f",
|
|
||||||
"homepage": "https://github.com/isaacs/inherits#readme",
|
|
||||||
"keywords": [
|
|
||||||
"inheritance",
|
|
||||||
"class",
|
|
||||||
"klass",
|
|
||||||
"oop",
|
|
||||||
"object-oriented",
|
|
||||||
"inherits",
|
|
||||||
"browser",
|
|
||||||
"browserify"
|
|
||||||
],
|
|
||||||
"license": "ISC",
|
|
||||||
"main": "./inherits.js",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"email": "i@izs.me",
|
|
||||||
"name": "isaacs"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "inherits",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/isaacs/inherits.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "node test"
|
|
||||||
},
|
|
||||||
"version": "2.0.3"
|
|
||||||
}
|
|
0
node_modules/mime/.npmignore
generated
vendored
0
node_modules/mime/.npmignore
generated
vendored
19
node_modules/mime/LICENSE
generated
vendored
19
node_modules/mime/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
|||||||
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.
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user