mirror of
https://github.com/actions/labeler
synced 2026-05-09 23:11:01 +02:00
build
This commit is contained in:
16
node_modules/@babel/traverse/lib/context.js
generated
vendored
16
node_modules/@babel/traverse/lib/context.js
generated
vendored
@@ -7,17 +7,11 @@ exports.default = void 0;
|
||||
|
||||
var _path = _interopRequireDefault(require("./path"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -36,8 +30,8 @@ class TraversalContext {
|
||||
const opts = this.opts;
|
||||
if (opts.enter || opts.exit) return true;
|
||||
if (opts[node.type]) return true;
|
||||
const keys = t().VISITOR_KEYS[node.type];
|
||||
if (!keys || !keys.length) return false;
|
||||
const keys = t.VISITOR_KEYS[node.type];
|
||||
if (!(keys == null ? void 0 : keys.length)) return false;
|
||||
|
||||
for (const key of keys) {
|
||||
if (node[key]) return true;
|
||||
|
||||
46
node_modules/@babel/traverse/lib/index.js
generated
vendored
46
node_modules/@babel/traverse/lib/index.js
generated
vendored
@@ -30,25 +30,7 @@ var visitors = _interopRequireWildcard(require("./visitors"));
|
||||
|
||||
exports.visitors = visitors;
|
||||
|
||||
function _includes() {
|
||||
const data = _interopRequireDefault(require("lodash/includes"));
|
||||
|
||||
_includes = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var cache = _interopRequireWildcard(require("./cache"));
|
||||
|
||||
@@ -58,7 +40,9 @@ var _scope = _interopRequireDefault(require("./scope"));
|
||||
|
||||
var _hub = _interopRequireDefault(require("./hub"));
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -72,6 +56,10 @@ function traverse(parent, opts, scope, state, parentPath) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!t.VISITOR_KEYS[parent.type]) {
|
||||
return;
|
||||
}
|
||||
|
||||
visitors.explode(opts);
|
||||
traverse.node(parent, opts, scope, state, parentPath);
|
||||
}
|
||||
@@ -81,11 +69,11 @@ traverse.verify = visitors.verify;
|
||||
traverse.explode = visitors.explode;
|
||||
|
||||
traverse.cheap = function (node, enter) {
|
||||
return t().traverseFast(node, enter);
|
||||
return t.traverseFast(node, enter);
|
||||
};
|
||||
|
||||
traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
|
||||
const keys = t().VISITOR_KEYS[node.type];
|
||||
const keys = t.VISITOR_KEYS[node.type];
|
||||
if (!keys) return;
|
||||
const context = new _context.default(scope, opts, state, parentPath);
|
||||
|
||||
@@ -96,24 +84,24 @@ traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
|
||||
};
|
||||
|
||||
traverse.clearNode = function (node, opts) {
|
||||
t().removeProperties(node, opts);
|
||||
t.removeProperties(node, opts);
|
||||
cache.path.delete(node);
|
||||
};
|
||||
|
||||
traverse.removeProperties = function (tree, opts) {
|
||||
t().traverseFast(tree, traverse.clearNode, opts);
|
||||
t.traverseFast(tree, traverse.clearNode, opts);
|
||||
return tree;
|
||||
};
|
||||
|
||||
function hasBlacklistedType(path, state) {
|
||||
function hasDenylistedType(path, state) {
|
||||
if (path.node.type === state.type) {
|
||||
state.has = true;
|
||||
path.stop();
|
||||
}
|
||||
}
|
||||
|
||||
traverse.hasType = function (tree, type, blacklistTypes) {
|
||||
if ((0, _includes().default)(blacklistTypes, tree.type)) return false;
|
||||
traverse.hasType = function (tree, type, denylistTypes) {
|
||||
if (denylistTypes == null ? void 0 : denylistTypes.includes(tree.type)) return false;
|
||||
if (tree.type === type) return true;
|
||||
const state = {
|
||||
has: false,
|
||||
@@ -121,8 +109,8 @@ traverse.hasType = function (tree, type, blacklistTypes) {
|
||||
};
|
||||
traverse(tree, {
|
||||
noScope: true,
|
||||
blacklist: blacklistTypes,
|
||||
enter: hasBlacklistedType
|
||||
denylist: denylistTypes,
|
||||
enter: hasDenylistedType
|
||||
}, null, state);
|
||||
return state.has;
|
||||
};
|
||||
|
||||
16
node_modules/@babel/traverse/lib/path/ancestry.js
generated
vendored
16
node_modules/@babel/traverse/lib/path/ancestry.js
generated
vendored
@@ -14,21 +14,15 @@ exports.isAncestor = isAncestor;
|
||||
exports.isDescendant = isDescendant;
|
||||
exports.inType = inType;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _index = _interopRequireDefault(require("./index"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function findParent(callback) {
|
||||
let path = this;
|
||||
@@ -75,7 +69,7 @@ function getStatementParent() {
|
||||
function getEarliestCommonAncestorFrom(paths) {
|
||||
return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
|
||||
let earliest;
|
||||
const keys = t().VISITOR_KEYS[deepest.type];
|
||||
const keys = t.VISITOR_KEYS[deepest.type];
|
||||
|
||||
for (const ancestry of ancestries) {
|
||||
const path = ancestry[i + 1];
|
||||
|
||||
20
node_modules/@babel/traverse/lib/path/comments.js
generated
vendored
20
node_modules/@babel/traverse/lib/path/comments.js
generated
vendored
@@ -7,17 +7,11 @@ exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
|
||||
exports.addComment = addComment;
|
||||
exports.addComments = addComments;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function shareCommentsWithSiblings() {
|
||||
if (typeof this.key === "string") return;
|
||||
@@ -31,17 +25,17 @@ function shareCommentsWithSiblings() {
|
||||
const hasPrev = Boolean(prev.node);
|
||||
const hasNext = Boolean(next.node);
|
||||
|
||||
if (hasPrev && hasNext) {} else if (hasPrev) {
|
||||
if (hasPrev && !hasNext) {
|
||||
prev.addComments("trailing", trailing);
|
||||
} else if (hasNext) {
|
||||
} else if (hasNext && !hasPrev) {
|
||||
next.addComments("leading", leading);
|
||||
}
|
||||
}
|
||||
|
||||
function addComment(type, content, line) {
|
||||
t().addComment(this.node, type, content, line);
|
||||
t.addComment(this.node, type, content, line);
|
||||
}
|
||||
|
||||
function addComments(type, comments) {
|
||||
t().addComments(this.node, type, comments);
|
||||
t.addComments(this.node, type, comments);
|
||||
}
|
||||
40
node_modules/@babel/traverse/lib/path/context.js
generated
vendored
40
node_modules/@babel/traverse/lib/path/context.js
generated
vendored
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.call = call;
|
||||
exports._call = _call;
|
||||
exports.isBlacklisted = isBlacklisted;
|
||||
exports.isBlacklisted = exports.isDenylisted = isDenylisted;
|
||||
exports.visit = visit;
|
||||
exports.skip = skip;
|
||||
exports.skipKey = skipKey;
|
||||
@@ -26,6 +26,8 @@ exports._getQueueContexts = _getQueueContexts;
|
||||
|
||||
var _index = _interopRequireDefault(require("../index"));
|
||||
|
||||
var _index2 = require("./index");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function call(key) {
|
||||
@@ -61,15 +63,17 @@ function _call(fns) {
|
||||
}
|
||||
|
||||
if (this.node !== node) return true;
|
||||
if (this.shouldStop || this.shouldSkip || this.removed) return true;
|
||||
if (this._traverseFlags > 0) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isBlacklisted() {
|
||||
const blacklist = this.opts.blacklist;
|
||||
return blacklist && blacklist.indexOf(this.node.type) > -1;
|
||||
function isDenylisted() {
|
||||
var _this$opts$denylist;
|
||||
|
||||
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
|
||||
return denylist && denylist.indexOf(this.node.type) > -1;
|
||||
}
|
||||
|
||||
function visit() {
|
||||
@@ -77,7 +81,7 @@ function visit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isBlacklisted()) {
|
||||
if (this.isDenylisted()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +89,7 @@ function visit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.call("enter") || this.shouldSkip) {
|
||||
if (this.shouldSkip || this.call("enter") || this.shouldSkip) {
|
||||
this.debug("Skip...");
|
||||
return this.shouldStop;
|
||||
}
|
||||
@@ -103,12 +107,15 @@ function skip() {
|
||||
}
|
||||
|
||||
function skipKey(key) {
|
||||
if (this.skipKeys == null) {
|
||||
this.skipKeys = {};
|
||||
}
|
||||
|
||||
this.skipKeys[key] = true;
|
||||
}
|
||||
|
||||
function stop() {
|
||||
this.shouldStop = true;
|
||||
this.shouldSkip = true;
|
||||
this._traverseFlags |= _index2.SHOULD_SKIP | _index2.SHOULD_STOP;
|
||||
}
|
||||
|
||||
function setScope() {
|
||||
@@ -127,10 +134,11 @@ function setScope() {
|
||||
}
|
||||
|
||||
function setContext(context) {
|
||||
this.shouldSkip = false;
|
||||
this.shouldStop = false;
|
||||
this.removed = false;
|
||||
this.skipKeys = {};
|
||||
if (this.skipKeys != null) {
|
||||
this.skipKeys = {};
|
||||
}
|
||||
|
||||
this._traverseFlags = 0;
|
||||
|
||||
if (context) {
|
||||
this.context = context;
|
||||
@@ -208,18 +216,18 @@ function pushContext(context) {
|
||||
}
|
||||
|
||||
function setup(parentPath, container, listKey, key) {
|
||||
this.inList = !!listKey;
|
||||
this.listKey = listKey;
|
||||
this.parentKey = listKey || key;
|
||||
this.container = container;
|
||||
this.parentPath = parentPath || this.parentPath;
|
||||
this.setKey(key);
|
||||
}
|
||||
|
||||
function setKey(key) {
|
||||
var _this$node;
|
||||
|
||||
this.key = key;
|
||||
this.node = this.container[this.key];
|
||||
this.type = this.node && this.node.type;
|
||||
this.type = (_this$node = this.node) == null ? void 0 : _this$node.type;
|
||||
}
|
||||
|
||||
function requeue(pathToQueue = this) {
|
||||
|
||||
179
node_modules/@babel/traverse/lib/path/conversion.js
generated
vendored
179
node_modules/@babel/traverse/lib/path/conversion.js
generated
vendored
@@ -9,29 +9,15 @@ exports.arrowFunctionToShadowed = arrowFunctionToShadowed;
|
||||
exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment;
|
||||
exports.arrowFunctionToExpression = arrowFunctionToExpression;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _helperFunctionName() {
|
||||
const data = _interopRequireDefault(require("@babel/helper-function-name"));
|
||||
|
||||
_helperFunctionName = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _helperFunctionName = _interopRequireDefault(require("@babel/helper-function-name"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function toComputedKey() {
|
||||
const node = this.node;
|
||||
@@ -46,7 +32,7 @@ function toComputedKey() {
|
||||
}
|
||||
|
||||
if (!node.computed) {
|
||||
if (t().isIdentifier(key)) key = t().stringLiteral(key.name);
|
||||
if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
|
||||
}
|
||||
|
||||
return key;
|
||||
@@ -82,14 +68,14 @@ function ensureBlock() {
|
||||
|
||||
if (this.isFunction()) {
|
||||
key = "argument";
|
||||
statements.push(t().returnStatement(body.node));
|
||||
statements.push(t.returnStatement(body.node));
|
||||
} else {
|
||||
key = "expression";
|
||||
statements.push(t().expressionStatement(body.node));
|
||||
statements.push(t.expressionStatement(body.node));
|
||||
}
|
||||
}
|
||||
|
||||
this.node.body = t().blockStatement(statements);
|
||||
this.node.body = t.blockStatement(statements);
|
||||
const parentPath = this.get(stringPath);
|
||||
body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
|
||||
return this.node;
|
||||
@@ -126,12 +112,12 @@ function arrowFunctionToExpression({
|
||||
if (checkBinding) {
|
||||
this.parentPath.scope.push({
|
||||
id: checkBinding,
|
||||
init: t().objectExpression([])
|
||||
init: t.objectExpression([])
|
||||
});
|
||||
}
|
||||
|
||||
this.get("body").unshiftContainer("body", t().expressionStatement(t().callExpression(this.hub.addHelper("newArrowCheck"), [t().thisExpression(), checkBinding ? t().identifier(checkBinding.name) : t().identifier(thisBinding)])));
|
||||
this.replaceWith(t().callExpression(t().memberExpression((0, _helperFunctionName().default)(this, true) || this.node, t().identifier("bind")), [checkBinding ? t().identifier(checkBinding.name) : t().thisExpression()]));
|
||||
this.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(this.hub.addHelper("newArrowCheck"), [t.thisExpression(), checkBinding ? t.identifier(checkBinding.name) : t.identifier(thisBinding)])));
|
||||
this.replaceWith(t.callExpression(t.memberExpression((0, _helperFunctionName.default)(this, true) || this.node, t.identifier("bind")), [checkBinding ? t.identifier(checkBinding.name) : t.thisExpression()]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +127,7 @@ function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArro
|
||||
static: false
|
||||
});
|
||||
});
|
||||
const inConstructor = thisEnvFn && thisEnvFn.node.kind === "constructor";
|
||||
const inConstructor = (thisEnvFn == null ? void 0 : thisEnvFn.node.kind) === "constructor";
|
||||
|
||||
if (thisEnvFn.isClassProperty()) {
|
||||
throw fnPath.buildCodeFrameError("Unable to transform arrow inside class property");
|
||||
@@ -179,40 +165,25 @@ function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArro
|
||||
});
|
||||
const superBinding = getSuperBinding(thisEnvFn);
|
||||
allSuperCalls.forEach(superCall => {
|
||||
const callee = t().identifier(superBinding);
|
||||
const callee = t.identifier(superBinding);
|
||||
callee.loc = superCall.node.callee.loc;
|
||||
superCall.get("callee").replaceWith(callee);
|
||||
});
|
||||
}
|
||||
|
||||
let thisBinding;
|
||||
|
||||
if (thisPaths.length > 0 || specCompliant) {
|
||||
thisBinding = getThisBinding(thisEnvFn, inConstructor);
|
||||
|
||||
if (!specCompliant || inConstructor && hasSuperClass(thisEnvFn)) {
|
||||
thisPaths.forEach(thisChild => {
|
||||
const thisRef = thisChild.isJSX() ? t().jsxIdentifier(thisBinding) : t().identifier(thisBinding);
|
||||
thisRef.loc = thisChild.node.loc;
|
||||
thisChild.replaceWith(thisRef);
|
||||
});
|
||||
if (specCompliant) thisBinding = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (argumentsPaths.length > 0) {
|
||||
const argumentsBinding = getBinding(thisEnvFn, "arguments", () => t().identifier("arguments"));
|
||||
const argumentsBinding = getBinding(thisEnvFn, "arguments", () => t.identifier("arguments"));
|
||||
argumentsPaths.forEach(argumentsChild => {
|
||||
const argsRef = t().identifier(argumentsBinding);
|
||||
const argsRef = t.identifier(argumentsBinding);
|
||||
argsRef.loc = argumentsChild.node.loc;
|
||||
argumentsChild.replaceWith(argsRef);
|
||||
});
|
||||
}
|
||||
|
||||
if (newTargetPaths.length > 0) {
|
||||
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => t().metaProperty(t().identifier("new"), t().identifier("target")));
|
||||
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => t.metaProperty(t.identifier("new"), t.identifier("target")));
|
||||
newTargetPaths.forEach(targetChild => {
|
||||
const targetRef = t().identifier(newTargetBinding);
|
||||
const targetRef = t.identifier(newTargetBinding);
|
||||
targetRef.loc = targetChild.node.loc;
|
||||
targetChild.replaceWith(targetRef);
|
||||
});
|
||||
@@ -226,41 +197,53 @@ function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArro
|
||||
const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []);
|
||||
flatSuperProps.forEach(superProp => {
|
||||
const key = superProp.node.computed ? "" : superProp.get("property").node.name;
|
||||
|
||||
if (superProp.parentPath.isCallExpression({
|
||||
const isAssignment = superProp.parentPath.isAssignmentExpression({
|
||||
left: superProp.node
|
||||
});
|
||||
const isCall = superProp.parentPath.isCallExpression({
|
||||
callee: superProp.node
|
||||
})) {
|
||||
const superBinding = getSuperPropCallBinding(thisEnvFn, key);
|
||||
});
|
||||
const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
|
||||
const args = [];
|
||||
|
||||
if (superProp.node.computed) {
|
||||
const prop = superProp.get("property").node;
|
||||
superProp.replaceWith(t().identifier(superBinding));
|
||||
superProp.parentPath.node.arguments.unshift(prop);
|
||||
} else {
|
||||
superProp.replaceWith(t().identifier(superBinding));
|
||||
}
|
||||
if (superProp.node.computed) {
|
||||
args.push(superProp.get("property").node);
|
||||
}
|
||||
|
||||
if (isAssignment) {
|
||||
const value = superProp.parentPath.node.right;
|
||||
args.push(value);
|
||||
}
|
||||
|
||||
const call = t.callExpression(t.identifier(superBinding), args);
|
||||
|
||||
if (isCall) {
|
||||
superProp.parentPath.unshiftContainer("arguments", t.thisExpression());
|
||||
superProp.replaceWith(t.memberExpression(call, t.identifier("call")));
|
||||
thisPaths.push(superProp.parentPath.get("arguments.0"));
|
||||
} else if (isAssignment) {
|
||||
superProp.parentPath.replaceWith(call);
|
||||
} else {
|
||||
const isAssignment = superProp.parentPath.isAssignmentExpression({
|
||||
left: superProp.node
|
||||
});
|
||||
const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
|
||||
const args = [];
|
||||
|
||||
if (superProp.node.computed) {
|
||||
args.push(superProp.get("property").node);
|
||||
}
|
||||
|
||||
if (isAssignment) {
|
||||
const value = superProp.parentPath.node.right;
|
||||
args.push(value);
|
||||
superProp.parentPath.replaceWith(t().callExpression(t().identifier(superBinding), args));
|
||||
} else {
|
||||
superProp.replaceWith(t().callExpression(t().identifier(superBinding), args));
|
||||
}
|
||||
superProp.replaceWith(call);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let thisBinding;
|
||||
|
||||
if (thisPaths.length > 0 || specCompliant) {
|
||||
thisBinding = getThisBinding(thisEnvFn, inConstructor);
|
||||
|
||||
if (!specCompliant || inConstructor && hasSuperClass(thisEnvFn)) {
|
||||
thisPaths.forEach(thisChild => {
|
||||
const thisRef = thisChild.isJSX() ? t.jsxIdentifier(thisBinding) : t.identifier(thisBinding);
|
||||
thisRef.loc = thisChild.node.loc;
|
||||
thisChild.replaceWith(thisRef);
|
||||
});
|
||||
if (specCompliant) thisBinding = null;
|
||||
}
|
||||
}
|
||||
|
||||
return thisBinding;
|
||||
}
|
||||
|
||||
@@ -273,11 +256,11 @@ function standardizeSuperProperty(superProp) {
|
||||
|
||||
if (superProp.node.computed) {
|
||||
const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
|
||||
assignmentPath.get("left").replaceWith(t().memberExpression(superProp.node.object, t().assignmentExpression("=", tmp, superProp.node.property), true));
|
||||
assignmentPath.get("right").replaceWith(t().binaryExpression(op, t().memberExpression(superProp.node.object, t().identifier(tmp.name), true), value));
|
||||
assignmentPath.get("left").replaceWith(t.memberExpression(superProp.node.object, t.assignmentExpression("=", tmp, superProp.node.property), true));
|
||||
assignmentPath.get("right").replaceWith(t.binaryExpression(op, t.memberExpression(superProp.node.object, t.identifier(tmp.name), true), value));
|
||||
} else {
|
||||
assignmentPath.get("left").replaceWith(t().memberExpression(superProp.node.object, superProp.node.property));
|
||||
assignmentPath.get("right").replaceWith(t().binaryExpression(op, t().memberExpression(superProp.node.object, t().identifier(superProp.node.property.name)), value));
|
||||
assignmentPath.get("left").replaceWith(t.memberExpression(superProp.node.object, superProp.node.property));
|
||||
assignmentPath.get("right").replaceWith(t.binaryExpression(op, t.memberExpression(superProp.node.object, t.identifier(superProp.node.property.name)), value));
|
||||
}
|
||||
|
||||
return [assignmentPath.get("left"), assignmentPath.get("right").get("left")];
|
||||
@@ -285,13 +268,13 @@ function standardizeSuperProperty(superProp) {
|
||||
const updateExpr = superProp.parentPath;
|
||||
const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
|
||||
const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
|
||||
const parts = [t().assignmentExpression("=", tmp, t().memberExpression(superProp.node.object, computedKey ? t().assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), t().assignmentExpression("=", t().memberExpression(superProp.node.object, computedKey ? t().identifier(computedKey.name) : superProp.node.property, superProp.node.computed), t().binaryExpression("+", t().identifier(tmp.name), t().numericLiteral(1)))];
|
||||
const parts = [t.assignmentExpression("=", tmp, t.memberExpression(superProp.node.object, computedKey ? t.assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), t.assignmentExpression("=", t.memberExpression(superProp.node.object, computedKey ? t.identifier(computedKey.name) : superProp.node.property, superProp.node.computed), t.binaryExpression("+", t.identifier(tmp.name), t.numericLiteral(1)))];
|
||||
|
||||
if (!superProp.parentPath.node.prefix) {
|
||||
parts.push(t().identifier(tmp.name));
|
||||
parts.push(t.identifier(tmp.name));
|
||||
}
|
||||
|
||||
updateExpr.replaceWith(t().sequenceExpression(parts));
|
||||
updateExpr.replaceWith(t.sequenceExpression(parts));
|
||||
const left = updateExpr.get("expressions.0.right");
|
||||
const right = updateExpr.get("expressions.1.left");
|
||||
return [left, right];
|
||||
@@ -306,7 +289,7 @@ function hasSuperClass(thisEnvFn) {
|
||||
|
||||
function getThisBinding(thisEnvFn, inConstructor) {
|
||||
return getBinding(thisEnvFn, "this", thisBinding => {
|
||||
if (!inConstructor || !hasSuperClass(thisEnvFn)) return t().thisExpression();
|
||||
if (!inConstructor || !hasSuperClass(thisEnvFn)) return t.thisExpression();
|
||||
const supers = new WeakSet();
|
||||
thisEnvFn.traverse({
|
||||
Function(child) {
|
||||
@@ -322,7 +305,7 @@ function getThisBinding(thisEnvFn, inConstructor) {
|
||||
if (!child.get("callee").isSuper()) return;
|
||||
if (supers.has(child.node)) return;
|
||||
supers.add(child.node);
|
||||
child.replaceWithMultiple([child.node, t().assignmentExpression("=", t().identifier(thisBinding), t().identifier("this"))]);
|
||||
child.replaceWithMultiple([child.node, t.assignmentExpression("=", t.identifier(thisBinding), t.identifier("this"))]);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -332,25 +315,7 @@ function getThisBinding(thisEnvFn, inConstructor) {
|
||||
function getSuperBinding(thisEnvFn) {
|
||||
return getBinding(thisEnvFn, "supercall", () => {
|
||||
const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
|
||||
return t().arrowFunctionExpression([t().restElement(argsBinding)], t().callExpression(t().super(), [t().spreadElement(t().identifier(argsBinding.name))]));
|
||||
});
|
||||
}
|
||||
|
||||
function getSuperPropCallBinding(thisEnvFn, propName) {
|
||||
return getBinding(thisEnvFn, `superprop_call:${propName || ""}`, () => {
|
||||
const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
|
||||
const argsList = [t().restElement(argsBinding)];
|
||||
let fnBody;
|
||||
|
||||
if (propName) {
|
||||
fnBody = t().callExpression(t().memberExpression(t().super(), t().identifier(propName)), [t().spreadElement(t().identifier(argsBinding.name))]);
|
||||
} else {
|
||||
const method = thisEnvFn.scope.generateUidIdentifier("prop");
|
||||
argsList.unshift(method);
|
||||
fnBody = t().callExpression(t().memberExpression(t().super(), t().identifier(method.name), true), [t().spreadElement(t().identifier(argsBinding.name))]);
|
||||
}
|
||||
|
||||
return t().arrowFunctionExpression(argsList, fnBody);
|
||||
return t.arrowFunctionExpression([t.restElement(argsBinding)], t.callExpression(t.super(), [t.spreadElement(t.identifier(argsBinding.name))]));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -361,20 +326,20 @@ function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
|
||||
let fnBody;
|
||||
|
||||
if (propName) {
|
||||
fnBody = t().memberExpression(t().super(), t().identifier(propName));
|
||||
fnBody = t.memberExpression(t.super(), t.identifier(propName));
|
||||
} else {
|
||||
const method = thisEnvFn.scope.generateUidIdentifier("prop");
|
||||
argsList.unshift(method);
|
||||
fnBody = t().memberExpression(t().super(), t().identifier(method.name), true);
|
||||
fnBody = t.memberExpression(t.super(), t.identifier(method.name), true);
|
||||
}
|
||||
|
||||
if (isAssignment) {
|
||||
const valueIdent = thisEnvFn.scope.generateUidIdentifier("value");
|
||||
argsList.push(valueIdent);
|
||||
fnBody = t().assignmentExpression("=", fnBody, t().identifier(valueIdent.name));
|
||||
fnBody = t.assignmentExpression("=", fnBody, t.identifier(valueIdent.name));
|
||||
}
|
||||
|
||||
return t().arrowFunctionExpression(argsList, fnBody);
|
||||
return t.arrowFunctionExpression(argsList, fnBody);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
8
node_modules/@babel/traverse/lib/path/evaluation.js
generated
vendored
8
node_modules/@babel/traverse/lib/path/evaluation.js
generated
vendored
@@ -132,7 +132,7 @@ function _evaluate(path, state) {
|
||||
return deopt(binding.path, state);
|
||||
}
|
||||
|
||||
if (binding && binding.hasValue) {
|
||||
if (binding == null ? void 0 : binding.hasValue) {
|
||||
return binding.value;
|
||||
} else {
|
||||
if (node.name === "undefined") {
|
||||
@@ -197,7 +197,7 @@ function _evaluate(path, state) {
|
||||
if (elemValue.confident) {
|
||||
arr.push(elemValue.value);
|
||||
} else {
|
||||
return deopt(elem, state);
|
||||
return deopt(elemValue.deopt, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ function _evaluate(path, state) {
|
||||
key = key.evaluate();
|
||||
|
||||
if (!key.confident) {
|
||||
return deopt(keyPath, state);
|
||||
return deopt(key.deopt, state);
|
||||
}
|
||||
|
||||
key = key.value;
|
||||
@@ -234,7 +234,7 @@ function _evaluate(path, state) {
|
||||
let value = valuePath.evaluate();
|
||||
|
||||
if (!value.confident) {
|
||||
return deopt(valuePath, state);
|
||||
return deopt(value.deopt, state);
|
||||
}
|
||||
|
||||
value = value.value;
|
||||
|
||||
72
node_modules/@babel/traverse/lib/path/family.js
generated
vendored
72
node_modules/@babel/traverse/lib/path/family.js
generated
vendored
@@ -20,17 +20,11 @@ exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
|
||||
|
||||
var _index = _interopRequireDefault(require("./index"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -47,6 +41,57 @@ function addCompletionRecords(path, paths) {
|
||||
return paths;
|
||||
}
|
||||
|
||||
function completionRecordForSwitch(cases, paths) {
|
||||
let isLastCaseWithConsequent = true;
|
||||
|
||||
for (let i = cases.length - 1; i >= 0; i--) {
|
||||
const switchCase = cases[i];
|
||||
const consequent = switchCase.get("consequent");
|
||||
let breakStatement;
|
||||
|
||||
findBreak: for (const statement of consequent) {
|
||||
if (statement.isBlockStatement()) {
|
||||
for (const statementInBlock of statement.get("body")) {
|
||||
if (statementInBlock.isBreakStatement()) {
|
||||
breakStatement = statementInBlock;
|
||||
break findBreak;
|
||||
}
|
||||
}
|
||||
} else if (statement.isBreakStatement()) {
|
||||
breakStatement = statement;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (breakStatement) {
|
||||
while (breakStatement.key === 0 && breakStatement.parentPath.isBlockStatement()) {
|
||||
breakStatement = breakStatement.parentPath;
|
||||
}
|
||||
|
||||
const prevSibling = breakStatement.getPrevSibling();
|
||||
|
||||
if (breakStatement.key > 0 && (prevSibling.isExpressionStatement() || prevSibling.isBlockStatement())) {
|
||||
paths = addCompletionRecords(prevSibling, paths);
|
||||
breakStatement.remove();
|
||||
} else {
|
||||
breakStatement.replaceWith(breakStatement.scope.buildUndefinedNode());
|
||||
paths = addCompletionRecords(breakStatement, paths);
|
||||
}
|
||||
} else if (isLastCaseWithConsequent) {
|
||||
const statementFinder = statement => !statement.isBlockStatement() || statement.get("body").some(statementFinder);
|
||||
|
||||
const hasConsequent = consequent.some(statementFinder);
|
||||
|
||||
if (hasConsequent) {
|
||||
paths = addCompletionRecords(consequent[consequent.length - 1], paths);
|
||||
isLastCaseWithConsequent = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
function getCompletionRecords() {
|
||||
let paths = [];
|
||||
|
||||
@@ -62,9 +107,10 @@ function getCompletionRecords() {
|
||||
} else if (this.isTryStatement()) {
|
||||
paths = addCompletionRecords(this.get("block"), paths);
|
||||
paths = addCompletionRecords(this.get("handler"), paths);
|
||||
paths = addCompletionRecords(this.get("finalizer"), paths);
|
||||
} else if (this.isCatchClause()) {
|
||||
paths = addCompletionRecords(this.get("body"), paths);
|
||||
} else if (this.isSwitchStatement()) {
|
||||
paths = completionRecordForSwitch(this.get("cases"), paths);
|
||||
} else {
|
||||
paths.push(this);
|
||||
}
|
||||
@@ -170,11 +216,11 @@ function _getPattern(parts, context) {
|
||||
}
|
||||
|
||||
function getBindingIdentifiers(duplicates) {
|
||||
return t().getBindingIdentifiers(this.node, duplicates);
|
||||
return t.getBindingIdentifiers(this.node, duplicates);
|
||||
}
|
||||
|
||||
function getOuterBindingIdentifiers(duplicates) {
|
||||
return t().getOuterBindingIdentifiers(this.node, duplicates);
|
||||
return t.getOuterBindingIdentifiers(this.node, duplicates);
|
||||
}
|
||||
|
||||
function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
||||
@@ -186,7 +232,7 @@ function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
||||
const id = search.shift();
|
||||
if (!id) continue;
|
||||
if (!id.node) continue;
|
||||
const keys = t().getBindingIdentifiers.keys[id.node.type];
|
||||
const keys = t.getBindingIdentifiers.keys[id.node.type];
|
||||
|
||||
if (id.isIdentifier()) {
|
||||
if (duplicates) {
|
||||
|
||||
121
node_modules/@babel/traverse/lib/path/index.js
generated
vendored
121
node_modules/@babel/traverse/lib/path/index.js
generated
vendored
@@ -3,45 +3,21 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
exports.default = exports.SHOULD_SKIP = exports.SHOULD_STOP = exports.REMOVED = void 0;
|
||||
|
||||
var virtualTypes = _interopRequireWildcard(require("./lib/virtual-types"));
|
||||
|
||||
function _debug() {
|
||||
const data = _interopRequireDefault(require("debug"));
|
||||
|
||||
_debug = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _debug = _interopRequireDefault(require("debug"));
|
||||
|
||||
var _index = _interopRequireDefault(require("../index"));
|
||||
|
||||
var _scope = _interopRequireDefault(require("../scope"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _cache = require("../cache");
|
||||
|
||||
function _generator() {
|
||||
const data = _interopRequireDefault(require("@babel/generator"));
|
||||
|
||||
_generator = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _generator = _interopRequireDefault(require("@babel/generator"));
|
||||
|
||||
var NodePath_ancestry = _interopRequireWildcard(require("./ancestry"));
|
||||
|
||||
@@ -67,19 +43,25 @@ var NodePath_comments = _interopRequireWildcard(require("./comments"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
const debug = (0, _debug().default)("babel");
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const debug = (0, _debug.default)("babel");
|
||||
const REMOVED = 1 << 0;
|
||||
exports.REMOVED = REMOVED;
|
||||
const SHOULD_STOP = 1 << 1;
|
||||
exports.SHOULD_STOP = SHOULD_STOP;
|
||||
const SHOULD_SKIP = 1 << 2;
|
||||
exports.SHOULD_SKIP = SHOULD_SKIP;
|
||||
|
||||
class NodePath {
|
||||
constructor(hub, parent) {
|
||||
this.parent = parent;
|
||||
this.hub = hub;
|
||||
this.contexts = [];
|
||||
this.data = Object.create(null);
|
||||
this.shouldSkip = false;
|
||||
this.shouldStop = false;
|
||||
this.removed = false;
|
||||
this.data = null;
|
||||
this._traverseFlags = 0;
|
||||
this.state = null;
|
||||
this.opts = null;
|
||||
this.skipKeys = null;
|
||||
@@ -87,13 +69,10 @@ class NodePath {
|
||||
this.context = null;
|
||||
this.container = null;
|
||||
this.listKey = null;
|
||||
this.inList = false;
|
||||
this.parentKey = null;
|
||||
this.key = null;
|
||||
this.node = null;
|
||||
this.scope = null;
|
||||
this.type = null;
|
||||
this.typeAnnotation = null;
|
||||
}
|
||||
|
||||
static get({
|
||||
@@ -144,10 +123,18 @@ class NodePath {
|
||||
}
|
||||
|
||||
setData(key, val) {
|
||||
if (this.data == null) {
|
||||
this.data = Object.create(null);
|
||||
}
|
||||
|
||||
return this.data[key] = val;
|
||||
}
|
||||
|
||||
getData(key, def) {
|
||||
if (this.data == null) {
|
||||
this.data = Object.create(null);
|
||||
}
|
||||
|
||||
let val = this.data[key];
|
||||
if (val === undefined && def !== undefined) val = this.data[key] = def;
|
||||
return val;
|
||||
@@ -162,7 +149,7 @@ class NodePath {
|
||||
}
|
||||
|
||||
set(key, node) {
|
||||
t().validate(this.node, key, node);
|
||||
t.validate(this.node, key, node);
|
||||
this.node[key] = node;
|
||||
}
|
||||
|
||||
@@ -185,7 +172,57 @@ class NodePath {
|
||||
}
|
||||
|
||||
toString() {
|
||||
return (0, _generator().default)(this.node).code;
|
||||
return (0, _generator.default)(this.node).code;
|
||||
}
|
||||
|
||||
get inList() {
|
||||
return !!this.listKey;
|
||||
}
|
||||
|
||||
set inList(inList) {
|
||||
if (!inList) {
|
||||
this.listKey = null;
|
||||
}
|
||||
}
|
||||
|
||||
get parentKey() {
|
||||
return this.listKey || this.key;
|
||||
}
|
||||
|
||||
get shouldSkip() {
|
||||
return !!(this._traverseFlags & SHOULD_SKIP);
|
||||
}
|
||||
|
||||
set shouldSkip(v) {
|
||||
if (v) {
|
||||
this._traverseFlags |= SHOULD_SKIP;
|
||||
} else {
|
||||
this._traverseFlags &= ~SHOULD_SKIP;
|
||||
}
|
||||
}
|
||||
|
||||
get shouldStop() {
|
||||
return !!(this._traverseFlags & SHOULD_STOP);
|
||||
}
|
||||
|
||||
set shouldStop(v) {
|
||||
if (v) {
|
||||
this._traverseFlags |= SHOULD_STOP;
|
||||
} else {
|
||||
this._traverseFlags &= ~SHOULD_STOP;
|
||||
}
|
||||
}
|
||||
|
||||
get removed() {
|
||||
return !!(this._traverseFlags & REMOVED);
|
||||
}
|
||||
|
||||
set removed(v) {
|
||||
if (v) {
|
||||
this._traverseFlags |= REMOVED;
|
||||
} else {
|
||||
this._traverseFlags &= ~REMOVED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -193,9 +230,9 @@ class NodePath {
|
||||
exports.default = NodePath;
|
||||
Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
|
||||
|
||||
for (const type of t().TYPES) {
|
||||
for (const type of t.TYPES) {
|
||||
const typeKey = `is${type}`;
|
||||
const fn = t()[typeKey];
|
||||
const fn = t[typeKey];
|
||||
|
||||
NodePath.prototype[typeKey] = function (opts) {
|
||||
return fn(this.node, opts);
|
||||
@@ -210,7 +247,7 @@ for (const type of t().TYPES) {
|
||||
|
||||
for (const type of Object.keys(virtualTypes)) {
|
||||
if (type[0] === "_") continue;
|
||||
if (t().TYPES.indexOf(type) < 0) t().TYPES.push(type);
|
||||
if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type);
|
||||
const virtualType = virtualTypes[type];
|
||||
|
||||
NodePath.prototype[`is${type}`] = function (opts) {
|
||||
|
||||
50
node_modules/@babel/traverse/lib/path/inference/index.js
generated
vendored
50
node_modules/@babel/traverse/lib/path/inference/index.js
generated
vendored
@@ -12,26 +12,22 @@ exports.isGenericType = isGenericType;
|
||||
|
||||
var inferers = _interopRequireWildcard(require("./inferers"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function getTypeAnnotation() {
|
||||
if (this.typeAnnotation) return this.typeAnnotation;
|
||||
let type = this._getTypeAnnotation() || t().anyTypeAnnotation();
|
||||
if (t().isTypeAnnotation(type)) type = type.typeAnnotation;
|
||||
let type = this._getTypeAnnotation() || t.anyTypeAnnotation();
|
||||
if (t.isTypeAnnotation(type)) type = type.typeAnnotation;
|
||||
return this.typeAnnotation = type;
|
||||
}
|
||||
|
||||
function _getTypeAnnotation() {
|
||||
var _inferer;
|
||||
|
||||
const node = this.node;
|
||||
|
||||
if (!node) {
|
||||
@@ -40,14 +36,14 @@ function _getTypeAnnotation() {
|
||||
const declarParent = declar.parentPath;
|
||||
|
||||
if (declar.key === "left" && declarParent.isForInStatement()) {
|
||||
return t().stringTypeAnnotation();
|
||||
return t.stringTypeAnnotation();
|
||||
}
|
||||
|
||||
if (declar.key === "left" && declarParent.isForOfStatement()) {
|
||||
return t().anyTypeAnnotation();
|
||||
return t.anyTypeAnnotation();
|
||||
}
|
||||
|
||||
return t().voidTypeAnnotation();
|
||||
return t.voidTypeAnnotation();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -65,7 +61,7 @@ function _getTypeAnnotation() {
|
||||
|
||||
inferer = inferers[this.parentPath.type];
|
||||
|
||||
if (inferer && inferer.validParent) {
|
||||
if ((_inferer = inferer) == null ? void 0 : _inferer.validParent) {
|
||||
return this.parentPath.getTypeAnnotation();
|
||||
}
|
||||
}
|
||||
@@ -76,19 +72,19 @@ function isBaseType(baseName, soft) {
|
||||
|
||||
function _isBaseType(baseName, type, soft) {
|
||||
if (baseName === "string") {
|
||||
return t().isStringTypeAnnotation(type);
|
||||
return t.isStringTypeAnnotation(type);
|
||||
} else if (baseName === "number") {
|
||||
return t().isNumberTypeAnnotation(type);
|
||||
return t.isNumberTypeAnnotation(type);
|
||||
} else if (baseName === "boolean") {
|
||||
return t().isBooleanTypeAnnotation(type);
|
||||
return t.isBooleanTypeAnnotation(type);
|
||||
} else if (baseName === "any") {
|
||||
return t().isAnyTypeAnnotation(type);
|
||||
return t.isAnyTypeAnnotation(type);
|
||||
} else if (baseName === "mixed") {
|
||||
return t().isMixedTypeAnnotation(type);
|
||||
return t.isMixedTypeAnnotation(type);
|
||||
} else if (baseName === "empty") {
|
||||
return t().isEmptyTypeAnnotation(type);
|
||||
return t.isEmptyTypeAnnotation(type);
|
||||
} else if (baseName === "void") {
|
||||
return t().isVoidTypeAnnotation(type);
|
||||
return t.isVoidTypeAnnotation(type);
|
||||
} else {
|
||||
if (soft) {
|
||||
return false;
|
||||
@@ -100,11 +96,11 @@ function _isBaseType(baseName, type, soft) {
|
||||
|
||||
function couldBeBaseType(name) {
|
||||
const type = this.getTypeAnnotation();
|
||||
if (t().isAnyTypeAnnotation(type)) return true;
|
||||
if (t.isAnyTypeAnnotation(type)) return true;
|
||||
|
||||
if (t().isUnionTypeAnnotation(type)) {
|
||||
if (t.isUnionTypeAnnotation(type)) {
|
||||
for (const type2 of type.types) {
|
||||
if (t().isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
|
||||
if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -119,14 +115,14 @@ function baseTypeStrictlyMatches(right) {
|
||||
const left = this.getTypeAnnotation();
|
||||
right = right.getTypeAnnotation();
|
||||
|
||||
if (!t().isAnyTypeAnnotation(left) && t().isFlowBaseAnnotation(left)) {
|
||||
if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) {
|
||||
return right.type === left.type;
|
||||
}
|
||||
}
|
||||
|
||||
function isGenericType(genericName) {
|
||||
const type = this.getTypeAnnotation();
|
||||
return t().isGenericTypeAnnotation(type) && t().isIdentifier(type.id, {
|
||||
return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, {
|
||||
name: genericName
|
||||
});
|
||||
}
|
||||
54
node_modules/@babel/traverse/lib/path/inference/inferer-reference.js
generated
vendored
54
node_modules/@babel/traverse/lib/path/inference/inferer-reference.js
generated
vendored
@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _default(node) {
|
||||
if (!this.isReferenced()) return;
|
||||
@@ -30,9 +24,9 @@ function _default(node) {
|
||||
}
|
||||
|
||||
if (node.name === "undefined") {
|
||||
return t().voidTypeAnnotation();
|
||||
return t.voidTypeAnnotation();
|
||||
} else if (node.name === "NaN" || node.name === "Infinity") {
|
||||
return t().numberTypeAnnotation();
|
||||
return t.numberTypeAnnotation();
|
||||
} else if (node.name === "arguments") {}
|
||||
}
|
||||
|
||||
@@ -56,9 +50,19 @@ function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
||||
}
|
||||
}
|
||||
|
||||
if (types.length) {
|
||||
return t().createUnionTypeAnnotation(types);
|
||||
if (!types.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
|
||||
return t.createTSUnionType(types);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(types);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(types);
|
||||
}
|
||||
|
||||
function getConstantViolationsBefore(binding, path, functions) {
|
||||
@@ -69,7 +73,7 @@ function getConstantViolationsBefore(binding, path, functions) {
|
||||
|
||||
const status = violation._guessExecutionStatusRelativeTo(path);
|
||||
|
||||
if (functions && status === "function") functions.push(violation);
|
||||
if (functions && status === "unknown") functions.push(violation);
|
||||
return status === "before";
|
||||
});
|
||||
}
|
||||
@@ -95,8 +99,8 @@ function inferAnnotationFromBinaryExpression(name, path) {
|
||||
return target.getTypeAnnotation();
|
||||
}
|
||||
|
||||
if (t().BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t().numberTypeAnnotation();
|
||||
if (t.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.numberTypeAnnotation();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -126,7 +130,7 @@ function inferAnnotationFromBinaryExpression(name, path) {
|
||||
if (!typePath.isLiteral()) return;
|
||||
const typeValue = typePath.node.value;
|
||||
if (typeof typeValue !== "string") return;
|
||||
return t().createTypeAnnotationBasedOnTypeof(typeValue);
|
||||
return t.createTypeAnnotationBasedOnTypeof(typeValue);
|
||||
}
|
||||
|
||||
function getParentConditionalPath(binding, path, name) {
|
||||
@@ -171,8 +175,22 @@ function getConditionalAnnotation(binding, path, name) {
|
||||
}
|
||||
|
||||
if (types.length) {
|
||||
if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
|
||||
return {
|
||||
typeAnnotation: t.createTSUnionType(types),
|
||||
ifStatement
|
||||
};
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return {
|
||||
typeAnnotation: t.createFlowUnionType(types),
|
||||
ifStatement
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
typeAnnotation: t().createUnionTypeAnnotation(types),
|
||||
typeAnnotation: t.createUnionTypeAnnotation(types),
|
||||
ifStatement
|
||||
};
|
||||
}
|
||||
|
||||
110
node_modules/@babel/traverse/lib/path/inference/inferers.js
generated
vendored
110
node_modules/@babel/traverse/lib/path/inference/inferers.js
generated
vendored
@@ -33,29 +33,25 @@ Object.defineProperty(exports, "Identifier", {
|
||||
}
|
||||
});
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _infererReference = _interopRequireDefault(require("./inferer-reference"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function VariableDeclarator() {
|
||||
var _type;
|
||||
|
||||
const id = this.get("id");
|
||||
if (!id.isIdentifier()) return;
|
||||
const init = this.get("init");
|
||||
let type = init.getTypeAnnotation();
|
||||
|
||||
if (type && type.type === "AnyTypeAnnotation") {
|
||||
if (((_type = type) == null ? void 0 : _type.type) === "AnyTypeAnnotation") {
|
||||
if (init.isCallExpression() && init.get("callee").isIdentifier({
|
||||
name: "Array"
|
||||
}) && !init.scope.hasBinding("Array", true)) {
|
||||
@@ -74,55 +70,75 @@ TypeCastExpression.validParent = true;
|
||||
|
||||
function NewExpression(node) {
|
||||
if (this.get("callee").isIdentifier()) {
|
||||
return t().genericTypeAnnotation(node.callee);
|
||||
return t.genericTypeAnnotation(node.callee);
|
||||
}
|
||||
}
|
||||
|
||||
function TemplateLiteral() {
|
||||
return t().stringTypeAnnotation();
|
||||
return t.stringTypeAnnotation();
|
||||
}
|
||||
|
||||
function UnaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
|
||||
if (operator === "void") {
|
||||
return t().voidTypeAnnotation();
|
||||
} else if (t().NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t().numberTypeAnnotation();
|
||||
} else if (t().STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t().stringTypeAnnotation();
|
||||
} else if (t().BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t().booleanTypeAnnotation();
|
||||
return t.voidTypeAnnotation();
|
||||
} else if (t.NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.numberTypeAnnotation();
|
||||
} else if (t.STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.stringTypeAnnotation();
|
||||
} else if (t.BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.booleanTypeAnnotation();
|
||||
}
|
||||
}
|
||||
|
||||
function BinaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
|
||||
if (t().NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t().numberTypeAnnotation();
|
||||
} else if (t().BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t().booleanTypeAnnotation();
|
||||
if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.numberTypeAnnotation();
|
||||
} else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.booleanTypeAnnotation();
|
||||
} else if (operator === "+") {
|
||||
const right = this.get("right");
|
||||
const left = this.get("left");
|
||||
|
||||
if (left.isBaseType("number") && right.isBaseType("number")) {
|
||||
return t().numberTypeAnnotation();
|
||||
return t.numberTypeAnnotation();
|
||||
} else if (left.isBaseType("string") || right.isBaseType("string")) {
|
||||
return t().stringTypeAnnotation();
|
||||
return t.stringTypeAnnotation();
|
||||
}
|
||||
|
||||
return t().unionTypeAnnotation([t().stringTypeAnnotation(), t().numberTypeAnnotation()]);
|
||||
return t.unionTypeAnnotation([t.stringTypeAnnotation(), t.numberTypeAnnotation()]);
|
||||
}
|
||||
}
|
||||
|
||||
function LogicalExpression() {
|
||||
return t().createUnionTypeAnnotation([this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()]);
|
||||
const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];
|
||||
|
||||
if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
|
||||
return t.createTSUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(argumentTypes);
|
||||
}
|
||||
|
||||
function ConditionalExpression() {
|
||||
return t().createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()]);
|
||||
const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()];
|
||||
|
||||
if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
|
||||
return t.createTSUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(argumentTypes);
|
||||
}
|
||||
|
||||
function SequenceExpression() {
|
||||
@@ -141,36 +157,36 @@ function UpdateExpression(node) {
|
||||
const operator = node.operator;
|
||||
|
||||
if (operator === "++" || operator === "--") {
|
||||
return t().numberTypeAnnotation();
|
||||
return t.numberTypeAnnotation();
|
||||
}
|
||||
}
|
||||
|
||||
function StringLiteral() {
|
||||
return t().stringTypeAnnotation();
|
||||
return t.stringTypeAnnotation();
|
||||
}
|
||||
|
||||
function NumericLiteral() {
|
||||
return t().numberTypeAnnotation();
|
||||
return t.numberTypeAnnotation();
|
||||
}
|
||||
|
||||
function BooleanLiteral() {
|
||||
return t().booleanTypeAnnotation();
|
||||
return t.booleanTypeAnnotation();
|
||||
}
|
||||
|
||||
function NullLiteral() {
|
||||
return t().nullLiteralTypeAnnotation();
|
||||
return t.nullLiteralTypeAnnotation();
|
||||
}
|
||||
|
||||
function RegExpLiteral() {
|
||||
return t().genericTypeAnnotation(t().identifier("RegExp"));
|
||||
return t.genericTypeAnnotation(t.identifier("RegExp"));
|
||||
}
|
||||
|
||||
function ObjectExpression() {
|
||||
return t().genericTypeAnnotation(t().identifier("Object"));
|
||||
return t.genericTypeAnnotation(t.identifier("Object"));
|
||||
}
|
||||
|
||||
function ArrayExpression() {
|
||||
return t().genericTypeAnnotation(t().identifier("Array"));
|
||||
return t.genericTypeAnnotation(t.identifier("Array"));
|
||||
}
|
||||
|
||||
function RestElement() {
|
||||
@@ -180,13 +196,13 @@ function RestElement() {
|
||||
RestElement.validParent = true;
|
||||
|
||||
function Func() {
|
||||
return t().genericTypeAnnotation(t().identifier("Function"));
|
||||
return t.genericTypeAnnotation(t.identifier("Function"));
|
||||
}
|
||||
|
||||
const isArrayFrom = t().buildMatchMemberExpression("Array.from");
|
||||
const isObjectKeys = t().buildMatchMemberExpression("Object.keys");
|
||||
const isObjectValues = t().buildMatchMemberExpression("Object.values");
|
||||
const isObjectEntries = t().buildMatchMemberExpression("Object.entries");
|
||||
const isArrayFrom = t.buildMatchMemberExpression("Array.from");
|
||||
const isObjectKeys = t.buildMatchMemberExpression("Object.keys");
|
||||
const isObjectValues = t.buildMatchMemberExpression("Object.values");
|
||||
const isObjectEntries = t.buildMatchMemberExpression("Object.entries");
|
||||
|
||||
function CallExpression() {
|
||||
const {
|
||||
@@ -194,11 +210,11 @@ function CallExpression() {
|
||||
} = this.node;
|
||||
|
||||
if (isObjectKeys(callee)) {
|
||||
return t().arrayTypeAnnotation(t().stringTypeAnnotation());
|
||||
return t.arrayTypeAnnotation(t.stringTypeAnnotation());
|
||||
} else if (isArrayFrom(callee) || isObjectValues(callee)) {
|
||||
return t().arrayTypeAnnotation(t().anyTypeAnnotation());
|
||||
return t.arrayTypeAnnotation(t.anyTypeAnnotation());
|
||||
} else if (isObjectEntries(callee)) {
|
||||
return t().arrayTypeAnnotation(t().tupleTypeAnnotation([t().stringTypeAnnotation(), t().anyTypeAnnotation()]));
|
||||
return t.arrayTypeAnnotation(t.tupleTypeAnnotation([t.stringTypeAnnotation(), t.anyTypeAnnotation()]));
|
||||
}
|
||||
|
||||
return resolveCall(this.get("callee"));
|
||||
@@ -214,9 +230,9 @@ function resolveCall(callee) {
|
||||
if (callee.isFunction()) {
|
||||
if (callee.is("async")) {
|
||||
if (callee.is("generator")) {
|
||||
return t().genericTypeAnnotation(t().identifier("AsyncIterator"));
|
||||
return t.genericTypeAnnotation(t.identifier("AsyncIterator"));
|
||||
} else {
|
||||
return t().genericTypeAnnotation(t().identifier("Promise"));
|
||||
return t.genericTypeAnnotation(t.identifier("Promise"));
|
||||
}
|
||||
} else {
|
||||
if (callee.node.returnType) {
|
||||
|
||||
194
node_modules/@babel/traverse/lib/path/introspection.js
generated
vendored
194
node_modules/@babel/traverse/lib/path/introspection.js
generated
vendored
@@ -24,32 +24,14 @@ exports.isConstantExpression = isConstantExpression;
|
||||
exports.isInStrictMode = isInStrictMode;
|
||||
exports.is = void 0;
|
||||
|
||||
function _includes() {
|
||||
const data = _interopRequireDefault(require("lodash/includes"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
_includes = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function matchesPattern(pattern, allowPartial) {
|
||||
return t().matchesPattern(this.node, pattern, allowPartial);
|
||||
return t.matchesPattern(this.node, pattern, allowPartial);
|
||||
}
|
||||
|
||||
function has(key) {
|
||||
@@ -78,7 +60,7 @@ function equals(key, value) {
|
||||
}
|
||||
|
||||
function isNodeType(type) {
|
||||
return t().isType(this.type, type);
|
||||
return t.isType(this.type, type);
|
||||
}
|
||||
|
||||
function canHaveVariableDeclarationOrExpression() {
|
||||
@@ -91,9 +73,9 @@ function canSwapBetweenExpressionAndStatement(replacement) {
|
||||
}
|
||||
|
||||
if (this.isExpression()) {
|
||||
return t().isBlockStatement(replacement);
|
||||
return t.isBlockStatement(replacement);
|
||||
} else if (this.isBlockStatement()) {
|
||||
return t().isExpression(replacement);
|
||||
return t.isExpression(replacement);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -121,10 +103,10 @@ function isCompletionRecord(allowInsideFunction) {
|
||||
}
|
||||
|
||||
function isStatementOrBlock() {
|
||||
if (this.parentPath.isLabeledStatement() || t().isBlockStatement(this.container)) {
|
||||
if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) {
|
||||
return false;
|
||||
} else {
|
||||
return (0, _includes().default)(t().STATEMENT_OR_BLOCK_KEYS, this.key);
|
||||
return t.STATEMENT_OR_BLOCK_KEYS.includes(this.key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,81 +154,147 @@ function willIMaybeExecuteBefore(target) {
|
||||
return this._guessExecutionStatusRelativeTo(target) !== "after";
|
||||
}
|
||||
|
||||
function _guessExecutionStatusRelativeTo(target) {
|
||||
const targetFuncParent = target.scope.getFunctionParent() || target.scope.getProgramParent();
|
||||
const selfFuncParent = this.scope.getFunctionParent() || target.scope.getProgramParent();
|
||||
function getOuterFunction(path) {
|
||||
return (path.scope.getFunctionParent() || path.scope.getProgramParent()).path;
|
||||
}
|
||||
|
||||
if (targetFuncParent.node !== selfFuncParent.node) {
|
||||
const status = this._guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent);
|
||||
function isExecutionUncertain(type, key) {
|
||||
switch (type) {
|
||||
case "LogicalExpression":
|
||||
return key === "right";
|
||||
|
||||
if (status) {
|
||||
return status;
|
||||
} else {
|
||||
target = targetFuncParent.path;
|
||||
case "ConditionalExpression":
|
||||
case "IfStatement":
|
||||
return key === "consequent" || key === "alternate";
|
||||
|
||||
case "WhileStatement":
|
||||
case "DoWhileStatement":
|
||||
case "ForInStatement":
|
||||
case "ForOfStatement":
|
||||
return key === "body";
|
||||
|
||||
case "ForStatement":
|
||||
return key === "body" || key === "update";
|
||||
|
||||
case "SwitchStatement":
|
||||
return key === "cases";
|
||||
|
||||
case "TryStatement":
|
||||
return key === "handler";
|
||||
|
||||
case "AssignmentPattern":
|
||||
return key === "right";
|
||||
|
||||
case "OptionalMemberExpression":
|
||||
return key === "property";
|
||||
|
||||
case "OptionalCallExpression":
|
||||
return key === "arguments";
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isExecutionUncertainInList(paths, maxIndex) {
|
||||
for (let i = 0; i < maxIndex; i++) {
|
||||
const path = paths[i];
|
||||
|
||||
if (isExecutionUncertain(path.parent.type, path.parentKey)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const targetPaths = target.getAncestry();
|
||||
if (targetPaths.indexOf(this) >= 0) return "after";
|
||||
const selfPaths = this.getAncestry();
|
||||
return false;
|
||||
}
|
||||
|
||||
function _guessExecutionStatusRelativeTo(target) {
|
||||
const funcParent = {
|
||||
this: getOuterFunction(this),
|
||||
target: getOuterFunction(target)
|
||||
};
|
||||
|
||||
if (funcParent.target.node !== funcParent.this.node) {
|
||||
return this._guessExecutionStatusRelativeToDifferentFunctions(funcParent.target);
|
||||
}
|
||||
|
||||
const paths = {
|
||||
target: target.getAncestry(),
|
||||
this: this.getAncestry()
|
||||
};
|
||||
if (paths.target.indexOf(this) >= 0) return "after";
|
||||
if (paths.this.indexOf(target) >= 0) return "before";
|
||||
let commonPath;
|
||||
let targetIndex;
|
||||
let selfIndex;
|
||||
const commonIndex = {
|
||||
target: 0,
|
||||
this: 0
|
||||
};
|
||||
|
||||
for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) {
|
||||
const selfPath = selfPaths[selfIndex];
|
||||
targetIndex = targetPaths.indexOf(selfPath);
|
||||
while (!commonPath && commonIndex.this < paths.this.length) {
|
||||
const path = paths.this[commonIndex.this];
|
||||
commonIndex.target = paths.target.indexOf(path);
|
||||
|
||||
if (targetIndex >= 0) {
|
||||
commonPath = selfPath;
|
||||
break;
|
||||
if (commonIndex.target >= 0) {
|
||||
commonPath = path;
|
||||
} else {
|
||||
commonIndex.this++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!commonPath) {
|
||||
return "before";
|
||||
throw new Error("Internal Babel error - The two compared nodes" + " don't appear to belong to the same program.");
|
||||
}
|
||||
|
||||
const targetRelationship = targetPaths[targetIndex - 1];
|
||||
const selfRelationship = selfPaths[selfIndex - 1];
|
||||
|
||||
if (!targetRelationship || !selfRelationship) {
|
||||
return "before";
|
||||
if (isExecutionUncertainInList(paths.this, commonIndex.this - 1) || isExecutionUncertainInList(paths.target, commonIndex.target - 1)) {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
if (targetRelationship.listKey && targetRelationship.container === selfRelationship.container) {
|
||||
return targetRelationship.key > selfRelationship.key ? "before" : "after";
|
||||
const divergence = {
|
||||
this: paths.this[commonIndex.this - 1],
|
||||
target: paths.target[commonIndex.target - 1]
|
||||
};
|
||||
|
||||
if (divergence.target.listKey && divergence.this.listKey && divergence.target.container === divergence.this.container) {
|
||||
return divergence.target.key > divergence.this.key ? "before" : "after";
|
||||
}
|
||||
|
||||
const keys = t().VISITOR_KEYS[commonPath.type];
|
||||
const targetKeyPosition = keys.indexOf(targetRelationship.key);
|
||||
const selfKeyPosition = keys.indexOf(selfRelationship.key);
|
||||
return targetKeyPosition > selfKeyPosition ? "before" : "after";
|
||||
const keys = t.VISITOR_KEYS[commonPath.type];
|
||||
const keyPosition = {
|
||||
this: keys.indexOf(divergence.this.parentKey),
|
||||
target: keys.indexOf(divergence.target.parentKey)
|
||||
};
|
||||
return keyPosition.target > keyPosition.this ? "before" : "after";
|
||||
}
|
||||
|
||||
function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) {
|
||||
const targetFuncPath = targetFuncParent.path;
|
||||
if (!targetFuncPath.isFunctionDeclaration()) return;
|
||||
const binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name);
|
||||
if (!binding.references) return "before";
|
||||
const referencePaths = binding.referencePaths;
|
||||
const executionOrderCheckedNodes = new WeakSet();
|
||||
|
||||
for (const path of referencePaths) {
|
||||
if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
|
||||
return;
|
||||
}
|
||||
function _guessExecutionStatusRelativeToDifferentFunctions(target) {
|
||||
if (!target.isFunctionDeclaration() || target.parentPath.isExportDeclaration()) {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
const binding = target.scope.getBinding(target.node.id.name);
|
||||
if (!binding.references) return "before";
|
||||
const referencePaths = binding.referencePaths;
|
||||
let allStatus;
|
||||
|
||||
for (const path of referencePaths) {
|
||||
const childOfFunction = !!path.find(path => path.node === targetFuncPath.node);
|
||||
const childOfFunction = !!path.find(path => path.node === target.node);
|
||||
if (childOfFunction) continue;
|
||||
|
||||
if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
if (executionOrderCheckedNodes.has(path.node)) continue;
|
||||
executionOrderCheckedNodes.add(path.node);
|
||||
|
||||
const status = this._guessExecutionStatusRelativeTo(path);
|
||||
|
||||
if (allStatus) {
|
||||
if (allStatus !== status) return;
|
||||
executionOrderCheckedNodes.delete(path.node);
|
||||
|
||||
if (allStatus && allStatus !== status) {
|
||||
return "unknown";
|
||||
} else {
|
||||
allStatus = status;
|
||||
}
|
||||
@@ -283,7 +331,7 @@ function _resolve(dangerous, resolved) {
|
||||
return this.get("expression").resolve(dangerous, resolved);
|
||||
} else if (dangerous && this.isMemberExpression()) {
|
||||
const targetKey = this.toComputedKey();
|
||||
if (!t().isLiteral(targetKey)) return;
|
||||
if (!t.isLiteral(targetKey)) return;
|
||||
const targetName = targetKey.value;
|
||||
const target = this.get("object").resolve(dangerous, resolved);
|
||||
|
||||
|
||||
33
node_modules/@babel/traverse/lib/path/lib/hoister.js
generated
vendored
33
node_modules/@babel/traverse/lib/path/lib/hoister.js
generated
vendored
@@ -5,21 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const referenceVisitor = {
|
||||
ReferencedIdentifier(path, state) {
|
||||
if (path.isJSXIdentifier() && t().react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
|
||||
if (path.isJSXIdentifier() && t.react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,6 +31,15 @@ const referenceVisitor = {
|
||||
|
||||
const binding = path.scope.getBinding(path.node.name);
|
||||
if (!binding) return;
|
||||
|
||||
for (const violation of binding.constantViolations) {
|
||||
if (violation.scope !== binding.path.scope) {
|
||||
state.mutableBinding = true;
|
||||
path.stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (binding !== state.scope.getBinding(path.node.name)) return;
|
||||
state.bindings[path.node.name] = binding;
|
||||
}
|
||||
@@ -47,6 +50,7 @@ class PathHoister {
|
||||
constructor(path, scope) {
|
||||
this.breakOnScopePaths = [];
|
||||
this.bindings = {};
|
||||
this.mutableBinding = false;
|
||||
this.scopes = [];
|
||||
this.scope = scope;
|
||||
this.path = path;
|
||||
@@ -165,21 +169,22 @@ class PathHoister {
|
||||
|
||||
run() {
|
||||
this.path.traverse(referenceVisitor, this);
|
||||
if (this.mutableBinding) return;
|
||||
this.getCompatibleScopes();
|
||||
const attachTo = this.getAttachmentPath();
|
||||
if (!attachTo) return;
|
||||
if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
|
||||
let uid = attachTo.scope.generateUidIdentifier("ref");
|
||||
const declarator = t().variableDeclarator(uid, this.path.node);
|
||||
const declarator = t.variableDeclarator(uid, this.path.node);
|
||||
const insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
|
||||
const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t().variableDeclaration("var", [declarator])]);
|
||||
const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]);
|
||||
const parent = this.path.parentPath;
|
||||
|
||||
if (parent.isJSXElement() && this.path.container === parent.node.children) {
|
||||
uid = t().JSXExpressionContainer(uid);
|
||||
uid = t.JSXExpressionContainer(uid);
|
||||
}
|
||||
|
||||
this.path.replaceWith(t().cloneNode(uid));
|
||||
this.path.replaceWith(t.cloneNode(uid));
|
||||
return attachTo.isVariableDeclarator() ? attached.get("init") : attached.get("declarations.0.init");
|
||||
}
|
||||
|
||||
|
||||
52
node_modules/@babel/traverse/lib/path/lib/virtual-types.js
generated
vendored
52
node_modules/@babel/traverse/lib/path/lib/virtual-types.js
generated
vendored
@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.ForAwaitStatement = exports.NumericLiteralTypeAnnotation = exports.ExistentialTypeParam = exports.SpreadProperty = exports.RestProperty = exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = void 0;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const ReferencedIdentifier = {
|
||||
types: ["Identifier", "JSXIdentifier"],
|
||||
@@ -26,15 +20,15 @@ const ReferencedIdentifier = {
|
||||
parent
|
||||
} = path;
|
||||
|
||||
if (!t().isIdentifier(node, opts) && !t().isJSXMemberExpression(parent, opts)) {
|
||||
if (t().isJSXIdentifier(node, opts)) {
|
||||
if (t().react.isCompatTag(node.name)) return false;
|
||||
if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
|
||||
if (t.isJSXIdentifier(node, opts)) {
|
||||
if (t.react.isCompatTag(node.name)) return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return t().isReferenced(node, parent, path.parentPath.parent);
|
||||
return t.isReferenced(node, parent, path.parentPath.parent);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -46,7 +40,7 @@ const ReferencedMemberExpression = {
|
||||
node,
|
||||
parent
|
||||
}) {
|
||||
return t().isMemberExpression(node) && t().isReferenced(node, parent);
|
||||
return t.isMemberExpression(node) && t.isReferenced(node, parent);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -60,7 +54,7 @@ const BindingIdentifier = {
|
||||
parent
|
||||
} = path;
|
||||
const grandparent = path.parentPath.parent;
|
||||
return t().isIdentifier(node) && t().isBinding(node, parent, grandparent);
|
||||
return t.isIdentifier(node) && t.isBinding(node, parent, grandparent);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -72,12 +66,12 @@ const Statement = {
|
||||
node,
|
||||
parent
|
||||
}) {
|
||||
if (t().isStatement(node)) {
|
||||
if (t().isVariableDeclaration(node)) {
|
||||
if (t().isForXStatement(parent, {
|
||||
if (t.isStatement(node)) {
|
||||
if (t.isVariableDeclaration(node)) {
|
||||
if (t.isForXStatement(parent, {
|
||||
left: node
|
||||
})) return false;
|
||||
if (t().isForStatement(parent, {
|
||||
if (t.isForStatement(parent, {
|
||||
init: node
|
||||
})) return false;
|
||||
}
|
||||
@@ -97,31 +91,31 @@ const Expression = {
|
||||
if (path.isIdentifier()) {
|
||||
return path.isReferencedIdentifier();
|
||||
} else {
|
||||
return t().isExpression(path.node);
|
||||
return t.isExpression(path.node);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
exports.Expression = Expression;
|
||||
const Scope = {
|
||||
types: ["Scopable"],
|
||||
types: ["Scopable", "Pattern"],
|
||||
|
||||
checkPath(path) {
|
||||
return t().isScope(path.node, path.parent);
|
||||
return t.isScope(path.node, path.parent);
|
||||
}
|
||||
|
||||
};
|
||||
exports.Scope = Scope;
|
||||
const Referenced = {
|
||||
checkPath(path) {
|
||||
return t().isReferenced(path.node, path.parent);
|
||||
return t.isReferenced(path.node, path.parent);
|
||||
}
|
||||
|
||||
};
|
||||
exports.Referenced = Referenced;
|
||||
const BlockScoped = {
|
||||
checkPath(path) {
|
||||
return t().isBlockScoped(path.node);
|
||||
return t.isBlockScoped(path.node);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -130,7 +124,7 @@ const Var = {
|
||||
types: ["VariableDeclaration"],
|
||||
|
||||
checkPath(path) {
|
||||
return t().isVar(path.node);
|
||||
return t.isVar(path.node);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -162,13 +156,13 @@ const Flow = {
|
||||
checkPath({
|
||||
node
|
||||
}) {
|
||||
if (t().isFlow(node)) {
|
||||
if (t.isFlow(node)) {
|
||||
return true;
|
||||
} else if (t().isImportDeclaration(node)) {
|
||||
} else if (t.isImportDeclaration(node)) {
|
||||
return node.importKind === "type" || node.importKind === "typeof";
|
||||
} else if (t().isExportDeclaration(node)) {
|
||||
} else if (t.isExportDeclaration(node)) {
|
||||
return node.exportKind === "type";
|
||||
} else if (t().isImportSpecifier(node)) {
|
||||
} else if (t.isImportSpecifier(node)) {
|
||||
return node.importKind === "type" || node.importKind === "typeof";
|
||||
} else {
|
||||
return false;
|
||||
|
||||
24
node_modules/@babel/traverse/lib/path/modification.js
generated
vendored
24
node_modules/@babel/traverse/lib/path/modification.js
generated
vendored
@@ -20,17 +20,11 @@ var _hoister = _interopRequireDefault(require("./lib/hoister"));
|
||||
|
||||
var _index = _interopRequireDefault(require("./index"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -51,7 +45,7 @@ function insertBefore(nodes) {
|
||||
return this._containerInsertBefore(nodes);
|
||||
} else if (this.isStatementOrBlock()) {
|
||||
const shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
|
||||
this.replaceWith(t().blockStatement(shouldInsertCurrentNode ? [this.node] : []));
|
||||
this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [this.node] : []));
|
||||
return this.unshiftContainer("body", nodes);
|
||||
} else {
|
||||
throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
|
||||
@@ -105,9 +99,9 @@ function insertAfter(nodes) {
|
||||
|
||||
if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
|
||||
return parentPath.insertAfter(nodes.map(node => {
|
||||
return t().isExpression(node) ? t().expressionStatement(node) : node;
|
||||
return t.isExpression(node) ? t.expressionStatement(node) : node;
|
||||
}));
|
||||
} else if (this.isNodeType("Expression") && !this.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
|
||||
} else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
|
||||
if (this.node) {
|
||||
let {
|
||||
scope
|
||||
@@ -121,8 +115,8 @@ function insertAfter(nodes) {
|
||||
}
|
||||
|
||||
const temp = scope.generateDeclaredUidIdentifier();
|
||||
nodes.unshift(t().expressionStatement(t().assignmentExpression("=", t().cloneNode(temp), this.node)));
|
||||
nodes.push(t().expressionStatement(t().cloneNode(temp)));
|
||||
nodes.unshift(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(temp), this.node)));
|
||||
nodes.push(t.expressionStatement(t.cloneNode(temp)));
|
||||
}
|
||||
|
||||
return this.replaceExpressionWithStatements(nodes);
|
||||
@@ -130,7 +124,7 @@ function insertAfter(nodes) {
|
||||
return this._containerInsertAfter(nodes);
|
||||
} else if (this.isStatementOrBlock()) {
|
||||
const shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
|
||||
this.replaceWith(t().blockStatement(shouldInsertCurrentNode ? [this.node] : []));
|
||||
this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [this.node] : []));
|
||||
return this.pushContainer("body", nodes);
|
||||
} else {
|
||||
throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
|
||||
|
||||
11
node_modules/@babel/traverse/lib/path/removal.js
generated
vendored
11
node_modules/@babel/traverse/lib/path/removal.js
generated
vendored
@@ -12,12 +12,18 @@ exports._assertUnremoved = _assertUnremoved;
|
||||
|
||||
var _removalHooks = require("./lib/removal-hooks");
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
function remove() {
|
||||
var _this$opts;
|
||||
|
||||
this._assertUnremoved();
|
||||
|
||||
this.resync();
|
||||
|
||||
this._removeFromScope();
|
||||
if (!((_this$opts = this.opts) == null ? void 0 : _this$opts.noScope)) {
|
||||
this._removeFromScope();
|
||||
}
|
||||
|
||||
if (this._callRemovalHooks()) {
|
||||
this._markRemoved();
|
||||
@@ -53,8 +59,7 @@ function _remove() {
|
||||
}
|
||||
|
||||
function _markRemoved() {
|
||||
this.shouldSkip = true;
|
||||
this.removed = true;
|
||||
this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED;
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
|
||||
80
node_modules/@babel/traverse/lib/path/replacement.js
generated
vendored
80
node_modules/@babel/traverse/lib/path/replacement.js
generated
vendored
@@ -10,41 +10,19 @@ exports._replaceWith = _replaceWith;
|
||||
exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
|
||||
exports.replaceInline = replaceInline;
|
||||
|
||||
function _codeFrame() {
|
||||
const data = require("@babel/code-frame");
|
||||
|
||||
_codeFrame = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _codeFrame = require("@babel/code-frame");
|
||||
|
||||
var _index = _interopRequireDefault(require("../index"));
|
||||
|
||||
var _index2 = _interopRequireDefault(require("./index"));
|
||||
|
||||
function _parser() {
|
||||
const data = require("@babel/parser");
|
||||
var _parser = require("@babel/parser");
|
||||
|
||||
_parser = function () {
|
||||
return data;
|
||||
};
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
return data;
|
||||
}
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -67,7 +45,7 @@ const hoistVariablesVisitor = {
|
||||
|
||||
for (const declar of path.node.declarations) {
|
||||
if (declar.init) {
|
||||
exprs.push(t().expressionStatement(t().assignmentExpression("=", declar.id, declar.init)));
|
||||
exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +57,8 @@ const hoistVariablesVisitor = {
|
||||
function replaceWithMultiple(nodes) {
|
||||
this.resync();
|
||||
nodes = this._verifyNodeList(nodes);
|
||||
t().inheritLeadingComments(nodes[0], this.node);
|
||||
t().inheritTrailingComments(nodes[nodes.length - 1], this.node);
|
||||
t.inheritLeadingComments(nodes[0], this.node);
|
||||
t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
|
||||
this.node = this.container[this.key] = null;
|
||||
const paths = this.insertAfter(nodes);
|
||||
|
||||
@@ -98,12 +76,12 @@ function replaceWithSourceString(replacement) {
|
||||
|
||||
try {
|
||||
replacement = `(${replacement})`;
|
||||
replacement = (0, _parser().parse)(replacement);
|
||||
replacement = (0, _parser.parse)(replacement);
|
||||
} catch (err) {
|
||||
const loc = err.loc;
|
||||
|
||||
if (loc) {
|
||||
err.message += " - make sure this is an expression.\n" + (0, _codeFrame().codeFrameColumns)(replacement, {
|
||||
err.message += " - make sure this is an expression.\n" + (0, _codeFrame.codeFrameColumns)(replacement, {
|
||||
start: {
|
||||
line: loc.line,
|
||||
column: loc.column + 1
|
||||
@@ -141,7 +119,7 @@ function replaceWith(replacement) {
|
||||
return [this];
|
||||
}
|
||||
|
||||
if (this.isProgram() && !t().isProgram(replacement)) {
|
||||
if (this.isProgram() && !t.isProgram(replacement)) {
|
||||
throw new Error("You can only replace a Program root node with another Program node");
|
||||
}
|
||||
|
||||
@@ -155,14 +133,14 @@ function replaceWith(replacement) {
|
||||
|
||||
let nodePath = "";
|
||||
|
||||
if (this.isNodeType("Statement") && t().isExpression(replacement)) {
|
||||
if (this.isNodeType("Statement") && t.isExpression(replacement)) {
|
||||
if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
|
||||
replacement = t().expressionStatement(replacement);
|
||||
replacement = t.expressionStatement(replacement);
|
||||
nodePath = "expression";
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isNodeType("Expression") && t().isStatement(replacement)) {
|
||||
if (this.isNodeType("Expression") && t.isStatement(replacement)) {
|
||||
if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
|
||||
return this.replaceExpressionWithStatements([replacement]);
|
||||
}
|
||||
@@ -171,8 +149,8 @@ function replaceWith(replacement) {
|
||||
const oldNode = this.node;
|
||||
|
||||
if (oldNode) {
|
||||
t().inheritsComments(replacement, oldNode);
|
||||
t().removeComments(oldNode);
|
||||
t.inheritsComments(replacement, oldNode);
|
||||
t.removeComments(oldNode);
|
||||
}
|
||||
|
||||
this._replaceWith(replacement);
|
||||
@@ -189,27 +167,27 @@ function _replaceWith(node) {
|
||||
}
|
||||
|
||||
if (this.inList) {
|
||||
t().validate(this.parent, this.key, [node]);
|
||||
t.validate(this.parent, this.key, [node]);
|
||||
} else {
|
||||
t().validate(this.parent, this.key, node);
|
||||
t.validate(this.parent, this.key, node);
|
||||
}
|
||||
|
||||
this.debug(`Replace with ${node && node.type}`);
|
||||
this.debug(`Replace with ${node == null ? void 0 : node.type}`);
|
||||
this.node = this.container[this.key] = node;
|
||||
}
|
||||
|
||||
function replaceExpressionWithStatements(nodes) {
|
||||
this.resync();
|
||||
const toSequenceExpression = t().toSequenceExpression(nodes, this.scope);
|
||||
const toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
|
||||
|
||||
if (toSequenceExpression) {
|
||||
return this.replaceWith(toSequenceExpression)[0].get("expressions");
|
||||
}
|
||||
|
||||
const functionParent = this.getFunctionParent();
|
||||
const isParentAsync = functionParent && functionParent.is("async");
|
||||
const container = t().arrowFunctionExpression([], t().blockStatement(nodes));
|
||||
this.replaceWith(t().callExpression(container, []));
|
||||
const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
|
||||
const container = t.arrowFunctionExpression([], t.blockStatement(nodes));
|
||||
this.replaceWith(t.callExpression(container, []));
|
||||
this.traverse(hoistVariablesVisitor);
|
||||
const completionRecords = this.get("callee").getCompletionRecords();
|
||||
|
||||
@@ -223,24 +201,24 @@ function replaceExpressionWithStatements(nodes) {
|
||||
if (!uid) {
|
||||
const callee = this.get("callee");
|
||||
uid = callee.scope.generateDeclaredUidIdentifier("ret");
|
||||
callee.get("body").pushContainer("body", t().returnStatement(t().cloneNode(uid)));
|
||||
callee.get("body").pushContainer("body", t.returnStatement(t.cloneNode(uid)));
|
||||
loop.setData("expressionReplacementReturnUid", uid);
|
||||
} else {
|
||||
uid = t().identifier(uid.name);
|
||||
uid = t.identifier(uid.name);
|
||||
}
|
||||
|
||||
path.get("expression").replaceWith(t().assignmentExpression("=", t().cloneNode(uid), path.node.expression));
|
||||
path.get("expression").replaceWith(t.assignmentExpression("=", t.cloneNode(uid), path.node.expression));
|
||||
} else {
|
||||
path.replaceWith(t().returnStatement(path.node.expression));
|
||||
path.replaceWith(t.returnStatement(path.node.expression));
|
||||
}
|
||||
}
|
||||
|
||||
const callee = this.get("callee");
|
||||
callee.arrowFunctionToExpression();
|
||||
|
||||
if (isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", t().FUNCTION_TYPES)) {
|
||||
if (isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", t.FUNCTION_TYPES)) {
|
||||
callee.set("async", true);
|
||||
this.replaceWith(t().awaitExpression(this.node));
|
||||
this.replaceWith(t.awaitExpression(this.node));
|
||||
}
|
||||
|
||||
return callee.get("body.body");
|
||||
|
||||
440
node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
440
node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
@@ -5,106 +5,170 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _includes() {
|
||||
const data = _interopRequireDefault(require("lodash/includes"));
|
||||
|
||||
_includes = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _repeat() {
|
||||
const data = _interopRequireDefault(require("lodash/repeat"));
|
||||
|
||||
_repeat = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _renamer = _interopRequireDefault(require("./lib/renamer"));
|
||||
|
||||
var _index = _interopRequireDefault(require("../index"));
|
||||
|
||||
function _defaults() {
|
||||
const data = _interopRequireDefault(require("lodash/defaults"));
|
||||
|
||||
_defaults = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
||||
|
||||
var _binding = _interopRequireDefault(require("./binding"));
|
||||
|
||||
function _globals() {
|
||||
const data = _interopRequireDefault(require("globals"));
|
||||
var _globals = _interopRequireDefault(require("globals"));
|
||||
|
||||
_globals = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _cache = require("../cache");
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function gatherNodeParts(node, parts) {
|
||||
if (t().isModuleDeclaration(node)) {
|
||||
if (node.source) {
|
||||
gatherNodeParts(node.source, parts);
|
||||
} else if (node.specifiers && node.specifiers.length) {
|
||||
for (const specifier of node.specifiers) {
|
||||
gatherNodeParts(specifier, parts);
|
||||
switch (node == null ? void 0 : node.type) {
|
||||
default:
|
||||
if (t.isModuleDeclaration(node)) {
|
||||
if (node.source) {
|
||||
gatherNodeParts(node.source, parts);
|
||||
} else if (node.specifiers && node.specifiers.length) {
|
||||
for (const e of node.specifiers) gatherNodeParts(e, parts);
|
||||
} else if (node.declaration) {
|
||||
gatherNodeParts(node.declaration, parts);
|
||||
}
|
||||
} else if (t.isModuleSpecifier(node)) {
|
||||
gatherNodeParts(node.local, parts);
|
||||
} else if (t.isLiteral(node)) {
|
||||
parts.push(node.value);
|
||||
}
|
||||
} else if (node.declaration) {
|
||||
gatherNodeParts(node.declaration, parts);
|
||||
}
|
||||
} else if (t().isModuleSpecifier(node)) {
|
||||
gatherNodeParts(node.local, parts);
|
||||
} else if (t().isMemberExpression(node)) {
|
||||
gatherNodeParts(node.object, parts);
|
||||
gatherNodeParts(node.property, parts);
|
||||
} else if (t().isIdentifier(node)) {
|
||||
parts.push(node.name);
|
||||
} else if (t().isLiteral(node)) {
|
||||
parts.push(node.value);
|
||||
} else if (t().isCallExpression(node)) {
|
||||
gatherNodeParts(node.callee, parts);
|
||||
} else if (t().isObjectExpression(node) || t().isObjectPattern(node)) {
|
||||
for (const prop of node.properties) {
|
||||
gatherNodeParts(prop.key || prop.argument, parts);
|
||||
}
|
||||
} else if (t().isPrivateName(node)) {
|
||||
gatherNodeParts(node.id, parts);
|
||||
} else if (t().isThisExpression(node)) {
|
||||
parts.push("this");
|
||||
} else if (t().isSuper(node)) {
|
||||
parts.push("super");
|
||||
|
||||
break;
|
||||
|
||||
case "MemberExpression":
|
||||
case "OptionalMemberExpression":
|
||||
case "JSXMemberExpression":
|
||||
gatherNodeParts(node.object, parts);
|
||||
gatherNodeParts(node.property, parts);
|
||||
break;
|
||||
|
||||
case "Identifier":
|
||||
case "JSXIdentifier":
|
||||
parts.push(node.name);
|
||||
break;
|
||||
|
||||
case "CallExpression":
|
||||
case "OptionalCallExpression":
|
||||
case "NewExpression":
|
||||
gatherNodeParts(node.callee, parts);
|
||||
break;
|
||||
|
||||
case "ObjectExpression":
|
||||
case "ObjectPattern":
|
||||
for (const e of node.properties) {
|
||||
gatherNodeParts(e, parts);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "SpreadElement":
|
||||
case "RestElement":
|
||||
gatherNodeParts(node.argument, parts);
|
||||
break;
|
||||
|
||||
case "ObjectProperty":
|
||||
case "ObjectMethod":
|
||||
case "ClassProperty":
|
||||
case "ClassMethod":
|
||||
case "ClassPrivateProperty":
|
||||
case "ClassPrivateMethod":
|
||||
gatherNodeParts(node.key, parts);
|
||||
break;
|
||||
|
||||
case "ThisExpression":
|
||||
parts.push("this");
|
||||
break;
|
||||
|
||||
case "Super":
|
||||
parts.push("super");
|
||||
break;
|
||||
|
||||
case "Import":
|
||||
parts.push("import");
|
||||
break;
|
||||
|
||||
case "DoExpression":
|
||||
parts.push("do");
|
||||
break;
|
||||
|
||||
case "YieldExpression":
|
||||
parts.push("yield");
|
||||
gatherNodeParts(node.argument, parts);
|
||||
break;
|
||||
|
||||
case "AwaitExpression":
|
||||
parts.push("await");
|
||||
gatherNodeParts(node.argument, parts);
|
||||
break;
|
||||
|
||||
case "AssignmentExpression":
|
||||
gatherNodeParts(node.left, parts);
|
||||
break;
|
||||
|
||||
case "VariableDeclarator":
|
||||
gatherNodeParts(node.id, parts);
|
||||
break;
|
||||
|
||||
case "FunctionExpression":
|
||||
case "FunctionDeclaration":
|
||||
case "ClassExpression":
|
||||
case "ClassDeclaration":
|
||||
gatherNodeParts(node.id, parts);
|
||||
break;
|
||||
|
||||
case "PrivateName":
|
||||
gatherNodeParts(node.id, parts);
|
||||
break;
|
||||
|
||||
case "ParenthesizedExpression":
|
||||
gatherNodeParts(node.expression, parts);
|
||||
break;
|
||||
|
||||
case "UnaryExpression":
|
||||
case "UpdateExpression":
|
||||
gatherNodeParts(node.argument, parts);
|
||||
break;
|
||||
|
||||
case "MetaProperty":
|
||||
gatherNodeParts(node.meta, parts);
|
||||
gatherNodeParts(node.property, parts);
|
||||
break;
|
||||
|
||||
case "JSXElement":
|
||||
gatherNodeParts(node.openingElement, parts);
|
||||
break;
|
||||
|
||||
case "JSXOpeningElement":
|
||||
parts.push(node.name);
|
||||
break;
|
||||
|
||||
case "JSXFragment":
|
||||
gatherNodeParts(node.openingFragment, parts);
|
||||
break;
|
||||
|
||||
case "JSXOpeningFragment":
|
||||
parts.push("Fragment");
|
||||
break;
|
||||
|
||||
case "JSXNamespacedName":
|
||||
gatherNodeParts(node.namespace, parts);
|
||||
gatherNodeParts(node.name, parts);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const collectorVisitor = {
|
||||
For(path) {
|
||||
for (const key of t().FOR_INIT_KEYS) {
|
||||
for (const key of t.FOR_INIT_KEYS) {
|
||||
const declar = path.get(key);
|
||||
|
||||
if (declar.isVar()) {
|
||||
@@ -145,14 +209,14 @@ const collectorVisitor = {
|
||||
} = path;
|
||||
const declar = node.declaration;
|
||||
|
||||
if (t().isClassDeclaration(declar) || t().isFunctionDeclaration(declar)) {
|
||||
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
|
||||
const id = declar.id;
|
||||
if (!id) return;
|
||||
const binding = scope.getBinding(id.name);
|
||||
if (binding) binding.reference(path);
|
||||
} else if (t().isVariableDeclaration(declar)) {
|
||||
} else if (t.isVariableDeclaration(declar)) {
|
||||
for (const decl of declar.declarations) {
|
||||
for (const name of Object.keys(t().getBindingIdentifiers(decl))) {
|
||||
for (const name of Object.keys(t.getBindingIdentifiers(decl))) {
|
||||
const binding = scope.getBinding(name);
|
||||
if (binding) binding.reference(path);
|
||||
}
|
||||
@@ -184,14 +248,14 @@ const collectorVisitor = {
|
||||
BlockScoped(path) {
|
||||
let scope = path.scope;
|
||||
if (scope.path === path) scope = scope.parent;
|
||||
scope.getBlockParent().registerDeclaration(path);
|
||||
},
|
||||
const parent = scope.getBlockParent();
|
||||
parent.registerDeclaration(path);
|
||||
|
||||
ClassDeclaration(path) {
|
||||
const id = path.node.id;
|
||||
if (!id) return;
|
||||
const name = id.name;
|
||||
path.scope.bindings[name] = path.scope.getBinding(name);
|
||||
if (path.isClassDeclaration() && path.node.id) {
|
||||
const id = path.node.id;
|
||||
const name = id.name;
|
||||
path.scope.bindings[name] = path.scope.parent.getBinding(name);
|
||||
}
|
||||
},
|
||||
|
||||
Block(path) {
|
||||
@@ -202,6 +266,28 @@ const collectorVisitor = {
|
||||
path.scope.getBlockParent().registerDeclaration(bodyPath);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
CatchClause(path) {
|
||||
path.scope.registerBinding("let", path);
|
||||
},
|
||||
|
||||
Function(path) {
|
||||
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) {
|
||||
path.scope.registerBinding("local", path.get("id"), path);
|
||||
}
|
||||
|
||||
const params = path.get("params");
|
||||
|
||||
for (const param of params) {
|
||||
path.scope.registerBinding("param", param);
|
||||
}
|
||||
},
|
||||
|
||||
ClassExpression(path) {
|
||||
if (path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) {
|
||||
path.scope.registerBinding("local", path);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -215,7 +301,7 @@ class Scope {
|
||||
|
||||
const cached = _cache.scope.get(node);
|
||||
|
||||
if (cached && cached.path === path) {
|
||||
if ((cached == null ? void 0 : cached.path) === path) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
@@ -225,11 +311,12 @@ class Scope {
|
||||
this.block = node;
|
||||
this.path = path;
|
||||
this.labels = new Map();
|
||||
this.inited = false;
|
||||
}
|
||||
|
||||
get parent() {
|
||||
const parent = this.path.findParent(p => p.isScope());
|
||||
return parent && parent.scope;
|
||||
return parent == null ? void 0 : parent.scope;
|
||||
}
|
||||
|
||||
get parentBlock() {
|
||||
@@ -249,15 +336,15 @@ class Scope {
|
||||
this.push({
|
||||
id
|
||||
});
|
||||
return t().cloneNode(id);
|
||||
return t.cloneNode(id);
|
||||
}
|
||||
|
||||
generateUidIdentifier(name) {
|
||||
return t().identifier(this.generateUid(name));
|
||||
return t.identifier(this.generateUid(name));
|
||||
}
|
||||
|
||||
generateUid(name = "temp") {
|
||||
name = t().toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
||||
name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
||||
let uid;
|
||||
let i = 0;
|
||||
|
||||
@@ -278,17 +365,7 @@ class Scope {
|
||||
return `_${id}`;
|
||||
}
|
||||
|
||||
generateUidBasedOnNode(parent, defaultName) {
|
||||
let node = parent;
|
||||
|
||||
if (t().isAssignmentExpression(parent)) {
|
||||
node = parent.left;
|
||||
} else if (t().isVariableDeclarator(parent)) {
|
||||
node = parent.id;
|
||||
} else if (t().isObjectProperty(node) || t().isObjectMethod(node)) {
|
||||
node = node.key;
|
||||
}
|
||||
|
||||
generateUidBasedOnNode(node, defaultName) {
|
||||
const parts = [];
|
||||
gatherNodeParts(node, parts);
|
||||
let id = parts.join("$");
|
||||
@@ -296,16 +373,16 @@ class Scope {
|
||||
return this.generateUid(id.slice(0, 20));
|
||||
}
|
||||
|
||||
generateUidIdentifierBasedOnNode(parent, defaultName) {
|
||||
return t().identifier(this.generateUidBasedOnNode(parent, defaultName));
|
||||
generateUidIdentifierBasedOnNode(node, defaultName) {
|
||||
return t.identifier(this.generateUidBasedOnNode(node, defaultName));
|
||||
}
|
||||
|
||||
isStatic(node) {
|
||||
if (t().isThisExpression(node) || t().isSuper(node)) {
|
||||
if (t.isThisExpression(node) || t.isSuper(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t().isIdentifier(node)) {
|
||||
if (t.isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
|
||||
if (binding) {
|
||||
@@ -328,7 +405,7 @@ class Scope {
|
||||
this.push({
|
||||
id
|
||||
});
|
||||
return t().cloneNode(id);
|
||||
return t.cloneNode(id);
|
||||
}
|
||||
|
||||
return id;
|
||||
@@ -362,7 +439,7 @@ class Scope {
|
||||
}
|
||||
|
||||
dump() {
|
||||
const sep = (0, _repeat().default)("-", 60);
|
||||
const sep = "-".repeat(60);
|
||||
console.log(sep);
|
||||
let scope = this;
|
||||
|
||||
@@ -383,23 +460,23 @@ class Scope {
|
||||
console.log(sep);
|
||||
}
|
||||
|
||||
toArray(node, i) {
|
||||
if (t().isIdentifier(node)) {
|
||||
toArray(node, i, allowArrayLike) {
|
||||
if (t.isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
|
||||
if (binding && binding.constant && binding.path.isGenericType("Array")) {
|
||||
if ((binding == null ? void 0 : binding.constant) && binding.path.isGenericType("Array")) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
if (t().isArrayExpression(node)) {
|
||||
if (t.isArrayExpression(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (t().isIdentifier(node, {
|
||||
if (t.isIdentifier(node, {
|
||||
name: "arguments"
|
||||
})) {
|
||||
return t().callExpression(t().memberExpression(t().memberExpression(t().memberExpression(t().identifier("Array"), t().identifier("prototype")), t().identifier("slice")), t().identifier("call")), [node]);
|
||||
return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
|
||||
}
|
||||
|
||||
let helperName;
|
||||
@@ -408,13 +485,18 @@ class Scope {
|
||||
if (i === true) {
|
||||
helperName = "toConsumableArray";
|
||||
} else if (i) {
|
||||
args.push(t().numericLiteral(i));
|
||||
args.push(t.numericLiteral(i));
|
||||
helperName = "slicedToArray";
|
||||
} else {
|
||||
helperName = "toArray";
|
||||
}
|
||||
|
||||
return t().callExpression(this.hub.addHelper(helperName), args);
|
||||
if (allowArrayLike) {
|
||||
args.unshift(this.hub.addHelper(helperName));
|
||||
helperName = "maybeArrayLike";
|
||||
}
|
||||
|
||||
return t.callExpression(this.hub.addHelper(helperName), args);
|
||||
}
|
||||
|
||||
hasLabel(name) {
|
||||
@@ -460,11 +542,7 @@ class Scope {
|
||||
}
|
||||
|
||||
buildUndefinedNode() {
|
||||
if (this.hasBinding("undefined")) {
|
||||
return t().unaryExpression("void", t().numericLiteral(0), true);
|
||||
} else {
|
||||
return t().identifier("undefined");
|
||||
}
|
||||
return t.unaryExpression("void", t.numericLiteral(0), true);
|
||||
}
|
||||
|
||||
registerConstantViolation(path) {
|
||||
@@ -493,6 +571,8 @@ class Scope {
|
||||
const ids = path.getOuterBindingIdentifiers(true);
|
||||
|
||||
for (const name of Object.keys(ids)) {
|
||||
parent.references[name] = true;
|
||||
|
||||
for (const id of ids[name]) {
|
||||
const local = this.getOwnBinding(name);
|
||||
|
||||
@@ -501,8 +581,6 @@ class Scope {
|
||||
this.checkBlockScopedCollisions(local, kind, name, id);
|
||||
}
|
||||
|
||||
parent.references[name] = true;
|
||||
|
||||
if (local) {
|
||||
this.registerConstantViolation(bindingPath);
|
||||
} else {
|
||||
@@ -542,66 +620,60 @@ class Scope {
|
||||
}
|
||||
|
||||
hasReference(name) {
|
||||
let scope = this;
|
||||
|
||||
do {
|
||||
if (scope.references[name]) return true;
|
||||
} while (scope = scope.parent);
|
||||
|
||||
return false;
|
||||
return !!this.getProgramParent().references[name];
|
||||
}
|
||||
|
||||
isPure(node, constantsOnly) {
|
||||
if (t().isIdentifier(node)) {
|
||||
if (t.isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
if (!binding) return false;
|
||||
if (constantsOnly) return binding.constant;
|
||||
return true;
|
||||
} else if (t().isClass(node)) {
|
||||
} else if (t.isClass(node)) {
|
||||
if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.isPure(node.body, constantsOnly);
|
||||
} else if (t().isClassBody(node)) {
|
||||
} else if (t.isClassBody(node)) {
|
||||
for (const method of node.body) {
|
||||
if (!this.isPure(method, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (t().isBinary(node)) {
|
||||
} else if (t.isBinary(node)) {
|
||||
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
|
||||
} else if (t().isArrayExpression(node)) {
|
||||
} else if (t.isArrayExpression(node)) {
|
||||
for (const elem of node.elements) {
|
||||
if (!this.isPure(elem, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (t().isObjectExpression(node)) {
|
||||
} else if (t.isObjectExpression(node)) {
|
||||
for (const prop of node.properties) {
|
||||
if (!this.isPure(prop, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (t().isClassMethod(node)) {
|
||||
} else if (t.isMethod(node)) {
|
||||
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
|
||||
if (node.kind === "get" || node.kind === "set") return false;
|
||||
return true;
|
||||
} else if (t().isProperty(node)) {
|
||||
} else if (t.isProperty(node)) {
|
||||
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
|
||||
return this.isPure(node.value, constantsOnly);
|
||||
} else if (t().isUnaryExpression(node)) {
|
||||
} else if (t.isUnaryExpression(node)) {
|
||||
return this.isPure(node.argument, constantsOnly);
|
||||
} else if (t().isTaggedTemplateExpression(node)) {
|
||||
return t().matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
|
||||
} else if (t().isTemplateLiteral(node)) {
|
||||
} else if (t.isTaggedTemplateExpression(node)) {
|
||||
return t.matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
|
||||
} else if (t.isTemplateLiteral(node)) {
|
||||
for (const expression of node.expressions) {
|
||||
if (!this.isPure(expression, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return t().isPureish(node);
|
||||
return t.isPureish(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +700,10 @@ class Scope {
|
||||
}
|
||||
|
||||
init() {
|
||||
if (!this.references) this.crawl();
|
||||
if (!this.inited) {
|
||||
this.inited = true;
|
||||
this.crawl();
|
||||
}
|
||||
}
|
||||
|
||||
crawl() {
|
||||
@@ -639,26 +714,11 @@ class Scope {
|
||||
this.uids = Object.create(null);
|
||||
this.data = Object.create(null);
|
||||
|
||||
if (path.isLoop()) {
|
||||
for (const key of t().FOR_INIT_KEYS) {
|
||||
const node = path.get(key);
|
||||
if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
|
||||
}
|
||||
}
|
||||
|
||||
if (path.isFunctionExpression() && path.has("id")) {
|
||||
if (!path.get("id").node[t().NOT_LOCAL_BINDING]) {
|
||||
if (path.isFunction()) {
|
||||
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) {
|
||||
this.registerBinding("local", path.get("id"), path);
|
||||
}
|
||||
}
|
||||
|
||||
if (path.isClassExpression() && path.has("id")) {
|
||||
if (!path.get("id").node[t().NOT_LOCAL_BINDING]) {
|
||||
this.registerBinding("local", path);
|
||||
}
|
||||
}
|
||||
|
||||
if (path.isFunction()) {
|
||||
const params = path.get("params");
|
||||
|
||||
for (const param of params) {
|
||||
@@ -666,12 +726,8 @@ class Scope {
|
||||
}
|
||||
}
|
||||
|
||||
if (path.isCatchClause()) {
|
||||
this.registerBinding("let", path);
|
||||
}
|
||||
|
||||
const parent = this.getProgramParent();
|
||||
if (parent.crawling) return;
|
||||
const programParent = this.getProgramParent();
|
||||
if (programParent.crawling) return;
|
||||
const state = {
|
||||
references: [],
|
||||
constantViolations: [],
|
||||
@@ -683,11 +739,9 @@ class Scope {
|
||||
|
||||
for (const path of state.assignments) {
|
||||
const ids = path.getBindingIdentifiers();
|
||||
let programParent;
|
||||
|
||||
for (const name of Object.keys(ids)) {
|
||||
if (path.scope.getBinding(name)) continue;
|
||||
programParent = programParent || path.scope.getProgramParent();
|
||||
programParent.addGlobal(ids[name]);
|
||||
}
|
||||
|
||||
@@ -700,7 +754,7 @@ class Scope {
|
||||
if (binding) {
|
||||
binding.reference(ref);
|
||||
} else {
|
||||
ref.scope.getProgramParent().addGlobal(ref.node);
|
||||
programParent.addGlobal(ref.node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,13 +786,13 @@ class Scope {
|
||||
let declarPath = !unique && path.getData(dataKey);
|
||||
|
||||
if (!declarPath) {
|
||||
const declar = t().variableDeclaration(kind, []);
|
||||
const declar = t.variableDeclaration(kind, []);
|
||||
declar._blockHoist = blockHoist;
|
||||
[declarPath] = path.unshiftContainer("body", [declar]);
|
||||
if (!unique) path.setData(dataKey, declarPath);
|
||||
}
|
||||
|
||||
const declarator = t().variableDeclarator(opts.id, opts.init);
|
||||
const declarator = t.variableDeclarator(opts.id, opts.init);
|
||||
declarPath.node.declarations.push(declarator);
|
||||
this.registerBinding(kind, declarPath.get("declarations").pop());
|
||||
}
|
||||
@@ -784,7 +838,7 @@ class Scope {
|
||||
let scope = this;
|
||||
|
||||
do {
|
||||
(0, _defaults().default)(ids, scope.bindings);
|
||||
(0, _defaults.default)(ids, scope.bindings);
|
||||
scope = scope.parent;
|
||||
} while (scope);
|
||||
|
||||
@@ -816,10 +870,18 @@ class Scope {
|
||||
|
||||
getBinding(name) {
|
||||
let scope = this;
|
||||
let previousPath;
|
||||
|
||||
do {
|
||||
const binding = scope.getOwnBinding(name);
|
||||
if (binding) return binding;
|
||||
|
||||
if (binding) {
|
||||
if (previousPath && previousPath.isPattern() && previousPath.parentPath.isFunction() && binding.kind !== "param") {} else {
|
||||
return binding;
|
||||
}
|
||||
}
|
||||
|
||||
previousPath = scope.path;
|
||||
} while (scope = scope.parent);
|
||||
}
|
||||
|
||||
@@ -828,13 +890,14 @@ class Scope {
|
||||
}
|
||||
|
||||
getBindingIdentifier(name) {
|
||||
const info = this.getBinding(name);
|
||||
return info && info.identifier;
|
||||
var _this$getBinding;
|
||||
|
||||
return (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.identifier;
|
||||
}
|
||||
|
||||
getOwnBindingIdentifier(name) {
|
||||
const binding = this.bindings[name];
|
||||
return binding && binding.identifier;
|
||||
return binding == null ? void 0 : binding.identifier;
|
||||
}
|
||||
|
||||
hasOwnBinding(name) {
|
||||
@@ -846,13 +909,15 @@ class Scope {
|
||||
if (this.hasOwnBinding(name)) return true;
|
||||
if (this.parentHasBinding(name, noGlobals)) return true;
|
||||
if (this.hasUid(name)) return true;
|
||||
if (!noGlobals && (0, _includes().default)(Scope.globals, name)) return true;
|
||||
if (!noGlobals && (0, _includes().default)(Scope.contextVariables, name)) return true;
|
||||
if (!noGlobals && Scope.globals.includes(name)) return true;
|
||||
if (!noGlobals && Scope.contextVariables.includes(name)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
parentHasBinding(name, noGlobals) {
|
||||
return this.parent && this.parent.hasBinding(name, noGlobals);
|
||||
var _this$parent;
|
||||
|
||||
return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, noGlobals);
|
||||
}
|
||||
|
||||
moveBindingTo(name, scope) {
|
||||
@@ -870,12 +935,9 @@ class Scope {
|
||||
}
|
||||
|
||||
removeBinding(name) {
|
||||
const info = this.getBinding(name);
|
||||
|
||||
if (info) {
|
||||
info.scope.removeOwnBinding(name);
|
||||
}
|
||||
var _this$getBinding2;
|
||||
|
||||
(_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.scope.removeOwnBinding(name);
|
||||
let scope = this;
|
||||
|
||||
do {
|
||||
@@ -888,5 +950,5 @@ class Scope {
|
||||
}
|
||||
|
||||
exports.default = Scope;
|
||||
Scope.globals = Object.keys(_globals().default.builtin);
|
||||
Scope.globals = Object.keys(_globals.default.builtin);
|
||||
Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
|
||||
37
node_modules/@babel/traverse/lib/scope/lib/renamer.js
generated
vendored
37
node_modules/@babel/traverse/lib/scope/lib/renamer.js
generated
vendored
@@ -7,27 +7,13 @@ exports.default = void 0;
|
||||
|
||||
var _binding = _interopRequireDefault(require("../binding"));
|
||||
|
||||
function _helperSplitExportDeclaration() {
|
||||
const data = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
|
||||
var _helperSplitExportDeclaration = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
|
||||
|
||||
_helperSplitExportDeclaration = function () {
|
||||
return data;
|
||||
};
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
return data;
|
||||
}
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -46,7 +32,8 @@ const renameVisitor = {
|
||||
}
|
||||
},
|
||||
|
||||
"AssignmentExpression|Declaration"(path, state) {
|
||||
"AssignmentExpression|Declaration|VariableDeclarator"(path, state) {
|
||||
if (path.isVariableDeclaration()) return;
|
||||
const ids = path.getOuterBindingIdentifiers();
|
||||
|
||||
for (const name in ids) {
|
||||
@@ -74,27 +61,27 @@ class Renamer {
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _helperSplitExportDeclaration().default)(maybeExportDeclar);
|
||||
(0, _helperSplitExportDeclaration.default)(maybeExportDeclar);
|
||||
}
|
||||
|
||||
maybeConvertFromClassFunctionDeclaration(path) {
|
||||
return;
|
||||
if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
|
||||
if (this.binding.kind !== "hoisted") return;
|
||||
path.node.id = t().identifier(this.oldName);
|
||||
path.node.id = t.identifier(this.oldName);
|
||||
path.node._blockHoist = 3;
|
||||
path.replaceWith(t().variableDeclaration("let", [t().variableDeclarator(t().identifier(this.newName), t().toExpression(path.node))]));
|
||||
path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))]));
|
||||
}
|
||||
|
||||
maybeConvertFromClassFunctionExpression(path) {
|
||||
return;
|
||||
if (!path.isFunctionExpression() && !path.isClassExpression()) return;
|
||||
if (this.binding.kind !== "local") return;
|
||||
path.node.id = t().identifier(this.oldName);
|
||||
path.node.id = t.identifier(this.oldName);
|
||||
this.binding.scope.parent.push({
|
||||
id: t().identifier(this.newName)
|
||||
id: t.identifier(this.newName)
|
||||
});
|
||||
path.replaceWith(t().assignmentExpression("=", t().identifier(this.newName), path.node));
|
||||
path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node));
|
||||
}
|
||||
|
||||
rename(block) {
|
||||
|
||||
38
node_modules/@babel/traverse/lib/visitors.js
generated
vendored
38
node_modules/@babel/traverse/lib/visitors.js
generated
vendored
@@ -9,29 +9,11 @@ exports.merge = merge;
|
||||
|
||||
var virtualTypes = _interopRequireWildcard(require("./path/lib/virtual-types"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _clone() {
|
||||
const data = _interopRequireDefault(require("lodash/clone"));
|
||||
|
||||
_clone = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function explode(visitor) {
|
||||
if (visitor._exploded) return visitor;
|
||||
@@ -82,8 +64,8 @@ function explode(visitor) {
|
||||
for (const nodeType of Object.keys(visitor)) {
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
const fns = visitor[nodeType];
|
||||
let aliases = t().FLIPPED_ALIAS_KEYS[nodeType];
|
||||
const deprecratedKey = t().DEPRECATED_KEYS[nodeType];
|
||||
let aliases = t.FLIPPED_ALIAS_KEYS[nodeType];
|
||||
const deprecratedKey = t.DEPRECATED_KEYS[nodeType];
|
||||
|
||||
if (deprecratedKey) {
|
||||
console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecratedKey}`);
|
||||
@@ -99,7 +81,7 @@ function explode(visitor) {
|
||||
if (existing) {
|
||||
mergePair(existing, fns);
|
||||
} else {
|
||||
visitor[alias] = (0, _clone().default)(fns);
|
||||
visitor[alias] = Object.assign({}, fns);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +108,7 @@ function verify(visitor) {
|
||||
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
|
||||
if (t().TYPES.indexOf(nodeType) < 0) {
|
||||
if (t.TYPES.indexOf(nodeType) < 0) {
|
||||
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type`);
|
||||
}
|
||||
|
||||
@@ -198,6 +180,10 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
|
||||
newFn = wrapper(state.key, key, newFn);
|
||||
}
|
||||
|
||||
if (newFn !== fn) {
|
||||
newFn.toString = () => fn.toString();
|
||||
}
|
||||
|
||||
return newFn;
|
||||
});
|
||||
newVisitor[key] = fns;
|
||||
@@ -240,7 +226,7 @@ function shouldIgnoreKey(key) {
|
||||
if (key[0] === "_") return true;
|
||||
if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
|
||||
|
||||
if (key === "blacklist" || key === "noScope" || key === "skipKeys") {
|
||||
if (key === "denylist" || key === "noScope" || key === "skipKeys" || key === "blacklist") {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
24
node_modules/@babel/traverse/node_modules/debug/package.json
generated
vendored
24
node_modules/@babel/traverse/node_modules/debug/package.json
generated
vendored
@@ -1,33 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"debug@4.1.1",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "debug@4.1.1",
|
||||
"_from": "debug@^4.1.0",
|
||||
"_id": "debug@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"_location": "/@babel/traverse/debug",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "debug@4.1.1",
|
||||
"raw": "debug@^4.1.0",
|
||||
"name": "debug",
|
||||
"escapedName": "debug",
|
||||
"rawSpec": "4.1.1",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.1.1"
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/traverse"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"_spec": "4.1.1",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_shasum": "3b72260255109c6b589cee050f1d516139664791",
|
||||
"_spec": "debug@^4.1.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/traverse",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
@@ -36,6 +30,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
@@ -50,6 +45,7 @@
|
||||
"dependencies": {
|
||||
"ms": "^2.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
|
||||
24
node_modules/@babel/traverse/node_modules/ms/package.json
generated
vendored
24
node_modules/@babel/traverse/node_modules/ms/package.json
generated
vendored
@@ -1,36 +1,32 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"ms@2.1.2",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "ms@2.1.2",
|
||||
"_from": "ms@^2.1.1",
|
||||
"_id": "ms@2.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"_location": "/@babel/traverse/ms",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ms@2.1.2",
|
||||
"raw": "ms@^2.1.1",
|
||||
"name": "ms",
|
||||
"escapedName": "ms",
|
||||
"rawSpec": "2.1.2",
|
||||
"rawSpec": "^2.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.1.2"
|
||||
"fetchSpec": "^2.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/traverse/debug"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"_spec": "2.1.2",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009",
|
||||
"_spec": "ms@^2.1.1",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/traverse/node_modules/debug",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeit/ms/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
|
||||
57
node_modules/@babel/traverse/package.json
generated
vendored
57
node_modules/@babel/traverse/package.json
generated
vendored
@@ -1,58 +1,58 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/traverse@7.5.5",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/traverse@7.5.5",
|
||||
"_id": "@babel/traverse@7.5.5",
|
||||
"_from": "@babel/traverse@^7.11.5",
|
||||
"_id": "@babel/traverse@7.11.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ==",
|
||||
"_integrity": "sha512-EjiPXt+r7LiCZXEfRpSJd+jUMnBd4/9OUv7Nx3+0u9+eimMwJmG0Q98lw4/289JCoxSE8OolDMNZaaF/JZ69WQ==",
|
||||
"_location": "/@babel/traverse",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/traverse@7.5.5",
|
||||
"raw": "@babel/traverse@^7.11.5",
|
||||
"name": "@babel/traverse",
|
||||
"escapedName": "@babel%2ftraverse",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.5.5",
|
||||
"rawSpec": "^7.11.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.5.5"
|
||||
"fetchSpec": "^7.11.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core",
|
||||
"/@babel/helper-replace-supers",
|
||||
"/@babel/helpers",
|
||||
"/istanbul-lib-instrument",
|
||||
"/jest-circus",
|
||||
"/jest-jasmine2"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.5.5.tgz",
|
||||
"_spec": "7.5.5",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.5.tgz",
|
||||
"_shasum": "be777b93b518eb6d76ee2e1ea1d143daa11e61c3",
|
||||
"_spec": "@babel/traverse@^7.11.5",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/generator": "^7.5.5",
|
||||
"@babel/helper-function-name": "^7.1.0",
|
||||
"@babel/helper-split-export-declaration": "^7.4.4",
|
||||
"@babel/parser": "^7.5.5",
|
||||
"@babel/types": "^7.5.5",
|
||||
"@babel/code-frame": "^7.10.4",
|
||||
"@babel/generator": "^7.11.5",
|
||||
"@babel/helper-function-name": "^7.10.4",
|
||||
"@babel/helper-split-export-declaration": "^7.11.0",
|
||||
"@babel/parser": "^7.11.5",
|
||||
"@babel/types": "^7.11.5",
|
||||
"debug": "^4.1.0",
|
||||
"globals": "^11.1.0",
|
||||
"lodash": "^4.17.13"
|
||||
"lodash": "^4.17.19"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
||||
"devDependencies": {
|
||||
"@babel/helper-plugin-test-runner": "^7.0.0"
|
||||
"@babel/helper-plugin-test-runner": "^7.10.4"
|
||||
},
|
||||
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
||||
"gitHead": "af64ccb2b00bc7574943674996c2f0507cdbfb6f",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@@ -62,7 +62,8 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-traverse"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-traverse"
|
||||
},
|
||||
"version": "7.5.5"
|
||||
"version": "7.11.5"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user