filter http
This commit is contained in:
+51
-3
@@ -1,7 +1,9 @@
|
||||
var mdeps = require("module-deps"),
|
||||
through = require("through"),
|
||||
async = require("async"),
|
||||
path = require("path");
|
||||
path = require("path"),
|
||||
fs = require("fs"),
|
||||
uglify = require("uglify-js");
|
||||
|
||||
function bundle (input, complete) {
|
||||
|
||||
@@ -16,12 +18,57 @@ function bundle (input, complete) {
|
||||
var deps = [];
|
||||
|
||||
|
||||
var md = mdeps();
|
||||
var md = mdeps({
|
||||
transforma: function (tr, file) {
|
||||
|
||||
var buffer = [];
|
||||
console.log(tr);
|
||||
|
||||
|
||||
return through(write, end);
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
function write (chunk) {
|
||||
buffer.push(chunk.toString());
|
||||
// console.log(chunk.toString(""))
|
||||
console.log(tr);
|
||||
}
|
||||
|
||||
function end() {
|
||||
var content = buffer.join("");
|
||||
// console.log(content);
|
||||
|
||||
|
||||
/*var source = uglify.parse(content, {
|
||||
strict: false
|
||||
});
|
||||
source.figure_out_scope();
|
||||
source.compute_char_frequency();
|
||||
source.mangle_names();
|
||||
|
||||
// TODO - production
|
||||
content = source.print_to_string({
|
||||
ascii_only: true,
|
||||
quote_keys: true
|
||||
});*/
|
||||
|
||||
this.queue(content);
|
||||
this.queue(null);
|
||||
}
|
||||
|
||||
},
|
||||
filter: function (id) {
|
||||
return !~["http"].indexOf(id);
|
||||
}
|
||||
});
|
||||
md.pipe(through(function (chunk) {
|
||||
deps.push(chunk);
|
||||
}, function () {
|
||||
next(null, deps)
|
||||
next(null, deps);
|
||||
}));
|
||||
|
||||
md.end({ file: input })
|
||||
|
||||
},
|
||||
@@ -46,6 +93,7 @@ function bundle (input, complete) {
|
||||
|
||||
buffer = ["(" + loader.toString() + ").call(null, {"+dbuffer.join(",")+"})"].toString();
|
||||
|
||||
console.log(buffer);
|
||||
|
||||
next(null, buffer);
|
||||
}
|
||||
|
||||
+3
-2
@@ -21,8 +21,9 @@
|
||||
"glob": "~3.2.9",
|
||||
"progress": "~1.1.3",
|
||||
"tar.gz": "0.1.1",
|
||||
"module-deps": "^2.1.2",
|
||||
"through": "^2.3.4"
|
||||
"module-deps": "^3.5.4",
|
||||
"through": "^2.3.4",
|
||||
"uglify-js": "^2.4.15"
|
||||
},
|
||||
"preferGlobal": "true",
|
||||
"bin": {
|
||||
|
||||
Reference in New Issue
Block a user