Comparing version 0.0.10 to 0.0.11
@@ -13,3 +13,4 @@ var path = require("path"), | ||
directory = path.dirname(file), | ||
extension = path.extname(file); | ||
extension = path.extname(file), | ||
lines = []; | ||
@@ -25,2 +26,3 @@ file = expandFile(file, extension); | ||
if (/^import\b/.test(line)) { | ||
flush(); | ||
var match = /^import\s+"([^"]+)"\s*;?\s*(?:\/\/.*)?$/.exec(line); | ||
@@ -33,8 +35,13 @@ if (match) { | ||
} | ||
} else if (line) { | ||
emitter.emit("line", line); | ||
} else { | ||
lines.push(line, newline); | ||
} | ||
} | ||
function flush() { | ||
if (lines.length) emitter.emit("data", Buffer.concat(lines)), lines = []; | ||
} | ||
function end() { | ||
flush(); | ||
emitter.emit("end"); | ||
@@ -49,1 +56,3 @@ } | ||
}; | ||
var newline = new Buffer("\n"); |
@@ -33,3 +33,3 @@ var stream = require("stream"), | ||
.on("import", function(file) { q.defer(streamRecursive, file); }) | ||
.on("line", function(chunk) { q.defer(function(callback) { s.write(chunk + "\n", callback); }); }) | ||
.on("data", function(data) { q.defer(function(callback) { s.write(data, callback); }); }) | ||
.on("end", c); | ||
@@ -36,0 +36,0 @@ |
{ | ||
"name": "smash", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Concatenate files together using import statements.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32656
809
0