From 5558f61518fad668e1a2f708a85ca26236f41592 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 30 Oct 2014 17:16:33 +1100 Subject: [PATCH] add more feature detection to 6to5/register --- lib/6to5/register.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/6to5/register.js b/lib/6to5/register.js index da10785944..553e62a5f9 100644 --- a/lib/6to5/register.js +++ b/lib/6to5/register.js @@ -6,7 +6,7 @@ var _ = require("lodash"); sourceMapSupport.install({ retrieveSourceMap: function (source) { - var map = maps[source]; + var map = maps && maps[source]; if (map) { return { url: null, @@ -31,8 +31,23 @@ var blacklistTest = function (transformer, code) { } }; -blacklistTest("generators", "function test *() {}"); -blacklistTest("letScoping", "let test = 0;"); +// array comprehension +blacklistTest("arrowFunctions", "var foo = x => x * x;"); +blacklistTest("classes", "class Foo {}"); +// computed property names +// constants +// defaultParamters +// descturing +// forOf +blacklistTest("generators", "function foo *() {}"); +blacklistTest("letScoping", "let foo = 0;"); +// modules +// propertyMethodAssignment +// propertyNameShorthand +// restParameters +// spread +blacklistTest("templateLiterals", "`foo`"); +blacklistTest("unicodeRegex", "/foo/u"); // @@ -79,5 +94,9 @@ module.exports = function (opts) { ignoreRegex = opts.ignoreRegex; } + if (opts.blacklist) { + blacklist = opts.blacklist; + } + if (opts.extensions) hookExtensions(opts.extensions); };