Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -25,9 +25,9 @@ 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);
}
}

View File

@@ -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;
@@ -69,9 +69,11 @@ function _call(fns) {
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() {
@@ -79,7 +81,7 @@ function visit() {
return false;
}
if (this.isBlacklisted()) {
if (this.isDenylisted()) {
return false;
}
@@ -221,9 +223,11 @@ function setup(parentPath, container, listKey, 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) {

View File

@@ -127,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");

View File

@@ -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;

View File

@@ -41,27 +41,43 @@ function addCompletionRecords(path, paths) {
return paths;
}
function findBreak(statements) {
let breakStatement;
if (!Array.isArray(statements)) {
statements = [statements];
}
for (const statement of statements) {
if (statement.isDoExpression() || statement.isProgram() || statement.isBlockStatement() || statement.isCatchClause() || statement.isLabeledStatement()) {
breakStatement = findBreak(statement.get("body"));
} else if (statement.isIfStatement()) {
var _findBreak;
breakStatement = (_findBreak = findBreak(statement.get("consequent"))) != null ? _findBreak : findBreak(statement.get("alternate"));
} else if (statement.isTryStatement()) {
var _findBreak2;
breakStatement = (_findBreak2 = findBreak(statement.get("block"))) != null ? _findBreak2 : findBreak(statement.get("handler"));
} else if (statement.isBreakStatement()) {
breakStatement = statement;
}
if (breakStatement) {
return breakStatement;
}
}
return null;
}
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;
}
}
let breakStatement = findBreak(consequent);
if (breakStatement) {
while (breakStatement.key === 0 && breakStatement.parentPath.isBlockStatement()) {

View File

@@ -57,22 +57,22 @@ exports.SHOULD_SKIP = SHOULD_SKIP;
class NodePath {
constructor(hub, parent) {
this.parent = parent;
this.hub = hub;
this.contexts = [];
this.data = null;
this._traverseFlags = 0;
this.state = null;
this.opts = null;
this._traverseFlags = 0;
this.skipKeys = null;
this.parentPath = null;
this.context = null;
this.container = null;
this.listKey = null;
this.key = null;
this.node = null;
this.scope = null;
this.type = null;
this.parent = parent;
this.hub = hub;
this.data = null;
this.context = null;
this.scope = null;
}
static get({

View File

@@ -26,6 +26,8 @@ function getTypeAnnotation() {
}
function _getTypeAnnotation() {
var _inferer;
const node = this.node;
if (!node) {
@@ -59,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();
}
}

View File

@@ -50,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) {
@@ -165,6 +175,20 @@ 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),
ifStatement

View File

@@ -44,12 +44,14 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
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)) {
@@ -112,11 +114,31 @@ function BinaryExpression(node) {
}
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() {

View File

@@ -24,16 +24,12 @@ exports.isConstantExpression = isConstantExpression;
exports.isInStrictMode = isInStrictMode;
exports.is = void 0;
var _includes = _interopRequireDefault(require("lodash/includes"));
var t = _interopRequireWildcard(require("@babel/types"));
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 matchesPattern(pattern, allowPartial) {
return t.matchesPattern(this.node, pattern, allowPartial);
}
@@ -110,7 +106,7 @@ function isStatementOrBlock() {
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);
}
}

View File

@@ -15,11 +15,15 @@ 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();

View File

@@ -172,7 +172,7 @@ function _replaceWith(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;
}
@@ -185,7 +185,7 @@ function replaceExpressionWithStatements(nodes) {
}
const functionParent = this.getFunctionParent();
const isParentAsync = functionParent && functionParent.is("async");
const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
const container = t.arrowFunctionExpression([], t.blockStatement(nodes));
this.replaceWith(t.callExpression(container, []));
this.traverse(hoistVariablesVisitor);