Compare commits

...

15 Commits

Author SHA1 Message Date
Sebastian McKenzie
708cdfb993 v5.0.9 2015-04-06 06:28:58 -07:00
Sebastian McKenzie
8cb3aabefa add 5.0.9 changelog 2015-04-06 06:26:11 -07:00
Sebastian McKenzie
4a87b35d20 fix function name self referencing test 2015-04-06 06:23:46 -07:00
Sebastian McKenzie
543554b258 flow tests style nit 2015-04-06 06:20:09 -07:00
Sebastian McKenzie
afd95cf663 add #1168 regression test 2015-04-06 06:20:05 -07:00
Sebastian McKenzie
87ce4b9cd8 fix order of parameter type annotation parsing - fixes #1168 2015-04-06 06:19:13 -07:00
Sebastian McKenzie
6b76f26ed8 use module id if available for umd global name - fixes #1166 2015-04-06 06:14:09 -07:00
Sebastian McKenzie
c2776e63ae rename umd module variable name - fixes #1166 2015-04-06 06:13:43 -07:00
Sebastian McKenzie
3f2fe363d1 Merge pull request #1163 from chocolateboy/babel_node_print_fix
babel-node --print: don't mangle percent characters (%)
2015-04-06 06:06:21 -07:00
Sebastian McKenzie
8de28098f4 Merge pull request #1170 from alawatthe/master
Replaced FUNCTION_ID by FUNCTION_KEY - fixes #1164
2015-04-06 06:02:49 -07:00
alawatthe
9a28f3fdb1 Replaced FUNCTION_ID by FUNCTION_KEY - fixes #1164 2015-04-06 10:53:41 +02:00
chocolateboy
88941b3270 babel-node --print: don't mangle percent characters (%)
This applies the babel fix in #528 to babel-node.

before:

    $ babel-node --print --eval '"%%"'
    '%'

after:

    $ babel-node --print --eval '"%%"'
    '%%'
2015-04-05 06:26:29 +01:00
Sebastian McKenzie
3a768db2bf fix missing this in acorn parseExprAtom 2015-04-05 03:26:41 +10:00
Sebastian McKenzie
320a39f4c4 fix computed properties in es7 object rest/spread - thanks @AluisioASG! 2015-04-05 02:52:14 +10:00
Sebastian McKenzie
dc98ac7c93 5.0.8 2015-04-04 17:09:35 +11:00
39 changed files with 139 additions and 85 deletions

View File

@@ -13,6 +13,15 @@ _Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 5.0.9
* **Polish**
* Use `moduleId` for UMD global name if available.
* **Bug Fix**
* Fix UMD global `module` variable shadowing the `amd`/`common` `module` variable.
* Fix Flow param type annotation regression.
* Fix function name collision `toString` wrapper. Thanks [@alawatthe](https://github.com/alawatthe)!
## 5.0.8
* **Bug Fix**

View File

@@ -1,7 +1,7 @@
{
"name": "babel-core",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "5.0.8",
"version": "5.0.9",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"repository": "babel/babel",

View File

@@ -4,6 +4,7 @@ var pathIsAbsolute = require("path-is-absolute");
var commander = require("commander");
var Module = require("module");
var babel = require("babel-core");
var inspect = require("util").inspect;
var path = require("path");
var repl = require("repl");
var util = require("babel-core").util;
@@ -71,7 +72,10 @@ if (program.eval || program.print) {
global.require = module.require.bind(module);
var result = _eval(code, global.__filename);
if (program.print) console.log(result);
if (program.print) {
var output = _.isString(result) ? result : inspect(result);
process.stdout.write(output + "\n");
}
} else {
if (program.args.length) {
// slice all arguments up to the first filename since they're babel args that we handle

View File

@@ -1,14 +1,14 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "5.0.7",
"version": "5.0.8",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"repository": "babel/babel",
"preferGlobal": true,
"dependencies": {
"chokidar": "^0.12.6",
"babel-core": "^5.0.7",
"babel-core": "^5.0.8",
"commander": "^2.6.0",
"fs-readdir-recursive": "^0.1.0",
"output-file-sync": "^1.1.0",

View File

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

View File

@@ -250,7 +250,7 @@ pp.parseExprAtom = function(refShorthandDefaultPos) {
return this.finishNode(node, type)
case tt._yield:
if (this.inGenerator) unexpected()
if (this.inGenerator) this.unexpected()
case tt._do:
if (this.options.features["es7.doExpressions"]) {

View File

@@ -125,7 +125,9 @@ pp.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
this.expect(close)
break
} else {
elts.push(this.parseAssignableListItemTypes(this.parseMaybeDefault()))
var left = this.parseMaybeDefault()
this.parseAssignableListItemTypes(left)
elts.push(this.parseMaybeDefault(null, left))
}
}
return elts

View File

@@ -47,8 +47,8 @@ export default class UMDFormatter extends AMDFormatter {
// globals
var browserArgs = [t.memberExpression(t.identifier("module"), t.identifier("exports"))];
if (this.passModuleArg) browserArgs.push(t.identifier("module"));
var browserArgs = [];
if (this.passModuleArg) browserArgs.push(t.identifier("mod"));
for (let name in this.ids) {
var id = this.defaultIds[name] || t.identifier(t.toIdentifier(name));
@@ -60,12 +60,17 @@ export default class UMDFormatter extends AMDFormatter {
var moduleName = this.getModuleName();
if (moduleName) defineArgs.unshift(t.literal(moduleName));
//
var globalArg = this.file.opts.basename;
if (moduleName) globalArg = moduleName;
globalArg = t.identifier(t.toIdentifier(globalArg));
var runner = util.template("umd-runner-body", {
AMD_ARGUMENTS: defineArgs,
COMMON_TEST: commonTests,
COMMON_ARGUMENTS: commonArgs,
BROWSER_ARGUMENTS: browserArgs,
GLOBAL_ARG: t.identifier(t.toIdentifier(this.file.opts.basename))
GLOBAL_ARG: globalArg
});
//

View File

@@ -4,7 +4,7 @@
}
FUNCTION_ID.toString = function () {
return FUNCTION_ID.toString();
return FUNCTION_KEY.toString();
};
return FUNCTION_ID;

View File

@@ -4,7 +4,7 @@
}
FUNCTION_ID.toString = function () {
return FUNCTION_ID.toString();
return FUNCTION_KEY.toString();
}
return FUNCTION_ID;

View File

@@ -4,8 +4,8 @@
} else if (COMMON_TEST) {
factory(COMMON_ARGUMENTS);
} else {
var module = { exports: {} };
factory(BROWSER_ARGUMENTS);
global.GLOBAL_ARG = module.exports;
var mod = { exports: {} };
factory(mod.exports, BROWSER_ARGUMENTS);
global.GLOBAL_ARG = mod.exports;
}
});

View File

@@ -332,7 +332,7 @@ class DestructuringTransformer {
if (t.isSpreadProperty(prop)) continue;
var key = prop.key;
if (t.isIdentifier(key)) key = t.literal(prop.key.name);
if (t.isIdentifier(key) && !prop.computed) key = t.literal(prop.key.name);
keys.push(key);
}

View File

@@ -10959,7 +10959,7 @@ var fbTestFixture = {
}
},
},
'Bounded Polymorphism': {
'Bounded Polymorphism': {
'class A<T: Foo> {}': {
type: 'ClassDeclaration',
id: {

View File

@@ -1,4 +1,5 @@
var z = {};
var { ...x } = z;
var { x, ...y } = z;
var { [x]: x, ...y } = z;
(function({ x, ...y }) { })

View File

@@ -4,6 +4,8 @@ var z = {};
var x = babelHelpers.objectWithoutProperties(z, []);
var x = z.x;
var y = babelHelpers.objectWithoutProperties(z, ["x"]);
var x = z[x];
var y = babelHelpers.objectWithoutProperties(z, [x]);
(function (_ref) {
var x = _ref.x;

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined" && typeof module !== "undefined") {
factory(exports, module);
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, module);
global.actual = module.exports;
factory(mod.exports, mod);
global.actual = mod.exports;
}
})(this, function (exports, module) {
"use strict";
@@ -41,4 +41,4 @@
module.exports = Foo;
module.exports = foo;
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo);
global.actual = module.exports;
factory(mod.exports, global.foo);
global.actual = mod.exports;
}
})(this, function (exports, _foo) {
"use strict";

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports);
global.actual = module.exports;
factory(mod.exports);
global.actual = mod.exports;
}
})(this, function (exports) {
"use strict";
@@ -23,4 +23,4 @@
exports["default"] = foo;
exports["default"] = foo;
exports.bar = bar;
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports);
global.actual = module.exports;
factory(mod.exports);
global.actual = mod.exports;
}
})(this, function (exports) {
"use strict";
@@ -43,4 +43,4 @@
};
exports.foo8 = foo8;
});
});

View File

@@ -4,12 +4,12 @@
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports);
global.actual = module.exports;
factory(mod.exports);
global.myCustomModuleName = mod.exports;
}
})(this, function (exports) {
"use strict";
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("./evens"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.evens);
global.actual = module.exports;
factory(mod.exports, global.evens);
global.actual = mod.exports;
}
})(this, function (exports, _evens) {
"use strict";
@@ -28,4 +28,4 @@
};
})(_evens.isEven);
exports.isOdd = isOdd;
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo);
global.actual = module.exports;
factory(mod.exports, global.foo);
global.actual = mod.exports;
}
})(this, function (exports, _foo) {
"use strict";
@@ -21,4 +21,4 @@
_foo2;
_foo22;
});
});

View File

@@ -4,14 +4,14 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo);
global.actual = module.exports;
factory(mod.exports, global.foo);
global.actual = mod.exports;
}
})(this, function (exports, _foo) {
"use strict";
_foo;
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo);
global.actual = module.exports;
factory(mod.exports, global.foo);
global.actual = mod.exports;
}
})(this, function (exports, _foo) {
"use strict";
@@ -18,4 +18,4 @@
var _foo2 = _interopRequire(_foo);
_foo.baz;
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo);
global.actual = module.exports;
factory(mod.exports, global.foo);
global.actual = mod.exports;
}
})(this, function (exports, _foo) {
"use strict";
@@ -19,4 +19,4 @@
_foo.bar;
_foo.bar;
_foo.xyz;
});
});

View File

@@ -4,12 +4,12 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo, global.fooBar, global.directoryFooBar);
global.actual = module.exports;
factory(mod.exports, global.foo, global.fooBar, global.directoryFooBar);
global.actual = mod.exports;
}
})(this, function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
});
});

View File

@@ -0,0 +1 @@
foobar();

View File

@@ -0,0 +1,17 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define("MyLib", ["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.MyLib = mod.exports;
}
})(this, function (exports) {
"use strict";
foobar();
});

View File

@@ -0,0 +1,3 @@
{
"moduleId": "MyLib"
}

View File

@@ -4,14 +4,14 @@
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports);
global.actual = module.exports;
factory(mod.exports);
global.es6ModulesUmdModuleNameExpected = mod.exports;
}
})(this, function (exports) {
"use strict";
foobar();
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo2, global.fooBar, global.directoryFooBar);
global.actual = module.exports;
factory(mod.exports, global.foo2, global.fooBar, global.directoryFooBar);
global.actual = mod.exports;
}
})(this, function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
@@ -29,4 +29,4 @@
_foo.bar;
_foo.foo;
});
});

View File

@@ -4,11 +4,11 @@
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports);
global.actual = module.exports;
factory(mod.exports);
global.actual = mod.exports;
}
})(this, function (exports) {
"use strict";
@@ -42,4 +42,4 @@
exports.f = d;
exports.f = exports.e = d = 4;
});
});

View File

@@ -0,0 +1,3 @@
function test(x: string = "hi"): string {
return x;
}

View File

@@ -0,0 +1,7 @@
"use strict";
function test() {
var x = arguments[0] === undefined ? "hi" : arguments[0];
return x;
}

View File

@@ -4,14 +4,14 @@
} else if (typeof exports !== "undefined") {
factory(exports, require("foo"), require("babel-runtime/helpers/interop-require"));
} else {
var module = {
var mod = {
exports: {}
};
factory(module.exports, global.foo, global._interopRequire);
global.actual = module.exports;
factory(mod.exports, global.foo, global._interopRequire);
global.actual = mod.exports;
}
})(this, function (exports, _foo, _babelRuntimeHelpersInteropRequire) {
"use strict";
var _foo2 = _babelRuntimeHelpersInteropRequire["default"](_foo);
});
});

View File

@@ -6,7 +6,7 @@ var i = (function (_i) {
}
i.toString = function () {
return i.toString();
return _i.toString();
};
return i;
@@ -17,4 +17,4 @@ var i = (function (_i) {
var j = function j() {
var _ = 5;
j = _.j;
};
};

View File

@@ -13,7 +13,7 @@ var obj = {
}
h.toString = function () {
return h.toString();
return _h.toString();
};
return h;
@@ -24,4 +24,4 @@ var obj = {
m: function m() {
doSmth();
}
};
};

View File

@@ -10,7 +10,7 @@ var f = (function (_f) {
}
f.toString = function () {
return f.toString();
return _f.toString();
};
return f;
@@ -23,9 +23,9 @@ var obj = {
}
f.toString = function () {
return f.toString();
return _f2.toString();
};
return f;
})(function (f) {})
};
};

View File

@@ -6,10 +6,10 @@ var f = (function (_f) {
}
f.toString = function () {
return f.toString();
return _f.toString();
};
return f;
})(function () {
console.log(f, g);
});
});