v3 new release (#84)

swap to graphql
This commit is contained in:
github-actions[bot]
2022-07-11 13:48:02 -04:00
committed by GitHub
parent 20d2b4f98d
commit e4f3964f67
1492 changed files with 63799 additions and 63001 deletions

View File

@ -63,7 +63,7 @@ const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
function DirectiveLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
if (!this.format.minified && raw !== undefined) {
this.token(raw);
return;
}

View File

@ -3,6 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ClassAccessorProperty = ClassAccessorProperty;
exports.ClassBody = ClassBody;
exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration;
exports.ClassMethod = ClassMethod;
@ -20,8 +21,10 @@ const {
} = _t;
function ClassDeclaration(node, parent) {
if (!this.format.decoratorsBeforeExport || !isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) {
this.printJoin(node.decorators, node);
{
if (!this.format.decoratorsBeforeExport || !isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) {
this.printJoin(node.decorators, node);
}
}
if (node.declare) {
@ -82,7 +85,45 @@ function ClassBody(node) {
function ClassProperty(node) {
this.printJoin(node.decorators, node);
this.source("end", node.key.loc);
this.tsPrintClassMemberModifiers(node, true);
this.tsPrintClassMemberModifiers(node);
if (node.computed) {
this.token("[");
this.print(node.key, node);
this.token("]");
} else {
this._variance(node);
this.print(node.key, node);
}
if (node.optional) {
this.token("?");
}
if (node.definite) {
this.token("!");
}
this.print(node.typeAnnotation, node);
if (node.value) {
this.space();
this.token("=");
this.space();
this.print(node.value, node);
}
this.semicolon();
}
function ClassAccessorProperty(node) {
this.printJoin(node.decorators, node);
this.source("end", node.key.loc);
this.tsPrintClassMemberModifiers(node);
this.word("accessor");
this.printInnerComments(node);
this.space();
if (node.computed) {
this.token("[");
@ -152,7 +193,7 @@ function ClassPrivateMethod(node) {
function _classMethodHead(node) {
this.printJoin(node.decorators, node);
this.source("end", node.key.loc);
this.tsPrintClassMemberModifiers(node, false);
this.tsPrintClassMemberModifiers(node);
this._methodHead(node);
}

View File

@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression;
exports.AssignmentPattern = AssignmentPattern;
exports.AwaitExpression = void 0;
exports.AwaitExpression = AwaitExpression;
exports.BindExpression = BindExpression;
exports.CallExpression = CallExpression;
exports.ConditionalExpression = ConditionalExpression;
@ -28,7 +28,7 @@ exports.ThisExpression = ThisExpression;
exports.UnaryExpression = UnaryExpression;
exports.UpdateExpression = UpdateExpression;
exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier;
exports.YieldExpression = void 0;
exports.YieldExpression = YieldExpression;
var _t = require("@babel/types");
@ -74,9 +74,7 @@ function UpdateExpression(node) {
this.token(node.operator);
this.print(node.argument, node);
} else {
this.startTerminatorless(true);
this.print(node.argument, node);
this.endTerminatorless();
this.printTerminatorless(node.argument, node, true);
this.token(node.operator);
}
}
@ -128,9 +126,45 @@ function Super() {
this.word("super");
}
function isDecoratorMemberExpression(node) {
switch (node.type) {
case "Identifier":
return true;
case "MemberExpression":
return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object);
default:
return false;
}
}
function shouldParenthesizeDecoratorExpression(node) {
if (node.type === "CallExpression") {
node = node.callee;
}
if (node.type === "ParenthesizedExpression") {
return false;
}
return !isDecoratorMemberExpression(node);
}
function Decorator(node) {
this.token("@");
this.print(node.expression, node);
const {
expression
} = node;
if (shouldParenthesizeDecoratorExpression(expression)) {
this.token("(");
this.print(expression, node);
this.token(")");
} else {
this.print(expression, node);
}
this.newline();
}
@ -191,27 +225,27 @@ function Import() {
this.word("import");
}
function buildYieldAwait(keyword) {
return function (node) {
this.word(keyword);
function AwaitExpression(node) {
this.word("await");
if (node.delegate) {
this.token("*");
}
if (node.argument) {
this.space();
const terminatorState = this.startTerminatorless();
this.print(node.argument, node);
this.endTerminatorless(terminatorState);
}
};
if (node.argument) {
this.space();
this.printTerminatorless(node.argument, node, false);
}
}
const YieldExpression = buildYieldAwait("yield");
exports.YieldExpression = YieldExpression;
const AwaitExpression = buildYieldAwait("await");
exports.AwaitExpression = AwaitExpression;
function YieldExpression(node) {
this.word("yield");
if (node.delegate) {
this.token("*");
}
if (node.argument) {
this.space();
this.printTerminatorless(node.argument, node, false);
}
}
function EmptyStatement() {
this.semicolon(true);

View File

@ -219,14 +219,14 @@ function DeclareExportDeclaration(node) {
this.space();
}
FlowExportDeclaration.apply(this, arguments);
FlowExportDeclaration.call(this, node);
}
function DeclareExportAllDeclaration() {
function DeclareExportAllDeclaration(node) {
this.word("declare");
this.space();
_modules.ExportAllDeclaration.apply(this, arguments);
_modules.ExportAllDeclaration.call(this, node);
}
function EnumDeclaration(node) {

View File

@ -67,7 +67,7 @@ function JSXSpreadChild(node) {
function JSXText(node) {
const raw = this.getPossibleRaw(node);
if (raw != null) {
if (raw !== undefined) {
this.token(raw);
} else {
this.token(node.value);

View File

@ -42,7 +42,11 @@ function _parameters(parameters, parent) {
function _param(parameter, parent) {
this.printJoin(parameter.decorators, parameter);
this.print(parameter, parent);
if (parameter.optional) this.token("?");
if (parameter.optional) {
this.token("?");
}
this.print(parameter.typeAnnotation, parameter);
}
@ -111,7 +115,9 @@ function _functionHead(node) {
this._params(node);
this._predicate(node);
if (node.type !== "TSDeclareFunction") {
this._predicate(node);
}
}
function FunctionExpression(node) {

View File

@ -93,28 +93,14 @@ function ExportAllDeclaration(node) {
}
function ExportNamedDeclaration(node) {
if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);
{
if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);
}
}
this.word("export");
this.space();
ExportDeclaration.apply(this, arguments);
}
function ExportDefaultDeclaration(node) {
if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);
}
this.word("export");
this.space();
this.word("default");
this.space();
ExportDeclaration.apply(this, arguments);
}
function ExportDeclaration(node) {
if (node.declaration) {
const declar = node.declaration;
this.print(declar, node);
@ -168,41 +154,61 @@ function ExportDeclaration(node) {
}
}
function ExportDefaultDeclaration(node) {
{
if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);
}
}
this.word("export");
this.space();
this.word("default");
this.space();
const declar = node.declaration;
this.print(declar, node);
if (!isStatement(declar)) this.semicolon();
}
function ImportDeclaration(node) {
this.word("import");
this.space();
const isTypeKind = node.importKind === "type" || node.importKind === "typeof";
if (node.importKind === "type" || node.importKind === "typeof") {
if (isTypeKind) {
this.word(node.importKind);
this.space();
}
const specifiers = node.specifiers.slice(0);
const hasSpecifiers = !!specifiers.length;
if (specifiers != null && specifiers.length) {
for (;;) {
const first = specifiers[0];
while (hasSpecifiers) {
const first = specifiers[0];
if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {
this.print(specifiers.shift(), node);
if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {
this.print(specifiers.shift(), node);
if (specifiers.length) {
this.token(",");
this.space();
}
} else {
break;
if (specifiers.length) {
this.token(",");
this.space();
}
} else {
break;
}
}
if (specifiers.length) {
this.token("{");
this.space();
this.printList(specifiers, node);
this.space();
this.token("}");
}
if (specifiers.length) {
this.token("{");
this.space();
this.printList(specifiers, node);
this.space();
this.token("}");
} else if (isTypeKind && !hasSpecifiers) {
this.token("{");
this.token("}");
}
if (hasSpecifiers || isTypeKind) {
this.space();
this.word("from");
this.space();

View File

@ -3,19 +3,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BreakStatement = void 0;
exports.BreakStatement = BreakStatement;
exports.CatchClause = CatchClause;
exports.ContinueStatement = void 0;
exports.ContinueStatement = ContinueStatement;
exports.DebuggerStatement = DebuggerStatement;
exports.DoWhileStatement = DoWhileStatement;
exports.ForOfStatement = exports.ForInStatement = void 0;
exports.ForStatement = ForStatement;
exports.IfStatement = IfStatement;
exports.LabeledStatement = LabeledStatement;
exports.ReturnStatement = void 0;
exports.ReturnStatement = ReturnStatement;
exports.SwitchCase = SwitchCase;
exports.SwitchStatement = SwitchStatement;
exports.ThrowStatement = void 0;
exports.ThrowStatement = ThrowStatement;
exports.TryStatement = TryStatement;
exports.VariableDeclaration = VariableDeclaration;
exports.VariableDeclarator = VariableDeclarator;
@ -72,8 +72,15 @@ function IfStatement(node) {
}
function getLastStatement(statement) {
if (!isStatement(statement.body)) return statement;
return getLastStatement(statement.body);
const {
body
} = statement;
if (isStatement(body) === false) {
return statement;
}
return getLastStatement(body);
}
function ForStatement(node) {
@ -110,30 +117,29 @@ function WhileStatement(node) {
this.printBlock(node);
}
const buildForXStatement = function (op) {
return function (node) {
this.word("for");
this.space();
function ForXStatement(node) {
this.word("for");
this.space();
const isForOf = node.type === "ForOfStatement";
if (op === "of" && node.await) {
this.word("await");
this.space();
}
this.token("(");
this.print(node.left, node);
if (isForOf && node.await) {
this.word("await");
this.space();
this.word(op);
this.space();
this.print(node.right, node);
this.token(")");
this.printBlock(node);
};
};
}
const ForInStatement = buildForXStatement("in");
this.token("(");
this.print(node.left, node);
this.space();
this.word(isForOf ? "of" : "in");
this.space();
this.print(node.right, node);
this.token(")");
this.printBlock(node);
}
const ForInStatement = ForXStatement;
exports.ForInStatement = ForInStatement;
const ForOfStatement = buildForXStatement("of");
const ForOfStatement = ForXStatement;
exports.ForOfStatement = ForOfStatement;
function DoWhileStatement(node) {
@ -149,31 +155,34 @@ function DoWhileStatement(node) {
this.semicolon();
}
function buildLabelStatement(prefix, key = "label") {
return function (node) {
this.word(prefix);
const label = node[key];
function printStatementAfterKeyword(printer, node, parent, isLabel) {
if (node) {
printer.space();
printer.printTerminatorless(node, parent, isLabel);
}
if (label) {
this.space();
const isLabel = key == "label";
const terminatorState = this.startTerminatorless(isLabel);
this.print(label, node);
this.endTerminatorless(terminatorState);
}
this.semicolon();
};
printer.semicolon();
}
const ContinueStatement = buildLabelStatement("continue");
exports.ContinueStatement = ContinueStatement;
const ReturnStatement = buildLabelStatement("return", "argument");
exports.ReturnStatement = ReturnStatement;
const BreakStatement = buildLabelStatement("break");
exports.BreakStatement = BreakStatement;
const ThrowStatement = buildLabelStatement("throw", "argument");
exports.ThrowStatement = ThrowStatement;
function BreakStatement(node) {
this.word("break");
printStatementAfterKeyword(this, node.label, node, true);
}
function ContinueStatement(node) {
this.word("continue");
printStatementAfterKeyword(this, node.label, node, true);
}
function ReturnStatement(node) {
this.word("return");
printStatementAfterKeyword(this, node.argument, node, false);
}
function ThrowStatement(node) {
this.word("throw");
printStatementAfterKeyword(this, node.argument, node, false);
}
function LabeledStatement(node) {
this.print(node.label, node);

View File

@ -213,7 +213,7 @@ function NumericLiteral(node) {
function StringLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
if (!this.format.minified && raw !== undefined) {
this.token(raw);
return;
}
@ -228,7 +228,7 @@ function StringLiteral(node) {
function BigIntLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
if (!this.format.minified && raw !== undefined) {
this.word(raw);
return;
}
@ -239,7 +239,7 @@ function BigIntLiteral(node) {
function DecimalLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
if (!this.format.minified && raw !== undefined) {
this.word(raw);
return;
}
@ -247,7 +247,7 @@ function DecimalLiteral(node) {
this.word(node.value + "m");
}
const validTopicTokenSet = new Set(["^", "%", "#"]);
const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]);
function TopicReference() {
const {

View File

@ -25,6 +25,7 @@ exports.TSImportType = TSImportType;
exports.TSIndexSignature = TSIndexSignature;
exports.TSIndexedAccessType = TSIndexedAccessType;
exports.TSInferType = TSInferType;
exports.TSInstantiationExpression = TSInstantiationExpression;
exports.TSInterfaceBody = TSInterfaceBody;
exports.TSInterfaceDeclaration = TSInterfaceDeclaration;
exports.TSIntersectionType = TSIntersectionType;
@ -65,13 +66,11 @@ exports.TSUndefinedKeyword = TSUndefinedKeyword;
exports.TSUnionType = TSUnionType;
exports.TSUnknownKeyword = TSUnknownKeyword;
exports.TSVoidKeyword = TSVoidKeyword;
exports.tsPrintBraced = tsPrintBraced;
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType;
exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody;
exports.tsPrintUnionOrIntersectionType = tsPrintUnionOrIntersectionType;
function TSTypeAnnotation(node) {
this.token(":");
@ -92,6 +91,16 @@ function TSTypeParameterInstantiation(node, parent) {
}
function TSTypeParameter(node) {
if (node.in) {
this.word("in");
this.space();
}
if (node.out) {
this.word("out");
this.space();
}
this.word(node.name);
if (node.constraint) {
@ -352,6 +361,10 @@ function TSTypeQuery(node) {
this.word("typeof");
this.space();
this.print(node.exprName);
if (node.typeParameters) {
this.print(node.typeParameters, node);
}
}
function TSTypeLiteral(node) {
@ -359,25 +372,25 @@ function TSTypeLiteral(node) {
}
function tsPrintTypeLiteralOrInterfaceBody(members, node) {
this.tsPrintBraced(members, node);
tsPrintBraced(this, members, node);
}
function tsPrintBraced(members, node) {
this.token("{");
function tsPrintBraced(printer, members, node) {
printer.token("{");
if (members.length) {
this.indent();
this.newline();
printer.indent();
printer.newline();
for (const member of members) {
this.print(member, node);
this.newline();
printer.print(member, node);
printer.newline();
}
this.dedent();
this.rightBrace();
printer.dedent();
printer.rightBrace();
} else {
this.token("}");
printer.token("}");
}
}
@ -411,15 +424,15 @@ function TSNamedTupleMember(node) {
}
function TSUnionType(node) {
this.tsPrintUnionOrIntersectionType(node, "|");
tsPrintUnionOrIntersectionType(this, node, "|");
}
function TSIntersectionType(node) {
this.tsPrintUnionOrIntersectionType(node, "&");
tsPrintUnionOrIntersectionType(this, node, "&");
}
function tsPrintUnionOrIntersectionType(node, sep) {
this.printJoin(node.types, node, {
function tsPrintUnionOrIntersectionType(printer, node, sep) {
printer.printJoin(node.types, node, {
separator() {
this.space();
this.token(sep);
@ -611,6 +624,11 @@ function TSTypeAssertion(node) {
this.print(expression, node);
}
function TSInstantiationExpression(node) {
this.print(node.expression, node);
this.print(node.typeParameters, node);
}
function TSEnumDeclaration(node) {
const {
declare,
@ -633,7 +651,7 @@ function TSEnumDeclaration(node) {
this.space();
this.print(id, node);
this.space();
this.tsPrintBraced(members, node);
tsPrintBraced(this, members, node);
}
function TSEnumMember(node) {
@ -689,7 +707,7 @@ function TSModuleDeclaration(node) {
}
function TSModuleBlock(node) {
this.tsPrintBraced(node.body, node);
tsPrintBraced(this, node.body, node);
}
function TSImportType(node) {
@ -780,7 +798,9 @@ function tsPrintSignatureDeclarationBase(node) {
this.print(returnType, node);
}
function tsPrintClassMemberModifiers(node, isField) {
function tsPrintClassMemberModifiers(node) {
const isField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty";
if (isField && node.declare) {
this.word("declare");
this.space();