Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1841f5c8a0 | ||
|
|
33f8988313 | ||
|
|
af997b9945 | ||
|
|
a2332f08bc | ||
|
|
115dca56b6 | ||
|
|
251e4d01c8 | ||
|
|
530ad78428 | ||
|
|
51f72ace57 | ||
|
|
2fa36b30d5 |
@@ -4,7 +4,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/sebmck/6to5">
|
||||
<img alt="Travis Status" src="http://img.shields.io/travis/sebmck/6to5.svg?style=flat&label=travis">
|
||||
<img alt="Travis Status" src="http://img.shields.io/travis/sebmck/6to5.svg?branch=master&style=flat&label=travis">
|
||||
</a>
|
||||
|
||||
<a href="https://codeclimate.com/github/sebmck/6to5">
|
||||
@@ -102,6 +102,10 @@ map embedded in a comment at the bottom.
|
||||
Compile the entire `src` directory and output it to the `lib` directory.
|
||||
|
||||
$ 6to5 src --out-dir lib
|
||||
|
||||
Compile the entire `src` directory and output it to the one concatenated file.
|
||||
|
||||
$ 6to5 src --out-file script-compiled.js
|
||||
|
||||
Pipe a file in via stdin and output it to `script-compiled.js`
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ transform.transformers = {
|
||||
forOf: require("./transformers/for-of"),
|
||||
unicodeRegex: require("./transformers/unicode-regex"),
|
||||
generators: require("./transformers/generators"),
|
||||
numericLiterals: require("./transformers/numeric-literals"),
|
||||
|
||||
react: require("./transformers/react"),
|
||||
jsx: require("./transformers/jsx"),
|
||||
|
||||
@@ -148,5 +148,22 @@ exports.VariableDeclaration = function (node, parent, file) {
|
||||
}
|
||||
});
|
||||
|
||||
if (parent.type !== "Program" && parent.type !== "BlockStatement") {
|
||||
var declar;
|
||||
|
||||
_.each(nodes, function (node) {
|
||||
declar = declar || b.variableDeclaration(node.kind, []);
|
||||
|
||||
if (node.type !== "VariableDeclaration" && declar.kind !== node.kind) {
|
||||
throw util.errorWithNode(node, "Cannot use this node within the current parent");
|
||||
}
|
||||
|
||||
declar.declarations = declar.declarations.concat(node.declarations);
|
||||
});
|
||||
|
||||
return declar;
|
||||
}
|
||||
|
||||
return nodes;
|
||||
};
|
||||
|
||||
|
||||
6
lib/6to5/transformers/numeric-literals.js
Normal file
6
lib/6to5/transformers/numeric-literals.js
Normal file
@@ -0,0 +1,6 @@
|
||||
var _ = require("lodash");
|
||||
|
||||
exports.Literal = function (node) {
|
||||
// TODO: remove this when the new code generator is released
|
||||
if (_.isNumber(node.value)) delete node.raw;
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "1.10.8",
|
||||
"version": "1.10.10",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/sebmck/6to5",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user