gulp-jsmodule
Advanced tools
Comparing version 0.0.9 to 1.0.0
50
index.js
@@ -9,4 +9,7 @@ var through = require('through'), | ||
colors = require('colors'), | ||
strftime = require('strftime'); | ||
strftime = require('strftime'), | ||
md5 = require('md5'); | ||
var compiledFiles = {}; | ||
/** | ||
@@ -132,2 +135,3 @@ * Log an error | ||
var jsmoduleconcat = function (fileName, specialConfig) { | ||
if (!fileName) throw new PluginError('jsmodule', 'Missing fileName option for jsmodule'); | ||
@@ -181,24 +185,36 @@ | ||
function endStream() { | ||
var joinedPath = path.join(firstFileBase, fileName), | ||
pathmd5 = md5(joinedPath); | ||
if (specialConfig && specialConfig.replace && specialConfig.replace.length > 0) { | ||
for (var i = 0; i < specialConfig.replace.length; i++) { | ||
var fl = fs.readFileSync(specialConfig.replace[i], 'utf8'); | ||
jsm.integrateReplacementFromString(fl, specialConfig.replace[i]); | ||
if (compiledFiles[pathmd5]) { | ||
process.nextTick(function() { | ||
var joinedFile = compiledFiles[pathmd5]; | ||
this.emit('data', joinedFile); | ||
this.emit('end'); | ||
logEvent("Reconciled " + jsm.fileList.length + " files for " + fileName + " (from cache)."); | ||
}.bind(this)); | ||
} else { | ||
if (specialConfig && specialConfig.replace && specialConfig.replace.length > 0) { | ||
for (var i = 0; i < specialConfig.replace.length; i++) { | ||
var fl = fs.readFileSync(specialConfig.replace[i], 'utf8'); | ||
jsm.integrateReplacementFromString(fl, specialConfig.replace[i]); | ||
} | ||
} | ||
} | ||
var joinedContents = jsm.getCompiledContents(config); | ||
var joinedPath = path.join(firstFileBase, fileName); | ||
var joinedContents = jsm.getCompiledContents(config); | ||
var joinedFile = new File({ | ||
cwd: firstFileCwd, | ||
base: firstFileBase, | ||
path: joinedPath, | ||
contents: new Buffer(joinedContents) | ||
}); | ||
this.emit('data', joinedFile); | ||
this.emit('end'); | ||
var joinedFile = new File({ | ||
cwd: firstFileCwd, | ||
base: firstFileBase, | ||
path: joinedPath, | ||
contents: new Buffer(joinedContents) | ||
}); | ||
logEvent("Reconciled " + jsm.fileList.length + " files for " + fileName + " (" + formatKB(joinedContents.length) + ")."); | ||
compiledFiles[pathmd5] = joinedFile; | ||
this.emit('data', joinedFile); | ||
this.emit('end'); | ||
logEvent("Reconciled " + jsm.fileList.length + " files for " + fileName + " (" + formatKB(joinedContents.length) + ")."); | ||
} | ||
} | ||
@@ -205,0 +221,0 @@ |
@@ -192,3 +192,2 @@ /** | ||
JSModuleCompiler.prototype.integrateReplacementFromString = function (filestr, path) { | ||
// Grab the header | ||
@@ -278,3 +277,3 @@ var headerPos = this._regexIndexOf(filestr, /\([\w]*function[^\(]*\([a-zA-Z0-9\., _]*\)[^{]*{/g, 0); | ||
this._applyRequires(requiredfiles[r]); | ||
} catch(e) { | ||
} catch (e) { | ||
this._signalError("Possible recursive error: " + flc.path); | ||
@@ -335,3 +334,3 @@ } | ||
JSModuleCompiler.prototype.getCompiledContents = function (config) { | ||
console.log(config); | ||
this._reconcile(); | ||
@@ -338,0 +337,0 @@ |
{ | ||
"name": "gulp-jsmodule", | ||
"version": "0.0.9", | ||
"version": "1.0.0", | ||
"description": "Gulp plugin for reconciling AMD dependency trees in JavaScript projects.", | ||
@@ -27,4 +27,5 @@ "main": "index.js", | ||
"strftime": "^0.9.2", | ||
"through": "^2.3.7" | ||
"through": "^2.3.7", | ||
"md5": "^2.2.1" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
62939
14
510
2
7
+ Addedmd5@^2.2.1
+ Addedcharenc@0.0.2(transitive)
+ Addedcrypt@0.0.2(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedmd5@2.3.0(transitive)