From 8ce5c5b6088fc3385cc64a25e0fbfe0e9045a8c0 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 14 Jan 2015 15:09:15 +1100 Subject: [PATCH] add jsx to possible extensions --- lib/6to5/register.js | 2 +- lib/6to5/util.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/6to5/register.js b/lib/6to5/register.js index d73532e1e9..f8647bea85 100644 --- a/lib/6to5/register.js +++ b/lib/6to5/register.js @@ -123,7 +123,7 @@ var hookExtensions = function (_exts) { }); }; -hookExtensions([".es6", ".es", ".js"]); +hookExtensions(util.canCompile.EXTENSIONS); module.exports = function (opts) { // normalise options diff --git a/lib/6to5/util.js b/lib/6to5/util.js index d161eec184..66af587e4f 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -12,11 +12,13 @@ var _ = require("lodash"); exports.inherits = util.inherits; exports.canCompile = function (filename, altExts) { - var exts = altExts || [".js", ".jsx", ".es6", ".es"]; + var exts = altExts || exports.canCompile.EXTENSIONS; var ext = path.extname(filename); return _.contains(exts, ext); }; +exports.canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"]; + exports.isInteger = function (i) { return _.isNumber(i) && i % 1 === 0; };