parent
fde81bde41
commit
0ebcddcf21
@ -0,0 +1,3 @@
|
||||
/coverage
|
||||
/node_modules
|
||||
/prod
|
||||
@ -1 +0,0 @@
|
||||
{"prod/js/main.js":{"b":{},"branchMap":{},"f":{"1":1,"2":1,"3":1},"fnMap":{"1":{"line":1,"loc":{"end":{"column":12,"line":1},"start":{"column":1,"line":1}},"name":"(anonymous_1)"},"2":{"line":2,"loc":{"end":{"column":13,"line":2},"start":{"column":3,"line":2}},"name":"(anonymous_2)"},"3":{"line":3,"loc":{"end":{"column":25,"line":3},"start":{"column":15,"line":3}},"name":"(anonymous_3)"}},"path":"prod/js/main.js","s":{"1":1,"2":1,"3":1,"4":1},"statementMap":{"1":{"end":{"column":11,"line":7},"start":{"column":0,"line":1}},"2":{"end":{"column":4,"line":6},"start":{"column":1,"line":2}},"3":{"end":{"column":5,"line":5},"start":{"column":2,"line":3}},"4":{"end":{"column":75,"line":4},"start":{"column":3,"line":4}}}}}
|
||||
@ -1,350 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for All files</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<link rel="stylesheet" href="prettify.css">
|
||||
|
||||
<style>
|
||||
body, html {
|
||||
margin:0; padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica,Arial;
|
||||
font-size: 10pt;
|
||||
}
|
||||
div.header, div.footer {
|
||||
background: #eee;
|
||||
padding: 1em;
|
||||
}
|
||||
div.header {
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
border-bottom: 1px solid #666;
|
||||
width: 100%;
|
||||
}
|
||||
div.footer {
|
||||
border-top: 1px solid #666;
|
||||
}
|
||||
div.body {
|
||||
margin-top: 10em;
|
||||
}
|
||||
div.meta {
|
||||
font-size: 90%;
|
||||
text-align: center;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
font-weight: normal;
|
||||
}
|
||||
h1 {
|
||||
font-size: 12pt;
|
||||
}
|
||||
h2 {
|
||||
font-size: 10pt;
|
||||
}
|
||||
pre {
|
||||
font-family: Consolas, Menlo, Monaco, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 14px;
|
||||
font-size: 14px;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
|
||||
div.path { font-size: 110%; }
|
||||
div.path a:link, div.path a:visited { color: #000; }
|
||||
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #111;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
width: 50px;
|
||||
text-align: right;
|
||||
padding-right: 5px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
color: #777 !important;
|
||||
text-align: right;
|
||||
border-left: 1px solid #666;
|
||||
border-right: 1px solid #666;
|
||||
}
|
||||
|
||||
table.coverage td.text {
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 40px;
|
||||
}
|
||||
table.coverage td span.cline-neutral {
|
||||
background: #eee;
|
||||
}
|
||||
table.coverage td span.cline-yes {
|
||||
background: #b5d592;
|
||||
color: #999;
|
||||
}
|
||||
table.coverage td span.cline-no {
|
||||
background: #fc8c84;
|
||||
}
|
||||
|
||||
.cstat-yes { color: #111; }
|
||||
.cstat-no { background: #fc8c84; color: #111; }
|
||||
.fstat-no { background: #ffc520; color: #111 !important; }
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: black;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.entity, .metric { font-weight: bold; }
|
||||
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
|
||||
.metric small { font-size: 80%; font-weight: normal; color: #666; }
|
||||
|
||||
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
|
||||
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
|
||||
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
|
||||
div.coverage-summary th.file { border-right: none !important; }
|
||||
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
|
||||
div.coverage-summary th.pct { border-right: none !important; }
|
||||
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
|
||||
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
|
||||
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
|
||||
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
|
||||
div.coverage-summary td.pic { min-width: 120px !important; }
|
||||
div.coverage-summary a:link { text-decoration: none; color: #000; }
|
||||
div.coverage-summary a:visited { text-decoration: none; color: #333; }
|
||||
div.coverage-summary a:hover { text-decoration: underline; }
|
||||
div.coverage-summary tfoot td { border-top: 1px solid #666; }
|
||||
|
||||
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sort-indicator {
|
||||
background: url("http://yui.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
|
||||
.high { background: #b5d592 !important; }
|
||||
.medium { background: #ffe87c !important; }
|
||||
.low { background: #fc8c84 !important; }
|
||||
|
||||
span.cover-fill, span.cover-empty {
|
||||
display:inline-block;
|
||||
border:1px solid #444;
|
||||
background: white;
|
||||
height: 12px;
|
||||
}
|
||||
span.cover-fill {
|
||||
background: #ccc;
|
||||
border-right: 1px solid #444;
|
||||
}
|
||||
span.cover-empty {
|
||||
background: white;
|
||||
border-left: none;
|
||||
}
|
||||
span.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header high">
|
||||
<h1>Code coverage report for <span class="entity">All files</span></h1>
|
||||
<h2>
|
||||
|
||||
Statements: <span class="metric">100% <small>(4 / 4)</small></span>
|
||||
|
||||
|
||||
Branches: <span class="metric">100% <small>(0 / 0)</small></span>
|
||||
|
||||
|
||||
Functions: <span class="metric">100% <small>(3 / 3)</small></span>
|
||||
|
||||
|
||||
Lines: <span class="metric">100% <small>(4 / 4)</small></span>
|
||||
|
||||
Ignored: <span class="metric"><span class="ignore-none">none</span></span>
|
||||
</h2>
|
||||
<div class="path"></div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="coverage-summary">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="js/"><a href="js/index.html">js/</a></td>
|
||||
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">(4 / 4)</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">(0 / 0)</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">(3 / 3)</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">(4 / 4)</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Jun 24 2014 16:28:15 GMT-0400 (EDT)</div>
|
||||
</div>
|
||||
|
||||
<script src="prettify.js"></script>
|
||||
|
||||
<script src="http://yui.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
|
||||
<script>
|
||||
|
||||
YUI().use('datatable', function (Y) {
|
||||
|
||||
var formatters = {
|
||||
pct: function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
try {
|
||||
return o.value.toFixed(2) + '%';
|
||||
} catch (ex) { return o.value + '%'; }
|
||||
},
|
||||
html: function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
return o.record.get(o.column.key + '_html');
|
||||
}
|
||||
},
|
||||
defaultFormatter = function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
return o.value;
|
||||
};
|
||||
|
||||
function getColumns(theadNode) {
|
||||
var colNodes = theadNode.all('tr th'),
|
||||
cols = [],
|
||||
col;
|
||||
colNodes.each(function (colNode) {
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
label: colNode.get('innerHTML') || ' ',
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
className: colNode.getAttribute('class'),
|
||||
type: colNode.getAttribute('data-type'),
|
||||
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
|
||||
};
|
||||
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
|
||||
cols.push(col);
|
||||
});
|
||||
return cols;
|
||||
}
|
||||
|
||||
function getRowData(trNode, cols) {
|
||||
var tdNodes = trNode.all('td'),
|
||||
i,
|
||||
row = { classes: {} },
|
||||
node,
|
||||
name;
|
||||
for (i = 0; i < cols.length; i += 1) {
|
||||
name = cols[i].key;
|
||||
node = tdNodes.item(i);
|
||||
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
|
||||
row[name + '_html'] = node.get('innerHTML');
|
||||
row.classes[name] = node.getAttribute('class');
|
||||
//Y.log('Name: ' + name + '; Value: ' + row[name]);
|
||||
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
|
||||
}
|
||||
//Y.log(row);
|
||||
return row;
|
||||
}
|
||||
|
||||
function getData(tbodyNode, cols) {
|
||||
var data = [];
|
||||
tbodyNode.all('tr').each(function (trNode) {
|
||||
data.push(getRowData(trNode, cols));
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
function replaceTable(node) {
|
||||
if (!node) { return; }
|
||||
var cols = getColumns(node.one('thead')),
|
||||
data = getData(node.one('tbody'), cols),
|
||||
table,
|
||||
parent = node.get('parentNode');
|
||||
|
||||
table = new Y.DataTable({
|
||||
columns: cols,
|
||||
data: data,
|
||||
sortBy: 'file'
|
||||
});
|
||||
parent.set('innerHTML', '');
|
||||
table.render(parent);
|
||||
}
|
||||
|
||||
Y.on('domready', function () {
|
||||
replaceTable(Y.one('div.coverage-summary table'));
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,350 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for js/</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<link rel="stylesheet" href="../prettify.css">
|
||||
|
||||
<style>
|
||||
body, html {
|
||||
margin:0; padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica,Arial;
|
||||
font-size: 10pt;
|
||||
}
|
||||
div.header, div.footer {
|
||||
background: #eee;
|
||||
padding: 1em;
|
||||
}
|
||||
div.header {
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
border-bottom: 1px solid #666;
|
||||
width: 100%;
|
||||
}
|
||||
div.footer {
|
||||
border-top: 1px solid #666;
|
||||
}
|
||||
div.body {
|
||||
margin-top: 10em;
|
||||
}
|
||||
div.meta {
|
||||
font-size: 90%;
|
||||
text-align: center;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
font-weight: normal;
|
||||
}
|
||||
h1 {
|
||||
font-size: 12pt;
|
||||
}
|
||||
h2 {
|
||||
font-size: 10pt;
|
||||
}
|
||||
pre {
|
||||
font-family: Consolas, Menlo, Monaco, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 14px;
|
||||
font-size: 14px;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
|
||||
div.path { font-size: 110%; }
|
||||
div.path a:link, div.path a:visited { color: #000; }
|
||||
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #111;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
width: 50px;
|
||||
text-align: right;
|
||||
padding-right: 5px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
color: #777 !important;
|
||||
text-align: right;
|
||||
border-left: 1px solid #666;
|
||||
border-right: 1px solid #666;
|
||||
}
|
||||
|
||||
table.coverage td.text {
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 40px;
|
||||
}
|
||||
table.coverage td span.cline-neutral {
|
||||
background: #eee;
|
||||
}
|
||||
table.coverage td span.cline-yes {
|
||||
background: #b5d592;
|
||||
color: #999;
|
||||
}
|
||||
table.coverage td span.cline-no {
|
||||
background: #fc8c84;
|
||||
}
|
||||
|
||||
.cstat-yes { color: #111; }
|
||||
.cstat-no { background: #fc8c84; color: #111; }
|
||||
.fstat-no { background: #ffc520; color: #111 !important; }
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: black;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.entity, .metric { font-weight: bold; }
|
||||
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
|
||||
.metric small { font-size: 80%; font-weight: normal; color: #666; }
|
||||
|
||||
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
|
||||
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
|
||||
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
|
||||
div.coverage-summary th.file { border-right: none !important; }
|
||||
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
|
||||
div.coverage-summary th.pct { border-right: none !important; }
|
||||
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
|
||||
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
|
||||
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
|
||||
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
|
||||
div.coverage-summary td.pic { min-width: 120px !important; }
|
||||
div.coverage-summary a:link { text-decoration: none; color: #000; }
|
||||
div.coverage-summary a:visited { text-decoration: none; color: #333; }
|
||||
div.coverage-summary a:hover { text-decoration: underline; }
|
||||
div.coverage-summary tfoot td { border-top: 1px solid #666; }
|
||||
|
||||
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sort-indicator {
|
||||
background: url("http://yui.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
|
||||
.high { background: #b5d592 !important; }
|
||||
.medium { background: #ffe87c !important; }
|
||||
.low { background: #fc8c84 !important; }
|
||||
|
||||
span.cover-fill, span.cover-empty {
|
||||
display:inline-block;
|
||||
border:1px solid #444;
|
||||
background: white;
|
||||
height: 12px;
|
||||
}
|
||||
span.cover-fill {
|
||||
background: #ccc;
|
||||
border-right: 1px solid #444;
|
||||
}
|
||||
span.cover-empty {
|
||||
background: white;
|
||||
border-left: none;
|
||||
}
|
||||
span.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header high">
|
||||
<h1>Code coverage report for <span class="entity">js/</span></h1>
|
||||
<h2>
|
||||
|
||||
Statements: <span class="metric">100% <small>(4 / 4)</small></span>
|
||||
|
||||
|
||||
Branches: <span class="metric">100% <small>(0 / 0)</small></span>
|
||||
|
||||
|
||||
Functions: <span class="metric">100% <small>(3 / 3)</small></span>
|
||||
|
||||
|
||||
Lines: <span class="metric">100% <small>(4 / 4)</small></span>
|
||||
|
||||
Ignored: <span class="metric"><span class="ignore-none">none</span></span>
|
||||
</h2>
|
||||
<div class="path"><a href="../index.html">All files</a> » js/</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="coverage-summary">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="main.js"><a href="main.js.html">main.js</a></td>
|
||||
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">(4 / 4)</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">(0 / 0)</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">(3 / 3)</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">(4 / 4)</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Jun 24 2014 16:28:15 GMT-0400 (EDT)</div>
|
||||
</div>
|
||||
|
||||
<script src="../prettify.js"></script>
|
||||
|
||||
<script src="http://yui.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
|
||||
<script>
|
||||
|
||||
YUI().use('datatable', function (Y) {
|
||||
|
||||
var formatters = {
|
||||
pct: function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
try {
|
||||
return o.value.toFixed(2) + '%';
|
||||
} catch (ex) { return o.value + '%'; }
|
||||
},
|
||||
html: function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
return o.record.get(o.column.key + '_html');
|
||||
}
|
||||
},
|
||||
defaultFormatter = function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
return o.value;
|
||||
};
|
||||
|
||||
function getColumns(theadNode) {
|
||||
var colNodes = theadNode.all('tr th'),
|
||||
cols = [],
|
||||
col;
|
||||
colNodes.each(function (colNode) {
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
label: colNode.get('innerHTML') || ' ',
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
className: colNode.getAttribute('class'),
|
||||
type: colNode.getAttribute('data-type'),
|
||||
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
|
||||
};
|
||||
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
|
||||
cols.push(col);
|
||||
});
|
||||
return cols;
|
||||
}
|
||||
|
||||
function getRowData(trNode, cols) {
|
||||
var tdNodes = trNode.all('td'),
|
||||
i,
|
||||
row = { classes: {} },
|
||||
node,
|
||||
name;
|
||||
for (i = 0; i < cols.length; i += 1) {
|
||||
name = cols[i].key;
|
||||
node = tdNodes.item(i);
|
||||
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
|
||||
row[name + '_html'] = node.get('innerHTML');
|
||||
row.classes[name] = node.getAttribute('class');
|
||||
//Y.log('Name: ' + name + '; Value: ' + row[name]);
|
||||
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
|
||||
}
|
||||
//Y.log(row);
|
||||
return row;
|
||||
}
|
||||
|
||||
function getData(tbodyNode, cols) {
|
||||
var data = [];
|
||||
tbodyNode.all('tr').each(function (trNode) {
|
||||
data.push(getRowData(trNode, cols));
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
function replaceTable(node) {
|
||||
if (!node) { return; }
|
||||
var cols = getColumns(node.one('thead')),
|
||||
data = getData(node.one('tbody'), cols),
|
||||
table,
|
||||
parent = node.get('parentNode');
|
||||
|
||||
table = new Y.DataTable({
|
||||
columns: cols,
|
||||
data: data,
|
||||
sortBy: 'file'
|
||||
});
|
||||
parent.set('innerHTML', '');
|
||||
table.render(parent);
|
||||
}
|
||||
|
||||
Y.on('domready', function () {
|
||||
replaceTable(Y.one('div.coverage-summary table'));
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,340 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for js/main.js</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<link rel="stylesheet" href="../prettify.css">
|
||||
|
||||
<style>
|
||||
body, html {
|
||||
margin:0; padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica,Arial;
|
||||
font-size: 10pt;
|
||||
}
|
||||
div.header, div.footer {
|
||||
background: #eee;
|
||||
padding: 1em;
|
||||
}
|
||||
div.header {
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
border-bottom: 1px solid #666;
|
||||
width: 100%;
|
||||
}
|
||||
div.footer {
|
||||
border-top: 1px solid #666;
|
||||
}
|
||||
div.body {
|
||||
margin-top: 10em;
|
||||
}
|
||||
div.meta {
|
||||
font-size: 90%;
|
||||
text-align: center;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
font-weight: normal;
|
||||
}
|
||||
h1 {
|
||||
font-size: 12pt;
|
||||
}
|
||||
h2 {
|
||||
font-size: 10pt;
|
||||
}
|
||||
pre {
|
||||
font-family: Consolas, Menlo, Monaco, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 14px;
|
||||
font-size: 14px;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
|
||||
div.path { font-size: 110%; }
|
||||
div.path a:link, div.path a:visited { color: #000; }
|
||||
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #111;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
width: 50px;
|
||||
text-align: right;
|
||||
padding-right: 5px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
color: #777 !important;
|
||||
text-align: right;
|
||||
border-left: 1px solid #666;
|
||||
border-right: 1px solid #666;
|
||||
}
|
||||
|
||||
table.coverage td.text {
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 40px;
|
||||
}
|
||||
table.coverage td span.cline-neutral {
|
||||
background: #eee;
|
||||
}
|
||||
table.coverage td span.cline-yes {
|
||||
background: #b5d592;
|
||||
color: #999;
|
||||
}
|
||||
table.coverage td span.cline-no {
|
||||
background: #fc8c84;
|
||||
}
|
||||
|
||||
.cstat-yes { color: #111; }
|
||||
.cstat-no { background: #fc8c84; color: #111; }
|
||||
.fstat-no { background: #ffc520; color: #111 !important; }
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: black;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.entity, .metric { font-weight: bold; }
|
||||
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
|
||||
.metric small { font-size: 80%; font-weight: normal; color: #666; }
|
||||
|
||||
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
|
||||
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
|
||||
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
|
||||
div.coverage-summary th.file { border-right: none !important; }
|
||||
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
|
||||
div.coverage-summary th.pct { border-right: none !important; }
|
||||
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
|
||||
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
|
||||
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
|
||||
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
|
||||
div.coverage-summary td.pic { min-width: 120px !important; }
|
||||
div.coverage-summary a:link { text-decoration: none; color: #000; }
|
||||
div.coverage-summary a:visited { text-decoration: none; color: #333; }
|
||||
div.coverage-summary a:hover { text-decoration: underline; }
|
||||
div.coverage-summary tfoot td { border-top: 1px solid #666; }
|
||||
|
||||
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sort-indicator {
|
||||
background: url("http://yui.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
|
||||
.high { background: #b5d592 !important; }
|
||||
.medium { background: #ffe87c !important; }
|
||||
.low { background: #fc8c84 !important; }
|
||||
|
||||
span.cover-fill, span.cover-empty {
|
||||
display:inline-block;
|
||||
border:1px solid #444;
|
||||
background: white;
|
||||
height: 12px;
|
||||
}
|
||||
span.cover-fill {
|
||||
background: #ccc;
|
||||
border-right: 1px solid #444;
|
||||
}
|
||||
span.cover-empty {
|
||||
background: white;
|
||||
border-left: none;
|
||||
}
|
||||
span.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header high">
|
||||
<h1>Code coverage report for <span class="entity">js/main.js</span></h1>
|
||||
<h2>
|
||||
|
||||
Statements: <span class="metric">100% <small>(4 / 4)</small></span>
|
||||
|
||||
|
||||
Branches: <span class="metric">100% <small>(0 / 0)</small></span>
|
||||
|
||||
|
||||
Functions: <span class="metric">100% <small>(3 / 3)</small></span>
|
||||
|
||||
|
||||
Lines: <span class="metric">100% <small>(4 / 4)</small></span>
|
||||
|
||||
Ignored: <span class="metric"><span class="ignore-none">none</span></span>
|
||||
</h2>
|
||||
<div class="path"><a href="../index.html">All files</a> » <a href="index.html">js/</a> » main.js</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7</td><td class="line-coverage"><span class="cline-any cline-yes">1</span>
|
||||
<span class="cline-any cline-yes">1</span>
|
||||
<span class="cline-any cline-yes">1</span>
|
||||
<span class="cline-any cline-yes">1</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">(function($){
|
||||
$(function(){
|
||||
$('a').click(function(){
|
||||
$('body').append('<div id="jQueryAddedDiv">added through jquery</div>');
|
||||
});
|
||||
});
|
||||
})(jQuery);</pre></td></tr>
|
||||
</table></pre>
|
||||
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Jun 24 2014 16:28:15 GMT-0400 (EDT)</div>
|
||||
</div>
|
||||
|
||||
<script src="../prettify.js"></script>
|
||||
|
||||
<script src="http://yui.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
|
||||
<script>
|
||||
|
||||
YUI().use('datatable', function (Y) {
|
||||
|
||||
var formatters = {
|
||||
pct: function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
try {
|
||||
return o.value.toFixed(2) + '%';
|
||||
} catch (ex) { return o.value + '%'; }
|
||||
},
|
||||
html: function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
return o.record.get(o.column.key + '_html');
|
||||
}
|
||||
},
|
||||
defaultFormatter = function (o) {
|
||||
o.className += o.record.get('classes')[o.column.key];
|
||||
return o.value;
|
||||
};
|
||||
|
||||
function getColumns(theadNode) {
|
||||
var colNodes = theadNode.all('tr th'),
|
||||
cols = [],
|
||||
col;
|
||||
colNodes.each(function (colNode) {
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
label: colNode.get('innerHTML') || ' ',
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
className: colNode.getAttribute('class'),
|
||||
type: colNode.getAttribute('data-type'),
|
||||
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
|
||||
};
|
||||
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
|
||||
cols.push(col);
|
||||
});
|
||||
return cols;
|
||||
}
|
||||
|
||||
function getRowData(trNode, cols) {
|
||||
var tdNodes = trNode.all('td'),
|
||||
i,
|
||||
row = { classes: {} },
|
||||
node,
|
||||
name;
|
||||
for (i = 0; i < cols.length; i += 1) {
|
||||
name = cols[i].key;
|
||||
node = tdNodes.item(i);
|
||||
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
|
||||
row[name + '_html'] = node.get('innerHTML');
|
||||
row.classes[name] = node.getAttribute('class');
|
||||
//Y.log('Name: ' + name + '; Value: ' + row[name]);
|
||||
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
|
||||
}
|
||||
//Y.log(row);
|
||||
return row;
|
||||
}
|
||||
|
||||
function getData(tbodyNode, cols) {
|
||||
var data = [];
|
||||
tbodyNode.all('tr').each(function (trNode) {
|
||||
data.push(getRowData(trNode, cols));
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
function replaceTable(node) {
|
||||
if (!node) { return; }
|
||||
var cols = getColumns(node.one('thead')),
|
||||
data = getData(node.one('tbody'), cols),
|
||||
table,
|
||||
parent = node.get('parentNode');
|
||||
|
||||
table = new Y.DataTable({
|
||||
columns: cols,
|
||||
data: data,
|
||||
sortBy: 'file'
|
||||
});
|
||||
parent.set('innerHTML', '');
|
||||
table.render(parent);
|
||||
}
|
||||
|
||||
Y.on('domready', function () {
|
||||
replaceTable(Y.one('div.coverage-summary table'));
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1 +0,0 @@
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
File diff suppressed because one or more lines are too long
@ -1,19 +0,0 @@
|
||||
TN:
|
||||
SF:prod/js/main.js
|
||||
FN:1,(anonymous_1)
|
||||
FN:2,(anonymous_2)
|
||||
FN:3,(anonymous_3)
|
||||
FNF:3
|
||||
FNH:3
|
||||
FNDA:1,(anonymous_1)
|
||||
FNDA:1,(anonymous_2)
|
||||
FNDA:1,(anonymous_3)
|
||||
DA:1,1
|
||||
DA:2,1
|
||||
DA:3,1
|
||||
DA:4,1
|
||||
LF:4
|
||||
LH:4
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
||||
@ -1 +0,0 @@
|
||||
../grunt-istanbul/bin/grunt-istanbul
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"node": true,
|
||||
"es5": true
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
tmp
|
||||
@ -1,6 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install -g grunt-cli
|
||||
@ -1,6 +0,0 @@
|
||||
Tim Branyen (http://tbranyen.com/)
|
||||
Tyler Kellen (http://goingslowly.com/)
|
||||
Chris Talkington (http://christalkington.com/)
|
||||
Sebastian Golasch (http://www.asciidisco.com/)
|
||||
Vlad Filippov (http://vf.io)
|
||||
"Cowboy" Ben Alman (http://benalman.com/)
|
||||
@ -1,37 +0,0 @@
|
||||
v0.5.0:
|
||||
date: 2013-07-15
|
||||
changes:
|
||||
- Use rimraf directly, version 2.2.1 to fix issue on Windows.
|
||||
- Add no-write option to mimic grunt.file.delete behavior.
|
||||
v0.4.1:
|
||||
date: 2013-04-16
|
||||
changes:
|
||||
- Check if file exists to avoid trying to delete a non-existent file.
|
||||
v0.4.0:
|
||||
date: 2013-02-15
|
||||
changes:
|
||||
- First official release for Grunt 0.4.0.
|
||||
v0.4.0rc6:
|
||||
date: 2013-01-18
|
||||
changes:
|
||||
- Updating grunt/gruntplugin dependencies to rc6.
|
||||
- Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
|
||||
v0.4.0rc5:
|
||||
date: 2013-01-09
|
||||
changes:
|
||||
- Updating to work with grunt v0.4.0rc5.
|
||||
- Switching to this.filesSrc api.
|
||||
v0.4.0a:
|
||||
date: 2012-12-07
|
||||
changes:
|
||||
- Conversion to grunt v0.4 conventions.
|
||||
- Remove node v0.6 and grunt v0.3 support.
|
||||
- Add force option to bypass CWD check.
|
||||
v0.3.0:
|
||||
date: 2012-09-23
|
||||
changes:
|
||||
- Options no longer accepted from global config key.
|
||||
v0.2.0:
|
||||
date: 2012-09-10
|
||||
changes:
|
||||
- Refactored from grunt-contrib into individual repo.
|
||||
@ -1 +0,0 @@
|
||||
Please see the [Contributing to grunt](http://gruntjs.com/contributing) guide for information on contributing to this project.
|
||||
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* grunt-contrib-clean
|
||||
* http://gruntjs.com/
|
||||
*
|
||||
* Copyright (c) 2013 Tim Branyen, contributors
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
jshint: {
|
||||
all: [
|
||||
'Gruntfile.js',
|
||||
'tasks/*.js',
|
||||
'<%= nodeunit.tests %>'
|
||||
],
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
},
|
||||
},
|
||||
|
||||
// Configuration to be run (and then tested).
|
||||
clean: {
|
||||
short: ['tmp/sample_short'],
|
||||
long: {
|
||||
src: ['tmp/sample_long'],
|
||||
},
|
||||
},
|
||||
|
||||
// Unit tests.
|
||||
nodeunit: {
|
||||
tests: ['test/*_test.js'],
|
||||
},
|
||||
});
|
||||
|
||||
// Actually load this plugin's task(s).
|
||||
grunt.loadTasks('tasks');
|
||||
|
||||
// These plugins provide necessary tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-nodeunit');
|
||||
grunt.loadNpmTasks('grunt-contrib-internal');
|
||||
|
||||
// Setup a test helper to create some folders to clean.
|
||||
grunt.registerTask('copy', 'Copy fixtures to a temp location.', function() {
|
||||
grunt.file.copy('test/fixtures/sample_long/long.txt', 'tmp/sample_long/long.txt');
|
||||
grunt.file.copy('test/fixtures/sample_short/short.txt', 'tmp/sample_short/short.txt');
|
||||
});
|
||||
|
||||
// Whenever the 'test' task is run, first create some files to be cleaned,
|
||||
// then run this plugin's task(s), then test the result.
|
||||
grunt.registerTask('test', ['copy', 'clean', 'nodeunit']);
|
||||
|
||||
// By default, lint and run all tests.
|
||||
grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
|
||||
};
|
||||
@ -1,22 +0,0 @@
|
||||
Copyright (c) 2012 Tim Branyen, contributors
|
||||
|
||||
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.
|
||||
@ -1,28 +0,0 @@
|
||||
# Usage Examples
|
||||
|
||||
There are three formats you can use to run this task.
|
||||
|
||||
## Short
|
||||
|
||||
```js
|
||||
clean: ["path/to/dir/one", "path/to/dir/two"]
|
||||
```
|
||||
|
||||
## Medium (specific targets with global options)
|
||||
|
||||
```js
|
||||
clean: {
|
||||
build: ["path/to/dir/one", "path/to/dir/two"],
|
||||
release: ["path/to/another/dir/one", "path/to/another/dir/two"]
|
||||
},
|
||||
```
|
||||
|
||||
## Long (specific targets with per target options)
|
||||
|
||||
```js
|
||||
clean: {
|
||||
build: {
|
||||
src: ["path/to/dir/one", "path/to/dir/two"]
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -1,13 +0,0 @@
|
||||
# Options
|
||||
|
||||
## force
|
||||
Type: `Boolean`
|
||||
Default: false
|
||||
|
||||
This overrides this task from blocking deletion of folders outside current working dir (CWD). Use with caution.
|
||||
|
||||
## no-write
|
||||
Type: `Boolean`
|
||||
Default: false
|
||||
|
||||
Will log messages of what would happen if the task was ran but doesn't actually delete the files.
|
||||
@ -1,3 +0,0 @@
|
||||
Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
|
||||
|
||||
*Due to the destructive nature of this task, always be cautious of the paths you clean.*
|
||||
@ -1 +0,0 @@
|
||||
*This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-clean/tree/grunt-0.3-stable).*
|
||||
@ -1 +0,0 @@
|
||||
../rimraf/bin.js
|
||||
@ -1,6 +0,0 @@
|
||||
# Authors sorted by whether or not they're me.
|
||||
Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)
|
||||
Wayne Larsen <wayne@larsen.st> (http://github.com/wvl)
|
||||
ritch <skawful@gmail.com>
|
||||
Marcel Laverdet
|
||||
Yosef Dinerstein <yosefd@microsoft.com>
|
||||
@ -1,23 +0,0 @@
|
||||
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
|
||||
All rights reserved.
|
||||
|
||||
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.
|
||||
@ -1,30 +0,0 @@
|
||||
`rm -rf` for node.
|
||||
|
||||
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
|
||||
|
||||
## API
|
||||
|
||||
`rimraf(f, callback)`
|
||||
|
||||
The callback will be called with an error if there is one. Certain
|
||||
errors are handled for you:
|
||||
|
||||
* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
|
||||
`opts.maxBusyTries` times before giving up.
|
||||
* `ENOENT` - If the file doesn't exist, rimraf will return
|
||||
successfully, since your desired outcome is already the case.
|
||||
|
||||
## rimraf.sync
|
||||
|
||||
It can remove stuff synchronously, too. But that's not so good. Use
|
||||
the async API. It's better.
|
||||
|
||||
## CLI
|
||||
|
||||
If installed with `npm install rimraf -g` it can be used as a global
|
||||
command `rimraf <path>` which is useful for cross platform support.
|
||||
|
||||
## mkdirp
|
||||
|
||||
If you need to create a directory recursively, check out
|
||||
[mkdirp](https://github.com/substack/node-mkdirp).
|
||||
@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rimraf = require('./')
|
||||
|
||||
var help = false
|
||||
var dashdash = false
|
||||
var args = process.argv.slice(2).filter(function(arg) {
|
||||
if (dashdash)
|
||||
return !!arg
|
||||
else if (arg === '--')
|
||||
dashdash = true
|
||||
else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
|
||||
help = true
|
||||
else
|
||||
return !!arg
|
||||
});
|
||||
|
||||
if (help || args.length === 0) {
|
||||
// If they didn't ask for help, then this is not a "success"
|
||||
var log = help ? console.log : console.error
|
||||
log('Usage: rimraf <path>')
|
||||
log('')
|
||||
log(' Deletes all files and folders at "path" recursively.')
|
||||
log('')
|
||||
log('Options:')
|
||||
log('')
|
||||
log(' -h, --help Display this usage info')
|
||||
process.exit(help ? 0 : 1)
|
||||
} else {
|
||||
args.forEach(function(arg) {
|
||||
rimraf.sync(arg)
|
||||
})
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
{
|
||||
"name": "rimraf",
|
||||
"version": "2.2.8",
|
||||
"main": "rimraf.js",
|
||||
"description": "A deep deletion module for node (like `rm -rf`)",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/isaacs/rimraf/raw/master/LICENSE"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/rimraf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "cd test && bash run.sh"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "./bin.js"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me"
|
||||
},
|
||||
{
|
||||
"name": "Wayne Larsen",
|
||||
"email": "wayne@larsen.st",
|
||||
"url": "http://github.com/wvl"
|
||||
},
|
||||
{
|
||||
"name": "ritch",
|
||||
"email": "skawful@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marcel Laverdet"
|
||||
},
|
||||
{
|
||||
"name": "Yosef Dinerstein",
|
||||
"email": "yosefd@microsoft.com"
|
||||
}
|
||||
],
|
||||
"readme": "`rm -rf` for node.\n\nInstall with `npm install rimraf`, or just drop rimraf.js somewhere.\n\n## API\n\n`rimraf(f, callback)`\n\nThe callback will be called with an error if there is one. Certain\nerrors are handled for you:\n\n* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of\n `opts.maxBusyTries` times before giving up.\n* `ENOENT` - If the file doesn't exist, rimraf will return\n successfully, since your desired outcome is already the case.\n\n## rimraf.sync\n\nIt can remove stuff synchronously, too. But that's not so good. Use\nthe async API. It's better.\n\n## CLI\n\nIf installed with `npm install rimraf -g` it can be used as a global\ncommand `rimraf <path>` which is useful for cross platform support.\n\n## mkdirp\n\nIf you need to create a directory recursively, check out\n[mkdirp](https://github.com/substack/node-mkdirp).\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/rimraf/issues"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/rimraf",
|
||||
"_id": "rimraf@2.2.8",
|
||||
"_shasum": "e439be2aaee327321952730f99a8929e4fc50582",
|
||||
"_from": "rimraf@~2.2.1",
|
||||
"_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz"
|
||||
}
|
||||
@ -1,248 +0,0 @@
|
||||
module.exports = rimraf
|
||||
rimraf.sync = rimrafSync
|
||||
|
||||
var assert = require("assert")
|
||||
var path = require("path")
|
||||
var fs = require("fs")
|
||||
|
||||
// for EMFILE handling
|
||||
var timeout = 0
|
||||
exports.EMFILE_MAX = 1000
|
||||
exports.BUSYTRIES_MAX = 3
|
||||
|
||||
var isWindows = (process.platform === "win32")
|
||||
|
||||
function defaults (options) {
|
||||
var methods = [
|
||||
'unlink',
|
||||
'chmod',
|
||||
'stat',
|
||||
'rmdir',
|
||||
'readdir'
|
||||
]
|
||||
methods.forEach(function(m) {
|
||||
options[m] = options[m] || fs[m]
|
||||
m = m + 'Sync'
|
||||
options[m] = options[m] || fs[m]
|
||||
})
|
||||
}
|
||||
|
||||
function rimraf (p, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = {}
|
||||
}
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
defaults(options)
|
||||
|
||||
if (!cb) throw new Error("No callback passed to rimraf()")
|
||||
|
||||
var busyTries = 0
|
||||
rimraf_(p, options, function CB (er) {
|
||||
if (er) {
|
||||
if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") &&
|
||||
busyTries < exports.BUSYTRIES_MAX) {
|
||||
busyTries ++
|
||||
var time = busyTries * 100
|
||||
// try again, with the same exact callback as this one.
|
||||
return setTimeout(function () {
|
||||
rimraf_(p, options, CB)
|
||||
}, time)
|
||||
}
|
||||
|
||||
// this one won't happen if graceful-fs is used.
|
||||
if (er.code === "EMFILE" && timeout < exports.EMFILE_MAX) {
|
||||
return setTimeout(function () {
|
||||
rimraf_(p, options, CB)
|
||||
}, timeout ++)
|
||||
}
|
||||
|
||||
// already gone
|
||||
if (er.code === "ENOENT") er = null
|
||||
}
|
||||
|
||||
timeout = 0
|
||||
cb(er)
|
||||
})
|
||||
}
|
||||
|
||||
// Two possible strategies.
|
||||
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
|
||||
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
|
||||
//
|
||||
// Both result in an extra syscall when you guess wrong. However, there
|
||||
// are likely far more normal files in the world than directories. This
|
||||
// is based on the assumption that a the average number of files per
|
||||
// directory is >= 1.
|
||||
//
|
||||
// If anyone ever complains about this, then I guess the strategy could
|
||||
// be made configurable somehow. But until then, YAGNI.
|
||||
function rimraf_ (p, options, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
options.unlink(p, function (er) {
|
||||
if (er) {
|
||||
if (er.code === "ENOENT")
|
||||
return cb(null)
|
||||
if (er.code === "EPERM")
|
||||
return (isWindows)
|
||||
? fixWinEPERM(p, options, er, cb)
|
||||
: rmdir(p, options, er, cb)
|
||||
if (er.code === "EISDIR")
|
||||
return rmdir(p, options, er, cb)
|
||||
}
|
||||
return cb(er)
|
||||
})
|
||||
}
|
||||
|
||||
function fixWinEPERM (p, options, er, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
if (er)
|
||||
assert(er instanceof Error)
|
||||
|
||||
options.chmod(p, 666, function (er2) {
|
||||
if (er2)
|
||||
cb(er2.code === "ENOENT" ? null : er)
|
||||
else
|
||||
options.stat(p, function(er3, stats) {
|
||||
if (er3)
|
||||
cb(er3.code === "ENOENT" ? null : er)
|
||||
else if (stats.isDirectory())
|
||||
rmdir(p, options, er, cb)
|
||||
else
|
||||
options.unlink(p, cb)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function fixWinEPERMSync (p, options, er) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
if (er)
|
||||
assert(er instanceof Error)
|
||||
|
||||
try {
|
||||
options.chmodSync(p, 666)
|
||||
} catch (er2) {
|
||||
if (er2.code === "ENOENT")
|
||||
return
|
||||
else
|
||||
throw er
|
||||
}
|
||||
|
||||
try {
|
||||
var stats = options.statSync(p)
|
||||
} catch (er3) {
|
||||
if (er3.code === "ENOENT")
|
||||
return
|
||||
else
|
||||
throw er
|
||||
}
|
||||
|
||||
if (stats.isDirectory())
|
||||
rmdirSync(p, options, er)
|
||||
else
|
||||
options.unlinkSync(p)
|
||||
}
|
||||
|
||||
function rmdir (p, options, originalEr, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
if (originalEr)
|
||||
assert(originalEr instanceof Error)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
|
||||
// if we guessed wrong, and it's not a directory, then
|
||||
// raise the original error.
|
||||
options.rmdir(p, function (er) {
|
||||
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
|
||||
rmkids(p, options, cb)
|
||||
else if (er && er.code === "ENOTDIR")
|
||||
cb(originalEr)
|
||||
else
|
||||
cb(er)
|
||||
})
|
||||
}
|
||||
|
||||
function rmkids(p, options, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
options.readdir(p, function (er, files) {
|
||||
if (er)
|
||||
return cb(er)
|
||||
var n = files.length
|
||||
if (n === 0)
|
||||
return options.rmdir(p, cb)
|
||||
var errState
|
||||
files.forEach(function (f) {
|
||||
rimraf(path.join(p, f), options, function (er) {
|
||||
if (errState)
|
||||
return
|
||||
if (er)
|
||||
return cb(errState = er)
|
||||
if (--n === 0)
|
||||
options.rmdir(p, cb)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// this looks simpler, and is strictly *faster*, but will
|
||||
// tie up the JavaScript thread and fail on excessively
|
||||
// deep directory trees.
|
||||
function rimrafSync (p, options) {
|
||||
options = options || {}
|
||||
defaults(options)
|
||||
|
||||
assert(p)
|
||||
assert(options)
|
||||
|
||||
try {
|
||||
options.unlinkSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === "ENOENT")
|
||||
return
|
||||
if (er.code === "EPERM")
|
||||
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
|
||||
if (er.code !== "EISDIR")
|
||||
throw er
|
||||
rmdirSync(p, options, er)
|
||||
}
|
||||
}
|
||||
|
||||
function rmdirSync (p, options, originalEr) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
if (originalEr)
|
||||
assert(originalEr instanceof Error)
|
||||
|
||||
try {
|
||||
options.rmdirSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === "ENOENT")
|
||||
return
|
||||
if (er.code === "ENOTDIR")
|
||||
throw originalEr
|
||||
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
|
||||
rmkidsSync(p, options)
|
||||
}
|
||||
}
|
||||
|
||||
function rmkidsSync (p, options) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
options.readdirSync(p).forEach(function (f) {
|
||||
rimrafSync(path.join(p, f), options)
|
||||
})
|
||||
options.rmdirSync(p, options)
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
code=0
|
||||
for i in test-*.js; do
|
||||
echo -n $i ...
|
||||
bash setup.sh
|
||||
node $i
|
||||
if [ -d target ]; then
|
||||
echo "fail"
|
||||
code=1
|
||||
else
|
||||
echo "pass"
|
||||
fi
|
||||
done
|
||||
rm -rf target
|
||||
exit $code
|
||||
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
files=10
|
||||
folders=2
|
||||
depth=4
|
||||
target="$PWD/target"
|
||||
|
||||
rm -rf target
|
||||
|
||||
fill () {
|
||||
local depth=$1
|
||||
local files=$2
|
||||
local folders=$3
|
||||
local target=$4
|
||||
|
||||
if ! [ -d $target ]; then
|
||||
mkdir -p $target
|
||||
fi
|
||||
|
||||
local f
|
||||
|
||||
f=$files
|
||||
while [ $f -gt 0 ]; do
|
||||
touch "$target/f-$depth-$f"
|
||||
let f--
|
||||
done
|
||||
|
||||
let depth--
|
||||
|
||||
if [ $depth -le 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
f=$folders
|
||||
while [ $f -gt 0 ]; do
|
||||
mkdir "$target/folder-$depth-$f"
|
||||
fill $depth $files $folders "$target/d-$depth-$f"
|
||||
let f--
|
||||
done
|
||||
}
|
||||
|
||||
fill $depth $files $folders $target
|
||||
|
||||
# sanity assert
|
||||
[ -d $target ]
|
||||
@ -1,5 +0,0 @@
|
||||
var rimraf = require("../rimraf")
|
||||
, path = require("path")
|
||||
rimraf(path.join(__dirname, "target"), function (er) {
|
||||
if (er) throw er
|
||||
})
|
||||
@ -1,3 +0,0 @@
|
||||
var rimraf = require("../rimraf")
|
||||
, path = require("path")
|
||||
rimraf.sync(path.join(__dirname, "target"))
|
||||
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* grunt-contrib-clean
|
||||
* http://gruntjs.com/
|
||||
*
|
||||
* Copyright (c) 2013 Tim Branyen, contributors
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var rimraf = require('rimraf');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
function clean(filepath, options) {
|
||||
if (!grunt.file.exists(filepath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
grunt.log.write((options['no-write'] ? 'Not actually cleaning ' : 'Cleaning ') + filepath + '...');
|
||||
|
||||
// Only delete cwd or outside cwd if --force enabled. Be careful, people!
|
||||
if (!options.force) {
|
||||
if (grunt.file.isPathCwd(filepath)) {
|
||||
grunt.verbose.error();
|
||||
grunt.fail.warn('Cannot delete the current working directory.');
|
||||
return false;
|
||||
} else if (!grunt.file.isPathInCwd(filepath)) {
|
||||
grunt.verbose.error();
|
||||
grunt.fail.warn('Cannot delete files outside the current working directory.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Actually delete. Or not.
|
||||
if (!options['no-write']) {
|
||||
rimraf.sync(filepath);
|
||||
}
|
||||
grunt.log.ok();
|
||||
} catch (e) {
|
||||
grunt.log.error();
|
||||
grunt.fail.warn('Unable to delete "' + filepath + '" file (' + e.message + ').', e);
|
||||
}
|
||||
}
|
||||
|
||||
grunt.registerMultiTask('clean', 'Clean files and folders.', function() {
|
||||
// Merge task-specific and/or target-specific options with these defaults.
|
||||
var options = this.options({
|
||||
force: grunt.option('force') === true,
|
||||
'no-write': grunt.option('no-write') === true,
|
||||
});
|
||||
|
||||
grunt.verbose.writeflags(options, 'Options');
|
||||
|
||||
// Clean specified files / dirs.
|
||||
this.filesSrc.forEach(function(filepath) {
|
||||
clean(filepath, options);
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
@ -1,22 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var grunt = require('grunt');
|
||||
|
||||
exports.clean = {
|
||||
short: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.exists('tmp/sample_short');
|
||||
test.equal(expected, false, 'should remove the short directory using clean');
|
||||
|
||||
test.done();
|
||||
},
|
||||
long: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.exists('tmp/sample_long');
|
||||
test.equal(expected, false, 'should remove the long directory using clean');
|
||||
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
@ -1 +0,0 @@
|
||||
txt
|
||||
@ -1 +0,0 @@
|
||||
txt
|
||||
@ -1,22 +0,0 @@
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman, contributors
|
||||
|
||||
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.
|
||||
@ -1,3 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
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.
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
||||
{
|
||||
"name": "async",
|
||||
"repo": "caolan/async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.1.23",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/async.js",
|
||||
"scripts": [ "lib/async.js" ]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,5 +0,0 @@
|
||||
examples/
|
||||
docs/
|
||||
src/
|
||||
test/
|
||||
spec/
|
||||
15
node_modules/grunt-contrib-connect/node_modules/connect-livereload/.travis.yml
generated
vendored
15
node_modules/grunt-contrib-connect/node_modules/connect-livereload/.travis.yml
generated
vendored
@ -1,15 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.9"
|
||||
|
||||
before_script:
|
||||
- "npm install"
|
||||
|
||||
script:
|
||||
- "node_modules/mocha/bin/mocha"
|
||||
|
||||
notifications:
|
||||
email: andi.neck@intesso.com
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2013 intesso
|
||||
|
||||
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.
|
||||
@ -1,142 +0,0 @@
|
||||
connect-livereload
|
||||
==================
|
||||
connect middleware for adding the livereload script to the response.
|
||||
no browser plugin is needed.
|
||||
if you are happy with a browser plugin, then you don't need this middleware.
|
||||
|
||||
[](https://travis-ci.org/intesso/connect-livereload)
|
||||
[](http://badge.fury.io/js/connect-livereload)
|
||||
install
|
||||
=======
|
||||
```bash
|
||||
npm install connect-livereload --save-dev
|
||||
```
|
||||
|
||||
use
|
||||
===
|
||||
note: if you use this middleware, you should make sure to switch off the Browser LiveReload Extension if you have it installed.
|
||||
|
||||
this middleware can be used with a LiveReload server e.g. [grunt-reload](https://github.com/webxl/grunt-reload) or [grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch).
|
||||
|
||||
`connect-livereload` itself does not serve the `livereload.js` script.
|
||||
|
||||
In your connect or express application add this after the static and before the dynamic routes.
|
||||
If you need liveReload on static html files, then place it before the static routes.
|
||||
`ignore` gives you the possibility to ignore certain files or url's from being handled by `connect-livereload`.
|
||||
|
||||
## connect/express example
|
||||
```javascript
|
||||
app.use(require('connect-livereload')({
|
||||
port: 35729
|
||||
}));
|
||||
```
|
||||
|
||||
please see the [examples](https://github.com/intesso/connect-livereload/tree/master/examples) for the app and Grunt configuration.
|
||||
|
||||
## options
|
||||
Options are not mandatory: `app.use(require('connect-livereload')());`
|
||||
The Options have to be provided when the middleware is loaded:
|
||||
|
||||
e.g.:
|
||||
```
|
||||
app.use(require('connect-livereload')({
|
||||
port: 35729,
|
||||
ignore: ['.js', '.svg']
|
||||
}));
|
||||
|
||||
```
|
||||
|
||||
These are the available options with the following defaults:
|
||||
|
||||
```javascript
|
||||
// `ignore` and `include`: array with strings and regex expressions elements.
|
||||
// strings: included/ignored when the url contains this string
|
||||
// regex: any expression: e.g. starts with pattern: /^.../ ends with pattern: /...$/
|
||||
ignore: [/\.js$/, /\.css$/, /\.svg$/, /\.ico$/, /\.woff$/, /\.png$/, /\.jpg$/, /\.jpeg$/],
|
||||
|
||||
// include all urls by default
|
||||
include: [/.*/],
|
||||
|
||||
// this function is used to determine if the content of `res.write` or `res.end` is html.
|
||||
html: function (str) {
|
||||
return /<[:_-\w\s\!\/\=\"\']+>/i.test(str);
|
||||
},
|
||||
|
||||
// rules are provided to find the place where the snippet should be inserted.
|
||||
// the main problem is that on the server side it can be tricky to determine if a string will be valid html on the client.
|
||||
// the function `fn` of the first `match` is executed like this `body.replace(rule.match, rule.fn);`
|
||||
// the function `fn` has got the arguments `fn(w, s)` where `w` is the matches string and `s` is the snippet.
|
||||
rules: [{
|
||||
match: /<\/body>(?![\s\S]*<\/body>)/,
|
||||
fn: prepend
|
||||
}, {
|
||||
match: /<\/html>(?![\s\S]*<\/html>)/,
|
||||
fn: prepend
|
||||
}, {
|
||||
match: /<\!DOCTYPE.+>/,
|
||||
fn: append
|
||||
}],
|
||||
|
||||
// port where the script is loaded
|
||||
port: 35729,
|
||||
|
||||
// location where the script is provided (not by connect-livereload). Change this e.g. when serving livereload with a proxy.
|
||||
src: "http://localhost:35729/livereload.js?snipver=1",
|
||||
```
|
||||
|
||||
please see the [examples](https://github.com/intesso/connect-livereload/tree/master/examples) for the app and Grunt configuration.
|
||||
|
||||
|
||||
## grunt example
|
||||
|
||||
The following example is from an actual Gruntfile that uses [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect)
|
||||
|
||||
```javascript
|
||||
connect: {
|
||||
options: {
|
||||
port: 3000,
|
||||
hostname: 'localhost'
|
||||
},
|
||||
dev: {
|
||||
options: {
|
||||
middleware: function (connect) {
|
||||
return [
|
||||
require('connect-livereload')(), // <--- here
|
||||
checkForDownload,
|
||||
mountFolder(connect, '.tmp'),
|
||||
mountFolder(connect, 'app')
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
For use as middleware in grunt simply add the following to the **top** of your array of middleware.
|
||||
|
||||
```javascript
|
||||
require('connect-livereload')(),
|
||||
```
|
||||
You can pass in options to this call if you do not want the defaults.
|
||||
|
||||
`dev` is simply the name of the server being used with the task `grunt connect:dev`. The other items in the `middleware` array are all functions that either are of the form `function (req, res, next)` like `checkForDownload` or return that like `mountFolder(connect, 'something')`.
|
||||
|
||||
alternative
|
||||
===========
|
||||
An alternative would be to install the [LiveReload browser plugin](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei).
|
||||
|
||||
|
||||
credits
|
||||
=======
|
||||
* The initial middleware code was mainly extracted from: [grunt-contrib-livereload/util.js](https://github.com/gruntjs/grunt-contrib-livereload/blob/master/lib/utils.js)
|
||||
* [LiveReload Creator](http://livereload.com/)
|
||||
|
||||
tests
|
||||
=====
|
||||
run the tests with
|
||||
```
|
||||
mocha
|
||||
```
|
||||
|
||||
license
|
||||
=======
|
||||
[MIT License](https://github.com/intesso/connect-livereload/blob/master/LICENSE)
|
||||
@ -1,147 +0,0 @@
|
||||
module.exports = function livereload(opt) {
|
||||
// options
|
||||
var opt = opt || {};
|
||||
var ignore = opt.ignore || opt.excludeList || [/\.js$/, /\.css$/, /\.svg$/, /\.ico$/, /\.woff$/, /\.png$/, /\.jpg$/, /\.jpeg$/];
|
||||
var include = opt.include || [/.*/];
|
||||
var html = opt.html || _html;
|
||||
var rules = opt.rules || [{
|
||||
match: /<\/body>(?![\s\S]*<\/body>)/,
|
||||
fn: prepend
|
||||
}, {
|
||||
match: /<\/html>(?![\s\S]*<\/html>)/,
|
||||
fn: prepend
|
||||
}, {
|
||||
match: /<\!DOCTYPE.+>/,
|
||||
fn: append
|
||||
}];
|
||||
var port = opt.port || 35729;
|
||||
var src = opt.src || "' + (location.protocol || 'http:') + '//' + (location.hostname || 'localhost') + ':" + port + "/livereload.js?snipver=1";
|
||||
var snippet = "\n<script type=\"text/javascript\">//<![CDATA[\ndocument.write('<script src=\"" + src + "\" type=\"text/javascript\"><\\/script>')\n//]]></script>\n";
|
||||
|
||||
// helper functions
|
||||
var regex = (function() {
|
||||
var matches = rules.map(function(item) {
|
||||
return item.match.source;
|
||||
}).join('|');
|
||||
|
||||
return new RegExp(matches);
|
||||
})();
|
||||
|
||||
function prepend(w, s) {
|
||||
return s + w;
|
||||
}
|
||||
|
||||
function append(w, s) {
|
||||
return w + s;
|
||||
}
|
||||
|
||||
function _html(str) {
|
||||
if (!str) return false;
|
||||
return /<[:_-\w\s\!\/\=\"\']+>/i.test(str);
|
||||
}
|
||||
|
||||
function exists(body) {
|
||||
if (!body) return false;
|
||||
return regex.test(body);
|
||||
}
|
||||
|
||||
function snip(body) {
|
||||
if (!body) return false;
|
||||
return (~body.lastIndexOf("/livereload.js"));
|
||||
}
|
||||
|
||||
function snap(body) {
|
||||
var _body = body;
|
||||
rules.some(function(rule) {
|
||||
if (rule.match.test(body)) {
|
||||
_body = body.replace(rule.match, function(w) {
|
||||
return rule.fn(w, snippet);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return _body;
|
||||
}
|
||||
|
||||
function accept(req) {
|
||||
var ha = req.headers["accept"];
|
||||
if (!ha) return false;
|
||||
return (~ha.indexOf("html"));
|
||||
}
|
||||
|
||||
function check(str, arr) {
|
||||
if (!str) return true;
|
||||
return arr.some(function(item) {
|
||||
if ( (item.test && item.test(str) ) || ~str.indexOf(item)) return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// middleware
|
||||
return function livereload(req, res, next) {
|
||||
if (res._livereload) return next();
|
||||
res._livereload = true;
|
||||
|
||||
var writeHead = res.writeHead;
|
||||
var write = res.write;
|
||||
var end = res.end;
|
||||
|
||||
if (!accept(req) || !check(req.url, include) || check(req.url, ignore)) {
|
||||
return next();
|
||||
}
|
||||
|
||||
function restore() {
|
||||
res.writeHead = writeHead;
|
||||
res.write = write;
|
||||
res.end = end;
|
||||
}
|
||||
|
||||
res.push = function(chunk) {
|
||||
res.data = (res.data || '') + chunk;
|
||||
};
|
||||
|
||||
res.inject = res.write = function(string, encoding) {
|
||||
if (string !== undefined) {
|
||||
var body = string instanceof Buffer ? string.toString(encoding) : string;
|
||||
if (exists(body) && !snip(res.data)) {
|
||||
res.push(snap(body));
|
||||
return true;
|
||||
} else if (html(body) || html(res.data)) {
|
||||
res.push(body);
|
||||
return true;
|
||||
} else {
|
||||
restore();
|
||||
return write.call(res, string, encoding);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
res.writeHead = function() {
|
||||
var headers = arguments[arguments.length - 1];
|
||||
if (headers && typeof headers === 'object') {
|
||||
for (var name in headers) {
|
||||
if (/content-length/i.test(name)) {
|
||||
delete headers[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var header = res.getHeader( 'content-length' );
|
||||
if ( header ) res.removeHeader( 'content-length' );
|
||||
|
||||
writeHead.apply(res, arguments);
|
||||
};
|
||||
|
||||
res.end = function(string, encoding) {
|
||||
restore();
|
||||
var result = res.inject(string, encoding);
|
||||
if (!result) return end.call(res, string, encoding);
|
||||
if (res.data !== undefined && !res._header) res.setHeader('content-length', Buffer.byteLength(res.data, encoding));
|
||||
res.end(res.data, encoding);
|
||||
};
|
||||
next();
|
||||
};
|
||||
|
||||
}
|
||||
44
node_modules/grunt-contrib-connect/node_modules/connect-livereload/package.json
generated
vendored
44
node_modules/grunt-contrib-connect/node_modules/connect-livereload/package.json
generated
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +0,0 @@
|
||||
coverage/
|
||||
docs/
|
||||
test/
|
||||
.travis.yml
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2010 Sencha Inc.
|
||||
Copyright (c) 2011 LearnBoost
|
||||
Copyright (c) 2011 TJ Holowaychuk
|
||||
|
||||
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.
|
||||
@ -1,88 +0,0 @@
|
||||
# Connect
|
||||
|
||||
[](http://badge.fury.io/js/connect)
|
||||
[](https://travis-ci.org/senchalabs/connect)
|
||||
[](https://coveralls.io/r/senchalabs/connect)
|
||||
|
||||
Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_.
|
||||
|
||||
Connect is bundled with over _20_ commonly used middleware, including
|
||||
a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://www.senchalabs.org/connect/).
|
||||
|
||||
```js
|
||||
var connect = require('connect')
|
||||
, http = require('http');
|
||||
|
||||
var app = connect()
|
||||
.use(connect.favicon('public/favicon.ico'))
|
||||
.use(connect.logger('dev'))
|
||||
.use(connect.static('public'))
|
||||
.use(connect.directory('public'))
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'my secret here' }))
|
||||
.use(function(req, res){
|
||||
res.end('Hello from Connect!\n');
|
||||
});
|
||||
|
||||
http.createServer(app).listen(3000);
|
||||
```
|
||||
|
||||
## Middleware
|
||||
|
||||
- [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)
|
||||
- [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)
|
||||
- [compress](http://www.senchalabs.org/connect/compress.html)
|
||||
- [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)
|
||||
- [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)
|
||||
- [csrf](http://www.senchalabs.org/connect/csrf.html)
|
||||
- [directory](http://www.senchalabs.org/connect/directory.html)
|
||||
- [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)
|
||||
- [favicon](http://www.senchalabs.org/connect/favicon.html)
|
||||
- [json](http://www.senchalabs.org/connect/json.html)
|
||||
- [limit](http://www.senchalabs.org/connect/limit.html)
|
||||
- [logger](http://www.senchalabs.org/connect/logger.html)
|
||||
- [methodOverride](http://www.senchalabs.org/connect/methodOverride.html)
|
||||
- [multipart](http://www.senchalabs.org/connect/multipart.html)
|
||||
- [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)
|
||||
- [query](http://www.senchalabs.org/connect/query.html)
|
||||
- [responseTime](http://www.senchalabs.org/connect/responseTime.html)
|
||||
- [session](http://www.senchalabs.org/connect/session.html)
|
||||
- [static](http://www.senchalabs.org/connect/static.html)
|
||||
- [staticCache](http://www.senchalabs.org/connect/staticCache.html)
|
||||
- [subdomains](http://www.senchalabs.org/connect/subdomains.html)
|
||||
- [vhost](http://www.senchalabs.org/connect/vhost.html)
|
||||
|
||||
## Running Tests
|
||||
|
||||
first:
|
||||
|
||||
$ npm install -d
|
||||
|
||||
then:
|
||||
|
||||
$ npm test
|
||||
|
||||
## Contributors
|
||||
|
||||
https://github.com/senchalabs/connect/graphs/contributors
|
||||
|
||||
## Node Compatibility
|
||||
|
||||
Connect `< 1.x` is compatible with node 0.2.x
|
||||
|
||||
|
||||
Connect `1.x` is compatible with node 0.4.x
|
||||
|
||||
|
||||
Connect `2.x` is compatible with node 0.6.x
|
||||
|
||||
|
||||
Connect (_master_) is compatible with node 0.8.x
|
||||
|
||||
## CLA
|
||||
|
||||
[http://sencha.com/cla](http://sencha.com/cla)
|
||||
|
||||
## License
|
||||
|
||||
View the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file.
|
||||
@ -1,35 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
function auth(user, pass) {
|
||||
return 'tj' == user && 'tobi' == pass;
|
||||
}
|
||||
|
||||
function authorized(req, res) {
|
||||
res.end('authorized!');
|
||||
}
|
||||
|
||||
function hello(req, res) {
|
||||
res.end('hello! try /admin');
|
||||
}
|
||||
|
||||
// apply globally
|
||||
|
||||
connect(
|
||||
connect.basicAuth(auth)
|
||||
, authorized
|
||||
).listen(3000);
|
||||
|
||||
// apply to /admin/* only
|
||||
|
||||
var server = connect();
|
||||
|
||||
server.use('/admin', connect.basicAuth(auth));
|
||||
server.use('/admin', authorized);
|
||||
server.use(hello);
|
||||
|
||||
server.listen(3001);
|
||||
40
node_modules/grunt-contrib-connect/node_modules/connect/examples/bodyParser.js
generated
vendored
40
node_modules/grunt-contrib-connect/node_modules/connect/examples/bodyParser.js
generated
vendored
@ -1,40 +0,0 @@
|
||||
|
||||
var connect = require('../')
|
||||
, http = require('http');
|
||||
|
||||
// visit form.html
|
||||
|
||||
var app = connect()
|
||||
.use(connect.static(__dirname + '/public'))
|
||||
.use(connect.bodyParser())
|
||||
.use(form)
|
||||
.use(upload);
|
||||
|
||||
function form(req, res, next){
|
||||
if ('GET' != req.method) return next();
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', 'form.html');
|
||||
res.end();
|
||||
}
|
||||
|
||||
function upload(req, res){
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.write('<p>thanks ' + req.body.name + '</p>');
|
||||
res.write('<ul>');
|
||||
|
||||
if (Array.isArray(req.files.images)) {
|
||||
req.files.images.forEach(function(image){
|
||||
var kb = image.size / 1024 | 0;
|
||||
res.write('<li>uploaded ' + image.name + ' ' + kb + 'kb</li>');
|
||||
});
|
||||
} else {
|
||||
var image = req.files.images;
|
||||
var kb = image.size / 1024 | 0;
|
||||
res.write('<li>uploaded ' + image.name + ' ' + kb + 'kb</li>');
|
||||
}
|
||||
|
||||
res.end('</ul>');
|
||||
}
|
||||
|
||||
http.Server(app).listen(3000);
|
||||
console.log('Server started on port 3000');
|
||||
41
node_modules/grunt-contrib-connect/node_modules/connect/examples/cookieSession.js
generated
vendored
41
node_modules/grunt-contrib-connect/node_modules/connect/examples/cookieSession.js
generated
vendored
@ -1,41 +0,0 @@
|
||||
|
||||
var connect = require('../')
|
||||
, http = require('http');
|
||||
|
||||
var app = connect()
|
||||
.use(connect.logger('dev'))
|
||||
.use(connect.bodyParser())
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.cookieSession({ secret: 'some secret' }))
|
||||
.use(post)
|
||||
.use(clear)
|
||||
.use(counter);
|
||||
|
||||
function clear(req, res, next) {
|
||||
if ('/clear' != req.url) return next();
|
||||
req.session = null;
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', '/');
|
||||
res.end();
|
||||
}
|
||||
|
||||
function post(req, res, next) {
|
||||
if ('POST' != req.method) return next();
|
||||
req.session.name = req.body.name;
|
||||
next();
|
||||
}
|
||||
|
||||
function counter(req, res) {
|
||||
req.session.count = req.session.count || 0;
|
||||
var n = req.session.count++;
|
||||
var name = req.session.name || 'Enter your name';
|
||||
res.end('<p>hits: ' + n + '</p>'
|
||||
+ '<form method="post">'
|
||||
+ '<p><input type="text" name="name" value="' + name + '" />'
|
||||
+ '<input type="submit" value="Save" /></p>'
|
||||
+ '</form>'
|
||||
+ '<p><a href="/clear">clear session</a></p>');
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000);
|
||||
console.log('Server listening on port 3000');
|
||||
@ -1,36 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../')
|
||||
, http = require('http');
|
||||
|
||||
var form = '\n\
|
||||
<form action="/" method="post">\n\
|
||||
<input type="hidden" name="_csrf" value="{token}" />\n\
|
||||
<input type="text" name="user[name]" value="{user}" placeholder="Username" />\n\
|
||||
<input type="submit" value="Login" />\n\
|
||||
</form>\n\
|
||||
';
|
||||
|
||||
var app = connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'keyboard cat' }))
|
||||
.use(connect.bodyParser())
|
||||
.use(connect.csrf())
|
||||
.use(function(req, res, next){
|
||||
if ('POST' != req.method) return next();
|
||||
req.session.user = req.body.user;
|
||||
next();
|
||||
})
|
||||
.use(function(req, res){
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
var body = form
|
||||
.replace('{token}', req.csrfToken())
|
||||
.replace('{user}', req.session.user && req.session.user.name || '');
|
||||
res.end(body);
|
||||
});
|
||||
|
||||
http.createServer(app).listen(3000);
|
||||
console.log('Server listening on port 3000');
|
||||
@ -1,12 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
var app = connect();
|
||||
var path = __dirname + '/../';
|
||||
|
||||
app.use(connect.directory(path, { icons: true }))
|
||||
app.use(connect.static(path))
|
||||
app.listen(3000);
|
||||
@ -1,19 +0,0 @@
|
||||
|
||||
var connect = require('../')
|
||||
, http = require('http');
|
||||
|
||||
// try:
|
||||
// - viewing in a browser
|
||||
// - curl http://localhost:3000
|
||||
// - curl -H "Accept: application/json" http://localhost:3000
|
||||
|
||||
var app = connect()
|
||||
.use(function(req, res, next){
|
||||
var err = new Error('oh noes!');
|
||||
err.number = 7;
|
||||
throw err;
|
||||
})
|
||||
.use(connect.errorHandler());
|
||||
|
||||
http.Server(app).listen(3000);
|
||||
console.log('Server started on port 3000');
|
||||
@ -1,12 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
// $ curl -i http://localhost:3000/favicon.ico
|
||||
|
||||
connect.createServer(
|
||||
connect.favicon()
|
||||
).listen(3000);
|
||||
12
node_modules/grunt-contrib-connect/node_modules/connect/examples/helloworld.js
generated
vendored
12
node_modules/grunt-contrib-connect/node_modules/connect/examples/helloworld.js
generated
vendored
@ -1,12 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
connect.createServer(function(req, res){
|
||||
var body = 'Hello World';
|
||||
res.setHeader('Content-Length', body.length);
|
||||
res.end(body);
|
||||
}).listen(3000);
|
||||
@ -1,41 +0,0 @@
|
||||
|
||||
var connect = require('../')
|
||||
, http = require('http');
|
||||
|
||||
// visit form.html
|
||||
|
||||
var app = connect()
|
||||
.use(connect.static(__dirname + '/public'))
|
||||
.use(connect.limit('5mb'))
|
||||
.use(connect.bodyParser())
|
||||
.use(form)
|
||||
.use(upload);
|
||||
|
||||
function form(req, res, next){
|
||||
if ('GET' != req.method) return next();
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', 'form.html');
|
||||
res.end();
|
||||
}
|
||||
|
||||
function upload(req, res){
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.write('<p>thanks ' + req.body.name + '</p>');
|
||||
res.write('<ul>');
|
||||
|
||||
if (Array.isArray(req.files.images)) {
|
||||
req.files.images.forEach(function(image){
|
||||
var kb = image.size / 1024 | 0;
|
||||
res.write('<li>uploaded ' + image.name + ' ' + kb + 'kb</li>');
|
||||
});
|
||||
} else {
|
||||
var image = req.files.images;
|
||||
var kb = image.size / 1024 | 0;
|
||||
res.write('<li>uploaded ' + image.name + ' ' + kb + 'kb</li>');
|
||||
}
|
||||
|
||||
res.end('</ul>');
|
||||
}
|
||||
|
||||
http.Server(app).listen(3000);
|
||||
console.log('Server started on port 3000');
|
||||
14
node_modules/grunt-contrib-connect/node_modules/connect/examples/logger.fast.js
generated
vendored
14
node_modules/grunt-contrib-connect/node_modules/connect/examples/logger.fast.js
generated
vendored
@ -1,14 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
// $ curl -i http://localhost:3000/favicon.ico
|
||||
// true defaults to 1000ms
|
||||
|
||||
connect.createServer(
|
||||
connect.logger({ buffer: 5000 })
|
||||
, connect.favicon()
|
||||
).listen(3000);
|
||||
62
node_modules/grunt-contrib-connect/node_modules/connect/examples/logger.format.js
generated
vendored
62
node_modules/grunt-contrib-connect/node_modules/connect/examples/logger.format.js
generated
vendored
@ -1,62 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
// $ curl http://localhost:3000/
|
||||
|
||||
// custom format string
|
||||
|
||||
connect.createServer(
|
||||
connect.logger(':method :url - :res[content-type]')
|
||||
, function(req, res){
|
||||
res.statusCode = 500;
|
||||
res.setHeader('Content-Type', 'text/plain');
|
||||
res.end('Internal Server Error');
|
||||
}
|
||||
).listen(3000);
|
||||
|
||||
// $ curl http://localhost:3001/
|
||||
// $ curl http://localhost:3001/302
|
||||
// $ curl http://localhost:3001/404
|
||||
// $ curl http://localhost:3001/500
|
||||
|
||||
connect()
|
||||
.use(connect.logger('dev'))
|
||||
.use('/connect', connect.static(__dirname + '/lib'))
|
||||
.use('/connect', connect.directory(__dirname + '/lib'))
|
||||
.use(function(req, res, next){
|
||||
switch (req.url) {
|
||||
case '/500':
|
||||
var body = 'Internal Server Error';
|
||||
res.statusCode = 500;
|
||||
res.setHeader('Content-Length', body.length);
|
||||
res.end(body);
|
||||
break;
|
||||
case '/404':
|
||||
var body = 'Not Found';
|
||||
res.statusCode = 404;
|
||||
res.setHeader('Content-Length', body.length);
|
||||
res.end(body);
|
||||
break;
|
||||
case '/302':
|
||||
var body = 'Found';
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Content-Length', body.length);
|
||||
res.end(body);
|
||||
break;
|
||||
default:
|
||||
var body = 'OK';
|
||||
res.setHeader('Content-Length', body.length);
|
||||
res.end(body);
|
||||
}
|
||||
})
|
||||
.listen(3001);
|
||||
|
||||
// pre-defined
|
||||
|
||||
connect()
|
||||
.use(connect.logger('short'))
|
||||
.listen(3002);
|
||||
@ -1,14 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
// $ curl http://localhost:3000/favicon.ico
|
||||
|
||||
connect.createServer(
|
||||
connect.logger()
|
||||
, connect.favicon()
|
||||
).listen(3000);
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
var blog = connect(
|
||||
connect.router(function(app){
|
||||
app.get('/', function(req, res){
|
||||
res.end('list blog posts. try /post/0');
|
||||
});
|
||||
|
||||
app.get('/post/:id', function(req, res){
|
||||
res.end('got post ' + req.params.id);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
var admin = connect(
|
||||
connect.basicAuth(function(user, pass){ return 'tj' == user && 'tobi' == pass })
|
||||
, function(req, res){
|
||||
res.end('admin stuff');
|
||||
}
|
||||
);
|
||||
|
||||
connect()
|
||||
.use('/admin', admin)
|
||||
.use('/blog', blog)
|
||||
.use(function(req, res){
|
||||
res.end('try /blog, /admin, or /blog/post/0');
|
||||
})
|
||||
.listen(3000);
|
||||
@ -1,17 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
// $ curl -i http://localhost:3000/
|
||||
|
||||
connect(
|
||||
connect.profiler()
|
||||
, connect.favicon()
|
||||
, connect.static(__dirname)
|
||||
, function(req, res, next){
|
||||
res.end('hello world');
|
||||
}
|
||||
).listen(3000);
|
||||
5
node_modules/grunt-contrib-connect/node_modules/connect/examples/public/form.html
generated
vendored
5
node_modules/grunt-contrib-connect/node_modules/connect/examples/public/form.html
generated
vendored
@ -1,5 +0,0 @@
|
||||
<form action="/" method="post" enctype="multipart/form-data">
|
||||
<input type="text" name="name" placeholder="Name:" />
|
||||
<input type="file" name="images" multiple="multiple" />
|
||||
<input type="submit" value="Upload" />
|
||||
</form>
|
||||
BIN
node_modules/grunt-contrib-connect/node_modules/connect/examples/public/tobi.jpeg
generated
vendored
BIN
node_modules/grunt-contrib-connect/node_modules/connect/examples/public/tobi.jpeg
generated
vendored
|
Before Width: | Height: | Size: 36 KiB |
64
node_modules/grunt-contrib-connect/node_modules/connect/examples/rollingSession.js
generated
vendored
64
node_modules/grunt-contrib-connect/node_modules/connect/examples/rollingSession.js
generated
vendored
@ -1,64 +0,0 @@
|
||||
|
||||
var connect = require('../')
|
||||
var http = require('http');
|
||||
|
||||
var hour = 60 * 60 * 1000;
|
||||
|
||||
// maxAge session without the rolling option
|
||||
// it doesn't update the maxAge value
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret : 'keyboard cat',
|
||||
key : 'NoRolling.sid',
|
||||
cookie : { maxAge: hour }}))
|
||||
.use(connect.favicon())
|
||||
.use(clear)
|
||||
.use(change)
|
||||
.use(counter)
|
||||
).listen(3000);
|
||||
console.log('port 3000: without rolling, session CANNOT be changed to browser session');
|
||||
|
||||
// maxAge session with the rolling option
|
||||
// it always updates the maxAge value
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret : 'keyboard cat',
|
||||
key : 'Rolling.sid',
|
||||
cookie : { maxAge: hour },
|
||||
rolling : true}))
|
||||
.use(connect.favicon())
|
||||
.use(clear)
|
||||
.use(change)
|
||||
.use(counter)
|
||||
).listen(3001);
|
||||
console.log('port 3001: with rolling, session CAN be changed to browser session');
|
||||
|
||||
function clear(req, res, next) {
|
||||
if ('/clear' != req.url) return next();
|
||||
req.session.regenerate(function(err){});
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', '/');
|
||||
res.end();
|
||||
}
|
||||
function change(req, res, next) {
|
||||
if ('/change' != req.url) return next();
|
||||
req.session.cookie.maxAge = req.session.cookie.maxAge ? null : hour;
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', '/');
|
||||
res.end();
|
||||
}
|
||||
function counter(req, res) {
|
||||
req.session.count = req.session.count || 0;
|
||||
var n = req.session.count++;
|
||||
var expiration = req.session.cookie.maxAge
|
||||
? req.session.cookie.maxAge + "msec"
|
||||
: "browser session";
|
||||
res.end('<p>Expiration: ' + expiration + '</p>'
|
||||
+ '<p>Hits: ' + n + '</p>'
|
||||
+ '<p><a href="/clear">clear session</a></p>'
|
||||
+ (req.session.cookie.maxAge
|
||||
? '<p><a href="/change">Change to Browser Session</a></p>'
|
||||
: '<p><a href="/change">Change to maxAge Session</a></p>'));
|
||||
}
|
||||
@ -1,198 +0,0 @@
|
||||
|
||||
var connect = require('../')
|
||||
, http = require('http');
|
||||
|
||||
var year = 31557600000;
|
||||
|
||||
// large max-age, delegate expiry to the session store.
|
||||
// for example with connect-redis's .ttl option.
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: year }}))
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
var sess = req.session;
|
||||
if (sess.views) {
|
||||
sess.views++;
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.write('<p>views: ' + sess.views + '</p>');
|
||||
res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
|
||||
res.end();
|
||||
} else {
|
||||
sess.views = 1;
|
||||
res.end('welcome to the session demo. refresh!');
|
||||
}
|
||||
})).listen(3007);
|
||||
|
||||
console.log('port 3007: 1 minute expiration demo');
|
||||
|
||||
|
||||
// expire sessions within a minute
|
||||
// /favicon.ico is ignored, and will not
|
||||
// receive req.session
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
var sess = req.session;
|
||||
if (sess.views) {
|
||||
sess.views++;
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.write('<p>views: ' + sess.views + '</p>');
|
||||
res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
|
||||
res.end();
|
||||
} else {
|
||||
sess.views = 1;
|
||||
res.end('welcome to the session demo. refresh!');
|
||||
}
|
||||
})).listen(3006);
|
||||
|
||||
console.log('port 3006: 1 minute expiration demo');
|
||||
|
||||
// $ npm install connect-redis
|
||||
|
||||
try {
|
||||
var RedisStore = require('connect-redis')(connect);
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({
|
||||
secret: 'keyboard cat',
|
||||
cookie: { maxAge: 60000 * 3 }
|
||||
, store: new RedisStore
|
||||
}))
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
var sess = req.session;
|
||||
if (sess.views) {
|
||||
sess.views++;
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end('<p>views: ' + sess.views + '</p>');
|
||||
} else {
|
||||
sess.views = 1;
|
||||
res.end('welcome to the redis demo. refresh!');
|
||||
}
|
||||
})).listen(3001);
|
||||
|
||||
console.log('port 3001: redis example');
|
||||
} catch (err) {
|
||||
console.log('\033[33m');
|
||||
console.log('failed to start the Redis example.');
|
||||
console.log('to try it install redis, start redis');
|
||||
console.log('install connect-redis, and run this');
|
||||
console.log('script again.');
|
||||
console.log(' $ redis-server');
|
||||
console.log(' $ npm install connect-redis');
|
||||
console.log('\033[0m');
|
||||
}
|
||||
|
||||
// conditional session support by simply
|
||||
// wrapping middleware with middleware.
|
||||
|
||||
var sess = connect.session({ secret: 'keyboard cat', cookie: { maxAge: 5000 }});
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(function(req, res, next){
|
||||
if ('/foo' == req.url || '/bar' == req.url) {
|
||||
sess(req, res, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
})
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
res.end('has session: ' + (req.session ? 'yes' : 'no'));
|
||||
})).listen(3002);
|
||||
|
||||
console.log('port 3002: conditional sessions');
|
||||
|
||||
// Session#reload() will update req.session
|
||||
// without altering .maxAge
|
||||
|
||||
// view the page several times, and see that the
|
||||
// setInterval can still gain access to new
|
||||
// session data
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
var sess = req.session
|
||||
, prev;
|
||||
|
||||
if (sess.views) {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.write('<p>views: ' + sess.views + '</p>');
|
||||
res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
|
||||
sess.views++;
|
||||
res.end();
|
||||
} else {
|
||||
sess.views = 1;
|
||||
setInterval(function(){
|
||||
sess.reload(function(){
|
||||
console.log();
|
||||
if (prev) console.log('previous views %d, now %d', prev, req.session.views);
|
||||
console.log('time remaining until expiry: %ds', (req.session.cookie.maxAge / 1000));
|
||||
prev = req.session.views;
|
||||
});
|
||||
}, 3000);
|
||||
res.end('welcome to the session demo. refresh!');
|
||||
}
|
||||
})).listen(3003);
|
||||
|
||||
console.log('port 3003: Session#reload() demo');
|
||||
|
||||
// by default sessions
|
||||
// last the duration of
|
||||
// a user-agent's own session,
|
||||
// aka while the browser is open.
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'keyboard cat' }))
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
var sess = req.session;
|
||||
if (sess.views) {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.write('<p>views: ' + sess.views + '</p>');
|
||||
res.end();
|
||||
sess.views++;
|
||||
} else {
|
||||
sess.views = 1;
|
||||
res.end('welcome to the browser session demo. refresh!');
|
||||
}
|
||||
})).listen(3004);
|
||||
|
||||
console.log('port 3004: browser-session length sessions');
|
||||
|
||||
// persistence example, enter your name!
|
||||
|
||||
http.createServer(connect()
|
||||
.use(connect.bodyParser())
|
||||
.use(connect.cookieParser())
|
||||
.use(connect.session({ secret: 'keyboard cat' }))
|
||||
.use(connect.favicon())
|
||||
.use(function(req, res, next){
|
||||
if ('POST' != req.method) return next();
|
||||
req.session.name = req.body.name;
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', '/');
|
||||
res.end();
|
||||
})
|
||||
.use(function(req, res, next){
|
||||
var sess = req.session;
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
if (sess.name) res.write('<p>Hey ' + sess.name + '!</p>');
|
||||
else res.write('<p>Enter a username:</p>');
|
||||
res.end('<form action="/" method="post">'
|
||||
+ '<input type="type" name="name" />'
|
||||
+ '<input type="submit" value="Save" />'
|
||||
+ '</form>');
|
||||
})).listen(3005);
|
||||
|
||||
console.log('port 3005: browser-session length sessions persistence example');
|
||||
@ -1,14 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
connect(
|
||||
connect.static(__dirname + '/public', { maxAge: 0 })
|
||||
, function(req, res) {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end('<img src="/tobi.jpeg" />')
|
||||
}
|
||||
).listen(3000);
|
||||
37
node_modules/grunt-contrib-connect/node_modules/connect/examples/upload-stream.js
generated
vendored
37
node_modules/grunt-contrib-connect/node_modules/connect/examples/upload-stream.js
generated
vendored
@ -1,37 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
var fs = require('fs');
|
||||
|
||||
connect()
|
||||
.use(connect.bodyParser({ defer: true }))
|
||||
.use(form)
|
||||
.use(upload)
|
||||
.listen(3000);
|
||||
|
||||
function form(req, res, next) {
|
||||
if ('GET' !== req.method) return next();
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end('<form method="post" enctype="multipart/form-data">'
|
||||
+ '<input type="file" name="images" multiple="multiple" />'
|
||||
+ '<input type="submit" value="Upload" />'
|
||||
+ '</form>');
|
||||
}
|
||||
|
||||
function upload(req, res, next) {
|
||||
if ('POST' !== req.method) return next();
|
||||
|
||||
req.form.on('part', function(part){
|
||||
// transfer to s3 etc
|
||||
console.log('upload %s %s', part.name, part.filename);
|
||||
var out = fs.createWriteStream('/tmp/' + part.filename);
|
||||
part.pipe(out);
|
||||
});
|
||||
|
||||
req.form.on('close', function(){
|
||||
res.end('uploaded!');
|
||||
});
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
connect()
|
||||
.use(connect.bodyParser())
|
||||
.use(form)
|
||||
.use(upload)
|
||||
.listen(3000);
|
||||
|
||||
function form(req, res, next) {
|
||||
if ('GET' !== req.method) return next();
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end('<form method="post" enctype="multipart/form-data">'
|
||||
+ '<input type="file" name="images" multiple="multiple" />'
|
||||
+ '<input type="submit" value="Upload" />'
|
||||
+ '</form>');
|
||||
}
|
||||
|
||||
function upload(req, res, next) {
|
||||
if ('POST' !== req.method) return next();
|
||||
req.files.images.forEach(function(file){
|
||||
console.log(' uploaded : %s %skb : %s', file.originalFilename, file.size / 1024 | 0, file.path);
|
||||
});
|
||||
res.end('Thanks');
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var connect = require('../');
|
||||
|
||||
var account = connect(function(req, res){
|
||||
var location = 'http://localhost:3000/account/' + req.headers.host.split('.localhost')[0];
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', location);
|
||||
res.end('Moved to ' + location);
|
||||
});
|
||||
|
||||
var blog = connect(function(req, res){
|
||||
res.end('blog app');
|
||||
});
|
||||
|
||||
var main = connect(function(req, res){
|
||||
if (req.url == '/') return res.end('main app');
|
||||
if (0 == req.url.indexOf('/account/')) return res.end('viewing user account for ' + req.url.substring(9));
|
||||
res.statusCode = 404;
|
||||
res.end();
|
||||
});
|
||||
|
||||
connect(
|
||||
connect.logger()
|
||||
, connect.vhost('blog.localhost', blog)
|
||||
, connect.vhost('*.localhost', account)
|
||||
, main
|
||||
).listen(3000);
|
||||
@ -1,2 +0,0 @@
|
||||
|
||||
module.exports = require('./lib/connect');
|
||||
@ -1,81 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - Cache
|
||||
* Copyright(c) 2011 Sencha Inc.
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Expose `Cache`.
|
||||
*/
|
||||
|
||||
module.exports = Cache;
|
||||
|
||||
/**
|
||||
* LRU cache store.
|
||||
*
|
||||
* @param {Number} limit
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Cache(limit) {
|
||||
this.store = {};
|
||||
this.keys = [];
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Touch `key`, promoting the object.
|
||||
*
|
||||
* @param {String} key
|
||||
* @param {Number} i
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Cache.prototype.touch = function(key, i){
|
||||
this.keys.splice(i,1);
|
||||
this.keys.push(key);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove `key`.
|
||||
*
|
||||
* @param {String} key
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Cache.prototype.remove = function(key){
|
||||
delete this.store[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the object stored for `key`.
|
||||
*
|
||||
* @param {String} key
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Cache.prototype.get = function(key){
|
||||
return this.store[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a cache `key`.
|
||||
*
|
||||
* @param {String} key
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Cache.prototype.add = function(key){
|
||||
// initialize store
|
||||
var len = this.keys.push(key);
|
||||
|
||||
// limit reached, invalidate LRU
|
||||
if (len > this.limit) this.remove(this.keys.shift());
|
||||
|
||||
var arr = this.store[key] = [];
|
||||
arr.createdAt = new Date;
|
||||
return arr;
|
||||
};
|
||||
@ -1,92 +0,0 @@
|
||||
/*!
|
||||
* Connect
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
, proto = require('./proto')
|
||||
, utils = require('./utils')
|
||||
, path = require('path')
|
||||
, basename = path.basename
|
||||
, fs = require('fs');
|
||||
|
||||
// node patches
|
||||
|
||||
require('./patch');
|
||||
|
||||
// expose createServer() as the module
|
||||
|
||||
exports = module.exports = createServer;
|
||||
|
||||
/**
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
exports.version = require('../package').version;
|
||||
|
||||
/**
|
||||
* Expose mime module.
|
||||
*/
|
||||
|
||||
exports.mime = require('./middleware/static').mime;
|
||||
|
||||
/**
|
||||
* Expose the prototype.
|
||||
*/
|
||||
|
||||
exports.proto = proto;
|
||||
|
||||
/**
|
||||
* Auto-load middleware getters.
|
||||
*/
|
||||
|
||||
exports.middleware = {};
|
||||
|
||||
/**
|
||||
* Expose utilities.
|
||||
*/
|
||||
|
||||
exports.utils = utils;
|
||||
|
||||
/**
|
||||
* Create a new connect server.
|
||||
*
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createServer() {
|
||||
function app(req, res, next){ app.handle(req, res, next); }
|
||||
utils.merge(app, proto);
|
||||
utils.merge(app, EventEmitter.prototype);
|
||||
app.route = '/';
|
||||
app.stack = [];
|
||||
for (var i = 0; i < arguments.length; ++i) {
|
||||
app.use(arguments[i]);
|
||||
}
|
||||
return app;
|
||||
};
|
||||
|
||||
/**
|
||||
* Support old `.createServer()` method.
|
||||
*/
|
||||
|
||||
createServer.createServer = createServer;
|
||||
|
||||
/**
|
||||
* Auto-load bundled middleware with getters.
|
||||
*/
|
||||
|
||||
fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
|
||||
if (!/\.js$/.test(filename)) return;
|
||||
var name = basename(filename, '.js');
|
||||
function load(){ return require('./middleware/' + name); }
|
||||
exports.middleware.__defineGetter__(name, load);
|
||||
exports.__defineGetter__(name, load);
|
||||
});
|
||||
@ -1,50 +0,0 @@
|
||||
|
||||
/**
|
||||
* Connect is a middleware framework for node,
|
||||
* shipping with over 18 bundled middleware and a rich selection of
|
||||
* 3rd-party middleware.
|
||||
*
|
||||
* var app = connect()
|
||||
* .use(connect.logger('dev'))
|
||||
* .use(connect.static('public'))
|
||||
* .use(function(req, res){
|
||||
* res.end('hello world\n');
|
||||
* })
|
||||
*
|
||||
* http.createServer(app).listen(3000);
|
||||
*
|
||||
* Installation:
|
||||
*
|
||||
* $ npm install connect
|
||||
*
|
||||
* Middleware:
|
||||
*
|
||||
* - [basicAuth](https://github.com/expressjs/basic-auth-connect) basic http authentication
|
||||
* - [cookieParser](https://github.com/expressjs/cookie-parser) cookie parser
|
||||
* - [compress](https://github.com/expressjs/compression) Gzip compression middleware
|
||||
* - [csrf](https://github.com/expressjs/csurf) Cross-site request forgery protection
|
||||
* - [directory](https://github.com/expressjs/serve-index) directory listing middleware
|
||||
* - [errorHandler](https://github.com/expressjs/errorhandler) flexible error handler
|
||||
* - [favicon](https://github.com/expressjs/favicon) efficient favicon server (with default icon)
|
||||
* - [json](https://github.com/expressjs/body-parser) application/json parser
|
||||
* - [logger](https://github.com/expressjs/morgan) request logger with custom format support
|
||||
* - [methodOverride](https://github.com/expressjs/method-override) faux HTTP method support
|
||||
* - [responseTime](https://github.com/expressjs/response-time) calculates response-time and exposes via X-Response-Time
|
||||
* - [session](https://github.com/expressjs/session) session management support with bundled MemoryStore
|
||||
* - [static](https://github.com/expressjs/serve-static) streaming static file server supporting `Range` and more
|
||||
* - [timeout](https://github.com/expressjs/timeout) request timeouts
|
||||
* - [urlencoded](https://github.com/expressjs/body-parser) application/x-www-form-urlencoded parser
|
||||
* - [vhost](https://github.com/expressjs/vhost) virtual host sub-domain mapping middleware
|
||||
* - [bodyParser](bodyParser.html) extensible request body parser
|
||||
* - [multipart](multipart.html) multipart/form-data parser
|
||||
* - [cookieSession](cookieSession.html) cookie-based session support
|
||||
* - [staticCache](staticCache.html) memory cache layer for the static() middleware
|
||||
* - [limit](limit.html) limit the bytesize of request bodies
|
||||
* - [query](query.html) automatic querystring parser, populating `req.query`
|
||||
*
|
||||
* Links:
|
||||
*
|
||||
* - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware
|
||||
* - GitHub [repository](http://github.com/senchalabs/connect)
|
||||
*
|
||||
*/
|
||||
24
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/basicAuth.js
generated
vendored
24
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/basicAuth.js
generated
vendored
@ -1,24 +0,0 @@
|
||||
/*!
|
||||
* Connect - basicAuth
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Basic Auth:
|
||||
*
|
||||
* Enfore basic authentication by providing a `callback(user, pass)`,
|
||||
* which must return `true` in order to gain access. Alternatively an async
|
||||
* method is provided as well, invoking `callback(user, pass, callback)`. Populates
|
||||
* `req.user`. The final alternative is simply passing username / password
|
||||
* strings.
|
||||
*
|
||||
* See [basic-auth-connect](https://github.com/expressjs/basic-auth-connect)
|
||||
*
|
||||
* @param {Function|String} callback or username
|
||||
* @param {String} realm
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('basic-auth-connect');
|
||||
68
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/bodyParser.js
generated
vendored
68
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/bodyParser.js
generated
vendored
@ -1,68 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - bodyParser
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var multipart = require('./multipart')
|
||||
, urlencoded = require('./urlencoded')
|
||||
, json = require('./json');
|
||||
|
||||
/**
|
||||
* Body parser:
|
||||
*
|
||||
* Status: the multipart body parser will be removed in Connect 3.
|
||||
*
|
||||
* Parse request bodies, supports _application/json_,
|
||||
* _application/x-www-form-urlencoded_, and _multipart/form-data_.
|
||||
*
|
||||
* This is equivalent to:
|
||||
*
|
||||
* app.use(connect.json());
|
||||
* app.use(connect.urlencoded());
|
||||
* app.use(connect.multipart());
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* connect()
|
||||
* .use(connect.bodyParser())
|
||||
* .use(function(req, res) {
|
||||
* res.end('viewing user ' + req.body.user.name);
|
||||
* });
|
||||
*
|
||||
* $ curl -d 'user[name]=tj' http://local/
|
||||
* $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/
|
||||
*
|
||||
* View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info.
|
||||
*
|
||||
* If you wish to create your own body parser, you may be interested in:
|
||||
*
|
||||
* - [raw-body](https://github.com/stream-utils/raw-body)
|
||||
* - [body](https://github.com/raynos/body)
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports = module.exports = function bodyParser(options){
|
||||
var _urlencoded = urlencoded(options)
|
||||
, _multipart = multipart(options)
|
||||
, _json = json(options);
|
||||
|
||||
return function bodyParser(req, res, next) {
|
||||
_json(req, res, function(err){
|
||||
if (err) return next(err);
|
||||
_urlencoded(req, res, function(err){
|
||||
if (err) return next(err);
|
||||
_multipart(req, res, next);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/compress.js
generated
vendored
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/compress.js
generated
vendored
@ -1,20 +0,0 @@
|
||||
/*!
|
||||
* Connect - compress
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Compress:
|
||||
*
|
||||
* Compress response data with gzip/deflate.
|
||||
*
|
||||
* See [compression](https://github.com/expressjs/compression)
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('compression');
|
||||
19
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/cookieParser.js
generated
vendored
19
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/cookieParser.js
generated
vendored
@ -1,19 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - cookieParser
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Cookie parser:
|
||||
*
|
||||
* See [cookie-parser](https://github.com/expressjs/cookie-parser)
|
||||
*
|
||||
* @param {String} secret
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('cookie-parser');
|
||||
122
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/cookieSession.js
generated
vendored
122
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/cookieSession.js
generated
vendored
@ -1,122 +0,0 @@
|
||||
/*!
|
||||
* Connect - cookieSession
|
||||
* Copyright(c) 2011 Sencha Inc.
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var utils = require('./../utils')
|
||||
, Cookie = require('express-session').Cookie
|
||||
, debug = require('debug')('connect:cookieSession')
|
||||
, signature = require('cookie-signature')
|
||||
, onHeaders = require('on-headers')
|
||||
, url = require('url');
|
||||
|
||||
/**
|
||||
* Cookie Session:
|
||||
*
|
||||
* Cookie session middleware.
|
||||
*
|
||||
* var app = connect();
|
||||
* app.use(connect.cookieParser());
|
||||
* app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }}));
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `key` cookie name defaulting to `connect.sess`
|
||||
* - `secret` prevents cookie tampering
|
||||
* - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
|
||||
* - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
|
||||
*
|
||||
* Clearing sessions:
|
||||
*
|
||||
* To clear the session simply set its value to `null`,
|
||||
* `cookieSession()` will then respond with a 1970 Set-Cookie.
|
||||
*
|
||||
* req.session = null;
|
||||
*
|
||||
* If you are interested in more sophisticated solutions,
|
||||
* you may be interested in:
|
||||
*
|
||||
* - [client-sessions](https://github.com/mozilla/node-client-sessions)
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function cookieSession(options){
|
||||
// TODO: utilize Session/Cookie to unify API
|
||||
options = options || {};
|
||||
var key = options.key || 'connect.sess'
|
||||
, trustProxy = options.proxy;
|
||||
|
||||
return function cookieSession(req, res, next) {
|
||||
|
||||
// req.secret is for backwards compatibility
|
||||
var secret = options.secret || req.secret;
|
||||
if (!secret) throw new Error('`secret` option required for cookie sessions');
|
||||
|
||||
// default session
|
||||
req.session = {};
|
||||
var cookie = req.session.cookie = new Cookie(options.cookie);
|
||||
|
||||
// pathname mismatch
|
||||
var originalPath = url.parse(req.originalUrl).pathname;
|
||||
if (0 != originalPath.indexOf(cookie.path)) return next();
|
||||
|
||||
// cookieParser secret
|
||||
if (!options.secret && req.secret) {
|
||||
req.session = req.signedCookies[key] || {};
|
||||
req.session.cookie = cookie;
|
||||
} else {
|
||||
// TODO: refactor
|
||||
var rawCookie = req.cookies[key];
|
||||
if (rawCookie) {
|
||||
var unsigned = utils.parseSignedCookie(rawCookie, secret);
|
||||
if (unsigned) {
|
||||
var original = unsigned;
|
||||
req.session = utils.parseJSONCookie(unsigned) || {};
|
||||
req.session.cookie = cookie;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onHeaders(res, function(){
|
||||
// removed
|
||||
if (!req.session) {
|
||||
debug('clear session');
|
||||
cookie.expires = new Date(0);
|
||||
res.setHeader('Set-Cookie', cookie.serialize(key, ''));
|
||||
return;
|
||||
}
|
||||
|
||||
delete req.session.cookie;
|
||||
|
||||
// check security
|
||||
var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
|
||||
, tls = req.connection.encrypted || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0]);
|
||||
|
||||
// only send secure cookies via https
|
||||
if (cookie.secure && !tls) return debug('not secured');
|
||||
|
||||
// serialize
|
||||
debug('serializing %j', req.session);
|
||||
var val = 'j:' + JSON.stringify(req.session);
|
||||
|
||||
// compare data, no need to set-cookie if unchanged
|
||||
if (original == val) return debug('unmodified session');
|
||||
|
||||
// set-cookie
|
||||
val = 's:' + signature.sign(val, secret);
|
||||
val = cookie.serialize(key, val);
|
||||
debug('set-cookie %j', cookie);
|
||||
res.setHeader('Set-Cookie', val);
|
||||
});
|
||||
|
||||
next();
|
||||
};
|
||||
};
|
||||
18
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/csrf.js
generated
vendored
18
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/csrf.js
generated
vendored
@ -1,18 +0,0 @@
|
||||
/*!
|
||||
* Connect - csrf
|
||||
* Copyright(c) 2011 Sencha Inc.
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Anti CSRF:
|
||||
*
|
||||
* CSRF protection middleware.
|
||||
*
|
||||
* See [csurf](https://github.com/expressjs/csurf)
|
||||
*
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('csurf');
|
||||
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/directory.js
generated
vendored
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/directory.js
generated
vendored
@ -1,20 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - directory
|
||||
* Copyright(c) 2011 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Directory:
|
||||
*
|
||||
* See [serve-index](https://github.com/expressjs/serve-index)
|
||||
*
|
||||
* @param {String} root
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('serve-index');
|
||||
17
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/errorHandler.js
generated
vendored
17
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/errorHandler.js
generated
vendored
@ -1,17 +0,0 @@
|
||||
/*!
|
||||
* Connect - errorHandler
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Error handler:
|
||||
*
|
||||
* See [errorHandler](https://github.com/expressjs/errorhandler)
|
||||
*
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('errorhandler');
|
||||
34
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/favicon.js
generated
vendored
34
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/favicon.js
generated
vendored
@ -1,34 +0,0 @@
|
||||
/*!
|
||||
* Connect - favicon
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var path = require('path');
|
||||
var serveFavicon = require('serve-favicon');
|
||||
|
||||
var defaultPath = path.join(__dirname, '..', 'public', 'favicon.ico');
|
||||
|
||||
/**
|
||||
* Favicon:
|
||||
*
|
||||
* By default serves the connect favicon, or the favicon
|
||||
* located by the given `path`.
|
||||
*
|
||||
* See [serve-favicon](https://github.com/expressjs/serve-favicon)
|
||||
*
|
||||
* @param {String|Buffer} path
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function favicon(path, options){
|
||||
path = path || defaultPath;
|
||||
return serveFavicon(path, options);
|
||||
};
|
||||
52
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/json.js
generated
vendored
52
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/json.js
generated
vendored
@ -1,52 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - json
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var bodyParser = require('body-parser');
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* JSON:
|
||||
*
|
||||
* See [body-parser](https://github.com/expressjs/body-parser)
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function json(options) {
|
||||
var opts = utils.merge({
|
||||
limit: '1mb',
|
||||
type: ['application/json', 'application/*+json']
|
||||
}, options);
|
||||
|
||||
// back-compat verify function
|
||||
if (typeof opts.verify === 'function') {
|
||||
opts.verify = convertVerify(opts.verify);
|
||||
}
|
||||
|
||||
return bodyParser.json(opts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert old verify signature to body-parser version.
|
||||
*
|
||||
* @param {Function} verify
|
||||
* @return {Function}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function convertVerify(verify) {
|
||||
return function (req, res, buf, encoding) {
|
||||
verify(req, res, buf.toString(encoding));
|
||||
};
|
||||
}
|
||||
89
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/limit.js
generated
vendored
89
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/limit.js
generated
vendored
@ -1,89 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - limit
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var parseBytes = require('bytes');
|
||||
var utils = require('../utils');
|
||||
var brokenPause = utils.brokenPause;
|
||||
|
||||
/**
|
||||
* Limit:
|
||||
*
|
||||
* Status: Deprecated. This middleware will be removed in Connect 3.0.
|
||||
* If you still wish to use some type of limit middleware,
|
||||
* you may be interested in:
|
||||
*
|
||||
* - [raw-body](https://github.com/stream-utils/raw-body)
|
||||
*
|
||||
* Limit request bodies to the given size in `bytes`.
|
||||
*
|
||||
* A string representation of the bytesize may also be passed,
|
||||
* for example "5mb", "200kb", "1gb", etc.
|
||||
*
|
||||
* connect()
|
||||
* .use(connect.limit('5.5mb'))
|
||||
* .use(handleImageUpload)
|
||||
*
|
||||
* @param {Number|String} bytes
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function limit(bytes){
|
||||
if ('string' == typeof bytes) bytes = parseBytes(bytes);
|
||||
if ('number' != typeof bytes) throw new Error('limit() bytes required');
|
||||
|
||||
return function limit(req, res, next){
|
||||
var received = 0
|
||||
, len = req.headers['content-length']
|
||||
? parseInt(req.headers['content-length'], 10)
|
||||
: null;
|
||||
|
||||
// self-awareness
|
||||
if (req._limit) return next();
|
||||
req._limit = true;
|
||||
|
||||
// limit by content-length
|
||||
if (len && len > bytes) return next(utils.error(413));
|
||||
|
||||
// limit
|
||||
if (brokenPause) {
|
||||
listen();
|
||||
} else {
|
||||
req.on('newListener', function handler(event) {
|
||||
if (event !== 'data') return;
|
||||
|
||||
req.removeListener('newListener', handler);
|
||||
// Start listening at the end of the current loop
|
||||
// otherwise the request will be consumed too early.
|
||||
// Sideaffect is `limit` will miss the first chunk,
|
||||
// but that's not a big deal.
|
||||
// Unfortunately, the tests don't have large enough
|
||||
// request bodies to test this.
|
||||
process.nextTick(listen);
|
||||
});
|
||||
};
|
||||
|
||||
next();
|
||||
|
||||
function listen() {
|
||||
req.on('data', function(chunk) {
|
||||
received += Buffer.isBuffer(chunk)
|
||||
? chunk.length :
|
||||
Buffer.byteLength(chunk);
|
||||
|
||||
if (received > bytes) req.destroy();
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = utils.deprecate(module.exports,
|
||||
'limit: Restrict request size at location of read');
|
||||
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/logger.js
generated
vendored
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/logger.js
generated
vendored
@ -1,20 +0,0 @@
|
||||
/*!
|
||||
* Connect - logger
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Logger:
|
||||
*
|
||||
* Log requests with the given `options` or a `format` string.
|
||||
*
|
||||
* See [morgan](https://github.com/expressjs/morgan)
|
||||
*
|
||||
* @param {String|Function|Object} format or options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('morgan');
|
||||
47
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/methodOverride.js
generated
vendored
47
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/methodOverride.js
generated
vendored
@ -1,47 +0,0 @@
|
||||
/*!
|
||||
* Connect - methodOverride
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var methodOverride = require('method-override');
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Method Override:
|
||||
*
|
||||
* See [method-override](https://github.com/expressjs/method-override)
|
||||
*
|
||||
* @param {String} key
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(key){
|
||||
// this is a shim to keep the interface working with method-override@2
|
||||
var opts = { methods: null };
|
||||
var prop = key || '_method';
|
||||
var _headerOverride = methodOverride('X-HTTP-Method-Override', opts);
|
||||
var _bodyOverride = methodOverride(function(req){
|
||||
if (req.body && typeof req.body === 'object' && prop in req.body) {
|
||||
var method = req.body[prop];
|
||||
delete req.body[prop];
|
||||
return method;
|
||||
}
|
||||
}, opts);
|
||||
|
||||
return function(req, res, next){
|
||||
_bodyOverride(req, res, function(err){
|
||||
if (err) return next(err);
|
||||
_headerOverride(req, res, next);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = utils.deprecate(module.exports,
|
||||
'methodOverride: use method-override module directly');
|
||||
168
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/multipart.js
generated
vendored
168
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/multipart.js
generated
vendored
@ -1,168 +0,0 @@
|
||||
/*!
|
||||
* Connect - multipart
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var multiparty = require('multiparty')
|
||||
, typeis = require('type-is')
|
||||
, _limit = require('./limit')
|
||||
, utils = require('../utils')
|
||||
, qs = require('qs');
|
||||
|
||||
/**
|
||||
* Multipart:
|
||||
*
|
||||
* Status: Deprecated. The multipart parser will be removed in Connect 3.0.
|
||||
* Please use one of the following parsers/middleware directly:
|
||||
*
|
||||
* - [formidable](https://github.com/felixge/node-formidable)
|
||||
* - [connect-multiparty](https://github.com/superjoe30/connect-multiparty) or [multiparty]
|
||||
* - [connect-busboy](https://github.com/mscdex/connect-busboy) or [busboy](https://github.com/mscdex/busboy)
|
||||
*
|
||||
* Parse multipart/form-data request bodies,
|
||||
* providing the parsed object as `req.body`
|
||||
* and `req.files`.
|
||||
*
|
||||
* Configuration:
|
||||
*
|
||||
* The options passed are merged with [multiparty](https://github.com/superjoe30/node-multiparty)'s
|
||||
* `Form` object, allowing you to configure the upload directory,
|
||||
* size limits, etc. For example if you wish to change the upload dir do the following.
|
||||
*
|
||||
* app.use(connect.multipart({ uploadDir: path }));
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `limit` byte limit defaulting to [100mb]
|
||||
* - `defer` defers processing and exposes the multiparty form object as `req.form`.
|
||||
* `next()` is called without waiting for the form's "end" event.
|
||||
* This option is useful if you need to bind to the "progress" or "part" events, for example.
|
||||
*
|
||||
* Temporary Files:
|
||||
*
|
||||
* By default temporary files are used, stored in `os.tmpDir()`. These
|
||||
* are not automatically garbage collected, you are in charge of moving them
|
||||
* or deleting them. When `defer` is not used and these files are created you
|
||||
* may refernce them via the `req.files` object.
|
||||
*
|
||||
* req.files.images.forEach(function(file){
|
||||
* console.log(' uploaded : %s %skb : %s', file.originalFilename, file.size / 1024 | 0, file.path);
|
||||
* });
|
||||
*
|
||||
* It is highly recommended to monitor and clean up tempfiles in any production
|
||||
* environment, you may use tools like [reap](https://github.com/visionmedia/reap)
|
||||
* to do so.
|
||||
*
|
||||
* Streaming:
|
||||
*
|
||||
* When `defer` is used files are _not_ streamed to tmpfiles, you may
|
||||
* access them via the "part" events and stream them accordingly:
|
||||
*
|
||||
* req.form.on('part', function(part){
|
||||
* // transfer to s3 etc
|
||||
* console.log('upload %s %s', part.name, part.filename);
|
||||
* var out = fs.createWriteStream('/tmp/' + part.filename);
|
||||
* part.pipe(out);
|
||||
* });
|
||||
*
|
||||
* req.form.on('close', function(){
|
||||
* res.end('uploaded!');
|
||||
* });
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports = module.exports = function(options){
|
||||
options = options || {};
|
||||
|
||||
var limit = _limit(options.limit || '100mb');
|
||||
|
||||
return function multipart(req, res, next) {
|
||||
if (req._body) return next();
|
||||
req.body = req.body || {};
|
||||
req.files = req.files || {};
|
||||
|
||||
// ignore GET
|
||||
if ('GET' == req.method || 'HEAD' == req.method) return next();
|
||||
|
||||
// check Content-Type
|
||||
if (!typeis(req, 'multipart')) return next();
|
||||
|
||||
// flag as parsed
|
||||
req._body = true;
|
||||
|
||||
// parse
|
||||
limit(req, res, function(err){
|
||||
if (err) return next(err);
|
||||
|
||||
var form = new multiparty.Form(options)
|
||||
, data = {}
|
||||
, files = {}
|
||||
, done;
|
||||
|
||||
Object.keys(options).forEach(function(key){
|
||||
form[key] = options[key];
|
||||
});
|
||||
|
||||
function ondata(name, val, data){
|
||||
if (Array.isArray(data[name])) {
|
||||
data[name].push(val);
|
||||
} else if (data[name]) {
|
||||
data[name] = [data[name], val];
|
||||
} else {
|
||||
data[name] = val;
|
||||
}
|
||||
}
|
||||
|
||||
form.on('field', function(name, val){
|
||||
ondata(name, val, data);
|
||||
});
|
||||
|
||||
if (!options.defer) {
|
||||
form.on('file', function(name, val){
|
||||
val.name = val.originalFilename;
|
||||
val.type = val.headers['content-type'] || null;
|
||||
ondata(name, val, files);
|
||||
});
|
||||
}
|
||||
|
||||
form.on('error', function(err){
|
||||
if (!options.defer) {
|
||||
err.status = 400;
|
||||
next(err);
|
||||
}
|
||||
done = true;
|
||||
});
|
||||
|
||||
form.on('close', function(){
|
||||
if (done) return;
|
||||
try {
|
||||
req.body = qs.parse(data);
|
||||
req.files = qs.parse(files);
|
||||
} catch (err) {
|
||||
form.emit('error', err);
|
||||
return;
|
||||
}
|
||||
if (!options.defer) next();
|
||||
});
|
||||
|
||||
form.parse(req);
|
||||
|
||||
if (options.defer) {
|
||||
req.form = form;
|
||||
next();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = utils.deprecate(module.exports,
|
||||
'multipart: use parser (multiparty, busboy, formidable) directly');
|
||||
47
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/query.js
generated
vendored
47
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/query.js
generated
vendored
@ -1,47 +0,0 @@
|
||||
/*!
|
||||
* Connect - query
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2011 Sencha Inc.
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var qs = require('qs')
|
||||
, parseurl = require('parseurl');
|
||||
|
||||
/**
|
||||
* Query:
|
||||
*
|
||||
* Automatically parse the query-string when available,
|
||||
* populating the `req.query` object using
|
||||
* [qs](https://github.com/visionmedia/node-querystring).
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* connect()
|
||||
* .use(connect.query())
|
||||
* .use(function(req, res){
|
||||
* res.end(JSON.stringify(req.query));
|
||||
* });
|
||||
*
|
||||
* The `options` passed are provided to qs.parse function.
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function query(options){
|
||||
return function query(req, res, next){
|
||||
if (!req.query) {
|
||||
req.query = ~req.url.indexOf('?')
|
||||
? qs.parse(parseurl(req).query, options)
|
||||
: {};
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
};
|
||||
17
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/responseTime.js
generated
vendored
17
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/responseTime.js
generated
vendored
@ -1,17 +0,0 @@
|
||||
|
||||
/*!
|
||||
* Connect - responseTime
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reponse time:
|
||||
*
|
||||
* See [response-time](https://github.com/expressjs/response-time)
|
||||
*
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('response-time');
|
||||
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/session.js
generated
vendored
20
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/session.js
generated
vendored
@ -1,20 +0,0 @@
|
||||
/*!
|
||||
* Connect - session
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Session:
|
||||
*
|
||||
* Setup session store with the given `options`.
|
||||
*
|
||||
* See [express-session](https://github.com/expressjs/session)
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('express-session');
|
||||
19
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/static.js
generated
vendored
19
node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware/static.js
generated
vendored
@ -1,19 +0,0 @@
|
||||
/*!
|
||||
* Connect - static
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Static:
|
||||
*
|
||||
* See [serve-static](https://github.com/expressjs/serve-static)
|
||||
*
|
||||
* @param {String} root
|
||||
* @param {Object} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = require('serve-static');
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue