Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16a94a769a | ||
|
|
f7c7918efe | ||
|
|
bf393c025f | ||
|
|
bbbc9c0c5e | ||
|
|
579db9107f | ||
|
|
d1d30e9ec9 | ||
|
|
ee782f93c4 | ||
|
|
9ed6aa48a0 | ||
|
|
ecebedd5a2 | ||
|
|
31df576d26 | ||
|
|
63d6335d99 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -11,6 +11,18 @@
|
||||
|
||||
_Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
## 3.1.1
|
||||
|
||||
* **Polish**
|
||||
* Drop `enumerable: false` clause from class method definitions as `enumerable` already defaults to `false`.
|
||||
* **Bug Fix**
|
||||
* Properly transform `XJSIdentifier` nodes referencing `this` into a `ThisExpression`.
|
||||
|
||||
## 3.1.0
|
||||
|
||||
* **Breaking Change**
|
||||
* [Make class methods unenumerable](https://esdiscuss.org/topic/classes-and-enumerability#content-61).
|
||||
|
||||
## 3.0.16
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -231,6 +231,7 @@ Class.prototype.pushMethod = function (node) {
|
||||
}
|
||||
|
||||
util.pushMutatorMap(mutatorMap, methodName, kind, node.computed, node);
|
||||
util.pushMutatorMap(mutatorMap, methodName, "enumerable", node.computed, false);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
var esutils = require("esutils");
|
||||
var t = require("../../../types");
|
||||
|
||||
exports.JSXIdentifier = function (node) {
|
||||
if (esutils.keyword.isIdentifierName(node.name)) {
|
||||
exports.JSXIdentifier = function (node, parent) {
|
||||
if (node.name === "this" && t.isReferenced(node, parent)) {
|
||||
return t.thisExpression();
|
||||
} else if (esutils.keyword.isIdentifierName(node.name)) {
|
||||
node.type = "Identifier";
|
||||
} else {
|
||||
return t.literal(node.name);
|
||||
|
||||
@@ -81,7 +81,7 @@ exports.sourceMapToComment = function (map) {
|
||||
return "//# sourceMappingURL=data:application/json;base64," + base64;
|
||||
};
|
||||
|
||||
exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
|
||||
exports.pushMutatorMap = function (mutatorMap, key, kind, computed, value) {
|
||||
var alias;
|
||||
|
||||
if (t.isIdentifier(key)) {
|
||||
@@ -106,7 +106,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
|
||||
map._computed = true;
|
||||
}
|
||||
|
||||
map[kind] = method;
|
||||
map[kind] = value;
|
||||
};
|
||||
|
||||
exports.buildDefineProperties = function (mutatorMap) {
|
||||
@@ -121,7 +121,12 @@ exports.buildDefineProperties = function (mutatorMap) {
|
||||
map.writable = t.literal(true);
|
||||
}
|
||||
|
||||
map.enumerable = t.literal(true);
|
||||
if (map.enumerable === false) {
|
||||
delete map.enumerable;
|
||||
} else {
|
||||
map.enumerable = t.literal(true);
|
||||
}
|
||||
|
||||
map.configurable = t.literal(true);
|
||||
|
||||
each(map, function (node, key) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "3.0.16",
|
||||
"version": "3.1.1",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://6to5.org/",
|
||||
"repository": "6to5/6to5",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5-runtime",
|
||||
"description": "6to5 selfContained runtime",
|
||||
"version": "3.0.15",
|
||||
"version": "3.1.0",
|
||||
"repository": "6to5/6to5",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>"
|
||||
}
|
||||
@@ -17,4 +17,4 @@ for (var key in point) {
|
||||
}
|
||||
|
||||
assert.equal(point.toString(), '(1, 2)');
|
||||
assert.deepEqual(keys.sort(), ['toString', 'x', 'y']);
|
||||
assert.deepEqual(keys.sort(), ['x', 'y']);
|
||||
|
||||
@@ -25,4 +25,4 @@ var forLoopProperties = [];
|
||||
for (var key in mazer) {
|
||||
forLoopProperties.push(key);
|
||||
}
|
||||
assert.ok(forLoopProperties.indexOf('name') >= 0, 'getters/setters are enumerable');
|
||||
assert.ok(forLoopProperties.indexOf('name') === -1, 'getters/setters should be unenumerable');
|
||||
|
||||
@@ -13,10 +13,9 @@ var Foo = (function () {
|
||||
var wat = yield bar();
|
||||
}),
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -13,10 +13,9 @@ var Foo = (function () {
|
||||
var wat = yield bar();
|
||||
}),
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -32,7 +32,6 @@ var Test = (function (Foo) {
|
||||
(_get2 = _get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
}, {
|
||||
@@ -44,7 +43,6 @@ var Test = (function (Foo) {
|
||||
(_get2 = _get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,7 +20,6 @@ var Test = (function (Foo) {
|
||||
return _get(Object.getPrototypeOf(Test), "wow", this).call(this);
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,7 +13,6 @@ var Test = (function () {
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ var Test = (function () {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,7 +11,6 @@ var Test = (function () {
|
||||
return 5 + 5;
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ var Test = (function () {
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,7 +19,6 @@ var BaseView = (function () {
|
||||
this.autoRender = true;
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,13 +9,11 @@ var A = (function () {
|
||||
a: {
|
||||
value: function a() {},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
},
|
||||
b: {
|
||||
get: function () {},
|
||||
set: function (b) {},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,14 +12,12 @@ var Foo = (function () {
|
||||
get: function () {
|
||||
return _defineProperty(this, "bar", complex()).bar;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
}, bar, {
|
||||
get: function () {
|
||||
return _defineProperty(this, bar, complex())[bar];
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}));
|
||||
|
||||
|
||||
3
test/fixtures/transformation/react/arrow-functions/actual.js
vendored
Normal file
3
test/fixtures/transformation/react/arrow-functions/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var foo = function () {
|
||||
return () => <this />;
|
||||
};
|
||||
6
test/fixtures/transformation/react/arrow-functions/expected.js
vendored
Normal file
6
test/fixtures/transformation/react/arrow-functions/expected.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
var foo = function () {
|
||||
var _this = this;
|
||||
return function () {
|
||||
return React.createElement(_this, null);
|
||||
};
|
||||
};
|
||||
@@ -10,7 +10,6 @@ var Test = (function () {
|
||||
get: function () {
|
||||
throw new Error("wow");
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user