@babel/types
Advanced tools
Comparing version 7.17.10 to 7.17.12
@@ -258,990 +258,1941 @@ "use strict"; | ||
var _builder = require("../builder"); | ||
var _validateNode = require("../validateNode"); | ||
function arrayExpression(elements) { | ||
return _builder.default.apply("ArrayExpression", arguments); | ||
function arrayExpression(elements = []) { | ||
return (0, _validateNode.default)({ | ||
type: "ArrayExpression", | ||
elements | ||
}); | ||
} | ||
function assignmentExpression(operator, left, right) { | ||
return _builder.default.apply("AssignmentExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "AssignmentExpression", | ||
operator, | ||
left, | ||
right | ||
}); | ||
} | ||
function binaryExpression(operator, left, right) { | ||
return _builder.default.apply("BinaryExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "BinaryExpression", | ||
operator, | ||
left, | ||
right | ||
}); | ||
} | ||
function interpreterDirective(value) { | ||
return _builder.default.apply("InterpreterDirective", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "InterpreterDirective", | ||
value | ||
}); | ||
} | ||
function directive(value) { | ||
return _builder.default.apply("Directive", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "Directive", | ||
value | ||
}); | ||
} | ||
function directiveLiteral(value) { | ||
return _builder.default.apply("DirectiveLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DirectiveLiteral", | ||
value | ||
}); | ||
} | ||
function blockStatement(body, directives) { | ||
return _builder.default.apply("BlockStatement", arguments); | ||
function blockStatement(body, directives = []) { | ||
return (0, _validateNode.default)({ | ||
type: "BlockStatement", | ||
body, | ||
directives | ||
}); | ||
} | ||
function breakStatement(label) { | ||
return _builder.default.apply("BreakStatement", arguments); | ||
function breakStatement(label = null) { | ||
return (0, _validateNode.default)({ | ||
type: "BreakStatement", | ||
label | ||
}); | ||
} | ||
function callExpression(callee, _arguments) { | ||
return _builder.default.apply("CallExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "CallExpression", | ||
callee, | ||
arguments: _arguments | ||
}); | ||
} | ||
function catchClause(param, body) { | ||
return _builder.default.apply("CatchClause", arguments); | ||
function catchClause(param = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "CatchClause", | ||
param, | ||
body | ||
}); | ||
} | ||
function conditionalExpression(test, consequent, alternate) { | ||
return _builder.default.apply("ConditionalExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ConditionalExpression", | ||
test, | ||
consequent, | ||
alternate | ||
}); | ||
} | ||
function continueStatement(label) { | ||
return _builder.default.apply("ContinueStatement", arguments); | ||
function continueStatement(label = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ContinueStatement", | ||
label | ||
}); | ||
} | ||
function debuggerStatement() { | ||
return _builder.default.apply("DebuggerStatement", arguments); | ||
return { | ||
type: "DebuggerStatement" | ||
}; | ||
} | ||
function doWhileStatement(test, body) { | ||
return _builder.default.apply("DoWhileStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DoWhileStatement", | ||
test, | ||
body | ||
}); | ||
} | ||
function emptyStatement() { | ||
return _builder.default.apply("EmptyStatement", arguments); | ||
return { | ||
type: "EmptyStatement" | ||
}; | ||
} | ||
function expressionStatement(expression) { | ||
return _builder.default.apply("ExpressionStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ExpressionStatement", | ||
expression | ||
}); | ||
} | ||
function file(program, comments, tokens) { | ||
return _builder.default.apply("File", arguments); | ||
function file(program, comments = null, tokens = null) { | ||
return (0, _validateNode.default)({ | ||
type: "File", | ||
program, | ||
comments, | ||
tokens | ||
}); | ||
} | ||
function forInStatement(left, right, body) { | ||
return _builder.default.apply("ForInStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ForInStatement", | ||
left, | ||
right, | ||
body | ||
}); | ||
} | ||
function forStatement(init, test, update, body) { | ||
return _builder.default.apply("ForStatement", arguments); | ||
function forStatement(init = null, test = null, update = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "ForStatement", | ||
init, | ||
test, | ||
update, | ||
body | ||
}); | ||
} | ||
function functionDeclaration(id, params, body, generator, async) { | ||
return _builder.default.apply("FunctionDeclaration", arguments); | ||
function functionDeclaration(id = null, params, body, generator = false, async = false) { | ||
return (0, _validateNode.default)({ | ||
type: "FunctionDeclaration", | ||
id, | ||
params, | ||
body, | ||
generator, | ||
async | ||
}); | ||
} | ||
function functionExpression(id, params, body, generator, async) { | ||
return _builder.default.apply("FunctionExpression", arguments); | ||
function functionExpression(id = null, params, body, generator = false, async = false) { | ||
return (0, _validateNode.default)({ | ||
type: "FunctionExpression", | ||
id, | ||
params, | ||
body, | ||
generator, | ||
async | ||
}); | ||
} | ||
function identifier(name) { | ||
return _builder.default.apply("Identifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "Identifier", | ||
name | ||
}); | ||
} | ||
function ifStatement(test, consequent, alternate) { | ||
return _builder.default.apply("IfStatement", arguments); | ||
function ifStatement(test, consequent, alternate = null) { | ||
return (0, _validateNode.default)({ | ||
type: "IfStatement", | ||
test, | ||
consequent, | ||
alternate | ||
}); | ||
} | ||
function labeledStatement(label, body) { | ||
return _builder.default.apply("LabeledStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "LabeledStatement", | ||
label, | ||
body | ||
}); | ||
} | ||
function stringLiteral(value) { | ||
return _builder.default.apply("StringLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "StringLiteral", | ||
value | ||
}); | ||
} | ||
function numericLiteral(value) { | ||
return _builder.default.apply("NumericLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "NumericLiteral", | ||
value | ||
}); | ||
} | ||
function nullLiteral() { | ||
return _builder.default.apply("NullLiteral", arguments); | ||
return { | ||
type: "NullLiteral" | ||
}; | ||
} | ||
function booleanLiteral(value) { | ||
return _builder.default.apply("BooleanLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "BooleanLiteral", | ||
value | ||
}); | ||
} | ||
function regExpLiteral(pattern, flags) { | ||
return _builder.default.apply("RegExpLiteral", arguments); | ||
function regExpLiteral(pattern, flags = "") { | ||
return (0, _validateNode.default)({ | ||
type: "RegExpLiteral", | ||
pattern, | ||
flags | ||
}); | ||
} | ||
function logicalExpression(operator, left, right) { | ||
return _builder.default.apply("LogicalExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "LogicalExpression", | ||
operator, | ||
left, | ||
right | ||
}); | ||
} | ||
function memberExpression(object, property, computed, optional) { | ||
return _builder.default.apply("MemberExpression", arguments); | ||
function memberExpression(object, property, computed = false, optional = null) { | ||
return (0, _validateNode.default)({ | ||
type: "MemberExpression", | ||
object, | ||
property, | ||
computed, | ||
optional | ||
}); | ||
} | ||
function newExpression(callee, _arguments) { | ||
return _builder.default.apply("NewExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "NewExpression", | ||
callee, | ||
arguments: _arguments | ||
}); | ||
} | ||
function program(body, directives, sourceType, interpreter) { | ||
return _builder.default.apply("Program", arguments); | ||
function program(body, directives = [], sourceType = "script", interpreter = null) { | ||
return (0, _validateNode.default)({ | ||
type: "Program", | ||
body, | ||
directives, | ||
sourceType, | ||
interpreter, | ||
sourceFile: null | ||
}); | ||
} | ||
function objectExpression(properties) { | ||
return _builder.default.apply("ObjectExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ObjectExpression", | ||
properties | ||
}); | ||
} | ||
function objectMethod(kind, key, params, body, computed, generator, async) { | ||
return _builder.default.apply("ObjectMethod", arguments); | ||
function objectMethod(kind = "method", key, params, body, computed = false, generator = false, async = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ObjectMethod", | ||
kind, | ||
key, | ||
params, | ||
body, | ||
computed, | ||
generator, | ||
async | ||
}); | ||
} | ||
function objectProperty(key, value, computed, shorthand, decorators) { | ||
return _builder.default.apply("ObjectProperty", arguments); | ||
function objectProperty(key, value, computed = false, shorthand = false, decorators = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ObjectProperty", | ||
key, | ||
value, | ||
computed, | ||
shorthand, | ||
decorators | ||
}); | ||
} | ||
function restElement(argument) { | ||
return _builder.default.apply("RestElement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "RestElement", | ||
argument | ||
}); | ||
} | ||
function returnStatement(argument) { | ||
return _builder.default.apply("ReturnStatement", arguments); | ||
function returnStatement(argument = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ReturnStatement", | ||
argument | ||
}); | ||
} | ||
function sequenceExpression(expressions) { | ||
return _builder.default.apply("SequenceExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "SequenceExpression", | ||
expressions | ||
}); | ||
} | ||
function parenthesizedExpression(expression) { | ||
return _builder.default.apply("ParenthesizedExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ParenthesizedExpression", | ||
expression | ||
}); | ||
} | ||
function switchCase(test, consequent) { | ||
return _builder.default.apply("SwitchCase", arguments); | ||
function switchCase(test = null, consequent) { | ||
return (0, _validateNode.default)({ | ||
type: "SwitchCase", | ||
test, | ||
consequent | ||
}); | ||
} | ||
function switchStatement(discriminant, cases) { | ||
return _builder.default.apply("SwitchStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "SwitchStatement", | ||
discriminant, | ||
cases | ||
}); | ||
} | ||
function thisExpression() { | ||
return _builder.default.apply("ThisExpression", arguments); | ||
return { | ||
type: "ThisExpression" | ||
}; | ||
} | ||
function throwStatement(argument) { | ||
return _builder.default.apply("ThrowStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ThrowStatement", | ||
argument | ||
}); | ||
} | ||
function tryStatement(block, handler, finalizer) { | ||
return _builder.default.apply("TryStatement", arguments); | ||
function tryStatement(block, handler = null, finalizer = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TryStatement", | ||
block, | ||
handler, | ||
finalizer | ||
}); | ||
} | ||
function unaryExpression(operator, argument, prefix) { | ||
return _builder.default.apply("UnaryExpression", arguments); | ||
function unaryExpression(operator, argument, prefix = true) { | ||
return (0, _validateNode.default)({ | ||
type: "UnaryExpression", | ||
operator, | ||
argument, | ||
prefix | ||
}); | ||
} | ||
function updateExpression(operator, argument, prefix) { | ||
return _builder.default.apply("UpdateExpression", arguments); | ||
function updateExpression(operator, argument, prefix = false) { | ||
return (0, _validateNode.default)({ | ||
type: "UpdateExpression", | ||
operator, | ||
argument, | ||
prefix | ||
}); | ||
} | ||
function variableDeclaration(kind, declarations) { | ||
return _builder.default.apply("VariableDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "VariableDeclaration", | ||
kind, | ||
declarations | ||
}); | ||
} | ||
function variableDeclarator(id, init) { | ||
return _builder.default.apply("VariableDeclarator", arguments); | ||
function variableDeclarator(id, init = null) { | ||
return (0, _validateNode.default)({ | ||
type: "VariableDeclarator", | ||
id, | ||
init | ||
}); | ||
} | ||
function whileStatement(test, body) { | ||
return _builder.default.apply("WhileStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "WhileStatement", | ||
test, | ||
body | ||
}); | ||
} | ||
function withStatement(object, body) { | ||
return _builder.default.apply("WithStatement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "WithStatement", | ||
object, | ||
body | ||
}); | ||
} | ||
function assignmentPattern(left, right) { | ||
return _builder.default.apply("AssignmentPattern", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "AssignmentPattern", | ||
left, | ||
right | ||
}); | ||
} | ||
function arrayPattern(elements) { | ||
return _builder.default.apply("ArrayPattern", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ArrayPattern", | ||
elements | ||
}); | ||
} | ||
function arrowFunctionExpression(params, body, async) { | ||
return _builder.default.apply("ArrowFunctionExpression", arguments); | ||
function arrowFunctionExpression(params, body, async = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ArrowFunctionExpression", | ||
params, | ||
body, | ||
async, | ||
expression: null | ||
}); | ||
} | ||
function classBody(body) { | ||
return _builder.default.apply("ClassBody", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ClassBody", | ||
body | ||
}); | ||
} | ||
function classExpression(id, superClass, body, decorators) { | ||
return _builder.default.apply("ClassExpression", arguments); | ||
function classExpression(id = null, superClass = null, body, decorators = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassExpression", | ||
id, | ||
superClass, | ||
body, | ||
decorators | ||
}); | ||
} | ||
function classDeclaration(id, superClass, body, decorators) { | ||
return _builder.default.apply("ClassDeclaration", arguments); | ||
function classDeclaration(id, superClass = null, body, decorators = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassDeclaration", | ||
id, | ||
superClass, | ||
body, | ||
decorators | ||
}); | ||
} | ||
function exportAllDeclaration(source) { | ||
return _builder.default.apply("ExportAllDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ExportAllDeclaration", | ||
source | ||
}); | ||
} | ||
function exportDefaultDeclaration(declaration) { | ||
return _builder.default.apply("ExportDefaultDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ExportDefaultDeclaration", | ||
declaration | ||
}); | ||
} | ||
function exportNamedDeclaration(declaration, specifiers, source) { | ||
return _builder.default.apply("ExportNamedDeclaration", arguments); | ||
function exportNamedDeclaration(declaration = null, specifiers = [], source = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ExportNamedDeclaration", | ||
declaration, | ||
specifiers, | ||
source | ||
}); | ||
} | ||
function exportSpecifier(local, exported) { | ||
return _builder.default.apply("ExportSpecifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ExportSpecifier", | ||
local, | ||
exported | ||
}); | ||
} | ||
function forOfStatement(left, right, body, _await) { | ||
return _builder.default.apply("ForOfStatement", arguments); | ||
function forOfStatement(left, right, body, _await = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ForOfStatement", | ||
left, | ||
right, | ||
body, | ||
await: _await | ||
}); | ||
} | ||
function importDeclaration(specifiers, source) { | ||
return _builder.default.apply("ImportDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ImportDeclaration", | ||
specifiers, | ||
source | ||
}); | ||
} | ||
function importDefaultSpecifier(local) { | ||
return _builder.default.apply("ImportDefaultSpecifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ImportDefaultSpecifier", | ||
local | ||
}); | ||
} | ||
function importNamespaceSpecifier(local) { | ||
return _builder.default.apply("ImportNamespaceSpecifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ImportNamespaceSpecifier", | ||
local | ||
}); | ||
} | ||
function importSpecifier(local, imported) { | ||
return _builder.default.apply("ImportSpecifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ImportSpecifier", | ||
local, | ||
imported | ||
}); | ||
} | ||
function metaProperty(meta, property) { | ||
return _builder.default.apply("MetaProperty", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "MetaProperty", | ||
meta, | ||
property | ||
}); | ||
} | ||
function classMethod(kind, key, params, body, computed, _static, generator, async) { | ||
return _builder.default.apply("ClassMethod", arguments); | ||
function classMethod(kind = "method", key, params, body, computed = false, _static = false, generator = false, async = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassMethod", | ||
kind, | ||
key, | ||
params, | ||
body, | ||
computed, | ||
static: _static, | ||
generator, | ||
async | ||
}); | ||
} | ||
function objectPattern(properties) { | ||
return _builder.default.apply("ObjectPattern", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ObjectPattern", | ||
properties | ||
}); | ||
} | ||
function spreadElement(argument) { | ||
return _builder.default.apply("SpreadElement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "SpreadElement", | ||
argument | ||
}); | ||
} | ||
function _super() { | ||
return _builder.default.apply("Super", arguments); | ||
return { | ||
type: "Super" | ||
}; | ||
} | ||
function taggedTemplateExpression(tag, quasi) { | ||
return _builder.default.apply("TaggedTemplateExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TaggedTemplateExpression", | ||
tag, | ||
quasi | ||
}); | ||
} | ||
function templateElement(value, tail) { | ||
return _builder.default.apply("TemplateElement", arguments); | ||
function templateElement(value, tail = false) { | ||
return (0, _validateNode.default)({ | ||
type: "TemplateElement", | ||
value, | ||
tail | ||
}); | ||
} | ||
function templateLiteral(quasis, expressions) { | ||
return _builder.default.apply("TemplateLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TemplateLiteral", | ||
quasis, | ||
expressions | ||
}); | ||
} | ||
function yieldExpression(argument, delegate) { | ||
return _builder.default.apply("YieldExpression", arguments); | ||
function yieldExpression(argument = null, delegate = false) { | ||
return (0, _validateNode.default)({ | ||
type: "YieldExpression", | ||
argument, | ||
delegate | ||
}); | ||
} | ||
function awaitExpression(argument) { | ||
return _builder.default.apply("AwaitExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "AwaitExpression", | ||
argument | ||
}); | ||
} | ||
function _import() { | ||
return _builder.default.apply("Import", arguments); | ||
return { | ||
type: "Import" | ||
}; | ||
} | ||
function bigIntLiteral(value) { | ||
return _builder.default.apply("BigIntLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "BigIntLiteral", | ||
value | ||
}); | ||
} | ||
function exportNamespaceSpecifier(exported) { | ||
return _builder.default.apply("ExportNamespaceSpecifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ExportNamespaceSpecifier", | ||
exported | ||
}); | ||
} | ||
function optionalMemberExpression(object, property, computed, optional) { | ||
return _builder.default.apply("OptionalMemberExpression", arguments); | ||
function optionalMemberExpression(object, property, computed = false, optional) { | ||
return (0, _validateNode.default)({ | ||
type: "OptionalMemberExpression", | ||
object, | ||
property, | ||
computed, | ||
optional | ||
}); | ||
} | ||
function optionalCallExpression(callee, _arguments, optional) { | ||
return _builder.default.apply("OptionalCallExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "OptionalCallExpression", | ||
callee, | ||
arguments: _arguments, | ||
optional | ||
}); | ||
} | ||
function classProperty(key, value, typeAnnotation, decorators, computed, _static) { | ||
return _builder.default.apply("ClassProperty", arguments); | ||
function classProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassProperty", | ||
key, | ||
value, | ||
typeAnnotation, | ||
decorators, | ||
computed, | ||
static: _static | ||
}); | ||
} | ||
function classAccessorProperty(key, value, typeAnnotation, decorators, computed, _static) { | ||
return _builder.default.apply("ClassAccessorProperty", arguments); | ||
function classAccessorProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassAccessorProperty", | ||
key, | ||
value, | ||
typeAnnotation, | ||
decorators, | ||
computed, | ||
static: _static | ||
}); | ||
} | ||
function classPrivateProperty(key, value, decorators, _static) { | ||
return _builder.default.apply("ClassPrivateProperty", arguments); | ||
function classPrivateProperty(key, value = null, decorators = null, _static) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassPrivateProperty", | ||
key, | ||
value, | ||
decorators, | ||
static: _static | ||
}); | ||
} | ||
function classPrivateMethod(kind, key, params, body, _static) { | ||
return _builder.default.apply("ClassPrivateMethod", arguments); | ||
function classPrivateMethod(kind = "method", key, params, body, _static = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassPrivateMethod", | ||
kind, | ||
key, | ||
params, | ||
body, | ||
static: _static | ||
}); | ||
} | ||
function privateName(id) { | ||
return _builder.default.apply("PrivateName", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "PrivateName", | ||
id | ||
}); | ||
} | ||
function staticBlock(body) { | ||
return _builder.default.apply("StaticBlock", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "StaticBlock", | ||
body | ||
}); | ||
} | ||
function anyTypeAnnotation() { | ||
return _builder.default.apply("AnyTypeAnnotation", arguments); | ||
return { | ||
type: "AnyTypeAnnotation" | ||
}; | ||
} | ||
function arrayTypeAnnotation(elementType) { | ||
return _builder.default.apply("ArrayTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ArrayTypeAnnotation", | ||
elementType | ||
}); | ||
} | ||
function booleanTypeAnnotation() { | ||
return _builder.default.apply("BooleanTypeAnnotation", arguments); | ||
return { | ||
type: "BooleanTypeAnnotation" | ||
}; | ||
} | ||
function booleanLiteralTypeAnnotation(value) { | ||
return _builder.default.apply("BooleanLiteralTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "BooleanLiteralTypeAnnotation", | ||
value | ||
}); | ||
} | ||
function nullLiteralTypeAnnotation() { | ||
return _builder.default.apply("NullLiteralTypeAnnotation", arguments); | ||
return { | ||
type: "NullLiteralTypeAnnotation" | ||
}; | ||
} | ||
function classImplements(id, typeParameters) { | ||
return _builder.default.apply("ClassImplements", arguments); | ||
function classImplements(id, typeParameters = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ClassImplements", | ||
id, | ||
typeParameters | ||
}); | ||
} | ||
function declareClass(id, typeParameters, _extends, body) { | ||
return _builder.default.apply("DeclareClass", arguments); | ||
function declareClass(id, typeParameters = null, _extends = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "DeclareClass", | ||
id, | ||
typeParameters, | ||
extends: _extends, | ||
body | ||
}); | ||
} | ||
function declareFunction(id) { | ||
return _builder.default.apply("DeclareFunction", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DeclareFunction", | ||
id | ||
}); | ||
} | ||
function declareInterface(id, typeParameters, _extends, body) { | ||
return _builder.default.apply("DeclareInterface", arguments); | ||
function declareInterface(id, typeParameters = null, _extends = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "DeclareInterface", | ||
id, | ||
typeParameters, | ||
extends: _extends, | ||
body | ||
}); | ||
} | ||
function declareModule(id, body, kind) { | ||
return _builder.default.apply("DeclareModule", arguments); | ||
function declareModule(id, body, kind = null) { | ||
return (0, _validateNode.default)({ | ||
type: "DeclareModule", | ||
id, | ||
body, | ||
kind | ||
}); | ||
} | ||
function declareModuleExports(typeAnnotation) { | ||
return _builder.default.apply("DeclareModuleExports", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DeclareModuleExports", | ||
typeAnnotation | ||
}); | ||
} | ||
function declareTypeAlias(id, typeParameters, right) { | ||
return _builder.default.apply("DeclareTypeAlias", arguments); | ||
function declareTypeAlias(id, typeParameters = null, right) { | ||
return (0, _validateNode.default)({ | ||
type: "DeclareTypeAlias", | ||
id, | ||
typeParameters, | ||
right | ||
}); | ||
} | ||
function declareOpaqueType(id, typeParameters, supertype) { | ||
return _builder.default.apply("DeclareOpaqueType", arguments); | ||
function declareOpaqueType(id, typeParameters = null, supertype = null) { | ||
return (0, _validateNode.default)({ | ||
type: "DeclareOpaqueType", | ||
id, | ||
typeParameters, | ||
supertype | ||
}); | ||
} | ||
function declareVariable(id) { | ||
return _builder.default.apply("DeclareVariable", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DeclareVariable", | ||
id | ||
}); | ||
} | ||
function declareExportDeclaration(declaration, specifiers, source) { | ||
return _builder.default.apply("DeclareExportDeclaration", arguments); | ||
function declareExportDeclaration(declaration = null, specifiers = null, source = null) { | ||
return (0, _validateNode.default)({ | ||
type: "DeclareExportDeclaration", | ||
declaration, | ||
specifiers, | ||
source | ||
}); | ||
} | ||
function declareExportAllDeclaration(source) { | ||
return _builder.default.apply("DeclareExportAllDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DeclareExportAllDeclaration", | ||
source | ||
}); | ||
} | ||
function declaredPredicate(value) { | ||
return _builder.default.apply("DeclaredPredicate", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DeclaredPredicate", | ||
value | ||
}); | ||
} | ||
function existsTypeAnnotation() { | ||
return _builder.default.apply("ExistsTypeAnnotation", arguments); | ||
return { | ||
type: "ExistsTypeAnnotation" | ||
}; | ||
} | ||
function functionTypeAnnotation(typeParameters, params, rest, returnType) { | ||
return _builder.default.apply("FunctionTypeAnnotation", arguments); | ||
function functionTypeAnnotation(typeParameters = null, params, rest = null, returnType) { | ||
return (0, _validateNode.default)({ | ||
type: "FunctionTypeAnnotation", | ||
typeParameters, | ||
params, | ||
rest, | ||
returnType | ||
}); | ||
} | ||
function functionTypeParam(name, typeAnnotation) { | ||
return _builder.default.apply("FunctionTypeParam", arguments); | ||
function functionTypeParam(name = null, typeAnnotation) { | ||
return (0, _validateNode.default)({ | ||
type: "FunctionTypeParam", | ||
name, | ||
typeAnnotation | ||
}); | ||
} | ||
function genericTypeAnnotation(id, typeParameters) { | ||
return _builder.default.apply("GenericTypeAnnotation", arguments); | ||
function genericTypeAnnotation(id, typeParameters = null) { | ||
return (0, _validateNode.default)({ | ||
type: "GenericTypeAnnotation", | ||
id, | ||
typeParameters | ||
}); | ||
} | ||
function inferredPredicate() { | ||
return _builder.default.apply("InferredPredicate", arguments); | ||
return { | ||
type: "InferredPredicate" | ||
}; | ||
} | ||
function interfaceExtends(id, typeParameters) { | ||
return _builder.default.apply("InterfaceExtends", arguments); | ||
function interfaceExtends(id, typeParameters = null) { | ||
return (0, _validateNode.default)({ | ||
type: "InterfaceExtends", | ||
id, | ||
typeParameters | ||
}); | ||
} | ||
function interfaceDeclaration(id, typeParameters, _extends, body) { | ||
return _builder.default.apply("InterfaceDeclaration", arguments); | ||
function interfaceDeclaration(id, typeParameters = null, _extends = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "InterfaceDeclaration", | ||
id, | ||
typeParameters, | ||
extends: _extends, | ||
body | ||
}); | ||
} | ||
function interfaceTypeAnnotation(_extends, body) { | ||
return _builder.default.apply("InterfaceTypeAnnotation", arguments); | ||
function interfaceTypeAnnotation(_extends = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "InterfaceTypeAnnotation", | ||
extends: _extends, | ||
body | ||
}); | ||
} | ||
function intersectionTypeAnnotation(types) { | ||
return _builder.default.apply("IntersectionTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "IntersectionTypeAnnotation", | ||
types | ||
}); | ||
} | ||
function mixedTypeAnnotation() { | ||
return _builder.default.apply("MixedTypeAnnotation", arguments); | ||
return { | ||
type: "MixedTypeAnnotation" | ||
}; | ||
} | ||
function emptyTypeAnnotation() { | ||
return _builder.default.apply("EmptyTypeAnnotation", arguments); | ||
return { | ||
type: "EmptyTypeAnnotation" | ||
}; | ||
} | ||
function nullableTypeAnnotation(typeAnnotation) { | ||
return _builder.default.apply("NullableTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "NullableTypeAnnotation", | ||
typeAnnotation | ||
}); | ||
} | ||
function numberLiteralTypeAnnotation(value) { | ||
return _builder.default.apply("NumberLiteralTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "NumberLiteralTypeAnnotation", | ||
value | ||
}); | ||
} | ||
function numberTypeAnnotation() { | ||
return _builder.default.apply("NumberTypeAnnotation", arguments); | ||
return { | ||
type: "NumberTypeAnnotation" | ||
}; | ||
} | ||
function objectTypeAnnotation(properties, indexers, callProperties, internalSlots, exact) { | ||
return _builder.default.apply("ObjectTypeAnnotation", arguments); | ||
function objectTypeAnnotation(properties, indexers = [], callProperties = [], internalSlots = [], exact = false) { | ||
return (0, _validateNode.default)({ | ||
type: "ObjectTypeAnnotation", | ||
properties, | ||
indexers, | ||
callProperties, | ||
internalSlots, | ||
exact | ||
}); | ||
} | ||
function objectTypeInternalSlot(id, value, optional, _static, method) { | ||
return _builder.default.apply("ObjectTypeInternalSlot", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ObjectTypeInternalSlot", | ||
id, | ||
value, | ||
optional, | ||
static: _static, | ||
method | ||
}); | ||
} | ||
function objectTypeCallProperty(value) { | ||
return _builder.default.apply("ObjectTypeCallProperty", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ObjectTypeCallProperty", | ||
value, | ||
static: null | ||
}); | ||
} | ||
function objectTypeIndexer(id, key, value, variance) { | ||
return _builder.default.apply("ObjectTypeIndexer", arguments); | ||
function objectTypeIndexer(id = null, key, value, variance = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ObjectTypeIndexer", | ||
id, | ||
key, | ||
value, | ||
variance, | ||
static: null | ||
}); | ||
} | ||
function objectTypeProperty(key, value, variance) { | ||
return _builder.default.apply("ObjectTypeProperty", arguments); | ||
function objectTypeProperty(key, value, variance = null) { | ||
return (0, _validateNode.default)({ | ||
type: "ObjectTypeProperty", | ||
key, | ||
value, | ||
variance, | ||
kind: null, | ||
method: null, | ||
optional: null, | ||
proto: null, | ||
static: null | ||
}); | ||
} | ||
function objectTypeSpreadProperty(argument) { | ||
return _builder.default.apply("ObjectTypeSpreadProperty", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ObjectTypeSpreadProperty", | ||
argument | ||
}); | ||
} | ||
function opaqueType(id, typeParameters, supertype, impltype) { | ||
return _builder.default.apply("OpaqueType", arguments); | ||
function opaqueType(id, typeParameters = null, supertype = null, impltype) { | ||
return (0, _validateNode.default)({ | ||
type: "OpaqueType", | ||
id, | ||
typeParameters, | ||
supertype, | ||
impltype | ||
}); | ||
} | ||
function qualifiedTypeIdentifier(id, qualification) { | ||
return _builder.default.apply("QualifiedTypeIdentifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "QualifiedTypeIdentifier", | ||
id, | ||
qualification | ||
}); | ||
} | ||
function stringLiteralTypeAnnotation(value) { | ||
return _builder.default.apply("StringLiteralTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "StringLiteralTypeAnnotation", | ||
value | ||
}); | ||
} | ||
function stringTypeAnnotation() { | ||
return _builder.default.apply("StringTypeAnnotation", arguments); | ||
return { | ||
type: "StringTypeAnnotation" | ||
}; | ||
} | ||
function symbolTypeAnnotation() { | ||
return _builder.default.apply("SymbolTypeAnnotation", arguments); | ||
return { | ||
type: "SymbolTypeAnnotation" | ||
}; | ||
} | ||
function thisTypeAnnotation() { | ||
return _builder.default.apply("ThisTypeAnnotation", arguments); | ||
return { | ||
type: "ThisTypeAnnotation" | ||
}; | ||
} | ||
function tupleTypeAnnotation(types) { | ||
return _builder.default.apply("TupleTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TupleTypeAnnotation", | ||
types | ||
}); | ||
} | ||
function typeofTypeAnnotation(argument) { | ||
return _builder.default.apply("TypeofTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TypeofTypeAnnotation", | ||
argument | ||
}); | ||
} | ||
function typeAlias(id, typeParameters, right) { | ||
return _builder.default.apply("TypeAlias", arguments); | ||
function typeAlias(id, typeParameters = null, right) { | ||
return (0, _validateNode.default)({ | ||
type: "TypeAlias", | ||
id, | ||
typeParameters, | ||
right | ||
}); | ||
} | ||
function typeAnnotation(typeAnnotation) { | ||
return _builder.default.apply("TypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TypeAnnotation", | ||
typeAnnotation | ||
}); | ||
} | ||
function typeCastExpression(expression, typeAnnotation) { | ||
return _builder.default.apply("TypeCastExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TypeCastExpression", | ||
expression, | ||
typeAnnotation | ||
}); | ||
} | ||
function typeParameter(bound, _default, variance) { | ||
return _builder.default.apply("TypeParameter", arguments); | ||
function typeParameter(bound = null, _default = null, variance = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TypeParameter", | ||
bound, | ||
default: _default, | ||
variance, | ||
name: null | ||
}); | ||
} | ||
function typeParameterDeclaration(params) { | ||
return _builder.default.apply("TypeParameterDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TypeParameterDeclaration", | ||
params | ||
}); | ||
} | ||
function typeParameterInstantiation(params) { | ||
return _builder.default.apply("TypeParameterInstantiation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TypeParameterInstantiation", | ||
params | ||
}); | ||
} | ||
function unionTypeAnnotation(types) { | ||
return _builder.default.apply("UnionTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "UnionTypeAnnotation", | ||
types | ||
}); | ||
} | ||
function variance(kind) { | ||
return _builder.default.apply("Variance", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "Variance", | ||
kind | ||
}); | ||
} | ||
function voidTypeAnnotation() { | ||
return _builder.default.apply("VoidTypeAnnotation", arguments); | ||
return { | ||
type: "VoidTypeAnnotation" | ||
}; | ||
} | ||
function enumDeclaration(id, body) { | ||
return _builder.default.apply("EnumDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumDeclaration", | ||
id, | ||
body | ||
}); | ||
} | ||
function enumBooleanBody(members) { | ||
return _builder.default.apply("EnumBooleanBody", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumBooleanBody", | ||
members, | ||
explicitType: null, | ||
hasUnknownMembers: null | ||
}); | ||
} | ||
function enumNumberBody(members) { | ||
return _builder.default.apply("EnumNumberBody", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumNumberBody", | ||
members, | ||
explicitType: null, | ||
hasUnknownMembers: null | ||
}); | ||
} | ||
function enumStringBody(members) { | ||
return _builder.default.apply("EnumStringBody", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumStringBody", | ||
members, | ||
explicitType: null, | ||
hasUnknownMembers: null | ||
}); | ||
} | ||
function enumSymbolBody(members) { | ||
return _builder.default.apply("EnumSymbolBody", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumSymbolBody", | ||
members, | ||
hasUnknownMembers: null | ||
}); | ||
} | ||
function enumBooleanMember(id) { | ||
return _builder.default.apply("EnumBooleanMember", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumBooleanMember", | ||
id, | ||
init: null | ||
}); | ||
} | ||
function enumNumberMember(id, init) { | ||
return _builder.default.apply("EnumNumberMember", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumNumberMember", | ||
id, | ||
init | ||
}); | ||
} | ||
function enumStringMember(id, init) { | ||
return _builder.default.apply("EnumStringMember", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumStringMember", | ||
id, | ||
init | ||
}); | ||
} | ||
function enumDefaultedMember(id) { | ||
return _builder.default.apply("EnumDefaultedMember", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "EnumDefaultedMember", | ||
id | ||
}); | ||
} | ||
function indexedAccessType(objectType, indexType) { | ||
return _builder.default.apply("IndexedAccessType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "IndexedAccessType", | ||
objectType, | ||
indexType | ||
}); | ||
} | ||
function optionalIndexedAccessType(objectType, indexType) { | ||
return _builder.default.apply("OptionalIndexedAccessType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "OptionalIndexedAccessType", | ||
objectType, | ||
indexType, | ||
optional: null | ||
}); | ||
} | ||
function jsxAttribute(name, value) { | ||
return _builder.default.apply("JSXAttribute", arguments); | ||
function jsxAttribute(name, value = null) { | ||
return (0, _validateNode.default)({ | ||
type: "JSXAttribute", | ||
name, | ||
value | ||
}); | ||
} | ||
function jsxClosingElement(name) { | ||
return _builder.default.apply("JSXClosingElement", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXClosingElement", | ||
name | ||
}); | ||
} | ||
function jsxElement(openingElement, closingElement, children, selfClosing) { | ||
return _builder.default.apply("JSXElement", arguments); | ||
function jsxElement(openingElement, closingElement = null, children, selfClosing = null) { | ||
return (0, _validateNode.default)({ | ||
type: "JSXElement", | ||
openingElement, | ||
closingElement, | ||
children, | ||
selfClosing | ||
}); | ||
} | ||
function jsxEmptyExpression() { | ||
return _builder.default.apply("JSXEmptyExpression", arguments); | ||
return { | ||
type: "JSXEmptyExpression" | ||
}; | ||
} | ||
function jsxExpressionContainer(expression) { | ||
return _builder.default.apply("JSXExpressionContainer", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXExpressionContainer", | ||
expression | ||
}); | ||
} | ||
function jsxSpreadChild(expression) { | ||
return _builder.default.apply("JSXSpreadChild", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXSpreadChild", | ||
expression | ||
}); | ||
} | ||
function jsxIdentifier(name) { | ||
return _builder.default.apply("JSXIdentifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXIdentifier", | ||
name | ||
}); | ||
} | ||
function jsxMemberExpression(object, property) { | ||
return _builder.default.apply("JSXMemberExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXMemberExpression", | ||
object, | ||
property | ||
}); | ||
} | ||
function jsxNamespacedName(namespace, name) { | ||
return _builder.default.apply("JSXNamespacedName", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXNamespacedName", | ||
namespace, | ||
name | ||
}); | ||
} | ||
function jsxOpeningElement(name, attributes, selfClosing) { | ||
return _builder.default.apply("JSXOpeningElement", arguments); | ||
function jsxOpeningElement(name, attributes, selfClosing = false) { | ||
return (0, _validateNode.default)({ | ||
type: "JSXOpeningElement", | ||
name, | ||
attributes, | ||
selfClosing | ||
}); | ||
} | ||
function jsxSpreadAttribute(argument) { | ||
return _builder.default.apply("JSXSpreadAttribute", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXSpreadAttribute", | ||
argument | ||
}); | ||
} | ||
function jsxText(value) { | ||
return _builder.default.apply("JSXText", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXText", | ||
value | ||
}); | ||
} | ||
function jsxFragment(openingFragment, closingFragment, children) { | ||
return _builder.default.apply("JSXFragment", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "JSXFragment", | ||
openingFragment, | ||
closingFragment, | ||
children | ||
}); | ||
} | ||
function jsxOpeningFragment() { | ||
return _builder.default.apply("JSXOpeningFragment", arguments); | ||
return { | ||
type: "JSXOpeningFragment" | ||
}; | ||
} | ||
function jsxClosingFragment() { | ||
return _builder.default.apply("JSXClosingFragment", arguments); | ||
return { | ||
type: "JSXClosingFragment" | ||
}; | ||
} | ||
function noop() { | ||
return _builder.default.apply("Noop", arguments); | ||
return { | ||
type: "Noop" | ||
}; | ||
} | ||
function placeholder(expectedNode, name) { | ||
return _builder.default.apply("Placeholder", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "Placeholder", | ||
expectedNode, | ||
name | ||
}); | ||
} | ||
function v8IntrinsicIdentifier(name) { | ||
return _builder.default.apply("V8IntrinsicIdentifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "V8IntrinsicIdentifier", | ||
name | ||
}); | ||
} | ||
function argumentPlaceholder() { | ||
return _builder.default.apply("ArgumentPlaceholder", arguments); | ||
return { | ||
type: "ArgumentPlaceholder" | ||
}; | ||
} | ||
function bindExpression(object, callee) { | ||
return _builder.default.apply("BindExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "BindExpression", | ||
object, | ||
callee | ||
}); | ||
} | ||
function importAttribute(key, value) { | ||
return _builder.default.apply("ImportAttribute", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ImportAttribute", | ||
key, | ||
value | ||
}); | ||
} | ||
function decorator(expression) { | ||
return _builder.default.apply("Decorator", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "Decorator", | ||
expression | ||
}); | ||
} | ||
function doExpression(body, async) { | ||
return _builder.default.apply("DoExpression", arguments); | ||
function doExpression(body, async = false) { | ||
return (0, _validateNode.default)({ | ||
type: "DoExpression", | ||
body, | ||
async | ||
}); | ||
} | ||
function exportDefaultSpecifier(exported) { | ||
return _builder.default.apply("ExportDefaultSpecifier", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ExportDefaultSpecifier", | ||
exported | ||
}); | ||
} | ||
function recordExpression(properties) { | ||
return _builder.default.apply("RecordExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "RecordExpression", | ||
properties | ||
}); | ||
} | ||
function tupleExpression(elements) { | ||
return _builder.default.apply("TupleExpression", arguments); | ||
function tupleExpression(elements = []) { | ||
return (0, _validateNode.default)({ | ||
type: "TupleExpression", | ||
elements | ||
}); | ||
} | ||
function decimalLiteral(value) { | ||
return _builder.default.apply("DecimalLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "DecimalLiteral", | ||
value | ||
}); | ||
} | ||
function moduleExpression(body) { | ||
return _builder.default.apply("ModuleExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "ModuleExpression", | ||
body | ||
}); | ||
} | ||
function topicReference() { | ||
return _builder.default.apply("TopicReference", arguments); | ||
return { | ||
type: "TopicReference" | ||
}; | ||
} | ||
function pipelineTopicExpression(expression) { | ||
return _builder.default.apply("PipelineTopicExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "PipelineTopicExpression", | ||
expression | ||
}); | ||
} | ||
function pipelineBareFunction(callee) { | ||
return _builder.default.apply("PipelineBareFunction", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "PipelineBareFunction", | ||
callee | ||
}); | ||
} | ||
function pipelinePrimaryTopicReference() { | ||
return _builder.default.apply("PipelinePrimaryTopicReference", arguments); | ||
return { | ||
type: "PipelinePrimaryTopicReference" | ||
}; | ||
} | ||
function tsParameterProperty(parameter) { | ||
return _builder.default.apply("TSParameterProperty", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSParameterProperty", | ||
parameter | ||
}); | ||
} | ||
function tsDeclareFunction(id, typeParameters, params, returnType) { | ||
return _builder.default.apply("TSDeclareFunction", arguments); | ||
function tsDeclareFunction(id = null, typeParameters = null, params, returnType = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSDeclareFunction", | ||
id, | ||
typeParameters, | ||
params, | ||
returnType | ||
}); | ||
} | ||
function tsDeclareMethod(decorators, key, typeParameters, params, returnType) { | ||
return _builder.default.apply("TSDeclareMethod", arguments); | ||
function tsDeclareMethod(decorators = null, key, typeParameters = null, params, returnType = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSDeclareMethod", | ||
decorators, | ||
key, | ||
typeParameters, | ||
params, | ||
returnType | ||
}); | ||
} | ||
function tsQualifiedName(left, right) { | ||
return _builder.default.apply("TSQualifiedName", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSQualifiedName", | ||
left, | ||
right | ||
}); | ||
} | ||
function tsCallSignatureDeclaration(typeParameters, parameters, typeAnnotation) { | ||
return _builder.default.apply("TSCallSignatureDeclaration", arguments); | ||
function tsCallSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSCallSignatureDeclaration", | ||
typeParameters, | ||
parameters, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsConstructSignatureDeclaration(typeParameters, parameters, typeAnnotation) { | ||
return _builder.default.apply("TSConstructSignatureDeclaration", arguments); | ||
function tsConstructSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSConstructSignatureDeclaration", | ||
typeParameters, | ||
parameters, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsPropertySignature(key, typeAnnotation, initializer) { | ||
return _builder.default.apply("TSPropertySignature", arguments); | ||
function tsPropertySignature(key, typeAnnotation = null, initializer = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSPropertySignature", | ||
key, | ||
typeAnnotation, | ||
initializer, | ||
kind: null | ||
}); | ||
} | ||
function tsMethodSignature(key, typeParameters, parameters, typeAnnotation) { | ||
return _builder.default.apply("TSMethodSignature", arguments); | ||
function tsMethodSignature(key, typeParameters = null, parameters, typeAnnotation = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSMethodSignature", | ||
key, | ||
typeParameters, | ||
parameters, | ||
typeAnnotation, | ||
kind: null | ||
}); | ||
} | ||
function tsIndexSignature(parameters, typeAnnotation) { | ||
return _builder.default.apply("TSIndexSignature", arguments); | ||
function tsIndexSignature(parameters, typeAnnotation = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSIndexSignature", | ||
parameters, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsAnyKeyword() { | ||
return _builder.default.apply("TSAnyKeyword", arguments); | ||
return { | ||
type: "TSAnyKeyword" | ||
}; | ||
} | ||
function tsBooleanKeyword() { | ||
return _builder.default.apply("TSBooleanKeyword", arguments); | ||
return { | ||
type: "TSBooleanKeyword" | ||
}; | ||
} | ||
function tsBigIntKeyword() { | ||
return _builder.default.apply("TSBigIntKeyword", arguments); | ||
return { | ||
type: "TSBigIntKeyword" | ||
}; | ||
} | ||
function tsIntrinsicKeyword() { | ||
return _builder.default.apply("TSIntrinsicKeyword", arguments); | ||
return { | ||
type: "TSIntrinsicKeyword" | ||
}; | ||
} | ||
function tsNeverKeyword() { | ||
return _builder.default.apply("TSNeverKeyword", arguments); | ||
return { | ||
type: "TSNeverKeyword" | ||
}; | ||
} | ||
function tsNullKeyword() { | ||
return _builder.default.apply("TSNullKeyword", arguments); | ||
return { | ||
type: "TSNullKeyword" | ||
}; | ||
} | ||
function tsNumberKeyword() { | ||
return _builder.default.apply("TSNumberKeyword", arguments); | ||
return { | ||
type: "TSNumberKeyword" | ||
}; | ||
} | ||
function tsObjectKeyword() { | ||
return _builder.default.apply("TSObjectKeyword", arguments); | ||
return { | ||
type: "TSObjectKeyword" | ||
}; | ||
} | ||
function tsStringKeyword() { | ||
return _builder.default.apply("TSStringKeyword", arguments); | ||
return { | ||
type: "TSStringKeyword" | ||
}; | ||
} | ||
function tsSymbolKeyword() { | ||
return _builder.default.apply("TSSymbolKeyword", arguments); | ||
return { | ||
type: "TSSymbolKeyword" | ||
}; | ||
} | ||
function tsUndefinedKeyword() { | ||
return _builder.default.apply("TSUndefinedKeyword", arguments); | ||
return { | ||
type: "TSUndefinedKeyword" | ||
}; | ||
} | ||
function tsUnknownKeyword() { | ||
return _builder.default.apply("TSUnknownKeyword", arguments); | ||
return { | ||
type: "TSUnknownKeyword" | ||
}; | ||
} | ||
function tsVoidKeyword() { | ||
return _builder.default.apply("TSVoidKeyword", arguments); | ||
return { | ||
type: "TSVoidKeyword" | ||
}; | ||
} | ||
function tsThisType() { | ||
return _builder.default.apply("TSThisType", arguments); | ||
return { | ||
type: "TSThisType" | ||
}; | ||
} | ||
function tsFunctionType(typeParameters, parameters, typeAnnotation) { | ||
return _builder.default.apply("TSFunctionType", arguments); | ||
function tsFunctionType(typeParameters = null, parameters, typeAnnotation = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSFunctionType", | ||
typeParameters, | ||
parameters, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsConstructorType(typeParameters, parameters, typeAnnotation) { | ||
return _builder.default.apply("TSConstructorType", arguments); | ||
function tsConstructorType(typeParameters = null, parameters, typeAnnotation = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSConstructorType", | ||
typeParameters, | ||
parameters, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsTypeReference(typeName, typeParameters) { | ||
return _builder.default.apply("TSTypeReference", arguments); | ||
function tsTypeReference(typeName, typeParameters = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeReference", | ||
typeName, | ||
typeParameters | ||
}); | ||
} | ||
function tsTypePredicate(parameterName, typeAnnotation, asserts) { | ||
return _builder.default.apply("TSTypePredicate", arguments); | ||
function tsTypePredicate(parameterName, typeAnnotation = null, asserts = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSTypePredicate", | ||
parameterName, | ||
typeAnnotation, | ||
asserts | ||
}); | ||
} | ||
function tsTypeQuery(exprName) { | ||
return _builder.default.apply("TSTypeQuery", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeQuery", | ||
exprName | ||
}); | ||
} | ||
function tsTypeLiteral(members) { | ||
return _builder.default.apply("TSTypeLiteral", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeLiteral", | ||
members | ||
}); | ||
} | ||
function tsArrayType(elementType) { | ||
return _builder.default.apply("TSArrayType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSArrayType", | ||
elementType | ||
}); | ||
} | ||
function tsTupleType(elementTypes) { | ||
return _builder.default.apply("TSTupleType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTupleType", | ||
elementTypes | ||
}); | ||
} | ||
function tsOptionalType(typeAnnotation) { | ||
return _builder.default.apply("TSOptionalType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSOptionalType", | ||
typeAnnotation | ||
}); | ||
} | ||
function tsRestType(typeAnnotation) { | ||
return _builder.default.apply("TSRestType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSRestType", | ||
typeAnnotation | ||
}); | ||
} | ||
function tsNamedTupleMember(label, elementType, optional) { | ||
return _builder.default.apply("TSNamedTupleMember", arguments); | ||
function tsNamedTupleMember(label, elementType, optional = false) { | ||
return (0, _validateNode.default)({ | ||
type: "TSNamedTupleMember", | ||
label, | ||
elementType, | ||
optional | ||
}); | ||
} | ||
function tsUnionType(types) { | ||
return _builder.default.apply("TSUnionType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSUnionType", | ||
types | ||
}); | ||
} | ||
function tsIntersectionType(types) { | ||
return _builder.default.apply("TSIntersectionType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSIntersectionType", | ||
types | ||
}); | ||
} | ||
function tsConditionalType(checkType, extendsType, trueType, falseType) { | ||
return _builder.default.apply("TSConditionalType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSConditionalType", | ||
checkType, | ||
extendsType, | ||
trueType, | ||
falseType | ||
}); | ||
} | ||
function tsInferType(typeParameter) { | ||
return _builder.default.apply("TSInferType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSInferType", | ||
typeParameter | ||
}); | ||
} | ||
function tsParenthesizedType(typeAnnotation) { | ||
return _builder.default.apply("TSParenthesizedType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSParenthesizedType", | ||
typeAnnotation | ||
}); | ||
} | ||
function tsTypeOperator(typeAnnotation) { | ||
return _builder.default.apply("TSTypeOperator", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeOperator", | ||
typeAnnotation, | ||
operator: null | ||
}); | ||
} | ||
function tsIndexedAccessType(objectType, indexType) { | ||
return _builder.default.apply("TSIndexedAccessType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSIndexedAccessType", | ||
objectType, | ||
indexType | ||
}); | ||
} | ||
function tsMappedType(typeParameter, typeAnnotation, nameType) { | ||
return _builder.default.apply("TSMappedType", arguments); | ||
function tsMappedType(typeParameter, typeAnnotation = null, nameType = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSMappedType", | ||
typeParameter, | ||
typeAnnotation, | ||
nameType | ||
}); | ||
} | ||
function tsLiteralType(literal) { | ||
return _builder.default.apply("TSLiteralType", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSLiteralType", | ||
literal | ||
}); | ||
} | ||
function tsExpressionWithTypeArguments(expression, typeParameters) { | ||
return _builder.default.apply("TSExpressionWithTypeArguments", arguments); | ||
function tsExpressionWithTypeArguments(expression, typeParameters = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSExpressionWithTypeArguments", | ||
expression, | ||
typeParameters | ||
}); | ||
} | ||
function tsInterfaceDeclaration(id, typeParameters, _extends, body) { | ||
return _builder.default.apply("TSInterfaceDeclaration", arguments); | ||
function tsInterfaceDeclaration(id, typeParameters = null, _extends = null, body) { | ||
return (0, _validateNode.default)({ | ||
type: "TSInterfaceDeclaration", | ||
id, | ||
typeParameters, | ||
extends: _extends, | ||
body | ||
}); | ||
} | ||
function tsInterfaceBody(body) { | ||
return _builder.default.apply("TSInterfaceBody", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSInterfaceBody", | ||
body | ||
}); | ||
} | ||
function tsTypeAliasDeclaration(id, typeParameters, typeAnnotation) { | ||
return _builder.default.apply("TSTypeAliasDeclaration", arguments); | ||
function tsTypeAliasDeclaration(id, typeParameters = null, typeAnnotation) { | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeAliasDeclaration", | ||
id, | ||
typeParameters, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsAsExpression(expression, typeAnnotation) { | ||
return _builder.default.apply("TSAsExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSAsExpression", | ||
expression, | ||
typeAnnotation | ||
}); | ||
} | ||
function tsTypeAssertion(typeAnnotation, expression) { | ||
return _builder.default.apply("TSTypeAssertion", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeAssertion", | ||
typeAnnotation, | ||
expression | ||
}); | ||
} | ||
function tsEnumDeclaration(id, members) { | ||
return _builder.default.apply("TSEnumDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSEnumDeclaration", | ||
id, | ||
members | ||
}); | ||
} | ||
function tsEnumMember(id, initializer) { | ||
return _builder.default.apply("TSEnumMember", arguments); | ||
function tsEnumMember(id, initializer = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSEnumMember", | ||
id, | ||
initializer | ||
}); | ||
} | ||
function tsModuleDeclaration(id, body) { | ||
return _builder.default.apply("TSModuleDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSModuleDeclaration", | ||
id, | ||
body | ||
}); | ||
} | ||
function tsModuleBlock(body) { | ||
return _builder.default.apply("TSModuleBlock", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSModuleBlock", | ||
body | ||
}); | ||
} | ||
function tsImportType(argument, qualifier, typeParameters) { | ||
return _builder.default.apply("TSImportType", arguments); | ||
function tsImportType(argument, qualifier = null, typeParameters = null) { | ||
return (0, _validateNode.default)({ | ||
type: "TSImportType", | ||
argument, | ||
qualifier, | ||
typeParameters | ||
}); | ||
} | ||
function tsImportEqualsDeclaration(id, moduleReference) { | ||
return _builder.default.apply("TSImportEqualsDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSImportEqualsDeclaration", | ||
id, | ||
moduleReference, | ||
isExport: null | ||
}); | ||
} | ||
function tsExternalModuleReference(expression) { | ||
return _builder.default.apply("TSExternalModuleReference", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSExternalModuleReference", | ||
expression | ||
}); | ||
} | ||
function tsNonNullExpression(expression) { | ||
return _builder.default.apply("TSNonNullExpression", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSNonNullExpression", | ||
expression | ||
}); | ||
} | ||
function tsExportAssignment(expression) { | ||
return _builder.default.apply("TSExportAssignment", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSExportAssignment", | ||
expression | ||
}); | ||
} | ||
function tsNamespaceExportDeclaration(id) { | ||
return _builder.default.apply("TSNamespaceExportDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSNamespaceExportDeclaration", | ||
id | ||
}); | ||
} | ||
function tsTypeAnnotation(typeAnnotation) { | ||
return _builder.default.apply("TSTypeAnnotation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeAnnotation", | ||
typeAnnotation | ||
}); | ||
} | ||
function tsTypeParameterInstantiation(params) { | ||
return _builder.default.apply("TSTypeParameterInstantiation", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeParameterInstantiation", | ||
params | ||
}); | ||
} | ||
function tsTypeParameterDeclaration(params) { | ||
return _builder.default.apply("TSTypeParameterDeclaration", arguments); | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeParameterDeclaration", | ||
params | ||
}); | ||
} | ||
function tsTypeParameter(constraint, _default, name) { | ||
return _builder.default.apply("TSTypeParameter", arguments); | ||
function tsTypeParameter(constraint = null, _default = null, name) { | ||
return (0, _validateNode.default)({ | ||
type: "TSTypeParameter", | ||
constraint, | ||
default: _default, | ||
name | ||
}); | ||
} | ||
@@ -1251,8 +2202,8 @@ | ||
console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | ||
return _builder.default.apply("NumberLiteral", arguments); | ||
return numericLiteral(value); | ||
} | ||
function RegexLiteral(pattern, flags) { | ||
function RegexLiteral(pattern, flags = "") { | ||
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | ||
return _builder.default.apply("RegexLiteral", arguments); | ||
return regExpLiteral(pattern, flags); | ||
} | ||
@@ -1262,3 +2213,3 @@ | ||
console.trace("The node type RestProperty has been renamed to RestElement"); | ||
return _builder.default.apply("RestProperty", arguments); | ||
return restElement(argument); | ||
} | ||
@@ -1268,3 +2219,3 @@ | ||
console.trace("The node type SpreadProperty has been renamed to SpreadElement"); | ||
return _builder.default.apply("SpreadProperty", arguments); | ||
return spreadElement(argument); | ||
} |
@@ -29,3 +29,3 @@ "use strict"; | ||
exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS; | ||
const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS]; | ||
const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS, "|>"]; | ||
exports.BINARY_OPERATORS = BINARY_OPERATORS; | ||
@@ -32,0 +32,0 @@ const ASSIGNMENT_OPERATORS = ["=", "+=", ...NUMBER_BINARY_OPERATORS.map(op => op + "="), ...LOGICAL_OPERATORS.map(op => op + "=")]; |
@@ -46,3 +46,3 @@ "use strict"; | ||
left: { | ||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern") | ||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression") | ||
}, | ||
@@ -252,3 +252,3 @@ right: { | ||
left: { | ||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("VariableDeclaration", "LVal") : (0, _utils.assertNodeType)("VariableDeclaration", "Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern") | ||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("VariableDeclaration", "LVal") : (0, _utils.assertNodeType)("VariableDeclaration", "Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression") | ||
}, | ||
@@ -324,2 +324,6 @@ right: { | ||
validate: (0, _utils.assertNodeType)("BlockStatement") | ||
}, | ||
predicate: { | ||
validate: (0, _utils.assertNodeType)("DeclaredPredicate", "InferredPredicate"), | ||
optional: true | ||
} | ||
@@ -348,2 +352,6 @@ }), | ||
validate: (0, _utils.assertNodeType)("BlockStatement") | ||
}, | ||
predicate: { | ||
validate: (0, _utils.assertNodeType)("DeclaredPredicate", "InferredPredicate"), | ||
optional: true | ||
} | ||
@@ -670,3 +678,3 @@ }) | ||
validate: function () { | ||
const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern"); | ||
const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern", "TSAsExpression", "TSNonNullExpression", "TSTypeAssertion"); | ||
const expression = (0, _utils.assertNodeType)("Expression"); | ||
@@ -687,3 +695,3 @@ return function (parent, key, node) { | ||
argument: { | ||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression") | ||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression") | ||
}, | ||
@@ -915,3 +923,3 @@ optional: { | ||
left: { | ||
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression") | ||
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression") | ||
}, | ||
@@ -955,2 +963,6 @@ right: { | ||
validate: (0, _utils.assertNodeType)("BlockStatement", "Expression") | ||
}, | ||
predicate: { | ||
validate: (0, _utils.assertNodeType)("DeclaredPredicate", "InferredPredicate"), | ||
optional: true | ||
} | ||
@@ -1156,3 +1168,3 @@ }) | ||
const declaration = (0, _utils.assertNodeType)("VariableDeclaration"); | ||
const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern"); | ||
const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression"); | ||
return function (node, key, val) { | ||
@@ -1159,0 +1171,0 @@ if ((0, _is.default)("VariableDeclaration", val)) { |
@@ -219,3 +219,3 @@ "use strict"; | ||
optional: true, | ||
default: undefined | ||
default: [] | ||
}, | ||
@@ -225,3 +225,3 @@ callProperties: { | ||
optional: true, | ||
default: undefined | ||
default: [] | ||
}, | ||
@@ -231,3 +231,3 @@ internalSlots: { | ||
optional: true, | ||
default: undefined | ||
default: [] | ||
}, | ||
@@ -234,0 +234,0 @@ exact: { |
@@ -331,3 +331,3 @@ "use strict"; | ||
defineType("TSAsExpression", { | ||
aliases: ["Expression"], | ||
aliases: ["Expression", "LVal", "PatternLike"], | ||
visitor: ["expression", "typeAnnotation"], | ||
@@ -340,3 +340,3 @@ fields: { | ||
defineType("TSTypeAssertion", { | ||
aliases: ["Expression"], | ||
aliases: ["Expression", "LVal", "PatternLike"], | ||
visitor: ["typeAnnotation", "expression"], | ||
@@ -412,3 +412,3 @@ fields: { | ||
defineType("TSNonNullExpression", { | ||
aliases: ["Expression"], | ||
aliases: ["Expression", "LVal", "PatternLike"], | ||
visitor: ["expression"], | ||
@@ -415,0 +415,0 @@ fields: { |
{ | ||
"name": "@babel/types", | ||
"version": "7.17.10", | ||
"version": "7.17.12", | ||
"description": "Babel Types is a Lodash-esque utility library for AST nodes", | ||
@@ -31,4 +31,4 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"devDependencies": { | ||
"@babel/generator": "^7.17.10", | ||
"@babel/parser": "^7.17.10", | ||
"@babel/generator": "^7.17.12", | ||
"@babel/parser": "^7.17.12", | ||
"chalk": "^4.1.0", | ||
@@ -35,0 +35,0 @@ "glob": "^7.1.7" |
@@ -39,9 +39,9 @@ import t from "../../lib/index.js"; | ||
interface BaseNode { | ||
leadingComments: ReadonlyArray<Comment> | null; | ||
innerComments: ReadonlyArray<Comment> | null; | ||
trailingComments: ReadonlyArray<Comment> | null; | ||
start: number | null; | ||
end: number | null; | ||
loc: SourceLocation | null; | ||
type: Node["type"]; | ||
leadingComments?: ReadonlyArray<Comment> | null; | ||
innerComments?: ReadonlyArray<Comment> | null; | ||
trailingComments?: ReadonlyArray<Comment> | null; | ||
start?: number | null; | ||
end?: number | null; | ||
loc?: SourceLocation | null; | ||
range?: [number, number]; | ||
@@ -48,0 +48,0 @@ extra?: Record<string, unknown>; |
@@ -54,16 +54,19 @@ import t from "../../lib/index.js"; | ||
if (builderNames.includes(fieldName)) { | ||
const field = definitions.NODE_FIELDS[type][fieldName]; | ||
const def = JSON.stringify(field.default); | ||
const bindingIdentifierName = t.toBindingIdentifierName(fieldName); | ||
let arg; | ||
if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) { | ||
args.push( | ||
`${bindingIdentifierName}${ | ||
isNullable(field) ? "?:" : ":" | ||
} ${typeAnnotation}` | ||
); | ||
arg = `${bindingIdentifierName}${ | ||
isNullable(field) && !def ? "?:" : ":" | ||
} ${typeAnnotation}`; | ||
} else { | ||
args.push( | ||
`${bindingIdentifierName}: ${typeAnnotation}${ | ||
isNullable(field) ? " | undefined" : "" | ||
}` | ||
); | ||
arg = `${bindingIdentifierName}: ${typeAnnotation}${ | ||
isNullable(field) ? " | undefined" : "" | ||
}`; | ||
} | ||
if (def !== "null" || isNullable(field)) { | ||
arg += `= ${def}`; | ||
} | ||
args.push(arg); | ||
} | ||
@@ -86,7 +89,4 @@ }); | ||
*/ | ||
import builder from "../builder"; | ||
import validateNode from "../validateNode"; | ||
import type * as t from "../.."; | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
`; | ||
@@ -101,7 +101,35 @@ | ||
: formatedBuilderName; | ||
const fieldNames = sortFieldNames( | ||
Object.keys(definitions.NODE_FIELDS[type]), | ||
type | ||
); | ||
const builderNames = definitions.BUILDER_KEYS[type]; | ||
const objectFields = [["type", JSON.stringify(type)]]; | ||
fieldNames.forEach(fieldName => { | ||
const field = definitions.NODE_FIELDS[type][fieldName]; | ||
if (builderNames.includes(fieldName)) { | ||
const bindingIdentifierName = t.toBindingIdentifierName(fieldName); | ||
objectFields.push([fieldName, bindingIdentifierName]); | ||
} else if (!field.optional) { | ||
const def = JSON.stringify(field.default); | ||
objectFields.push([fieldName, def]); | ||
} | ||
}); | ||
output += `${ | ||
formatedBuilderNameLocal === formatedBuilderName ? "export " : "" | ||
}function ${formatedBuilderNameLocal}(${defArgs.join( | ||
", " | ||
)}): t.${type} { return builder.apply("${type}", arguments); }\n`; | ||
}function ${formatedBuilderNameLocal}(${defArgs.join(", ")}): t.${type} {`; | ||
const nodeObjectExpression = `{\n${objectFields | ||
.map(([k, v]) => (k === v ? ` ${k},` : ` ${k}: ${v},`)) | ||
.join("\n")}\n }`; | ||
if (builderNames.length > 0) { | ||
output += `\n return validateNode<t.${type}>(${nodeObjectExpression});`; | ||
} else { | ||
output += `\n return ${nodeObjectExpression};`; | ||
} | ||
output += `\n}\n`; | ||
if (formatedBuilderNameLocal !== formatedBuilderName) { | ||
@@ -124,6 +152,7 @@ output += `export { ${formatedBuilderNameLocal} as ${formatedBuilderName} };\n`; | ||
const formatedBuilderName = formatBuilderName(type); | ||
const formatedNewBuilderName = formatBuilderName(newType); | ||
output += `/** @deprecated */ | ||
function ${type}(${generateBuilderArgs(newType).join(", ")}): t.${type} { | ||
function ${type}(${generateBuilderArgs(newType).join(", ")}) { | ||
console.trace("The node type ${type} has been renamed to ${newType}"); | ||
return builder.apply("${type}", arguments); | ||
return ${formatedNewBuilderName}(${t.BUILDER_KEYS[newType].join(", ")}); | ||
} | ||
@@ -130,0 +159,0 @@ export { ${type} as ${formatedBuilderName} };\n`; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1043827
20803