Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86c6d4e769 | ||
|
|
bf2d527cfe | ||
|
|
6b59ea8eac | ||
|
|
72e3cb9243 | ||
|
|
5e5ede6058 | ||
|
|
d25944ea1f | ||
|
|
fce2aa8fa3 | ||
|
|
0112c63779 | ||
|
|
6a4e93bf0f | ||
|
|
4328e920d2 | ||
|
|
bbbf0a895d | ||
|
|
3289b33806 | ||
|
|
f4b9faa6b3 | ||
|
|
239b77816f | ||
|
|
8565e2b4e5 | ||
|
|
4317a46a3e | ||
|
|
81ca29adc3 | ||
|
|
c1a6ff7f44 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -13,6 +13,35 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 5.2.13
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix `ExportDeclaration`s being incorrectly removed when using the `utility.deadCodeElimination` transformer.
|
||||
* Fix position of `utility` transformers.
|
||||
* **New Feature**
|
||||
* Add built-in `esquery` support.
|
||||
* **Internal**
|
||||
* Consolidate notion of "virtual types".
|
||||
|
||||
## 5.2.12
|
||||
|
||||
* **Polish**
|
||||
* Make UID generation based on module declarations **much** nicer.
|
||||
* **Internal**
|
||||
* Remove internal check for traversal path replacement of self. This is a pattern that **could** come up in the wild and it could lead to pretty nasty code and may lead to internal regressions as the test coverage isn't 100% :( Instead, just put it in the fast path.
|
||||
|
||||
## 5.2.11
|
||||
|
||||
* **Internal**
|
||||
* Rename `getModuleName` option to `getModuleId`, doh.
|
||||
|
||||
## 5.2.10
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix numerous issues in `replaceWithSourceString`. Thanks [@pangratz](https://github.com/pangratz)!
|
||||
* **New Feature**
|
||||
* Add `getModuleName` option. Thanks [@jayphelps](https://github.com/jayphelps)!
|
||||
|
||||
## 5.2.9
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.2.10",
|
||||
"version": "5.2.13",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
@@ -35,7 +35,8 @@
|
||||
"core-js": "^0.9.0",
|
||||
"debug": "^2.1.1",
|
||||
"detect-indent": "^3.0.0",
|
||||
"estraverse": "^3.0.0",
|
||||
"esquery": "^0.4.0",
|
||||
"estraverse": "^4.0.0",
|
||||
"esutils": "^2.0.0",
|
||||
"fs-readdir-recursive": "^0.1.0",
|
||||
"globals": "^6.4.0",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.2.9",
|
||||
"version": "5.2.12",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"babel-core": "^5.2.9",
|
||||
"babel-core": "^5.2.12",
|
||||
"chokidar": "^1.0.0",
|
||||
"commander": "^2.6.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.2.9",
|
||||
"version": "5.2.12",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"dependencies": {
|
||||
|
||||
@@ -23,10 +23,12 @@ export const MESSAGES = {
|
||||
missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",
|
||||
unsupportedOutputType: "Unsupported output type $1",
|
||||
illegalMethodName: "Illegal method name $1",
|
||||
|
||||
traverseNeedsParent: "Must pass a scope and parentPath unless traversing a Program/File got a $1 node",
|
||||
traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",
|
||||
traverseVerifyVisitorFunction: "Hey! You passed \`traverse()\` a visitor object with the key $1 that's a straight up `Function` instead of `{ enter: Function }`. You need to normalise it with `traverse.explode(visitor)`.",
|
||||
traverseVerifyVisitorFunction: "You passed \`traverse()\` a visitor object with the key $1 that's a `Function` instead of `{ enter: Function }`. You need to normalise your visitor with `traverse.explode(visitor)`.",
|
||||
traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",
|
||||
traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type",
|
||||
|
||||
pluginIllegalKind: "Illegal kind $1 for plugin $2",
|
||||
pluginIllegalPosition: "Illegal position $1 for plugin $2",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
"getModuleName": {
|
||||
"getModuleId": {
|
||||
"hidden": true
|
||||
},
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ import * as react from "./react";
|
||||
import * as t from "../../types";
|
||||
|
||||
export default function (exports, opts) {
|
||||
exports.check = function (node) {
|
||||
exports.shouldVisit = function (node) {
|
||||
if (t.isJSX(node)) return true;
|
||||
if (react.isCreateClass(node)) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.JSXIdentifier = function (node, parent) {
|
||||
if (node.name === "this" && t.isReferenced(node, parent)) {
|
||||
if (node.name === "this" && this.isReferenced()) {
|
||||
return t.thisExpression();
|
||||
} else if (esutils.keyword.isIdentifierNameES6(node.name)) {
|
||||
node.type = "Identifier";
|
||||
|
||||
@@ -19,7 +19,7 @@ var awaitVisitor = {
|
||||
var referenceVisitor = {
|
||||
enter(node, parent, scope, state) {
|
||||
var name = state.id.name;
|
||||
if (t.isReferencedIdentifier(node, parent, { name: name }) && scope.bindingIdentifierEquals(name, state.id)) {
|
||||
if (this.isReferencedIdentifier({ name: name }) && scope.bindingIdentifierEquals(name, state.id)) {
|
||||
return state.ref = state.ref || scope.generateUidIdentifier(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,14 @@ import object from "../../helpers/object";
|
||||
import * as util from "../../util";
|
||||
import * as t from "../../types";
|
||||
|
||||
var remapVisitor = {
|
||||
var remapVisitor = traverse.explode({
|
||||
enter(node, parent, scope, formatter) {
|
||||
if (node._skipModulesRemap) {
|
||||
return this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
Identifier(node, parent, scope, formatter) {
|
||||
var remap = formatter.internalRemap[node.name];
|
||||
|
||||
if (this.isReferencedIdentifier() && remap && node !== remap) {
|
||||
@@ -14,53 +20,50 @@ var remapVisitor = {
|
||||
return remap;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
if (t.isUpdateExpression(node)) {
|
||||
var exported = formatter.getExport(node.argument, scope);
|
||||
|
||||
if (exported) {
|
||||
this.skip();
|
||||
|
||||
// expand to long file assignment expression
|
||||
var assign = t.assignmentExpression(node.operator[0] + "=", node.argument, t.literal(1));
|
||||
|
||||
// remap this assignment expression
|
||||
var remapped = formatter.remapExportAssignment(assign, exported);
|
||||
|
||||
// we don't need to change the result
|
||||
if (t.isExpressionStatement(parent) || node.prefix) {
|
||||
return remapped;
|
||||
AssignmentExpression: {
|
||||
exit(node, parent, scope, formatter) {
|
||||
if (!node._ignoreModulesRemap) {
|
||||
var exported = formatter.getExport(node.left, scope);
|
||||
if (exported) {
|
||||
return formatter.remapExportAssignment(node, exported);
|
||||
}
|
||||
|
||||
var nodes = [];
|
||||
nodes.push(remapped);
|
||||
|
||||
var operator;
|
||||
if (node.operator === "--") {
|
||||
operator = "+";
|
||||
} else { // "++"
|
||||
operator = "-";
|
||||
}
|
||||
nodes.push(t.binaryExpression(operator, node.argument, t.literal(1)));
|
||||
|
||||
return t.sequenceExpression(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
if (node._skipModulesRemap) {
|
||||
return this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
exit(node, parent, scope, formatter) {
|
||||
if (t.isAssignmentExpression(node) && !node._ignoreModulesRemap) {
|
||||
var exported = formatter.getExport(node.left, scope);
|
||||
if (exported) {
|
||||
return formatter.remapExportAssignment(node, exported);
|
||||
}
|
||||
UpdateExpression(node, parent, scope, formatter) {
|
||||
var exported = formatter.getExport(node.argument, scope);
|
||||
if (!exported) return;
|
||||
|
||||
this.skip();
|
||||
|
||||
// expand to long file assignment expression
|
||||
var assign = t.assignmentExpression(node.operator[0] + "=", node.argument, t.literal(1));
|
||||
|
||||
// remap this assignment expression
|
||||
var remapped = formatter.remapExportAssignment(assign, exported);
|
||||
|
||||
// we don't need to change the result
|
||||
if (t.isExpressionStatement(parent) || node.prefix) {
|
||||
return remapped;
|
||||
}
|
||||
|
||||
var nodes = [];
|
||||
nodes.push(remapped);
|
||||
|
||||
var operator;
|
||||
if (node.operator === "--") {
|
||||
operator = "+";
|
||||
} else { // "++"
|
||||
operator = "-";
|
||||
}
|
||||
nodes.push(t.binaryExpression(operator, node.argument, t.literal(1)));
|
||||
|
||||
return t.sequenceExpression(nodes);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var importsVisitor = {
|
||||
ImportDeclaration: {
|
||||
@@ -185,8 +188,8 @@ export default class DefaultFormatter {
|
||||
|
||||
getModuleName() {
|
||||
var opts = this.file.opts;
|
||||
// moduleId is n/a if a `getModuleName()` is provided
|
||||
if (opts.moduleId && !opts.getModuleName) {
|
||||
// moduleId is n/a if a `getModuleId()` is provided
|
||||
if (opts.moduleId && !opts.getModuleId) {
|
||||
return opts.moduleId;
|
||||
}
|
||||
|
||||
@@ -217,10 +220,9 @@ export default class DefaultFormatter {
|
||||
// normalize path separators
|
||||
moduleName = moduleName.replace(/\\/g, "/");
|
||||
|
||||
if (opts.getModuleName) {
|
||||
// If return is falsy, assume they want us to use
|
||||
// our generated default name
|
||||
return opts.getModuleName(moduleName) || moduleName;
|
||||
if (opts.getModuleId) {
|
||||
// If return is falsy, assume they want us to use our generated default name
|
||||
return opts.getModuleId(moduleName) || moduleName;
|
||||
} else {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export default class Transformer {
|
||||
|
||||
//
|
||||
|
||||
if (!this.shouldVisit) {
|
||||
if (!this.shouldVisit && !this.handlers.enter && !this.handlers.exit) {
|
||||
var types = Object.keys(this.handlers);
|
||||
this.shouldVisit = function (node) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as t from "../../../types";
|
||||
|
||||
export { check } from "../internal/modules";
|
||||
export { shouldVisit } from "../internal/modules";
|
||||
|
||||
function keepBlockHoist(node, nodes) {
|
||||
if (node._blockHoist) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import callDelegate from "../../helpers/call-delegate";
|
||||
import * as util from "../../../util";
|
||||
import traverse from "../../../traversal";
|
||||
import * as t from "../../../types";
|
||||
|
||||
export function shouldVisit(node) {
|
||||
@@ -13,16 +14,15 @@ var hasDefaults = function (node) {
|
||||
return false;
|
||||
};
|
||||
|
||||
var iifeVisitor = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (!this.isReferencedIdentifier()) return;
|
||||
var iifeVisitor = traverse.explode({
|
||||
ReferencedIdentifier(node, parent, scope, state) {
|
||||
if (!state.scope.hasOwnBinding(node.name)) return;
|
||||
if (state.scope.bindingIdentifierEquals(node.name, node)) return;
|
||||
|
||||
state.iife = true;
|
||||
this.stop();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
if (!hasDefaults(node)) return;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import traverse from "../../../traversal";
|
||||
import * as t from "../../../types";
|
||||
|
||||
var visitor = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (!this.isReferencedIdentifier()) return;
|
||||
var visitor = traverse.explode({
|
||||
ReferencedIdentifier(node, parent, scope, state) {
|
||||
if (t.isFor(parent) && parent.left === node) return;
|
||||
|
||||
var declared = state.letRefs[node.name];
|
||||
@@ -25,7 +25,7 @@ var visitor = {
|
||||
return t.logicalExpression("&&", assert, node);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export var metadata = {
|
||||
optional: true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import reduceRight from "lodash/collection/reduceRight";
|
||||
import * as messages from "../../../messages";
|
||||
import flatten from "lodash/array/flatten";
|
||||
import traverse from "../../../traversal";
|
||||
import * as util from "../../../util";
|
||||
import map from "lodash/collection/map";
|
||||
import * as t from "../../../types";
|
||||
@@ -16,54 +17,61 @@ function returnBlock(expr) {
|
||||
}
|
||||
|
||||
// looks for and replaces tail recursion calls
|
||||
var firstPass = {
|
||||
var firstPass = traverse.explode({
|
||||
enter(node, parent, scope, state) {
|
||||
if (this.isReturnStatement()) {
|
||||
this.skip();
|
||||
return state.subTransform(node.argument);
|
||||
} else if (t.isTryStatement(parent)) {
|
||||
if (t.isTryStatement(parent)) {
|
||||
if (node === parent.block) {
|
||||
this.skip();
|
||||
} else if (parent.finalizer && node !== parent.finalizer) {
|
||||
this.skip();
|
||||
}
|
||||
} else if (this.isFunction()) {
|
||||
this.skip();
|
||||
} else if (this.isVariableDeclaration()) {
|
||||
this.skip();
|
||||
state.vars.push(node);
|
||||
}
|
||||
},
|
||||
|
||||
ReturnStatement(node, parent, scope, state) {
|
||||
this.skip();
|
||||
return state.subTransform(node.argument);
|
||||
},
|
||||
|
||||
Function(node, parent, scope, state) {
|
||||
this.skip();
|
||||
},
|
||||
|
||||
VariableDeclaration(node, parent, scope, state) {
|
||||
this.skip();
|
||||
state.vars.push(node);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// hoists up function declarations, replaces `this` and `arguments` and marks
|
||||
// them as needed
|
||||
var secondPass = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (this.isThisExpression()) {
|
||||
state.needsThis = true;
|
||||
return state.getThisId();
|
||||
} else if (this.isReferencedIdentifier({ name: "arguments" })) {
|
||||
state.needsArguments = true;
|
||||
return state.getArgumentsId();
|
||||
} else if (this.isFunction()) {
|
||||
this.skip();
|
||||
if (this.isFunctionDeclaration()) {
|
||||
node = t.variableDeclaration("var", [
|
||||
t.variableDeclarator(node.id, t.toExpression(node))
|
||||
]);
|
||||
node._blockHoist = 2;
|
||||
return node;
|
||||
}
|
||||
var secondPass = traverse.explode({
|
||||
ThisExpression(node, parent, scope, state) {
|
||||
state.needsThis = true;
|
||||
return state.getThisId();
|
||||
},
|
||||
|
||||
ReferencedIdentifier(node, parent, scope, state) {
|
||||
if (node.name !== "arguments") return;
|
||||
state.needsArguments = true;
|
||||
return state.getArgumentsId();
|
||||
},
|
||||
|
||||
Function(node, parent, scope, state) {
|
||||
this.skip();
|
||||
if (this.isFunctionDeclaration()) {
|
||||
node = t.variableDeclaration("var", [
|
||||
t.variableDeclarator(node.id, t.toExpression(node))
|
||||
]);
|
||||
node._blockHoist = 2;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// optimizes recursion by removing `this` and `arguments` if they aren't used
|
||||
var thirdPass = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (!this.isExpressionStatement()) return;
|
||||
|
||||
var thirdPass = traverse.explode({
|
||||
ExpressionStatement(node, parent, scope, state) {
|
||||
var expr = node.expression;
|
||||
if (!t.isAssignmentExpression(expr)) return;
|
||||
|
||||
@@ -75,7 +83,7 @@ var thirdPass = {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
class TailCallTransformer {
|
||||
constructor(path, scope, file) {
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
export default {
|
||||
_modules: require("./internal/modules"),
|
||||
"utility.removeDebugger": require("./utility/remove-debugger"),
|
||||
"utility.removeConsole": require("./utility/remove-console"),
|
||||
|
||||
"utility.inlineEnvironmentVariables": require("./utility/inline-environment-variables"),
|
||||
"utility.inlineExpressions": require("./utility/inline-expressions"),
|
||||
|
||||
"minification.deadCodeElimination": require("./minification/dead-code-elimination"),
|
||||
|
||||
_modules: require("./internal/modules"),
|
||||
|
||||
"es7.classProperties": require("./es7/class-properties"),
|
||||
"es7.trailingFunctionCommas": require("./es7/trailing-function-commas"),
|
||||
"es7.asyncFunctions": require("./es7/async-functions"),
|
||||
@@ -109,12 +116,6 @@ export default {
|
||||
"es3.propertyLiterals": require("./es3/property-literals"),
|
||||
"es3.memberExpressionLiterals": require("./es3/member-expression-literals"),
|
||||
|
||||
"utility.removeDebugger": require("./utility/remove-debugger"),
|
||||
"utility.removeConsole": require("./utility/remove-console"),
|
||||
|
||||
"utility.inlineEnvironmentVariables": require("./utility/inline-environment-variables"),
|
||||
"utility.inlineExpressions": require("./utility/inline-expressions"),
|
||||
|
||||
"minification.memberExpressionLiterals": require("./minification/member-expression-literals"),
|
||||
"minification.propertyLiterals": require("./minification/property-literals"),
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ import { _ForOfStatementArray } from "../es6/for-of";
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var shouldVisit = t.isForOfStatement;
|
||||
export var optional = true;
|
||||
export var metadata = {
|
||||
optional: true
|
||||
};
|
||||
|
||||
export function ForOfStatement(node, parent, scope, file) {
|
||||
if (this.get("right").isTypeGeneric("Array")) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class Binding {
|
||||
* Description
|
||||
*/
|
||||
|
||||
setTypeAnnotation() {
|
||||
setTypeAnnotation() {
|
||||
var typeInfo = this.path.getTypeAnnotation();
|
||||
this.typeAnnotationInferred = typeInfo.inferred;
|
||||
this.typeAnnotation = typeInfo.annotation;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import * as t from "../types";
|
||||
|
||||
export default function (obj) {
|
||||
for (var type in obj) {
|
||||
var fns = obj[type];
|
||||
if (typeof fns === "function") {
|
||||
obj[type] = fns = { enter: fns };
|
||||
}
|
||||
|
||||
var aliases = t.FLIPPED_ALIAS_KEYS[type];
|
||||
if (aliases) {
|
||||
for (var i = 0; i < aliases.length; i++) {
|
||||
var alias = aliases[i];
|
||||
obj[alias] = obj[alias] || fns;
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import TraversalContext from "./context";
|
||||
import explode from "./explode";
|
||||
import { explode, verify } from "./visitors";
|
||||
import * as messages from "../messages";
|
||||
import includes from "lodash/collection/includes";
|
||||
import * as t from "../types";
|
||||
@@ -14,7 +14,7 @@ export default function traverse(parent, opts, scope, state, parentPath) {
|
||||
}
|
||||
|
||||
if (!opts) opts = {};
|
||||
traverse.verify(opts);
|
||||
verify(opts);
|
||||
|
||||
// array of nodes
|
||||
if (Array.isArray(parent)) {
|
||||
@@ -26,42 +26,8 @@ export default function traverse(parent, opts, scope, state, parentPath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Quickly iterate over some traversal options and validate them.
|
||||
*/
|
||||
|
||||
traverse.verify = function (opts) {
|
||||
if (opts._verified) return;
|
||||
|
||||
if (typeof opts === "function") {
|
||||
throw new Error(messages.get("traverseVerifyRootFunction"));
|
||||
}
|
||||
|
||||
if (!opts.enter) opts.enter = function () { };
|
||||
if (!opts.exit) opts.exit = function () { };
|
||||
if (!opts.shouldSkip) opts.shouldSkip = function () { return false; };
|
||||
|
||||
for (var key in opts) {
|
||||
// it's all good
|
||||
if (key === "blacklist") continue;
|
||||
|
||||
var opt = opts[key];
|
||||
|
||||
if (typeof opt === "function") {
|
||||
// it's all good, it's fine for this key to be a function
|
||||
if (key === "enter" || key === "exit" || key === "shouldSkip") continue;
|
||||
|
||||
throw new Error(messages.get("traverseVerifyVisitorFunction", key));
|
||||
} else if (typeof opt === "object") {
|
||||
for (var key2 in opt) {
|
||||
if (key2 === "enter" || key2 === "exit") continue;
|
||||
throw new Error(messages.get("traverseVerifyVisitorProperty", key, key2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
opts._verified = true;
|
||||
};
|
||||
traverse.verify = verify;
|
||||
traverse.explode = explode;
|
||||
|
||||
traverse.node = function (node, opts, scope, state, parentPath) {
|
||||
var keys = t.VISITOR_KEYS[node.type];
|
||||
@@ -113,8 +79,6 @@ traverse.removeProperties = function (tree) {
|
||||
return tree;
|
||||
};
|
||||
|
||||
traverse.explode = explode;
|
||||
|
||||
function hasBlacklistedType(node, parent, scope, state) {
|
||||
if (node.type === state.type) {
|
||||
state.has = true;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import PathHoister from "./hoister";
|
||||
import * as virtualTypes from "./virtual-types";
|
||||
import isBoolean from "lodash/lang/isBoolean";
|
||||
import isNumber from "lodash/lang/isNumber";
|
||||
import isRegExp from "lodash/lang/isRegExp";
|
||||
import isString from "lodash/lang/isString";
|
||||
import codeFrame from "../../helpers/code-frame";
|
||||
import parse from "../../helpers/parse";
|
||||
import { explode } from "../visitors";
|
||||
import traverse from "../index";
|
||||
import includes from "lodash/collection/includes";
|
||||
import assign from "lodash/object/assign";
|
||||
@@ -12,33 +14,33 @@ import extend from "lodash/object/extend";
|
||||
import Scope from "../scope";
|
||||
import * as t from "../../types";
|
||||
|
||||
var hoistVariablesVisitor = {
|
||||
enter(node, parent, scope) {
|
||||
if (this.isFunction()) {
|
||||
return this.skip();
|
||||
}
|
||||
var hoistVariablesVisitor = explode({
|
||||
Function() {
|
||||
this.skip();
|
||||
},
|
||||
|
||||
VariableDeclaration(node, parent, scope) {
|
||||
if (node.kind !== "var") return;
|
||||
|
||||
if (this.isVariableDeclaration() && node.kind === "var") {
|
||||
var bindings = this.getBindingIdentifiers();
|
||||
for (var key in bindings) {
|
||||
scope.push({ id: bindings[key] });
|
||||
}
|
||||
|
||||
var exprs = [];
|
||||
|
||||
for (var i = 0; i < node.declarations.length; i++) {
|
||||
var declar = node.declarations[i];
|
||||
if (declar.init) {
|
||||
exprs.push(t.expressionStatement(
|
||||
t.assignmentExpression("=", declar.id, declar.init)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return exprs;
|
||||
for (var key in bindings) {
|
||||
scope.push({ id: bindings[key] });
|
||||
}
|
||||
|
||||
var exprs = [];
|
||||
|
||||
for (var i = 0; i < node.declarations.length; i++) {
|
||||
var declar = node.declarations[i];
|
||||
if (declar.init) {
|
||||
exprs.push(t.expressionStatement(
|
||||
t.assignmentExpression("=", declar.id, declar.init)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return exprs;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export default class TraversalPath {
|
||||
constructor(parent, container) {
|
||||
@@ -89,6 +91,22 @@ export default class TraversalPath {
|
||||
return ourScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
getAncestry() {
|
||||
var ancestry = [];
|
||||
|
||||
var path = this.parentPath;
|
||||
while (path) {
|
||||
ancestry.push(path.node);
|
||||
path = path.parentPath;
|
||||
}
|
||||
|
||||
return ancestry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
@@ -510,7 +528,7 @@ export default class TraversalPath {
|
||||
}
|
||||
|
||||
if (this.node === replacement) {
|
||||
throw new Error("You're trying to replace a node with itself which doesn't make any sense. If you're trying to do a transformer recache then use `this.checkSelf()`");
|
||||
return this.checkSelf();
|
||||
}
|
||||
|
||||
// normalise inserting an entire AST
|
||||
@@ -662,12 +680,21 @@ export default class TraversalPath {
|
||||
if (!node) return;
|
||||
|
||||
var opts = this.opts;
|
||||
var fn = opts[key] || opts;
|
||||
if (opts[node.type]) fn = opts[node.type][key] || fn;
|
||||
var fns = [].concat(opts[key]);
|
||||
|
||||
// call the function with the params (node, parent, scope, state)
|
||||
var replacement = fn.call(this, node, this.parent, this.scope, this.state);
|
||||
if (replacement) this.replaceWith(replacement, true);
|
||||
if (opts[node.type]) {
|
||||
fns = fns.concat(opts[node.type][key]);
|
||||
}
|
||||
|
||||
for (var fn of (fns: Array)) {
|
||||
if (!fn) continue;
|
||||
|
||||
// call the function with the params (node, parent, scope, state)
|
||||
var replacement = fn.call(this, node, this.parent, this.scope, this.state);
|
||||
if (replacement) this.replaceWith(replacement, true);
|
||||
|
||||
if (this.shouldStop) break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -929,46 +956,6 @@ export default class TraversalPath {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
isScope(): boolean {
|
||||
return t.isScope(this.node, this.parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
isReferencedIdentifier(opts): boolean {
|
||||
return t.isReferencedIdentifier(this.node, this.parent, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
isReferenced(): boolean {
|
||||
return t.isReferenced(this.node, this.parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
isBlockScoped(): boolean {
|
||||
return t.isBlockScoped(this.node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
isVar(): boolean {
|
||||
return t.isVar(this.node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
@@ -1087,8 +1074,15 @@ export default class TraversalPath {
|
||||
assign(TraversalPath.prototype, require("./evaluation"));
|
||||
assign(TraversalPath.prototype, require("./conversion"));
|
||||
|
||||
for (var i = 0; i < t.TYPES.length; i++) {
|
||||
let type = t.TYPES[i];
|
||||
for (let type in virtualTypes) {
|
||||
if (type[0] === "_") continue;
|
||||
|
||||
TraversalPath.prototype[`is${type}`] = function (opts) {
|
||||
return virtualTypes[type].checkPath(this, opts);
|
||||
};
|
||||
}
|
||||
|
||||
for (let type of (t.TYPES: Array)) {
|
||||
let typeKey = `is${type}`;
|
||||
TraversalPath.prototype[typeKey] = function (opts) {
|
||||
return t[typeKey](this.node, opts);
|
||||
|
||||
34
src/babel/traversal/path/virtual-types.js
Normal file
34
src/babel/traversal/path/virtual-types.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as t from "../../types";
|
||||
|
||||
export var ReferencedIdentifier = {
|
||||
type: "Identifier",
|
||||
checkPath(path, opts) {
|
||||
return t.isReferencedIdentifier(path.node, path.parent, opts);
|
||||
}
|
||||
};
|
||||
|
||||
export var Scope = {
|
||||
type: "Scopable",
|
||||
checkPath(path) {
|
||||
return t.isScope(path.node, path.parent);
|
||||
}
|
||||
};
|
||||
|
||||
export var Referenced = {
|
||||
checkPath(path) {
|
||||
return t.isReferenced(path.node, path.parent);
|
||||
}
|
||||
};
|
||||
|
||||
export var BlockScoped = {
|
||||
checkPath(path) {
|
||||
return t.isBlockScoped(path.node);
|
||||
}
|
||||
};
|
||||
|
||||
export var Var = {
|
||||
type: "VariableDeclaration",
|
||||
checkPath(path) {
|
||||
return t.isVar(path.node);
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import includes from "lodash/collection/includes";
|
||||
import explode from "./explode";
|
||||
import { explode } from "./visitors";
|
||||
import traverse from "./index";
|
||||
import defaults from "lodash/object/defaults";
|
||||
import * as messages from "../messages";
|
||||
@@ -38,54 +38,72 @@ var functionVariableVisitor = {
|
||||
}
|
||||
};
|
||||
|
||||
var programReferenceVisitor = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (t.isReferencedIdentifier(node, parent)) {
|
||||
var bindingInfo = scope.getBinding(node.name);
|
||||
if (bindingInfo) {
|
||||
bindingInfo.reference();
|
||||
} else {
|
||||
state.addGlobal(node);
|
||||
}
|
||||
} else if (t.isLabeledStatement(node)) {
|
||||
var programReferenceVisitor = explode({
|
||||
ReferencedIdentifier(node, parent, scope, state) {
|
||||
var bindingInfo = scope.getBinding(node.name);
|
||||
if (bindingInfo) {
|
||||
bindingInfo.reference();
|
||||
} else {
|
||||
state.addGlobal(node);
|
||||
} else if (t.isAssignmentExpression(node)) {
|
||||
scope.registerConstantViolation(this.get("left"), this.get("right"));
|
||||
} else if (t.isUpdateExpression(node)) {
|
||||
scope.registerConstantViolation(this.get("argument"), null);
|
||||
} else if (t.isUnaryExpression(node) && node.operator === "delete") {
|
||||
scope.registerConstantViolation(this.get("left"), null);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
ExportDeclaration(node, parent, scope, state) {
|
||||
var declar = node.declaration;
|
||||
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
|
||||
scope.getBinding(declar.id.name).reference();
|
||||
} else if (t.isVariableDeclaration(declar)) {
|
||||
for (var decl of (declar.declarations: Array)) {
|
||||
scope.getBinding(decl.id.name).reference();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
LabeledStatement(node, parent, scope, state) {
|
||||
state.addGlobal(node);
|
||||
},
|
||||
|
||||
AssignmentExpression(node, parent, scope, state) {
|
||||
scope.registerConstantViolation(this.get("left"), this.get("right"));
|
||||
},
|
||||
|
||||
UpdateExpression(node, parent, scope, state) {
|
||||
scope.registerConstantViolation(this.get("argument"), null);
|
||||
},
|
||||
|
||||
UnaryExpression(node, parent, scope, state) {
|
||||
if (node.operator === "delete") scope.registerConstantViolation(this.get("left"), null);
|
||||
}
|
||||
});
|
||||
|
||||
var blockVariableVisitor = explode({
|
||||
Scope() {
|
||||
this.skip();
|
||||
},
|
||||
|
||||
var blockVariableVisitor = {
|
||||
enter(node, parent, scope, state) {
|
||||
if (this.isFunctionDeclaration() || this.isBlockScoped()) {
|
||||
state.registerDeclaration(this);
|
||||
}
|
||||
if (this.isScope()) {
|
||||
this.skip();
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var renameVisitor = explode({
|
||||
Identifier(node, parent, scope, state) {
|
||||
if (this.isReferenced() && node.name === state.oldName) {
|
||||
if (this.parentPath.isProperty() && this.key === "key" && parent.shorthand) {
|
||||
var value = t.identifier(state.newName);;
|
||||
ReferencedIdentifier(node, parent, scope, state) {
|
||||
if (node.name !== state.oldName) return;
|
||||
|
||||
if (parent.value === state.binding) {
|
||||
state.info.identifier = state.binding = value;
|
||||
}
|
||||
if (this.parentPath.isProperty() && this.key === "key" && parent.shorthand) {
|
||||
var value = t.identifier(state.newName);;
|
||||
|
||||
parent.shorthand = false;
|
||||
parent.value = value;
|
||||
parent.key = t.identifier(state.oldName);
|
||||
} else {
|
||||
node.name = state.newName;
|
||||
if (parent.value === state.binding) {
|
||||
state.info.identifier = state.binding = value;
|
||||
}
|
||||
|
||||
parent.shorthand = false;
|
||||
parent.value = value;
|
||||
parent.key = t.identifier(state.oldName);
|
||||
} else {
|
||||
node.name = state.newName;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -244,12 +262,14 @@ export default class Scope {
|
||||
|
||||
var add = function (node) {
|
||||
if (t.isModuleDeclaration(node)) {
|
||||
if (node.specifiers && node.specifiers.length) {
|
||||
if (node.source) {
|
||||
add(node.source);
|
||||
} else if (node.specifiers && node.specifiers.length) {
|
||||
for (var i = 0; i < node.specifiers.length; i++) {
|
||||
add(node.specifiers[i]);
|
||||
}
|
||||
} else {
|
||||
add(node.source);
|
||||
} else if (node.declaration) {
|
||||
add(node.declaration);
|
||||
}
|
||||
} else if (t.isModuleSpecifier(node)) {
|
||||
add(node.local);
|
||||
|
||||
166
src/babel/traversal/visitors.js
Normal file
166
src/babel/traversal/visitors.js
Normal file
@@ -0,0 +1,166 @@
|
||||
import * as virtualTypes from "./path/virtual-types";
|
||||
import * as messages from "../messages";
|
||||
import * as t from "../types";
|
||||
import esquery from "esquery";
|
||||
|
||||
export function explode(visitor, mergeConflicts) {
|
||||
// make sure there's no __esModule type since this is because we're using loose mode
|
||||
// and it sets __esModule to be enumerable on all modules :(
|
||||
delete visitor.__esModule;
|
||||
|
||||
if (visitor.queries) {
|
||||
ensureEntranceObjects(visitor.queries);
|
||||
addQueries(visitor);
|
||||
delete visitor.queries;
|
||||
}
|
||||
|
||||
// ensure visitors are objects
|
||||
ensureEntranceObjects(visitor);
|
||||
|
||||
// add type wrappers
|
||||
for (let nodeType in visitor) {
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
|
||||
var wrapper = virtualTypes[nodeType];
|
||||
if (!wrapper) continue;
|
||||
|
||||
// wrap all the functions
|
||||
var fns = visitor[nodeType];
|
||||
for (var type in fns) {
|
||||
fns[type] = wrapCheck(wrapper, fns[type]);
|
||||
}
|
||||
|
||||
// clear it from the visitor
|
||||
delete visitor[nodeType];
|
||||
|
||||
if (wrapper.type) {
|
||||
// merge the visitor if necessary or just put it back in
|
||||
if (visitor[wrapper.type]) {
|
||||
merge(visitor[wrapper.type], fns);
|
||||
} else {
|
||||
visitor[wrapper.type] = fns;
|
||||
}
|
||||
} else {
|
||||
merge(visitor, fns);
|
||||
}
|
||||
}
|
||||
|
||||
// add aliases
|
||||
for (let nodeType in visitor) {
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
|
||||
var fns = visitor[nodeType];
|
||||
|
||||
var aliases = t.FLIPPED_ALIAS_KEYS[nodeType];
|
||||
if (!aliases) continue;
|
||||
|
||||
// clear it form the visitor
|
||||
delete visitor[nodeType];
|
||||
|
||||
for (var alias of (aliases: Array)) {
|
||||
var existing = visitor[alias];
|
||||
if (existing) {
|
||||
if (mergeConflicts) {
|
||||
merge(existing, fns);
|
||||
}
|
||||
} else {
|
||||
visitor[alias] = fns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return visitor;
|
||||
}
|
||||
|
||||
export function verify(visitor) {
|
||||
if (visitor._verified) return;
|
||||
|
||||
if (typeof visitor === "function") {
|
||||
throw new Error(messages.get("traverseVerifyRootFunction"));
|
||||
}
|
||||
|
||||
if (!visitor.enter) visitor.enter = function () { };
|
||||
if (!visitor.exit) visitor.exit = function () { };
|
||||
if (!visitor.shouldSkip) visitor.shouldSkip = function () { return false; };
|
||||
|
||||
for (var nodeType in visitor) {
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
|
||||
if (t.TYPES.indexOf(nodeType) < 0) {
|
||||
throw new Error(messages.get("traverseVerifyNodeType", nodeType));
|
||||
}
|
||||
|
||||
var visitors = visitor[nodeType];
|
||||
|
||||
if (typeof visitors === "function") {
|
||||
throw new Error(messages.get("traverseVerifyVisitorFunction", nodeType));
|
||||
} else if (typeof visitors === "object") {
|
||||
for (var visitorKey in visitors) {
|
||||
if (visitorKey === "enter" || visitorKey === "exit") continue;
|
||||
throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visitor._verified = true;
|
||||
}
|
||||
|
||||
function ensureEntranceObjects(obj) {
|
||||
for (let key in obj) {
|
||||
if (shouldIgnoreKey(key)) continue;
|
||||
|
||||
var fns = obj[key];
|
||||
if (typeof fns === "function") {
|
||||
obj[key] = { enter: fns };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addQueries(visitor) {
|
||||
for (var selector in visitor.queries) {
|
||||
var fns = visitor.queries[selector];
|
||||
addSelector(visitor, selector, fns);
|
||||
}
|
||||
}
|
||||
|
||||
function addSelector(visitor, selector, fns) {
|
||||
selector = esquery.parse(selector);
|
||||
|
||||
for (var key in fns) {
|
||||
let fn = fns[key];
|
||||
fns[key] = function (node) {
|
||||
if (esquery.matches(node, selector, this.getAncestry())) {
|
||||
return fn.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
merge(visitor, fns);
|
||||
}
|
||||
|
||||
function wrapCheck(wrapper, fn) {
|
||||
return function () {
|
||||
if (wrapper.checkPath(this)) {
|
||||
return fn.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function shouldIgnoreKey(key) {
|
||||
// internal/hidden key
|
||||
if (key[0] === "_") return true;
|
||||
|
||||
// ignore function keys
|
||||
if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
|
||||
|
||||
// ignore other options
|
||||
if (key === "blacklist" || key === "noScope") return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function merge(dest, src) {
|
||||
for (var key in src) {
|
||||
dest[key] = (dest[key] || []).concat(src[key]);
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,8 @@ suite("api", function () {
|
||||
assert.ok(!result.ast);
|
||||
});
|
||||
|
||||
suite("getModuleName() {} option", function () {
|
||||
// As of this commit, `getModuleName` is the only option that isn't JSON
|
||||
suite("getModuleId() {} option", function () {
|
||||
// As of this commit, `getModuleId` is the only option that isn't JSON
|
||||
// compatible which is why it's not inside /test/core/fixtures/transformation
|
||||
|
||||
function getModuleNameTest(moduleFormat, expected) {
|
||||
@@ -27,7 +27,7 @@ suite("api", function () {
|
||||
filename: "foo/bar/index",
|
||||
modules: moduleFormat,
|
||||
moduleIds: true,
|
||||
getModuleName: function (name) {
|
||||
getModuleId: function (name) {
|
||||
return name.replace(/\/index$/, "");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.nextOdd = nextOdd;
|
||||
|
||||
var _isEven = require("./evens");
|
||||
var _evens = require("./evens");
|
||||
|
||||
function nextOdd(n) {
|
||||
return _isEven.isEven(n) ? n + 1 : n + 2;
|
||||
return _evens.isEven(n) ? n + 1 : n + 2;
|
||||
}
|
||||
|
||||
var isOdd = (function (isEven) {
|
||||
return function (n) {
|
||||
return !isEven(n);
|
||||
};
|
||||
})(_isEven.isEven);
|
||||
exports.isOdd = isOdd;
|
||||
})(_evens.isEven);
|
||||
exports.isOdd = isOdd;
|
||||
@@ -4,7 +4,7 @@ var _foo = require("foo");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
var _foo22 = babelHelpers.interopRequireDefault(_foo);
|
||||
var _foo3 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
_foo2["default"];
|
||||
_foo22["default"];
|
||||
_foo3["default"];
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var _import = require("foo");
|
||||
var _foo = require("foo");
|
||||
|
||||
var foo = babelHelpers.interopRequireWildcard(_import);
|
||||
var foo = babelHelpers.interopRequireWildcard(_foo);
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var _foo$xyz = require("foo");
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo$xyz2 = babelHelpers.interopRequireDefault(_foo$xyz);
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
_foo$xyz2["default"];
|
||||
_foo$xyz.baz;
|
||||
_foo2["default"];
|
||||
_foo.baz;
|
||||
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _bar = require("foo");
|
||||
var _foo = require("foo");
|
||||
|
||||
_bar.bar;
|
||||
_bar.bar2;
|
||||
_bar.baz;
|
||||
_bar.bar;
|
||||
_bar.bar;
|
||||
_bar.xyz;
|
||||
_foo.bar;
|
||||
_foo.bar2;
|
||||
_foo.baz;
|
||||
_foo.bar;
|
||||
_foo.bar;
|
||||
_foo.xyz;
|
||||
@@ -10,22 +10,22 @@ require("foo-bar");
|
||||
|
||||
require("./directory/foo-bar");
|
||||
|
||||
var _foo = require("foo2");
|
||||
var _foo2 = require("foo2");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
var _foo22 = babelHelpers.interopRequireDefault(_foo2);
|
||||
|
||||
var _import = require("foo3");
|
||||
var _foo3 = require("foo3");
|
||||
|
||||
var foo2 = babelHelpers.interopRequireWildcard(_import);
|
||||
var foo2 = babelHelpers.interopRequireWildcard(_foo3);
|
||||
|
||||
var _bar = require("foo4");
|
||||
var _foo4 = require("foo4");
|
||||
|
||||
var _bar2 = require("foo5");
|
||||
var _foo5 = require("foo5");
|
||||
|
||||
exports.test = test;
|
||||
var test = 5;
|
||||
|
||||
exports.test = test;
|
||||
_bar.bar;
|
||||
_bar2.foo;
|
||||
_foo2["default"];
|
||||
_foo4.bar;
|
||||
_foo5.foo;
|
||||
_foo22["default"];
|
||||
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _foo2 = require("bar");
|
||||
var _bar = require("bar");
|
||||
|
||||
var _foo3 = babelHelpers.interopRequireDefault(_foo2);
|
||||
var _bar2 = babelHelpers.interopRequireDefault(_bar);
|
||||
|
||||
exports.foo = _foo3["default"];
|
||||
exports.foo = _bar2["default"];
|
||||
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _import = require("bar");
|
||||
var _bar = require("bar");
|
||||
|
||||
var _foo = babelHelpers.interopRequireWildcard(_import);
|
||||
var _foo = babelHelpers.interopRequireWildcard(_bar);
|
||||
|
||||
exports.foo = _foo;
|
||||
exports.foo = _foo;
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _toString = require("foo");
|
||||
var _foo = require("foo");
|
||||
|
||||
var _toString2 = babelHelpers.interopRequireDefault(_toString);
|
||||
var _foo2 = babelHelpers.interopRequireDefault(_foo);
|
||||
|
||||
_toString2["default"];
|
||||
_foo2["default"];
|
||||
@@ -17,11 +17,11 @@ _Object$defineProperty(exports, "__esModule", {
|
||||
exports.giveWord = giveWord;
|
||||
var marked0$0 = [giveWord].map(_regeneratorRuntime.mark);
|
||||
|
||||
var _foo = require("someModule");
|
||||
var _someModule = require("someModule");
|
||||
|
||||
var _foo2 = _interopRequireDefault(_foo);
|
||||
var _someModule2 = _interopRequireDefault(_someModule);
|
||||
|
||||
var bar = _interopRequireWildcard(_foo);
|
||||
var bar = _interopRequireWildcard(_someModule);
|
||||
|
||||
var myWord = _Symbol("abc");
|
||||
exports.myWord = myWord;
|
||||
@@ -40,5 +40,5 @@ function giveWord() {
|
||||
}, marked0$0[0], this);
|
||||
}
|
||||
|
||||
_foo2["default"];
|
||||
bar;
|
||||
_someModule2["default"];
|
||||
bar;
|
||||
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _last2 = require("lodash/array/last");
|
||||
var _lodashArrayLast = require("lodash/array/last");
|
||||
|
||||
var _last3 = babelHelpers.interopRequireDefault(_last2);
|
||||
var _lodashArrayLast2 = babelHelpers.interopRequireDefault(_lodashArrayLast);
|
||||
|
||||
var Container = (function () {
|
||||
function Container() {
|
||||
@@ -20,11 +20,11 @@ var Container = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
return _last3["default"](this.tokens.get(key));
|
||||
return _lodashArrayLast2["default"](this.tokens.get(key));
|
||||
}
|
||||
}]);
|
||||
return Container;
|
||||
})();
|
||||
|
||||
exports["default"] = Container;
|
||||
module.exports = exports["default"];
|
||||
module.exports = exports["default"];
|
||||
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _getForm2 = require("./store");
|
||||
var _store = require("./store");
|
||||
|
||||
var Login = (function (_React$Component) {
|
||||
function Login() {
|
||||
@@ -19,11 +19,11 @@ var Login = (function (_React$Component) {
|
||||
babelHelpers.createClass(Login, [{
|
||||
key: "getForm",
|
||||
value: function getForm() {
|
||||
return _getForm2.getForm().toJS();
|
||||
return _store.getForm().toJS();
|
||||
}
|
||||
}]);
|
||||
return Login;
|
||||
})(React.Component);
|
||||
|
||||
exports["default"] = Login;
|
||||
module.exports = exports["default"];
|
||||
module.exports = exports["default"];
|
||||
Reference in New Issue
Block a user