Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
998f1d544e | ||
|
|
deed48a3db | ||
|
|
00c0a958db | ||
|
|
1511dcbd73 | ||
|
|
12fef25803 | ||
|
|
fd30eb1839 | ||
|
|
63344eb0a4 | ||
|
|
6e4e11a365 | ||
|
|
e330efe058 | ||
|
|
ce86eca8b0 | ||
|
|
03dbaa3e0e | ||
|
|
2bd35fac6e | ||
|
|
cdca4e50d9 | ||
|
|
bb041c1bd6 | ||
|
|
a36c1b4a92 | ||
|
|
b760daca21 | ||
|
|
ff63d8f60c | ||
|
|
74f04ed6a1 | ||
|
|
74d880bf18 | ||
|
|
5ce38cacaa | ||
|
|
829f642ad8 | ||
|
|
80a4b95da4 | ||
|
|
dc2a20dbcd | ||
|
|
f6278e43ce | ||
|
|
30bc80000b | ||
|
|
ef56042c93 | ||
|
|
b6498103db | ||
|
|
7af4302d07 | ||
|
|
543770960c | ||
|
|
a2975a72cc | ||
|
|
beb3fd51d8 | ||
|
|
9360860601 | ||
|
|
7d4ecea8fb | ||
|
|
a44831b3fa | ||
|
|
8357f3900f | ||
|
|
6b1c5bc358 | ||
|
|
3564309a77 | ||
|
|
c9518bb60d | ||
|
|
0f1215e33e | ||
|
|
d7b0b5bec0 | ||
|
|
3e5af404ab | ||
|
|
1818094577 | ||
|
|
6d712b3d14 | ||
|
|
11389fe165 | ||
|
|
0ee9531db3 |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -13,6 +13,26 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 5.1.11
|
||||
|
||||
* **Bug Fix**
|
||||
* Memoise and bind member expression decorators.
|
||||
* Move JSX children cleaning to opening element visitor. Fixes elements not being cleaned in certain scenarios.
|
||||
* Consider `SwitchStatement`s to be `Scopable`.
|
||||
* Fix `bluebirdCoroutines` calling `interopRequireWildcard` before it's defined.
|
||||
* Add space to `do...while` code generation.
|
||||
* Validate `super` use before `this` on `super` exit rather than entrance.
|
||||
* **Polish**
|
||||
* Add Babel name to logger.
|
||||
|
||||
## 5.1.10
|
||||
|
||||
* **Bug Fix**
|
||||
* Remove `makePredicate` from acorn in favor of an `indexOf`.
|
||||
* Remove statements to expression explosion when inserting a block statement.
|
||||
* **Internal**
|
||||
* Remove runtime compatibility check.
|
||||
|
||||
## 5.1.9
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
<p align="center">
|
||||
<strong><a href="#setup">Setup</a></strong>
|
||||
|
|
||||
<strong><a href="#running-tests">Running tests</a></strong>
|
||||
|
|
||||
<strong><a href="#workflow">Workflow</a></strong>
|
||||
|
|
||||
<strong><a href="#dependencies">Dependencies</a></strong>
|
||||
|
|
||||
<strong><a href="#code-standards">Code Standards</a></strong>
|
||||
</p>
|
||||
|
||||
----
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributions are always welcome, no matter how large or small. Before
|
||||
contributing, please read the
|
||||
[code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md).
|
||||
|
||||
|
||||
## Developing
|
||||
|
||||
#### Setup
|
||||
@@ -21,7 +36,9 @@ $ make watch-core
|
||||
```
|
||||
|
||||
This will compile Babel and then sit in the background and on file modification
|
||||
recompile the necessary files.
|
||||
recompile the necessary files. Babel itself is written in ES6. The source files
|
||||
reside in `src/` and transpile to `lib/`
|
||||
|
||||
|
||||
#### Running tests
|
||||
|
||||
@@ -44,6 +61,11 @@ Use mocha's `--grep` option to run a subset of tests by name:
|
||||
$ mocha test/core/transformation.js --grep es7
|
||||
```
|
||||
|
||||
If you don't have `mocha` installed globally, you can still use it from Babel's
|
||||
dependencies in `node_modules`, but make sure `node_modules/.bin` is added to
|
||||
your [`$PATH`](http://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path) environment variable.
|
||||
|
||||
|
||||
#### Workflow
|
||||
|
||||
* Fork the repository
|
||||
@@ -54,24 +76,91 @@ $ mocha test/core/transformation.js --grep es7
|
||||
* Ensure the test are passing (`make test`)
|
||||
* Create new pull request explaining your proposed change or reference an issue in your commit message
|
||||
|
||||
|
||||
#### Dependencies
|
||||
|
||||
+ [ast-types](http://ghub.io/ast-types) This is required to monkeypatch regenerators AST definitions. Could be improved in the future.
|
||||
|
||||
+ [chalk](http://ghub.io/chalk) This is used for terminal color highlighting for syntax errors.
|
||||
|
||||
+ [convert-source-map](http://ghub.io/convert-source-map) Turns a source map object into a comment etc.
|
||||
|
||||
+ [core-js](http://ghub.io/core-js) Used for the polyfill.
|
||||
|
||||
+ [debug](http://ghub.io/debug) Used to output debugging information when NODE_DEBUG is set to babel.
|
||||
|
||||
+ [detect-indent](http://ghub.io/detect-indent) This is used in the code generator so it can infer indentation.
|
||||
|
||||
+ [estraverse](http://ghub.io/estraverse) The only method on this is attachComments. I'd like to implement our own comment attachment algorithm eventually though.
|
||||
|
||||
+ [esutils](http://ghub.io/esutils) Various ES related utilities. Check whether something is a keyword etc.
|
||||
|
||||
+ [fs-readdir-recursive](http://ghub.io/fs-readdir-recursive) Recursively search a directory for.
|
||||
|
||||
+ [globals](http://ghub.io/globals) A list of JavaScript global variables. This is used by the scope tracking to check for colliding variables.
|
||||
|
||||
+ [is-integer](http://ghub.io/is-integer) Checks if something is an integer.
|
||||
|
||||
+ [js-tokens](http://ghub.io/js-tokens) This is used to get tokens for syntax error highlighting.
|
||||
|
||||
+ [leven](http://ghub.io/leven) A levenstein algorithm to determine how close a word is to another. This is used to offer suggestions when using the utility.undeclaredVariableCheck transformer.
|
||||
|
||||
+ [line-numbers](http://ghub.io/line-numbers) Used to produce the code frames in syntax errors.
|
||||
|
||||
+ [lodash](http://ghub.io/lodash) Used for various utilities.
|
||||
|
||||
+ [minimatch](http://ghub.io/minimatch) This is used to match glob-style ignore/only filters.
|
||||
|
||||
+ [output-file-sync](http://ghub.io/output-file-sync) Synchronously writes a file and create its ancestor directories if needed.
|
||||
|
||||
+ [path-is-absolute](http://ghub.io/path-is-absolute) Checks if a path is absolute. C:\foo and \foo are considered absolute.
|
||||
|
||||
+ [regenerator](http://ghub.io/regenerator) This is used to transform generators/async functions.
|
||||
|
||||
+ [regexpu](http://ghub.io/regexpu) Used to transform unicode regex patterns.
|
||||
|
||||
+ [repeating](http://ghub.io/repeating) Repeats a string.
|
||||
|
||||
+ [shebang-regex](http://ghub.io/shebang-regex) Literally just a regex that matches shebangs.
|
||||
|
||||
+ [slash](http://ghub.io/slash) Normalises path separators.
|
||||
|
||||
+ [source-map](http://ghub.io/source-map) Generates sourcemaps.
|
||||
|
||||
+ [source-map-support](http://ghub.io/source-map-support) Adds source map support to babel-node/babel/register.
|
||||
|
||||
+ [strip-json-comments](http://ghub.io/strip-json-comments) Remove comments from a JSON string. This is used for .babelrc files.
|
||||
|
||||
+ [to-fast-properties](http://ghub.io/to-fast-properties) A V8 trick to put an object into fast properties mode.
|
||||
|
||||
+ [trim-right](http://ghub.io/trim-right) Trims the rightside whitespace.
|
||||
|
||||
+ [user-home](http://ghub.io/user-home) Gets the users home directory. This is used to resolve the babel-node/babel/register cache.
|
||||
|
||||
|
||||
#### Code Standards
|
||||
|
||||
* **General**
|
||||
* Max of five arguments for functions
|
||||
* Max depth of four nested blocks
|
||||
* 2-spaced soft tabs
|
||||
|
||||
* **Naming**
|
||||
* CamelCase all class names
|
||||
* camelBack all variable names
|
||||
|
||||
* **Spacing**
|
||||
* Spaces after all keywords
|
||||
* Spaces before all left curly braces
|
||||
|
||||
* **Comments**
|
||||
* Use JSDoc-style comments for methods
|
||||
* Single-line comments for ambiguous code
|
||||
|
||||
* **Quotes**
|
||||
* Always use double quotes
|
||||
* Only use single quotes when the string contains a double quote
|
||||
|
||||
* **Declaration**
|
||||
* No unused variables
|
||||
* No pollution of global variables and prototypes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.1.10",
|
||||
"version": "5.1.12",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
@@ -29,8 +29,8 @@
|
||||
"dependencies": {
|
||||
"ast-types": "~0.7.0",
|
||||
"chalk": "^1.0.0",
|
||||
"convert-source-map": "^1.0.0",
|
||||
"core-js": "^0.8.3",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"core-js": "^0.9.0",
|
||||
"debug": "^2.1.1",
|
||||
"detect-indent": "^3.0.0",
|
||||
"estraverse": "^3.0.0",
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.1.9",
|
||||
"version": "5.1.11",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"babel-core": "^5.1.9",
|
||||
"babel-core": "^5.1.11",
|
||||
"chokidar": "^1.0.0",
|
||||
"commander": "^2.6.0",
|
||||
"fs-readdir-recursive": "^0.1.0",
|
||||
"output-file-sync": "^1.1.0",
|
||||
"lodash": "^3.2.0",
|
||||
"convert-source-map": "^0.5.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"source-map": "^0.4.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
@@ -22,4 +22,4 @@
|
||||
"babel-node": "./bin/babel-node",
|
||||
"babel-external-helpers": "./bin/babel-external-helpers"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.1.9",
|
||||
"version": "5.1.11",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"dependencies": {
|
||||
"core-js": "^0.8.0"
|
||||
"core-js": "^0.9.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ each(File.helpers, function (helperName) {
|
||||
writeFile("helpers/" + helperName + ".js", buildHelper(helperName));
|
||||
});
|
||||
|
||||
writeFile("regenerator/index.js", readFile("regenerator-babel/runtime-module", true));
|
||||
writeFile("regenerator/runtime.js", selfContainify(readFile("regenerator-babel/runtime")));
|
||||
writeFile("regenerator/index.js", readFile("regenerator/runtime-module", true));
|
||||
writeFile("regenerator/runtime.js", selfContainify(readFile("regenerator/runtime")));
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ pp.toAssignable = function(node, isBinding) {
|
||||
node.type = "ObjectPattern"
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
let prop = node.properties[i]
|
||||
if (prop.type === "SpreadProperty") continue;
|
||||
if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter")
|
||||
this.toAssignable(prop.value, isBinding)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as babel from "../node";
|
||||
import each from "lodash/collection/each";
|
||||
import * as util from "../../util";
|
||||
import fs from "fs";
|
||||
import slash from "slash";
|
||||
|
||||
sourceMapSupport.install({
|
||||
handleUncaughtExceptions: false,
|
||||
@@ -76,6 +77,7 @@ var compile = function (filename) {
|
||||
};
|
||||
|
||||
var shouldIgnore = function (filename) {
|
||||
filename = slash(filename);
|
||||
return (ignoreRegex && ignoreRegex.test(filename)) || (onlyRegex && !onlyRegex.test(filename));
|
||||
};
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export function JSXElement(node, print) {
|
||||
this.indent();
|
||||
each(node.children, (child) => {
|
||||
if (t.isLiteral(child)) {
|
||||
this.push(child.value);
|
||||
this.push(child.value, true);
|
||||
} else {
|
||||
print(child);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export var ForInStatement = buildForXStatement("in");
|
||||
export var ForOfStatement = buildForXStatement("of");
|
||||
|
||||
export function DoWhileStatement(node, print) {
|
||||
this.keyword("do");
|
||||
this.push("do ");
|
||||
print(node.body);
|
||||
this.space();
|
||||
this.keyword("while");
|
||||
|
||||
@@ -17,9 +17,17 @@ function exists(filename) {
|
||||
export default function (loc, opts = {}) {
|
||||
var rel = ".babelrc";
|
||||
|
||||
if (!opts.babelrc) {
|
||||
opts.babelrc = [];
|
||||
}
|
||||
|
||||
function find(start, rel) {
|
||||
var file = path.join(start, rel);
|
||||
|
||||
if (opts.babelrc.indexOf(file) >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (exists(file)) {
|
||||
var content = fs.readFileSync(file, "utf8");
|
||||
var json;
|
||||
@@ -31,10 +39,18 @@ export default function (loc, opts = {}) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
opts.babelrc.push(file);
|
||||
|
||||
if (json.breakConfig) return;
|
||||
merge(opts, json, function(a, b) {
|
||||
if (Array.isArray(a)) {
|
||||
return a.concat(b);
|
||||
var c = a.slice(0);
|
||||
for (var v of b) {
|
||||
if (a.indexOf(v) < 0) {
|
||||
c.push(v);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -45,7 +61,7 @@ export default function (loc, opts = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.breakConfig !== true) {
|
||||
if (opts.babelrc.indexOf(loc) < 0 && opts.breakConfig !== true) {
|
||||
find(loc, rel);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ function checkNode(stack, node, scope) {
|
||||
|
||||
export default class File {
|
||||
constructor(opts = {}) {
|
||||
this.dynamicImportAbsoluteDefaults = [];
|
||||
this.dynamicImportIds = {};
|
||||
this.dynamicImports = [];
|
||||
this.dynamicImportTypes = {};
|
||||
this.dynamicImportIds = {};
|
||||
this.dynamicImports = [];
|
||||
|
||||
this.usedHelpers = {};
|
||||
this.dynamicData = {};
|
||||
@@ -60,9 +60,9 @@ export default class File {
|
||||
"create-class",
|
||||
"create-decorated-class",
|
||||
"create-decorated-object",
|
||||
"define-decorated-property-descriptor",
|
||||
"tagged-template-literal",
|
||||
"tagged-template-literal-loose",
|
||||
"interop-require",
|
||||
"to-array",
|
||||
"to-consumable-array",
|
||||
"sliced-to-array",
|
||||
@@ -74,6 +74,7 @@ export default class File {
|
||||
"define-property",
|
||||
"async-to-generator",
|
||||
"interop-require-wildcard",
|
||||
"interop-require-default",
|
||||
"typeof",
|
||||
"extends",
|
||||
"get",
|
||||
@@ -83,7 +84,10 @@ export default class File {
|
||||
"temporal-undefined",
|
||||
"temporal-assert-defined",
|
||||
"self-global",
|
||||
"default-props"
|
||||
"default-props",
|
||||
|
||||
// legacy
|
||||
"interop-require",
|
||||
];
|
||||
|
||||
static soloHelpers = [
|
||||
@@ -241,7 +245,10 @@ export default class File {
|
||||
var plugin;
|
||||
|
||||
if (name) {
|
||||
if (typeof name === "string") {
|
||||
if (typeof name === "object" && name.transformer) {
|
||||
plugin = name.transformer;
|
||||
position = name.position || position;
|
||||
} else if (typeof name === "string") {
|
||||
// this is a plugin in the form of "foobar" or "foobar:after"
|
||||
// where the optional colon is the delimiter for plugin position in the transformer stack
|
||||
|
||||
@@ -340,7 +347,7 @@ export default class File {
|
||||
return source;
|
||||
}
|
||||
|
||||
addImport(source: string, name?: string, absoluteDefault?: boolean): Object {
|
||||
addImport(source: string, name?: string, type?: string): Object {
|
||||
name ||= source;
|
||||
var id = this.dynamicImportIds[name];
|
||||
|
||||
@@ -351,7 +358,11 @@ export default class File {
|
||||
var specifiers = [t.importDefaultSpecifier(id)];
|
||||
var declar = t.importDeclaration(specifiers, t.literal(source));
|
||||
declar._blockHoist = 3;
|
||||
if (absoluteDefault) this.dynamicImportAbsoluteDefaults.push(declar);
|
||||
|
||||
if (type) {
|
||||
var modules = this.dynamicImportTypes[type] ||= [];
|
||||
modules.push(declar);
|
||||
}
|
||||
|
||||
if (this.transformers["es6.modules"].canTransform()) {
|
||||
this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports);
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class Logger {
|
||||
}
|
||||
|
||||
_buildMessage(msg: string): string {
|
||||
var parts = this.filename;
|
||||
var parts = `[BABEL] ${this.filename}`;
|
||||
if (msg) parts += `: ${msg}`;
|
||||
return parts;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ export default class Logger {
|
||||
|
||||
deprecate(msg) {
|
||||
if (!this.file.opts.suppressDeprecationMessages) {
|
||||
console.error(msg);
|
||||
console.error(this._buildMessage(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
},
|
||||
|
||||
"externalHelpers": {
|
||||
"type": "string",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"shorthand": "r",
|
||||
"description": "uses a reference to `babelHelpers` instead of placing helpers at the top of your code."
|
||||
@@ -206,6 +206,11 @@
|
||||
"default": false,
|
||||
"hidden": true,
|
||||
"description": "stop trying to load .babelrc files"
|
||||
},
|
||||
|
||||
"babelrc": {
|
||||
"hidden": true,
|
||||
"description": "do not load the same .babelrc file twice"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ export default function (exports, opts) {
|
||||
|
||||
exports.JSXOpeningElement = {
|
||||
exit(node, parent, scope, file) {
|
||||
parent.children = react.buildChildren(parent);
|
||||
|
||||
var tagExpr = node.name;
|
||||
var args = [];
|
||||
|
||||
@@ -144,10 +146,6 @@ export default function (exports, opts) {
|
||||
};
|
||||
|
||||
exports.JSXElement = {
|
||||
enter(node) {
|
||||
node.children = react.buildChildren(node);
|
||||
},
|
||||
|
||||
exit(node) {
|
||||
var callExpr = node.openingElement;
|
||||
|
||||
|
||||
33
src/babel/transformation/helpers/memoise-decorators.js
Normal file
33
src/babel/transformation/helpers/memoise-decorators.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as t from "../../types";
|
||||
|
||||
export default function (decorators, scope) {
|
||||
for (var i = 0; i < decorators.length; i++) {
|
||||
var decorator = decorators[i];
|
||||
var expression = decorator.expression;
|
||||
if (!t.isMemberExpression(expression)) continue;
|
||||
|
||||
var temp = scope.generateMemoisedReference(expression.object);
|
||||
var ref;
|
||||
|
||||
var nodes = [];
|
||||
|
||||
if (temp) {
|
||||
ref = temp;
|
||||
nodes.push(t.assignmentExpression("=", temp, expression.object));
|
||||
} else {
|
||||
ref = expression.object;
|
||||
}
|
||||
|
||||
nodes.push(t.callExpression(
|
||||
t.memberExpression(
|
||||
t.memberExpression(ref, expression.property, expression.computed),
|
||||
t.identifier("bind")
|
||||
),
|
||||
[ref]
|
||||
));
|
||||
|
||||
decorator.expression = t.sequenceExpression(nodes);
|
||||
}
|
||||
|
||||
return decorators;
|
||||
}
|
||||
5
src/babel/transformation/helpers/react.js
vendored
5
src/babel/transformation/helpers/react.js
vendored
@@ -34,9 +34,8 @@ function cleanJSXElementLiteralChild(child, args) {
|
||||
var lines = child.value.split(/\r\n|\n|\r/);
|
||||
|
||||
var lastNonEmptyLine = 0;
|
||||
var i;
|
||||
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].match(/[^ \t]/)) {
|
||||
lastNonEmptyLine = i;
|
||||
}
|
||||
@@ -44,7 +43,7 @@ function cleanJSXElementLiteralChild(child, args) {
|
||||
|
||||
var str = "";
|
||||
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
var line = lines[i];
|
||||
|
||||
var isFirstLine = i === 0;
|
||||
|
||||
@@ -124,6 +124,11 @@ export default class DefaultFormatter {
|
||||
this.getLocalImports();
|
||||
}
|
||||
|
||||
isModuleType(node, type) {
|
||||
var modules = this.file.dynamicImportTypes[type];
|
||||
return modules && modules.indexOf(node) >= 0;
|
||||
}
|
||||
|
||||
transform() {
|
||||
this.remapAssignments();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,9 @@ export default class AMDFormatter extends DefaultFormatter {
|
||||
this.defaultIds[key] = specifier.local;
|
||||
}
|
||||
|
||||
if (includes(this.file.dynamicImportAbsoluteDefaults, node)) {
|
||||
if (this.isModuleType(node, "absolute")) {
|
||||
// absolute module reference
|
||||
} else if (this.isModuleType(node, "absoluteDefault")) {
|
||||
// prevent unnecessary renaming of dynamic imports
|
||||
this.ids[node.source.value] = ref;
|
||||
ref = t.memberExpression(ref, t.identifier("default"));
|
||||
|
||||
@@ -45,7 +45,9 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
|
||||
// import foo from "foo";
|
||||
if (t.isSpecifierDefault(specifier)) {
|
||||
if (includes(this.file.dynamicImportAbsoluteDefaults, node)) {
|
||||
if (this.isModuleType(node, "absolute")) {
|
||||
// absolute module reference
|
||||
} else if (this.isModuleType(node, "absoluteDefault")) {
|
||||
this.internalRemap[variableName.name] = ref;
|
||||
} else if (this.noInteropRequireImport) {
|
||||
this.internalRemap[variableName.name] = t.memberExpression(ref, t.identifier("default"));
|
||||
@@ -53,7 +55,7 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
var uid = this.scope.generateUidBasedOnNode(node, "import");
|
||||
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-wildcard"), [ref]))
|
||||
t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-default"), [ref]))
|
||||
]));
|
||||
|
||||
this.internalRemap[variableName.name] = t.memberExpression(uid, t.identifier("default"));
|
||||
@@ -104,13 +106,16 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
var call = t.callExpression(t.identifier("require"), [node.source]);
|
||||
var uid;
|
||||
|
||||
if (includes(this.file.dynamicImportAbsoluteDefaults, node)) {
|
||||
if (this.isModuleType(node, "absolute")) {
|
||||
// absolute module reference
|
||||
} else if (this.isModuleType(node, "absoluteDefault")) {
|
||||
call = t.memberExpression(call, t.identifier("default"));
|
||||
uid = node.specifiers[0].local;
|
||||
} else {
|
||||
uid = this.scope.generateUidBasedOnNode(node, "import");
|
||||
}
|
||||
|
||||
uid ||= node.specifiers[0].local;
|
||||
|
||||
var declar = t.variableDeclaration("var", [
|
||||
t.variableDeclarator(uid, call)
|
||||
]);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
this.KEY = INITIALIZERS.KEY.call(this);
|
||||
@@ -1 +0,0 @@
|
||||
CONSTRUCTOR.KEY = INITIALIZERS.KEY.call(CONSTRUCTOR);
|
||||
@@ -23,7 +23,11 @@
|
||||
throw new TypeError("The decorator for method " + descriptor.key + " is of the invalid type " + typeof decorator);
|
||||
}
|
||||
}
|
||||
if (initializers) initializers[key] = descriptor.initializer;
|
||||
|
||||
if (descriptor.initializer) {
|
||||
initializers[key] = descriptor;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(target, key, descriptor);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
descriptor.enumerable = true;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
descriptor.writable = true;
|
||||
|
||||
if (decorators) {
|
||||
for (var f = 0; f < decorators.length; f++) {
|
||||
@@ -26,6 +26,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
descriptor.value = descriptor.initializer();
|
||||
|
||||
Object.defineProperty(target, key, descriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
(function (target, key, descriptors) {
|
||||
var _descriptor = descriptors[key];
|
||||
|
||||
// clone it
|
||||
var descriptor = {};
|
||||
for (var _key in _descriptor) descriptor[_key] = _descriptor[_key];
|
||||
|
||||
// initialize it
|
||||
descriptor.value = descriptor.initializer();
|
||||
|
||||
Object.defineProperty(target, key, descriptor);
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
(function (obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
})
|
||||
@@ -1,3 +1,14 @@
|
||||
(function (obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (typeof obj === "object" && obj !== null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import memoiseDecorators from "../../helpers/memoise-decorators";
|
||||
import ReplaceSupers from "../../helpers/replace-supers";
|
||||
import * as nameMethod from "../../helpers/name-method";
|
||||
import * as defineMap from "../../helpers/define-map";
|
||||
@@ -36,6 +37,22 @@ var collectPropertyReferencesVisitor = {
|
||||
}
|
||||
};
|
||||
|
||||
var constructorVisitor = traverse.explode({
|
||||
ThisExpression: {
|
||||
enter(node, parent, scope, ref) {
|
||||
return ref;
|
||||
}
|
||||
},
|
||||
|
||||
Function: {
|
||||
enter(node) {
|
||||
if (!node.shadow) {
|
||||
this.skip();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var verifyConstructorVisitor = traverse.explode({
|
||||
MethodDefinition: {
|
||||
enter() {
|
||||
@@ -50,7 +67,7 @@ var verifyConstructorVisitor = traverse.explode({
|
||||
},
|
||||
|
||||
CallExpression: {
|
||||
enter(node, parent, scope, state) {
|
||||
exit(node, parent, scope, state) {
|
||||
if (this.get("callee").isSuper()) {
|
||||
state.hasBareSuper = true;
|
||||
state.bareSuper = this;
|
||||
@@ -292,6 +309,10 @@ class ClassTransformer {
|
||||
var node = classBody[i];
|
||||
var path = classBodyPaths[i];
|
||||
|
||||
if (node.decorators) {
|
||||
memoiseDecorators(node.decorators, this.scope);
|
||||
}
|
||||
|
||||
if (t.isMethodDefinition(node)) {
|
||||
var isConstructor = node.kind === "constructor";
|
||||
if (isConstructor) this.verifyConstructor(path);
|
||||
@@ -533,35 +554,39 @@ class ClassTransformer {
|
||||
node.value = t.functionExpression(null, [], t.blockStatement(body));
|
||||
this.pushToMap(node, true, "initializer");
|
||||
|
||||
var initializers;
|
||||
var body;
|
||||
var target;
|
||||
if (node.static) {
|
||||
this.staticPropBody.push(util.template("call-static-decorator", {
|
||||
INITIALIZERS: this.staticInitializersId ||= this.scope.generateUidIdentifier("staticInitializers"),
|
||||
CONSTRUCTOR: this.classRef,
|
||||
KEY: node.key,
|
||||
}, true));
|
||||
initializers = this.staticInitializersId ||= this.scope.generateUidIdentifier("staticInitializers");
|
||||
body = this.staticPropBody;
|
||||
target = this.classRef;
|
||||
} else {
|
||||
this.instancePropBody.push(util.template("call-instance-decorator", {
|
||||
INITIALIZERS: this.instanceInitializersId ||= this.scope.generateUidIdentifier("instanceInitializers"),
|
||||
KEY: node.key
|
||||
}, true));
|
||||
initializers = this.instanceInitializersId ||= this.scope.generateUidIdentifier("instanceInitializers");
|
||||
body = this.instancePropBody;
|
||||
target = t.thisExpression();
|
||||
}
|
||||
|
||||
body.push(t.expressionStatement(
|
||||
t.callExpression(this.file.addHelper("define-decorated-property-descriptor"), [
|
||||
target,
|
||||
t.literal(node.key.name),
|
||||
initializers
|
||||
])
|
||||
));
|
||||
} else {
|
||||
if (!node.static && node.value) {
|
||||
node.value ||= t.identifier("undefined");
|
||||
|
||||
if (node.static) {
|
||||
// can just be added to the static map
|
||||
this.pushToMap(node, true);
|
||||
} else if (node.value) {
|
||||
// add this to the instancePropBody which will be added after the super call in a derived constructor
|
||||
// or at the start of a constructor for a non-derived constructor
|
||||
this.instancePropBody.push(t.expressionStatement(
|
||||
t.assignmentExpression("=", t.memberExpression(t.thisExpression(), node.key), node.value)
|
||||
));
|
||||
|
||||
node.value = null;
|
||||
}
|
||||
|
||||
if (!node.value) {
|
||||
node.value = t.identifier("undefined");
|
||||
}
|
||||
|
||||
// can just be added to the static map
|
||||
this.pushToMap(node, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,6 +601,10 @@ class ClassTransformer {
|
||||
fnPath.scope.rename(this.classRef.name);
|
||||
}
|
||||
|
||||
if (this.isNativeSuper) {
|
||||
fnPath.traverse(constructorVisitor, this.nativeSuperRef);
|
||||
}
|
||||
|
||||
var construct = this.constructor;
|
||||
var fn = method.value;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import memoiseDecorators from "../../helpers/memoise-decorators";
|
||||
import * as defineMap from "../../helpers/define-map";
|
||||
import * as t from "../../../types";
|
||||
|
||||
@@ -24,7 +25,18 @@ export function ObjectExpression(node, parent, scope, file) {
|
||||
var mutatorMap = {};
|
||||
|
||||
for (var i = 0; i < node.properties.length; i++) {
|
||||
defineMap.push(mutatorMap, node.properties[i], null, file);
|
||||
var prop = node.properties[i];
|
||||
if (prop.decorators) memoiseDecorators(prop.decorators, scope);
|
||||
|
||||
|
||||
if (prop.kind === "init") {
|
||||
prop.kind = "";
|
||||
prop.value = t.functionExpression(null, [], t.blockStatement([
|
||||
t.returnStatement(prop.value)
|
||||
]));
|
||||
}
|
||||
|
||||
defineMap.push(mutatorMap, prop, "initializer", file);
|
||||
}
|
||||
|
||||
var obj = defineMap.toClassObject(mutatorMap);
|
||||
|
||||
@@ -16,6 +16,8 @@ export function ImportDeclaration(node, parent, scope, file) {
|
||||
}
|
||||
}
|
||||
|
||||
export { ImportDeclaration as ExportAllDeclaration };
|
||||
|
||||
export function ExportDefaultDeclaration(node, parent, scope) {
|
||||
ImportDeclaration.apply(this, arguments);
|
||||
|
||||
|
||||
@@ -33,9 +33,11 @@ export function JSXElement(node, parent, scope, file) {
|
||||
|
||||
var state = { isImmutable: true };
|
||||
this.traverse(immutabilityVisitor, state);
|
||||
this.skip();
|
||||
|
||||
if (state.isImmutable) this.hoist();
|
||||
if (state.isImmutable) {
|
||||
this.hoist();
|
||||
this.skip();
|
||||
}
|
||||
|
||||
node._hoisted = true;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export function JSXElement(node, parent, scope, file) {
|
||||
if (isJSXAttributeOfName(attr, "key")) {
|
||||
key = attr.value;
|
||||
} else {
|
||||
pushProp(props.properties, attr.name, attr.value);
|
||||
pushProp(props.properties, attr.name, attr.value || t.identifier("true"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ exports.Function = function (node, parent, scope, file) {
|
||||
|
||||
return remapAsyncToGenerator(
|
||||
node,
|
||||
t.memberExpression(file.addImport("bluebird"), t.identifier("coroutine")),
|
||||
t.memberExpression(file.addImport("bluebird", null, "absolute"), t.identifier("coroutine")),
|
||||
scope
|
||||
);
|
||||
};
|
||||
|
||||
@@ -45,7 +45,10 @@
|
||||
"Object": {
|
||||
"assign": "object/assign",
|
||||
"classof": "object/classof",
|
||||
"create": "object/create",
|
||||
"define": "object/define",
|
||||
"defineProperties": "object/define-properties",
|
||||
"defineProperty": "object/define-property",
|
||||
"entries": "object/entries",
|
||||
"freeze": "object/freeze",
|
||||
"getOwnPropertyDescriptor": "object/get-own-property-descriptor",
|
||||
|
||||
@@ -18,7 +18,7 @@ var astVisitor = traverse.explode({
|
||||
|
||||
// Symbol() -> _core.Symbol(); new Promise -> new _core.Promise
|
||||
var modulePath = definitions.builtins[node.name];
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/core-js/${modulePath}`, node.name, true);
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/core-js/${modulePath}`, node.name, "absoluteDefault");
|
||||
},
|
||||
|
||||
CallExpression(node, parent, scope, file) {
|
||||
@@ -33,7 +33,7 @@ var astVisitor = traverse.explode({
|
||||
var prop = callee.property;
|
||||
if (!isSymbolIterator(prop)) return;
|
||||
|
||||
return t.callExpression(file.addImport(`${RUNTIME_MODULE_NAME}/core-js/get-iterator`, "getIterator", true), [callee.object]);
|
||||
return t.callExpression(file.addImport(`${RUNTIME_MODULE_NAME}/core-js/get-iterator`, "getIterator", "absoluteDefault"), [callee.object]);
|
||||
},
|
||||
|
||||
BinaryExpression(node, parent, scope, file) {
|
||||
@@ -45,7 +45,7 @@ var astVisitor = traverse.explode({
|
||||
if (!isSymbolIterator(left)) return;
|
||||
|
||||
return t.callExpression(
|
||||
file.addImport(`${RUNTIME_MODULE_NAME}/core-js/is-iterable`, "isIterable", true),
|
||||
file.addImport(`${RUNTIME_MODULE_NAME}/core-js/is-iterable`, "isIterable", "absoluteDefault"),
|
||||
[node.right]
|
||||
);
|
||||
},
|
||||
@@ -71,7 +71,7 @@ var astVisitor = traverse.explode({
|
||||
if (scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
var modulePath = methods[prop.name];
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/core-js/${modulePath}`, `${obj.name}$${prop.name}`, true);
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/core-js/${modulePath}`, `${obj.name}$${prop.name}`, "absoluteDefault");
|
||||
},
|
||||
|
||||
exit(node, parent, scope, file) {
|
||||
@@ -85,7 +85,7 @@ var astVisitor = traverse.explode({
|
||||
|
||||
var modulePath = definitions.builtins[obj.name];
|
||||
return t.memberExpression(
|
||||
file.addImport(`${RUNTIME_MODULE_NAME}/core-js/${modulePath}`, `${obj.name}`, true),
|
||||
file.addImport(`${RUNTIME_MODULE_NAME}/core-js/${modulePath}`, `${obj.name}`, "absoluteDefault"),
|
||||
prop
|
||||
);
|
||||
}
|
||||
@@ -102,11 +102,11 @@ exports.Program = function (node, parent, scope, file) {
|
||||
|
||||
exports.pre = function (file) {
|
||||
file.set("helperGenerator", function (name) {
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/helpers/${name}`, name, true);
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/helpers/${name}`, name, "absoluteDefault");
|
||||
});
|
||||
|
||||
file.setDynamic("regeneratorIdentifier", function () {
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/regenerator`, "regeneratorRuntime", true);
|
||||
return file.addImport(`${RUNTIME_MODULE_NAME}/regenerator`, "regeneratorRuntime", "absoluteDefault");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -109,6 +109,14 @@ export default class PathHoister {
|
||||
])
|
||||
]);
|
||||
|
||||
var parent = this.path.parentPath;
|
||||
|
||||
if (parent.isJSXElement() && this.path.container === parent.node.children) {
|
||||
// turning the `span` in `<div><span /></div>` to an expression so we need to wrap it with
|
||||
// an expression container
|
||||
uid = t.jSXExpressionContainer(uid);
|
||||
}
|
||||
|
||||
this.path.replaceWith(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"DoWhileStatement": ["Statement", "Loop", "While", "Scopable"],
|
||||
"IfStatement": ["Statement"],
|
||||
"ReturnStatement": ["Statement"],
|
||||
"SwitchStatement": ["Statement"],
|
||||
"SwitchStatement": ["Statement", "Scopable"],
|
||||
"ThrowStatement": ["Statement"],
|
||||
"TryStatement": ["Statement"],
|
||||
"WhileStatement": ["Statement", "Loop", "While", "Scopable"],
|
||||
|
||||
@@ -18,6 +18,7 @@ import each from "lodash/collection/each";
|
||||
import has from "lodash/object/has";
|
||||
import fs from "fs";
|
||||
import * as t from "./types";
|
||||
import slash from "slash";
|
||||
|
||||
export { inherits, inspect } from "util";
|
||||
|
||||
@@ -94,6 +95,7 @@ export function booleanify(val: any): boolean {
|
||||
}
|
||||
|
||||
export function shouldIgnore(filename, ignore, only) {
|
||||
filename = slash(filename);
|
||||
if (only.length) {
|
||||
for (var i = 0; i < only.length; i++) {
|
||||
if (only[i].test(filename)) return false;
|
||||
|
||||
@@ -111,6 +111,7 @@ var buildTest = function (binName, testName, opts) {
|
||||
};
|
||||
|
||||
var clear = function () {
|
||||
process.chdir(__dirname);
|
||||
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
|
||||
fs.mkdirSync(tmpLoc);
|
||||
process.chdir(tmpLoc);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _bluebird2 = require("bluebird");
|
||||
|
||||
var _bluebird3 = babelHelpers.interopRequireWildcard(_bluebird2);
|
||||
var _bluebird = require("bluebird");
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
@@ -11,7 +9,7 @@ var Foo = (function () {
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "foo",
|
||||
value: _bluebird3["default"].coroutine(function* () {
|
||||
value: _bluebird.coroutine(function* () {
|
||||
var wat = yield bar();
|
||||
})
|
||||
}]);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _bluebird2 = require("bluebird");
|
||||
var _bluebird = require("bluebird");
|
||||
|
||||
var _bluebird3 = _interopRequireWildcard(_bluebird2);
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var foo = _bluebird3["default"].coroutine(function* () {
|
||||
var foo = _bluebird.coroutine(function* () {
|
||||
var wat = yield bar();
|
||||
});
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _bluebird2 = require("bluebird");
|
||||
|
||||
var _bluebird3 = _interopRequireWildcard(_bluebird2);
|
||||
var _bluebird = require("bluebird");
|
||||
|
||||
var _bar;
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var foo = _bar = _bluebird3["default"].coroutine(function* () {
|
||||
var foo = _bar = _bluebird.coroutine(function* () {
|
||||
console.log(_bar);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _bluebird2 = require("bluebird");
|
||||
var _bluebird = require("bluebird");
|
||||
|
||||
var _bluebird3 = _interopRequireWildcard(_bluebird2);
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var foo = _bluebird3["default"].coroutine(function* () {
|
||||
var foo = _bluebird.coroutine(function* () {
|
||||
var wat = yield bar();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
let a = true;
|
||||
let b = false;
|
||||
|
||||
switch (a) {
|
||||
case true:
|
||||
let b = 2;
|
||||
break;
|
||||
case false:
|
||||
let c = 3;
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var a = true;
|
||||
var b = false;
|
||||
|
||||
switch (a) {
|
||||
case true:
|
||||
var b = 2;
|
||||
break;
|
||||
case false:
|
||||
var c = 3;
|
||||
break;
|
||||
}
|
||||
@@ -8,3 +8,10 @@ class Bar extends Array {
|
||||
this.foo = "bar";
|
||||
}
|
||||
}
|
||||
|
||||
class Baz extends Array {
|
||||
constructor() {
|
||||
super();
|
||||
(() => this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,3 +33,21 @@ var Bar = (function (_Array2) {
|
||||
babelHelpers.inherits(Bar, _Array2);
|
||||
return Bar;
|
||||
})(Array);
|
||||
|
||||
var Baz = (function (_Array3) {
|
||||
function Baz() {
|
||||
babelHelpers.classCallCheck(this, Baz);
|
||||
|
||||
var _this3 = new _Array3();
|
||||
|
||||
_this3.__proto__ = Baz.prototype;
|
||||
|
||||
(function () {
|
||||
return _this3;
|
||||
});
|
||||
return _this3;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Baz, _Array3);
|
||||
return Baz;
|
||||
})(Array);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo extends Bar {
|
||||
constructor() {
|
||||
super(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "'this' is not allowed before super()"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
this.foo = "bar";
|
||||
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -1,7 +1,7 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
var _interopRequireWildcard = function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (typeof obj === "object" && obj !== null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } };
|
||||
|
||||
var _defaults = function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; };
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
var _interopRequireWildcard = function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (typeof obj === "object" && obj !== null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } };
|
||||
|
||||
var _defaults = function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; };
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = _interopRequireWildcard(_foo);
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
var _foo22 = _interopRequireWildcard(_foo);
|
||||
var _foo22 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
_foo2["default"];
|
||||
_foo22["default"];
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"externalHelpers": true
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
var _interopRequireWildcard = function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (typeof obj === "object" && obj !== null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } };
|
||||
|
||||
var _import = require("foo");
|
||||
|
||||
var foo = _interopRequireWildcard(_import);
|
||||
var foo = _interopRequireWildcard(_import);
|
||||
@@ -1,10 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var _foo$xyz = require("foo");
|
||||
|
||||
var _foo$xyz2 = _interopRequireWildcard(_foo$xyz);
|
||||
var _foo$xyz2 = babelHelpers.interopRequireDefault(_foo$xyz);
|
||||
|
||||
_foo$xyz2["default"];
|
||||
_foo$xyz.baz;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"externalHelpers": true
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
@@ -14,11 +12,11 @@ require("./directory/foo-bar");
|
||||
|
||||
var _foo = require("foo2");
|
||||
|
||||
var _foo2 = _interopRequireWildcard(_foo);
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
var _import = require("foo3");
|
||||
|
||||
var foo2 = _interopRequireWildcard(_import);
|
||||
var foo2 = babelHelpers.interopRequireWildcard(_import);
|
||||
|
||||
var _bar = require("foo4");
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"externalHelpers": true
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
})(this, function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
var _interopRequireWildcard = function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (typeof obj === "object" && obj !== null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } };
|
||||
|
||||
var _defaults = function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; };
|
||||
|
||||
|
||||
@@ -12,14 +12,10 @@ var Foo = (function () {
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}, {
|
||||
key: "__initializeProperties",
|
||||
value: function __initializeProperties() {
|
||||
this.bar = foo;
|
||||
}
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -12,10 +12,5 @@ var Foo = (function (_Bar) {
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
})(Bar);
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
var Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = undefined;
|
||||
};
|
||||
@@ -1,15 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = "foo";
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
var Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = "foo";
|
||||
};
|
||||
|
||||
@@ -10,10 +10,5 @@ var Foo = (function (_Bar) {
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -9,10 +9,5 @@ var Foo = (function (_Bar) {
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -0,0 +1,14 @@
|
||||
function noop() {}
|
||||
|
||||
class Foo {
|
||||
@noop
|
||||
bar = "foobar";
|
||||
|
||||
@noop
|
||||
foo() {
|
||||
return "bar";
|
||||
}
|
||||
}
|
||||
|
||||
assert.equal(new Foo().bar, "foobar");
|
||||
assert.equal(new Foo().foo(), "bar");
|
||||
@@ -5,7 +5,7 @@ var Foo = (function () {
|
||||
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.foo = _instanceInitializers.foo.call(this);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(this, "foo", _instanceInitializers);
|
||||
}
|
||||
|
||||
babelHelpers.createDecoratedClass(Foo, [{
|
||||
@@ -17,4 +17,4 @@ var Foo = (function () {
|
||||
enumerable: true
|
||||
}], null, _instanceInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
function noop() {}
|
||||
|
||||
class Foo {
|
||||
@noop
|
||||
static bar = "foobar";
|
||||
|
||||
@noop
|
||||
static foo() {
|
||||
return "bar";
|
||||
}
|
||||
}
|
||||
|
||||
assert.equal(Foo.bar, "foobar");
|
||||
assert.equal(Foo.foo(), "bar");
|
||||
@@ -15,6 +15,6 @@ var Foo = (function () {
|
||||
},
|
||||
enumerable: true
|
||||
}], null, _staticInitializers);
|
||||
Foo.foo = _staticInitializers.foo.call(Foo);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(Foo, "foo", _staticInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireWildcard(_foo);
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
|
||||
@@ -5,7 +5,7 @@ var Foo = (function () {
|
||||
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.foo = _instanceInitializers.foo.call(this);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(this, "foo", _instanceInitializers);
|
||||
}
|
||||
|
||||
babelHelpers.createDecoratedClass(Foo, [{
|
||||
@@ -15,4 +15,4 @@ var Foo = (function () {
|
||||
enumerable: true
|
||||
}], null, _instanceInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -13,6 +13,6 @@ var Foo = (function () {
|
||||
initializer: function () {},
|
||||
enumerable: true
|
||||
}], null, _staticInitializers);
|
||||
Foo.foo = _staticInitializers.foo.call(Foo);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(Foo, "foo", _staticInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
var foo = {
|
||||
bar: function () { assert.equal(this, foo); },
|
||||
foobar: {
|
||||
bar: function () { assert.equal(this, foo.foobar); },
|
||||
}
|
||||
};
|
||||
|
||||
(class {
|
||||
@foo.bar
|
||||
@foo.foobar.bar
|
||||
bar() {}
|
||||
});
|
||||
|
||||
({
|
||||
@foo.bar
|
||||
@foo.foobar.bar
|
||||
bar() {}
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
function override(target, key, descriptor) {
|
||||
descriptor.initializer = function () {
|
||||
return "lol";
|
||||
};
|
||||
}
|
||||
|
||||
var obj = {
|
||||
@override
|
||||
foo: "bar",
|
||||
|
||||
bar: "heh"
|
||||
};
|
||||
|
||||
assert.equal(obj.foo, "lol");
|
||||
assert.equal(obj.bar, "heh");
|
||||
@@ -3,12 +3,18 @@
|
||||
var obj = babelHelpers.createDecoratedObject([{
|
||||
key: "bar",
|
||||
decorators: [foo],
|
||||
value: function value() {}
|
||||
initializer: function initializer() {
|
||||
return function () {};
|
||||
}
|
||||
}, {
|
||||
key: "foo",
|
||||
decorators: [bar],
|
||||
value: "lol"
|
||||
initializer: function initializer() {
|
||||
return "lol";
|
||||
}
|
||||
}, {
|
||||
key: "yes",
|
||||
value: "wow"
|
||||
}]);
|
||||
initializer: function initializer() {
|
||||
return "wow";
|
||||
}
|
||||
}]);
|
||||
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
|
||||
var _foo2 = require("bar");
|
||||
|
||||
var _foo3 = babelHelpers.interopRequireWildcard(_foo2);
|
||||
var _foo3 = babelHelpers.interopRequireDefault(_foo2);
|
||||
|
||||
exports.foo = _foo3["default"];
|
||||
exports.foo = _foo3["default"];
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
var _toString = require("foo");
|
||||
|
||||
var _toString2 = babelHelpers.interopRequireWildcard(_toString);
|
||||
var _toString2 = babelHelpers.interopRequireDefault(_toString);
|
||||
|
||||
_toString2["default"];
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
var Foo = React.createClass({
|
||||
render: function() {
|
||||
return <div className={this.props.className}>
|
||||
<span />
|
||||
</div>;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var _ref = <span />;
|
||||
|
||||
var Foo = React.createClass({
|
||||
render: function render() {
|
||||
return <div className={this.props.className}>
|
||||
{_ref}
|
||||
</div>;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
<Foo bar />;
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
({
|
||||
type: Foo,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Foo.defaultProps, {
|
||||
bar: true
|
||||
}),
|
||||
key: null
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
var HelloMessage = React.createClass({
|
||||
render: function() {
|
||||
return <div>Hello {this.props.name}</div>;
|
||||
}
|
||||
});
|
||||
|
||||
React.render(<HelloMessage name={
|
||||
<span>
|
||||
Sebastian
|
||||
</span>
|
||||
} />, mountNode);
|
||||
@@ -0,0 +1,18 @@
|
||||
var HelloMessage = React.createClass({
|
||||
displayName: "HelloMessage",
|
||||
|
||||
render: function render() {
|
||||
return React.createElement(
|
||||
"div",
|
||||
null,
|
||||
"Hello ",
|
||||
this.props.name
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.render(React.createElement(HelloMessage, { name: React.createElement(
|
||||
"span",
|
||||
null,
|
||||
"Sebastian"
|
||||
) }), mountNode);
|
||||
@@ -1,20 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
var _Object$defineProperty = require("babel-runtime/core-js/object/define-property")["default"];
|
||||
|
||||
var _Symbol = require("babel-runtime/core-js/symbol")["default"];
|
||||
|
||||
var _regeneratorRuntime = require("babel-runtime/regenerator")["default"];
|
||||
|
||||
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
|
||||
|
||||
var _interopRequireWildcard = require("babel-runtime/helpers/interop-require-wildcard")["default"];
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
_Object$defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.giveWord = giveWord;
|
||||
var marked0$0 = [giveWord].map(_regeneratorRuntime.mark);
|
||||
|
||||
var _foo = require("someModule");
|
||||
|
||||
var _foo2 = _interopRequireWildcard(_foo);
|
||||
var _foo2 = _interopRequireDefault(_foo);
|
||||
|
||||
var bar = _interopRequireWildcard(_foo);
|
||||
|
||||
@@ -36,4 +41,4 @@ function giveWord() {
|
||||
}
|
||||
|
||||
_foo2["default"];
|
||||
bar;
|
||||
bar;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("babel-runtime/helpers/interop-require-wildcard")["default"];
|
||||
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = _interopRequireWildcard(_foo);
|
||||
var _foo2 = _interopRequireDefault(_foo);
|
||||
|
||||
_foo2["default"];
|
||||
_foo2["default"];
|
||||
|
||||
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
|
||||
var _last2 = require("lodash/array/last");
|
||||
|
||||
var _last3 = babelHelpers.interopRequireWildcard(_last2);
|
||||
var _last3 = babelHelpers.interopRequireDefault(_last2);
|
||||
|
||||
var Container = (function () {
|
||||
function Container() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
var _events2 = require("events");
|
||||
|
||||
var _events3 = babelHelpers.interopRequireWildcard(_events2);
|
||||
var _events3 = babelHelpers.interopRequireDefault(_events2);
|
||||
|
||||
var Template = (function () {
|
||||
function Template() {
|
||||
|
||||
Reference in New Issue
Block a user