Comparing version 0.3.0 to 0.3.1
@@ -17,2 +17,6 @@ var env = process.env.NODE_ENV || 'development'; | ||
} | ||
// Make `instanceof Mirror` work and allow recursive embedding. | ||
assets.__proto__ = this; | ||
if (!options) options = {}; | ||
@@ -22,4 +26,7 @@ | ||
if (!options.type) { | ||
if (assets.length) options.type = path.extname(assets[0]).toLowerCase(); | ||
else options.type = '.js'; | ||
if (assets.length && !assets[0].join) { | ||
options.type = path.extname(assets[0]).toLowerCase(); | ||
} else { | ||
options.type = '.txt'; | ||
} | ||
} else if (options.type[0] !== '.') { | ||
@@ -52,8 +59,8 @@ options.type = '.' + options.type.toLowerCase(); | ||
this.handler.mirror = this; | ||
this.handler.content = this.content; | ||
return this.handler; | ||
return assets; | ||
}; | ||
// Make `instanceof Array` work on return values. | ||
Mirror.prototype.__proto__ = Array.prototype; | ||
Mirror.defaults = { | ||
@@ -90,2 +97,9 @@ maxAge: env === 'production' ? 3600 : 0, | ||
// Allow adding the files "array" as a express callback directly. This is a | ||
// shortcut that only works with express because it calls files.call(). | ||
// In new code, use files.handler instead. | ||
Mirror.prototype.call = function(_, req, res, next) { | ||
return this.handler(req, res, next); | ||
}; | ||
Mirror.prototype.handler = function(req, res, next) { | ||
@@ -92,0 +106,0 @@ this.content(function(err, data) { |
{ | ||
"name": "mirror", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Development Seed <info@developmentseed.org> (http://www.developmentseed.org)", | ||
@@ -5,0 +5,0 @@ "main": "./mirror", |
@@ -31,3 +31,3 @@ var assert = require('assert'); | ||
status: 200 | ||
}, contentType('application/javascript; charset=utf-8')) | ||
}, contentType('text/plain; charset=utf-8')) | ||
}; | ||
@@ -34,0 +34,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
17143
408
0