feat: refactoring project
This commit is contained in:
17
node_modules/@babel/traverse/lib/path/replacement.js
generated
vendored
17
node_modules/@babel/traverse/lib/path/replacement.js
generated
vendored
@@ -16,6 +16,7 @@ var _cache = require("../cache.js");
|
||||
var _modification = require("./modification.js");
|
||||
var _parser = require("@babel/parser");
|
||||
var _t = require("@babel/types");
|
||||
var _context = require("./context.js");
|
||||
const {
|
||||
FUNCTION_TYPES,
|
||||
arrowFunctionExpression,
|
||||
@@ -48,7 +49,7 @@ const {
|
||||
} = _t;
|
||||
function replaceWithMultiple(nodes) {
|
||||
var _getCachedPaths;
|
||||
this.resync();
|
||||
_context.resync.call(this);
|
||||
nodes = _modification._verifyNodeList.call(this, nodes);
|
||||
inheritLeadingComments(nodes[0], this.node);
|
||||
inheritTrailingComments(nodes[nodes.length - 1], this.node);
|
||||
@@ -63,7 +64,7 @@ function replaceWithMultiple(nodes) {
|
||||
return paths;
|
||||
}
|
||||
function replaceWithSourceString(replacement) {
|
||||
this.resync();
|
||||
_context.resync.call(this);
|
||||
let ast;
|
||||
try {
|
||||
replacement = `(${replacement})`;
|
||||
@@ -86,7 +87,7 @@ function replaceWithSourceString(replacement) {
|
||||
return this.replaceWith(expressionAST);
|
||||
}
|
||||
function replaceWith(replacementPath) {
|
||||
this.resync();
|
||||
_context.resync.call(this);
|
||||
if (this.removed) {
|
||||
throw new Error("You can't replace this node, we've already removed it");
|
||||
}
|
||||
@@ -125,7 +126,7 @@ function replaceWith(replacementPath) {
|
||||
}
|
||||
_replaceWith.call(this, replacement);
|
||||
this.type = replacement.type;
|
||||
this.setScope();
|
||||
_context.setScope.call(this);
|
||||
this.requeue();
|
||||
return [nodePath ? this.get(nodePath) : this];
|
||||
}
|
||||
@@ -144,7 +145,7 @@ function _replaceWith(node) {
|
||||
this.node = this.container[this.key] = node;
|
||||
}
|
||||
function replaceExpressionWithStatements(nodes) {
|
||||
this.resync();
|
||||
_context.resync.call(this);
|
||||
const declars = [];
|
||||
const nodesAsSingleExpression = gatherSequenceExpressions(nodes, declars);
|
||||
if (nodesAsSingleExpression) {
|
||||
@@ -154,8 +155,8 @@ function replaceExpressionWithStatements(nodes) {
|
||||
return this.replaceWith(nodesAsSingleExpression)[0].get("expressions");
|
||||
}
|
||||
const functionParent = this.getFunctionParent();
|
||||
const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
|
||||
const isParentGenerator = functionParent == null ? void 0 : functionParent.is("generator");
|
||||
const isParentAsync = functionParent == null ? void 0 : functionParent.node.async;
|
||||
const isParentGenerator = functionParent == null ? void 0 : functionParent.node.generator;
|
||||
const container = arrowFunctionExpression([], blockStatement(nodes));
|
||||
this.replaceWith(callExpression(container, []));
|
||||
const callee = this.get("callee");
|
||||
@@ -244,7 +245,7 @@ function gatherSequenceExpressions(nodes, declars) {
|
||||
}
|
||||
}
|
||||
function replaceInline(nodes) {
|
||||
this.resync();
|
||||
_context.resync.call(this);
|
||||
if (Array.isArray(nodes)) {
|
||||
if (Array.isArray(this.container)) {
|
||||
nodes = _modification._verifyNodeList.call(this, nodes);
|
||||
|
||||
Reference in New Issue
Block a user