mirror of
https://github.com/actions/labeler.git
synced 2025-12-13 13:07:24 +00:00
build
This commit is contained in:
118
node_modules/@babel/generator/lib/node/parentheses.js
generated
vendored
118
node_modules/@babel/generator/lib/node/parentheses.js
generated
vendored
@@ -13,6 +13,7 @@ exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnno
|
||||
exports.TSAsExpression = TSAsExpression;
|
||||
exports.TSTypeAssertion = TSTypeAssertion;
|
||||
exports.TSIntersectionType = exports.TSUnionType = TSUnionType;
|
||||
exports.TSInferType = TSInferType;
|
||||
exports.BinaryExpression = BinaryExpression;
|
||||
exports.SequenceExpression = SequenceExpression;
|
||||
exports.AwaitExpression = exports.YieldExpression = YieldExpression;
|
||||
@@ -21,24 +22,19 @@ exports.UnaryLike = UnaryLike;
|
||||
exports.FunctionExpression = FunctionExpression;
|
||||
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
||||
exports.ConditionalExpression = ConditionalExpression;
|
||||
exports.OptionalMemberExpression = OptionalMemberExpression;
|
||||
exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
|
||||
exports.AssignmentExpression = AssignmentExpression;
|
||||
exports.NewExpression = NewExpression;
|
||||
exports.LogicalExpression = LogicalExpression;
|
||||
|
||||
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 PRECEDENCE = {
|
||||
"||": 0,
|
||||
"??": 0,
|
||||
"&&": 1,
|
||||
"|": 2,
|
||||
"^": 3,
|
||||
@@ -64,24 +60,20 @@ const PRECEDENCE = {
|
||||
"**": 10
|
||||
};
|
||||
|
||||
const isClassExtendsClause = (node, parent) => (t().isClassDeclaration(parent) || t().isClassExpression(parent)) && parent.superClass === node;
|
||||
const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;
|
||||
|
||||
const hasPostfixPart = (node, parent) => (t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && parent.object === node || (t.isCallExpression(parent) || t.isOptionalCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isTaggedTemplateExpression(parent) && parent.tag === node || t.isTSNonNullExpression(parent);
|
||||
|
||||
function NullableTypeAnnotation(node, parent) {
|
||||
return t().isArrayTypeAnnotation(parent);
|
||||
return t.isArrayTypeAnnotation(parent);
|
||||
}
|
||||
|
||||
function FunctionTypeAnnotation(node, parent) {
|
||||
return t().isUnionTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isArrayTypeAnnotation(parent);
|
||||
function FunctionTypeAnnotation(node, parent, printStack) {
|
||||
return t.isUnionTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isArrayTypeAnnotation(parent) || t.isTypeAnnotation(parent) && t.isArrowFunctionExpression(printStack[printStack.length - 3]);
|
||||
}
|
||||
|
||||
function UpdateExpression(node, parent) {
|
||||
return t().isMemberExpression(parent, {
|
||||
object: node
|
||||
}) || t().isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isNewExpression(parent, {
|
||||
callee: node
|
||||
}) || isClassExtendsClause(node, parent);
|
||||
return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);
|
||||
}
|
||||
|
||||
function ObjectExpression(node, parent, printStack) {
|
||||
@@ -95,7 +87,7 @@ function DoExpression(node, parent, printStack) {
|
||||
}
|
||||
|
||||
function Binary(node, parent) {
|
||||
if (node.operator === "**" && t().isBinaryExpression(parent, {
|
||||
if (node.operator === "**" && t.isBinaryExpression(parent, {
|
||||
operator: "**"
|
||||
})) {
|
||||
return parent.left === node;
|
||||
@@ -105,26 +97,24 @@ function Binary(node, parent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((t().isCallExpression(parent) || t().isNewExpression(parent)) && parent.callee === node || t().isUnaryLike(parent) || t().isMemberExpression(parent) && parent.object === node || t().isAwaitExpression(parent)) {
|
||||
if (hasPostfixPart(node, parent) || t.isUnaryLike(parent) || t.isAwaitExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t().isBinary(parent)) {
|
||||
if (t.isBinary(parent)) {
|
||||
const parentOp = parent.operator;
|
||||
const parentPos = PRECEDENCE[parentOp];
|
||||
const nodeOp = node.operator;
|
||||
const nodePos = PRECEDENCE[nodeOp];
|
||||
|
||||
if (parentPos === nodePos && parent.right === node && !t().isLogicalExpression(parent) || parentPos > nodePos) {
|
||||
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function UnionTypeAnnotation(node, parent) {
|
||||
return t().isArrayTypeAnnotation(parent) || t().isNullableTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isUnionTypeAnnotation(parent);
|
||||
return t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent);
|
||||
}
|
||||
|
||||
function TSAsExpression() {
|
||||
@@ -136,15 +126,19 @@ function TSTypeAssertion() {
|
||||
}
|
||||
|
||||
function TSUnionType(node, parent) {
|
||||
return t().isTSArrayType(parent) || t().isTSOptionalType(parent) || t().isTSIntersectionType(parent) || t().isTSUnionType(parent) || t().isTSRestType(parent);
|
||||
return t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent);
|
||||
}
|
||||
|
||||
function TSInferType(node, parent) {
|
||||
return t.isTSArrayType(parent) || t.isTSOptionalType(parent);
|
||||
}
|
||||
|
||||
function BinaryExpression(node, parent) {
|
||||
return node.operator === "in" && (t().isVariableDeclarator(parent) || t().isFor(parent));
|
||||
return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
|
||||
}
|
||||
|
||||
function SequenceExpression(node, parent) {
|
||||
if (t().isForStatement(parent) || t().isThrowStatement(parent) || t().isReturnStatement(parent) || t().isIfStatement(parent) && parent.test === node || t().isWhileStatement(parent) && parent.test === node || t().isForInStatement(parent) && parent.right === node || t().isSwitchStatement(parent) && parent.discriminant === node || t().isExpressionStatement(parent) && parent.expression === node) {
|
||||
if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -152,7 +146,7 @@ function SequenceExpression(node, parent) {
|
||||
}
|
||||
|
||||
function YieldExpression(node, parent) {
|
||||
return t().isBinary(parent) || t().isUnaryLike(parent) || t().isCallExpression(parent) || t().isMemberExpression(parent) || t().isNewExpression(parent) || t().isAwaitExpression(parent) && t().isYieldExpression(node) || t().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
|
||||
return t.isBinary(parent) || t.isUnaryLike(parent) || hasPostfixPart(node, parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
|
||||
}
|
||||
|
||||
function ClassExpression(node, parent, printStack) {
|
||||
@@ -162,13 +156,7 @@ function ClassExpression(node, parent, printStack) {
|
||||
}
|
||||
|
||||
function UnaryLike(node, parent) {
|
||||
return t().isMemberExpression(parent, {
|
||||
object: node
|
||||
}) || t().isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isNewExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isBinaryExpression(parent, {
|
||||
return hasPostfixPart(node, parent) || t.isBinaryExpression(parent, {
|
||||
operator: "**",
|
||||
left: node
|
||||
}) || isClassExtendsClause(node, parent);
|
||||
@@ -181,13 +169,13 @@ function FunctionExpression(node, parent, printStack) {
|
||||
}
|
||||
|
||||
function ArrowFunctionExpression(node, parent) {
|
||||
return t().isExportDeclaration(parent) || ConditionalExpression(node, parent);
|
||||
return t.isExportDeclaration(parent) || ConditionalExpression(node, parent);
|
||||
}
|
||||
|
||||
function ConditionalExpression(node, parent) {
|
||||
if (t().isUnaryLike(parent) || t().isBinary(parent) || t().isConditionalExpression(parent, {
|
||||
if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, {
|
||||
test: node
|
||||
}) || t().isAwaitExpression(parent) || t().isOptionalMemberExpression(parent) || t().isTaggedTemplateExpression(parent) || t().isTSTypeAssertion(parent) || t().isTSAsExpression(parent)) {
|
||||
}) || t.isAwaitExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -195,19 +183,35 @@ function ConditionalExpression(node, parent) {
|
||||
}
|
||||
|
||||
function OptionalMemberExpression(node, parent) {
|
||||
return t().isCallExpression(parent) || t().isMemberExpression(parent);
|
||||
return t.isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t.isMemberExpression(parent, {
|
||||
object: node
|
||||
});
|
||||
}
|
||||
|
||||
function AssignmentExpression(node) {
|
||||
if (t().isObjectPattern(node.left)) {
|
||||
function AssignmentExpression(node, parent, printStack) {
|
||||
if (t.isObjectPattern(node.left)) {
|
||||
return true;
|
||||
} else {
|
||||
return ConditionalExpression(...arguments);
|
||||
return ConditionalExpression(node, parent, printStack);
|
||||
}
|
||||
}
|
||||
|
||||
function NewExpression(node, parent) {
|
||||
return isClassExtendsClause(node, parent);
|
||||
function LogicalExpression(node, parent) {
|
||||
switch (node.operator) {
|
||||
case "||":
|
||||
if (!t.isLogicalExpression(parent)) return false;
|
||||
return parent.operator === "??" || parent.operator === "&&";
|
||||
|
||||
case "&&":
|
||||
return t.isLogicalExpression(parent, {
|
||||
operator: "??"
|
||||
});
|
||||
|
||||
case "??":
|
||||
return t.isLogicalExpression(parent) && parent.operator !== "??";
|
||||
}
|
||||
}
|
||||
|
||||
function isFirstInStatement(printStack, {
|
||||
@@ -220,25 +224,21 @@ function isFirstInStatement(printStack, {
|
||||
let parent = printStack[i];
|
||||
|
||||
while (i > 0) {
|
||||
if (t().isExpressionStatement(parent, {
|
||||
if (t.isExpressionStatement(parent, {
|
||||
expression: node
|
||||
}) || t().isTaggedTemplateExpression(parent) || considerDefaultExports && t().isExportDefaultDeclaration(parent, {
|
||||
}) || considerDefaultExports && t.isExportDefaultDeclaration(parent, {
|
||||
declaration: node
|
||||
}) || considerArrow && t().isArrowFunctionExpression(parent, {
|
||||
}) || considerArrow && t.isArrowFunctionExpression(parent, {
|
||||
body: node
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t().isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isSequenceExpression(parent) && parent.expressions[0] === node || t().isMemberExpression(parent, {
|
||||
object: node
|
||||
}) || t().isConditional(parent, {
|
||||
if (hasPostfixPart(node, parent) && !t.isNewExpression(parent) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isConditional(parent, {
|
||||
test: node
|
||||
}) || t().isBinary(parent, {
|
||||
}) || t.isBinary(parent, {
|
||||
left: node
|
||||
}) || t().isAssignmentExpression(parent, {
|
||||
}) || t.isAssignmentExpression(parent, {
|
||||
left: node
|
||||
})) {
|
||||
node = parent;
|
||||
|
||||
Reference in New Issue
Block a user