Comparing version 0.2.1 to 0.2.2
@@ -13,3 +13,3 @@ var fs = require('fs'), | ||
main: 'index.js', | ||
reqpath: '' | ||
reqpath: process.cwd() | ||
}; | ||
@@ -53,3 +53,6 @@ | ||
// add the dependency -- on the package (which adds sub-dependencies etc.) | ||
if(arguments.length == 1 || typeof pathTo == 'undefined') { | ||
if(arguments.length == 0) { | ||
// TODO perhaps we could come up with a default, e.g. the package.json in the basepath? | ||
throw new Error('.npm() must have at least one argument: .npm(pathToPackageJson) or .npm(name, [searchFrom]) '); | ||
} else if(arguments.length == 1 || typeof pathTo == 'undefined') { | ||
this.build.dependency(this._fullPath(name)); | ||
@@ -117,3 +120,13 @@ } else { | ||
onDone({ | ||
replaced: self.replaced, | ||
// merge with defaults.replaced if it is set | ||
replaced: (function() { | ||
if(defaults.replace) { | ||
Object.keys(defaults.replace).forEach(function(module) { | ||
// defaults do not override explicitly set replacements | ||
if(self.replaced[module]) return; | ||
self.replaced[module] = defaults.replace[module]; | ||
}); | ||
} | ||
return self.replaced; | ||
}()), | ||
code: self.code, | ||
@@ -129,2 +142,9 @@ modules: result, | ||
var self = this; | ||
// toggle logging | ||
if(this.options['silent']) { | ||
Minilog.disable(); | ||
} else { | ||
Minilog.enable(); | ||
} | ||
this._render(function(out) { | ||
@@ -193,2 +213,5 @@ // place replaced modules into modules[0] | ||
} | ||
else { | ||
p = path.normalize(p); | ||
} | ||
return p; | ||
@@ -195,0 +218,0 @@ }; |
@@ -44,8 +44,8 @@ var fs = require('fs'), | ||
self.paths = self.paths.filter(function(p){ | ||
if(expr.test && expr.test(p)) { | ||
return false; | ||
} else if(p.substr(expr.length) == expr) { | ||
return false; | ||
if(expr.test) { // regexp | ||
return !expr.test(p); | ||
} | ||
return true; | ||
// string | ||
expr = path.normalize(expr); | ||
return (p.substr(p.length - expr.length) != expr); | ||
}) | ||
@@ -52,0 +52,0 @@ }); |
@@ -1,36 +0,3 @@ | ||
var Minilog = require('minilog'); | ||
var styles = { | ||
//styles | ||
'bold' : ['\033[1m', '\033[22m'], | ||
'italic' : ['\033[3m', '\033[23m'], | ||
'underline' : ['\033[4m', '\033[24m'], | ||
'inverse' : ['\033[7m', '\033[27m'], | ||
//grayscale | ||
'white' : ['\033[37m', '\033[39m'], | ||
'grey' : ['\033[90m', '\033[39m'], | ||
'black' : ['\033[30m', '\033[39m'], | ||
//colors | ||
'blue' : ['\033[34m', '\033[39m'], | ||
'cyan' : ['\033[36m', '\033[39m'], | ||
'green' : ['\033[32m', '\033[39m'], | ||
'magenta' : ['\033[35m', '\033[39m'], | ||
'red' : ['\033[31m', '\033[39m'], | ||
'yellow' : ['\033[33m', '\033[39m'] | ||
}, | ||
levelMap = { debug: 1, info: 2, warn: 3, error: 4 }; | ||
function style(str, style) { | ||
return styles[style][0] + str + styles[style][1]; | ||
} | ||
Minilog.pipe(Minilog.backends.nodeConsole).format(function(name, level, args) { | ||
var colors = { debug: 'blue', info: 'cyan', warn: 'yellow', error: 'red' }; | ||
return (name ? style(name +' ', 'grey') : '') | ||
+ (level ? style(level, colors[level]) + ' ' : '') | ||
+ args.join(' '); | ||
}); | ||
module.exports = require('./glue.js'); | ||
module.exports.defaults({ 'reqpath': require('path').dirname(require.cache[__filename].parent.filename) }); |
function require(e, t) { | ||
for (var n = [], r = e.split("/"), i, s, o = 0; s = r[o++]; ) ".." == s ? n.pop() : "." != s && n.push(s); | ||
for (var n = [], r = e.split("/"), i, s, o = 0; (s = r[o++]) != null; ) ".." == s ? n.pop() : "." != s && n.push(s); | ||
n = n.join("/"), o = require, s = o.m[t || 0], i = s[n + ".js"] || s[n + "/index.js"] || s[n], r = 'Cannot require("' + n + '")'; | ||
@@ -4,0 +4,0 @@ if (!i) throw Error(r); |
@@ -1,1 +0,1 @@ | ||
function require(e,t){for(var n=[],r=e.split("/"),i,s,o=0;s=r[o++];)".."==s?n.pop():"."!=s&&n.push(s);n=n.join("/"),o=require,s=o.m[t||0],i=s[n+".js"]||s[n+"/index.js"]||s[n],r='Cannot require("'+n+'")';if(!i)throw Error(r);if(s=i.c)i=o.m[t=s][e=i.m];if(!i)throw Error(r);return i.exports||i(i,i.exports={},function(n){return o("."!=n.charAt(0)?n:e+"/../"+n,t)}),i.exports}; | ||
function require(e,t){for(var n=[],r=e.split("/"),i,s,o=0;(s=r[o++])!=null;)".."==s?n.pop():"."!=s&&n.push(s);n=n.join("/"),o=require,s=o.m[t||0],i=s[n+".js"]||s[n+"/index.js"]||s[n],r='Cannot require("'+n+'")';if(!i)throw Error(r);if(s=i.c)i=o.m[t=s][e=i.m];if(!i)throw Error(r);return i.exports||i(i,i.exports={},function(n){return o("."!=n.charAt(0)?n:e+"/../"+n,t)}),i.exports}; |
function require(p, context) { | ||
/* normalize function: Use index presence to iterate arrays of truthy items */ | ||
for (var normalized = [], parts = p.split('/'), mod, temp, i = 0; temp = parts[i++]; ) { | ||
for (var normalized = [], parts = p.split('/'), mod, temp, i = 0; (temp = parts[i++]) != null; ) { | ||
if ('..' == temp) normalized.pop(); | ||
@@ -5,0 +5,0 @@ else if ('.' != temp) normalized.push(temp); |
{ | ||
"name": "gluejs", | ||
"description": "Build CommonJS modules for the browser via a chainable API", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": { | ||
@@ -25,3 +25,3 @@ "name": "Mikito Takada", | ||
"package-json-resolver": "0.0.1", | ||
"minilog": "0.0.4", | ||
"minilog": "2.0.0", | ||
"argsparser": "0.0.6" | ||
@@ -28,0 +28,0 @@ }, |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
32014
526
+ Addedmicroee@0.0.2(transitive)
+ Addedminilog@2.0.0(transitive)
- Removedminilog@0.0.4(transitive)
Updatedminilog@2.0.0