Compare commits

...

7 Commits

Author SHA1 Message Date
Sebastian McKenzie
4744719040 v2.12.2 2015-01-14 18:48:29 +11:00
Sebastian McKenzie
a3b814a897 fix default parameters closure scope 2015-01-14 18:46:36 +11:00
Sebastian McKenzie
f5f17f0ccb ignore function params, rest and catch clauses - webpack/webpack#688 2015-01-14 18:39:07 +11:00
Sebastian McKenzie
f6a2acdfb1 v2.12.1 2015-01-14 18:06:51 +11:00
Sebastian McKenzie
e8dba2ad1e add 2.12.1 changelog 2015-01-14 18:05:11 +11:00
Sebastian McKenzie
8ce5c5b608 add jsx to possible extensions 2015-01-14 18:04:14 +11:00
Sebastian McKenzie
0dfea1a51b update notes 2015-01-14 14:54:31 +11:00
7 changed files with 28 additions and 5 deletions

View File

@@ -11,6 +11,16 @@
_Note: Gaps between patch versions are faulty/broken releases._
## 2.12.2
* **Internal**
* Exclude nodes in function parameters and catch clauses from `isReferenced` check.
## 2.12.1
* **Internal**
* Add `.jsx` to list of allowed extensions.
## 2.12.0
* **Bug Fix**

View File

@@ -10,4 +10,4 @@
* Split up ES5 getter/setter transforming and ES6 property methods into separate transformers.
* Add autoindentation.
* Move `super` transformation from classes into a separate transformer that also supports object expressions.
* Prefix all fast transformers with `fast`, make them declare that they're a fast transformer similar to optional transformers and add a `--fast` flag to enable them all.
* Remove fast transformer backwards compatibility.

View File

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

View File

@@ -45,7 +45,7 @@ exports.Function = function (node, parent, file, scope) {
}
// we're accessing a variable that's already defined within this function
var has = scope.get(param.name);
var has = scope.get(param.name, true);
if (has && node.params.indexOf(has) < 0) {
iife = true;
}

View File

@@ -193,6 +193,17 @@ t.isReferenced = function (node, parent) {
// we're a property key and we aren't computed so we aren't referenced
if (t.isProperty(parent) && parent.key === node && !parent.computed) return false;
if (t.isFunction(parent)) {
// we're a function param
if (_.contains(parent.params, node)) return false;
// we're a rest parameter
if (_.contains(parent.params, node)) return false;
}
// we're a catch clause param
if (t.isCatchClause(parent) && parent.param === node) return false;
// we're a variable declarator id so we aren't referenced
if (t.isVariableDeclarator(parent) && parent.id === node) return false;

View File

@@ -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;
};

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "2.12.0",
"version": "2.12.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://github.com/6to5/6to5",
"repository": {