first commit
This commit is contained in:
1
build/node_modules/browser-pack/.npmignore
generated
vendored
Normal file
1
build/node_modules/browser-pack/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
5
build/node_modules/browser-pack/.travis.yml
generated
vendored
Normal file
5
build/node_modules/browser-pack/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- node
|
||||
18
build/node_modules/browser-pack/LICENSE
generated
vendored
Normal file
18
build/node_modules/browser-pack/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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
build/node_modules/browser-pack/_prelude.js
generated
vendored
Normal file
1
build/node_modules/browser-pack/_prelude.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})
|
||||
4
build/node_modules/browser-pack/bin/cmd.js
generated
vendored
Executable file
4
build/node_modules/browser-pack/bin/cmd.js
generated
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var pack = require('../')();
|
||||
process.stdin.pipe(pack).pipe(process.stdout);
|
||||
8
build/node_modules/browser-pack/bin/prepublish.js
generated
vendored
Executable file
8
build/node_modules/browser-pack/bin/prepublish.js
generated
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var uglify = require('uglify-js');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var src = fs.readFileSync(path.join(__dirname, '..', 'prelude.js'), 'utf8');
|
||||
fs.writeFileSync(path.join(__dirname, '..', '_prelude.js'), uglify(src));
|
||||
13
build/node_modules/browser-pack/example/input.json
generated
vendored
Normal file
13
build/node_modules/browser-pack/example/input.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
[
|
||||
{
|
||||
"id": "a1b5af78",
|
||||
"source": "console.log(require('./foo')(5))",
|
||||
"deps": { "./foo": "b8f69fa5" },
|
||||
"entry": true
|
||||
},
|
||||
{
|
||||
"id": "b8f69fa5",
|
||||
"source": "module.exports = function (n) { return n * 111 }",
|
||||
"deps": {}
|
||||
}
|
||||
]
|
||||
1
build/node_modules/browser-pack/example/output.js
generated
vendored
Normal file
1
build/node_modules/browser-pack/example/output.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(p,c,e){function r(n){if(!c[n]){c[n]={exports:{}};p[n][0](function(x){return r(p[n][1][x])},c[n],c[n].exports);}return c[n].exports}for(var i=0;i<e.length;i++)r(e[i]);return r})({"a1b5af78":[function(require,module,exports){console.log(require('./foo')(5))},{"./foo":"b8f69fa5"}],"b8f69fa5":[function(require,module,exports){module.exports = function (n) { return n * 111 }},{}]},{},["a1b5af78","b8f69fa5"])
|
||||
15
build/node_modules/browser-pack/example/sourcemap/input.json
generated
vendored
Normal file
15
build/node_modules/browser-pack/example/sourcemap/input.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"id": "a1b5af78",
|
||||
"source": "console.log(require('./foo')(5))",
|
||||
"deps": { "./foo": "b8f69fa5" },
|
||||
"entry": true,
|
||||
"sourceFile": "wunder/bar.js"
|
||||
},
|
||||
{
|
||||
"id": "b8f69fa5",
|
||||
"source": "module.exports = function (n) { return n * 111 }",
|
||||
"deps": {},
|
||||
"sourceFile": "foo.js"
|
||||
}
|
||||
]
|
||||
6
build/node_modules/browser-pack/example/sourcemap/output.js
generated
vendored
Normal file
6
build/node_modules/browser-pack/example/sourcemap/output.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
(function(e,t,n,r){function i(r){if(!n[r]){if(!t[r]){if(e)return e(r);throw new Error("Cannot find module '"+r+"'")}var s=n[r]={exports:{}};t[r][0](function(e){var n=t[r][1][e];return i(n?n:e)},s,s.exports)}return n[r].exports}for(var s=0;s<r.length;s++)i(r[s]);return i})(typeof require!=="undefined"&&require,{"a1b5af78":[function(require,module,exports){
|
||||
console.log(require('./foo')(5))
|
||||
},{"./foo":"b8f69fa5"}],"b8f69fa5":[function(require,module,exports){
|
||||
module.exports = function (n) { return n * 111 }
|
||||
},{}]},{},["a1b5af78"])
|
||||
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJ3dW5kZXIvYmFyLmpzIiwiZm9vLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7QUNBQSJ9
|
||||
121
build/node_modules/browser-pack/index.js
generated
vendored
Normal file
121
build/node_modules/browser-pack/index.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
var JSONStream = require('JSONStream');
|
||||
var defined = require('defined');
|
||||
var through = require('through2');
|
||||
var umd = require('umd');
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var combineSourceMap = require('combine-source-map');
|
||||
|
||||
var defaultPreludePath = path.join(__dirname, '_prelude.js');
|
||||
var defaultPrelude = fs.readFileSync(defaultPreludePath, 'utf8');
|
||||
|
||||
function newlinesIn(src) {
|
||||
if (!src) return 0;
|
||||
var newlines = src.match(/\n/g);
|
||||
|
||||
return newlines ? newlines.length : 0;
|
||||
}
|
||||
|
||||
module.exports = function (opts) {
|
||||
if (!opts) opts = {};
|
||||
var parser = opts.raw ? through.obj() : JSONStream.parse([ true ]);
|
||||
var stream = through.obj(
|
||||
function (buf, enc, next) { parser.write(buf); next() },
|
||||
function () { parser.end() }
|
||||
);
|
||||
parser.pipe(through.obj(write, end));
|
||||
stream.standaloneModule = opts.standaloneModule;
|
||||
stream.hasExports = opts.hasExports;
|
||||
|
||||
var first = true;
|
||||
var entries = [];
|
||||
var basedir = defined(opts.basedir, process.cwd());
|
||||
var prelude = opts.prelude || defaultPrelude;
|
||||
var preludePath = opts.preludePath ||
|
||||
path.relative(basedir, defaultPreludePath).replace(/\\/g, '/');
|
||||
|
||||
var lineno = 1 + newlinesIn(prelude);
|
||||
var sourcemap;
|
||||
|
||||
return stream;
|
||||
|
||||
function write (row, enc, next) {
|
||||
if (first && opts.standalone) {
|
||||
var pre = umd.prelude(opts.standalone).trim();
|
||||
stream.push(new Buffer(pre + 'return '));
|
||||
}
|
||||
else if (first && stream.hasExports) {
|
||||
var pre = opts.externalRequireName || 'require';
|
||||
stream.push(new Buffer(pre + '='));
|
||||
}
|
||||
if (first) stream.push(new Buffer(prelude + '({'));
|
||||
|
||||
if (row.sourceFile && !row.nomap) {
|
||||
if (!sourcemap) {
|
||||
sourcemap = combineSourceMap.create();
|
||||
sourcemap.addFile(
|
||||
{ sourceFile: preludePath, source: prelude },
|
||||
{ line: 0 }
|
||||
);
|
||||
}
|
||||
sourcemap.addFile(
|
||||
{ sourceFile: row.sourceFile, source: row.source },
|
||||
{ line: lineno }
|
||||
);
|
||||
}
|
||||
|
||||
var wrappedSource = [
|
||||
(first ? '' : ','),
|
||||
JSON.stringify(row.id),
|
||||
':[',
|
||||
'function(require,module,exports){\n',
|
||||
combineSourceMap.removeComments(row.source),
|
||||
'\n},',
|
||||
'{' + Object.keys(row.deps || {}).sort().map(function (key) {
|
||||
return JSON.stringify(key) + ':'
|
||||
+ JSON.stringify(row.deps[key])
|
||||
;
|
||||
}).join(',') + '}',
|
||||
']'
|
||||
].join('');
|
||||
|
||||
stream.push(new Buffer(wrappedSource));
|
||||
lineno += newlinesIn(wrappedSource);
|
||||
|
||||
first = false;
|
||||
if (row.entry && row.order !== undefined) {
|
||||
entries[row.order] = row.id;
|
||||
}
|
||||
else if (row.entry) entries.push(row.id);
|
||||
next();
|
||||
}
|
||||
|
||||
function end () {
|
||||
if (first) stream.push(new Buffer(prelude + '({'));
|
||||
entries = entries.filter(function (x) { return x !== undefined });
|
||||
|
||||
stream.push(new Buffer('},{},' + JSON.stringify(entries) + ')'));
|
||||
|
||||
if (opts.standalone && !first) {
|
||||
stream.push(new Buffer(
|
||||
'(' + JSON.stringify(stream.standaloneModule) + ')'
|
||||
+ umd.postlude(opts.standalone)
|
||||
));
|
||||
}
|
||||
|
||||
if (sourcemap) {
|
||||
var comment = sourcemap.comment();
|
||||
if (opts.sourceMapPrefix) {
|
||||
comment = comment.replace(
|
||||
/^\/\/#/, function () { return opts.sourceMapPrefix }
|
||||
)
|
||||
}
|
||||
stream.push(new Buffer('\n' + comment + '\n'));
|
||||
}
|
||||
if (!sourcemap && !opts.standalone) stream.push(new Buffer(';\n'));
|
||||
|
||||
stream.push(null);
|
||||
}
|
||||
};
|
||||
3
build/node_modules/browser-pack/node_modules/through2/.npmignore
generated
vendored
Normal file
3
build/node_modules/browser-pack/node_modules/through2/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
test
|
||||
.jshintrc
|
||||
.travis.yml
|
||||
336
build/node_modules/browser-pack/node_modules/through2/LICENSE.html
generated
vendored
Normal file
336
build/node_modules/browser-pack/node_modules/through2/LICENSE.html
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
<!doctype html>
|
||||
<!-- Created with GFM2HTML: https://github.com/rvagg/gfm2html -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="created-with" content="https://github.com/rvagg/gfm2html">
|
||||
|
||||
<style type="text/css">
|
||||
/* most of normalize.css */
|
||||
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}[hidden],template{display:none;}html{font-family:sans-serif;/*1*/-ms-text-size-adjust:100%;/*2*/-webkit-text-size-adjust:100%;/*2*/}body{margin:0;}a{background:transparent;}a:focus{outline:thindotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em0;}abbr[title]{border-bottom:1pxdotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C""\201D""\2018""\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}table{border-collapse:collapse;border-spacing:0;}
|
||||
|
||||
html {
|
||||
font: 14px 'Helvetica Neue', Helvetica, arial, freesans, clean, sans-serif;
|
||||
}
|
||||
|
||||
.container {
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background: #eee;
|
||||
border-radius: 3px;
|
||||
padding: 3px;
|
||||
width: 790px;
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
.body-content {
|
||||
background-color: #fff;
|
||||
border: 1px solid #CACACA;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.body-content > *:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
color: #4183c4;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
p, blockquote, ul, ol, dl, table, pre {
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.markdown-body h1
|
||||
, .markdown-body h2
|
||||
, .markdown-body h3
|
||||
, .markdown-body h4
|
||||
, .markdown-body h5
|
||||
, .markdown-body h6 {
|
||||
margin: 20px 0 10px;
|
||||
padding: 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.5em;
|
||||
color: #000;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 2em;
|
||||
border-bottom: 1px solid #eee;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
hr {
|
||||
background: transparent url("/img/hr.png") repeat-x 0 0;
|
||||
border: 0 none;
|
||||
color: #ccc;
|
||||
height: 4px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
tr:nth-child(2n) {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.markdown-body tr {
|
||||
border-top: 1px solid #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #ccc;
|
||||
padding: 6px 13px;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 4px solid #ddd;
|
||||
padding: 0 15px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
blockquote > :last-child, blockquote > :first-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
pre, code {
|
||||
font-size: 13px;
|
||||
font-family: 'UbuntuMono', monospace;
|
||||
white-space: nowrap;
|
||||
margin: 0 2px;
|
||||
padding: 0px 5px;
|
||||
border: 1px solid #eaeaea;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
pre > code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
pre {
|
||||
overflow-x: auto;
|
||||
white-space: pre;
|
||||
padding: 10px;
|
||||
line-height: 150%;
|
||||
background-color: #f8f8f8;
|
||||
border-color: #ccc;
|
||||
}
|
||||
|
||||
pre code, pre tt {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.highlight .c
|
||||
, .highlight .cm
|
||||
, .highlight .cp
|
||||
, .highlight .c1 {
|
||||
color:#999988;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
.highlight .err {
|
||||
color:#a61717;
|
||||
background-color:#e3d2d2
|
||||
}
|
||||
|
||||
.highlight .o
|
||||
, .highlight .gs
|
||||
, .highlight .kc
|
||||
, .highlight .kd
|
||||
, .highlight .kn
|
||||
, .highlight .kp
|
||||
, .highlight .kr {
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
.highlight .cs {
|
||||
color:#999999;
|
||||
font-weight:bold;
|
||||
font-style:italic
|
||||
}
|
||||
|
||||
.highlight .gd {
|
||||
color:#000000;
|
||||
background-color:#ffdddd
|
||||
}
|
||||
|
||||
.highlight .gd .x {
|
||||
color:#000000;
|
||||
background-color:#ffaaaa
|
||||
}
|
||||
|
||||
.highlight .ge {
|
||||
font-style:italic
|
||||
}
|
||||
|
||||
.highlight .gr
|
||||
, .highlight .gt {
|
||||
color:#aa0000
|
||||
}
|
||||
|
||||
.highlight .gh
|
||||
, .highlight .bp {
|
||||
color:#999999
|
||||
}
|
||||
|
||||
.highlight .gi {
|
||||
color:#000000;
|
||||
background-color:#ddffdd
|
||||
}
|
||||
|
||||
.highlight .gi .x {
|
||||
color:#000000;
|
||||
background-color:#aaffaa
|
||||
}
|
||||
|
||||
.highlight .go {
|
||||
color:#888888
|
||||
}
|
||||
|
||||
.highlight .gp
|
||||
, .highlight .nn {
|
||||
color:#555555
|
||||
}
|
||||
|
||||
|
||||
.highlight .gu {
|
||||
color:#800080;
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
|
||||
.highlight .kt {
|
||||
color:#445588;
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
.highlight .m
|
||||
, .highlight .mf
|
||||
, .highlight .mh
|
||||
, .highlight .mi
|
||||
, .highlight .mo
|
||||
, .highlight .il {
|
||||
color:#009999
|
||||
}
|
||||
|
||||
.highlight .s
|
||||
, .highlight .sb
|
||||
, .highlight .sc
|
||||
, .highlight .sd
|
||||
, .highlight .s2
|
||||
, .highlight .se
|
||||
, .highlight .sh
|
||||
, .highlight .si
|
||||
, .highlight .sx
|
||||
, .highlight .s1 {
|
||||
color:#d14
|
||||
}
|
||||
|
||||
.highlight .n {
|
||||
color:#333333
|
||||
}
|
||||
|
||||
.highlight .na
|
||||
, .highlight .no
|
||||
, .highlight .nv
|
||||
, .highlight .vc
|
||||
, .highlight .vg
|
||||
, .highlight .vi
|
||||
, .highlight .nb {
|
||||
color:#0086B3
|
||||
}
|
||||
|
||||
.highlight .nc {
|
||||
color:#445588;
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
.highlight .ni {
|
||||
color:#800080
|
||||
}
|
||||
|
||||
.highlight .ne
|
||||
, .highlight .nf {
|
||||
color:#990000;
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
.highlight .nt {
|
||||
color:#000080
|
||||
}
|
||||
|
||||
.highlight .ow {
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
.highlight .w {
|
||||
color:#bbbbbb
|
||||
}
|
||||
|
||||
.highlight .sr {
|
||||
color:#009926
|
||||
}
|
||||
|
||||
.highlight .ss {
|
||||
color:#990073
|
||||
}
|
||||
|
||||
.highlight .gc {
|
||||
color:#999;
|
||||
background-color:#EAF2F5
|
||||
}
|
||||
|
||||
@media print {
|
||||
.container {
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.body-content {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="body-content"><h1 id="the-mit-license-mit-">The MIT License (MIT)</h1>
|
||||
<p><strong>Copyright (c) 2016 Rod Vagg (the "Original Author") and additional contributors</strong></p>
|
||||
<p>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:</p>
|
||||
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
|
||||
<p>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.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
9
build/node_modules/browser-pack/node_modules/through2/LICENSE.md
generated
vendored
Normal file
9
build/node_modules/browser-pack/node_modules/through2/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
**Copyright (c) 2016 Rod Vagg (the "Original Author") and additional 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.
|
||||
136
build/node_modules/browser-pack/node_modules/through2/README.md
generated
vendored
Normal file
136
build/node_modules/browser-pack/node_modules/through2/README.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# through2
|
||||
|
||||
[](https://nodei.co/npm/through2/)
|
||||
|
||||
**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise**
|
||||
|
||||
Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`.
|
||||
|
||||
Note: As 2.x.x this module starts using **Streams3** instead of Stream2. To continue using a Streams2 version use `npm install through2@0` to fetch the latest version of 0.x.x. More information about Streams2 vs Streams3 and recommendations see the article **[Why I don't use Node's core 'stream' module](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html)**.
|
||||
|
||||
```js
|
||||
fs.createReadStream('ex.txt')
|
||||
.pipe(through2(function (chunk, enc, callback) {
|
||||
for (var i = 0; i < chunk.length; i++)
|
||||
if (chunk[i] == 97)
|
||||
chunk[i] = 122 // swap 'a' for 'z'
|
||||
|
||||
this.push(chunk)
|
||||
|
||||
callback()
|
||||
}))
|
||||
.pipe(fs.createWriteStream('out.txt'))
|
||||
.on('finish', function () {
|
||||
doSomethingSpecial()
|
||||
})
|
||||
```
|
||||
|
||||
Or object streams:
|
||||
|
||||
```js
|
||||
var all = []
|
||||
|
||||
fs.createReadStream('data.csv')
|
||||
.pipe(csv2())
|
||||
.pipe(through2.obj(function (chunk, enc, callback) {
|
||||
var data = {
|
||||
name : chunk[0]
|
||||
, address : chunk[3]
|
||||
, phone : chunk[10]
|
||||
}
|
||||
this.push(data)
|
||||
|
||||
callback()
|
||||
}))
|
||||
.on('data', function (data) {
|
||||
all.push(data)
|
||||
})
|
||||
.on('end', function () {
|
||||
doSomethingSpecial(all)
|
||||
})
|
||||
```
|
||||
|
||||
Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`.
|
||||
|
||||
## API
|
||||
|
||||
<b><code>through2([ options, ] [ transformFunction ] [, flushFunction ])</code></b>
|
||||
|
||||
Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`).
|
||||
|
||||
### options
|
||||
|
||||
The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`).
|
||||
|
||||
The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call:
|
||||
|
||||
```js
|
||||
fs.createReadStream('/tmp/important.dat')
|
||||
.pipe(through2({ objectMode: true, allowHalfOpen: false },
|
||||
function (chunk, enc, cb) {
|
||||
cb(null, 'wut?') // note we can use the second argument on the callback
|
||||
// to provide data as an alternative to this.push('wut?')
|
||||
}
|
||||
)
|
||||
.pipe(fs.createWriteStream('/tmp/wut.txt'))
|
||||
```
|
||||
|
||||
### transformFunction
|
||||
|
||||
The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk.
|
||||
|
||||
To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on.
|
||||
|
||||
Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error.
|
||||
|
||||
If you **do not provide a `transformFunction`** then you will get a simple pass-through stream.
|
||||
|
||||
### flushFunction
|
||||
|
||||
The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress.
|
||||
|
||||
```js
|
||||
fs.createReadStream('/tmp/important.dat')
|
||||
.pipe(through2(
|
||||
function (chunk, enc, cb) { cb(null, chunk) }, // transform is a noop
|
||||
function (cb) { // flush function
|
||||
this.push('tacking on an extra buffer to the end');
|
||||
cb();
|
||||
}
|
||||
))
|
||||
.pipe(fs.createWriteStream('/tmp/wut.txt'));
|
||||
```
|
||||
|
||||
<b><code>through2.ctor([ options, ] transformFunction[, flushFunction ])</code></b>
|
||||
|
||||
Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances.
|
||||
|
||||
```js
|
||||
var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) {
|
||||
if (record.temp != null && record.unit == "F") {
|
||||
record.temp = ( ( record.temp - 32 ) * 5 ) / 9
|
||||
record.unit = "C"
|
||||
}
|
||||
this.push(record)
|
||||
callback()
|
||||
})
|
||||
|
||||
// Create instances of FToC like so:
|
||||
var converter = new FToC()
|
||||
// Or:
|
||||
var converter = FToC()
|
||||
// Or specify/override options when you instantiate, if you prefer:
|
||||
var converter = FToC({objectMode: true})
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams.
|
||||
- [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams.
|
||||
- [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams.
|
||||
- [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies.
|
||||
- the [mississippi stream utility collection](https://github.com/maxogden/mississippi) includes `through2` as well as many more useful stream modules similar to this one
|
||||
|
||||
## License
|
||||
|
||||
**through2** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
|
||||
65
build/node_modules/browser-pack/node_modules/through2/package.json
generated
vendored
Normal file
65
build/node_modules/browser-pack/node_modules/through2/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "through2@^2.0.0",
|
||||
"_id": "through2@2.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=",
|
||||
"_location": "/browser-pack/through2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "through2@^2.0.0",
|
||||
"name": "through2",
|
||||
"escapedName": "through2",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-pack"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz",
|
||||
"_shasum": "0004569b37c7c74ba39c43f3ced78d1ad94140be",
|
||||
"_spec": "through2@^2.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/browser-pack",
|
||||
"author": {
|
||||
"name": "Rod Vagg",
|
||||
"email": "r@va.gg",
|
||||
"url": "https://github.com/rvagg"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/rvagg/through2/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.1.5",
|
||||
"xtend": "~4.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise",
|
||||
"devDependencies": {
|
||||
"bl": "~1.1.2",
|
||||
"faucet": "0.0.1",
|
||||
"stream-spigot": "~3.0.5",
|
||||
"tape": "~4.6.2"
|
||||
},
|
||||
"homepage": "https://github.com/rvagg/through2#readme",
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams2",
|
||||
"through",
|
||||
"transform"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "through2.js",
|
||||
"name": "through2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/rvagg/through2.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/test.js | faucet",
|
||||
"test-local": "brtapsauce-local test/basic-test.js"
|
||||
},
|
||||
"version": "2.0.3"
|
||||
}
|
||||
96
build/node_modules/browser-pack/node_modules/through2/through2.js
generated
vendored
Normal file
96
build/node_modules/browser-pack/node_modules/through2/through2.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
var Transform = require('readable-stream/transform')
|
||||
, inherits = require('util').inherits
|
||||
, xtend = require('xtend')
|
||||
|
||||
function DestroyableTransform(opts) {
|
||||
Transform.call(this, opts)
|
||||
this._destroyed = false
|
||||
}
|
||||
|
||||
inherits(DestroyableTransform, Transform)
|
||||
|
||||
DestroyableTransform.prototype.destroy = function(err) {
|
||||
if (this._destroyed) return
|
||||
this._destroyed = true
|
||||
|
||||
var self = this
|
||||
process.nextTick(function() {
|
||||
if (err)
|
||||
self.emit('error', err)
|
||||
self.emit('close')
|
||||
})
|
||||
}
|
||||
|
||||
// a noop _transform function
|
||||
function noop (chunk, enc, callback) {
|
||||
callback(null, chunk)
|
||||
}
|
||||
|
||||
|
||||
// create a new export function, used by both the main export and
|
||||
// the .ctor export, contains common logic for dealing with arguments
|
||||
function through2 (construct) {
|
||||
return function (options, transform, flush) {
|
||||
if (typeof options == 'function') {
|
||||
flush = transform
|
||||
transform = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (typeof transform != 'function')
|
||||
transform = noop
|
||||
|
||||
if (typeof flush != 'function')
|
||||
flush = null
|
||||
|
||||
return construct(options, transform, flush)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// main export, just make me a transform stream!
|
||||
module.exports = through2(function (options, transform, flush) {
|
||||
var t2 = new DestroyableTransform(options)
|
||||
|
||||
t2._transform = transform
|
||||
|
||||
if (flush)
|
||||
t2._flush = flush
|
||||
|
||||
return t2
|
||||
})
|
||||
|
||||
|
||||
// make me a reusable prototype that I can `new`, or implicitly `new`
|
||||
// with a constructor call
|
||||
module.exports.ctor = through2(function (options, transform, flush) {
|
||||
function Through2 (override) {
|
||||
if (!(this instanceof Through2))
|
||||
return new Through2(override)
|
||||
|
||||
this.options = xtend(options, override)
|
||||
|
||||
DestroyableTransform.call(this, this.options)
|
||||
}
|
||||
|
||||
inherits(Through2, DestroyableTransform)
|
||||
|
||||
Through2.prototype._transform = transform
|
||||
|
||||
if (flush)
|
||||
Through2.prototype._flush = flush
|
||||
|
||||
return Through2
|
||||
})
|
||||
|
||||
|
||||
module.exports.obj = through2(function (options, transform, flush) {
|
||||
var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options))
|
||||
|
||||
t2._transform = transform
|
||||
|
||||
if (flush)
|
||||
t2._flush = flush
|
||||
|
||||
return t2
|
||||
})
|
||||
92
build/node_modules/browser-pack/package.json
generated
vendored
Normal file
92
build/node_modules/browser-pack/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"_from": "browser-pack@^6.0.1",
|
||||
"_id": "browser-pack@6.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=",
|
||||
"_location": "/browser-pack",
|
||||
"_phantomChildren": {
|
||||
"readable-stream": "2.3.3",
|
||||
"xtend": "4.0.1"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "browser-pack@^6.0.1",
|
||||
"name": "browser-pack",
|
||||
"escapedName": "browser-pack",
|
||||
"rawSpec": "^6.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browserify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.0.2.tgz",
|
||||
"_shasum": "f86cd6cef4f5300c8e63e07a4d512f65fbff4531",
|
||||
"_spec": "browser-pack@^6.0.1",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/browserify",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bin": {
|
||||
"browser-pack": "bin/cmd.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/browser-pack/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"JSONStream": "^1.0.3",
|
||||
"combine-source-map": "~0.7.1",
|
||||
"defined": "^1.0.0",
|
||||
"through2": "^2.0.0",
|
||||
"umd": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "pack node-style source files from a json stream into a browser bundle",
|
||||
"devDependencies": {
|
||||
"concat-stream": "~1.5.1",
|
||||
"convert-source-map": "~1.1.0",
|
||||
"parse-base64vlq-mappings": "~0.1.1",
|
||||
"tap": "^2.2.0",
|
||||
"uglify-js": "1.3.5"
|
||||
},
|
||||
"homepage": "https://github.com/substack/browser-pack",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"bundle",
|
||||
"commonjs",
|
||||
"commonj-esque",
|
||||
"exports",
|
||||
"module.exports",
|
||||
"require"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "browser-pack",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/browser-pack.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "node bin/prepublish.js",
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8",
|
||||
"ie/9",
|
||||
"ie/10",
|
||||
"chrome/15",
|
||||
"chrome/latest",
|
||||
"firefox/10",
|
||||
"firefox/latest",
|
||||
"safari/latest",
|
||||
"opera/latest"
|
||||
]
|
||||
},
|
||||
"version": "6.0.2"
|
||||
}
|
||||
44
build/node_modules/browser-pack/prelude.js
generated
vendored
Normal file
44
build/node_modules/browser-pack/prelude.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
// modules are defined as an array
|
||||
// [ module function, map of requireuires ]
|
||||
//
|
||||
// map of requireuires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the requireuire for previous bundles
|
||||
|
||||
(function outer (modules, cache, entry) {
|
||||
// Save the require from previous bundle to this closure if any
|
||||
var previousRequire = typeof require == "function" && require;
|
||||
|
||||
function newRequire(name, jumped){
|
||||
if(!cache[name]) {
|
||||
if(!modules[name]) {
|
||||
// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var currentRequire = typeof require == "function" && require;
|
||||
if (!jumped && currentRequire) return currentRequire(name, true);
|
||||
|
||||
// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if (previousRequire) return previousRequire(name, true);
|
||||
var err = new Error('Cannot find module \'' + name + '\'');
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
}
|
||||
var m = cache[name] = {exports:{}};
|
||||
modules[name][0].call(m.exports, function(x){
|
||||
var id = modules[name][1][x];
|
||||
return newRequire(id ? id : x);
|
||||
},m,m.exports,outer,modules,cache,entry);
|
||||
}
|
||||
return cache[name].exports;
|
||||
}
|
||||
for(var i=0;i<entry.length;i++) newRequire(entry[i]);
|
||||
|
||||
// Override the current require with this new one
|
||||
return newRequire;
|
||||
})
|
||||
96
build/node_modules/browser-pack/readme.markdown
generated
vendored
Normal file
96
build/node_modules/browser-pack/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
# browser-pack
|
||||
|
||||
pack node-style source files from a json stream into a browser bundle
|
||||
|
||||
[](http://ci.testling.com/substack/browser-pack)
|
||||
|
||||
[](http://travis-ci.org/substack/browser-pack)
|
||||
|
||||
# example
|
||||
|
||||
json input:
|
||||
|
||||
``` json
|
||||
[
|
||||
{
|
||||
"id": "a1b5af78",
|
||||
"source": "console.log(require('./foo')(5))",
|
||||
"deps": { "./foo": "b8f69fa5" },
|
||||
"entry": true
|
||||
},
|
||||
{
|
||||
"id": "b8f69fa5",
|
||||
"source": "module.exports = function (n) { return n * 111 }",
|
||||
"deps": {}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
bundle script:
|
||||
|
||||
``` js
|
||||
var pack = require('browser-pack')();
|
||||
process.stdin.pipe(pack).pipe(process.stdout);
|
||||
process.stdin.resume();
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
$ browser-pack < input.json
|
||||
(function(p,c,e){function r(n){if(!c[n]){c[n]={exports:{}};p[n][0](function(x){return r(p[n][1][x])},c[n],c[n].exports);}return c[n].exports}for(var i=0;i<e.length;i++)r(e[i]);return r})({"a1b5af78":[function(require,module,exports){console.log(require('./foo')(5))},{"./foo":"b8f69fa5"}],"b8f69fa5":[function(require,module,exports){module.exports = function (n) { return n * 111 }},{}]},{},["a1b5af78","b8f69fa5"])
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var pack = require('browser-pack');
|
||||
```
|
||||
|
||||
## pack(opts)
|
||||
|
||||
Return a through stream that takes a stream of json input and produces a stream
|
||||
of javascript output. This module does not export its internal `require()`
|
||||
function but you can prepend `'var require='` to the stream contents to get the
|
||||
require function. `require()` will return `undefined` when a module hasn't been
|
||||
defined to support splitting up modules across several bundles with custom
|
||||
fallback logic.
|
||||
|
||||
If `opts.raw` is given, the writable end of the stream will expect objects to be
|
||||
written to it instead of expecting a stream of json text it will need to parse.
|
||||
|
||||
If `opts.sourceMapPrefix` is given and source maps are computed, the
|
||||
`opts.sourceMapPrefix` string will be used instead of `//#`.
|
||||
|
||||
Additionally, rows with a truthy `entry` may have an `order` field that
|
||||
determines the numeric index to execute the entries in.
|
||||
|
||||
You can specify a custom prelude with `opts.prelude` but you should really know
|
||||
what you're doing first. See the `prelude.js` file in this repo for the default
|
||||
prelude. If you specify a custom prelude, you must also specify a valid
|
||||
`opts.preludePath` to the prelude source file for sourcemaps to work.
|
||||
|
||||
`opts.standalone` external string name to use for umd
|
||||
|
||||
`opts.standaloneModule` sets the internal module name to export for standalone
|
||||
|
||||
`opts.hasExports` whether the bundle should include `require=` (or the
|
||||
`opts.externalRequireName`) so that `require()` is available outside the bundle
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org), to get the library do:
|
||||
|
||||
```
|
||||
npm install browser-pack
|
||||
```
|
||||
|
||||
and to get the command-line tool do:
|
||||
|
||||
```
|
||||
npm install -g browser-pack
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
33
build/node_modules/browser-pack/test/comment.js
generated
vendored
Normal file
33
build/node_modules/browser-pack/test/comment.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('trailing comment', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
+ ' // trailing comment'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
33
build/node_modules/browser-pack/test/empty.js
generated
vendored
Normal file
33
build/node_modules/browser-pack/test/empty.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var vm = require('vm');
|
||||
|
||||
test('empty', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
t.doesNotThrow(function() {
|
||||
vm.runInNewContext(src, {});
|
||||
});
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
|
||||
test('empty with standalone', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({standalone: 'ABC'});
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
t.doesNotThrow(function() {
|
||||
vm.runInNewContext(src, {});
|
||||
});
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
34
build/node_modules/browser-pack/test/not_found.js
generated
vendored
Normal file
34
build/node_modules/browser-pack/test/not_found.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var concat = require('concat-stream');
|
||||
|
||||
test('not found', function (t) {
|
||||
t.plan(6);
|
||||
|
||||
var p = pack({ raw: true, hasExports: true });
|
||||
var src = '';
|
||||
p.pipe(concat(function (src) {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
try { r('zzz') }
|
||||
catch (err) { t.equal(err.code, 'MODULE_NOT_FOUND') }
|
||||
}));
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
26
build/node_modules/browser-pack/test/only_execute_entries.js
generated
vendored
Normal file
26
build/node_modules/browser-pack/test/only_execute_entries.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('raw', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.ok(true)',
|
||||
entry: true,
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.fail("non-entry files should not execute")'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
38
build/node_modules/browser-pack/test/order.js
generated
vendored
Normal file
38
build/node_modules/browser-pack/test/order.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('raw', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var order = [];
|
||||
var r = Function(['order'], 'return ' + src)(order);
|
||||
t.same(order, [ 'abc', 'def', 'hij' ]);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'def',
|
||||
order: 1,
|
||||
entry: true,
|
||||
source: 'order.push("def")'
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'hij',
|
||||
entry: true,
|
||||
order: 2,
|
||||
source: 'order.push("hij")'
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
entry: true,
|
||||
order: 0,
|
||||
source: 'order.push("abc")'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
28
build/node_modules/browser-pack/test/pack.js
generated
vendored
Normal file
28
build/node_modules/browser-pack/test/pack.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('pack', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
}
|
||||
]));
|
||||
});
|
||||
32
build/node_modules/browser-pack/test/raw.js
generated
vendored
Normal file
32
build/node_modules/browser-pack/test/raw.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('raw', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
59
build/node_modules/browser-pack/test/source-maps-existing.js
generated
vendored
Normal file
59
build/node_modules/browser-pack/test/source-maps-existing.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var convert = require('convert-source-map');
|
||||
var parse = require('parse-base64vlq-mappings');
|
||||
|
||||
var foo = {
|
||||
version: 3,
|
||||
file: 'foo.js',
|
||||
sourceRoot: '',
|
||||
sources: [ 'foo.coffee' ],
|
||||
names: [],
|
||||
mappings: ';AAAA;CAAA;CAAA,CAAA,CAAA,IAAO,GAAK;CAAZ',
|
||||
sourcesContent: [ 'console.log(require \'./bar.js\')\n' ] };
|
||||
|
||||
test('pack one file with source file field and existing sourcemap', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var mapComment = convert.fromObject(foo).toComment();
|
||||
var fooMappings = parse(foo.mappings);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
|
||||
var sm = convert.fromSource(src).toObject();
|
||||
var mappings = parse(sm.mappings);
|
||||
|
||||
var remainingMaps = src.match(convert.commentRegex);
|
||||
|
||||
// remove map for _prelude.js
|
||||
mappings.shift();
|
||||
|
||||
var fstMap = mappings[0];
|
||||
var fstFooMap = fooMappings[0];
|
||||
var lstMap = mappings.pop();
|
||||
var lstFooMap = fooMappings.pop();
|
||||
|
||||
t.deepEqual(fstMap.original, fstFooMap.original, 'first original mappings are same');
|
||||
t.deepEqual(lstMap.original, lstFooMap.original, 'last original mappings are same');
|
||||
|
||||
t.equal(fstMap.generated.column, fstFooMap.generated.column, 'first generated columns are same');
|
||||
t.equal(lstMap.generated.column, lstFooMap.generated.column, 'last generated columns are same');
|
||||
|
||||
t.equal(fstMap.generated.line, fstFooMap.generated.line + 1, 'first generated line is offset by 1');
|
||||
t.equal(lstMap.generated.line, lstFooMap.generated.line + 1, 'last generated line is offset by 1');
|
||||
|
||||
t.equal(remainingMaps.length, 1, 'removes orinal source maps');
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'xyz',
|
||||
source: '(function() {\n\n console.log(require(\'./bar.js\'));\n\n}).call(this);\n' + '\n' + mapComment,
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
195
build/node_modules/browser-pack/test/source-maps.js
generated
vendored
Normal file
195
build/node_modules/browser-pack/test/source-maps.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var path = require('path');
|
||||
|
||||
function decode(base64) {
|
||||
return new Buffer(base64, 'base64').toString();
|
||||
}
|
||||
|
||||
function unmountPrelude(sources) {
|
||||
return sources.map(function (x) {
|
||||
var basename = path.basename(x);
|
||||
return basename === '_prelude.js' ? basename : x;
|
||||
});
|
||||
}
|
||||
|
||||
function grabSourceMap(lastLine) {
|
||||
var base64 = lastLine.split(',').pop();
|
||||
var sm = JSON.parse(decode(base64));
|
||||
sm.sources = unmountPrelude(sm.sources);
|
||||
return sm;
|
||||
}
|
||||
|
||||
function grabLastLine(src) {
|
||||
return src.split('\n').slice(-2)[0];
|
||||
}
|
||||
|
||||
test('pack one file with source file field and one without', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/# sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'foo.js' ], 'includes mappings for sourceFile and prelude only');
|
||||
t.equal(sm.mappings, 'AAAA;;;ACAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('pack two files with source file field', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/# sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'wunder/bar.js', 'foo.js' ], 'includes mappings for both files and prelude');
|
||||
t.equal(sm.mappings, 'AAAA;ACAA;;ACAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' },
|
||||
sourceFile: 'wunder/bar.js'
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('pack two files without source file field', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
t.notOk(/^\/\/# sourceMappingURL/.test(lastLine), 'contains no source mapping url');
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('pack two files with source file field, one with nomap flag', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/# sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'wunder/bar.js' ], 'includes mappings for only the file without the "nomap" flag and prelude');
|
||||
t.equal(sm.mappings, 'AAAA;ACAA', 'adds offset mapping for each line of mapped file' );
|
||||
t.end()
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' },
|
||||
sourceFile: 'wunder/bar.js'
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js',
|
||||
nomap: true
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('custom sourceMapPrefix for //@', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack({ sourceMapPrefix: '//@' });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/@ sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'foo.js' ], 'includes mappings for sourceFile and prelude only');
|
||||
t.equal(sm.mappings, 'AAAA;;;ACAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
24
build/node_modules/browser-pack/test/this.js
generated
vendored
Normal file
24
build/node_modules/browser-pack/test/this.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* In node.js `this` on the module root is the same as `exports`. Browser-pack
|
||||
* should act like it too.
|
||||
**/
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('this', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf; });
|
||||
p.on('end', function () {
|
||||
var r = Function([], 'return ' + src)();
|
||||
t.deepEqual(r("abc"), { foo: "bar" });
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([{
|
||||
id: 'abc',
|
||||
source: 'this.foo = "bar"'
|
||||
}]));
|
||||
|
||||
});
|
||||
32
build/node_modules/browser-pack/test/unicode.js
generated
vendored
Normal file
32
build/node_modules/browser-pack/test/unicode.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('unicode', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['Ṫ'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'Ṫ.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'Ṫ.ok(true); module.exports=function(ñ){return ñ*111}'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
Reference in New Issue
Block a user