Merge pull request #396 from caspervonb/master

Add .es to register extensions
This commit is contained in:
Sebastian McKenzie 2015-01-05 20:55:36 +11:00
commit 145413dbfd
4 changed files with 7 additions and 3 deletions

View File

@ -208,7 +208,7 @@ result.ast;
### Require hook
All subsequent files required by node with the extensions `.es6` and `.js` will
All subsequent files required by node with the extensions `.es6`, `.es` and `.js` will
be transformed by 6to5. The polyfill specified in [Polyfill](polyfill.md) is
also required; but this is automatically loaded when using:

View File

@ -123,7 +123,7 @@ var hookExtensions = function (_exts) {
});
};
hookExtensions([".es6", ".js"]);
hookExtensions([".es6", ".es", ".js"]);
module.exports = function (opts) {
// normalise options

View File

@ -12,7 +12,7 @@ var _ = require("lodash");
exports.inherits = util.inherits;
exports.canCompile = function (filename, altExts) {
var exts = altExts || [".js", ".jsx", ".es6"];
var exts = altExts || [".js", ".jsx", ".es6", ".es"];
var ext = path.extname(filename);
return _.contains(exts, ext);
};

View File

@ -18,6 +18,10 @@ suite("util", function () {
assert.ok(util.canCompile("/test.es6"));
assert.ok(util.canCompile("/scripts/test.es6"));
assert.ok(util.canCompile("test.es"));
assert.ok(util.canCompile("/test.es"));
assert.ok(util.canCompile("/scripts/test.es"));
assert.ok(!util.canCompile("test"));
assert.ok(!util.canCompile("test.css"));
assert.ok(!util.canCompile("/test.css"));