Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a0fd26f56 | ||
|
|
17583e4807 | ||
|
|
37dd5137ff | ||
|
|
24fced406e | ||
|
|
0ab1362893 | ||
|
|
96506f4249 | ||
|
|
ed747f88bd | ||
|
|
3987545b4f | ||
|
|
148aa3f96d | ||
|
|
0cb5a7c91e | ||
|
|
fc34d5a9b0 | ||
|
|
f8d56d9612 | ||
|
|
737be0e95e | ||
|
|
26e2b392e8 | ||
|
|
708cdfb993 | ||
|
|
8cb3aabefa | ||
|
|
4a87b35d20 | ||
|
|
543554b258 | ||
|
|
afd95cf663 | ||
|
|
87ce4b9cd8 | ||
|
|
6b76f26ed8 | ||
|
|
c2776e63ae | ||
|
|
3f2fe363d1 | ||
|
|
8de28098f4 | ||
|
|
9a28f3fdb1 | ||
|
|
88941b3270 | ||
|
|
3a768db2bf | ||
|
|
320a39f4c4 | ||
|
|
dc98ac7c93 | ||
|
|
6e456f0ec1 | ||
|
|
793090628d | ||
|
|
9ed251cb08 | ||
|
|
480fa7f4e0 | ||
|
|
3e642dfa1b | ||
|
|
d9cbce1862 | ||
|
|
4bd19da3c2 | ||
|
|
7c710a0378 | ||
|
|
56335409d3 | ||
|
|
91d78afc67 | ||
|
|
54c6339f20 |
27
CHANGELOG.md
27
CHANGELOG.md
@@ -13,6 +13,33 @@ _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**
|
||||
* Fix falsy static class properties not being writable.
|
||||
* Fix block scoping collisions not properly detecting modules and function clashes.
|
||||
* Skip `this` before `super` for derived constructors on functions.
|
||||
|
||||
## 5.0.7
|
||||
|
||||
* **New Feature**
|
||||
* Add `--ignore` and `--only` support to the CLI.
|
||||
* **Bug Fix**
|
||||
* Remove `HOMEPATH` environment variable from home resolution in `babel/register` cache.
|
||||
* **Internal**
|
||||
* Disable WIP path resolution introducing infinite recursion in some code examples.
|
||||
* **Polish**
|
||||
* Add live binding to CommonJS default imports.
|
||||
|
||||
## 5.0.6
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -35,13 +35,13 @@ This is mostly overkill and you can limit the tests to a select few by directly
|
||||
running them with `mocha`:
|
||||
|
||||
```sh
|
||||
$ mocha test/transformation.js
|
||||
$ mocha test/core/transformation.js
|
||||
```
|
||||
|
||||
Use mocha's `--grep` option to run a subset of tests by name:
|
||||
|
||||
```sh
|
||||
$ mocha test/transformation.js --grep es7
|
||||
$ mocha test/core/transformation.js --grep es7
|
||||
```
|
||||
|
||||
#### Workflow
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.0.7",
|
||||
"version": "5.0.10",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.0.6",
|
||||
"version": "5.0.9",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^0.12.6",
|
||||
"babel-core": "^5.0.6",
|
||||
"babel-core": "^5.0.9",
|
||||
"commander": "^2.6.0",
|
||||
"fs-readdir-recursive": "^0.1.0",
|
||||
"output-file-sync": "^1.1.0",
|
||||
@@ -22,4 +22,4 @@
|
||||
"babel-node": "./bin/babel-node",
|
||||
"babel-external-helpers": "./bin/babel-external-helpers"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.0.6",
|
||||
"version": "5.0.9",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"dependencies": {
|
||||
|
||||
@@ -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"]) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -46,7 +46,7 @@ var remapVisitor = {
|
||||
}
|
||||
}
|
||||
|
||||
if (t.isAssignmentExpression(node)) {
|
||||
if (t.isAssignmentExpression(node) && !node._ignoreModulesRemap) {
|
||||
var exported = formatter.getExport(node.left, scope);
|
||||
if (exported) {
|
||||
this.skip();
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if (descriptor.value) descriptor.writable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
FUNCTION_ID.toString = function () {
|
||||
return FUNCTION_ID.toString();
|
||||
return FUNCTION_KEY.toString();
|
||||
};
|
||||
|
||||
return FUNCTION_ID;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
FUNCTION_ID.toString = function () {
|
||||
return FUNCTION_ID.toString();
|
||||
return FUNCTION_KEY.toString();
|
||||
}
|
||||
|
||||
return FUNCTION_ID;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ var collectPropertyReferencesVisitor = {
|
||||
}
|
||||
|
||||
if (this.isReferenced() && scope.getBinding(node.name) === state.scope.getBinding(node.name)) {
|
||||
state.references[node.name] = true;;
|
||||
state.references[node.name] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,18 @@ var verifyConstructorVisitor = traverse.explode({
|
||||
}
|
||||
},
|
||||
|
||||
FunctionDeclaration: {
|
||||
enter() {
|
||||
this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
FunctionExpression: {
|
||||
enter() {
|
||||
this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
ThisExpression: {
|
||||
enter(node, parent, scope, state) {
|
||||
if (state.hasSuper && !state.hasBareSuper) {
|
||||
@@ -158,21 +170,36 @@ class ClassTransformer {
|
||||
|
||||
this.buildBody();
|
||||
|
||||
var decorators = this.node.decorators;
|
||||
var classCheckRef = classRef;
|
||||
|
||||
if (decorators) {
|
||||
classCheckRef = this.scope.generateUidIdentifier(classRef);
|
||||
}
|
||||
|
||||
constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("class-call-check"), [
|
||||
t.thisExpression(),
|
||||
classRef
|
||||
classCheckRef
|
||||
])));
|
||||
|
||||
//
|
||||
|
||||
var decorators = this.node.decorators;
|
||||
if (decorators) {
|
||||
if (this.className) {
|
||||
body.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(classCheckRef, classRef)
|
||||
]));
|
||||
}
|
||||
|
||||
for (var i = 0; i < decorators.length; i++) {
|
||||
var decorator = decorators[i];
|
||||
body.push(util.template("class-decorator", {
|
||||
|
||||
var decoratorNode = util.template("class-decorator", {
|
||||
DECORATOR: decorator.expression,
|
||||
CLASS_REF: classRef
|
||||
}, true));
|
||||
}, true);
|
||||
decoratorNode.expression._ignoreModulesRemap = true;
|
||||
body.push(decoratorNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +467,7 @@ class ClassTransformer {
|
||||
file: this.file
|
||||
};
|
||||
|
||||
path.traverse(verifyConstructorVisitor, state);
|
||||
path.get("value").traverse(verifyConstructorVisitor, state);
|
||||
|
||||
this.bareSuper = state.bareSuper;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -237,12 +237,12 @@ export default class Scope {
|
||||
var local = this.getOwnBindingInfo(name);
|
||||
if (!local) return;
|
||||
|
||||
|
||||
if (kind === "param") return;
|
||||
if (kind === "hoisted" && local.kind === "let") return;
|
||||
|
||||
|
||||
var duplicate = false;
|
||||
duplicate ||= local.kind === "let" || local.kind === "const" || local.kind === "module";
|
||||
duplicate ||= kind === "let" || kind === "const" || local.kind === "let" || local.kind === "const" || local.kind === "module";
|
||||
duplicate ||= local.kind === "param" && (kind === "let" || kind === "const");
|
||||
|
||||
if (duplicate) {
|
||||
@@ -477,6 +477,15 @@ export default class Scope {
|
||||
this.traverse(path.get("body").node, blockVariableVisitor, this);
|
||||
}
|
||||
|
||||
// Program, Function - var variables
|
||||
|
||||
if (path.isProgram() || path.isFunction()) {
|
||||
this.traverse(path.node, functionVariableVisitor, {
|
||||
blockId: path.get("id").node,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
// Program, BlockStatement, Function - let variables
|
||||
|
||||
if (path.isBlockStatement() || path.isProgram()) {
|
||||
@@ -495,15 +504,6 @@ export default class Scope {
|
||||
this.registerBinding("let", path);
|
||||
}
|
||||
|
||||
// Program, Function - var variables
|
||||
|
||||
if (path.isProgram() || path.isFunction()) {
|
||||
this.traverse(path.node, functionVariableVisitor, {
|
||||
blockId: path.get("id").node,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
// Program
|
||||
|
||||
if (path.isProgram()) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"CallExpression": ["callee", "arguments"],
|
||||
"CatchClause": ["param", "body"],
|
||||
"ClassBody": ["body"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ComprehensionBlock": ["left", "right", "body"],
|
||||
"ComprehensionExpression": ["filter", "blocks", "body"],
|
||||
"ConditionalExpression": ["test", "consequent", "alternate"],
|
||||
@@ -40,12 +40,12 @@
|
||||
"LogicalExpression": ["left", "right"],
|
||||
"MemberExpression": ["object", "property"],
|
||||
"MetaProperty": ["meta", "property"],
|
||||
"MethodDefinition": ["key", "value"],
|
||||
"MethodDefinition": ["key", "value", "decorators"],
|
||||
"NewExpression": ["callee", "arguments"],
|
||||
"ObjectExpression": ["properties"],
|
||||
"ObjectPattern": ["properties", "typeAnnotation"],
|
||||
"Program": ["body"],
|
||||
"Property": ["key", "value"],
|
||||
"Property": ["key", "value", "decorators"],
|
||||
"RestElement": ["argument", "typeAnnotation"],
|
||||
"ReturnStatement": ["argument"],
|
||||
"SequenceExpression": ["expressions"],
|
||||
|
||||
@@ -10959,7 +10959,7 @@ var fbTestFixture = {
|
||||
}
|
||||
},
|
||||
},
|
||||
'Bounded Polymorphism': {
|
||||
'Bounded Polymorphism': {
|
||||
'class A<T: Foo> {}': {
|
||||
type: 'ClassDeclaration',
|
||||
id: {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var z = {};
|
||||
var { ...x } = z;
|
||||
var { x, ...y } = z;
|
||||
var { [x]: x, ...y } = z;
|
||||
(function({ x, ...y }) { })
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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";
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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";
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
foobar();
|
||||
@@ -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();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"moduleId": "MyLib"
|
||||
}
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo {
|
||||
static num = 0;
|
||||
static str = "foo";
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.str, "foo");
|
||||
assert.equal(Foo.str = "bar", "bar");
|
||||
@@ -0,0 +1,6 @@
|
||||
import foo from "foo";
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireWildcard(_foo);
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
}
|
||||
|
||||
var _Foo = Foo;
|
||||
Foo = _foo2["default"](Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
exports["default"] = Foo;
|
||||
module.exports = exports["default"];
|
||||
@@ -12,3 +12,10 @@ var Foo2 = @bar class Foo {
|
||||
var Bar2 = @foo @bar class Bar {
|
||||
|
||||
};
|
||||
|
||||
@foo
|
||||
class Baz{
|
||||
constructor(baz) {
|
||||
this.baz = baz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
}
|
||||
|
||||
var _Foo = Foo;
|
||||
Foo = foo(Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var Bar = (function () {
|
||||
function Bar() {
|
||||
babelHelpers.classCallCheck(this, Bar);
|
||||
babelHelpers.classCallCheck(this, _Bar);
|
||||
}
|
||||
|
||||
var _Bar = Bar;
|
||||
Bar = foo(Bar) || Bar;
|
||||
Bar = bar(Bar) || Bar;
|
||||
return Bar;
|
||||
@@ -21,19 +23,33 @@ var Bar = (function () {
|
||||
|
||||
var Foo2 = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
babelHelpers.classCallCheck(this, _Foo2);
|
||||
}
|
||||
|
||||
var _Foo2 = Foo;
|
||||
Foo = bar(Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var Bar2 = (function () {
|
||||
function Bar() {
|
||||
babelHelpers.classCallCheck(this, Bar);
|
||||
babelHelpers.classCallCheck(this, _Bar2);
|
||||
}
|
||||
|
||||
var _Bar2 = Bar;
|
||||
Bar = foo(Bar) || Bar;
|
||||
Bar = bar(Bar) || Bar;
|
||||
return Bar;
|
||||
})();
|
||||
})();
|
||||
|
||||
var Baz = (function () {
|
||||
function Baz(baz) {
|
||||
babelHelpers.classCallCheck(this, _Baz);
|
||||
|
||||
this.baz = baz;
|
||||
}
|
||||
|
||||
var _Baz = Baz;
|
||||
Baz = foo(Baz) || Baz;
|
||||
return Baz;
|
||||
})();
|
||||
|
||||
@@ -89,7 +89,7 @@ var a: Promise<bool>[]
|
||||
var a:(...rest:Array<number>) => number
|
||||
var identity: <T>(x: T) => T
|
||||
var identity: <T>(x: T, ...y:T[]) => T
|
||||
import type foo from "bar";
|
||||
import type foo4 from "bar";
|
||||
import type { foo2, bar } from "baz";
|
||||
import type { foo as bar2 } from "baz";
|
||||
import type from "foo";
|
||||
|
||||
3
test/core/fixtures/transformation/misc/options.json
Normal file
3
test/core/fixtures/transformation/misc/options.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"externalHelpers": true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo extends Bar {
|
||||
constructor (options) {
|
||||
let parentOptions = {};
|
||||
parentOptions.init = function () {
|
||||
this;
|
||||
};
|
||||
super(parentOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
function Foo(options) {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
var parentOptions = {};
|
||||
parentOptions.init = function () {
|
||||
this;
|
||||
};
|
||||
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this, parentOptions);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -0,0 +1,3 @@
|
||||
function test(x: string = "hi"): string {
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
var x = arguments[0] === undefined ? "hi" : arguments[0];
|
||||
|
||||
return x;
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var _toString = require("foo");
|
||||
|
||||
var _toString2 = _interopRequireWildcard(_toString);
|
||||
var _toString2 = babelHelpers.interopRequireWildcard(_toString);
|
||||
|
||||
_toString2["default"];
|
||||
_toString2["default"];
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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) {})
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,10 +6,10 @@ var f = (function (_f) {
|
||||
}
|
||||
|
||||
f.toString = function () {
|
||||
return f.toString();
|
||||
return _f.toString();
|
||||
};
|
||||
|
||||
return f;
|
||||
})(function () {
|
||||
console.log(f, g);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user