Compare commits

...

11 Commits

Author SHA1 Message Date
Sebastian McKenzie
36423f2e78 v4.2.0 2015-02-18 11:28:53 +11:00
Sebastian McKenzie
06eaba5ad1 add 4.2.0 changelog 2015-02-18 11:26:46 +11:00
Sebastian McKenzie
7e8cd2ca8a i'm a terrible spellerer #777 2015-02-18 11:24:51 +11:00
Sebastian McKenzie
2541dcf960 bump acorn 2015-02-18 10:25:59 +11:00
Sebastian McKenzie
5d45e1475c Merge branch 'master' of github.com:6to5/6to5 2015-02-18 10:22:33 +11:00
Sebastian McKenzie
9964de9b2f remove redundant unknown transformer error message 2015-02-18 10:22:07 +11:00
Sebastian McKenzie
5b75b11628 add error message to use of eval(); and enable strict mode on the parser 2015-02-18 10:21:57 +11:00
Sebastian McKenzie
1890fb5bd3 add loose mode to __esModule 2015-02-18 10:21:32 +11:00
Sebastian McKenzie
df20b3df5a Merge pull request #815 from kolodny/iojs-test
add iojs to travis
2015-02-18 08:46:38 +11:00
Moshe Kolodny
56e74dfd10 add iojs to travis 2015-02-17 13:31:45 -05:00
Sebastian McKenzie
513d05143a 4.1.1 2015-02-18 00:01:55 +11:00
16 changed files with 42 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs"
branches:
except:

View File

@@ -7,7 +7,7 @@
* **Bug Fix**
* Fix temp variables not being properly pushed inside of `while` loops.
* **New Feature**
* Add `auxilaryComment`/`--auxilary-comment` option that prepends comments to auxilary helpers.
* Add `auxiliaryComment`/`--auxiliary-comment` option that prepends comments to auxiliary helpers.
## 3.6.5

View File

@@ -13,6 +13,13 @@ _Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 4.2.0
* **Polish**
* Use an assignment instead of a define for `__esModule` in loose mode.
* **Internal**
* Add error for `eval();` usage and enable strict mode for parsing.
## 4.1.0
* **New Feature**

View File

@@ -26,7 +26,7 @@ commander.option("-c, --remove-comments", "Remove comments from the compiled cod
commander.option("-M, --module-ids", "Insert module id in modules", false);
commander.option("-R, --react-compat", "Makes the react transformer produce pre-v0.12 code");
commander.option("--keep-module-id-extensions", "Keep extensions when generating module ids", false);
commander.option("-a, --auxilary-comment [comment]", "Comment text to prepend to all auxilary code");
commander.option("-a, --auxiliary-comment [comment]", "Comment text to prepend to all auxiliary code");
commander.on("--help", function () {
var outKeys = function (title, obj) {
@@ -100,7 +100,7 @@ if (errors.length) {
exports.opts = {
keepModuleIdExtensions: commander.keepModuleIdExtensions,
auxilaryComment: commander.auxilaryComment,
auxiliaryComment: commander.auxiliaryComment,
externalHelpers: commander.externalHelpers,
sourceMapName: commander.outFile,
experimental: commander.experimental,

View File

@@ -16,7 +16,8 @@ exports.messages = {
readOnly: "$1 is read-only",
modulesIllegalExportName: "Illegal export $1",
unknownForHead: "Unknown node type $1 in ForStatement",
didYouMean: "Did you mean $1?"
didYouMean: "Did you mean $1?",
evalInStrictMode: "eval is not allowed in strict mode"
};
exports.get = function (key) {

View File

@@ -87,7 +87,7 @@ File.validOptions = [
"experimental",
"resolveModuleSource",
"externalHelpers",
"auxilaryComment",
"auxiliaryComment",
// these are used by plugins
"ignore",
@@ -302,8 +302,8 @@ File.prototype.isConsequenceExpressionStatement = function (node) {
return t.isExpressionStatement(node) && this.lastStatements.indexOf(node) >= 0;
};
File.prototype.attachAuxilaryComment = function (node) {
var comment = this.opts.auxilaryComment;
File.prototype.attachAuxiliaryComment = function (node) {
var comment = this.opts.auxiliaryComment;
if (comment) {
node.leadingComments = node.leadingComments || [];
node.leadingComments.push({
@@ -368,7 +368,7 @@ File.prototype.parse = function (code) {
var opts = this.opts;
opts.allowImportExportEverywhere = this.isLoose("es6.modules");
//opts.strictMode = this.transformers.useStrict.canRun();
opts.strictMode = this.transformers.useStrict.canRun();
return parse(opts, code, function (tree) {
self.transform(tree);

View File

@@ -41,12 +41,7 @@ transform._ensureTransformerNames = function (type, rawKeys) {
keys = keys.concat(transform.namespaces[key]);
} else {
// invalid key
throw new ReferenceError(
"Unknown transformer " + key + " specified in " + type + " - " +
"transformer key names have been changed in 3.0.0 see " +
"the changelog for more info " +
"https://github.com/babel/babel/blob/master/CHANGELOG.md#300"
);
throw new ReferenceError("Unknown transformer " + key + " specified in " + type);
}
}

View File

@@ -20,7 +20,9 @@ CommonJSFormatter.prototype.init = function () {
scope.rename("module");
if (!this.noInteropRequireImport && this.hasNonDefaultExports) {
file.ast.program.body.push(util.template("exports-module-declaration", true));
var templateName = "exports-module-declaration";
if (this.file.isLoose("es6.modules")) templateName += "-loose";
file.ast.program.body.push(util.template(templateName, true));
}
};

View File

@@ -0,0 +1 @@
exports.__esModule = true;

View File

@@ -20,7 +20,7 @@ exports.Program = function (node, parent, scope, file) {
var declarNode = t.variableDeclarator(declar.id, declar.init);
if (declar.init) {
node.body.unshift(file.attachAuxilaryComment(t.variableDeclaration(kind, [declarNode])));
node.body.unshift(file.attachAuxiliaryComment(t.variableDeclaration(kind, [declarNode])));
} else {
kinds[kind] = kinds[kind] || [];
kinds[kind].push(declarNode);
@@ -28,7 +28,7 @@ exports.Program = function (node, parent, scope, file) {
}
for (kind in kinds) {
node.body.unshift(file.attachAuxilaryComment(t.variableDeclaration(kind, kinds[kind])));
node.body.unshift(file.attachAuxiliaryComment(t.variableDeclaration(kind, kinds[kind])));
}
});

View File

@@ -1,6 +1,7 @@
"use strict";
var useStrict = require("../../helpers/use-strict");
var messages = require("../../../messages");
var t = require("../../../types");
exports.Program = function (program) {
@@ -17,3 +18,9 @@ exports.FunctionExpression = function () {
exports.ThisExpression = function () {
return t.identifier("undefined");
};
exports.CallExpression = function (node, parent, scope, file) {
if (t.isIdentifier(node.callee, { name: "eval" })) {
throw file.errorWithNode(node, messages.get("evalInStrictMode"));
}
};

View File

@@ -1,7 +1,7 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "4.1.1",
"version": "4.2.0",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"repository": "babel/babel",
@@ -38,7 +38,7 @@
"test": "make test"
},
"dependencies": {
"acorn-babel": "0.11.1-32",
"acorn-babel": "0.11.1-33",
"ast-types": "~0.6.1",
"chalk": "^0.5.1",
"chokidar": "^0.12.6",

View File

@@ -1,7 +1,7 @@
{
"name": "babel-runtime",
"description": "babel selfContained runtime",
"version": "4.0.2",
"version": "4.1.1",
"repository": "babel/babel",
"author": "Sebastian McKenzie <sebmck@gmail.com>"
}

View File

@@ -0,0 +1 @@
export var foo = 5;

View File

@@ -0,0 +1,4 @@
"use strict";
var foo = exports.foo = 5;
exports.__esModule = true;

View File

@@ -0,0 +1,3 @@
{
"loose": "es6.modules"
}