diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js
index 088bbae668b2..68d041efa6be 100644
--- a/.github/actions/javascript/authorChecklist/index.js
+++ b/.github/actions/javascript/authorChecklist/index.js
@@ -19585,6 +19585,10 @@ function TSTypeParameterInstantiation(node, parent) {
this.tokenChar(62);
}
function TSTypeParameter(node) {
+ if (node.const) {
+ this.word("const");
+ this.space();
+ }
if (node.in) {
this.word("in");
this.space();
@@ -22817,14258 +22821,6134 @@ function isKeyword(word) {
/***/ 5026:
/***/ ((__unused_webpack_module, exports) => {
+"use strict";
+Object.defineProperty(exports, "__esModule", ({value:true}));function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}class Position{constructor(line,col,index){this.line=void 0;this.column=void 0;this.index=void 0;this.line=line;this.column=col;this.index=index;}}class SourceLocation{constructor(start,end){this.start=void 0;this.end=void 0;this.filename=void 0;this.identifierName=void 0;this.start=start;this.end=end;}}function createPositionWithColumnOffset(position,columnOffset){const{line,column,index}=position;return new Position(line,column+columnOffset,index+columnOffset);}const code="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var ModuleErrors={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code}};const NodeDescriptions={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"};const toNodeDescription=node=>node.type==="UpdateExpression"?NodeDescriptions.UpdateExpression[`${node.prefix}`]:NodeDescriptions[node.type];var StandardErrors={AccessorIsGenerator:({kind})=>`A ${kind}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind})=>`Missing initializer in ${kind} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName})=>`\`${exportName}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",DynamicImportPhaseRequiresImportExpressions:({phase})=>`'import.${phase}(...)' can only be parsed when using the 'createImportExpressions' option.`,ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName,exportName})=>`A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type})=>`'${type==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type})=>`Unsyntactic ${type==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName})=>`A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,ImportCallArity:`\`import()\` requires exactly one or two arguments.`,ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix})=>`Expected number in radix ${radix}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord})=>`Escape sequence in keyword ${reservedWord}.`,InvalidIdentifier:({identifierName})=>`Invalid identifier ${identifierName}.`,InvalidLhs:({ancestor})=>`Invalid left-hand side in ${toNodeDescription(ancestor)}.`,InvalidLhsBinding:({ancestor})=>`Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,InvalidLhsOptionalChaining:({ancestor})=>`Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected})=>`Unexpected character '${unexpected}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName})=>`Private name #${identifierName} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName})=>`Label '${labelName}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin})=>`This experimental syntax requires enabling the parser plugin: ${missingPlugin.map(name=>JSON.stringify(name)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map(name=>JSON.stringify(name)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key})=>`Duplicate key "${key}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode})=>`An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`,ModuleExportUndefined:({localName})=>`Export '${localName}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName})=>`Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`,PrivateNameRedeclaration:({identifierName})=>`Duplicate private name #${identifierName}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword})=>`Unexpected keyword '${keyword}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord})=>`Unexpected reserved word '${reservedWord}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected,unexpected})=>`Unexpected token${unexpected?` '${unexpected}'.`:""}${expected?`, expected "${expected}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script`.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target,onlyValidPropertyName})=>`The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName})=>`Identifier '${identifierName}' has already been declared.`,YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."};var StrictModeErrors={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName})=>`Assigning to '${referenceName}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName})=>`Binding '${bindingName}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."};const UnparenthesizedPipeBodyDescriptions=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var PipelineOperatorErrors=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token})=>`Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type})=>`Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({type})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'});const _excluded=["message"];function defineHidden(obj,key,value){Object.defineProperty(obj,key,{enumerable:false,configurable:true,value});}function toParseErrorConstructor({toMessage,code,reasonCode,syntaxPlugin}){const hasMissingPlugin=reasonCode==="MissingPlugin"||reasonCode==="MissingOneOfPlugins";{const oldReasonCodes={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};if(oldReasonCodes[reasonCode]){reasonCode=oldReasonCodes[reasonCode];}}return function constructor(loc,details){const error=new SyntaxError();error.code=code;error.reasonCode=reasonCode;error.loc=loc;error.pos=loc.index;error.syntaxPlugin=syntaxPlugin;if(hasMissingPlugin){error.missingPlugin=details.missingPlugin;}defineHidden(error,"clone",function clone(overrides={}){var _overrides$loc;const{line,column,index}=(_overrides$loc=overrides.loc)!=null?_overrides$loc:loc;return constructor(new Position(line,column,index),Object.assign({},details,overrides.details));});defineHidden(error,"details",details);Object.defineProperty(error,"message",{configurable:true,get(){const message=`${toMessage(details)} (${loc.line}:${loc.column})`;this.message=message;return message;},set(value){Object.defineProperty(this,"message",{value,writable:true});}});return error;};}function ParseErrorEnum(argument,syntaxPlugin){if(Array.isArray(argument)){return parseErrorTemplates=>ParseErrorEnum(parseErrorTemplates,argument[0]);}const ParseErrorConstructors={};for(const reasonCode of Object.keys(argument)){const template=argument[reasonCode];const _ref=typeof template==="string"?{message:()=>template}:typeof template==="function"?{message:template}:template,{message}=_ref,rest=_objectWithoutPropertiesLoose(_ref,_excluded);const toMessage=typeof message==="string"?()=>message:message;ParseErrorConstructors[reasonCode]=toParseErrorConstructor(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode,toMessage},syntaxPlugin?{syntaxPlugin}:{},rest));}return ParseErrorConstructors;}const Errors=Object.assign({},ParseErrorEnum(ModuleErrors),ParseErrorEnum(StandardErrors),ParseErrorEnum(StrictModeErrors),ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));function createDefaultOptions(){return{sourceType:"script",sourceFilename:undefined,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:false,allowReturnOutsideFunction:false,allowNewTargetOutsideFunction:false,allowImportExportEverywhere:false,allowSuperOutsideMethod:false,allowUndeclaredExports:false,allowYieldOutsideFunction:false,plugins:[],strictMode:null,ranges:false,tokens:false,createImportExpressions:false,createParenthesizedExpressions:false,errorRecovery:false,attachComment:true,annexB:true};}function getOptions(opts){const options=createDefaultOptions();if(opts==null){return options;}if(opts.annexB!=null&&opts.annexB!==false){throw new Error("The `annexB` option can only be set to `false`.");}for(const key of Object.keys(options)){if(opts[key]!=null)options[key]=opts[key];}if(options.startLine===1){if(opts.startIndex==null&&options.startColumn>0){options.startIndex=options.startColumn;}else if(opts.startColumn==null&&options.startIndex>0){options.startColumn=options.startIndex;}}else if(opts.startColumn==null||opts.startIndex==null){if(opts.startIndex!=null){throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");}}return options;}const{defineProperty}=Object;const toUnenumerable=(object,key)=>{if(object){defineProperty(object,key,{enumerable:false,value:object[key]});}};function toESTreeLocation(node){toUnenumerable(node.loc.start,"index");toUnenumerable(node.loc.end,"index");return node;}var estree=superClass=>class ESTreeParserMixin extends superClass{parse(){const file=toESTreeLocation(super.parse());if(this.optionFlags&256){file.tokens=file.tokens.map(toESTreeLocation);}return file;}parseRegExpLiteral({pattern,flags}){let regex=null;try{regex=new RegExp(pattern,flags);}catch(_){}const node=this.estreeParseLiteral(regex);node.regex={pattern,flags};return node;}parseBigIntLiteral(value){let bigInt;try{bigInt=BigInt(value);}catch(_unused){bigInt=null;}const node=this.estreeParseLiteral(bigInt);node.bigint=String(node.value||value);return node;}parseDecimalLiteral(value){const decimal=null;const node=this.estreeParseLiteral(decimal);node.decimal=String(node.value||value);return node;}estreeParseLiteral(value){return this.parseLiteral(value,"Literal");}parseStringLiteral(value){return this.estreeParseLiteral(value);}parseNumericLiteral(value){return this.estreeParseLiteral(value);}parseNullLiteral(){return this.estreeParseLiteral(null);}parseBooleanLiteral(value){return this.estreeParseLiteral(value);}estreeParseChainExpression(node,endLoc){const chain=this.startNodeAtNode(node);chain.expression=node;return this.finishNodeAt(chain,"ChainExpression",endLoc);}directiveToStmt(directive){const expression=directive.value;delete directive.value;this.castNodeTo(expression,"Literal");expression.raw=expression.extra.raw;expression.value=expression.extra.expressionValue;const stmt=this.castNodeTo(directive,"ExpressionStatement");stmt.expression=expression;stmt.directive=expression.extra.rawValue;delete expression.extra;return stmt;}fillOptionalPropertiesForTSESLint(node){}cloneEstreeStringLiteral(node){const{start,end,loc,range,raw,value}=node;const cloned=Object.create(node.constructor.prototype);cloned.type="Literal";cloned.start=start;cloned.end=end;cloned.loc=loc;cloned.range=range;cloned.raw=raw;cloned.value=value;return cloned;}initFunction(node,isAsync){super.initFunction(node,isAsync);node.expression=false;}checkDeclaration(node){if(node!=null&&this.isObjectProperty(node)){this.checkDeclaration(node.value);}else{super.checkDeclaration(node);}}getObjectOrClassMethodParams(method){return method.value.params;}isValidDirective(stmt){var _stmt$expression$extr;return stmt.type==="ExpressionStatement"&&stmt.expression.type==="Literal"&&typeof stmt.expression.value==="string"&&!((_stmt$expression$extr=stmt.expression.extra)!=null&&_stmt$expression$extr.parenthesized);}parseBlockBody(node,allowDirectives,topLevel,end,afterBlockParse){super.parseBlockBody(node,allowDirectives,topLevel,end,afterBlockParse);const directiveStatements=node.directives.map(d=>this.directiveToStmt(d));node.body=directiveStatements.concat(node.body);delete node.directives;}parsePrivateName(){const node=super.parsePrivateName();{if(!this.getPluginOption("estree","classFeatures")){return node;}}return this.convertPrivateNameToPrivateIdentifier(node);}convertPrivateNameToPrivateIdentifier(node){const name=super.getPrivateNameSV(node);node=node;delete node.id;node.name=name;return this.castNodeTo(node,"PrivateIdentifier");}isPrivateName(node){{if(!this.getPluginOption("estree","classFeatures")){return super.isPrivateName(node);}}return node.type==="PrivateIdentifier";}getPrivateNameSV(node){{if(!this.getPluginOption("estree","classFeatures")){return super.getPrivateNameSV(node);}}return node.name;}parseLiteral(value,type){const node=super.parseLiteral(value,type);node.raw=node.extra.raw;delete node.extra;return node;}parseFunctionBody(node,allowExpression,isMethod=false){super.parseFunctionBody(node,allowExpression,isMethod);node.expression=node.body.type!=="BlockStatement";}parseMethod(node,isGenerator,isAsync,isConstructor,allowDirectSuper,type,inClassScope=false){let funcNode=this.startNode();funcNode.kind=node.kind;funcNode=super.parseMethod(funcNode,isGenerator,isAsync,isConstructor,allowDirectSuper,type,inClassScope);delete funcNode.kind;const{typeParameters}=node;if(typeParameters){delete node.typeParameters;funcNode.typeParameters=typeParameters;this.resetStartLocationFromNode(funcNode,typeParameters);}const valueNode=this.castNodeTo(funcNode,"FunctionExpression");node.value=valueNode;if(type==="ClassPrivateMethod"){node.computed=false;}if(type==="ObjectMethod"){if(node.kind==="method"){node.kind="init";}node.shorthand=false;return this.finishNode(node,"Property");}else{return this.finishNode(node,"MethodDefinition");}}nameIsConstructor(key){if(key.type==="Literal")return key.value==="constructor";return super.nameIsConstructor(key);}parseClassProperty(...args){const propertyNode=super.parseClassProperty(...args);{if(!this.getPluginOption("estree","classFeatures")){return propertyNode;}}{this.castNodeTo(propertyNode,"PropertyDefinition");}return propertyNode;}parseClassPrivateProperty(...args){const propertyNode=super.parseClassPrivateProperty(...args);{if(!this.getPluginOption("estree","classFeatures")){return propertyNode;}}{this.castNodeTo(propertyNode,"PropertyDefinition");}propertyNode.computed=false;return propertyNode;}parseClassAccessorProperty(node){const accessorPropertyNode=super.parseClassAccessorProperty(node);{if(!this.getPluginOption("estree","classFeatures")){return accessorPropertyNode;}}if(accessorPropertyNode.abstract&&this.hasPlugin("typescript")){delete accessorPropertyNode.abstract;this.castNodeTo(accessorPropertyNode,"TSAbstractAccessorProperty");}else{this.castNodeTo(accessorPropertyNode,"AccessorProperty");}return accessorPropertyNode;}parseObjectProperty(prop,startLoc,isPattern,refExpressionErrors){const node=super.parseObjectProperty(prop,startLoc,isPattern,refExpressionErrors);if(node){node.kind="init";this.castNodeTo(node,"Property");}return node;}finishObjectProperty(node){node.kind="init";return this.finishNode(node,"Property");}isValidLVal(type,isUnparenthesizedInAssign,binding){return type==="Property"?"value":super.isValidLVal(type,isUnparenthesizedInAssign,binding);}isAssignable(node,isBinding){if(node!=null&&this.isObjectProperty(node)){return this.isAssignable(node.value,isBinding);}return super.isAssignable(node,isBinding);}toAssignable(node,isLHS=false){if(node!=null&&this.isObjectProperty(node)){const{key,value}=node;if(this.isPrivateName(key)){this.classScope.usePrivateName(this.getPrivateNameSV(key),key.loc.start);}this.toAssignable(value,isLHS);}else{super.toAssignable(node,isLHS);}}toAssignableObjectExpressionProp(prop,isLast,isLHS){if(prop.type==="Property"&&(prop.kind==="get"||prop.kind==="set")){this.raise(Errors.PatternHasAccessor,prop.key);}else if(prop.type==="Property"&&prop.method){this.raise(Errors.PatternHasMethod,prop.key);}else{super.toAssignableObjectExpressionProp(prop,isLast,isLHS);}}finishCallExpression(unfinished,optional){const node=super.finishCallExpression(unfinished,optional);if(node.callee.type==="Import"){var _ref,_ref2;this.castNodeTo(node,"ImportExpression");node.source=node.arguments[0];node.options=(_ref=node.arguments[1])!=null?_ref:null;node.attributes=(_ref2=node.arguments[1])!=null?_ref2:null;delete node.arguments;delete node.callee;}else if(node.type==="OptionalCallExpression"){this.castNodeTo(node,"CallExpression");}else{node.optional=false;}return node;}toReferencedArguments(node){if(node.type==="ImportExpression"){return;}super.toReferencedArguments(node);}parseExport(unfinished,decorators){const exportStartLoc=this.state.lastTokStartLoc;const node=super.parseExport(unfinished,decorators);switch(node.type){case"ExportAllDeclaration":node.exported=null;break;case"ExportNamedDeclaration":if(node.specifiers.length===1&&node.specifiers[0].type==="ExportNamespaceSpecifier"){this.castNodeTo(node,"ExportAllDeclaration");node.exported=node.specifiers[0].exported;delete node.specifiers;}case"ExportDefaultDeclaration":{var _declaration$decorato;const{declaration}=node;if((declaration==null?void 0:declaration.type)==="ClassDeclaration"&&((_declaration$decorato=declaration.decorators)==null?void 0:_declaration$decorato.length)>0&&declaration.start===node.start){this.resetStartLocation(node,exportStartLoc);}}break;}return node;}stopParseSubscript(base,state){const node=super.stopParseSubscript(base,state);if(state.optionalChainMember){return this.estreeParseChainExpression(node,base.loc.end);}return node;}parseMember(base,startLoc,state,computed,optional){const node=super.parseMember(base,startLoc,state,computed,optional);if(node.type==="OptionalMemberExpression"){this.castNodeTo(node,"MemberExpression");}else{node.optional=false;}return node;}isOptionalMemberExpression(node){if(node.type==="ChainExpression"){return node.expression.type==="MemberExpression";}return super.isOptionalMemberExpression(node);}hasPropertyAsPrivateName(node){if(node.type==="ChainExpression"){node=node.expression;}return super.hasPropertyAsPrivateName(node);}isObjectProperty(node){return node.type==="Property"&&node.kind==="init"&&!node.method;}isObjectMethod(node){return node.type==="Property"&&(node.method||node.kind==="get"||node.kind==="set");}castNodeTo(node,type){const result=super.castNodeTo(node,type);this.fillOptionalPropertiesForTSESLint(result);return result;}cloneIdentifier(node){const cloned=super.cloneIdentifier(node);this.fillOptionalPropertiesForTSESLint(cloned);return cloned;}cloneStringLiteral(node){if(node.type==="Literal"){return this.cloneEstreeStringLiteral(node);}return super.cloneStringLiteral(node);}finishNodeAt(node,type,endLoc){return toESTreeLocation(super.finishNodeAt(node,type,endLoc));}finishNode(node,type){const result=super.finishNode(node,type);this.fillOptionalPropertiesForTSESLint(result);return result;}resetStartLocation(node,startLoc){super.resetStartLocation(node,startLoc);toESTreeLocation(node);}resetEndLocation(node,endLoc=this.state.lastTokEndLoc){super.resetEndLocation(node,endLoc);toESTreeLocation(node);}};class TokContext{constructor(token,preserveSpace){this.token=void 0;this.preserveSpace=void 0;this.token=token;this.preserveSpace=!!preserveSpace;}}const types={brace:new TokContext("{"),j_oTag:new TokContext("...",true)};{types.template=new TokContext("`",true);}const beforeExpr=true;const startsExpr=true;const isLoop=true;const isAssign=true;const prefix=true;const postfix=true;class ExportedTokenType{constructor(label,conf={}){this.label=void 0;this.keyword=void 0;this.beforeExpr=void 0;this.startsExpr=void 0;this.rightAssociative=void 0;this.isLoop=void 0;this.isAssign=void 0;this.prefix=void 0;this.postfix=void 0;this.binop=void 0;this.label=label;this.keyword=conf.keyword;this.beforeExpr=!!conf.beforeExpr;this.startsExpr=!!conf.startsExpr;this.rightAssociative=!!conf.rightAssociative;this.isLoop=!!conf.isLoop;this.isAssign=!!conf.isAssign;this.prefix=!!conf.prefix;this.postfix=!!conf.postfix;this.binop=conf.binop!=null?conf.binop:null;{this.updateContext=null;}}}const keywords$1=new Map();function createKeyword(name,options={}){options.keyword=name;const token=createToken(name,options);keywords$1.set(name,token);return token;}function createBinop(name,binop){return createToken(name,{beforeExpr,binop});}let tokenTypeCounter=-1;const tokenTypes=[];const tokenLabels=[];const tokenBinops=[];const tokenBeforeExprs=[];const tokenStartsExprs=[];const tokenPrefixes=[];function createToken(name,options={}){var _options$binop,_options$beforeExpr,_options$startsExpr,_options$prefix;++tokenTypeCounter;tokenLabels.push(name);tokenBinops.push((_options$binop=options.binop)!=null?_options$binop:-1);tokenBeforeExprs.push((_options$beforeExpr=options.beforeExpr)!=null?_options$beforeExpr:false);tokenStartsExprs.push((_options$startsExpr=options.startsExpr)!=null?_options$startsExpr:false);tokenPrefixes.push((_options$prefix=options.prefix)!=null?_options$prefix:false);tokenTypes.push(new ExportedTokenType(name,options));return tokenTypeCounter;}function createKeywordLike(name,options={}){var _options$binop2,_options$beforeExpr2,_options$startsExpr2,_options$prefix2;++tokenTypeCounter;keywords$1.set(name,tokenTypeCounter);tokenLabels.push(name);tokenBinops.push((_options$binop2=options.binop)!=null?_options$binop2:-1);tokenBeforeExprs.push((_options$beforeExpr2=options.beforeExpr)!=null?_options$beforeExpr2:false);tokenStartsExprs.push((_options$startsExpr2=options.startsExpr)!=null?_options$startsExpr2:false);tokenPrefixes.push((_options$prefix2=options.prefix)!=null?_options$prefix2:false);tokenTypes.push(new ExportedTokenType("name",options));return tokenTypeCounter;}const tt={bracketL:createToken("[",{beforeExpr,startsExpr}),bracketHashL:createToken("#[",{beforeExpr,startsExpr}),bracketBarL:createToken("[|",{beforeExpr,startsExpr}),bracketR:createToken("]"),bracketBarR:createToken("|]"),braceL:createToken("{",{beforeExpr,startsExpr}),braceBarL:createToken("{|",{beforeExpr,startsExpr}),braceHashL:createToken("#{",{beforeExpr,startsExpr}),braceR:createToken("}"),braceBarR:createToken("|}"),parenL:createToken("(",{beforeExpr,startsExpr}),parenR:createToken(")"),comma:createToken(",",{beforeExpr}),semi:createToken(";",{beforeExpr}),colon:createToken(":",{beforeExpr}),doubleColon:createToken("::",{beforeExpr}),dot:createToken("."),question:createToken("?",{beforeExpr}),questionDot:createToken("?."),arrow:createToken("=>",{beforeExpr}),template:createToken("template"),ellipsis:createToken("...",{beforeExpr}),backQuote:createToken("`",{startsExpr}),dollarBraceL:createToken("${",{beforeExpr,startsExpr}),templateTail:createToken("...`",{startsExpr}),templateNonTail:createToken("...${",{beforeExpr,startsExpr}),at:createToken("@"),hash:createToken("#",{startsExpr}),interpreterDirective:createToken("#!..."),eq:createToken("=",{beforeExpr,isAssign}),assign:createToken("_=",{beforeExpr,isAssign}),slashAssign:createToken("_=",{beforeExpr,isAssign}),xorAssign:createToken("_=",{beforeExpr,isAssign}),moduloAssign:createToken("_=",{beforeExpr,isAssign}),incDec:createToken("++/--",{prefix,postfix,startsExpr}),bang:createToken("!",{beforeExpr,prefix,startsExpr}),tilde:createToken("~",{beforeExpr,prefix,startsExpr}),doubleCaret:createToken("^^",{startsExpr}),doubleAt:createToken("@@",{startsExpr}),pipeline:createBinop("|>",0),nullishCoalescing:createBinop("??",1),logicalOR:createBinop("||",1),logicalAND:createBinop("&&",2),bitwiseOR:createBinop("|",3),bitwiseXOR:createBinop("^",4),bitwiseAND:createBinop("&",5),equality:createBinop("==/!=/===/!==",6),lt:createBinop(">/<=/>=",7),gt:createBinop(">/<=/>=",7),relational:createBinop(">/<=/>=",7),bitShift:createBinop("<>>/>>>",8),bitShiftL:createBinop("<>>/>>>",8),bitShiftR:createBinop("<>>/>>>",8),plusMin:createToken("+/-",{beforeExpr,binop:9,prefix,startsExpr}),modulo:createToken("%",{binop:10,startsExpr}),star:createToken("*",{binop:10}),slash:createBinop("/",10),exponent:createToken("**",{beforeExpr,binop:11,rightAssociative:true}),_in:createKeyword("in",{beforeExpr,binop:7}),_instanceof:createKeyword("instanceof",{beforeExpr,binop:7}),_break:createKeyword("break"),_case:createKeyword("case",{beforeExpr}),_catch:createKeyword("catch"),_continue:createKeyword("continue"),_debugger:createKeyword("debugger"),_default:createKeyword("default",{beforeExpr}),_else:createKeyword("else",{beforeExpr}),_finally:createKeyword("finally"),_function:createKeyword("function",{startsExpr}),_if:createKeyword("if"),_return:createKeyword("return",{beforeExpr}),_switch:createKeyword("switch"),_throw:createKeyword("throw",{beforeExpr,prefix,startsExpr}),_try:createKeyword("try"),_var:createKeyword("var"),_const:createKeyword("const"),_with:createKeyword("with"),_new:createKeyword("new",{beforeExpr,startsExpr}),_this:createKeyword("this",{startsExpr}),_super:createKeyword("super",{startsExpr}),_class:createKeyword("class",{startsExpr}),_extends:createKeyword("extends",{beforeExpr}),_export:createKeyword("export"),_import:createKeyword("import",{startsExpr}),_null:createKeyword("null",{startsExpr}),_true:createKeyword("true",{startsExpr}),_false:createKeyword("false",{startsExpr}),_typeof:createKeyword("typeof",{beforeExpr,prefix,startsExpr}),_void:createKeyword("void",{beforeExpr,prefix,startsExpr}),_delete:createKeyword("delete",{beforeExpr,prefix,startsExpr}),_do:createKeyword("do",{isLoop,beforeExpr}),_for:createKeyword("for",{isLoop}),_while:createKeyword("while",{isLoop}),_as:createKeywordLike("as",{startsExpr}),_assert:createKeywordLike("assert",{startsExpr}),_async:createKeywordLike("async",{startsExpr}),_await:createKeywordLike("await",{startsExpr}),_defer:createKeywordLike("defer",{startsExpr}),_from:createKeywordLike("from",{startsExpr}),_get:createKeywordLike("get",{startsExpr}),_let:createKeywordLike("let",{startsExpr}),_meta:createKeywordLike("meta",{startsExpr}),_of:createKeywordLike("of",{startsExpr}),_sent:createKeywordLike("sent",{startsExpr}),_set:createKeywordLike("set",{startsExpr}),_source:createKeywordLike("source",{startsExpr}),_static:createKeywordLike("static",{startsExpr}),_using:createKeywordLike("using",{startsExpr}),_yield:createKeywordLike("yield",{startsExpr}),_asserts:createKeywordLike("asserts",{startsExpr}),_checks:createKeywordLike("checks",{startsExpr}),_exports:createKeywordLike("exports",{startsExpr}),_global:createKeywordLike("global",{startsExpr}),_implements:createKeywordLike("implements",{startsExpr}),_intrinsic:createKeywordLike("intrinsic",{startsExpr}),_infer:createKeywordLike("infer",{startsExpr}),_is:createKeywordLike("is",{startsExpr}),_mixins:createKeywordLike("mixins",{startsExpr}),_proto:createKeywordLike("proto",{startsExpr}),_require:createKeywordLike("require",{startsExpr}),_satisfies:createKeywordLike("satisfies",{startsExpr}),_keyof:createKeywordLike("keyof",{startsExpr}),_readonly:createKeywordLike("readonly",{startsExpr}),_unique:createKeywordLike("unique",{startsExpr}),_abstract:createKeywordLike("abstract",{startsExpr}),_declare:createKeywordLike("declare",{startsExpr}),_enum:createKeywordLike("enum",{startsExpr}),_module:createKeywordLike("module",{startsExpr}),_namespace:createKeywordLike("namespace",{startsExpr}),_interface:createKeywordLike("interface",{startsExpr}),_type:createKeywordLike("type",{startsExpr}),_opaque:createKeywordLike("opaque",{startsExpr}),name:createToken("name",{startsExpr}),placeholder:createToken("%%",{startsExpr:true}),string:createToken("string",{startsExpr}),num:createToken("num",{startsExpr}),bigint:createToken("bigint",{startsExpr}),decimal:createToken("decimal",{startsExpr}),regexp:createToken("regexp",{startsExpr}),privateName:createToken("#name",{startsExpr}),eof:createToken("eof"),jsxName:createToken("jsxName"),jsxText:createToken("jsxText",{beforeExpr:true}),jsxTagStart:createToken("jsxTagStart",{startsExpr:true}),jsxTagEnd:createToken("jsxTagEnd")};function tokenIsIdentifier(token){return token>=93&&token<=133;}function tokenKeywordOrIdentifierIsKeyword(token){return token<=92;}function tokenIsKeywordOrIdentifier(token){return token>=58&&token<=133;}function tokenIsLiteralPropertyName(token){return token>=58&&token<=137;}function tokenComesBeforeExpression(token){return tokenBeforeExprs[token];}function tokenCanStartExpression(token){return tokenStartsExprs[token];}function tokenIsAssignment(token){return token>=29&&token<=33;}function tokenIsFlowInterfaceOrTypeOrOpaque(token){return token>=129&&token<=131;}function tokenIsLoop(token){return token>=90&&token<=92;}function tokenIsKeyword(token){return token>=58&&token<=92;}function tokenIsOperator(token){return token>=39&&token<=59;}function tokenIsPostfix(token){return token===34;}function tokenIsPrefix(token){return tokenPrefixes[token];}function tokenIsTSTypeOperator(token){return token>=121&&token<=123;}function tokenIsTSDeclarationStart(token){return token>=124&&token<=130;}function tokenLabelName(token){return tokenLabels[token];}function tokenOperatorPrecedence(token){return tokenBinops[token];}function tokenIsRightAssociative(token){return token===57;}function tokenIsTemplate(token){return token>=24&&token<=25;}function getExportedToken(token){return tokenTypes[token];}{tokenTypes[8].updateContext=context=>{context.pop();};tokenTypes[5].updateContext=tokenTypes[7].updateContext=tokenTypes[23].updateContext=context=>{context.push(types.brace);};tokenTypes[22].updateContext=context=>{if(context[context.length-1]===types.template){context.pop();}else{context.push(types.template);}};tokenTypes[143].updateContext=context=>{context.push(types.j_expr,types.j_oTag);};}let nonASCIIidentifierStartChars="\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";let nonASCIIidentifierChars="\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";const nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");const nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");nonASCIIidentifierStartChars=nonASCIIidentifierChars=null;const astralIdentifierStartCodes=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191];const astralIdentifierCodes=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(code,set){let pos=0x10000;for(let i=0,length=set.length;icode)return false;pos+=set[i+1];if(pos>=code)return true;}return false;}function isIdentifierStart(code){if(code<65)return code===36;if(code<=90)return true;if(code<97)return code===95;if(code<=122)return true;if(code<=0xffff){return code>=0xaa&&nonASCIIidentifierStart.test(String.fromCharCode(code));}return isInAstralSet(code,astralIdentifierStartCodes);}function isIdentifierChar(code){if(code<48)return code===36;if(code<58)return true;if(code<65)return false;if(code<=90)return true;if(code<97)return code===95;if(code<=122)return true;if(code<=0xffff){return code>=0xaa&&nonASCIIidentifier.test(String.fromCharCode(code));}return isInAstralSet(code,astralIdentifierStartCodes)||isInAstralSet(code,astralIdentifierCodes);}const reservedWords={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const keywords=new Set(reservedWords.keyword);const reservedWordsStrictSet=new Set(reservedWords.strict);const reservedWordsStrictBindSet=new Set(reservedWords.strictBind);function isReservedWord(word,inModule){return inModule&&word==="await"||word==="enum";}function isStrictReservedWord(word,inModule){return isReservedWord(word,inModule)||reservedWordsStrictSet.has(word);}function isStrictBindOnlyReservedWord(word){return reservedWordsStrictBindSet.has(word);}function isStrictBindReservedWord(word,inModule){return isStrictReservedWord(word,inModule)||isStrictBindOnlyReservedWord(word);}function isKeyword(word){return keywords.has(word);}function isIteratorStart(current,next,next2){return current===64&&next===64&&isIdentifierStart(next2);}const reservedWordLikeSet=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function canBeReservedWord(word){return reservedWordLikeSet.has(word);}class Scope{constructor(flags){this.flags=0;this.names=new Map();this.firstLexicalName="";this.flags=flags;}}class ScopeHandler{constructor(parser,inModule){this.parser=void 0;this.scopeStack=[];this.inModule=void 0;this.undefinedExports=new Map();this.parser=parser;this.inModule=inModule;}get inTopLevel(){return(this.currentScope().flags&1)>0;}get inFunction(){return(this.currentVarScopeFlags()&2)>0;}get allowSuper(){return(this.currentThisScopeFlags()&16)>0;}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0;}get inClass(){return(this.currentThisScopeFlags()&64)>0;}get inClassAndNotInNonArrowFunction(){const flags=this.currentThisScopeFlags();return(flags&64)>0&&(flags&2)===0;}get inStaticBlock(){for(let i=this.scopeStack.length-1;;i--){const{flags}=this.scopeStack[i];if(flags&128){return true;}if(flags&(387|64)){return false;}}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0;}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope());}createScope(flags){return new Scope(flags);}enter(flags){this.scopeStack.push(this.createScope(flags));}exit(){const scope=this.scopeStack.pop();return scope.flags;}treatFunctionsAsVarInScope(scope){return!!(scope.flags&(2|128)||!this.parser.inModule&&scope.flags&1);}declareName(name,bindingType,loc){let scope=this.currentScope();if(bindingType&8||bindingType&16){this.checkRedeclarationInScope(scope,name,bindingType,loc);let type=scope.names.get(name)||0;if(bindingType&16){type=type|4;}else{if(!scope.firstLexicalName){scope.firstLexicalName=name;}type=type|2;}scope.names.set(name,type);if(bindingType&8){this.maybeExportDefined(scope,name);}}else if(bindingType&4){for(let i=this.scopeStack.length-1;i>=0;--i){scope=this.scopeStack[i];this.checkRedeclarationInScope(scope,name,bindingType,loc);scope.names.set(name,(scope.names.get(name)||0)|1);this.maybeExportDefined(scope,name);if(scope.flags&387)break;}}if(this.parser.inModule&&scope.flags&1){this.undefinedExports.delete(name);}}maybeExportDefined(scope,name){if(this.parser.inModule&&scope.flags&1){this.undefinedExports.delete(name);}}checkRedeclarationInScope(scope,name,bindingType,loc){if(this.isRedeclaredInScope(scope,name,bindingType)){this.parser.raise(Errors.VarRedeclaration,loc,{identifierName:name});}}isRedeclaredInScope(scope,name,bindingType){if(!(bindingType&1))return false;if(bindingType&8){return scope.names.has(name);}const type=scope.names.get(name);if(bindingType&16){return(type&2)>0||!this.treatFunctionsAsVarInScope(scope)&&(type&1)>0;}return(type&2)>0&&!(scope.flags&8&&scope.firstLexicalName===name)||!this.treatFunctionsAsVarInScope(scope)&&(type&4)>0;}checkLocalExport(id){const{name}=id;const topLevelScope=this.scopeStack[0];if(!topLevelScope.names.has(name)){this.undefinedExports.set(name,id.loc.start);}}currentScope(){return this.scopeStack[this.scopeStack.length-1];}currentVarScopeFlags(){for(let i=this.scopeStack.length-1;;i--){const{flags}=this.scopeStack[i];if(flags&387){return flags;}}}currentThisScopeFlags(){for(let i=this.scopeStack.length-1;;i--){const{flags}=this.scopeStack[i];if(flags&(387|64)&&!(flags&4)){return flags;}}}}class FlowScope extends Scope{constructor(...args){super(...args);this.declareFunctions=new Set();}}class FlowScopeHandler extends ScopeHandler{createScope(flags){return new FlowScope(flags);}declareName(name,bindingType,loc){const scope=this.currentScope();if(bindingType&2048){this.checkRedeclarationInScope(scope,name,bindingType,loc);this.maybeExportDefined(scope,name);scope.declareFunctions.add(name);return;}super.declareName(name,bindingType,loc);}isRedeclaredInScope(scope,name,bindingType){if(super.isRedeclaredInScope(scope,name,bindingType))return true;if(bindingType&2048&&!scope.declareFunctions.has(name)){const type=scope.names.get(name);return(type&4)>0||(type&2)>0;}return false;}checkLocalExport(id){if(!this.scopeStack[0].declareFunctions.has(id.name)){super.checkLocalExport(id);}}}const reservedTypes=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]);const FlowErrors=ParseErrorEnum`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType})=>`Cannot overwrite reserved type ${reservedType}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName,enumName})=>`Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,EnumDuplicateMemberName:({memberName,enumName})=>`Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,EnumInconsistentMemberValues:({enumName})=>`Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType,enumName})=>`Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName,memberName,explicitType})=>`Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName,memberName})=>`Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName,memberName})=>`The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,EnumInvalidMemberName:({enumName,memberName,suggestion})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,EnumNumberMemberNotInitialized:({enumName,memberName})=>`Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType})=>`Unexpected reserved type ${reservedType}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind,suggestion})=>`\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function isEsModuleType(bodyElement){return bodyElement.type==="DeclareExportAllDeclaration"||bodyElement.type==="DeclareExportDeclaration"&&(!bodyElement.declaration||bodyElement.declaration.type!=="TypeAlias"&&bodyElement.declaration.type!=="InterfaceDeclaration");}function hasTypeImportKind(node){return node.importKind==="type"||node.importKind==="typeof";}const exportSuggestions={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function partition(list,test){const list1=[];const list2=[];for(let i=0;iclass FlowParserMixin extends superClass{constructor(...args){super(...args);this.flowPragma=undefined;}getScopeHandler(){return FlowScopeHandler;}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow";}finishToken(type,val){if(type!==134&&type!==13&&type!==28){if(this.flowPragma===undefined){this.flowPragma=null;}}super.finishToken(type,val);}addComment(comment){if(this.flowPragma===undefined){const matches=FLOW_PRAGMA_REGEX.exec(comment.value);if(!matches);else if(matches[1]==="flow"){this.flowPragma="flow";}else if(matches[1]==="noflow"){this.flowPragma="noflow";}else{throw new Error("Unexpected flow pragma");}}super.addComment(comment);}flowParseTypeInitialiser(tok){const oldInType=this.state.inType;this.state.inType=true;this.expect(tok||14);const type=this.flowParseType();this.state.inType=oldInType;return type;}flowParsePredicate(){const node=this.startNode();const moduloLoc=this.state.startLoc;this.next();this.expectContextual(110);if(this.state.lastTokStartLoc.index>moduloLoc.index+1){this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks,moduloLoc);}if(this.eat(10)){node.value=super.parseExpression();this.expect(11);return this.finishNode(node,"DeclaredPredicate");}else{return this.finishNode(node,"InferredPredicate");}}flowParseTypeAndPredicateInitialiser(){const oldInType=this.state.inType;this.state.inType=true;this.expect(14);let type=null;let predicate=null;if(this.match(54)){this.state.inType=oldInType;predicate=this.flowParsePredicate();}else{type=this.flowParseType();this.state.inType=oldInType;if(this.match(54)){predicate=this.flowParsePredicate();}}return[type,predicate];}flowParseDeclareClass(node){this.next();this.flowParseInterfaceish(node,true);return this.finishNode(node,"DeclareClass");}flowParseDeclareFunction(node){this.next();const id=node.id=this.parseIdentifier();const typeNode=this.startNode();const typeContainer=this.startNode();if(this.match(47)){typeNode.typeParameters=this.flowParseTypeParameterDeclaration();}else{typeNode.typeParameters=null;}this.expect(10);const tmp=this.flowParseFunctionTypeParams();typeNode.params=tmp.params;typeNode.rest=tmp.rest;typeNode.this=tmp._this;this.expect(11);[typeNode.returnType,node.predicate]=this.flowParseTypeAndPredicateInitialiser();typeContainer.typeAnnotation=this.finishNode(typeNode,"FunctionTypeAnnotation");id.typeAnnotation=this.finishNode(typeContainer,"TypeAnnotation");this.resetEndLocation(id);this.semicolon();this.scope.declareName(node.id.name,2048,node.id.loc.start);return this.finishNode(node,"DeclareFunction");}flowParseDeclare(node,insideModule){if(this.match(80)){return this.flowParseDeclareClass(node);}else if(this.match(68)){return this.flowParseDeclareFunction(node);}else if(this.match(74)){return this.flowParseDeclareVariable(node);}else if(this.eatContextual(127)){if(this.match(16)){return this.flowParseDeclareModuleExports(node);}else{if(insideModule){this.raise(FlowErrors.NestedDeclareModule,this.state.lastTokStartLoc);}return this.flowParseDeclareModule(node);}}else if(this.isContextual(130)){return this.flowParseDeclareTypeAlias(node);}else if(this.isContextual(131)){return this.flowParseDeclareOpaqueType(node);}else if(this.isContextual(129)){return this.flowParseDeclareInterface(node);}else if(this.match(82)){return this.flowParseDeclareExportDeclaration(node,insideModule);}else{this.unexpected();}}flowParseDeclareVariable(node){this.next();node.id=this.flowParseTypeAnnotatableIdentifier(true);this.scope.declareName(node.id.name,5,node.id.loc.start);this.semicolon();return this.finishNode(node,"DeclareVariable");}flowParseDeclareModule(node){this.scope.enter(0);if(this.match(134)){node.id=super.parseExprAtom();}else{node.id=this.parseIdentifier();}const bodyNode=node.body=this.startNode();const body=bodyNode.body=[];this.expect(5);while(!this.match(8)){let bodyNode=this.startNode();if(this.match(83)){this.next();if(!this.isContextual(130)&&!this.match(87)){this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc);}super.parseImport(bodyNode);}else{this.expectContextual(125,FlowErrors.UnsupportedStatementInDeclareModule);bodyNode=this.flowParseDeclare(bodyNode,true);}body.push(bodyNode);}this.scope.exit();this.expect(8);this.finishNode(bodyNode,"BlockStatement");let kind=null;let hasModuleExport=false;body.forEach(bodyElement=>{if(isEsModuleType(bodyElement)){if(kind==="CommonJS"){this.raise(FlowErrors.AmbiguousDeclareModuleKind,bodyElement);}kind="ES";}else if(bodyElement.type==="DeclareModuleExports"){if(hasModuleExport){this.raise(FlowErrors.DuplicateDeclareModuleExports,bodyElement);}if(kind==="ES"){this.raise(FlowErrors.AmbiguousDeclareModuleKind,bodyElement);}kind="CommonJS";hasModuleExport=true;}});node.kind=kind||"CommonJS";return this.finishNode(node,"DeclareModule");}flowParseDeclareExportDeclaration(node,insideModule){this.expect(82);if(this.eat(65)){if(this.match(68)||this.match(80)){node.declaration=this.flowParseDeclare(this.startNode());}else{node.declaration=this.flowParseType();this.semicolon();}node.default=true;return this.finishNode(node,"DeclareExportDeclaration");}else{if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!insideModule){const label=this.state.value;throw this.raise(FlowErrors.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:label,suggestion:exportSuggestions[label]});}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131)){node.declaration=this.flowParseDeclare(this.startNode());node.default=false;return this.finishNode(node,"DeclareExportDeclaration");}else if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131)){node=this.parseExport(node,null);if(node.type==="ExportNamedDeclaration"){node.default=false;delete node.exportKind;return this.castNodeTo(node,"DeclareExportDeclaration");}else{return this.castNodeTo(node,"DeclareExportAllDeclaration");}}}this.unexpected();}flowParseDeclareModuleExports(node){this.next();this.expectContextual(111);node.typeAnnotation=this.flowParseTypeAnnotation();this.semicolon();return this.finishNode(node,"DeclareModuleExports");}flowParseDeclareTypeAlias(node){this.next();const finished=this.flowParseTypeAlias(node);this.castNodeTo(finished,"DeclareTypeAlias");return finished;}flowParseDeclareOpaqueType(node){this.next();const finished=this.flowParseOpaqueType(node,true);this.castNodeTo(finished,"DeclareOpaqueType");return finished;}flowParseDeclareInterface(node){this.next();this.flowParseInterfaceish(node,false);return this.finishNode(node,"DeclareInterface");}flowParseInterfaceish(node,isClass){node.id=this.flowParseRestrictedIdentifier(!isClass,true);this.scope.declareName(node.id.name,isClass?17:8201,node.id.loc.start);if(this.match(47)){node.typeParameters=this.flowParseTypeParameterDeclaration();}else{node.typeParameters=null;}node.extends=[];if(this.eat(81)){do{node.extends.push(this.flowParseInterfaceExtends());}while(!isClass&&this.eat(12));}if(isClass){node.implements=[];node.mixins=[];if(this.eatContextual(117)){do{node.mixins.push(this.flowParseInterfaceExtends());}while(this.eat(12));}if(this.eatContextual(113)){do{node.implements.push(this.flowParseInterfaceExtends());}while(this.eat(12));}}node.body=this.flowParseObjectType({allowStatic:isClass,allowExact:false,allowSpread:false,allowProto:isClass,allowInexact:false});}flowParseInterfaceExtends(){const node=this.startNode();node.id=this.flowParseQualifiedTypeIdentifier();if(this.match(47)){node.typeParameters=this.flowParseTypeParameterInstantiation();}else{node.typeParameters=null;}return this.finishNode(node,"InterfaceExtends");}flowParseInterface(node){this.flowParseInterfaceish(node,false);return this.finishNode(node,"InterfaceDeclaration");}checkNotUnderscore(word){if(word==="_"){this.raise(FlowErrors.UnexpectedReservedUnderscore,this.state.startLoc);}}checkReservedType(word,startLoc,declaration){if(!reservedTypes.has(word))return;this.raise(declaration?FlowErrors.AssignReservedType:FlowErrors.UnexpectedReservedType,startLoc,{reservedType:word});}flowParseRestrictedIdentifier(liberal,declaration){this.checkReservedType(this.state.value,this.state.startLoc,declaration);return this.parseIdentifier(liberal);}flowParseTypeAlias(node){node.id=this.flowParseRestrictedIdentifier(false,true);this.scope.declareName(node.id.name,8201,node.id.loc.start);if(this.match(47)){node.typeParameters=this.flowParseTypeParameterDeclaration();}else{node.typeParameters=null;}node.right=this.flowParseTypeInitialiser(29);this.semicolon();return this.finishNode(node,"TypeAlias");}flowParseOpaqueType(node,declare){this.expectContextual(130);node.id=this.flowParseRestrictedIdentifier(true,true);this.scope.declareName(node.id.name,8201,node.id.loc.start);if(this.match(47)){node.typeParameters=this.flowParseTypeParameterDeclaration();}else{node.typeParameters=null;}node.supertype=null;if(this.match(14)){node.supertype=this.flowParseTypeInitialiser(14);}node.impltype=null;if(!declare){node.impltype=this.flowParseTypeInitialiser(29);}this.semicolon();return this.finishNode(node,"OpaqueType");}flowParseTypeParameter(requireDefault=false){const nodeStartLoc=this.state.startLoc;const node=this.startNode();const variance=this.flowParseVariance();const ident=this.flowParseTypeAnnotatableIdentifier();node.name=ident.name;node.variance=variance;node.bound=ident.typeAnnotation;if(this.match(29)){this.eat(29);node.default=this.flowParseType();}else{if(requireDefault){this.raise(FlowErrors.MissingTypeParamDefault,nodeStartLoc);}}return this.finishNode(node,"TypeParameter");}flowParseTypeParameterDeclaration(){const oldInType=this.state.inType;const node=this.startNode();node.params=[];this.state.inType=true;if(this.match(47)||this.match(143)){this.next();}else{this.unexpected();}let defaultRequired=false;do{const typeParameter=this.flowParseTypeParameter(defaultRequired);node.params.push(typeParameter);if(typeParameter.default){defaultRequired=true;}if(!this.match(48)){this.expect(12);}}while(!this.match(48));this.expect(48);this.state.inType=oldInType;return this.finishNode(node,"TypeParameterDeclaration");}flowInTopLevelContext(cb){if(this.curContext()!==types.brace){const oldContext=this.state.context;this.state.context=[oldContext[0]];try{return cb();}finally{this.state.context=oldContext;}}else{return cb();}}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()!==47)return;return this.flowParseTypeParameterInstantiation();}flowParseTypeParameterInstantiation(){const node=this.startNode();const oldInType=this.state.inType;this.state.inType=true;node.params=[];this.flowInTopLevelContext(()=>{this.expect(47);const oldNoAnonFunctionType=this.state.noAnonFunctionType;this.state.noAnonFunctionType=false;while(!this.match(48)){node.params.push(this.flowParseType());if(!this.match(48)){this.expect(12);}}this.state.noAnonFunctionType=oldNoAnonFunctionType;});this.state.inType=oldInType;if(!this.state.inType&&this.curContext()===types.brace){this.reScan_lt_gt();}this.expect(48);return this.finishNode(node,"TypeParameterInstantiation");}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return;const node=this.startNode();const oldInType=this.state.inType;node.params=[];this.state.inType=true;this.expect(47);while(!this.match(48)){node.params.push(this.flowParseTypeOrImplicitInstantiation());if(!this.match(48)){this.expect(12);}}this.expect(48);this.state.inType=oldInType;return this.finishNode(node,"TypeParameterInstantiation");}flowParseInterfaceType(){const node=this.startNode();this.expectContextual(129);node.extends=[];if(this.eat(81)){do{node.extends.push(this.flowParseInterfaceExtends());}while(this.eat(12));}node.body=this.flowParseObjectType({allowStatic:false,allowExact:false,allowSpread:false,allowProto:false,allowInexact:false});return this.finishNode(node,"InterfaceTypeAnnotation");}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(true);}flowParseObjectTypeIndexer(node,isStatic,variance){node.static=isStatic;if(this.lookahead().type===14){node.id=this.flowParseObjectPropertyKey();node.key=this.flowParseTypeInitialiser();}else{node.id=null;node.key=this.flowParseType();}this.expect(3);node.value=this.flowParseTypeInitialiser();node.variance=variance;return this.finishNode(node,"ObjectTypeIndexer");}flowParseObjectTypeInternalSlot(node,isStatic){node.static=isStatic;node.id=this.flowParseObjectPropertyKey();this.expect(3);this.expect(3);if(this.match(47)||this.match(10)){node.method=true;node.optional=false;node.value=this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start));}else{node.method=false;if(this.eat(17)){node.optional=true;}node.value=this.flowParseTypeInitialiser();}return this.finishNode(node,"ObjectTypeInternalSlot");}flowParseObjectTypeMethodish(node){node.params=[];node.rest=null;node.typeParameters=null;node.this=null;if(this.match(47)){node.typeParameters=this.flowParseTypeParameterDeclaration();}this.expect(10);if(this.match(78)){node.this=this.flowParseFunctionTypeParam(true);node.this.name=null;if(!this.match(11)){this.expect(12);}}while(!this.match(11)&&!this.match(21)){node.params.push(this.flowParseFunctionTypeParam(false));if(!this.match(11)){this.expect(12);}}if(this.eat(21)){node.rest=this.flowParseFunctionTypeParam(false);}this.expect(11);node.returnType=this.flowParseTypeInitialiser();return this.finishNode(node,"FunctionTypeAnnotation");}flowParseObjectTypeCallProperty(node,isStatic){const valueNode=this.startNode();node.static=isStatic;node.value=this.flowParseObjectTypeMethodish(valueNode);return this.finishNode(node,"ObjectTypeCallProperty");}flowParseObjectType({allowStatic,allowExact,allowSpread,allowProto,allowInexact}){const oldInType=this.state.inType;this.state.inType=true;const nodeStart=this.startNode();nodeStart.callProperties=[];nodeStart.properties=[];nodeStart.indexers=[];nodeStart.internalSlots=[];let endDelim;let exact;let inexact=false;if(allowExact&&this.match(6)){this.expect(6);endDelim=9;exact=true;}else{this.expect(5);endDelim=8;exact=false;}nodeStart.exact=exact;while(!this.match(endDelim)){let isStatic=false;let protoStartLoc=null;let inexactStartLoc=null;const node=this.startNode();if(allowProto&&this.isContextual(118)){const lookahead=this.lookahead();if(lookahead.type!==14&&lookahead.type!==17){this.next();protoStartLoc=this.state.startLoc;allowStatic=false;}}if(allowStatic&&this.isContextual(106)){const lookahead=this.lookahead();if(lookahead.type!==14&&lookahead.type!==17){this.next();isStatic=true;}}const variance=this.flowParseVariance();if(this.eat(0)){if(protoStartLoc!=null){this.unexpected(protoStartLoc);}if(this.eat(0)){if(variance){this.unexpected(variance.loc.start);}nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node,isStatic));}else{nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node,isStatic,variance));}}else if(this.match(10)||this.match(47)){if(protoStartLoc!=null){this.unexpected(protoStartLoc);}if(variance){this.unexpected(variance.loc.start);}nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node,isStatic));}else{let kind="init";if(this.isContextual(99)||this.isContextual(104)){const lookahead=this.lookahead();if(tokenIsLiteralPropertyName(lookahead.type)){kind=this.state.value;this.next();}}const propOrInexact=this.flowParseObjectTypeProperty(node,isStatic,protoStartLoc,variance,kind,allowSpread,allowInexact!=null?allowInexact:!exact);if(propOrInexact===null){inexact=true;inexactStartLoc=this.state.lastTokStartLoc;}else{nodeStart.properties.push(propOrInexact);}}this.flowObjectTypeSemicolon();if(inexactStartLoc&&!this.match(8)&&!this.match(9)){this.raise(FlowErrors.UnexpectedExplicitInexactInObject,inexactStartLoc);}}this.expect(endDelim);if(allowSpread){nodeStart.inexact=inexact;}const out=this.finishNode(nodeStart,"ObjectTypeAnnotation");this.state.inType=oldInType;return out;}flowParseObjectTypeProperty(node,isStatic,protoStartLoc,variance,kind,allowSpread,allowInexact){if(this.eat(21)){const isInexactToken=this.match(12)||this.match(13)||this.match(8)||this.match(9);if(isInexactToken){if(!allowSpread){this.raise(FlowErrors.InexactInsideNonObject,this.state.lastTokStartLoc);}else if(!allowInexact){this.raise(FlowErrors.InexactInsideExact,this.state.lastTokStartLoc);}if(variance){this.raise(FlowErrors.InexactVariance,variance);}return null;}if(!allowSpread){this.raise(FlowErrors.UnexpectedSpreadType,this.state.lastTokStartLoc);}if(protoStartLoc!=null){this.unexpected(protoStartLoc);}if(variance){this.raise(FlowErrors.SpreadVariance,variance);}node.argument=this.flowParseType();return this.finishNode(node,"ObjectTypeSpreadProperty");}else{node.key=this.flowParseObjectPropertyKey();node.static=isStatic;node.proto=protoStartLoc!=null;node.kind=kind;let optional=false;if(this.match(47)||this.match(10)){node.method=true;if(protoStartLoc!=null){this.unexpected(protoStartLoc);}if(variance){this.unexpected(variance.loc.start);}node.value=this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start));if(kind==="get"||kind==="set"){this.flowCheckGetterSetterParams(node);}if(!allowSpread&&node.key.name==="constructor"&&node.value.this){this.raise(FlowErrors.ThisParamBannedInConstructor,node.value.this);}}else{if(kind!=="init")this.unexpected();node.method=false;if(this.eat(17)){optional=true;}node.value=this.flowParseTypeInitialiser();node.variance=variance;}node.optional=optional;return this.finishNode(node,"ObjectTypeProperty");}}flowCheckGetterSetterParams(property){const paramCount=property.kind==="get"?0:1;const length=property.value.params.length+(property.value.rest?1:0);if(property.value.this){this.raise(property.kind==="get"?FlowErrors.GetterMayNotHaveThisParam:FlowErrors.SetterMayNotHaveThisParam,property.value.this);}if(length!==paramCount){this.raise(property.kind==="get"?Errors.BadGetterArity:Errors.BadSetterArity,property);}if(property.kind==="set"&&property.value.rest){this.raise(Errors.BadSetterRestParameter,property);}}flowObjectTypeSemicolon(){if(!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)){this.unexpected();}}flowParseQualifiedTypeIdentifier(startLoc,id){startLoc!=null?startLoc:startLoc=this.state.startLoc;let node=id||this.flowParseRestrictedIdentifier(true);while(this.eat(16)){const node2=this.startNodeAt(startLoc);node2.qualification=node;node2.id=this.flowParseRestrictedIdentifier(true);node=this.finishNode(node2,"QualifiedTypeIdentifier");}return node;}flowParseGenericType(startLoc,id){const node=this.startNodeAt(startLoc);node.typeParameters=null;node.id=this.flowParseQualifiedTypeIdentifier(startLoc,id);if(this.match(47)){node.typeParameters=this.flowParseTypeParameterInstantiation();}return this.finishNode(node,"GenericTypeAnnotation");}flowParseTypeofType(){const node=this.startNode();this.expect(87);node.argument=this.flowParsePrimaryType();return this.finishNode(node,"TypeofTypeAnnotation");}flowParseTupleType(){const node=this.startNode();node.types=[];this.expect(0);while(this.state.possuper.parseFunctionBody(node,true,isMethod));return;}super.parseFunctionBody(node,false,isMethod);}parseFunctionBodyAndFinish(node,type,isMethod=false){if(this.match(14)){const typeNode=this.startNode();[typeNode.typeAnnotation,node.predicate]=this.flowParseTypeAndPredicateInitialiser();node.returnType=typeNode.typeAnnotation?this.finishNode(typeNode,"TypeAnnotation"):null;}return super.parseFunctionBodyAndFinish(node,type,isMethod);}parseStatementLike(flags){if(this.state.strict&&this.isContextual(129)){const lookahead=this.lookahead();if(tokenIsKeywordOrIdentifier(lookahead.type)){const node=this.startNode();this.next();return this.flowParseInterface(node);}}else if(this.isContextual(126)){const node=this.startNode();this.next();return this.flowParseEnumDeclaration(node);}const stmt=super.parseStatementLike(flags);if(this.flowPragma===undefined&&!this.isValidDirective(stmt)){this.flowPragma=null;}return stmt;}parseExpressionStatement(node,expr,decorators){if(expr.type==="Identifier"){if(expr.name==="declare"){if(this.match(80)||tokenIsIdentifier(this.state.type)||this.match(68)||this.match(74)||this.match(82)){return this.flowParseDeclare(node);}}else if(tokenIsIdentifier(this.state.type)){if(expr.name==="interface"){return this.flowParseInterface(node);}else if(expr.name==="type"){return this.flowParseTypeAlias(node);}else if(expr.name==="opaque"){return this.flowParseOpaqueType(node,false);}}}return super.parseExpressionStatement(node,expr,decorators);}shouldParseExportDeclaration(){const{type}=this.state;if(type===126||tokenIsFlowInterfaceOrTypeOrOpaque(type)){return!this.state.containsEsc;}return super.shouldParseExportDeclaration();}isExportDefaultSpecifier(){const{type}=this.state;if(type===126||tokenIsFlowInterfaceOrTypeOrOpaque(type)){return this.state.containsEsc;}return super.isExportDefaultSpecifier();}parseExportDefaultExpression(){if(this.isContextual(126)){const node=this.startNode();this.next();return this.flowParseEnumDeclaration(node);}return super.parseExportDefaultExpression();}parseConditional(expr,startLoc,refExpressionErrors){if(!this.match(17))return expr;if(this.state.maybeInArrowParameters){const nextCh=this.lookaheadCharCode();if(nextCh===44||nextCh===61||nextCh===58||nextCh===41){this.setOptionalParametersError(refExpressionErrors);return expr;}}this.expect(17);const state=this.state.clone();const originalNoArrowAt=this.state.noArrowAt;const node=this.startNodeAt(startLoc);let{consequent,failed}=this.tryParseConditionalConsequent();let[valid,invalid]=this.getArrowLikeExpressions(consequent);if(failed||invalid.length>0){const noArrowAt=[...originalNoArrowAt];if(invalid.length>0){this.state=state;this.state.noArrowAt=noArrowAt;for(let i=0;i1){this.raise(FlowErrors.AmbiguousConditionalArrow,state.startLoc);}if(failed&&valid.length===1){this.state=state;noArrowAt.push(valid[0].start);this.state.noArrowAt=noArrowAt;({consequent,failed}=this.tryParseConditionalConsequent());}}this.getArrowLikeExpressions(consequent,true);this.state.noArrowAt=originalNoArrowAt;this.expect(14);node.test=expr;node.consequent=consequent;node.alternate=this.forwardNoArrowParamsConversionAt(node,()=>this.parseMaybeAssign(undefined,undefined));return this.finishNode(node,"ConditionalExpression");}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const consequent=this.parseMaybeAssignAllowIn();const failed=!this.match(14);this.state.noArrowParamsConversionAt.pop();return{consequent,failed};}getArrowLikeExpressions(node,disallowInvalid){const stack=[node];const arrows=[];while(stack.length!==0){const node=stack.pop();if(node.type==="ArrowFunctionExpression"&&node.body.type!=="BlockStatement"){if(node.typeParameters||!node.returnType){this.finishArrowValidation(node);}else{arrows.push(node);}stack.push(node.body);}else if(node.type==="ConditionalExpression"){stack.push(node.consequent);stack.push(node.alternate);}}if(disallowInvalid){arrows.forEach(node=>this.finishArrowValidation(node));return[arrows,[]];}return partition(arrows,node=>node.params.every(param=>this.isAssignable(param,true)));}finishArrowValidation(node){var _node$extra;this.toAssignableList(node.params,(_node$extra=node.extra)==null?void 0:_node$extra.trailingCommaLoc,false);this.scope.enter(2|4);super.checkParams(node,false,true);this.scope.exit();}forwardNoArrowParamsConversionAt(node,parse){let result;if(this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))){this.state.noArrowParamsConversionAt.push(this.state.start);result=parse();this.state.noArrowParamsConversionAt.pop();}else{result=parse();}return result;}parseParenItem(node,startLoc){const newNode=super.parseParenItem(node,startLoc);if(this.eat(17)){newNode.optional=true;this.resetEndLocation(node);}if(this.match(14)){const typeCastNode=this.startNodeAt(startLoc);typeCastNode.expression=newNode;typeCastNode.typeAnnotation=this.flowParseTypeAnnotation();return this.finishNode(typeCastNode,"TypeCastExpression");}return newNode;}assertModuleNodeAllowed(node){if(node.type==="ImportDeclaration"&&(node.importKind==="type"||node.importKind==="typeof")||node.type==="ExportNamedDeclaration"&&node.exportKind==="type"||node.type==="ExportAllDeclaration"&&node.exportKind==="type"){return;}super.assertModuleNodeAllowed(node);}parseExportDeclaration(node){if(this.isContextual(130)){node.exportKind="type";const declarationNode=this.startNode();this.next();if(this.match(5)){node.specifiers=this.parseExportSpecifiers(true);super.parseExportFrom(node);return null;}else{return this.flowParseTypeAlias(declarationNode);}}else if(this.isContextual(131)){node.exportKind="type";const declarationNode=this.startNode();this.next();return this.flowParseOpaqueType(declarationNode,false);}else if(this.isContextual(129)){node.exportKind="type";const declarationNode=this.startNode();this.next();return this.flowParseInterface(declarationNode);}else if(this.isContextual(126)){node.exportKind="value";const declarationNode=this.startNode();this.next();return this.flowParseEnumDeclaration(declarationNode);}else{return super.parseExportDeclaration(node);}}eatExportStar(node){if(super.eatExportStar(node))return true;if(this.isContextual(130)&&this.lookahead().type===55){node.exportKind="type";this.next();this.next();return true;}return false;}maybeParseExportNamespaceSpecifier(node){const{startLoc}=this.state;const hasNamespace=super.maybeParseExportNamespaceSpecifier(node);if(hasNamespace&&node.exportKind==="type"){this.unexpected(startLoc);}return hasNamespace;}parseClassId(node,isStatement,optionalId){super.parseClassId(node,isStatement,optionalId);if(this.match(47)){node.typeParameters=this.flowParseTypeParameterDeclaration();}}parseClassMember(classBody,member,state){const{startLoc}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(classBody,member)){return;}member.declare=true;}super.parseClassMember(classBody,member,state);if(member.declare){if(member.type!=="ClassProperty"&&member.type!=="ClassPrivateProperty"&&member.type!=="PropertyDefinition"){this.raise(FlowErrors.DeclareClassElement,startLoc);}else if(member.value){this.raise(FlowErrors.DeclareClassFieldInitializer,member.value);}}}isIterator(word){return word==="iterator"||word==="asyncIterator";}readIterator(){const word=super.readWord1();const fullWord="@@"+word;if(!this.isIterator(word)||!this.state.inType){this.raise(Errors.InvalidIdentifier,this.state.curPosition(),{identifierName:fullWord});}this.finishToken(132,fullWord);}getTokenFromCode(code){const next=this.input.charCodeAt(this.state.pos+1);if(code===123&&next===124){this.finishOp(6,2);}else if(this.state.inType&&(code===62||code===60)){this.finishOp(code===62?48:47,1);}else if(this.state.inType&&code===63){if(next===46){this.finishOp(18,2);}else{this.finishOp(17,1);}}else if(isIteratorStart(code,next,this.input.charCodeAt(this.state.pos+2))){this.state.pos+=2;this.readIterator();}else{super.getTokenFromCode(code);}}isAssignable(node,isBinding){if(node.type==="TypeCastExpression"){return this.isAssignable(node.expression,isBinding);}else{return super.isAssignable(node,isBinding);}}toAssignable(node,isLHS=false){if(!isLHS&&node.type==="AssignmentExpression"&&node.left.type==="TypeCastExpression"){node.left=this.typeCastToParameter(node.left);}super.toAssignable(node,isLHS);}toAssignableList(exprList,trailingCommaLoc,isLHS){for(let i=0;i1||!isParenthesizedExpr)){this.raise(FlowErrors.TypeCastInPattern,expr.typeAnnotation);}}return exprList;}parseArrayLike(close,canBePattern,isTuple,refExpressionErrors){const node=super.parseArrayLike(close,canBePattern,isTuple,refExpressionErrors);if(canBePattern&&!this.state.maybeInArrowParameters){this.toReferencedList(node.elements);}return node;}isValidLVal(type,isParenthesized,binding){return type==="TypeCastExpression"||super.isValidLVal(type,isParenthesized,binding);}parseClassProperty(node){if(this.match(14)){node.typeAnnotation=this.flowParseTypeAnnotation();}return super.parseClassProperty(node);}parseClassPrivateProperty(node){if(this.match(14)){node.typeAnnotation=this.flowParseTypeAnnotation();}return super.parseClassPrivateProperty(node);}isClassMethod(){return this.match(47)||super.isClassMethod();}isClassProperty(){return this.match(14)||super.isClassProperty();}isNonstaticConstructor(method){return!this.match(14)&&super.isNonstaticConstructor(method);}pushClassMethod(classBody,method,isGenerator,isAsync,isConstructor,allowsDirectSuper){if(method.variance){this.unexpected(method.variance.loc.start);}delete method.variance;if(this.match(47)){method.typeParameters=this.flowParseTypeParameterDeclaration();}super.pushClassMethod(classBody,method,isGenerator,isAsync,isConstructor,allowsDirectSuper);if(method.params&&isConstructor){const params=method.params;if(params.length>0&&this.isThisParam(params[0])){this.raise(FlowErrors.ThisParamBannedInConstructor,method);}}else if(method.type==="MethodDefinition"&&isConstructor&&method.value.params){const params=method.value.params;if(params.length>0&&this.isThisParam(params[0])){this.raise(FlowErrors.ThisParamBannedInConstructor,method);}}}pushClassPrivateMethod(classBody,method,isGenerator,isAsync){if(method.variance){this.unexpected(method.variance.loc.start);}delete method.variance;if(this.match(47)){method.typeParameters=this.flowParseTypeParameterDeclaration();}super.pushClassPrivateMethod(classBody,method,isGenerator,isAsync);}parseClassSuper(node){super.parseClassSuper(node);if(node.superClass&&(this.match(47)||this.match(51))){{node.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression();}}if(this.isContextual(113)){this.next();const implemented=node.implements=[];do{const node=this.startNode();node.id=this.flowParseRestrictedIdentifier(true);if(this.match(47)){node.typeParameters=this.flowParseTypeParameterInstantiation();}else{node.typeParameters=null;}implemented.push(this.finishNode(node,"ClassImplements"));}while(this.eat(12));}}checkGetterSetterParams(method){super.checkGetterSetterParams(method);const params=this.getObjectOrClassMethodParams(method);if(params.length>0){const param=params[0];if(this.isThisParam(param)&&method.kind==="get"){this.raise(FlowErrors.GetterMayNotHaveThisParam,param);}else if(this.isThisParam(param)){this.raise(FlowErrors.SetterMayNotHaveThisParam,param);}}}parsePropertyNamePrefixOperator(node){node.variance=this.flowParseVariance();}parseObjPropValue(prop,startLoc,isGenerator,isAsync,isPattern,isAccessor,refExpressionErrors){if(prop.variance){this.unexpected(prop.variance.loc.start);}delete prop.variance;let typeParameters;if(this.match(47)&&!isAccessor){typeParameters=this.flowParseTypeParameterDeclaration();if(!this.match(10))this.unexpected();}const result=super.parseObjPropValue(prop,startLoc,isGenerator,isAsync,isPattern,isAccessor,refExpressionErrors);if(typeParameters){(result.value||result).typeParameters=typeParameters;}return result;}parseFunctionParamType(param){if(this.eat(17)){if(param.type!=="Identifier"){this.raise(FlowErrors.PatternIsOptional,param);}if(this.isThisParam(param)){this.raise(FlowErrors.ThisParamMayNotBeOptional,param);}param.optional=true;}if(this.match(14)){param.typeAnnotation=this.flowParseTypeAnnotation();}else if(this.isThisParam(param)){this.raise(FlowErrors.ThisParamAnnotationRequired,param);}if(this.match(29)&&this.isThisParam(param)){this.raise(FlowErrors.ThisParamNoDefault,param);}this.resetEndLocation(param);return param;}parseMaybeDefault(startLoc,left){const node=super.parseMaybeDefault(startLoc,left);if(node.type==="AssignmentPattern"&&node.typeAnnotation&&node.right.startsuper.parseMaybeAssign(refExpressionErrors,afterLeftParse),state);if(!jsx.error)return jsx.node;const{context}=this.state;const currentContext=context[context.length-1];if(currentContext===types.j_oTag||currentContext===types.j_expr){context.pop();}}if((_jsx=jsx)!=null&&_jsx.error||this.match(47)){var _jsx2,_jsx3;state=state||this.state.clone();let typeParameters;const arrow=this.tryParse(abort=>{var _arrowExpression$extr;typeParameters=this.flowParseTypeParameterDeclaration();const arrowExpression=this.forwardNoArrowParamsConversionAt(typeParameters,()=>{const result=super.parseMaybeAssign(refExpressionErrors,afterLeftParse);this.resetStartLocationFromNode(result,typeParameters);return result;});if((_arrowExpression$extr=arrowExpression.extra)!=null&&_arrowExpression$extr.parenthesized)abort();const expr=this.maybeUnwrapTypeCastExpression(arrowExpression);if(expr.type!=="ArrowFunctionExpression")abort();expr.typeParameters=typeParameters;this.resetStartLocationFromNode(expr,typeParameters);return arrowExpression;},state);let arrowExpression=null;if(arrow.node&&this.maybeUnwrapTypeCastExpression(arrow.node).type==="ArrowFunctionExpression"){if(!arrow.error&&!arrow.aborted){if(arrow.node.async){this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction,typeParameters);}return arrow.node;}arrowExpression=arrow.node;}if((_jsx2=jsx)!=null&&_jsx2.node){this.state=jsx.failState;return jsx.node;}if(arrowExpression){this.state=arrow.failState;return arrowExpression;}if((_jsx3=jsx)!=null&&_jsx3.thrown)throw jsx.error;if(arrow.thrown)throw arrow.error;throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter,typeParameters);}return super.parseMaybeAssign(refExpressionErrors,afterLeftParse);}parseArrow(node){if(this.match(14)){const result=this.tryParse(()=>{const oldNoAnonFunctionType=this.state.noAnonFunctionType;this.state.noAnonFunctionType=true;const typeNode=this.startNode();[typeNode.typeAnnotation,node.predicate]=this.flowParseTypeAndPredicateInitialiser();this.state.noAnonFunctionType=oldNoAnonFunctionType;if(this.canInsertSemicolon())this.unexpected();if(!this.match(19))this.unexpected();return typeNode;});if(result.thrown)return null;if(result.error)this.state=result.failState;node.returnType=result.node.typeAnnotation?this.finishNode(result.node,"TypeAnnotation"):null;}return super.parseArrow(node);}shouldParseArrow(params){return this.match(14)||super.shouldParseArrow(params);}setArrowFunctionParameters(node,params){if(this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))){node.params=params;}else{super.setArrowFunctionParameters(node,params);}}checkParams(node,allowDuplicates,isArrowFunction,strictModeChanged=true){if(isArrowFunction&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))){return;}for(let i=0;i0){this.raise(FlowErrors.ThisParamMustBeFirst,node.params[i]);}}super.checkParams(node,allowDuplicates,isArrowFunction,strictModeChanged);}parseParenAndDistinguishExpression(canBeArrow){return super.parseParenAndDistinguishExpression(canBeArrow&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));}parseSubscripts(base,startLoc,noCalls){if(base.type==="Identifier"&&base.name==="async"&&this.state.noArrowAt.includes(startLoc.index)){this.next();const node=this.startNodeAt(startLoc);node.callee=base;node.arguments=super.parseCallExpressionArguments(11);base=this.finishNode(node,"CallExpression");}else if(base.type==="Identifier"&&base.name==="async"&&this.match(47)){const state=this.state.clone();const arrow=this.tryParse(abort=>this.parseAsyncArrowWithTypeParameters(startLoc)||abort(),state);if(!arrow.error&&!arrow.aborted)return arrow.node;const result=this.tryParse(()=>super.parseSubscripts(base,startLoc,noCalls),state);if(result.node&&!result.error)return result.node;if(arrow.node){this.state=arrow.failState;return arrow.node;}if(result.node){this.state=result.failState;return result.node;}throw arrow.error||result.error;}return super.parseSubscripts(base,startLoc,noCalls);}parseSubscript(base,startLoc,noCalls,subscriptState){if(this.match(18)&&this.isLookaheadToken_lt()){subscriptState.optionalChainMember=true;if(noCalls){subscriptState.stop=true;return base;}this.next();const node=this.startNodeAt(startLoc);node.callee=base;node.typeArguments=this.flowParseTypeParameterInstantiationInExpression();this.expect(10);node.arguments=this.parseCallExpressionArguments(11);node.optional=true;return this.finishCallExpression(node,true);}else if(!noCalls&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const node=this.startNodeAt(startLoc);node.callee=base;const result=this.tryParse(()=>{node.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew();this.expect(10);node.arguments=super.parseCallExpressionArguments(11);if(subscriptState.optionalChainMember){node.optional=false;}return this.finishCallExpression(node,subscriptState.optionalChainMember);});if(result.node){if(result.error)this.state=result.failState;return result.node;}}return super.parseSubscript(base,startLoc,noCalls,subscriptState);}parseNewCallee(node){super.parseNewCallee(node);let targs=null;if(this.shouldParseTypes()&&this.match(47)){targs=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node;}node.typeArguments=targs;}parseAsyncArrowWithTypeParameters(startLoc){const node=this.startNodeAt(startLoc);this.parseFunctionParams(node,false);if(!this.parseArrow(node))return;return super.parseArrowExpression(node,undefined,true);}readToken_mult_modulo(code){const next=this.input.charCodeAt(this.state.pos+1);if(code===42&&next===47&&this.state.hasFlowComment){this.state.hasFlowComment=false;this.state.pos+=2;this.nextToken();return;}super.readToken_mult_modulo(code);}readToken_pipe_amp(code){const next=this.input.charCodeAt(this.state.pos+1);if(code===124&&next===125){this.finishOp(9,2);return;}super.readToken_pipe_amp(code);}parseTopLevel(file,program){const fileNode=super.parseTopLevel(file,program);if(this.state.hasFlowComment){this.raise(FlowErrors.UnterminatedFlowComment,this.state.curPosition());}return fileNode;}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment){throw this.raise(FlowErrors.NestedFlowComment,this.state.startLoc);}this.hasFlowCommentCompletion();const commentSkip=this.skipFlowComment();if(commentSkip){this.state.pos+=commentSkip;this.state.hasFlowComment=true;}return;}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/");}skipFlowComment(){const{pos}=this.state;let shiftToFirstNonWhiteSpace=2;while([32,9].includes(this.input.charCodeAt(pos+shiftToFirstNonWhiteSpace))){shiftToFirstNonWhiteSpace++;}const ch2=this.input.charCodeAt(shiftToFirstNonWhiteSpace+pos);const ch3=this.input.charCodeAt(shiftToFirstNonWhiteSpace+pos+1);if(ch2===58&&ch3===58){return shiftToFirstNonWhiteSpace+2;}if(this.input.slice(shiftToFirstNonWhiteSpace+pos,shiftToFirstNonWhiteSpace+pos+12)==="flow-include"){return shiftToFirstNonWhiteSpace+12;}if(ch2===58&&ch3!==58){return shiftToFirstNonWhiteSpace;}return false;}hasFlowCommentCompletion(){const end=this.input.indexOf("*/",this.state.pos);if(end===-1){throw this.raise(Errors.UnterminatedComment,this.state.curPosition());}}flowEnumErrorBooleanMemberNotInitialized(loc,{enumName,memberName}){this.raise(FlowErrors.EnumBooleanMemberNotInitialized,loc,{memberName,enumName});}flowEnumErrorInvalidMemberInitializer(loc,enumContext){return this.raise(!enumContext.explicitType?FlowErrors.EnumInvalidMemberInitializerUnknownType:enumContext.explicitType==="symbol"?FlowErrors.EnumInvalidMemberInitializerSymbolType:FlowErrors.EnumInvalidMemberInitializerPrimaryType,loc,enumContext);}flowEnumErrorNumberMemberNotInitialized(loc,details){this.raise(FlowErrors.EnumNumberMemberNotInitialized,loc,details);}flowEnumErrorStringMemberInconsistentlyInitialized(node,details){this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized,node,details);}flowEnumMemberInit(){const startLoc=this.state.startLoc;const endOfInit=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const literal=this.parseNumericLiteral(this.state.value);if(endOfInit()){return{type:"number",loc:literal.loc.start,value:literal};}return{type:"invalid",loc:startLoc};}case 134:{const literal=this.parseStringLiteral(this.state.value);if(endOfInit()){return{type:"string",loc:literal.loc.start,value:literal};}return{type:"invalid",loc:startLoc};}case 85:case 86:{const literal=this.parseBooleanLiteral(this.match(85));if(endOfInit()){return{type:"boolean",loc:literal.loc.start,value:literal};}return{type:"invalid",loc:startLoc};}default:return{type:"invalid",loc:startLoc};}}flowEnumMemberRaw(){const loc=this.state.startLoc;const id=this.parseIdentifier(true);const init=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc};return{id,init};}flowEnumCheckExplicitTypeMismatch(loc,context,expectedType){const{explicitType}=context;if(explicitType===null){return;}if(explicitType!==expectedType){this.flowEnumErrorInvalidMemberInitializer(loc,context);}}flowEnumMembers({enumName,explicitType}){const seenNames=new Set();const members={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};let hasUnknownMembers=false;while(!this.match(8)){if(this.eat(21)){hasUnknownMembers=true;break;}const memberNode=this.startNode();const{id,init}=this.flowEnumMemberRaw();const memberName=id.name;if(memberName===""){continue;}if(/^[a-z]/.test(memberName)){this.raise(FlowErrors.EnumInvalidMemberName,id,{memberName,suggestion:memberName[0].toUpperCase()+memberName.slice(1),enumName});}if(seenNames.has(memberName)){this.raise(FlowErrors.EnumDuplicateMemberName,id,{memberName,enumName});}seenNames.add(memberName);const context={enumName,explicitType,memberName};memberNode.id=id;switch(init.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(init.loc,context,"boolean");memberNode.init=init.value;members.booleanMembers.push(this.finishNode(memberNode,"EnumBooleanMember"));break;}case"number":{this.flowEnumCheckExplicitTypeMismatch(init.loc,context,"number");memberNode.init=init.value;members.numberMembers.push(this.finishNode(memberNode,"EnumNumberMember"));break;}case"string":{this.flowEnumCheckExplicitTypeMismatch(init.loc,context,"string");memberNode.init=init.value;members.stringMembers.push(this.finishNode(memberNode,"EnumStringMember"));break;}case"invalid":{throw this.flowEnumErrorInvalidMemberInitializer(init.loc,context);}case"none":{switch(explicitType){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(init.loc,context);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(init.loc,context);break;default:members.defaultedMembers.push(this.finishNode(memberNode,"EnumDefaultedMember"));}}}if(!this.match(8)){this.expect(12);}}return{members,hasUnknownMembers};}flowEnumStringMembers(initializedMembers,defaultedMembers,{enumName}){if(initializedMembers.length===0){return defaultedMembers;}else if(defaultedMembers.length===0){return initializedMembers;}else if(defaultedMembers.length>initializedMembers.length){for(const member of initializedMembers){this.flowEnumErrorStringMemberInconsistentlyInitialized(member,{enumName});}return defaultedMembers;}else{for(const member of defaultedMembers){this.flowEnumErrorStringMemberInconsistentlyInitialized(member,{enumName});}return initializedMembers;}}flowEnumParseExplicitType({enumName}){if(!this.eatContextual(102))return null;if(!tokenIsIdentifier(this.state.type)){throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName});}const{value}=this.state;this.next();if(value!=="boolean"&&value!=="number"&&value!=="string"&&value!=="symbol"){this.raise(FlowErrors.EnumInvalidExplicitType,this.state.startLoc,{enumName,invalidEnumType:value});}return value;}flowEnumBody(node,id){const enumName=id.name;const nameLoc=id.loc.start;const explicitType=this.flowEnumParseExplicitType({enumName});this.expect(5);const{members,hasUnknownMembers}=this.flowEnumMembers({enumName,explicitType});node.hasUnknownMembers=hasUnknownMembers;switch(explicitType){case"boolean":node.explicitType=true;node.members=members.booleanMembers;this.expect(8);return this.finishNode(node,"EnumBooleanBody");case"number":node.explicitType=true;node.members=members.numberMembers;this.expect(8);return this.finishNode(node,"EnumNumberBody");case"string":node.explicitType=true;node.members=this.flowEnumStringMembers(members.stringMembers,members.defaultedMembers,{enumName});this.expect(8);return this.finishNode(node,"EnumStringBody");case"symbol":node.members=members.defaultedMembers;this.expect(8);return this.finishNode(node,"EnumSymbolBody");default:{const empty=()=>{node.members=[];this.expect(8);return this.finishNode(node,"EnumStringBody");};node.explicitType=false;const boolsLen=members.booleanMembers.length;const numsLen=members.numberMembers.length;const strsLen=members.stringMembers.length;const defaultedLen=members.defaultedMembers.length;if(!boolsLen&&!numsLen&&!strsLen&&!defaultedLen){return empty();}else if(!boolsLen&&!numsLen){node.members=this.flowEnumStringMembers(members.stringMembers,members.defaultedMembers,{enumName});this.expect(8);return this.finishNode(node,"EnumStringBody");}else if(!numsLen&&!strsLen&&boolsLen>=defaultedLen){for(const member of members.defaultedMembers){this.flowEnumErrorBooleanMemberNotInitialized(member.loc.start,{enumName,memberName:member.id.name});}node.members=members.booleanMembers;this.expect(8);return this.finishNode(node,"EnumBooleanBody");}else if(!boolsLen&&!strsLen&&numsLen>=defaultedLen){for(const member of members.defaultedMembers){this.flowEnumErrorNumberMemberNotInitialized(member.loc.start,{enumName,memberName:member.id.name});}node.members=members.numberMembers;this.expect(8);return this.finishNode(node,"EnumNumberBody");}else{this.raise(FlowErrors.EnumInconsistentMemberValues,nameLoc,{enumName});return empty();}}}}flowParseEnumDeclaration(node){const id=this.parseIdentifier();node.id=id;node.body=this.flowEnumBody(this.startNode(),id);return this.finishNode(node,"EnumDeclaration");}jsxParseOpeningElementAfterName(node){if(this.shouldParseTypes()){if(this.match(47)||this.match(51)){node.typeArguments=this.flowParseTypeParameterInstantiationInExpression();}}return super.jsxParseOpeningElementAfterName(node);}isLookaheadToken_lt(){const next=this.nextTokenStart();if(this.input.charCodeAt(next)===60){const afterNext=this.input.charCodeAt(next+1);return afterNext!==60&&afterNext!==61;}return false;}reScan_lt_gt(){const{type}=this.state;if(type===47){this.state.pos-=1;this.readToken_lt();}else if(type===48){this.state.pos-=1;this.readToken_gt();}}reScan_lt(){const{type}=this.state;if(type===51){this.state.pos-=2;this.finishOp(47,1);return 47;}return type;}maybeUnwrapTypeCastExpression(node){return node.type==="TypeCastExpression"?node.expression:node;}};const entities={__proto__:null,quot:"\u0022",amp:"&",apos:"\u0027",lt:"<",gt:">",nbsp:"\u00A0",iexcl:"\u00A1",cent:"\u00A2",pound:"\u00A3",curren:"\u00A4",yen:"\u00A5",brvbar:"\u00A6",sect:"\u00A7",uml:"\u00A8",copy:"\u00A9",ordf:"\u00AA",laquo:"\u00AB",not:"\u00AC",shy:"\u00AD",reg:"\u00AE",macr:"\u00AF",deg:"\u00B0",plusmn:"\u00B1",sup2:"\u00B2",sup3:"\u00B3",acute:"\u00B4",micro:"\u00B5",para:"\u00B6",middot:"\u00B7",cedil:"\u00B8",sup1:"\u00B9",ordm:"\u00BA",raquo:"\u00BB",frac14:"\u00BC",frac12:"\u00BD",frac34:"\u00BE",iquest:"\u00BF",Agrave:"\u00C0",Aacute:"\u00C1",Acirc:"\u00C2",Atilde:"\u00C3",Auml:"\u00C4",Aring:"\u00C5",AElig:"\u00C6",Ccedil:"\u00C7",Egrave:"\u00C8",Eacute:"\u00C9",Ecirc:"\u00CA",Euml:"\u00CB",Igrave:"\u00CC",Iacute:"\u00CD",Icirc:"\u00CE",Iuml:"\u00CF",ETH:"\u00D0",Ntilde:"\u00D1",Ograve:"\u00D2",Oacute:"\u00D3",Ocirc:"\u00D4",Otilde:"\u00D5",Ouml:"\u00D6",times:"\u00D7",Oslash:"\u00D8",Ugrave:"\u00D9",Uacute:"\u00DA",Ucirc:"\u00DB",Uuml:"\u00DC",Yacute:"\u00DD",THORN:"\u00DE",szlig:"\u00DF",agrave:"\u00E0",aacute:"\u00E1",acirc:"\u00E2",atilde:"\u00E3",auml:"\u00E4",aring:"\u00E5",aelig:"\u00E6",ccedil:"\u00E7",egrave:"\u00E8",eacute:"\u00E9",ecirc:"\u00EA",euml:"\u00EB",igrave:"\u00EC",iacute:"\u00ED",icirc:"\u00EE",iuml:"\u00EF",eth:"\u00F0",ntilde:"\u00F1",ograve:"\u00F2",oacute:"\u00F3",ocirc:"\u00F4",otilde:"\u00F5",ouml:"\u00F6",divide:"\u00F7",oslash:"\u00F8",ugrave:"\u00F9",uacute:"\u00FA",ucirc:"\u00FB",uuml:"\u00FC",yacute:"\u00FD",thorn:"\u00FE",yuml:"\u00FF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"};const lineBreak=/\r\n|[\r\n\u2028\u2029]/;const lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(code){switch(code){case 10:case 13:case 8232:case 8233:return true;default:return false;}}function hasNewLine(input,start,end){for(let i=start;i`Expected corresponding JSX closing tag for <${openingTagName}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected,HTMLEntity})=>`Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...>?"});function isFragment(object){return object?object.type==="JSXOpeningFragment"||object.type==="JSXClosingFragment":false;}function getQualifiedJSXName(object){if(object.type==="JSXIdentifier"){return object.name;}if(object.type==="JSXNamespacedName"){return object.namespace.name+":"+object.name.name;}if(object.type==="JSXMemberExpression"){return getQualifiedJSXName(object.object)+"."+getQualifiedJSXName(object.property);}throw new Error("Node had unexpected type: "+object.type);}var jsx=superClass=>class JSXParserMixin extends superClass{jsxReadToken(){let out="";let chunkStart=this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(JsxErrors.UnterminatedJsxContent,this.state.startLoc);}const ch=this.input.charCodeAt(this.state.pos);switch(ch){case 60:case 123:if(this.state.pos===this.state.start){if(ch===60&&this.state.canStartJSXElement){++this.state.pos;this.finishToken(143);}else{super.getTokenFromCode(ch);}return;}out+=this.input.slice(chunkStart,this.state.pos);this.finishToken(142,out);return;case 38:out+=this.input.slice(chunkStart,this.state.pos);out+=this.jsxReadEntity();chunkStart=this.state.pos;break;case 62:case 125:default:if(isNewLine(ch)){out+=this.input.slice(chunkStart,this.state.pos);out+=this.jsxReadNewLine(true);chunkStart=this.state.pos;}else{++this.state.pos;}}}}jsxReadNewLine(normalizeCRLF){const ch=this.input.charCodeAt(this.state.pos);let out;++this.state.pos;if(ch===13&&this.input.charCodeAt(this.state.pos)===10){++this.state.pos;out=normalizeCRLF?"\n":"\r\n";}else{out=String.fromCharCode(ch);}++this.state.curLine;this.state.lineStart=this.state.pos;return out;}jsxReadString(quote){let out="";let chunkStart=++this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(Errors.UnterminatedString,this.state.startLoc);}const ch=this.input.charCodeAt(this.state.pos);if(ch===quote)break;if(ch===38){out+=this.input.slice(chunkStart,this.state.pos);out+=this.jsxReadEntity();chunkStart=this.state.pos;}else if(isNewLine(ch)){out+=this.input.slice(chunkStart,this.state.pos);out+=this.jsxReadNewLine(false);chunkStart=this.state.pos;}else{++this.state.pos;}}out+=this.input.slice(chunkStart,this.state.pos++);this.finishToken(134,out);}jsxReadEntity(){const startPos=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let radix=10;if(this.codePointAtPos(this.state.pos)===120){radix=16;++this.state.pos;}const codePoint=this.readInt(radix,undefined,false,"bail");if(codePoint!==null&&this.codePointAtPos(this.state.pos)===59){++this.state.pos;return String.fromCodePoint(codePoint);}}else{let count=0;let semi=false;while(count++<10&&this.state.pos1){for(let i=0;i0){if(bindingType&256){const isConst=!!(bindingType&512);const wasConst=(type&4)>0;return isConst!==wasConst;}return true;}if(bindingType&128&&(type&8)>0){if(scope.names.get(name)&2){return!!(bindingType&1);}else{return false;}}if(bindingType&2&&(type&1)>0){return true;}return super.isRedeclaredInScope(scope,name,bindingType);}checkLocalExport(id){const{name}=id;if(this.hasImport(name))return;const len=this.scopeStack.length;for(let i=len-1;i>=0;i--){const scope=this.scopeStack[i];const type=scope.tsNames.get(name);if((type&1)>0||(type&16)>0){return;}}super.checkLocalExport(id);}}class ProductionParameterHandler{constructor(){this.stacks=[];}enter(flags){this.stacks.push(flags);}exit(){this.stacks.pop();}currentFlags(){return this.stacks[this.stacks.length-1];}get hasAwait(){return(this.currentFlags()&2)>0;}get hasYield(){return(this.currentFlags()&1)>0;}get hasReturn(){return(this.currentFlags()&4)>0;}get hasIn(){return(this.currentFlags()&8)>0;}}function functionFlags(isAsync,isGenerator){return(isAsync?2:0)|(isGenerator?1:0);}class BaseParser{constructor(){this.sawUnambiguousESM=false;this.ambiguousScriptDifferentAst=false;}sourceToOffsetPos(sourcePos){return sourcePos+this.startIndex;}offsetToSourcePos(offsetPos){return offsetPos-this.startIndex;}hasPlugin(pluginConfig){if(typeof pluginConfig==="string"){return this.plugins.has(pluginConfig);}else{const[pluginName,pluginOptions]=pluginConfig;if(!this.hasPlugin(pluginName)){return false;}const actualOptions=this.plugins.get(pluginName);for(const key of Object.keys(pluginOptions)){if((actualOptions==null?void 0:actualOptions[key])!==pluginOptions[key]){return false;}}return true;}}getPluginOption(plugin,name){var _this$plugins$get;return(_this$plugins$get=this.plugins.get(plugin))==null?void 0:_this$plugins$get[name];}}function setTrailingComments(node,comments){if(node.trailingComments===undefined){node.trailingComments=comments;}else{node.trailingComments.unshift(...comments);}}function setLeadingComments(node,comments){if(node.leadingComments===undefined){node.leadingComments=comments;}else{node.leadingComments.unshift(...comments);}}function setInnerComments(node,comments){if(node.innerComments===undefined){node.innerComments=comments;}else{node.innerComments.unshift(...comments);}}function adjustInnerComments(node,elements,commentWS){let lastElement=null;let i=elements.length;while(lastElement===null&&i>0){lastElement=elements[--i];}if(lastElement===null||lastElement.start>commentWS.start){setInnerComments(node,commentWS.comments);}else{setTrailingComments(lastElement,commentWS.comments);}}class CommentsParser extends BaseParser{addComment(comment){if(this.filename)comment.loc.filename=this.filename;const{commentsLen}=this.state;if(this.comments.length!==commentsLen){this.comments.length=commentsLen;}this.comments.push(comment);this.state.commentsLen++;}processComment(node){const{commentStack}=this.state;const commentStackLength=commentStack.length;if(commentStackLength===0)return;let i=commentStackLength-1;const lastCommentWS=commentStack[i];if(lastCommentWS.start===node.end){lastCommentWS.leadingNode=node;i--;}const{start:nodeStart}=node;for(;i>=0;i--){const commentWS=commentStack[i];const commentEnd=commentWS.end;if(commentEnd>nodeStart){commentWS.containingNode=node;this.finalizeComment(commentWS);commentStack.splice(i,1);}else{if(commentEnd===nodeStart){commentWS.trailingNode=node;}break;}}}finalizeComment(commentWS){const{comments}=commentWS;if(commentWS.leadingNode!==null||commentWS.trailingNode!==null){if(commentWS.leadingNode!==null){setTrailingComments(commentWS.leadingNode,comments);}if(commentWS.trailingNode!==null){setLeadingComments(commentWS.trailingNode,comments);}}else{const{containingNode:node,start:commentStart}=commentWS;if(this.input.charCodeAt(this.offsetToSourcePos(commentStart)-1)===44){switch(node.type){case"ObjectExpression":case"ObjectPattern":case"RecordExpression":adjustInnerComments(node,node.properties,commentWS);break;case"CallExpression":case"OptionalCallExpression":adjustInnerComments(node,node.arguments,commentWS);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":adjustInnerComments(node,node.params,commentWS);break;case"ArrayExpression":case"ArrayPattern":case"TupleExpression":adjustInnerComments(node,node.elements,commentWS);break;case"ExportNamedDeclaration":case"ImportDeclaration":adjustInnerComments(node,node.specifiers,commentWS);break;case"TSEnumDeclaration":{adjustInnerComments(node,node.members,commentWS);}break;case"TSEnumBody":adjustInnerComments(node,node.members,commentWS);break;default:{setInnerComments(node,comments);}}}else{setInnerComments(node,comments);}}}finalizeRemainingComments(){const{commentStack}=this.state;for(let i=commentStack.length-1;i>=0;i--){this.finalizeComment(commentStack[i]);}this.state.commentStack=[];}resetPreviousNodeTrailingComments(node){const{commentStack}=this.state;const{length}=commentStack;if(length===0)return;const commentWS=commentStack[length-1];if(commentWS.leadingNode===node){commentWS.leadingNode=null;}}resetPreviousIdentifierLeadingComments(node){const{commentStack}=this.state;const{length}=commentStack;if(length===0)return;if(commentStack[length-1].trailingNode===node){commentStack[length-1].trailingNode=null;}else if(length>=2&&commentStack[length-2].trailingNode===node){commentStack[length-2].trailingNode=null;}}takeSurroundingComments(node,start,end){const{commentStack}=this.state;const commentStackLength=commentStack.length;if(commentStackLength===0)return;let i=commentStackLength-1;for(;i>=0;i--){const commentWS=commentStack[i];const commentEnd=commentWS.end;const commentStart=commentWS.start;if(commentStart===end){commentWS.leadingNode=node;}else if(commentEnd===start){commentWS.trailingNode=node;}else if(commentEnd0;}set strict(v){if(v)this.flags|=1;else this.flags&=-2;}init({strictMode,sourceType,startIndex,startLine,startColumn}){this.strict=strictMode===false?false:strictMode===true?true:sourceType==="module";this.startIndex=startIndex;this.curLine=startLine;this.lineStart=-startColumn;this.startLoc=this.endLoc=new Position(startLine,startColumn,startIndex);}get maybeInArrowParameters(){return(this.flags&2)>0;}set maybeInArrowParameters(v){if(v)this.flags|=2;else this.flags&=-3;}get inType(){return(this.flags&4)>0;}set inType(v){if(v)this.flags|=4;else this.flags&=-5;}get noAnonFunctionType(){return(this.flags&8)>0;}set noAnonFunctionType(v){if(v)this.flags|=8;else this.flags&=-9;}get hasFlowComment(){return(this.flags&16)>0;}set hasFlowComment(v){if(v)this.flags|=16;else this.flags&=-17;}get isAmbientContext(){return(this.flags&32)>0;}set isAmbientContext(v){if(v)this.flags|=32;else this.flags&=-33;}get inAbstractClass(){return(this.flags&64)>0;}set inAbstractClass(v){if(v)this.flags|=64;else this.flags&=-65;}get inDisallowConditionalTypesContext(){return(this.flags&128)>0;}set inDisallowConditionalTypesContext(v){if(v)this.flags|=128;else this.flags&=-129;}get soloAwait(){return(this.flags&256)>0;}set soloAwait(v){if(v)this.flags|=256;else this.flags&=-257;}get inFSharpPipelineDirectBody(){return(this.flags&512)>0;}set inFSharpPipelineDirectBody(v){if(v)this.flags|=512;else this.flags&=-513;}get canStartJSXElement(){return(this.flags&1024)>0;}set canStartJSXElement(v){if(v)this.flags|=1024;else this.flags&=-1025;}get containsEsc(){return(this.flags&2048)>0;}set containsEsc(v){if(v)this.flags|=2048;else this.flags&=-2049;}get hasTopLevelAwait(){return(this.flags&4096)>0;}set hasTopLevelAwait(v){if(v)this.flags|=4096;else this.flags&=-4097;}curPosition(){return new Position(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex);}clone(){const state=new State();state.flags=this.flags;state.startIndex=this.startIndex;state.curLine=this.curLine;state.lineStart=this.lineStart;state.startLoc=this.startLoc;state.endLoc=this.endLoc;state.errors=this.errors.slice();state.potentialArrowAt=this.potentialArrowAt;state.noArrowAt=this.noArrowAt.slice();state.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice();state.topicContext=this.topicContext;state.labels=this.labels.slice();state.commentsLen=this.commentsLen;state.commentStack=this.commentStack.slice();state.pos=this.pos;state.type=this.type;state.value=this.value;state.start=this.start;state.end=this.end;state.lastTokEndLoc=this.lastTokEndLoc;state.lastTokStartLoc=this.lastTokStartLoc;state.context=this.context.slice();state.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos;state.strictErrors=this.strictErrors;state.tokensLength=this.tokensLength;return state;}}var _isDigit=function isDigit(code){return code>=48&&code<=57;};const forbiddenNumericSeparatorSiblings={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])};const isAllowedNumericSeparatorSibling={bin:ch=>ch===48||ch===49,oct:ch=>ch>=48&&ch<=55,dec:ch=>ch>=48&&ch<=57,hex:ch=>ch>=48&&ch<=57||ch>=65&&ch<=70||ch>=97&&ch<=102};function readStringContents(type,input,pos,lineStart,curLine,errors){const initialPos=pos;const initialLineStart=lineStart;const initialCurLine=curLine;let out="";let firstInvalidLoc=null;let chunkStart=pos;const{length}=input;for(;;){if(pos>=length){errors.unterminated(initialPos,initialLineStart,initialCurLine);out+=input.slice(chunkStart,pos);break;}const ch=input.charCodeAt(pos);if(isStringEnd(type,ch,input,pos)){out+=input.slice(chunkStart,pos);break;}if(ch===92){out+=input.slice(chunkStart,pos);const res=readEscapedChar(input,pos,lineStart,curLine,type==="template",errors);if(res.ch===null&&!firstInvalidLoc){firstInvalidLoc={pos,lineStart,curLine};}else{out+=res.ch;}({pos,lineStart,curLine}=res);chunkStart=pos;}else if(ch===8232||ch===8233){++pos;++curLine;lineStart=pos;}else if(ch===10||ch===13){if(type==="template"){out+=input.slice(chunkStart,pos)+"\n";++pos;if(ch===13&&input.charCodeAt(pos)===10){++pos;}++curLine;chunkStart=lineStart=pos;}else{errors.unterminated(initialPos,initialLineStart,initialCurLine);}}else{++pos;}}return{pos,str:out,firstInvalidLoc,lineStart,curLine,containsInvalid:!!firstInvalidLoc};}function isStringEnd(type,ch,input,pos){if(type==="template"){return ch===96||ch===36&&input.charCodeAt(pos+1)===123;}return ch===(type==="double"?34:39);}function readEscapedChar(input,pos,lineStart,curLine,inTemplate,errors){const throwOnInvalid=!inTemplate;pos++;const res=ch=>({pos,ch,lineStart,curLine});const ch=input.charCodeAt(pos++);switch(ch){case 110:return res("\n");case 114:return res("\r");case 120:{let code;({code,pos}=readHexChar(input,pos,lineStart,curLine,2,false,throwOnInvalid,errors));return res(code===null?null:String.fromCharCode(code));}case 117:{let code;({code,pos}=readCodePoint(input,pos,lineStart,curLine,throwOnInvalid,errors));return res(code===null?null:String.fromCodePoint(code));}case 116:return res("\t");case 98:return res("\b");case 118:return res("\u000b");case 102:return res("\f");case 13:if(input.charCodeAt(pos)===10){++pos;}case 10:lineStart=pos;++curLine;case 8232:case 8233:return res("");case 56:case 57:if(inTemplate){return res(null);}else{errors.strictNumericEscape(pos-1,lineStart,curLine);}default:if(ch>=48&&ch<=55){const startPos=pos-1;const match=/^[0-7]+/.exec(input.slice(startPos,pos+2));let octalStr=match[0];let octal=parseInt(octalStr,8);if(octal>255){octalStr=octalStr.slice(0,-1);octal=parseInt(octalStr,8);}pos+=octalStr.length-1;const next=input.charCodeAt(pos);if(octalStr!=="0"||next===56||next===57){if(inTemplate){return res(null);}else{errors.strictNumericEscape(startPos,lineStart,curLine);}}return res(String.fromCharCode(octal));}return res(String.fromCharCode(ch));}}function readHexChar(input,pos,lineStart,curLine,len,forceLen,throwOnInvalid,errors){const initialPos=pos;let n;({n,pos}=readInt(input,pos,lineStart,curLine,16,len,forceLen,false,errors,!throwOnInvalid));if(n===null){if(throwOnInvalid){errors.invalidEscapeSequence(initialPos,lineStart,curLine);}else{pos=initialPos-1;}}return{code:n,pos};}function readInt(input,pos,lineStart,curLine,radix,len,forceLen,allowNumSeparator,errors,bailOnError){const start=pos;const forbiddenSiblings=radix===16?forbiddenNumericSeparatorSiblings.hex:forbiddenNumericSeparatorSiblings.decBinOct;const isAllowedSibling=radix===16?isAllowedNumericSeparatorSibling.hex:radix===10?isAllowedNumericSeparatorSibling.dec:radix===8?isAllowedNumericSeparatorSibling.oct:isAllowedNumericSeparatorSibling.bin;let invalid=false;let total=0;for(let i=0,e=len==null?Infinity:len;i=97){val=code-97+10;}else if(code>=65){val=code-65+10;}else if(_isDigit(code)){val=code-48;}else{val=Infinity;}if(val>=radix){if(val<=9&&bailOnError){return{n:null,pos};}else if(val<=9&&errors.invalidDigit(pos,lineStart,curLine,radix)){val=0;}else if(forceLen){val=0;invalid=true;}else{break;}}++pos;total=total*radix+val;}if(pos===start||len!=null&&pos-start!==len||invalid){return{n:null,pos};}return{n:total,pos};}function readCodePoint(input,pos,lineStart,curLine,throwOnInvalid,errors){const ch=input.charCodeAt(pos);let code;if(ch===123){++pos;({code,pos}=readHexChar(input,pos,lineStart,curLine,input.indexOf("}",pos)-pos,true,throwOnInvalid,errors));++pos;if(code!==null&&code>0x10ffff){if(throwOnInvalid){errors.invalidCodePoint(pos,lineStart,curLine);}else{return{code:null,pos};}}}else{({code,pos}=readHexChar(input,pos,lineStart,curLine,4,false,throwOnInvalid,errors));}return{code,pos};}function buildPosition(pos,lineStart,curLine){return new Position(curLine,pos-lineStart,pos);}const VALID_REGEX_FLAGS=new Set([103,109,115,105,121,117,100,118]);class Token{constructor(state){const startIndex=state.startIndex||0;this.type=state.type;this.value=state.value;this.start=startIndex+state.start;this.end=startIndex+state.end;this.loc=new SourceLocation(state.startLoc,state.endLoc);}}class Tokenizer extends CommentsParser{constructor(options,input){super();this.isLookahead=void 0;this.tokens=[];this.errorHandlers_readInt={invalidDigit:(pos,lineStart,curLine,radix)=>{if(!(this.optionFlags&2048))return false;this.raise(Errors.InvalidDigit,buildPosition(pos,lineStart,curLine),{radix});return true;},numericSeparatorInEscapeSequence:this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(Errors.UnexpectedNumericSeparator)};this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(Errors.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(Errors.InvalidCodePoint)});this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(pos,lineStart,curLine)=>{this.recordStrictModeErrors(Errors.StrictNumericEscape,buildPosition(pos,lineStart,curLine));},unterminated:(pos,lineStart,curLine)=>{throw this.raise(Errors.UnterminatedString,buildPosition(pos-1,lineStart,curLine));}});this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(Errors.StrictNumericEscape),unterminated:(pos,lineStart,curLine)=>{throw this.raise(Errors.UnterminatedTemplate,buildPosition(pos,lineStart,curLine));}});this.state=new State();this.state.init(options);this.input=input;this.length=input.length;this.comments=[];this.isLookahead=false;}pushToken(token){this.tokens.length=this.state.tokensLength;this.tokens.push(token);++this.state.tokensLength;}next(){this.checkKeywordEscapes();if(this.optionFlags&256){this.pushToken(new Token(this.state));}this.state.lastTokEndLoc=this.state.endLoc;this.state.lastTokStartLoc=this.state.startLoc;this.nextToken();}eat(type){if(this.match(type)){this.next();return true;}else{return false;}}match(type){return this.state.type===type;}createLookaheadState(state){return{pos:state.pos,value:null,type:state.type,start:state.start,end:state.end,context:[this.curContext()],inType:state.inType,startLoc:state.startLoc,lastTokEndLoc:state.lastTokEndLoc,curLine:state.curLine,lineStart:state.lineStart,curPosition:state.curPosition};}lookahead(){const old=this.state;this.state=this.createLookaheadState(old);this.isLookahead=true;this.nextToken();this.isLookahead=false;const curr=this.state;this.state=old;return curr;}nextTokenStart(){return this.nextTokenStartSince(this.state.pos);}nextTokenStartSince(pos){skipWhiteSpace.lastIndex=pos;return skipWhiteSpace.test(this.input)?skipWhiteSpace.lastIndex:pos;}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos);}lookaheadCharCodeSince(pos){return this.input.charCodeAt(this.nextTokenStartSince(pos));}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos);}nextTokenInLineStartSince(pos){skipWhiteSpaceInLine.lastIndex=pos;return skipWhiteSpaceInLine.test(this.input)?skipWhiteSpaceInLine.lastIndex:pos;}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart());}codePointAtPos(pos){let cp=this.input.charCodeAt(pos);if((cp&0xfc00)===0xd800&&++posthis.raise(toParseError,at));this.state.strictErrors.clear();}}curContext(){return this.state.context[this.state.context.length-1];}nextToken(){this.skipSpace();this.state.start=this.state.pos;if(!this.isLookahead)this.state.startLoc=this.state.curPosition();if(this.state.pos>=this.length){this.finishToken(140);return;}this.getTokenFromCode(this.codePointAtPos(this.state.pos));}skipBlockComment(commentEnd){let startLoc;if(!this.isLookahead)startLoc=this.state.curPosition();const start=this.state.pos;const end=this.input.indexOf(commentEnd,start+2);if(end===-1){throw this.raise(Errors.UnterminatedComment,this.state.curPosition());}this.state.pos=end+commentEnd.length;lineBreakG.lastIndex=start+2;while(lineBreakG.test(this.input)&&lineBreakG.lastIndex<=end){++this.state.curLine;this.state.lineStart=lineBreakG.lastIndex;}if(this.isLookahead)return;const comment={type:"CommentBlock",value:this.input.slice(start+2,end),start:this.sourceToOffsetPos(start),end:this.sourceToOffsetPos(end+commentEnd.length),loc:new SourceLocation(startLoc,this.state.curPosition())};if(this.optionFlags&256)this.pushToken(comment);return comment;}skipLineComment(startSkip){const start=this.state.pos;let startLoc;if(!this.isLookahead)startLoc=this.state.curPosition();let ch=this.input.charCodeAt(this.state.pos+=startSkip);if(this.state.posspaceStart)){const comment=this.skipLineComment(3);if(comment!==undefined){this.addComment(comment);comments==null||comments.push(comment);}}else{break loop;}}else if(ch===60&&!this.inModule&&this.optionFlags&8192){const pos=this.state.pos;if(this.input.charCodeAt(pos+1)===33&&this.input.charCodeAt(pos+2)===45&&this.input.charCodeAt(pos+3)===45){const comment=this.skipLineComment(4);if(comment!==undefined){this.addComment(comment);comments==null||comments.push(comment);}}else{break loop;}}else{break loop;}}}if((comments==null?void 0:comments.length)>0){const end=this.state.pos;const commentWhitespace={start:this.sourceToOffsetPos(spaceStart),end:this.sourceToOffsetPos(end),comments,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(commentWhitespace);}}finishToken(type,val){this.state.end=this.state.pos;this.state.endLoc=this.state.curPosition();const prevType=this.state.type;this.state.type=type;this.state.value=val;if(!this.isLookahead){this.updateContext(prevType);}}replaceToken(type){this.state.type=type;this.updateContext();}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter()){return;}const nextPos=this.state.pos+1;const next=this.codePointAtPos(nextPos);if(next>=48&&next<=57){throw this.raise(Errors.UnexpectedDigitAfterHash,this.state.curPosition());}if(next===123||next===91&&this.hasPlugin("recordAndTuple")){this.expectPlugin("recordAndTuple");if(this.getPluginOption("recordAndTuple","syntaxType")==="bar"){throw this.raise(next===123?Errors.RecordExpressionHashIncorrectStartSyntaxType:Errors.TupleExpressionHashIncorrectStartSyntaxType,this.state.curPosition());}this.state.pos+=2;if(next===123){this.finishToken(7);}else{this.finishToken(1);}}else if(isIdentifierStart(next)){++this.state.pos;this.finishToken(139,this.readWord1(next));}else if(next===92){++this.state.pos;this.finishToken(139,this.readWord1());}else{this.finishOp(27,1);}}readToken_dot(){const next=this.input.charCodeAt(this.state.pos+1);if(next>=48&&next<=57){this.readNumber(true);return;}if(next===46&&this.input.charCodeAt(this.state.pos+2)===46){this.state.pos+=3;this.finishToken(21);}else{++this.state.pos;this.finishToken(16);}}readToken_slash(){const next=this.input.charCodeAt(this.state.pos+1);if(next===61){this.finishOp(31,2);}else{this.finishOp(56,1);}}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return false;let ch=this.input.charCodeAt(this.state.pos+1);if(ch!==33)return false;const start=this.state.pos;this.state.pos+=1;while(!isNewLine(ch)&&++this.state.pos=48&&next2<=57)){this.state.pos+=2;this.finishToken(18);}else{++this.state.pos;this.finishToken(17);}}getTokenFromCode(code){switch(code){case 46:this.readToken_dot();return;case 40:++this.state.pos;this.finishToken(10);return;case 41:++this.state.pos;this.finishToken(11);return;case 59:++this.state.pos;this.finishToken(13);return;case 44:++this.state.pos;this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar"){throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType,this.state.curPosition());}this.state.pos+=2;this.finishToken(2);}else{++this.state.pos;this.finishToken(0);}return;case 93:++this.state.pos;this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar"){throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType,this.state.curPosition());}this.state.pos+=2;this.finishToken(6);}else{++this.state.pos;this.finishToken(5);}return;case 125:++this.state.pos;this.finishToken(8);return;case 58:if(this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58){this.finishOp(15,2);}else{++this.state.pos;this.finishToken(14);}return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{const next=this.input.charCodeAt(this.state.pos+1);if(next===120||next===88){this.readRadixNumber(16);return;}if(next===111||next===79){this.readRadixNumber(8);return;}if(next===98||next===66){this.readRadixNumber(2);return;}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(false);return;case 34:case 39:this.readString(code);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(code);return;case 124:case 38:this.readToken_pipe_amp(code);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(code);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(code);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(isIdentifierStart(code)){this.readWord(code);return;}}throw this.raise(Errors.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(code)});}finishOp(type,size){const str=this.input.slice(this.state.pos,this.state.pos+size);this.state.pos+=size;this.finishToken(type,str);}readRegexp(){const startLoc=this.state.startLoc;const start=this.state.start+1;let escaped,inClass;let{pos}=this.state;for(;;++pos){if(pos>=this.length){throw this.raise(Errors.UnterminatedRegExp,createPositionWithColumnOffset(startLoc,1));}const ch=this.input.charCodeAt(pos);if(isNewLine(ch)){throw this.raise(Errors.UnterminatedRegExp,createPositionWithColumnOffset(startLoc,1));}if(escaped){escaped=false;}else{if(ch===91){inClass=true;}else if(ch===93&&inClass){inClass=false;}else if(ch===47&&!inClass){break;}escaped=ch===92;}}const content=this.input.slice(start,pos);++pos;let mods="";const nextPos=()=>createPositionWithColumnOffset(startLoc,pos+2-start);while(pos=2&&this.input.charCodeAt(start)===48;if(hasLeadingZero){const integer=this.input.slice(start,this.state.pos);this.recordStrictModeErrors(Errors.StrictOctalLiteral,startLoc);if(!this.state.strict){const underscorePos=integer.indexOf("_");if(underscorePos>0){this.raise(Errors.ZeroDigitNumericSeparator,createPositionWithColumnOffset(startLoc,underscorePos));}}isOctal=hasLeadingZero&&!/[89]/.test(integer);}let next=this.input.charCodeAt(this.state.pos);if(next===46&&!isOctal){++this.state.pos;this.readInt(10);isFloat=true;next=this.input.charCodeAt(this.state.pos);}if((next===69||next===101)&&!isOctal){next=this.input.charCodeAt(++this.state.pos);if(next===43||next===45){++this.state.pos;}if(this.readInt(10)===null){this.raise(Errors.InvalidOrMissingExponent,startLoc);}isFloat=true;hasExponent=true;next=this.input.charCodeAt(this.state.pos);}if(next===110){if(isFloat||hasLeadingZero){this.raise(Errors.InvalidBigIntLiteral,startLoc);}++this.state.pos;isBigInt=true;}if(next===109){this.expectPlugin("decimal",this.state.curPosition());if(hasExponent||hasLeadingZero){this.raise(Errors.InvalidDecimal,startLoc);}++this.state.pos;var isDecimal=true;}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(Errors.NumberIdentifier,this.state.curPosition());}const str=this.input.slice(start,this.state.pos).replace(/[_mn]/g,"");if(isBigInt){this.finishToken(136,str);return;}if(isDecimal){this.finishToken(137,str);return;}const val=isOctal?parseInt(str,8):parseFloat(str);this.finishToken(135,val);}readCodePoint(throwOnInvalid){const{code,pos}=readCodePoint(this.input,this.state.pos,this.state.lineStart,this.state.curLine,throwOnInvalid,this.errorHandlers_readCodePoint);this.state.pos=pos;return code;}readString(quote){const{str,pos,curLine,lineStart}=readStringContents(quote===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=pos+1;this.state.lineStart=lineStart;this.state.curLine=curLine;this.finishToken(134,str);}readTemplateContinuation(){if(!this.match(8)){this.unexpected(null,8);}this.state.pos--;this.readTemplateToken();}readTemplateToken(){const opening=this.input[this.state.pos];const{str,firstInvalidLoc,pos,curLine,lineStart}=readStringContents("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=pos+1;this.state.lineStart=lineStart;this.state.curLine=curLine;if(firstInvalidLoc){this.state.firstInvalidTemplateEscapePos=new Position(firstInvalidLoc.curLine,firstInvalidLoc.pos-firstInvalidLoc.lineStart,this.sourceToOffsetPos(firstInvalidLoc.pos));}if(this.input.codePointAt(pos)===96){this.finishToken(24,firstInvalidLoc?null:opening+str+"`");}else{this.state.pos++;this.finishToken(25,firstInvalidLoc?null:opening+str+"${");}}recordStrictModeErrors(toParseError,at){const index=at.index;if(this.state.strict&&!this.state.strictErrors.has(index)){this.raise(toParseError,at);}else{this.state.strictErrors.set(index,[toParseError,at]);}}readWord1(firstCode){this.state.containsEsc=false;let word="";const start=this.state.pos;let chunkStart=this.state.pos;if(firstCode!==undefined){this.state.pos+=firstCode<=0xffff?1:2;}while(this.state.pos=0;i--){const error=errors[i];if(error.loc.index===pos){return errors[i]=toParseError(loc,details);}if(error.loc.indexthis.hasPlugin(name))){throw this.raise(Errors.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:pluginNames});}}errorBuilder(error){return(pos,lineStart,curLine)=>{this.raise(error,buildPosition(pos,lineStart,curLine));};}}class ClassScope{constructor(){this.privateNames=new Set();this.loneAccessors=new Map();this.undefinedPrivateNames=new Map();}}class ClassScopeHandler{constructor(parser){this.parser=void 0;this.stack=[];this.undefinedPrivateNames=new Map();this.parser=parser;}current(){return this.stack[this.stack.length-1];}enter(){this.stack.push(new ClassScope());}exit(){const oldClassScope=this.stack.pop();const current=this.current();for(const[name,loc]of Array.from(oldClassScope.undefinedPrivateNames)){if(current){if(!current.undefinedPrivateNames.has(name)){current.undefinedPrivateNames.set(name,loc);}}else{this.parser.raise(Errors.InvalidPrivateFieldResolution,loc,{identifierName:name});}}}declarePrivateName(name,elementType,loc){const{privateNames,loneAccessors,undefinedPrivateNames}=this.current();let redefined=privateNames.has(name);if(elementType&3){const accessor=redefined&&loneAccessors.get(name);if(accessor){const oldStatic=accessor&4;const newStatic=elementType&4;const oldKind=accessor&3;const newKind=elementType&3;redefined=oldKind===newKind||oldStatic!==newStatic;if(!redefined)loneAccessors.delete(name);}else if(!redefined){loneAccessors.set(name,elementType);}}if(redefined){this.parser.raise(Errors.PrivateNameRedeclaration,loc,{identifierName:name});}privateNames.add(name);undefinedPrivateNames.delete(name);}usePrivateName(name,loc){let classScope;for(classScope of this.stack){if(classScope.privateNames.has(name))return;}if(classScope){classScope.undefinedPrivateNames.set(name,loc);}else{this.parser.raise(Errors.InvalidPrivateFieldResolution,loc,{identifierName:name});}}}class ExpressionScope{constructor(type=0){this.type=type;}canBeArrowParameterDeclaration(){return this.type===2||this.type===1;}isCertainlyParameterDeclaration(){return this.type===3;}}class ArrowHeadParsingScope extends ExpressionScope{constructor(type){super(type);this.declarationErrors=new Map();}recordDeclarationError(ParsingErrorClass,at){const index=at.index;this.declarationErrors.set(index,[ParsingErrorClass,at]);}clearDeclarationError(index){this.declarationErrors.delete(index);}iterateErrors(iterator){this.declarationErrors.forEach(iterator);}}class ExpressionScopeHandler{constructor(parser){this.parser=void 0;this.stack=[new ExpressionScope()];this.parser=parser;}enter(scope){this.stack.push(scope);}exit(){this.stack.pop();}recordParameterInitializerError(toParseError,node){const origin=node.loc.start;const{stack}=this;let i=stack.length-1;let scope=stack[i];while(!scope.isCertainlyParameterDeclaration()){if(scope.canBeArrowParameterDeclaration()){scope.recordDeclarationError(toParseError,origin);}else{return;}scope=stack[--i];}this.parser.raise(toParseError,origin);}recordArrowParameterBindingError(error,node){const{stack}=this;const scope=stack[stack.length-1];const origin=node.loc.start;if(scope.isCertainlyParameterDeclaration()){this.parser.raise(error,origin);}else if(scope.canBeArrowParameterDeclaration()){scope.recordDeclarationError(error,origin);}else{return;}}recordAsyncArrowParametersError(at){const{stack}=this;let i=stack.length-1;let scope=stack[i];while(scope.canBeArrowParameterDeclaration()){if(scope.type===2){scope.recordDeclarationError(Errors.AwaitBindingIdentifier,at);}scope=stack[--i];}}validateAsPattern(){const{stack}=this;const currentScope=stack[stack.length-1];if(!currentScope.canBeArrowParameterDeclaration())return;currentScope.iterateErrors(([toParseError,loc])=>{this.parser.raise(toParseError,loc);let i=stack.length-2;let scope=stack[i];while(scope.canBeArrowParameterDeclaration()){scope.clearDeclarationError(loc.index);scope=stack[--i];}});}}function newParameterDeclarationScope(){return new ExpressionScope(3);}function newArrowHeadScope(){return new ArrowHeadParsingScope(1);}function newAsyncArrowScope(){return new ArrowHeadParsingScope(2);}function newExpressionScope(){return new ExpressionScope();}class UtilParser extends Tokenizer{addExtra(node,key,value,enumerable=true){if(!node)return;let{extra}=node;if(extra==null){extra={};node.extra=extra;}if(enumerable){extra[key]=value;}else{Object.defineProperty(extra,key,{enumerable,value});}}isContextual(token){return this.state.type===token&&!this.state.containsEsc;}isUnparsedContextual(nameStart,name){const nameEnd=nameStart+name.length;if(this.input.slice(nameStart,nameEnd)===name){const nextCh=this.input.charCodeAt(nameEnd);return!(isIdentifierChar(nextCh)||(nextCh&0xfc00)===0xd800);}return false;}isLookaheadContextual(name){const next=this.nextTokenStart();return this.isUnparsedContextual(next,name);}eatContextual(token){if(this.isContextual(token)){this.next();return true;}return false;}expectContextual(token,toParseError){if(!this.eatContextual(token)){if(toParseError!=null){throw this.raise(toParseError,this.state.startLoc);}this.unexpected(null,token);}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak();}hasPrecedingLineBreak(){return hasNewLine(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start);}hasFollowingLineBreak(){return hasNewLine(this.input,this.state.end,this.nextTokenStart());}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon();}semicolon(allowAsi=true){if(allowAsi?this.isLineTerminator():this.eat(13))return;this.raise(Errors.MissingSemicolon,this.state.lastTokEndLoc);}expect(type,loc){if(!this.eat(type)){this.unexpected(loc,type);}}tryParse(fn,oldState=this.state.clone()){const abortSignal={node:null};try{const node=fn((node=null)=>{abortSignal.node=node;throw abortSignal;});if(this.state.errors.length>oldState.errors.length){const failState=this.state;this.state=oldState;this.state.tokensLength=failState.tokensLength;return{node,error:failState.errors[oldState.errors.length],thrown:false,aborted:false,failState};}return{node,error:null,thrown:false,aborted:false,failState:null};}catch(error){const failState=this.state;this.state=oldState;if(error instanceof SyntaxError){return{node:null,error,thrown:true,aborted:false,failState};}if(error===abortSignal){return{node:abortSignal.node,error:null,thrown:false,aborted:true,failState};}throw error;}}checkExpressionErrors(refExpressionErrors,andThrow){if(!refExpressionErrors)return false;const{shorthandAssignLoc,doubleProtoLoc,privateKeyLoc,optionalParametersLoc}=refExpressionErrors;const hasErrors=!!shorthandAssignLoc||!!doubleProtoLoc||!!optionalParametersLoc||!!privateKeyLoc;if(!andThrow){return hasErrors;}if(shorthandAssignLoc!=null){this.raise(Errors.InvalidCoverInitializedName,shorthandAssignLoc);}if(doubleProtoLoc!=null){this.raise(Errors.DuplicateProto,doubleProtoLoc);}if(privateKeyLoc!=null){this.raise(Errors.UnexpectedPrivateField,privateKeyLoc);}if(optionalParametersLoc!=null){this.unexpected(optionalParametersLoc);}}isLiteralPropertyName(){return tokenIsLiteralPropertyName(this.state.type);}isPrivateName(node){return node.type==="PrivateName";}getPrivateNameSV(node){return node.id.name;}hasPropertyAsPrivateName(node){return(node.type==="MemberExpression"||node.type==="OptionalMemberExpression")&&this.isPrivateName(node.property);}isObjectProperty(node){return node.type==="ObjectProperty";}isObjectMethod(node){return node.type==="ObjectMethod";}initializeScopes(inModule=this.options.sourceType==="module"){const oldLabels=this.state.labels;this.state.labels=[];const oldExportedIdentifiers=this.exportedIdentifiers;this.exportedIdentifiers=new Set();const oldInModule=this.inModule;this.inModule=inModule;const oldScope=this.scope;const ScopeHandler=this.getScopeHandler();this.scope=new ScopeHandler(this,inModule);const oldProdParam=this.prodParam;this.prodParam=new ProductionParameterHandler();const oldClassScope=this.classScope;this.classScope=new ClassScopeHandler(this);const oldExpressionScope=this.expressionScope;this.expressionScope=new ExpressionScopeHandler(this);return()=>{this.state.labels=oldLabels;this.exportedIdentifiers=oldExportedIdentifiers;this.inModule=oldInModule;this.scope=oldScope;this.prodParam=oldProdParam;this.classScope=oldClassScope;this.expressionScope=oldExpressionScope;};}enterInitialScopes(){let paramFlags=0;if(this.inModule){paramFlags|=2;}if(this.optionFlags&32){paramFlags|=1;}this.scope.enter(1);this.prodParam.enter(paramFlags);}checkDestructuringPrivate(refExpressionErrors){const{privateKeyLoc}=refExpressionErrors;if(privateKeyLoc!==null){this.expectPlugin("destructuringPrivate",privateKeyLoc);}}}class ExpressionErrors{constructor(){this.shorthandAssignLoc=null;this.doubleProtoLoc=null;this.privateKeyLoc=null;this.optionalParametersLoc=null;}}class Node{constructor(parser,pos,loc){this.type="";this.start=pos;this.end=0;this.loc=new SourceLocation(loc);if((parser==null?void 0:parser.optionFlags)&128)this.range=[pos,0];if(parser!=null&&parser.filename)this.loc.filename=parser.filename;}}const NodePrototype=Node.prototype;{NodePrototype.__clone=function(){const newNode=new Node(undefined,this.start,this.loc.start);const keys=Object.keys(this);for(let i=0,length=keys.length;i{return node.type==="ParenthesizedExpression"?unwrapParenthesizedExpression(node.expression):node;};class LValParser extends NodeUtils{toAssignable(node,isLHS=false){var _node$extra,_node$extra3;let parenthesized=undefined;if(node.type==="ParenthesizedExpression"||(_node$extra=node.extra)!=null&&_node$extra.parenthesized){parenthesized=unwrapParenthesizedExpression(node);if(isLHS){if(parenthesized.type==="Identifier"){this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment,node);}else if(parenthesized.type!=="MemberExpression"&&!this.isOptionalMemberExpression(parenthesized)){this.raise(Errors.InvalidParenthesizedAssignment,node);}}else{this.raise(Errors.InvalidParenthesizedAssignment,node);}}switch(node.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":this.castNodeTo(node,"ObjectPattern");for(let i=0,length=node.properties.length,last=length-1;i{return prop.type!=="ObjectMethod"&&(i===last||prop.type!=="SpreadElement")&&this.isAssignable(prop);});}case"ObjectProperty":return this.isAssignable(node.value);case"SpreadElement":return this.isAssignable(node.argument);case"ArrayExpression":return node.elements.every(element=>element===null||this.isAssignable(element));case"AssignmentExpression":return node.operator==="=";case"ParenthesizedExpression":return this.isAssignable(node.expression);case"MemberExpression":case"OptionalMemberExpression":return!isBinding;default:return false;}}toReferencedList(exprList,isParenthesizedExpr){return exprList;}toReferencedListDeep(exprList,isParenthesizedExpr){this.toReferencedList(exprList,isParenthesizedExpr);for(const expr of exprList){if((expr==null?void 0:expr.type)==="ArrayExpression"){this.toReferencedListDeep(expr.elements);}}}parseSpread(refExpressionErrors){const node=this.startNode();this.next();node.argument=this.parseMaybeAssignAllowIn(refExpressionErrors,undefined);return this.finishNode(node,"SpreadElement");}parseRestBinding(){const node=this.startNode();this.next();node.argument=this.parseBindingAtom();return this.finishNode(node,"RestElement");}parseBindingAtom(){switch(this.state.type){case 0:{const node=this.startNode();this.next();node.elements=this.parseBindingList(3,93,1);return this.finishNode(node,"ArrayPattern");}case 5:return this.parseObjectLike(8,true);}return this.parseIdentifier();}parseBindingList(close,closeCharCode,flags){const allowEmpty=flags&1;const elts=[];let first=true;while(!this.eat(close)){if(first){first=false;}else{this.expect(12);}if(allowEmpty&&this.match(12)){elts.push(null);}else if(this.eat(close)){break;}else if(this.match(21)){let rest=this.parseRestBinding();if(this.hasPlugin("flow")||flags&2){rest=this.parseFunctionParamType(rest);}elts.push(rest);if(!this.checkCommaAfterRest(closeCharCode)){this.expect(close);break;}}else{const decorators=[];if(flags&2){if(this.match(26)&&this.hasPlugin("decorators")){this.raise(Errors.UnsupportedParameterDecorator,this.state.startLoc);}while(this.match(26)){decorators.push(this.parseDecorator());}}elts.push(this.parseBindingElement(flags,decorators));}}return elts;}parseBindingRestProperty(prop){this.next();prop.argument=this.parseIdentifier();this.checkCommaAfterRest(125);return this.finishNode(prop,"RestElement");}parseBindingProperty(){const{type,startLoc}=this.state;if(type===21){return this.parseBindingRestProperty(this.startNode());}const prop=this.startNode();if(type===139){this.expectPlugin("destructuringPrivate",startLoc);this.classScope.usePrivateName(this.state.value,startLoc);prop.key=this.parsePrivateName();}else{this.parsePropertyName(prop);}prop.method=false;return this.parseObjPropValue(prop,startLoc,false,false,true,false);}parseBindingElement(flags,decorators){const left=this.parseMaybeDefault();if(this.hasPlugin("flow")||flags&2){this.parseFunctionParamType(left);}if(decorators.length){left.decorators=decorators;this.resetStartLocationFromNode(left,decorators[0]);}const elt=this.parseMaybeDefault(left.loc.start,left);return elt;}parseFunctionParamType(param){return param;}parseMaybeDefault(startLoc,left){startLoc!=null?startLoc:startLoc=this.state.startLoc;left=left!=null?left:this.parseBindingAtom();if(!this.eat(29))return left;const node=this.startNodeAt(startLoc);node.left=left;node.right=this.parseMaybeAssignAllowIn();return this.finishNode(node,"AssignmentPattern");}isValidLVal(type,isUnparenthesizedInAssign,binding){switch(type){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";}return false;}isOptionalMemberExpression(expression){return expression.type==="OptionalMemberExpression";}checkLVal(expression,ancestor,binding=64,checkClashes=false,strictModeChanged=false,hasParenthesizedAncestor=false){var _expression$extra;const type=expression.type;if(this.isObjectMethod(expression))return;const isOptionalMemberExpression=this.isOptionalMemberExpression(expression);if(isOptionalMemberExpression||type==="MemberExpression"){if(isOptionalMemberExpression){this.expectPlugin("optionalChainingAssign",expression.loc.start);if(ancestor.type!=="AssignmentExpression"){this.raise(Errors.InvalidLhsOptionalChaining,expression,{ancestor});}}if(binding!==64){this.raise(Errors.InvalidPropertyBindingPattern,expression);}return;}if(type==="Identifier"){this.checkIdentifier(expression,binding,strictModeChanged);const{name}=expression;if(checkClashes){if(checkClashes.has(name)){this.raise(Errors.ParamDupe,expression);}else{checkClashes.add(name);}}return;}const validity=this.isValidLVal(type,!(hasParenthesizedAncestor||(_expression$extra=expression.extra)!=null&&_expression$extra.parenthesized)&&ancestor.type==="AssignmentExpression",binding);if(validity===true)return;if(validity===false){const ParseErrorClass=binding===64?Errors.InvalidLhs:Errors.InvalidLhsBinding;this.raise(ParseErrorClass,expression,{ancestor});return;}let key,isParenthesizedExpression;if(typeof validity==="string"){key=validity;isParenthesizedExpression=type==="ParenthesizedExpression";}else{[key,isParenthesizedExpression]=validity;}const nextAncestor=type==="ArrayPattern"||type==="ObjectPattern"?{type}:ancestor;const val=expression[key];if(Array.isArray(val)){for(const child of val){if(child){this.checkLVal(child,nextAncestor,binding,checkClashes,strictModeChanged,isParenthesizedExpression);}}}else if(val){this.checkLVal(val,nextAncestor,binding,checkClashes,strictModeChanged,isParenthesizedExpression);}}checkIdentifier(at,bindingType,strictModeChanged=false){if(this.state.strict&&(strictModeChanged?isStrictBindReservedWord(at.name,this.inModule):isStrictBindOnlyReservedWord(at.name))){if(bindingType===64){this.raise(Errors.StrictEvalArguments,at,{referenceName:at.name});}else{this.raise(Errors.StrictEvalArgumentsBinding,at,{bindingName:at.name});}}if(bindingType&8192&&at.name==="let"){this.raise(Errors.LetInLexicalBinding,at);}if(!(bindingType&64)){this.declareNameFromIdentifier(at,bindingType);}}declareNameFromIdentifier(identifier,binding){this.scope.declareName(identifier.name,binding,identifier.loc.start);}checkToRestConversion(node,allowPattern){switch(node.type){case"ParenthesizedExpression":this.checkToRestConversion(node.expression,allowPattern);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(allowPattern)break;default:this.raise(Errors.InvalidRestAssignmentPattern,node);}}checkCommaAfterRest(close){if(!this.match(12)){return false;}this.raise(this.lookaheadCharCode()===close?Errors.RestTrailingComma:Errors.ElementAfterRest,this.state.startLoc);return true;}}function nonNull(x){if(x==null){throw new Error(`Unexpected ${x} value.`);}return x;}function assert(x){if(!x){throw new Error("Assert fail");}}const TSErrors=ParseErrorEnum`typescript`({AbstractMethodHasImplementation:({methodName})=>`Method '${methodName}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName})=>`Property '${propertyName}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind})=>`'declare' is not allowed in ${kind}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier})=>`Accessibility modifier already seen.`,DuplicateModifier:({modifier})=>`Duplicate modifier: '${modifier}'.`,EmptyHeritageClauseType:({token})=>`'${token}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers})=>`'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier})=>`Index signatures cannot have an accessibility modifier ('${modifier}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token})=>`'${token}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnTypeMember:({modifier})=>`'${modifier}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier})=>`'${modifier}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier})=>`'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifiersOrder:({orderedModifiers})=>`'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. "+"You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifer:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier})=>`Private elements cannot have an accessibility modifier ('${modifier}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName})=>`Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`});function keywordTypeFromName(value){switch(value){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return undefined;}}function tsIsAccessModifier(modifier){return modifier==="private"||modifier==="public"||modifier==="protected";}function tsIsVarianceAnnotations(modifier){return modifier==="in"||modifier==="out";}var typescript=superClass=>class TypeScriptParserMixin extends superClass{constructor(...args){super(...args);this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:TSErrors.InvalidModifierOnTypeParameter});this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:TSErrors.InvalidModifierOnTypeParameterPositions});this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:TSErrors.InvalidModifierOnTypeParameter});}getScopeHandler(){return TypeScriptScopeHandler;}tsIsIdentifier(){return tokenIsIdentifier(this.state.type);}tsTokenCanFollowModifier(){return this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(139)||this.isLiteralPropertyName();}tsNextTokenOnSameLineAndCanFollowModifier(){this.next();if(this.hasPrecedingLineBreak()){return false;}return this.tsTokenCanFollowModifier();}tsNextTokenCanFollowModifier(){if(this.match(106)){this.next();return this.tsTokenCanFollowModifier();}return this.tsNextTokenOnSameLineAndCanFollowModifier();}tsParseModifier(allowedModifiers,stopOnStartOfClassStaticBlock){if(!tokenIsIdentifier(this.state.type)&&this.state.type!==58&&this.state.type!==75){return undefined;}const modifier=this.state.value;if(allowedModifiers.includes(modifier)){if(stopOnStartOfClassStaticBlock&&this.tsIsStartOfStaticBlocks()){return undefined;}if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))){return modifier;}}return undefined;}tsParseModifiers({allowedModifiers,disallowedModifiers,stopOnStartOfClassStaticBlock,errorTemplate=TSErrors.InvalidModifierOnTypeMember},modified){const enforceOrder=(loc,modifier,before,after)=>{if(modifier===before&&modified[after]){this.raise(TSErrors.InvalidModifiersOrder,loc,{orderedModifiers:[before,after]});}};const incompatible=(loc,modifier,mod1,mod2)=>{if(modified[mod1]&&modifier===mod2||modified[mod2]&&modifier===mod1){this.raise(TSErrors.IncompatibleModifiers,loc,{modifiers:[mod1,mod2]});}};for(;;){const{startLoc}=this.state;const modifier=this.tsParseModifier(allowedModifiers.concat(disallowedModifiers!=null?disallowedModifiers:[]),stopOnStartOfClassStaticBlock);if(!modifier)break;if(tsIsAccessModifier(modifier)){if(modified.accessibility){this.raise(TSErrors.DuplicateAccessibilityModifier,startLoc,{modifier});}else{enforceOrder(startLoc,modifier,modifier,"override");enforceOrder(startLoc,modifier,modifier,"static");enforceOrder(startLoc,modifier,modifier,"readonly");modified.accessibility=modifier;}}else if(tsIsVarianceAnnotations(modifier)){if(modified[modifier]){this.raise(TSErrors.DuplicateModifier,startLoc,{modifier});}modified[modifier]=true;enforceOrder(startLoc,modifier,"in","out");}else{if(hasOwnProperty.call(modified,modifier)){this.raise(TSErrors.DuplicateModifier,startLoc,{modifier});}else{enforceOrder(startLoc,modifier,"static","readonly");enforceOrder(startLoc,modifier,"static","override");enforceOrder(startLoc,modifier,"override","readonly");enforceOrder(startLoc,modifier,"abstract","override");incompatible(startLoc,modifier,"declare","override");incompatible(startLoc,modifier,"static","abstract");}modified[modifier]=true;}if(disallowedModifiers!=null&&disallowedModifiers.includes(modifier)){this.raise(errorTemplate,startLoc,{modifier});}}}tsIsListTerminator(kind){switch(kind){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48);}}tsParseList(kind,parseElement){const result=[];while(!this.tsIsListTerminator(kind)){result.push(parseElement());}return result;}tsParseDelimitedList(kind,parseElement,refTrailingCommaPos){return nonNull(this.tsParseDelimitedListWorker(kind,parseElement,true,refTrailingCommaPos));}tsParseDelimitedListWorker(kind,parseElement,expectSuccess,refTrailingCommaPos){const result=[];let trailingCommaPos=-1;for(;;){if(this.tsIsListTerminator(kind)){break;}trailingCommaPos=-1;const element=parseElement();if(element==null){return undefined;}result.push(element);if(this.eat(12)){trailingCommaPos=this.state.lastTokStartLoc.index;continue;}if(this.tsIsListTerminator(kind)){break;}if(expectSuccess){this.expect(12);}return undefined;}if(refTrailingCommaPos){refTrailingCommaPos.value=trailingCommaPos;}return result;}tsParseBracketedList(kind,parseElement,bracket,skipFirstToken,refTrailingCommaPos){if(!skipFirstToken){if(bracket){this.expect(0);}else{this.expect(47);}}const result=this.tsParseDelimitedList(kind,parseElement,refTrailingCommaPos);if(bracket){this.expect(3);}else{this.expect(48);}return result;}tsParseImportType(){const node=this.startNode();this.expect(83);this.expect(10);if(!this.match(134)){this.raise(TSErrors.UnsupportedImportTypeArgument,this.state.startLoc);{node.argument=super.parseExprAtom();}}else{{node.argument=this.parseStringLiteral(this.state.value);}}if(this.eat(12)){node.options=this.tsParseImportTypeOptions();}else{node.options=null;}this.expect(11);if(this.eat(16)){node.qualifier=this.tsParseEntityName(1|2);}if(this.match(47)){{node.typeParameters=this.tsParseTypeArguments();}}return this.finishNode(node,"TSImportType");}tsParseImportTypeOptions(){const node=this.startNode();this.expect(5);const withProperty=this.startNode();if(this.isContextual(76)){withProperty.method=false;withProperty.key=this.parseIdentifier(true);withProperty.computed=false;withProperty.shorthand=false;}else{this.unexpected(null,76);}this.expect(14);withProperty.value=this.tsParseImportTypeWithPropertyValue();node.properties=[this.finishObjectProperty(withProperty)];this.expect(8);return this.finishNode(node,"ObjectExpression");}tsParseImportTypeWithPropertyValue(){const node=this.startNode();const properties=[];this.expect(5);while(!this.match(8)){const type=this.state.type;if(tokenIsIdentifier(type)||type===134){properties.push(super.parsePropertyDefinition(null));}else{this.unexpected();}this.eat(12);}node.properties=properties;this.next();return this.finishNode(node,"ObjectExpression");}tsParseEntityName(flags){let entity;if(flags&1&&this.match(78)){if(flags&2){entity=this.parseIdentifier(true);}else{const node=this.startNode();this.next();entity=this.finishNode(node,"ThisExpression");}}else{entity=this.parseIdentifier(!!(flags&1));}while(this.eat(16)){const node=this.startNodeAtNode(entity);node.left=entity;node.right=this.parseIdentifier(!!(flags&1));entity=this.finishNode(node,"TSQualifiedName");}return entity;}tsParseTypeReference(){const node=this.startNode();node.typeName=this.tsParseEntityName(1);if(!this.hasPrecedingLineBreak()&&this.match(47)){{node.typeParameters=this.tsParseTypeArguments();}}return this.finishNode(node,"TSTypeReference");}tsParseThisTypePredicate(lhs){this.next();const node=this.startNodeAtNode(lhs);node.parameterName=lhs;node.typeAnnotation=this.tsParseTypeAnnotation(false);node.asserts=false;return this.finishNode(node,"TSTypePredicate");}tsParseThisTypeNode(){const node=this.startNode();this.next();return this.finishNode(node,"TSThisType");}tsParseTypeQuery(){const node=this.startNode();this.expect(87);if(this.match(83)){node.exprName=this.tsParseImportType();}else{{node.exprName=this.tsParseEntityName(1|2);}}if(!this.hasPrecedingLineBreak()&&this.match(47)){{node.typeParameters=this.tsParseTypeArguments();}}return this.finishNode(node,"TSTypeQuery");}tsParseTypeParameter(parseModifiers){const node=this.startNode();parseModifiers(node);node.name=this.tsParseTypeParameterName();node.constraint=this.tsEatThenParseType(81);node.default=this.tsEatThenParseType(29);return this.finishNode(node,"TSTypeParameter");}tsTryParseTypeParameters(parseModifiers){if(this.match(47)){return this.tsParseTypeParameters(parseModifiers);}}tsParseTypeParameters(parseModifiers){const node=this.startNode();if(this.match(47)||this.match(143)){this.next();}else{this.unexpected();}const refTrailingCommaPos={value:-1};node.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,parseModifiers),false,true,refTrailingCommaPos);if(node.params.length===0){this.raise(TSErrors.EmptyTypeParameters,node);}if(refTrailingCommaPos.value!==-1){this.addExtra(node,"trailingComma",refTrailingCommaPos.value);}return this.finishNode(node,"TSTypeParameterDeclaration");}tsFillSignature(returnToken,signature){const returnTokenRequired=returnToken===19;const paramsKey="parameters";const returnTypeKey="typeAnnotation";signature.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);this.expect(10);signature[paramsKey]=this.tsParseBindingListForSignature();if(returnTokenRequired){signature[returnTypeKey]=this.tsParseTypeOrTypePredicateAnnotation(returnToken);}else if(this.match(returnToken)){signature[returnTypeKey]=this.tsParseTypeOrTypePredicateAnnotation(returnToken);}}tsParseBindingListForSignature(){const list=super.parseBindingList(11,41,2);for(const pattern of list){const{type}=pattern;if(type==="AssignmentPattern"||type==="TSParameterProperty"){this.raise(TSErrors.UnsupportedSignatureParameterKind,pattern,{type});}}return list;}tsParseTypeMemberSemicolon(){if(!this.eat(12)&&!this.isLineTerminator()){this.expect(13);}}tsParseSignatureMember(kind,node){this.tsFillSignature(14,node);this.tsParseTypeMemberSemicolon();return this.finishNode(node,kind);}tsIsUnambiguouslyIndexSignature(){this.next();if(tokenIsIdentifier(this.state.type)){this.next();return this.match(14);}return false;}tsTryParseIndexSignature(node){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))){return;}this.expect(0);const id=this.parseIdentifier();id.typeAnnotation=this.tsParseTypeAnnotation();this.resetEndLocation(id);this.expect(3);node.parameters=[id];const type=this.tsTryParseTypeAnnotation();if(type)node.typeAnnotation=type;this.tsParseTypeMemberSemicolon();return this.finishNode(node,"TSIndexSignature");}tsParsePropertyOrMethodSignature(node,readonly){if(this.eat(17))node.optional=true;if(this.match(10)||this.match(47)){if(readonly){this.raise(TSErrors.ReadonlyForMethodSignature,node);}const method=node;if(method.kind&&this.match(47)){this.raise(TSErrors.AccessorCannotHaveTypeParameters,this.state.curPosition());}this.tsFillSignature(14,method);this.tsParseTypeMemberSemicolon();const paramsKey="parameters";const returnTypeKey="typeAnnotation";if(method.kind==="get"){if(method[paramsKey].length>0){this.raise(Errors.BadGetterArity,this.state.curPosition());if(this.isThisParam(method[paramsKey][0])){this.raise(TSErrors.AccessorCannotDeclareThisParameter,this.state.curPosition());}}}else if(method.kind==="set"){if(method[paramsKey].length!==1){this.raise(Errors.BadSetterArity,this.state.curPosition());}else{const firstParameter=method[paramsKey][0];if(this.isThisParam(firstParameter)){this.raise(TSErrors.AccessorCannotDeclareThisParameter,this.state.curPosition());}if(firstParameter.type==="Identifier"&&firstParameter.optional){this.raise(TSErrors.SetAccessorCannotHaveOptionalParameter,this.state.curPosition());}if(firstParameter.type==="RestElement"){this.raise(TSErrors.SetAccessorCannotHaveRestParameter,this.state.curPosition());}}if(method[returnTypeKey]){this.raise(TSErrors.SetAccessorCannotHaveReturnType,method[returnTypeKey]);}}else{method.kind="method";}return this.finishNode(method,"TSMethodSignature");}else{const property=node;if(readonly)property.readonly=true;const type=this.tsTryParseTypeAnnotation();if(type)property.typeAnnotation=type;this.tsParseTypeMemberSemicolon();return this.finishNode(property,"TSPropertySignature");}}tsParseTypeMember(){const node=this.startNode();if(this.match(10)||this.match(47)){return this.tsParseSignatureMember("TSCallSignatureDeclaration",node);}if(this.match(77)){const id=this.startNode();this.next();if(this.match(10)||this.match(47)){return this.tsParseSignatureMember("TSConstructSignatureDeclaration",node);}else{node.key=this.createIdentifier(id,"new");return this.tsParsePropertyOrMethodSignature(node,false);}}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},node);const idx=this.tsTryParseIndexSignature(node);if(idx){return idx;}super.parsePropertyName(node);if(!node.computed&&node.key.type==="Identifier"&&(node.key.name==="get"||node.key.name==="set")&&this.tsTokenCanFollowModifier()){node.kind=node.key.name;super.parsePropertyName(node);if(!this.match(10)&&!this.match(47)){this.unexpected(null,10);}}return this.tsParsePropertyOrMethodSignature(node,!!node.readonly);}tsParseTypeLiteral(){const node=this.startNode();node.members=this.tsParseObjectTypeMembers();return this.finishNode(node,"TSTypeLiteral");}tsParseObjectTypeMembers(){this.expect(5);const members=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));this.expect(8);return members;}tsIsStartOfMappedType(){this.next();if(this.eat(53)){return this.isContextual(122);}if(this.isContextual(122)){this.next();}if(!this.match(0)){return false;}this.next();if(!this.tsIsIdentifier()){return false;}this.next();return this.match(58);}tsParseMappedType(){const node=this.startNode();this.expect(5);if(this.match(53)){node.readonly=this.state.value;this.next();this.expectContextual(122);}else if(this.eatContextual(122)){node.readonly=true;}this.expect(0);{const typeParameter=this.startNode();typeParameter.name=this.tsParseTypeParameterName();typeParameter.constraint=this.tsExpectThenParseType(58);node.typeParameter=this.finishNode(typeParameter,"TSTypeParameter");}node.nameType=this.eatContextual(93)?this.tsParseType():null;this.expect(3);if(this.match(53)){node.optional=this.state.value;this.next();this.expect(17);}else if(this.eat(17)){node.optional=true;}node.typeAnnotation=this.tsTryParseType();this.semicolon();this.expect(8);return this.finishNode(node,"TSMappedType");}tsParseTupleType(){const node=this.startNode();node.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),true,false);let seenOptionalElement=false;node.elementTypes.forEach(elementNode=>{const{type}=elementNode;if(seenOptionalElement&&type!=="TSRestType"&&type!=="TSOptionalType"&&!(type==="TSNamedTupleMember"&&elementNode.optional)){this.raise(TSErrors.OptionalTypeBeforeRequired,elementNode);}seenOptionalElement||(seenOptionalElement=type==="TSNamedTupleMember"&&elementNode.optional||type==="TSOptionalType");});return this.finishNode(node,"TSTupleType");}tsParseTupleElementType(){const restStartLoc=this.state.startLoc;const rest=this.eat(21);const{startLoc}=this.state;let labeled;let label;let optional;let type;const isWord=tokenIsKeywordOrIdentifier(this.state.type);const chAfterWord=isWord?this.lookaheadCharCode():null;if(chAfterWord===58){labeled=true;optional=false;label=this.parseIdentifier(true);this.expect(14);type=this.tsParseType();}else if(chAfterWord===63){optional=true;const wordName=this.state.value;const typeOrLabel=this.tsParseNonArrayType();if(this.lookaheadCharCode()===58){labeled=true;label=this.createIdentifier(this.startNodeAt(startLoc),wordName);this.expect(17);this.expect(14);type=this.tsParseType();}else{labeled=false;type=typeOrLabel;this.expect(17);}}else{type=this.tsParseType();optional=this.eat(17);labeled=this.eat(14);}if(labeled){let labeledNode;if(label){labeledNode=this.startNodeAt(startLoc);labeledNode.optional=optional;labeledNode.label=label;labeledNode.elementType=type;if(this.eat(17)){labeledNode.optional=true;this.raise(TSErrors.TupleOptionalAfterType,this.state.lastTokStartLoc);}}else{labeledNode=this.startNodeAt(startLoc);labeledNode.optional=optional;this.raise(TSErrors.InvalidTupleMemberLabel,type);labeledNode.label=type;labeledNode.elementType=this.tsParseType();}type=this.finishNode(labeledNode,"TSNamedTupleMember");}else if(optional){const optionalTypeNode=this.startNodeAt(startLoc);optionalTypeNode.typeAnnotation=type;type=this.finishNode(optionalTypeNode,"TSOptionalType");}if(rest){const restNode=this.startNodeAt(restStartLoc);restNode.typeAnnotation=type;type=this.finishNode(restNode,"TSRestType");}return type;}tsParseParenthesizedType(){const node=this.startNode();this.expect(10);node.typeAnnotation=this.tsParseType();this.expect(11);return this.finishNode(node,"TSParenthesizedType");}tsParseFunctionOrConstructorType(type,abstract){const node=this.startNode();if(type==="TSConstructorType"){node.abstract=!!abstract;if(abstract)this.next();this.next();}this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,node));return this.finishNode(node,type);}tsParseLiteralTypeNode(){const node=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:node.literal=super.parseExprAtom();break;default:this.unexpected();}return this.finishNode(node,"TSLiteralType");}tsParseTemplateLiteralType(){{const node=this.startNode();node.literal=super.parseTemplate(false);return this.finishNode(node,"TSLiteralType");}}parseTemplateSubstitution(){if(this.state.inType)return this.tsParseType();return super.parseTemplateSubstitution();}tsParseThisTypeOrThisTypePredicate(){const thisKeyword=this.tsParseThisTypeNode();if(this.isContextual(116)&&!this.hasPrecedingLineBreak()){return this.tsParseThisTypePredicate(thisKeyword);}else{return thisKeyword;}}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const node=this.startNode();const nextToken=this.lookahead();if(nextToken.type!==135&&nextToken.type!==136){this.unexpected();}node.literal=this.parseMaybeUnary();return this.finishNode(node,"TSLiteralType");}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{const{type}=this.state;if(tokenIsIdentifier(type)||type===88||type===84){const nodeType=type===88?"TSVoidKeyword":type===84?"TSNullKeyword":keywordTypeFromName(this.state.value);if(nodeType!==undefined&&this.lookaheadCharCode()!==46){const node=this.startNode();this.next();return this.finishNode(node,nodeType);}return this.tsParseTypeReference();}}}this.unexpected();}tsParseArrayTypeOrHigher(){const{startLoc}=this.state;let type=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0)){if(this.match(3)){const node=this.startNodeAt(startLoc);node.elementType=type;this.expect(3);type=this.finishNode(node,"TSArrayType");}else{const node=this.startNodeAt(startLoc);node.objectType=type;node.indexType=this.tsParseType();this.expect(3);type=this.finishNode(node,"TSIndexedAccessType");}}return type;}tsParseTypeOperator(){const node=this.startNode();const operator=this.state.value;this.next();node.operator=operator;node.typeAnnotation=this.tsParseTypeOperatorOrHigher();if(operator==="readonly"){this.tsCheckTypeAnnotationForReadOnly(node);}return this.finishNode(node,"TSTypeOperator");}tsCheckTypeAnnotationForReadOnly(node){switch(node.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(TSErrors.UnexpectedReadonly,node);}}tsParseInferType(){const node=this.startNode();this.expectContextual(115);const typeParameter=this.startNode();typeParameter.name=this.tsParseTypeParameterName();typeParameter.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType());node.typeParameter=this.finishNode(typeParameter,"TSTypeParameter");return this.finishNode(node,"TSInferType");}tsParseConstraintForInferType(){if(this.eat(81)){const constraint=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17)){return constraint;}}}tsParseTypeOperatorOrHigher(){const isTypeOperator=tokenIsTSTypeOperator(this.state.type)&&!this.state.containsEsc;return isTypeOperator?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher());}tsParseUnionOrIntersectionType(kind,parseConstituentType,operator){const node=this.startNode();const hasLeadingOperator=this.eat(operator);const types=[];do{types.push(parseConstituentType());}while(this.eat(operator));if(types.length===1&&!hasLeadingOperator){return types[0];}node.types=types;return this.finishNode(node,kind);}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45);}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43);}tsIsStartOfFunctionType(){if(this.match(47)){return true;}return this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));}tsSkipParameterStart(){if(tokenIsIdentifier(this.state.type)||this.match(78)){this.next();return true;}if(this.match(5)){const{errors}=this.state;const previousErrorCount=errors.length;try{this.parseObjectLike(8,true);return errors.length===previousErrorCount;}catch(_unused){return false;}}if(this.match(0)){this.next();const{errors}=this.state;const previousErrorCount=errors.length;try{super.parseBindingList(3,93,1);return errors.length===previousErrorCount;}catch(_unused2){return false;}}return false;}tsIsUnambiguouslyStartOfFunctionType(){this.next();if(this.match(11)||this.match(21)){return true;}if(this.tsSkipParameterStart()){if(this.match(14)||this.match(12)||this.match(17)||this.match(29)){return true;}if(this.match(11)){this.next();if(this.match(19)){return true;}}}return false;}tsParseTypeOrTypePredicateAnnotation(returnToken){return this.tsInType(()=>{const t=this.startNode();this.expect(returnToken);const node=this.startNode();const asserts=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(asserts&&this.match(78)){let thisTypePredicate=this.tsParseThisTypeOrThisTypePredicate();if(thisTypePredicate.type==="TSThisType"){node.parameterName=thisTypePredicate;node.asserts=true;node.typeAnnotation=null;thisTypePredicate=this.finishNode(node,"TSTypePredicate");}else{this.resetStartLocationFromNode(thisTypePredicate,node);thisTypePredicate.asserts=true;}t.typeAnnotation=thisTypePredicate;return this.finishNode(t,"TSTypeAnnotation");}const typePredicateVariable=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!typePredicateVariable){if(!asserts){return this.tsParseTypeAnnotation(false,t);}node.parameterName=this.parseIdentifier();node.asserts=asserts;node.typeAnnotation=null;t.typeAnnotation=this.finishNode(node,"TSTypePredicate");return this.finishNode(t,"TSTypeAnnotation");}const type=this.tsParseTypeAnnotation(false);node.parameterName=typePredicateVariable;node.typeAnnotation=type;node.asserts=asserts;t.typeAnnotation=this.finishNode(node,"TSTypePredicate");return this.finishNode(t,"TSTypeAnnotation");});}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14)){return this.tsParseTypeOrTypePredicateAnnotation(14);}}tsTryParseTypeAnnotation(){if(this.match(14)){return this.tsParseTypeAnnotation();}}tsTryParseType(){return this.tsEatThenParseType(14);}tsParseTypePredicatePrefix(){const id=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak()){this.next();return id;}}tsParseTypePredicateAsserts(){if(this.state.type!==109){return false;}const containsEsc=this.state.containsEsc;this.next();if(!tokenIsIdentifier(this.state.type)&&!this.match(78)){return false;}if(containsEsc){this.raise(Errors.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"});}return true;}tsParseTypeAnnotation(eatColon=true,t=this.startNode()){this.tsInType(()=>{if(eatColon)this.expect(14);t.typeAnnotation=this.tsParseType();});return this.finishNode(t,"TSTypeAnnotation");}tsParseType(){assert(this.state.inType);const type=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81)){return type;}const node=this.startNodeAtNode(type);node.checkType=type;node.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType());this.expect(17);node.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType());this.expect(14);node.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType());return this.finishNode(node,"TSConditionalType");}isAbstractConstructorSignature(){return this.isContextual(124)&&this.lookahead().type===77;}tsParseNonConditionalType(){if(this.tsIsStartOfFunctionType()){return this.tsParseFunctionOrConstructorType("TSFunctionType");}if(this.match(77)){return this.tsParseFunctionOrConstructorType("TSConstructorType");}else if(this.isAbstractConstructorSignature()){return this.tsParseFunctionOrConstructorType("TSConstructorType",true);}return this.tsParseUnionTypeOrHigher();}tsParseTypeAssertion(){if(this.getPluginOption("typescript","disallowAmbiguousJSXLike")){this.raise(TSErrors.ReservedTypeAssertion,this.state.startLoc);}const node=this.startNode();node.typeAnnotation=this.tsInType(()=>{this.next();return this.match(75)?this.tsParseTypeReference():this.tsParseType();});this.expect(48);node.expression=this.parseMaybeUnary();return this.finishNode(node,"TSTypeAssertion");}tsParseHeritageClause(token){const originalStartLoc=this.state.startLoc;const delimitedList=this.tsParseDelimitedList("HeritageClauseElement",()=>{{const node=this.startNode();node.expression=this.tsParseEntityName(1|2);if(this.match(47)){node.typeParameters=this.tsParseTypeArguments();}return this.finishNode(node,"TSExpressionWithTypeArguments");}});if(!delimitedList.length){this.raise(TSErrors.EmptyHeritageClauseType,originalStartLoc,{token});}return delimitedList;}tsParseInterfaceDeclaration(node,properties={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129);if(properties.declare)node.declare=true;if(tokenIsIdentifier(this.state.type)){node.id=this.parseIdentifier();this.checkIdentifier(node.id,130);}else{node.id=null;this.raise(TSErrors.MissingInterfaceName,this.state.startLoc);}node.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(this.eat(81)){node.extends=this.tsParseHeritageClause("extends");}const body=this.startNode();body.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this));node.body=this.finishNode(body,"TSInterfaceBody");return this.finishNode(node,"TSInterfaceDeclaration");}tsParseTypeAliasDeclaration(node){node.id=this.parseIdentifier();this.checkIdentifier(node.id,2);node.typeAnnotation=this.tsInType(()=>{node.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers);this.expect(29);if(this.isContextual(114)&&this.lookahead().type!==16){const node=this.startNode();this.next();return this.finishNode(node,"TSIntrinsicKeyword");}return this.tsParseType();});this.semicolon();return this.finishNode(node,"TSTypeAliasDeclaration");}tsInTopLevelContext(cb){if(this.curContext()!==types.brace){const oldContext=this.state.context;this.state.context=[oldContext[0]];try{return cb();}finally{this.state.context=oldContext;}}else{return cb();}}tsInType(cb){const oldInType=this.state.inType;this.state.inType=true;try{return cb();}finally{this.state.inType=oldInType;}}tsInDisallowConditionalTypesContext(cb){const oldInDisallowConditionalTypesContext=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=true;try{return cb();}finally{this.state.inDisallowConditionalTypesContext=oldInDisallowConditionalTypesContext;}}tsInAllowConditionalTypesContext(cb){const oldInDisallowConditionalTypesContext=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=false;try{return cb();}finally{this.state.inDisallowConditionalTypesContext=oldInDisallowConditionalTypesContext;}}tsEatThenParseType(token){if(this.match(token)){return this.tsNextThenParseType();}}tsExpectThenParseType(token){return this.tsInType(()=>{this.expect(token);return this.tsParseType();});}tsNextThenParseType(){return this.tsInType(()=>{this.next();return this.tsParseType();});}tsParseEnumMember(){const node=this.startNode();node.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(true);if(this.eat(29)){node.initializer=super.parseMaybeAssignAllowIn();}return this.finishNode(node,"TSEnumMember");}tsParseEnumDeclaration(node,properties={}){if(properties.const)node.const=true;if(properties.declare)node.declare=true;this.expectContextual(126);node.id=this.parseIdentifier();this.checkIdentifier(node.id,node.const?8971:8459);{this.expect(5);node.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8);}return this.finishNode(node,"TSEnumDeclaration");}tsParseEnumBody(){const node=this.startNode();this.expect(5);node.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8);return this.finishNode(node,"TSEnumBody");}tsParseModuleBlock(){const node=this.startNode();this.scope.enter(0);this.expect(5);super.parseBlockOrModuleBlockBody(node.body=[],undefined,true,8);this.scope.exit();return this.finishNode(node,"TSModuleBlock");}tsParseModuleOrNamespaceDeclaration(node,nested=false){node.id=this.parseIdentifier();if(!nested){this.checkIdentifier(node.id,1024);}if(this.eat(16)){const inner=this.startNode();this.tsParseModuleOrNamespaceDeclaration(inner,true);node.body=inner;}else{this.scope.enter(256);this.prodParam.enter(0);node.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit();}return this.finishNode(node,"TSModuleDeclaration");}tsParseAmbientExternalModuleDeclaration(node){if(this.isContextual(112)){node.kind="global";{node.global=true;}node.id=this.parseIdentifier();}else if(this.match(134)){node.kind="module";node.id=super.parseStringLiteral(this.state.value);}else{this.unexpected();}if(this.match(5)){this.scope.enter(256);this.prodParam.enter(0);node.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit();}else{this.semicolon();}return this.finishNode(node,"TSModuleDeclaration");}tsParseImportEqualsDeclaration(node,maybeDefaultIdentifier,isExport){{node.isExport=isExport||false;}node.id=maybeDefaultIdentifier||this.parseIdentifier();this.checkIdentifier(node.id,4096);this.expect(29);const moduleReference=this.tsParseModuleReference();if(node.importKind==="type"&&moduleReference.type!=="TSExternalModuleReference"){this.raise(TSErrors.ImportAliasHasImportType,moduleReference);}node.moduleReference=moduleReference;this.semicolon();return this.finishNode(node,"TSImportEqualsDeclaration");}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40;}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0);}tsParseExternalModuleReference(){const node=this.startNode();this.expectContextual(119);this.expect(10);if(!this.match(134)){this.unexpected();}node.expression=super.parseExprAtom();this.expect(11);this.sawUnambiguousESM=true;return this.finishNode(node,"TSExternalModuleReference");}tsLookAhead(f){const state=this.state.clone();const res=f();this.state=state;return res;}tsTryParseAndCatch(f){const result=this.tryParse(abort=>f()||abort());if(result.aborted||!result.node)return;if(result.error)this.state=result.failState;return result.node;}tsTryParse(f){const state=this.state.clone();const result=f();if(result!==undefined&&result!==false){return result;}this.state=state;}tsTryParseDeclare(nany){if(this.isLineTerminator()){return;}let startType=this.state.type;let kind;if(this.isContextual(100)){startType=74;kind="let";}return this.tsInAmbientContext(()=>{switch(startType){case 68:nany.declare=true;return super.parseFunctionStatement(nany,false,false);case 80:nany.declare=true;return this.parseClass(nany,true,false);case 126:return this.tsParseEnumDeclaration(nany,{declare:true});case 112:return this.tsParseAmbientExternalModuleDeclaration(nany);case 75:case 74:if(!this.match(75)||!this.isLookaheadContextual("enum")){nany.declare=true;return this.parseVarStatement(nany,kind||this.state.value,true);}this.expect(75);return this.tsParseEnumDeclaration(nany,{const:true,declare:true});case 129:{const result=this.tsParseInterfaceDeclaration(nany,{declare:true});if(result)return result;}default:if(tokenIsIdentifier(startType)){return this.tsParseDeclaration(nany,this.state.value,true,null);}}});}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,true,null);}tsParseExpressionStatement(node,expr,decorators){switch(expr.name){case"declare":{const declaration=this.tsTryParseDeclare(node);if(declaration){declaration.declare=true;}return declaration;}case"global":if(this.match(5)){this.scope.enter(256);this.prodParam.enter(0);const mod=node;mod.kind="global";{node.global=true;}mod.id=expr;mod.body=this.tsParseModuleBlock();this.scope.exit();this.prodParam.exit();return this.finishNode(mod,"TSModuleDeclaration");}break;default:return this.tsParseDeclaration(node,expr.name,false,decorators);}}tsParseDeclaration(node,value,next,decorators){switch(value){case"abstract":if(this.tsCheckLineTerminator(next)&&(this.match(80)||tokenIsIdentifier(this.state.type))){return this.tsParseAbstractDeclaration(node,decorators);}break;case"module":if(this.tsCheckLineTerminator(next)){if(this.match(134)){return this.tsParseAmbientExternalModuleDeclaration(node);}else if(tokenIsIdentifier(this.state.type)){node.kind="module";return this.tsParseModuleOrNamespaceDeclaration(node);}}break;case"namespace":if(this.tsCheckLineTerminator(next)&&tokenIsIdentifier(this.state.type)){node.kind="namespace";return this.tsParseModuleOrNamespaceDeclaration(node);}break;case"type":if(this.tsCheckLineTerminator(next)&&tokenIsIdentifier(this.state.type)){return this.tsParseTypeAliasDeclaration(node);}break;}}tsCheckLineTerminator(next){if(next){if(this.hasFollowingLineBreak())return false;this.next();return true;}return!this.isLineTerminator();}tsTryParseGenericAsyncArrowFunction(startLoc){if(!this.match(47))return;const oldMaybeInArrowParameters=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=true;const res=this.tsTryParseAndCatch(()=>{const node=this.startNodeAt(startLoc);node.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier);super.parseFunctionParams(node);node.returnType=this.tsTryParseTypeOrTypePredicateAnnotation();this.expect(19);return node;});this.state.maybeInArrowParameters=oldMaybeInArrowParameters;if(!res)return;return super.parseArrowExpression(res,null,true);}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==47)return;return this.tsParseTypeArguments();}tsParseTypeArguments(){const node=this.startNode();node.params=this.tsInType(()=>this.tsInTopLevelContext(()=>{this.expect(47);return this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this));}));if(node.params.length===0){this.raise(TSErrors.EmptyTypeArguments,node);}else if(!this.state.inType&&this.curContext()===types.brace){this.reScan_lt_gt();}this.expect(48);return this.finishNode(node,"TSTypeParameterInstantiation");}tsIsDeclarationStart(){return tokenIsTSDeclarationStart(this.state.type);}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return false;return super.isExportDefaultSpecifier();}parseBindingElement(flags,decorators){const startLoc=decorators.length?decorators[0].loc.start:this.state.startLoc;const modified={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},modified);const accessibility=modified.accessibility;const override=modified.override;const readonly=modified.readonly;if(!(flags&4)&&(accessibility||readonly||override)){this.raise(TSErrors.UnexpectedParameterModifier,startLoc);}const left=this.parseMaybeDefault();if(flags&2){this.parseFunctionParamType(left);}const elt=this.parseMaybeDefault(left.loc.start,left);if(accessibility||readonly||override){const pp=this.startNodeAt(startLoc);if(decorators.length){pp.decorators=decorators;}if(accessibility)pp.accessibility=accessibility;if(readonly)pp.readonly=readonly;if(override)pp.override=override;if(elt.type!=="Identifier"&&elt.type!=="AssignmentPattern"){this.raise(TSErrors.UnsupportedParameterPropertyKind,pp);}pp.parameter=elt;return this.finishNode(pp,"TSParameterProperty");}if(decorators.length){left.decorators=decorators;}return elt;}isSimpleParameter(node){return node.type==="TSParameterProperty"&&super.isSimpleParameter(node.parameter)||super.isSimpleParameter(node);}tsDisallowOptionalPattern(node){for(const param of node.params){if(param.type!=="Identifier"&¶m.optional&&!this.state.isAmbientContext){this.raise(TSErrors.PatternIsOptional,param);}}}setArrowFunctionParameters(node,params,trailingCommaLoc){super.setArrowFunctionParameters(node,params,trailingCommaLoc);this.tsDisallowOptionalPattern(node);}parseFunctionBodyAndFinish(node,type,isMethod=false){if(this.match(14)){node.returnType=this.tsParseTypeOrTypePredicateAnnotation(14);}const bodilessType=type==="FunctionDeclaration"?"TSDeclareFunction":type==="ClassMethod"||type==="ClassPrivateMethod"?"TSDeclareMethod":undefined;if(bodilessType&&!this.match(5)&&this.isLineTerminator()){return this.finishNode(node,bodilessType);}if(bodilessType==="TSDeclareFunction"&&this.state.isAmbientContext){this.raise(TSErrors.DeclareFunctionHasImplementation,node);if(node.declare){return super.parseFunctionBodyAndFinish(node,bodilessType,isMethod);}}this.tsDisallowOptionalPattern(node);return super.parseFunctionBodyAndFinish(node,type,isMethod);}registerFunctionStatementId(node){if(!node.body&&node.id){this.checkIdentifier(node.id,1024);}else{super.registerFunctionStatementId(node);}}tsCheckForInvalidTypeCasts(items){items.forEach(node=>{if((node==null?void 0:node.type)==="TSTypeCastExpression"){this.raise(TSErrors.UnexpectedTypeAnnotation,node.typeAnnotation);}});}toReferencedList(exprList,isInParens){this.tsCheckForInvalidTypeCasts(exprList);return exprList;}parseArrayLike(close,canBePattern,isTuple,refExpressionErrors){const node=super.parseArrayLike(close,canBePattern,isTuple,refExpressionErrors);if(node.type==="ArrayExpression"){this.tsCheckForInvalidTypeCasts(node.elements);}return node;}parseSubscript(base,startLoc,noCalls,state){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=false;this.next();const nonNullExpression=this.startNodeAt(startLoc);nonNullExpression.expression=base;return this.finishNode(nonNullExpression,"TSNonNullExpression");}let isOptionalCall=false;if(this.match(18)&&this.lookaheadCharCode()===60){if(noCalls){state.stop=true;return base;}state.optionalChainMember=isOptionalCall=true;this.next();}if(this.match(47)||this.match(51)){let missingParenErrorLoc;const result=this.tsTryParseAndCatch(()=>{if(!noCalls&&this.atPossibleAsyncArrow(base)){const asyncArrowFn=this.tsTryParseGenericAsyncArrowFunction(startLoc);if(asyncArrowFn){return asyncArrowFn;}}const typeArguments=this.tsParseTypeArgumentsInExpression();if(!typeArguments)return;if(isOptionalCall&&!this.match(10)){missingParenErrorLoc=this.state.curPosition();return;}if(tokenIsTemplate(this.state.type)){const result=super.parseTaggedTemplateExpression(base,startLoc,state);{result.typeParameters=typeArguments;}return result;}if(!noCalls&&this.eat(10)){const node=this.startNodeAt(startLoc);node.callee=base;node.arguments=this.parseCallExpressionArguments(11);this.tsCheckForInvalidTypeCasts(node.arguments);{node.typeParameters=typeArguments;}if(state.optionalChainMember){node.optional=isOptionalCall;}return this.finishCallExpression(node,state.optionalChainMember);}const tokenType=this.state.type;if(tokenType===48||tokenType===52||tokenType!==10&&tokenCanStartExpression(tokenType)&&!this.hasPrecedingLineBreak()){return;}const node=this.startNodeAt(startLoc);node.expression=base;{node.typeParameters=typeArguments;}return this.finishNode(node,"TSInstantiationExpression");});if(missingParenErrorLoc){this.unexpected(missingParenErrorLoc,10);}if(result){if(result.type==="TSInstantiationExpression"){if(this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40){this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc);}if(!this.match(16)&&!this.match(18)){result.expression=super.stopParseSubscript(base,state);}}return result;}}return super.parseSubscript(base,startLoc,noCalls,state);}parseNewCallee(node){var _callee$extra;super.parseNewCallee(node);const{callee}=node;if(callee.type==="TSInstantiationExpression"&&!((_callee$extra=callee.extra)!=null&&_callee$extra.parenthesized)){{node.typeParameters=callee.typeParameters;}node.callee=callee.expression;}}parseExprOp(left,leftStartLoc,minPrec){let isSatisfies;if(tokenOperatorPrecedence(58)>minPrec&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(isSatisfies=this.isContextual(120)))){const node=this.startNodeAt(leftStartLoc);node.expression=left;node.typeAnnotation=this.tsInType(()=>{this.next();if(this.match(75)){if(isSatisfies){this.raise(Errors.UnexpectedKeyword,this.state.startLoc,{keyword:"const"});}return this.tsParseTypeReference();}return this.tsParseType();});this.finishNode(node,isSatisfies?"TSSatisfiesExpression":"TSAsExpression");this.reScan_lt_gt();return this.parseExprOp(node,leftStartLoc,minPrec);}return super.parseExprOp(left,leftStartLoc,minPrec);}checkReservedWord(word,startLoc,checkKeywords,isBinding){if(!this.state.isAmbientContext){super.checkReservedWord(word,startLoc,checkKeywords,isBinding);}}checkImportReflection(node){super.checkImportReflection(node);if(node.module&&node.importKind!=="value"){this.raise(TSErrors.ImportReflectionHasImportType,node.specifiers[0].loc.start);}}checkDuplicateExports(){}isPotentialImportPhase(isExport){if(super.isPotentialImportPhase(isExport))return true;if(this.isContextual(130)){const ch=this.lookaheadCharCode();return isExport?ch===123||ch===42:ch!==61;}return!isExport&&this.isContextual(87);}applyImportPhase(node,isExport,phase,loc){super.applyImportPhase(node,isExport,phase,loc);if(isExport){node.exportKind=phase==="type"?"type":"value";}else{node.importKind=phase==="type"||phase==="typeof"?phase:"value";}}parseImport(node){if(this.match(134)){node.importKind="value";return super.parseImport(node);}let importNode;if(tokenIsIdentifier(this.state.type)&&this.lookaheadCharCode()===61){node.importKind="value";return this.tsParseImportEqualsDeclaration(node);}else if(this.isContextual(130)){const maybeDefaultIdentifier=this.parseMaybeImportPhase(node,false);if(this.lookaheadCharCode()===61){return this.tsParseImportEqualsDeclaration(node,maybeDefaultIdentifier);}else{importNode=super.parseImportSpecifiersAndAfter(node,maybeDefaultIdentifier);}}else{importNode=super.parseImport(node);}if(importNode.importKind==="type"&&importNode.specifiers.length>1&&importNode.specifiers[0].type==="ImportDefaultSpecifier"){this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed,importNode);}return importNode;}parseExport(node,decorators){if(this.match(83)){const nodeImportEquals=node;this.next();let maybeDefaultIdentifier=null;if(this.isContextual(130)&&this.isPotentialImportPhase(false)){maybeDefaultIdentifier=this.parseMaybeImportPhase(nodeImportEquals,false);}else{nodeImportEquals.importKind="value";}const declaration=this.tsParseImportEqualsDeclaration(nodeImportEquals,maybeDefaultIdentifier,true);{return declaration;}}else if(this.eat(29)){const assign=node;assign.expression=super.parseExpression();this.semicolon();this.sawUnambiguousESM=true;return this.finishNode(assign,"TSExportAssignment");}else if(this.eatContextual(93)){const decl=node;this.expectContextual(128);decl.id=this.parseIdentifier();this.semicolon();return this.finishNode(decl,"TSNamespaceExportDeclaration");}else{return super.parseExport(node,decorators);}}isAbstractClass(){return this.isContextual(124)&&this.lookahead().type===80;}parseExportDefaultExpression(){if(this.isAbstractClass()){const cls=this.startNode();this.next();cls.abstract=true;return this.parseClass(cls,true,true);}if(this.match(129)){const result=this.tsParseInterfaceDeclaration(this.startNode());if(result)return result;}return super.parseExportDefaultExpression();}parseVarStatement(node,kind,allowMissingInitializer=false){const{isAmbientContext}=this.state;const declaration=super.parseVarStatement(node,kind,allowMissingInitializer||isAmbientContext);if(!isAmbientContext)return declaration;for(const{id,init}of declaration.declarations){if(!init)continue;if(kind!=="const"||!!id.typeAnnotation){this.raise(TSErrors.InitializerNotAllowedInAmbientContext,init);}else if(!isValidAmbientConstInitializer(init,this.hasPlugin("estree"))){this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,init);}}return declaration;}parseStatementContent(flags,decorators){if(this.match(75)&&this.isLookaheadContextual("enum")){const node=this.startNode();this.expect(75);return this.tsParseEnumDeclaration(node,{const:true});}if(this.isContextual(126)){return this.tsParseEnumDeclaration(this.startNode());}if(this.isContextual(129)){const result=this.tsParseInterfaceDeclaration(this.startNode());if(result)return result;}return super.parseStatementContent(flags,decorators);}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"]);}tsHasSomeModifiers(member,modifiers){return modifiers.some(modifier=>{if(tsIsAccessModifier(modifier)){return member.accessibility===modifier;}return!!member[modifier];});}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123;}parseClassMember(classBody,member,state){const modifiers=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:modifiers,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:true,errorTemplate:TSErrors.InvalidModifierOnTypeParameterPositions},member);const callParseClassMemberWithIsStatic=()=>{if(this.tsIsStartOfStaticBlocks()){this.next();this.next();if(this.tsHasSomeModifiers(member,modifiers)){this.raise(TSErrors.StaticBlockCannotHaveModifier,this.state.curPosition());}super.parseClassStaticBlock(classBody,member);}else{this.parseClassMemberWithIsStatic(classBody,member,state,!!member.static);}};if(member.declare){this.tsInAmbientContext(callParseClassMemberWithIsStatic);}else{callParseClassMemberWithIsStatic();}}parseClassMemberWithIsStatic(classBody,member,state,isStatic){const idx=this.tsTryParseIndexSignature(member);if(idx){classBody.body.push(idx);if(member.abstract){this.raise(TSErrors.IndexSignatureHasAbstract,member);}if(member.accessibility){this.raise(TSErrors.IndexSignatureHasAccessibility,member,{modifier:member.accessibility});}if(member.declare){this.raise(TSErrors.IndexSignatureHasDeclare,member);}if(member.override){this.raise(TSErrors.IndexSignatureHasOverride,member);}return;}if(!this.state.inAbstractClass&&member.abstract){this.raise(TSErrors.NonAbstractClassHasAbstractMethod,member);}if(member.override){if(!state.hadSuperClass){this.raise(TSErrors.OverrideNotInSubClass,member);}}super.parseClassMemberWithIsStatic(classBody,member,state,isStatic);}parsePostMemberNameModifiers(methodOrProp){const optional=this.eat(17);if(optional)methodOrProp.optional=true;if(methodOrProp.readonly&&this.match(10)){this.raise(TSErrors.ClassMethodHasReadonly,methodOrProp);}if(methodOrProp.declare&&this.match(10)){this.raise(TSErrors.ClassMethodHasDeclare,methodOrProp);}}parseExpressionStatement(node,expr,decorators){const decl=expr.type==="Identifier"?this.tsParseExpressionStatement(node,expr,decorators):undefined;return decl||super.parseExpressionStatement(node,expr,decorators);}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return true;return super.shouldParseExportDeclaration();}parseConditional(expr,startLoc,refExpressionErrors){if(!this.match(17))return expr;if(this.state.maybeInArrowParameters){const nextCh=this.lookaheadCharCode();if(nextCh===44||nextCh===61||nextCh===58||nextCh===41){this.setOptionalParametersError(refExpressionErrors);return expr;}}return super.parseConditional(expr,startLoc,refExpressionErrors);}parseParenItem(node,startLoc){const newNode=super.parseParenItem(node,startLoc);if(this.eat(17)){newNode.optional=true;this.resetEndLocation(node);}if(this.match(14)){const typeCastNode=this.startNodeAt(startLoc);typeCastNode.expression=node;typeCastNode.typeAnnotation=this.tsParseTypeAnnotation();return this.finishNode(typeCastNode,"TSTypeCastExpression");}return node;}parseExportDeclaration(node){if(!this.state.isAmbientContext&&this.isContextual(125)){return this.tsInAmbientContext(()=>this.parseExportDeclaration(node));}const startLoc=this.state.startLoc;const isDeclare=this.eatContextual(125);if(isDeclare&&(this.isContextual(125)||!this.shouldParseExportDeclaration())){throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare,this.state.startLoc);}const isIdentifier=tokenIsIdentifier(this.state.type);const declaration=isIdentifier&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(node);if(!declaration)return null;if(declaration.type==="TSInterfaceDeclaration"||declaration.type==="TSTypeAliasDeclaration"||isDeclare){node.exportKind="type";}if(isDeclare&&declaration.type!=="TSImportEqualsDeclaration"){this.resetStartLocation(declaration,startLoc);declaration.declare=true;}return declaration;}parseClassId(node,isStatement,optionalId,bindingType){if((!isStatement||optionalId)&&this.isContextual(113)){return;}super.parseClassId(node,isStatement,optionalId,node.declare?1024:8331);const typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(typeParameters)node.typeParameters=typeParameters;}parseClassPropertyAnnotation(node){if(!node.optional){if(this.eat(35)){node.definite=true;}else if(this.eat(17)){node.optional=true;}}const type=this.tsTryParseTypeAnnotation();if(type)node.typeAnnotation=type;}parseClassProperty(node){this.parseClassPropertyAnnotation(node);if(this.state.isAmbientContext&&!(node.readonly&&!node.typeAnnotation)&&this.match(29)){this.raise(TSErrors.DeclareClassFieldHasInitializer,this.state.startLoc);}if(node.abstract&&this.match(29)){const{key}=node;this.raise(TSErrors.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:key.type==="Identifier"&&!node.computed?key.name:`[${this.input.slice(this.offsetToSourcePos(key.start),this.offsetToSourcePos(key.end))}]`});}return super.parseClassProperty(node);}parseClassPrivateProperty(node){if(node.abstract){this.raise(TSErrors.PrivateElementHasAbstract,node);}if(node.accessibility){this.raise(TSErrors.PrivateElementHasAccessibility,node,{modifier:node.accessibility});}this.parseClassPropertyAnnotation(node);return super.parseClassPrivateProperty(node);}parseClassAccessorProperty(node){this.parseClassPropertyAnnotation(node);if(node.optional){this.raise(TSErrors.AccessorCannotBeOptional,node);}return super.parseClassAccessorProperty(node);}pushClassMethod(classBody,method,isGenerator,isAsync,isConstructor,allowsDirectSuper){const typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(typeParameters&&isConstructor){this.raise(TSErrors.ConstructorHasTypeParameters,typeParameters);}const{declare=false,kind}=method;if(declare&&(kind==="get"||kind==="set")){this.raise(TSErrors.DeclareAccessor,method,{kind});}if(typeParameters)method.typeParameters=typeParameters;super.pushClassMethod(classBody,method,isGenerator,isAsync,isConstructor,allowsDirectSuper);}pushClassPrivateMethod(classBody,method,isGenerator,isAsync){const typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(typeParameters)method.typeParameters=typeParameters;super.pushClassPrivateMethod(classBody,method,isGenerator,isAsync);}declareClassPrivateMethodInScope(node,kind){if(node.type==="TSDeclareMethod")return;if(node.type==="MethodDefinition"&&node.body==null){return;}super.declareClassPrivateMethodInScope(node,kind);}parseClassSuper(node){super.parseClassSuper(node);if(node.superClass&&(this.match(47)||this.match(51))){{node.superTypeParameters=this.tsParseTypeArgumentsInExpression();}}if(this.eatContextual(113)){node.implements=this.tsParseHeritageClause("implements");}}parseObjPropValue(prop,startLoc,isGenerator,isAsync,isPattern,isAccessor,refExpressionErrors){const typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(typeParameters)prop.typeParameters=typeParameters;return super.parseObjPropValue(prop,startLoc,isGenerator,isAsync,isPattern,isAccessor,refExpressionErrors);}parseFunctionParams(node,isConstructor){const typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(typeParameters)node.typeParameters=typeParameters;super.parseFunctionParams(node,isConstructor);}parseVarId(decl,kind){super.parseVarId(decl,kind);if(decl.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)){decl.definite=true;}const type=this.tsTryParseTypeAnnotation();if(type){decl.id.typeAnnotation=type;this.resetEndLocation(decl.id);}}parseAsyncArrowFromCallExpression(node,call){if(this.match(14)){node.returnType=this.tsParseTypeAnnotation();}return super.parseAsyncArrowFromCallExpression(node,call);}parseMaybeAssign(refExpressionErrors,afterLeftParse){var _jsx,_jsx2,_typeCast,_jsx3,_typeCast2;let state;let jsx;let typeCast;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){state=this.state.clone();jsx=this.tryParse(()=>super.parseMaybeAssign(refExpressionErrors,afterLeftParse),state);if(!jsx.error)return jsx.node;const{context}=this.state;const currentContext=context[context.length-1];if(currentContext===types.j_oTag||currentContext===types.j_expr){context.pop();}}if(!((_jsx=jsx)!=null&&_jsx.error)&&!this.match(47)){return super.parseMaybeAssign(refExpressionErrors,afterLeftParse);}if(!state||state===this.state)state=this.state.clone();let typeParameters;const arrow=this.tryParse(abort=>{var _expr$extra,_typeParameters;typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier);const expr=super.parseMaybeAssign(refExpressionErrors,afterLeftParse);if(expr.type!=="ArrowFunctionExpression"||(_expr$extra=expr.extra)!=null&&_expr$extra.parenthesized){abort();}if(((_typeParameters=typeParameters)==null?void 0:_typeParameters.params.length)!==0){this.resetStartLocationFromNode(expr,typeParameters);}expr.typeParameters=typeParameters;return expr;},state);if(!arrow.error&&!arrow.aborted){if(typeParameters)this.reportReservedArrowTypeParam(typeParameters);return arrow.node;}if(!jsx){assert(!this.hasPlugin("jsx"));typeCast=this.tryParse(()=>super.parseMaybeAssign(refExpressionErrors,afterLeftParse),state);if(!typeCast.error)return typeCast.node;}if((_jsx2=jsx)!=null&&_jsx2.node){this.state=jsx.failState;return jsx.node;}if(arrow.node){this.state=arrow.failState;if(typeParameters)this.reportReservedArrowTypeParam(typeParameters);return arrow.node;}if((_typeCast=typeCast)!=null&&_typeCast.node){this.state=typeCast.failState;return typeCast.node;}throw((_jsx3=jsx)==null?void 0:_jsx3.error)||arrow.error||((_typeCast2=typeCast)==null?void 0:_typeCast2.error);}reportReservedArrowTypeParam(node){var _node$extra2;if(node.params.length===1&&!node.params[0].constraint&&!((_node$extra2=node.extra)!=null&&_node$extra2.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")){this.raise(TSErrors.ReservedArrowTypeParam,node);}}parseMaybeUnary(refExpressionErrors,sawUnary){if(!this.hasPlugin("jsx")&&this.match(47)){return this.tsParseTypeAssertion();}return super.parseMaybeUnary(refExpressionErrors,sawUnary);}parseArrow(node){if(this.match(14)){const result=this.tryParse(abort=>{const returnType=this.tsParseTypeOrTypePredicateAnnotation(14);if(this.canInsertSemicolon()||!this.match(19))abort();return returnType;});if(result.aborted)return;if(!result.thrown){if(result.error)this.state=result.failState;node.returnType=result.node;}}return super.parseArrow(node);}parseFunctionParamType(param){if(this.eat(17)){param.optional=true;}const type=this.tsTryParseTypeAnnotation();if(type)param.typeAnnotation=type;this.resetEndLocation(param);return param;}isAssignable(node,isBinding){switch(node.type){case"TSTypeCastExpression":return this.isAssignable(node.expression,isBinding);case"TSParameterProperty":return true;default:return super.isAssignable(node,isBinding);}}toAssignable(node,isLHS=false){switch(node.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(node,isLHS);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(isLHS){this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter,node);}else{this.raise(TSErrors.UnexpectedTypeCastInParameter,node);}this.toAssignable(node.expression,isLHS);break;case"AssignmentExpression":if(!isLHS&&node.left.type==="TSTypeCastExpression"){node.left=this.typeCastToParameter(node.left);}default:super.toAssignable(node,isLHS);}}toAssignableParenthesizedExpression(node,isLHS){switch(node.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(node.expression,isLHS);break;default:super.toAssignable(node,isLHS);}}checkToRestConversion(node,allowPattern){switch(node.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(node.expression,false);break;default:super.checkToRestConversion(node,allowPattern);}}isValidLVal(type,isUnparenthesizedInAssign,binding){switch(type){case"TSTypeCastExpression":return true;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(binding!==64||!isUnparenthesizedInAssign)&&["expression",true];default:return super.isValidLVal(type,isUnparenthesizedInAssign,binding);}}parseBindingAtom(){if(this.state.type===78){return this.parseIdentifier(true);}return super.parseBindingAtom();}parseMaybeDecoratorArguments(expr,startLoc){if(this.match(47)||this.match(51)){const typeArguments=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const call=super.parseMaybeDecoratorArguments(expr,startLoc);{call.typeParameters=typeArguments;}return call;}this.unexpected(null,10);}return super.parseMaybeDecoratorArguments(expr,startLoc);}checkCommaAfterRest(close){if(this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===close){this.next();return false;}return super.checkCommaAfterRest(close);}isClassMethod(){return this.match(47)||super.isClassMethod();}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty();}parseMaybeDefault(startLoc,left){const node=super.parseMaybeDefault(startLoc,left);if(node.type==="AssignmentPattern"&&node.typeAnnotation&&node.right.startthis.isAssignable(expr,true));}return super.shouldParseArrow(params);}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow();}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass();}jsxParseOpeningElementAfterName(node){if(this.match(47)||this.match(51)){const typeArguments=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());if(typeArguments){{node.typeParameters=typeArguments;}}}return super.jsxParseOpeningElementAfterName(node);}getGetterSetterExpectedParamCount(method){const baseCount=super.getGetterSetterExpectedParamCount(method);const params=this.getObjectOrClassMethodParams(method);const firstParam=params[0];const hasContextParam=firstParam&&this.isThisParam(firstParam);return hasContextParam?baseCount+1:baseCount;}parseCatchClauseParam(){const param=super.parseCatchClauseParam();const type=this.tsTryParseTypeAnnotation();if(type){param.typeAnnotation=type;this.resetEndLocation(param);}return param;}tsInAmbientContext(cb){const{isAmbientContext:oldIsAmbientContext,strict:oldStrict}=this.state;this.state.isAmbientContext=true;this.state.strict=false;try{return cb();}finally{this.state.isAmbientContext=oldIsAmbientContext;this.state.strict=oldStrict;}}parseClass(node,isStatement,optionalId){const oldInAbstractClass=this.state.inAbstractClass;this.state.inAbstractClass=!!node.abstract;try{return super.parseClass(node,isStatement,optionalId);}finally{this.state.inAbstractClass=oldInAbstractClass;}}tsParseAbstractDeclaration(node,decorators){if(this.match(80)){node.abstract=true;return this.maybeTakeDecorators(decorators,this.parseClass(node,true,false));}else if(this.isContextual(129)){if(!this.hasFollowingLineBreak()){node.abstract=true;this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer,node);return this.tsParseInterfaceDeclaration(node);}}else{this.unexpected(null,80);}}parseMethod(node,isGenerator,isAsync,isConstructor,allowDirectSuper,type,inClassScope){const method=super.parseMethod(node,isGenerator,isAsync,isConstructor,allowDirectSuper,type,inClassScope);if(method.abstract||method.type==="TSAbstractMethodDefinition"){const hasEstreePlugin=this.hasPlugin("estree");const methodFn=hasEstreePlugin?method.value:method;if(methodFn.body){const{key}=method;this.raise(TSErrors.AbstractMethodHasImplementation,method,{methodName:key.type==="Identifier"&&!method.computed?key.name:`[${this.input.slice(this.offsetToSourcePos(key.start),this.offsetToSourcePos(key.end))}]`});}}return method;}tsParseTypeParameterName(){const typeName=this.parseIdentifier();return typeName.name;}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts");}parse(){if(this.shouldParseAsAmbientContext()){this.state.isAmbientContext=true;}return super.parse();}getExpression(){if(this.shouldParseAsAmbientContext()){this.state.isAmbientContext=true;}return super.getExpression();}parseExportSpecifier(node,isString,isInTypeExport,isMaybeTypeOnly){if(!isString&&isMaybeTypeOnly){this.parseTypeOnlyImportExportSpecifier(node,false,isInTypeExport);return this.finishNode(node,"ExportSpecifier");}node.exportKind="value";return super.parseExportSpecifier(node,isString,isInTypeExport,isMaybeTypeOnly);}parseImportSpecifier(specifier,importedIsString,isInTypeOnlyImport,isMaybeTypeOnly,bindingType){if(!importedIsString&&isMaybeTypeOnly){this.parseTypeOnlyImportExportSpecifier(specifier,true,isInTypeOnlyImport);return this.finishNode(specifier,"ImportSpecifier");}specifier.importKind="value";return super.parseImportSpecifier(specifier,importedIsString,isInTypeOnlyImport,isMaybeTypeOnly,isInTypeOnlyImport?4098:4096);}parseTypeOnlyImportExportSpecifier(node,isImport,isInTypeOnlyImportExport){const leftOfAsKey=isImport?"imported":"local";const rightOfAsKey=isImport?"local":"exported";let leftOfAs=node[leftOfAsKey];let rightOfAs;let hasTypeSpecifier=false;let canParseAsKeyword=true;const loc=leftOfAs.loc.start;if(this.isContextual(93)){const firstAs=this.parseIdentifier();if(this.isContextual(93)){const secondAs=this.parseIdentifier();if(tokenIsKeywordOrIdentifier(this.state.type)){hasTypeSpecifier=true;leftOfAs=firstAs;rightOfAs=isImport?this.parseIdentifier():this.parseModuleExportName();canParseAsKeyword=false;}else{rightOfAs=secondAs;canParseAsKeyword=false;}}else if(tokenIsKeywordOrIdentifier(this.state.type)){canParseAsKeyword=false;rightOfAs=isImport?this.parseIdentifier():this.parseModuleExportName();}else{hasTypeSpecifier=true;leftOfAs=firstAs;}}else if(tokenIsKeywordOrIdentifier(this.state.type)){hasTypeSpecifier=true;if(isImport){leftOfAs=this.parseIdentifier(true);if(!this.isContextual(93)){this.checkReservedWord(leftOfAs.name,leftOfAs.loc.start,true,true);}}else{leftOfAs=this.parseModuleExportName();}}if(hasTypeSpecifier&&isInTypeOnlyImportExport){this.raise(isImport?TSErrors.TypeModifierIsUsedInTypeImports:TSErrors.TypeModifierIsUsedInTypeExports,loc);}node[leftOfAsKey]=leftOfAs;node[rightOfAsKey]=rightOfAs;const kindKey=isImport?"importKind":"exportKind";node[kindKey]=hasTypeSpecifier?"type":"value";if(canParseAsKeyword&&this.eatContextual(93)){node[rightOfAsKey]=isImport?this.parseIdentifier():this.parseModuleExportName();}if(!node[rightOfAsKey]){node[rightOfAsKey]=this.cloneIdentifier(node[leftOfAsKey]);}if(isImport){this.checkIdentifier(node[rightOfAsKey],hasTypeSpecifier?4098:4096);}}fillOptionalPropertiesForTSESLint(node){var _node$directive,_node$decorators,_node$optional,_node$typeAnnotation,_node$accessibility,_node$decorators2,_node$override,_node$readonly,_node$static,_node$declare,_node$returnType,_node$typeParameters,_node$optional2,_node$optional3,_node$accessibility2,_node$readonly2,_node$static2,_node$declare2,_node$definite,_node$readonly3,_node$typeAnnotation2,_node$accessibility3,_node$decorators3,_node$override2,_node$optional4,_node$id,_node$abstract,_node$declare3,_node$decorators4,_node$implements,_node$superTypeArgume,_node$typeParameters2,_node$declare4,_node$definite2,_node$const,_node$declare5,_node$computed,_node$qualifier,_node$options,_node$declare6,_node$extends,_node$declare7,_node$global,_node$const2,_node$in,_node$out;switch(node.type){case"ExpressionStatement":(_node$directive=node.directive)!=null?_node$directive:node.directive=undefined;return;case"RestElement":node.value=undefined;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(_node$decorators=node.decorators)!=null?_node$decorators:node.decorators=[];(_node$optional=node.optional)!=null?_node$optional:node.optional=false;(_node$typeAnnotation=node.typeAnnotation)!=null?_node$typeAnnotation:node.typeAnnotation=undefined;return;case"TSParameterProperty":(_node$accessibility=node.accessibility)!=null?_node$accessibility:node.accessibility=undefined;(_node$decorators2=node.decorators)!=null?_node$decorators2:node.decorators=[];(_node$override=node.override)!=null?_node$override:node.override=false;(_node$readonly=node.readonly)!=null?_node$readonly:node.readonly=false;(_node$static=node.static)!=null?_node$static:node.static=false;return;case"TSEmptyBodyFunctionExpression":node.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(_node$declare=node.declare)!=null?_node$declare:node.declare=false;(_node$returnType=node.returnType)!=null?_node$returnType:node.returnType=undefined;(_node$typeParameters=node.typeParameters)!=null?_node$typeParameters:node.typeParameters=undefined;return;case"Property":(_node$optional2=node.optional)!=null?_node$optional2:node.optional=false;return;case"TSMethodSignature":case"TSPropertySignature":(_node$optional3=node.optional)!=null?_node$optional3:node.optional=false;case"TSIndexSignature":(_node$accessibility2=node.accessibility)!=null?_node$accessibility2:node.accessibility=undefined;(_node$readonly2=node.readonly)!=null?_node$readonly2:node.readonly=false;(_node$static2=node.static)!=null?_node$static2:node.static=false;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(_node$declare2=node.declare)!=null?_node$declare2:node.declare=false;(_node$definite=node.definite)!=null?_node$definite:node.definite=false;(_node$readonly3=node.readonly)!=null?_node$readonly3:node.readonly=false;(_node$typeAnnotation2=node.typeAnnotation)!=null?_node$typeAnnotation2:node.typeAnnotation=undefined;case"TSAbstractMethodDefinition":case"MethodDefinition":(_node$accessibility3=node.accessibility)!=null?_node$accessibility3:node.accessibility=undefined;(_node$decorators3=node.decorators)!=null?_node$decorators3:node.decorators=[];(_node$override2=node.override)!=null?_node$override2:node.override=false;(_node$optional4=node.optional)!=null?_node$optional4:node.optional=false;return;case"ClassExpression":(_node$id=node.id)!=null?_node$id:node.id=null;case"ClassDeclaration":(_node$abstract=node.abstract)!=null?_node$abstract:node.abstract=false;(_node$declare3=node.declare)!=null?_node$declare3:node.declare=false;(_node$decorators4=node.decorators)!=null?_node$decorators4:node.decorators=[];(_node$implements=node.implements)!=null?_node$implements:node.implements=[];(_node$superTypeArgume=node.superTypeArguments)!=null?_node$superTypeArgume:node.superTypeArguments=undefined;(_node$typeParameters2=node.typeParameters)!=null?_node$typeParameters2:node.typeParameters=undefined;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(_node$declare4=node.declare)!=null?_node$declare4:node.declare=false;return;case"VariableDeclarator":(_node$definite2=node.definite)!=null?_node$definite2:node.definite=false;return;case"TSEnumDeclaration":(_node$const=node.const)!=null?_node$const:node.const=false;(_node$declare5=node.declare)!=null?_node$declare5:node.declare=false;return;case"TSEnumMember":(_node$computed=node.computed)!=null?_node$computed:node.computed=false;return;case"TSImportType":(_node$qualifier=node.qualifier)!=null?_node$qualifier:node.qualifier=null;(_node$options=node.options)!=null?_node$options:node.options=null;return;case"TSInterfaceDeclaration":(_node$declare6=node.declare)!=null?_node$declare6:node.declare=false;(_node$extends=node.extends)!=null?_node$extends:node.extends=[];return;case"TSModuleDeclaration":(_node$declare7=node.declare)!=null?_node$declare7:node.declare=false;(_node$global=node.global)!=null?_node$global:node.global=node.kind==="global";return;case"TSTypeParameter":(_node$const2=node.const)!=null?_node$const2:node.const=false;(_node$in=node.in)!=null?_node$in:node.in=false;(_node$out=node.out)!=null?_node$out:node.out=false;return;}}};function isPossiblyLiteralEnum(expression){if(expression.type!=="MemberExpression")return false;const{computed,property}=expression;if(computed&&property.type!=="StringLiteral"&&(property.type!=="TemplateLiteral"||property.expressions.length>0)){return false;}return isUncomputedMemberExpressionChain(expression.object);}function isValidAmbientConstInitializer(expression,estree){var _expression$extra;const{type}=expression;if((_expression$extra=expression.extra)!=null&&_expression$extra.parenthesized){return false;}if(estree){if(type==="Literal"){const{value}=expression;if(typeof value==="string"||typeof value==="boolean"){return true;}}}else{if(type==="StringLiteral"||type==="BooleanLiteral"){return true;}}if(isNumber(expression,estree)||isNegativeNumber(expression,estree)){return true;}if(type==="TemplateLiteral"&&expression.expressions.length===0){return true;}if(isPossiblyLiteralEnum(expression)){return true;}return false;}function isNumber(expression,estree){if(estree){return expression.type==="Literal"&&(typeof expression.value==="number"||"bigint"in expression);}return expression.type==="NumericLiteral"||expression.type==="BigIntLiteral";}function isNegativeNumber(expression,estree){if(expression.type==="UnaryExpression"){const{operator,argument}=expression;if(operator==="-"&&isNumber(argument,estree)){return true;}}return false;}function isUncomputedMemberExpressionChain(expression){if(expression.type==="Identifier")return true;if(expression.type!=="MemberExpression"||expression.computed){return false;}return isUncomputedMemberExpressionChain(expression.object);}const PlaceholderErrors=ParseErrorEnum`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var placeholders=superClass=>class PlaceholdersParserMixin extends superClass{parsePlaceholder(expectedNode){if(this.match(133)){const node=this.startNode();this.next();this.assertNoSpace();node.name=super.parseIdentifier(true);this.assertNoSpace();this.expect(133);return this.finishPlaceholder(node,expectedNode);}}finishPlaceholder(node,expectedNode){let placeholder=node;if(!placeholder.expectedNode||!placeholder.type){placeholder=this.finishNode(placeholder,"Placeholder");}placeholder.expectedNode=expectedNode;return placeholder;}getTokenFromCode(code){if(code===37&&this.input.charCodeAt(this.state.pos+1)===37){this.finishOp(133,2);}else{super.getTokenFromCode(code);}}parseExprAtom(refExpressionErrors){return this.parsePlaceholder("Expression")||super.parseExprAtom(refExpressionErrors);}parseIdentifier(liberal){return this.parsePlaceholder("Identifier")||super.parseIdentifier(liberal);}checkReservedWord(word,startLoc,checkKeywords,isBinding){if(word!==undefined){super.checkReservedWord(word,startLoc,checkKeywords,isBinding);}}cloneIdentifier(node){const cloned=super.cloneIdentifier(node);if(cloned.type==="Placeholder"){cloned.expectedNode=node.expectedNode;}return cloned;}cloneStringLiteral(node){if(node.type==="Placeholder"){return this.cloneIdentifier(node);}return super.cloneStringLiteral(node);}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom();}isValidLVal(type,isParenthesized,binding){return type==="Placeholder"||super.isValidLVal(type,isParenthesized,binding);}toAssignable(node,isLHS){if(node&&node.type==="Placeholder"&&node.expectedNode==="Expression"){node.expectedNode="Pattern";}else{super.toAssignable(node,isLHS);}}chStartsBindingIdentifier(ch,pos){if(super.chStartsBindingIdentifier(ch,pos)){return true;}const nextToken=this.lookahead();if(nextToken.type===133){return true;}return false;}verifyBreakContinue(node,isBreak){if(node.label&&node.label.type==="Placeholder")return;super.verifyBreakContinue(node,isBreak);}parseExpressionStatement(node,expr){var _expr$extra;if(expr.type!=="Placeholder"||(_expr$extra=expr.extra)!=null&&_expr$extra.parenthesized){return super.parseExpressionStatement(node,expr);}if(this.match(14)){const stmt=node;stmt.label=this.finishPlaceholder(expr,"Identifier");this.next();stmt.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration();return this.finishNode(stmt,"LabeledStatement");}this.semicolon();const stmtPlaceholder=node;stmtPlaceholder.name=expr.name;return this.finishPlaceholder(stmtPlaceholder,"Statement");}parseBlock(allowDirectives,createNewLexicalScope,afterBlockParse){return this.parsePlaceholder("BlockStatement")||super.parseBlock(allowDirectives,createNewLexicalScope,afterBlockParse);}parseFunctionId(requireId){return this.parsePlaceholder("Identifier")||super.parseFunctionId(requireId);}parseClass(node,isStatement,optionalId){const type=isStatement?"ClassDeclaration":"ClassExpression";this.next();const oldStrict=this.state.strict;const placeholder=this.parsePlaceholder("Identifier");if(placeholder){if(this.match(81)||this.match(133)||this.match(5)){node.id=placeholder;}else if(optionalId||!isStatement){node.id=null;node.body=this.finishPlaceholder(placeholder,"ClassBody");return this.finishNode(node,type);}else{throw this.raise(PlaceholderErrors.ClassNameIsRequired,this.state.startLoc);}}else{this.parseClassId(node,isStatement,optionalId);}super.parseClassSuper(node);node.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!node.superClass,oldStrict);return this.finishNode(node,type);}parseExport(node,decorators){const placeholder=this.parsePlaceholder("Identifier");if(!placeholder)return super.parseExport(node,decorators);const node2=node;if(!this.isContextual(98)&&!this.match(12)){node2.specifiers=[];node2.source=null;node2.declaration=this.finishPlaceholder(placeholder,"Declaration");return this.finishNode(node2,"ExportNamedDeclaration");}this.expectPlugin("exportDefaultFrom");const specifier=this.startNode();specifier.exported=placeholder;node2.specifiers=[this.finishNode(specifier,"ExportDefaultSpecifier")];return super.parseExport(node2,decorators);}isExportDefaultSpecifier(){if(this.match(65)){const next=this.nextTokenStart();if(this.isUnparsedContextual(next,"from")){if(this.input.startsWith(tokenLabelName(133),this.nextTokenStartSince(next+4))){return true;}}}return super.isExportDefaultSpecifier();}maybeParseExportDefaultSpecifier(node,maybeDefaultIdentifier){var _specifiers;if((_specifiers=node.specifiers)!=null&&_specifiers.length){return true;}return super.maybeParseExportDefaultSpecifier(node,maybeDefaultIdentifier);}checkExport(node){const{specifiers}=node;if(specifiers!=null&&specifiers.length){node.specifiers=specifiers.filter(node=>node.exported.type==="Placeholder");}super.checkExport(node);node.specifiers=specifiers;}parseImport(node){const placeholder=this.parsePlaceholder("Identifier");if(!placeholder)return super.parseImport(node);node.specifiers=[];if(!this.isContextual(98)&&!this.match(12)){node.source=this.finishPlaceholder(placeholder,"StringLiteral");this.semicolon();return this.finishNode(node,"ImportDeclaration");}const specifier=this.startNodeAtNode(placeholder);specifier.local=placeholder;node.specifiers.push(this.finishNode(specifier,"ImportDefaultSpecifier"));if(this.eat(12)){const hasStarImport=this.maybeParseStarImportSpecifier(node);if(!hasStarImport)this.parseNamedImportSpecifiers(node);}this.expectContextual(98);node.source=this.parseImportSource();this.semicolon();return this.finishNode(node,"ImportDeclaration");}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource();}assertNoSpace(){if(this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)){this.raise(PlaceholderErrors.UnexpectedSpace,this.state.lastTokEndLoc);}}};var v8intrinsic=superClass=>class V8IntrinsicMixin extends superClass{parseV8Intrinsic(){if(this.match(54)){const v8IntrinsicStartLoc=this.state.startLoc;const node=this.startNode();this.next();if(tokenIsIdentifier(this.state.type)){const name=this.parseIdentifierName();const identifier=this.createIdentifier(node,name);this.castNodeTo(identifier,"V8IntrinsicIdentifier");if(this.match(10)){return identifier;}}this.unexpected(v8IntrinsicStartLoc);}}parseExprAtom(refExpressionErrors){return this.parseV8Intrinsic()||super.parseExprAtom(refExpressionErrors);}};const PIPELINE_PROPOSALS=["minimal","fsharp","hack","smart"];const TOPIC_TOKENS=["^^","@@","^","%","#"];function validatePlugins(pluginsMap){if(pluginsMap.has("decorators")){if(pluginsMap.has("decorators-legacy")){throw new Error("Cannot use the decorators and decorators-legacy plugin together");}const decoratorsBeforeExport=pluginsMap.get("decorators").decoratorsBeforeExport;if(decoratorsBeforeExport!=null&&typeof decoratorsBeforeExport!=="boolean"){throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");}const allowCallParenthesized=pluginsMap.get("decorators").allowCallParenthesized;if(allowCallParenthesized!=null&&typeof allowCallParenthesized!=="boolean"){throw new Error("'allowCallParenthesized' must be a boolean.");}}if(pluginsMap.has("flow")&&pluginsMap.has("typescript")){throw new Error("Cannot combine flow and typescript plugins.");}if(pluginsMap.has("placeholders")&&pluginsMap.has("v8intrinsic")){throw new Error("Cannot combine placeholders and v8intrinsic plugins.");}if(pluginsMap.has("pipelineOperator")){var _pluginsMap$get2;const proposal=pluginsMap.get("pipelineOperator").proposal;if(!PIPELINE_PROPOSALS.includes(proposal)){const proposalList=PIPELINE_PROPOSALS.map(p=>`"${p}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);}if(proposal==="hack"){if(pluginsMap.has("placeholders")){throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");}if(pluginsMap.has("v8intrinsic")){throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");}const topicToken=pluginsMap.get("pipelineOperator").topicToken;if(!TOPIC_TOKENS.includes(topicToken)){const tokenList=TOPIC_TOKENS.map(t=>`"${t}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);}{var _pluginsMap$get;if(topicToken==="#"&&((_pluginsMap$get=pluginsMap.get("recordAndTuple"))==null?void 0:_pluginsMap$get.syntaxType)==="hash"){throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",pluginsMap.get("recordAndTuple")])}\`.`);}}}else if(proposal==="smart"&&((_pluginsMap$get2=pluginsMap.get("recordAndTuple"))==null?void 0:_pluginsMap$get2.syntaxType)==="hash"){throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",pluginsMap.get("recordAndTuple")])}\`.`);}}if(pluginsMap.has("moduleAttributes")){{if(pluginsMap.has("deprecatedImportAssert")||pluginsMap.has("importAssertions")){throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");}const moduleAttributesVersionPluginOption=pluginsMap.get("moduleAttributes").version;if(moduleAttributesVersionPluginOption!=="may-2020"){throw new Error("The 'moduleAttributes' plugin requires a 'version' option,"+" representing the last proposal update. Currently, the"+" only supported value is 'may-2020'.");}}}if(pluginsMap.has("importAssertions")){if(pluginsMap.has("deprecatedImportAssert")){throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");}}if(!pluginsMap.has("deprecatedImportAssert")&&pluginsMap.has("importAttributes")&&pluginsMap.get("importAttributes").deprecatedAssertSyntax){{pluginsMap.set("deprecatedImportAssert",{});}}if(pluginsMap.has("recordAndTuple")){{const syntaxType=pluginsMap.get("recordAndTuple").syntaxType;if(syntaxType!=null){const RECORD_AND_TUPLE_SYNTAX_TYPES=["hash","bar"];if(!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)){throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+RECORD_AND_TUPLE_SYNTAX_TYPES.map(p=>`'${p}'`).join(", "));}}}}if(pluginsMap.has("asyncDoExpressions")&&!pluginsMap.has("doExpressions")){const error=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");error.missingPlugins="doExpressions";throw error;}if(pluginsMap.has("optionalChainingAssign")&&pluginsMap.get("optionalChainingAssign").version!=="2023-07"){throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option,"+" representing the last proposal update. Currently, the"+" only supported value is '2023-07'.");}}const mixinPlugins={estree,jsx,flow,typescript,v8intrinsic,placeholders};const mixinPluginNames=Object.keys(mixinPlugins);class ExpressionParser extends LValParser{checkProto(prop,isRecord,sawProto,refExpressionErrors){if(prop.type==="SpreadElement"||this.isObjectMethod(prop)||prop.computed||prop.shorthand){return sawProto;}const key=prop.key;const name=key.type==="Identifier"?key.name:key.value;if(name==="__proto__"){if(isRecord){this.raise(Errors.RecordNoProto,key);return true;}if(sawProto){if(refExpressionErrors){if(refExpressionErrors.doubleProtoLoc===null){refExpressionErrors.doubleProtoLoc=key.loc.start;}}else{this.raise(Errors.DuplicateProto,key);}}return true;}return sawProto;}shouldExitDescending(expr,potentialArrowAt){return expr.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(expr.start)===potentialArrowAt;}getExpression(){this.enterInitialScopes();this.nextToken();const expr=this.parseExpression();if(!this.match(140)){this.unexpected();}this.finalizeRemainingComments();expr.comments=this.comments;expr.errors=this.state.errors;if(this.optionFlags&256){expr.tokens=this.tokens;}return expr;}parseExpression(disallowIn,refExpressionErrors){if(disallowIn){return this.disallowInAnd(()=>this.parseExpressionBase(refExpressionErrors));}return this.allowInAnd(()=>this.parseExpressionBase(refExpressionErrors));}parseExpressionBase(refExpressionErrors){const startLoc=this.state.startLoc;const expr=this.parseMaybeAssign(refExpressionErrors);if(this.match(12)){const node=this.startNodeAt(startLoc);node.expressions=[expr];while(this.eat(12)){node.expressions.push(this.parseMaybeAssign(refExpressionErrors));}this.toReferencedList(node.expressions);return this.finishNode(node,"SequenceExpression");}return expr;}parseMaybeAssignDisallowIn(refExpressionErrors,afterLeftParse){return this.disallowInAnd(()=>this.parseMaybeAssign(refExpressionErrors,afterLeftParse));}parseMaybeAssignAllowIn(refExpressionErrors,afterLeftParse){return this.allowInAnd(()=>this.parseMaybeAssign(refExpressionErrors,afterLeftParse));}setOptionalParametersError(refExpressionErrors){refExpressionErrors.optionalParametersLoc=this.state.startLoc;}parseMaybeAssign(refExpressionErrors,afterLeftParse){const startLoc=this.state.startLoc;const isYield=this.isContextual(108);if(isYield){if(this.prodParam.hasYield){this.next();let left=this.parseYield(startLoc);if(afterLeftParse){left=afterLeftParse.call(this,left,startLoc);}return left;}}let ownExpressionErrors;if(refExpressionErrors){ownExpressionErrors=false;}else{refExpressionErrors=new ExpressionErrors();ownExpressionErrors=true;}const{type}=this.state;if(type===10||tokenIsIdentifier(type)){this.state.potentialArrowAt=this.state.start;}let left=this.parseMaybeConditional(refExpressionErrors);if(afterLeftParse){left=afterLeftParse.call(this,left,startLoc);}if(tokenIsAssignment(this.state.type)){const node=this.startNodeAt(startLoc);const operator=this.state.value;node.operator=operator;if(this.match(29)){this.toAssignable(left,true);node.left=left;const startIndex=startLoc.index;if(refExpressionErrors.doubleProtoLoc!=null&&refExpressionErrors.doubleProtoLoc.index>=startIndex){refExpressionErrors.doubleProtoLoc=null;}if(refExpressionErrors.shorthandAssignLoc!=null&&refExpressionErrors.shorthandAssignLoc.index>=startIndex){refExpressionErrors.shorthandAssignLoc=null;}if(refExpressionErrors.privateKeyLoc!=null&&refExpressionErrors.privateKeyLoc.index>=startIndex){this.checkDestructuringPrivate(refExpressionErrors);refExpressionErrors.privateKeyLoc=null;}}else{node.left=left;}this.next();node.right=this.parseMaybeAssign();this.checkLVal(left,this.finishNode(node,"AssignmentExpression"));return node;}else if(ownExpressionErrors){this.checkExpressionErrors(refExpressionErrors,true);}if(isYield){const{type}=this.state;const startsExpr=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(type):tokenCanStartExpression(type)&&!this.match(54);if(startsExpr&&!this.isAmbiguousPrefixOrIdentifier()){this.raiseOverwrite(Errors.YieldNotInGeneratorFunction,startLoc);return this.parseYield(startLoc);}}return left;}parseMaybeConditional(refExpressionErrors){const startLoc=this.state.startLoc;const potentialArrowAt=this.state.potentialArrowAt;const expr=this.parseExprOps(refExpressionErrors);if(this.shouldExitDescending(expr,potentialArrowAt)){return expr;}return this.parseConditional(expr,startLoc,refExpressionErrors);}parseConditional(expr,startLoc,refExpressionErrors){if(this.eat(17)){const node=this.startNodeAt(startLoc);node.test=expr;node.consequent=this.parseMaybeAssignAllowIn();this.expect(14);node.alternate=this.parseMaybeAssign();return this.finishNode(node,"ConditionalExpression");}return expr;}parseMaybeUnaryOrPrivate(refExpressionErrors){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(refExpressionErrors);}parseExprOps(refExpressionErrors){const startLoc=this.state.startLoc;const potentialArrowAt=this.state.potentialArrowAt;const expr=this.parseMaybeUnaryOrPrivate(refExpressionErrors);if(this.shouldExitDescending(expr,potentialArrowAt)){return expr;}return this.parseExprOp(expr,startLoc,-1);}parseExprOp(left,leftStartLoc,minPrec){if(this.isPrivateName(left)){const value=this.getPrivateNameSV(left);if(minPrec>=tokenOperatorPrecedence(58)||!this.prodParam.hasIn||!this.match(58)){this.raise(Errors.PrivateInExpectedIn,left,{identifierName:value});}this.classScope.usePrivateName(value,left.loc.start);}const op=this.state.type;if(tokenIsOperator(op)&&(this.prodParam.hasIn||!this.match(58))){let prec=tokenOperatorPrecedence(op);if(prec>minPrec){if(op===39){this.expectPlugin("pipelineOperator");if(this.state.inFSharpPipelineDirectBody){return left;}this.checkPipelineAtInfixOperator(left,leftStartLoc);}const node=this.startNodeAt(leftStartLoc);node.left=left;node.operator=this.state.value;const logical=op===41||op===42;const coalesce=op===40;if(coalesce){prec=tokenOperatorPrecedence(42);}this.next();if(op===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])){if(this.state.type===96&&this.prodParam.hasAwait){throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody,this.state.startLoc);}}node.right=this.parseExprOpRightExpr(op,prec);const finishedNode=this.finishNode(node,logical||coalesce?"LogicalExpression":"BinaryExpression");const nextOp=this.state.type;if(coalesce&&(nextOp===41||nextOp===42)||logical&&nextOp===40){throw this.raise(Errors.MixingCoalesceWithLogical,this.state.startLoc);}return this.parseExprOp(finishedNode,leftStartLoc,minPrec);}}return left;}parseExprOpRightExpr(op,prec){const startLoc=this.state.startLoc;switch(op){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>{return this.parseHackPipeBody();});case"fsharp":return this.withSoloAwaitPermittingContext(()=>{return this.parseFSharpPipelineBody(prec);});}if(this.getPluginOption("pipelineOperator","proposal")==="smart"){return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(108)){throw this.raise(Errors.PipeBodyIsTighter,this.state.startLoc);}return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op,prec),startLoc);});}default:return this.parseExprOpBaseRightExpr(op,prec);}}parseExprOpBaseRightExpr(op,prec){const startLoc=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),startLoc,tokenIsRightAssociative(op)?prec-1:prec);}parseHackPipeBody(){var _body$extra;const{startLoc}=this.state;const body=this.parseMaybeAssign();const requiredParentheses=UnparenthesizedPipeBodyDescriptions.has(body.type);if(requiredParentheses&&!((_body$extra=body.extra)!=null&&_body$extra.parenthesized)){this.raise(Errors.PipeUnparenthesizedBody,startLoc,{type:body.type});}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(Errors.PipeTopicUnused,startLoc);}return body;}checkExponentialAfterUnary(node){if(this.match(57)){this.raise(Errors.UnexpectedTokenUnaryExponentiation,node.argument);}}parseMaybeUnary(refExpressionErrors,sawUnary){const startLoc=this.state.startLoc;const isAwait=this.isContextual(96);if(isAwait&&this.recordAwaitIfAllowed()){this.next();const expr=this.parseAwait(startLoc);if(!sawUnary)this.checkExponentialAfterUnary(expr);return expr;}const update=this.match(34);const node=this.startNode();if(tokenIsPrefix(this.state.type)){node.operator=this.state.value;node.prefix=true;if(this.match(72)){this.expectPlugin("throwExpressions");}const isDelete=this.match(89);this.next();node.argument=this.parseMaybeUnary(null,true);this.checkExpressionErrors(refExpressionErrors,true);if(this.state.strict&&isDelete){const arg=node.argument;if(arg.type==="Identifier"){this.raise(Errors.StrictDelete,node);}else if(this.hasPropertyAsPrivateName(arg)){this.raise(Errors.DeletePrivateField,node);}}if(!update){if(!sawUnary){this.checkExponentialAfterUnary(node);}return this.finishNode(node,"UnaryExpression");}}const expr=this.parseUpdate(node,update,refExpressionErrors);if(isAwait){const{type}=this.state;const startsExpr=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(type):tokenCanStartExpression(type)&&!this.match(54);if(startsExpr&&!this.isAmbiguousPrefixOrIdentifier()){this.raiseOverwrite(Errors.AwaitNotInAsyncContext,startLoc);return this.parseAwait(startLoc);}}return expr;}parseUpdate(node,update,refExpressionErrors){if(update){const updateExpressionNode=node;this.checkLVal(updateExpressionNode.argument,this.finishNode(updateExpressionNode,"UpdateExpression"));return node;}const startLoc=this.state.startLoc;let expr=this.parseExprSubscripts(refExpressionErrors);if(this.checkExpressionErrors(refExpressionErrors,false))return expr;while(tokenIsPostfix(this.state.type)&&!this.canInsertSemicolon()){const node=this.startNodeAt(startLoc);node.operator=this.state.value;node.prefix=false;node.argument=expr;this.next();this.checkLVal(expr,expr=this.finishNode(node,"UpdateExpression"));}return expr;}parseExprSubscripts(refExpressionErrors){const startLoc=this.state.startLoc;const potentialArrowAt=this.state.potentialArrowAt;const expr=this.parseExprAtom(refExpressionErrors);if(this.shouldExitDescending(expr,potentialArrowAt)){return expr;}return this.parseSubscripts(expr,startLoc);}parseSubscripts(base,startLoc,noCalls){const state={optionalChainMember:false,maybeAsyncArrow:this.atPossibleAsyncArrow(base),stop:false};do{base=this.parseSubscript(base,startLoc,noCalls,state);state.maybeAsyncArrow=false;}while(!state.stop);return base;}parseSubscript(base,startLoc,noCalls,state){const{type}=this.state;if(!noCalls&&type===15){return this.parseBind(base,startLoc,noCalls,state);}else if(tokenIsTemplate(type)){return this.parseTaggedTemplateExpression(base,startLoc,state);}let optional=false;if(type===18){if(noCalls){this.raise(Errors.OptionalChainingNoNew,this.state.startLoc);if(this.lookaheadCharCode()===40){return this.stopParseSubscript(base,state);}}state.optionalChainMember=optional=true;this.next();}if(!noCalls&&this.match(10)){return this.parseCoverCallAndAsyncArrowHead(base,startLoc,state,optional);}else{const computed=this.eat(0);if(computed||optional||this.eat(16)){return this.parseMember(base,startLoc,state,computed,optional);}else{return this.stopParseSubscript(base,state);}}}stopParseSubscript(base,state){state.stop=true;return base;}parseMember(base,startLoc,state,computed,optional){const node=this.startNodeAt(startLoc);node.object=base;node.computed=computed;if(computed){node.property=this.parseExpression();this.expect(3);}else if(this.match(139)){if(base.type==="Super"){this.raise(Errors.SuperPrivateField,startLoc);}this.classScope.usePrivateName(this.state.value,this.state.startLoc);node.property=this.parsePrivateName();}else{node.property=this.parseIdentifier(true);}if(state.optionalChainMember){node.optional=optional;return this.finishNode(node,"OptionalMemberExpression");}else{return this.finishNode(node,"MemberExpression");}}parseBind(base,startLoc,noCalls,state){const node=this.startNodeAt(startLoc);node.object=base;this.next();node.callee=this.parseNoCallExpr();state.stop=true;return this.parseSubscripts(this.finishNode(node,"BindExpression"),startLoc,noCalls);}parseCoverCallAndAsyncArrowHead(base,startLoc,state,optional){const oldMaybeInArrowParameters=this.state.maybeInArrowParameters;let refExpressionErrors=null;this.state.maybeInArrowParameters=true;this.next();const node=this.startNodeAt(startLoc);node.callee=base;const{maybeAsyncArrow,optionalChainMember}=state;if(maybeAsyncArrow){this.expressionScope.enter(newAsyncArrowScope());refExpressionErrors=new ExpressionErrors();}if(optionalChainMember){node.optional=optional;}if(optional){node.arguments=this.parseCallExpressionArguments(11);}else{node.arguments=this.parseCallExpressionArguments(11,base.type!=="Super",node,refExpressionErrors);}let finishedNode=this.finishCallExpression(node,optionalChainMember);if(maybeAsyncArrow&&this.shouldParseAsyncArrow()&&!optional){state.stop=true;this.checkDestructuringPrivate(refExpressionErrors);this.expressionScope.validateAsPattern();this.expressionScope.exit();finishedNode=this.parseAsyncArrowFromCallExpression(this.startNodeAt(startLoc),finishedNode);}else{if(maybeAsyncArrow){this.checkExpressionErrors(refExpressionErrors,true);this.expressionScope.exit();}this.toReferencedArguments(finishedNode);}this.state.maybeInArrowParameters=oldMaybeInArrowParameters;return finishedNode;}toReferencedArguments(node,isParenthesizedExpr){this.toReferencedListDeep(node.arguments,isParenthesizedExpr);}parseTaggedTemplateExpression(base,startLoc,state){const node=this.startNodeAt(startLoc);node.tag=base;node.quasi=this.parseTemplate(true);if(state.optionalChainMember){this.raise(Errors.OptionalChainingNoTemplate,startLoc);}return this.finishNode(node,"TaggedTemplateExpression");}atPossibleAsyncArrow(base){return base.type==="Identifier"&&base.name==="async"&&this.state.lastTokEndLoc.index===base.end&&!this.canInsertSemicolon()&&base.end-base.start===5&&this.offsetToSourcePos(base.start)===this.state.potentialArrowAt;}finishCallExpression(node,optional){if(node.callee.type==="Import"){if(node.arguments.length===0||node.arguments.length>2){this.raise(Errors.ImportCallArity,node);}else{for(const arg of node.arguments){if(arg.type==="SpreadElement"){this.raise(Errors.ImportCallSpreadArgument,arg);}}}}return this.finishNode(node,optional?"OptionalCallExpression":"CallExpression");}parseCallExpressionArguments(close,allowPlaceholder,nodeForExtra,refExpressionErrors){const elts=[];let first=true;const oldInFSharpPipelineDirectBody=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;while(!this.eat(close)){if(first){first=false;}else{this.expect(12);if(this.match(close)){if(nodeForExtra){this.addTrailingCommaExtraToNode(nodeForExtra);}this.next();break;}}elts.push(this.parseExprListItem(false,refExpressionErrors,allowPlaceholder));}this.state.inFSharpPipelineDirectBody=oldInFSharpPipelineDirectBody;return elts;}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon();}parseAsyncArrowFromCallExpression(node,call){var _call$extra;this.resetPreviousNodeTrailingComments(call);this.expect(19);this.parseArrowExpression(node,call.arguments,true,(_call$extra=call.extra)==null?void 0:_call$extra.trailingCommaLoc);if(call.innerComments){setInnerComments(node,call.innerComments);}if(call.callee.trailingComments){setInnerComments(node,call.callee.trailingComments);}return node;}parseNoCallExpr(){const startLoc=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),startLoc,true);}parseExprAtom(refExpressionErrors){let node;let decorators=null;const{type}=this.state;switch(type){case 79:return this.parseSuper();case 83:node=this.startNode();this.next();if(this.match(16)){return this.parseImportMetaProperty(node);}if(this.match(10)){if(this.optionFlags&512){return this.parseImportCall(node);}else{return this.finishNode(node,"Import");}}else{this.raise(Errors.UnsupportedImport,this.state.lastTokStartLoc);return this.finishNode(node,"Import");}case 78:node=this.startNode();this.next();return this.finishNode(node,"ThisExpression");case 90:{return this.parseDo(this.startNode(),false);}case 56:case 31:{this.readRegexp();return this.parseRegExpLiteral(this.state.value);}case 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(true);case 86:return this.parseBooleanLiteral(false);case 10:{const canBeArrow=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(canBeArrow);}case 0:{return this.parseArrayLike(3,true,false,refExpressionErrors);}case 5:{return this.parseObjectLike(8,false,false,refExpressionErrors);}case 68:return this.parseFunctionOrFunctionSent();case 26:decorators=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(decorators,this.startNode()),false);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(false);case 15:{node=this.startNode();this.next();node.object=null;const callee=node.callee=this.parseNoCallExpr();if(callee.type==="MemberExpression"){return this.finishNode(node,"BindExpression");}else{throw this.raise(Errors.UnsupportedBind,callee);}}case 139:{this.raise(Errors.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value});return this.parsePrivateName();}case 33:{return this.parseTopicReferenceThenEqualsSign(54,"%");}case 32:{return this.parseTopicReferenceThenEqualsSign(44,"^");}case 37:case 38:{return this.parseTopicReference("hack");}case 44:case 54:case 27:{const pipeProposal=this.getPluginOption("pipelineOperator","proposal");if(pipeProposal){return this.parseTopicReference(pipeProposal);}this.unexpected();break;}case 47:{const lookaheadCh=this.input.codePointAt(this.nextTokenStart());if(isIdentifierStart(lookaheadCh)||lookaheadCh===62){this.expectOnePlugin(["jsx","flow","typescript"]);}else{this.unexpected();}break;}default:{if(type===137){return this.parseDecimalLiteral(this.state.value);}else if(type===2||type===1){return this.parseArrayLike(this.state.type===2?4:3,false,true);}else if(type===6||type===7){return this.parseObjectLike(this.state.type===6?9:8,false,true);}}if(tokenIsIdentifier(type)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123){return this.parseModuleExpression();}const canBeArrow=this.state.potentialArrowAt===this.state.start;const containsEsc=this.state.containsEsc;const id=this.parseIdentifier();if(!containsEsc&&id.name==="async"&&!this.canInsertSemicolon()){const{type}=this.state;if(type===68){this.resetPreviousNodeTrailingComments(id);this.next();return this.parseAsyncFunctionExpression(this.startNodeAtNode(id));}else if(tokenIsIdentifier(type)){if(this.lookaheadCharCode()===61){return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));}else{return id;}}else if(type===90){this.resetPreviousNodeTrailingComments(id);return this.parseDo(this.startNodeAtNode(id),true);}}if(canBeArrow&&this.match(19)&&!this.canInsertSemicolon()){this.next();return this.parseArrowExpression(this.startNodeAtNode(id),[id],false);}return id;}else{this.unexpected();}}}parseTopicReferenceThenEqualsSign(topicTokenType,topicTokenValue){const pipeProposal=this.getPluginOption("pipelineOperator","proposal");if(pipeProposal){this.state.type=topicTokenType;this.state.value=topicTokenValue;this.state.pos--;this.state.end--;this.state.endLoc=createPositionWithColumnOffset(this.state.endLoc,-1);return this.parseTopicReference(pipeProposal);}else{this.unexpected();}}parseTopicReference(pipeProposal){const node=this.startNode();const startLoc=this.state.startLoc;const tokenType=this.state.type;this.next();return this.finishTopicReference(node,startLoc,pipeProposal,tokenType);}finishTopicReference(node,startLoc,pipeProposal,tokenType){if(this.testTopicReferenceConfiguration(pipeProposal,startLoc,tokenType)){if(pipeProposal==="hack"){if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(Errors.PipeTopicUnbound,startLoc);}this.registerTopicReference();return this.finishNode(node,"TopicReference");}else{if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(Errors.PrimaryTopicNotAllowed,startLoc);}this.registerTopicReference();return this.finishNode(node,"PipelinePrimaryTopicReference");}}else{throw this.raise(Errors.PipeTopicUnconfiguredToken,startLoc,{token:tokenLabelName(tokenType)});}}testTopicReferenceConfiguration(pipeProposal,startLoc,tokenType){switch(pipeProposal){case"hack":{return this.hasPlugin(["pipelineOperator",{topicToken:tokenLabelName(tokenType)}]);}case"smart":return tokenType===27;default:throw this.raise(Errors.PipeTopicRequiresHackPipes,startLoc);}}parseAsyncArrowUnaryFunction(node){this.prodParam.enter(functionFlags(true,this.prodParam.hasYield));const params=[this.parseIdentifier()];this.prodParam.exit();if(this.hasPrecedingLineBreak()){this.raise(Errors.LineTerminatorBeforeArrow,this.state.curPosition());}this.expect(19);return this.parseArrowExpression(node,params,true);}parseDo(node,isAsync){this.expectPlugin("doExpressions");if(isAsync){this.expectPlugin("asyncDoExpressions");}node.async=isAsync;this.next();const oldLabels=this.state.labels;this.state.labels=[];if(isAsync){this.prodParam.enter(2);node.body=this.parseBlock();this.prodParam.exit();}else{node.body=this.parseBlock();}this.state.labels=oldLabels;return this.finishNode(node,"DoExpression");}parseSuper(){const node=this.startNode();this.next();if(this.match(10)&&!this.scope.allowDirectSuper&&!(this.optionFlags&16)){this.raise(Errors.SuperNotAllowed,node);}else if(!this.scope.allowSuper&&!(this.optionFlags&16)){this.raise(Errors.UnexpectedSuper,node);}if(!this.match(10)&&!this.match(0)&&!this.match(16)){this.raise(Errors.UnsupportedSuper,node);}return this.finishNode(node,"Super");}parsePrivateName(){const node=this.startNode();const id=this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc,1));const name=this.state.value;this.next();node.id=this.createIdentifier(id,name);return this.finishNode(node,"PrivateName");}parseFunctionOrFunctionSent(){const node=this.startNode();this.next();if(this.prodParam.hasYield&&this.match(16)){const meta=this.createIdentifier(this.startNodeAtNode(node),"function");this.next();if(this.match(103)){this.expectPlugin("functionSent");}else if(!this.hasPlugin("functionSent")){this.unexpected();}return this.parseMetaProperty(node,meta,"sent");}return this.parseFunction(node);}parseMetaProperty(node,meta,propertyName){node.meta=meta;const containsEsc=this.state.containsEsc;node.property=this.parseIdentifier(true);if(node.property.name!==propertyName||containsEsc){this.raise(Errors.UnsupportedMetaProperty,node.property,{target:meta.name,onlyValidPropertyName:propertyName});}return this.finishNode(node,"MetaProperty");}parseImportMetaProperty(node){const id=this.createIdentifier(this.startNodeAtNode(node),"import");this.next();if(this.isContextual(101)){if(!this.inModule){this.raise(Errors.ImportMetaOutsideModule,id);}this.sawUnambiguousESM=true;}else if(this.isContextual(105)||this.isContextual(97)){const isSource=this.isContextual(105);this.expectPlugin(isSource?"sourcePhaseImports":"deferredImportEvaluation");if(!(this.optionFlags&512)){throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions,this.state.startLoc,{phase:this.state.value});}this.next();node.phase=isSource?"source":"defer";return this.parseImportCall(node);}return this.parseMetaProperty(node,id,"meta");}parseLiteralAtNode(value,type,node){this.addExtra(node,"rawValue",value);this.addExtra(node,"raw",this.input.slice(this.offsetToSourcePos(node.start),this.state.end));node.value=value;this.next();return this.finishNode(node,type);}parseLiteral(value,type){const node=this.startNode();return this.parseLiteralAtNode(value,type,node);}parseStringLiteral(value){return this.parseLiteral(value,"StringLiteral");}parseNumericLiteral(value){return this.parseLiteral(value,"NumericLiteral");}parseBigIntLiteral(value){return this.parseLiteral(value,"BigIntLiteral");}parseDecimalLiteral(value){return this.parseLiteral(value,"DecimalLiteral");}parseRegExpLiteral(value){const node=this.startNode();this.addExtra(node,"raw",this.input.slice(this.offsetToSourcePos(node.start),this.state.end));node.pattern=value.pattern;node.flags=value.flags;this.next();return this.finishNode(node,"RegExpLiteral");}parseBooleanLiteral(value){const node=this.startNode();node.value=value;this.next();return this.finishNode(node,"BooleanLiteral");}parseNullLiteral(){const node=this.startNode();this.next();return this.finishNode(node,"NullLiteral");}parseParenAndDistinguishExpression(canBeArrow){const startLoc=this.state.startLoc;let val;this.next();this.expressionScope.enter(newArrowHeadScope());const oldMaybeInArrowParameters=this.state.maybeInArrowParameters;const oldInFSharpPipelineDirectBody=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=true;this.state.inFSharpPipelineDirectBody=false;const innerStartLoc=this.state.startLoc;const exprList=[];const refExpressionErrors=new ExpressionErrors();let first=true;let spreadStartLoc;let optionalCommaStartLoc;while(!this.match(11)){if(first){first=false;}else{this.expect(12,refExpressionErrors.optionalParametersLoc===null?null:refExpressionErrors.optionalParametersLoc);if(this.match(11)){optionalCommaStartLoc=this.state.startLoc;break;}}if(this.match(21)){const spreadNodeStartLoc=this.state.startLoc;spreadStartLoc=this.state.startLoc;exprList.push(this.parseParenItem(this.parseRestBinding(),spreadNodeStartLoc));if(!this.checkCommaAfterRest(41)){break;}}else{exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors,this.parseParenItem));}}const innerEndLoc=this.state.lastTokEndLoc;this.expect(11);this.state.maybeInArrowParameters=oldMaybeInArrowParameters;this.state.inFSharpPipelineDirectBody=oldInFSharpPipelineDirectBody;let arrowNode=this.startNodeAt(startLoc);if(canBeArrow&&this.shouldParseArrow(exprList)&&(arrowNode=this.parseArrow(arrowNode))){this.checkDestructuringPrivate(refExpressionErrors);this.expressionScope.validateAsPattern();this.expressionScope.exit();this.parseArrowExpression(arrowNode,exprList,false);return arrowNode;}this.expressionScope.exit();if(!exprList.length){this.unexpected(this.state.lastTokStartLoc);}if(optionalCommaStartLoc)this.unexpected(optionalCommaStartLoc);if(spreadStartLoc)this.unexpected(spreadStartLoc);this.checkExpressionErrors(refExpressionErrors,true);this.toReferencedListDeep(exprList,true);if(exprList.length>1){val=this.startNodeAt(innerStartLoc);val.expressions=exprList;this.finishNode(val,"SequenceExpression");this.resetEndLocation(val,innerEndLoc);}else{val=exprList[0];}return this.wrapParenthesis(startLoc,val);}wrapParenthesis(startLoc,expression){if(!(this.optionFlags&1024)){this.addExtra(expression,"parenthesized",true);this.addExtra(expression,"parenStart",startLoc.index);this.takeSurroundingComments(expression,startLoc.index,this.state.lastTokEndLoc.index);return expression;}const parenExpression=this.startNodeAt(startLoc);parenExpression.expression=expression;return this.finishNode(parenExpression,"ParenthesizedExpression");}shouldParseArrow(params){return!this.canInsertSemicolon();}parseArrow(node){if(this.eat(19)){return node;}}parseParenItem(node,startLoc){return node;}parseNewOrNewTarget(){const node=this.startNode();this.next();if(this.match(16)){const meta=this.createIdentifier(this.startNodeAtNode(node),"new");this.next();const metaProp=this.parseMetaProperty(node,meta,"target");if(!this.scope.inNonArrowFunction&&!this.scope.inClass&&!(this.optionFlags&4)){this.raise(Errors.UnexpectedNewTarget,metaProp);}return metaProp;}return this.parseNew(node);}parseNew(node){this.parseNewCallee(node);if(this.eat(10)){const args=this.parseExprList(11);this.toReferencedList(args);node.arguments=args;}else{node.arguments=[];}return this.finishNode(node,"NewExpression");}parseNewCallee(node){const isImport=this.match(83);const callee=this.parseNoCallExpr();node.callee=callee;if(isImport&&(callee.type==="Import"||callee.type==="ImportExpression")){this.raise(Errors.ImportCallNotNewExpression,callee);}}parseTemplateElement(isTagged){const{start,startLoc,end,value}=this.state;const elemStart=start+1;const elem=this.startNodeAt(createPositionWithColumnOffset(startLoc,1));if(value===null){if(!isTagged){this.raise(Errors.InvalidEscapeSequenceTemplate,createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos,1));}}const isTail=this.match(24);const endOffset=isTail?-1:-2;const elemEnd=end+endOffset;elem.value={raw:this.input.slice(elemStart,elemEnd).replace(/\r\n?/g,"\n"),cooked:value===null?null:value.slice(1,endOffset)};elem.tail=isTail;this.next();const finishedNode=this.finishNode(elem,"TemplateElement");this.resetEndLocation(finishedNode,createPositionWithColumnOffset(this.state.lastTokEndLoc,endOffset));return finishedNode;}parseTemplate(isTagged){const node=this.startNode();let curElt=this.parseTemplateElement(isTagged);const quasis=[curElt];const substitutions=[];while(!curElt.tail){substitutions.push(this.parseTemplateSubstitution());this.readTemplateContinuation();quasis.push(curElt=this.parseTemplateElement(isTagged));}node.expressions=substitutions;node.quasis=quasis;return this.finishNode(node,"TemplateLiteral");}parseTemplateSubstitution(){return this.parseExpression();}parseObjectLike(close,isPattern,isRecord,refExpressionErrors){if(isRecord){this.expectPlugin("recordAndTuple");}const oldInFSharpPipelineDirectBody=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;let sawProto=false;let first=true;const node=this.startNode();node.properties=[];this.next();while(!this.match(close)){if(first){first=false;}else{this.expect(12);if(this.match(close)){this.addTrailingCommaExtraToNode(node);break;}}let prop;if(isPattern){prop=this.parseBindingProperty();}else{prop=this.parsePropertyDefinition(refExpressionErrors);sawProto=this.checkProto(prop,isRecord,sawProto,refExpressionErrors);}if(isRecord&&!this.isObjectProperty(prop)&&prop.type!=="SpreadElement"){this.raise(Errors.InvalidRecordProperty,prop);}{if(prop.shorthand){this.addExtra(prop,"shorthand",true);}}node.properties.push(prop);}this.next();this.state.inFSharpPipelineDirectBody=oldInFSharpPipelineDirectBody;let type="ObjectExpression";if(isPattern){type="ObjectPattern";}else if(isRecord){type="RecordExpression";}return this.finishNode(node,type);}addTrailingCommaExtraToNode(node){this.addExtra(node,"trailingComma",this.state.lastTokStartLoc.index);this.addExtra(node,"trailingCommaLoc",this.state.lastTokStartLoc,false);}maybeAsyncOrAccessorProp(prop){return!prop.computed&&prop.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55));}parsePropertyDefinition(refExpressionErrors){let decorators=[];if(this.match(26)){if(this.hasPlugin("decorators")){this.raise(Errors.UnsupportedPropertyDecorator,this.state.startLoc);}while(this.match(26)){decorators.push(this.parseDecorator());}}const prop=this.startNode();let isAsync=false;let isAccessor=false;let startLoc;if(this.match(21)){if(decorators.length)this.unexpected();return this.parseSpread();}if(decorators.length){prop.decorators=decorators;decorators=[];}prop.method=false;if(refExpressionErrors){startLoc=this.state.startLoc;}let isGenerator=this.eat(55);this.parsePropertyNamePrefixOperator(prop);const containsEsc=this.state.containsEsc;this.parsePropertyName(prop,refExpressionErrors);if(!isGenerator&&!containsEsc&&this.maybeAsyncOrAccessorProp(prop)){const{key}=prop;const keyName=key.name;if(keyName==="async"&&!this.hasPrecedingLineBreak()){isAsync=true;this.resetPreviousNodeTrailingComments(key);isGenerator=this.eat(55);this.parsePropertyName(prop);}if(keyName==="get"||keyName==="set"){isAccessor=true;this.resetPreviousNodeTrailingComments(key);prop.kind=keyName;if(this.match(55)){isGenerator=true;this.raise(Errors.AccessorIsGenerator,this.state.curPosition(),{kind:keyName});this.next();}this.parsePropertyName(prop);}}return this.parseObjPropValue(prop,startLoc,isGenerator,isAsync,false,isAccessor,refExpressionErrors);}getGetterSetterExpectedParamCount(method){return method.kind==="get"?0:1;}getObjectOrClassMethodParams(method){return method.params;}checkGetterSetterParams(method){var _params;const paramCount=this.getGetterSetterExpectedParamCount(method);const params=this.getObjectOrClassMethodParams(method);if(params.length!==paramCount){this.raise(method.kind==="get"?Errors.BadGetterArity:Errors.BadSetterArity,method);}if(method.kind==="set"&&((_params=params[params.length-1])==null?void 0:_params.type)==="RestElement"){this.raise(Errors.BadSetterRestParameter,method);}}parseObjectMethod(prop,isGenerator,isAsync,isPattern,isAccessor){if(isAccessor){const finishedProp=this.parseMethod(prop,isGenerator,false,false,false,"ObjectMethod");this.checkGetterSetterParams(finishedProp);return finishedProp;}if(isAsync||isGenerator||this.match(10)){if(isPattern)this.unexpected();prop.kind="method";prop.method=true;return this.parseMethod(prop,isGenerator,isAsync,false,false,"ObjectMethod");}}parseObjectProperty(prop,startLoc,isPattern,refExpressionErrors){prop.shorthand=false;if(this.eat(14)){prop.value=isPattern?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(refExpressionErrors);return this.finishObjectProperty(prop);}if(!prop.computed&&prop.key.type==="Identifier"){this.checkReservedWord(prop.key.name,prop.key.loc.start,true,false);if(isPattern){prop.value=this.parseMaybeDefault(startLoc,this.cloneIdentifier(prop.key));}else if(this.match(29)){const shorthandAssignLoc=this.state.startLoc;if(refExpressionErrors!=null){if(refExpressionErrors.shorthandAssignLoc===null){refExpressionErrors.shorthandAssignLoc=shorthandAssignLoc;}}else{this.raise(Errors.InvalidCoverInitializedName,shorthandAssignLoc);}prop.value=this.parseMaybeDefault(startLoc,this.cloneIdentifier(prop.key));}else{prop.value=this.cloneIdentifier(prop.key);}prop.shorthand=true;return this.finishObjectProperty(prop);}}finishObjectProperty(node){return this.finishNode(node,"ObjectProperty");}parseObjPropValue(prop,startLoc,isGenerator,isAsync,isPattern,isAccessor,refExpressionErrors){const node=this.parseObjectMethod(prop,isGenerator,isAsync,isPattern,isAccessor)||this.parseObjectProperty(prop,startLoc,isPattern,refExpressionErrors);if(!node)this.unexpected();return node;}parsePropertyName(prop,refExpressionErrors){if(this.eat(0)){prop.computed=true;prop.key=this.parseMaybeAssignAllowIn();this.expect(3);}else{const{type,value}=this.state;let key;if(tokenIsKeywordOrIdentifier(type)){key=this.parseIdentifier(true);}else{switch(type){case 135:key=this.parseNumericLiteral(value);break;case 134:key=this.parseStringLiteral(value);break;case 136:key=this.parseBigIntLiteral(value);break;case 139:{const privateKeyLoc=this.state.startLoc;if(refExpressionErrors!=null){if(refExpressionErrors.privateKeyLoc===null){refExpressionErrors.privateKeyLoc=privateKeyLoc;}}else{this.raise(Errors.UnexpectedPrivateField,privateKeyLoc);}key=this.parsePrivateName();break;}default:if(type===137){key=this.parseDecimalLiteral(value);break;}this.unexpected();}}prop.key=key;if(type!==139){prop.computed=false;}}}initFunction(node,isAsync){node.id=null;node.generator=false;node.async=isAsync;}parseMethod(node,isGenerator,isAsync,isConstructor,allowDirectSuper,type,inClassScope=false){this.initFunction(node,isAsync);node.generator=isGenerator;this.scope.enter(2|16|(inClassScope?64:0)|(allowDirectSuper?32:0));this.prodParam.enter(functionFlags(isAsync,node.generator));this.parseFunctionParams(node,isConstructor);const finishedNode=this.parseFunctionBodyAndFinish(node,type,true);this.prodParam.exit();this.scope.exit();return finishedNode;}parseArrayLike(close,canBePattern,isTuple,refExpressionErrors){if(isTuple){this.expectPlugin("recordAndTuple");}const oldInFSharpPipelineDirectBody=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;const node=this.startNode();this.next();node.elements=this.parseExprList(close,!isTuple,refExpressionErrors,node);this.state.inFSharpPipelineDirectBody=oldInFSharpPipelineDirectBody;return this.finishNode(node,isTuple?"TupleExpression":"ArrayExpression");}parseArrowExpression(node,params,isAsync,trailingCommaLoc){this.scope.enter(2|4);let flags=functionFlags(isAsync,false);if(!this.match(5)&&this.prodParam.hasIn){flags|=8;}this.prodParam.enter(flags);this.initFunction(node,isAsync);const oldMaybeInArrowParameters=this.state.maybeInArrowParameters;if(params){this.state.maybeInArrowParameters=true;this.setArrowFunctionParameters(node,params,trailingCommaLoc);}this.state.maybeInArrowParameters=false;this.parseFunctionBody(node,true);this.prodParam.exit();this.scope.exit();this.state.maybeInArrowParameters=oldMaybeInArrowParameters;return this.finishNode(node,"ArrowFunctionExpression");}setArrowFunctionParameters(node,params,trailingCommaLoc){this.toAssignableList(params,trailingCommaLoc,false);node.params=params;}parseFunctionBodyAndFinish(node,type,isMethod=false){this.parseFunctionBody(node,false,isMethod);return this.finishNode(node,type);}parseFunctionBody(node,allowExpression,isMethod=false){const isExpression=allowExpression&&!this.match(5);this.expressionScope.enter(newExpressionScope());if(isExpression){node.body=this.parseMaybeAssign();this.checkParams(node,false,allowExpression,false);}else{const oldStrict=this.state.strict;const oldLabels=this.state.labels;this.state.labels=[];this.prodParam.enter(this.prodParam.currentFlags()|4);node.body=this.parseBlock(true,false,hasStrictModeDirective=>{const nonSimple=!this.isSimpleParamList(node.params);if(hasStrictModeDirective&&nonSimple){this.raise(Errors.IllegalLanguageModeDirective,(node.kind==="method"||node.kind==="constructor")&&!!node.key?node.key.loc.end:node);}const strictModeChanged=!oldStrict&&this.state.strict;this.checkParams(node,!this.state.strict&&!allowExpression&&!isMethod&&!nonSimple,allowExpression,strictModeChanged);if(this.state.strict&&node.id){this.checkIdentifier(node.id,65,strictModeChanged);}});this.prodParam.exit();this.state.labels=oldLabels;}this.expressionScope.exit();}isSimpleParameter(node){return node.type==="Identifier";}isSimpleParamList(params){for(let i=0,len=params.length;i10){return;}if(!canBeReservedWord(word)){return;}if(checkKeywords&&isKeyword(word)){this.raise(Errors.UnexpectedKeyword,startLoc,{keyword:word});return;}const reservedTest=!this.state.strict?isReservedWord:isBinding?isStrictBindReservedWord:isStrictReservedWord;if(reservedTest(word,this.inModule)){this.raise(Errors.UnexpectedReservedWord,startLoc,{reservedWord:word});return;}else if(word==="yield"){if(this.prodParam.hasYield){this.raise(Errors.YieldBindingIdentifier,startLoc);return;}}else if(word==="await"){if(this.prodParam.hasAwait){this.raise(Errors.AwaitBindingIdentifier,startLoc);return;}if(this.scope.inStaticBlock){this.raise(Errors.AwaitBindingIdentifierInStaticBlock,startLoc);return;}this.expressionScope.recordAsyncArrowParametersError(startLoc);}else if(word==="arguments"){if(this.scope.inClassAndNotInNonArrowFunction){this.raise(Errors.ArgumentsInClass,startLoc);return;}}}recordAwaitIfAllowed(){const isAwaitAllowed=this.prodParam.hasAwait||this.optionFlags&1&&!this.scope.inFunction;if(isAwaitAllowed&&!this.scope.inFunction){this.state.hasTopLevelAwait=true;}return isAwaitAllowed;}parseAwait(startLoc){const node=this.startNodeAt(startLoc);this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter,node);if(this.eat(55)){this.raise(Errors.ObsoleteAwaitStar,node);}if(!this.scope.inFunction&&!(this.optionFlags&1)){if(this.isAmbiguousPrefixOrIdentifier()){this.ambiguousScriptDifferentAst=true;}else{this.sawUnambiguousESM=true;}}if(!this.state.soloAwait){node.argument=this.parseMaybeUnary(null,true);}return this.finishNode(node,"AwaitExpression");}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return true;const{type}=this.state;return type===53||type===10||type===0||tokenIsTemplate(type)||type===102&&!this.state.containsEsc||type===138||type===56||this.hasPlugin("v8intrinsic")&&type===54;}parseYield(startLoc){const node=this.startNodeAt(startLoc);this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter,node);let delegating=false;let argument=null;if(!this.hasPrecedingLineBreak()){delegating=this.eat(55);switch(this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!delegating)break;default:argument=this.parseMaybeAssign();}}node.delegate=delegating;node.argument=argument;return this.finishNode(node,"YieldExpression");}parseImportCall(node){this.next();node.source=this.parseMaybeAssignAllowIn();node.options=null;if(this.eat(12)){if(!this.match(11)){node.options=this.parseMaybeAssignAllowIn();if(this.eat(12)&&!this.match(11)){do{this.parseMaybeAssignAllowIn();}while(this.eat(12)&&!this.match(11));this.raise(Errors.ImportCallArity,node);}}}this.expect(11);return this.finishNode(node,"ImportExpression");}checkPipelineAtInfixOperator(left,leftStartLoc){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){if(left.type==="SequenceExpression"){this.raise(Errors.PipelineHeadSequenceExpression,leftStartLoc);}}}parseSmartPipelineBodyInStyle(childExpr,startLoc){if(this.isSimpleReference(childExpr)){const bodyNode=this.startNodeAt(startLoc);bodyNode.callee=childExpr;return this.finishNode(bodyNode,"PipelineBareFunction");}else{const bodyNode=this.startNodeAt(startLoc);this.checkSmartPipeTopicBodyEarlyErrors(startLoc);bodyNode.expression=childExpr;return this.finishNode(bodyNode,"PipelineTopicExpression");}}isSimpleReference(expression){switch(expression.type){case"MemberExpression":return!expression.computed&&this.isSimpleReference(expression.object);case"Identifier":return true;default:return false;}}checkSmartPipeTopicBodyEarlyErrors(startLoc){if(this.match(19)){throw this.raise(Errors.PipelineBodyNoArrow,this.state.startLoc);}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(Errors.PipelineTopicUnused,startLoc);}}withTopicBindingContext(callback){const outerContextTopicState=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return callback();}finally{this.state.topicContext=outerContextTopicState;}}withSmartMixTopicForbiddingContext(callback){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){const outerContextTopicState=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return callback();}finally{this.state.topicContext=outerContextTopicState;}}else{return callback();}}withSoloAwaitPermittingContext(callback){const outerContextSoloAwaitState=this.state.soloAwait;this.state.soloAwait=true;try{return callback();}finally{this.state.soloAwait=outerContextSoloAwaitState;}}allowInAnd(callback){const flags=this.prodParam.currentFlags();const prodParamToSet=8&~flags;if(prodParamToSet){this.prodParam.enter(flags|8);try{return callback();}finally{this.prodParam.exit();}}return callback();}disallowInAnd(callback){const flags=this.prodParam.currentFlags();const prodParamToClear=8&flags;if(prodParamToClear){this.prodParam.enter(flags&~8);try{return callback();}finally{this.prodParam.exit();}}return callback();}registerTopicReference(){this.state.topicContext.maxTopicIndex=0;}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1;}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0;}parseFSharpPipelineBody(prec){const startLoc=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const oldInFSharpPipelineDirectBody=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=true;const ret=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),startLoc,prec);this.state.inFSharpPipelineDirectBody=oldInFSharpPipelineDirectBody;return ret;}parseModuleExpression(){this.expectPlugin("moduleBlocks");const node=this.startNode();this.next();if(!this.match(5)){this.unexpected(null,5);}const program=this.startNodeAt(this.state.endLoc);this.next();const revertScopes=this.initializeScopes(true);this.enterInitialScopes();try{node.body=this.parseProgram(program,8,"module");}finally{revertScopes();}return this.finishNode(node,"ModuleExpression");}parsePropertyNamePrefixOperator(prop){}}const loopLabel={kind:1},switchLabel={kind:2};const loneSurrogate=/[\uD800-\uDFFF]/u;const keywordRelationalOperator=/in(?:stanceof)?/y;function babel7CompatTokens(tokens,input,startIndex){for(let i=0;i0){for(const[localName,at]of Array.from(this.scope.undefinedExports)){this.raise(Errors.ModuleExportUndefined,at,{localName});}}this.addExtra(program,"topLevelAwait",this.state.hasTopLevelAwait);}let finishedProgram;if(end===140){finishedProgram=this.finishNode(program,"Program");}else{finishedProgram=this.finishNodeAt(program,"Program",createPositionWithColumnOffset(this.state.startLoc,-1));}return finishedProgram;}stmtToDirective(stmt){const directive=this.castNodeTo(stmt,"Directive");const directiveLiteral=this.castNodeTo(stmt.expression,"DirectiveLiteral");const expressionValue=directiveLiteral.value;const raw=this.input.slice(this.offsetToSourcePos(directiveLiteral.start),this.offsetToSourcePos(directiveLiteral.end));const val=directiveLiteral.value=raw.slice(1,-1);this.addExtra(directiveLiteral,"raw",raw);this.addExtra(directiveLiteral,"rawValue",val);this.addExtra(directiveLiteral,"expressionValue",expressionValue);directive.value=directiveLiteral;delete stmt.expression;return directive;}parseInterpreterDirective(){if(!this.match(28)){return null;}const node=this.startNode();node.value=this.state.value;this.next();return this.finishNode(node,"InterpreterDirective");}isLet(){if(!this.isContextual(100)){return false;}return this.hasFollowingBindingAtom();}chStartsBindingIdentifier(ch,pos){if(isIdentifierStart(ch)){keywordRelationalOperator.lastIndex=pos;if(keywordRelationalOperator.test(this.input)){const endCh=this.codePointAtPos(keywordRelationalOperator.lastIndex);if(!isIdentifierChar(endCh)&&endCh!==92){return false;}}return true;}else if(ch===92){return true;}else{return false;}}chStartsBindingPattern(ch){return ch===91||ch===123;}hasFollowingBindingAtom(){const next=this.nextTokenStart();const nextCh=this.codePointAtPos(next);return this.chStartsBindingPattern(nextCh)||this.chStartsBindingIdentifier(nextCh,next);}hasInLineFollowingBindingIdentifierOrBrace(){const next=this.nextTokenInLineStart();const nextCh=this.codePointAtPos(next);return nextCh===123||this.chStartsBindingIdentifier(nextCh,next);}allowsForUsing(){const{type,containsEsc,end}=this.lookahead();if(type===102&&!containsEsc){const nextCharAfterOf=this.lookaheadCharCodeSince(end);if(nextCharAfterOf!==61&&nextCharAfterOf!==58&&nextCharAfterOf!==59){return false;}}if(tokenIsIdentifier(type)&&!this.hasFollowingLineBreak()){this.expectPlugin("explicitResourceManagement");return true;}return false;}startsAwaitUsing(){let next=this.nextTokenInLineStart();if(this.isUnparsedContextual(next,"using")){next=this.nextTokenInLineStartSince(next+5);const nextCh=this.codePointAtPos(next);if(this.chStartsBindingIdentifier(nextCh,next)){this.expectPlugin("explicitResourceManagement");return true;}}return false;}parseModuleItem(){return this.parseStatementLike(1|2|4|8);}parseStatementListItem(){return this.parseStatementLike(2|4|(!this.options.annexB||this.state.strict?0:8));}parseStatementOrSloppyAnnexBFunctionDeclaration(allowLabeledFunction=false){let flags=0;if(this.options.annexB&&!this.state.strict){flags|=4;if(allowLabeledFunction){flags|=8;}}return this.parseStatementLike(flags);}parseStatement(){return this.parseStatementLike(0);}parseStatementLike(flags){let decorators=null;if(this.match(26)){decorators=this.parseDecorators(true);}return this.parseStatementContent(flags,decorators);}parseStatementContent(flags,decorators){const startType=this.state.type;const node=this.startNode();const allowDeclaration=!!(flags&2);const allowFunctionDeclaration=!!(flags&4);const topLevel=flags&1;switch(startType){case 60:return this.parseBreakContinueStatement(node,true);case 63:return this.parseBreakContinueStatement(node,false);case 64:return this.parseDebuggerStatement(node);case 90:return this.parseDoWhileStatement(node);case 91:return this.parseForStatement(node);case 68:if(this.lookaheadCharCode()===46)break;if(!allowFunctionDeclaration){this.raise(this.state.strict?Errors.StrictFunction:this.options.annexB?Errors.SloppyFunctionAnnexB:Errors.SloppyFunction,this.state.startLoc);}return this.parseFunctionStatement(node,false,!allowDeclaration&&allowFunctionDeclaration);case 80:if(!allowDeclaration)this.unexpected();return this.parseClass(this.maybeTakeDecorators(decorators,node),true);case 69:return this.parseIfStatement(node);case 70:return this.parseReturnStatement(node);case 71:return this.parseSwitchStatement(node);case 72:return this.parseThrowStatement(node);case 73:return this.parseTryStatement(node);case 96:if(!this.state.containsEsc&&this.startsAwaitUsing()){if(!this.recordAwaitIfAllowed()){this.raise(Errors.AwaitUsingNotInAsyncContext,node);}else if(!allowDeclaration){this.raise(Errors.UnexpectedLexicalDeclaration,node);}this.next();return this.parseVarStatement(node,"await using");}break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace()){break;}this.expectPlugin("explicitResourceManagement");if(!this.scope.inModule&&this.scope.inTopLevel){this.raise(Errors.UnexpectedUsingDeclaration,this.state.startLoc);}else if(!allowDeclaration){this.raise(Errors.UnexpectedLexicalDeclaration,this.state.startLoc);}return this.parseVarStatement(node,"using");case 100:{if(this.state.containsEsc){break;}const next=this.nextTokenStart();const nextCh=this.codePointAtPos(next);if(nextCh!==91){if(!allowDeclaration&&this.hasFollowingLineBreak())break;if(!this.chStartsBindingIdentifier(nextCh,next)&&nextCh!==123){break;}}}case 75:{if(!allowDeclaration){this.raise(Errors.UnexpectedLexicalDeclaration,this.state.startLoc);}}case 74:{const kind=this.state.value;return this.parseVarStatement(node,kind);}case 92:return this.parseWhileStatement(node);case 76:return this.parseWithStatement(node);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(node);case 83:{const nextTokenCharCode=this.lookaheadCharCode();if(nextTokenCharCode===40||nextTokenCharCode===46){break;}}case 82:{if(!(this.optionFlags&8)&&!topLevel){this.raise(Errors.UnexpectedImportExport,this.state.startLoc);}this.next();let result;if(startType===83){result=this.parseImport(node);}else{result=this.parseExport(node,decorators);}this.assertModuleNodeAllowed(result);return result;}default:{if(this.isAsyncFunction()){if(!allowDeclaration){this.raise(Errors.AsyncFunctionInSingleStatementContext,this.state.startLoc);}this.next();return this.parseFunctionStatement(node,true,!allowDeclaration&&allowFunctionDeclaration);}}}const maybeName=this.state.value;const expr=this.parseExpression();if(tokenIsIdentifier(startType)&&expr.type==="Identifier"&&this.eat(14)){return this.parseLabeledStatement(node,maybeName,expr,flags);}else{return this.parseExpressionStatement(node,expr,decorators);}}assertModuleNodeAllowed(node){if(!(this.optionFlags&8)&&!this.inModule){this.raise(Errors.ImportOutsideModule,node);}}decoratorsEnabledBeforeExport(){if(this.hasPlugin("decorators-legacy"))return true;return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==false;}maybeTakeDecorators(maybeDecorators,classNode,exportNode){if(maybeDecorators){var _classNode$decorators;if((_classNode$decorators=classNode.decorators)!=null&&_classNode$decorators.length){if(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!=="boolean"){this.raise(Errors.DecoratorsBeforeAfterExport,classNode.decorators[0]);}classNode.decorators.unshift(...maybeDecorators);}else{classNode.decorators=maybeDecorators;}this.resetStartLocationFromNode(classNode,maybeDecorators[0]);if(exportNode)this.resetStartLocationFromNode(exportNode,classNode);}return classNode;}canHaveLeadingDecorator(){return this.match(80);}parseDecorators(allowExport){const decorators=[];do{decorators.push(this.parseDecorator());}while(this.match(26));if(this.match(82)){if(!allowExport){this.unexpected();}if(!this.decoratorsEnabledBeforeExport()){this.raise(Errors.DecoratorExportClass,this.state.startLoc);}}else if(!this.canHaveLeadingDecorator()){throw this.raise(Errors.UnexpectedLeadingDecorator,this.state.startLoc);}return decorators;}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const node=this.startNode();this.next();if(this.hasPlugin("decorators")){const startLoc=this.state.startLoc;let expr;if(this.match(10)){const startLoc=this.state.startLoc;this.next();expr=this.parseExpression();this.expect(11);expr=this.wrapParenthesis(startLoc,expr);const paramsStartLoc=this.state.startLoc;node.expression=this.parseMaybeDecoratorArguments(expr,startLoc);if(this.getPluginOption("decorators","allowCallParenthesized")===false&&node.expression!==expr){this.raise(Errors.DecoratorArgumentsOutsideParentheses,paramsStartLoc);}}else{expr=this.parseIdentifier(false);while(this.eat(16)){const node=this.startNodeAt(startLoc);node.object=expr;if(this.match(139)){this.classScope.usePrivateName(this.state.value,this.state.startLoc);node.property=this.parsePrivateName();}else{node.property=this.parseIdentifier(true);}node.computed=false;expr=this.finishNode(node,"MemberExpression");}node.expression=this.parseMaybeDecoratorArguments(expr,startLoc);}}else{node.expression=this.parseExprSubscripts();}return this.finishNode(node,"Decorator");}parseMaybeDecoratorArguments(expr,startLoc){if(this.eat(10)){const node=this.startNodeAt(startLoc);node.callee=expr;node.arguments=this.parseCallExpressionArguments(11);this.toReferencedList(node.arguments);return this.finishNode(node,"CallExpression");}return expr;}parseBreakContinueStatement(node,isBreak){this.next();if(this.isLineTerminator()){node.label=null;}else{node.label=this.parseIdentifier();this.semicolon();}this.verifyBreakContinue(node,isBreak);return this.finishNode(node,isBreak?"BreakStatement":"ContinueStatement");}verifyBreakContinue(node,isBreak){let i;for(i=0;ithis.parseStatement());this.state.labels.pop();this.expect(92);node.test=this.parseHeaderExpression();this.eat(13);return this.finishNode(node,"DoWhileStatement");}parseForStatement(node){this.next();this.state.labels.push(loopLabel);let awaitAt=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()){awaitAt=this.state.startLoc;this.next();}this.scope.enter(0);this.expect(10);if(this.match(13)){if(awaitAt!==null){this.unexpected(awaitAt);}return this.parseFor(node,null);}const startsWithLet=this.isContextual(100);{const startsWithAwaitUsing=this.isContextual(96)&&this.startsAwaitUsing();const starsWithUsingDeclaration=startsWithAwaitUsing||this.isContextual(107)&&this.allowsForUsing();const isLetOrUsing=startsWithLet&&this.hasFollowingBindingAtom()||starsWithUsingDeclaration;if(this.match(74)||this.match(75)||isLetOrUsing){const initNode=this.startNode();let kind;if(startsWithAwaitUsing){kind="await using";if(!this.recordAwaitIfAllowed()){this.raise(Errors.AwaitUsingNotInAsyncContext,this.state.startLoc);}this.next();}else{kind=this.state.value;}this.next();this.parseVar(initNode,true,kind);const init=this.finishNode(initNode,"VariableDeclaration");const isForIn=this.match(58);if(isForIn&&starsWithUsingDeclaration){this.raise(Errors.ForInUsing,init);}if((isForIn||this.isContextual(102))&&init.declarations.length===1){return this.parseForIn(node,init,awaitAt);}if(awaitAt!==null){this.unexpected(awaitAt);}return this.parseFor(node,init);}}const startsWithAsync=this.isContextual(95);const refExpressionErrors=new ExpressionErrors();const init=this.parseExpression(true,refExpressionErrors);const isForOf=this.isContextual(102);if(isForOf){if(startsWithLet){this.raise(Errors.ForOfLet,init);}if(awaitAt===null&&startsWithAsync&&init.type==="Identifier"){this.raise(Errors.ForOfAsync,init);}}if(isForOf||this.match(58)){this.checkDestructuringPrivate(refExpressionErrors);this.toAssignable(init,true);const type=isForOf?"ForOfStatement":"ForInStatement";this.checkLVal(init,{type});return this.parseForIn(node,init,awaitAt);}else{this.checkExpressionErrors(refExpressionErrors,true);}if(awaitAt!==null){this.unexpected(awaitAt);}return this.parseFor(node,init);}parseFunctionStatement(node,isAsync,isHangingDeclaration){this.next();return this.parseFunction(node,1|(isHangingDeclaration?2:0)|(isAsync?8:0));}parseIfStatement(node){this.next();node.test=this.parseHeaderExpression();node.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration();node.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null;return this.finishNode(node,"IfStatement");}parseReturnStatement(node){if(!this.prodParam.hasReturn&&!(this.optionFlags&2)){this.raise(Errors.IllegalReturn,this.state.startLoc);}this.next();if(this.isLineTerminator()){node.argument=null;}else{node.argument=this.parseExpression();this.semicolon();}return this.finishNode(node,"ReturnStatement");}parseSwitchStatement(node){this.next();node.discriminant=this.parseHeaderExpression();const cases=node.cases=[];this.expect(5);this.state.labels.push(switchLabel);this.scope.enter(0);let cur;for(let sawDefault;!this.match(8);){if(this.match(61)||this.match(65)){const isCase=this.match(61);if(cur)this.finishNode(cur,"SwitchCase");cases.push(cur=this.startNode());cur.consequent=[];this.next();if(isCase){cur.test=this.parseExpression();}else{if(sawDefault){this.raise(Errors.MultipleDefaultsInSwitch,this.state.lastTokStartLoc);}sawDefault=true;cur.test=null;}this.expect(14);}else{if(cur){cur.consequent.push(this.parseStatementListItem());}else{this.unexpected();}}}this.scope.exit();if(cur)this.finishNode(cur,"SwitchCase");this.next();this.state.labels.pop();return this.finishNode(node,"SwitchStatement");}parseThrowStatement(node){this.next();if(this.hasPrecedingLineBreak()){this.raise(Errors.NewlineAfterThrow,this.state.lastTokEndLoc);}node.argument=this.parseExpression();this.semicolon();return this.finishNode(node,"ThrowStatement");}parseCatchClauseParam(){const param=this.parseBindingAtom();this.scope.enter(this.options.annexB&¶m.type==="Identifier"?8:0);this.checkLVal(param,{type:"CatchClause"},9);return param;}parseTryStatement(node){this.next();node.block=this.parseBlock();node.handler=null;if(this.match(62)){const clause=this.startNode();this.next();if(this.match(10)){this.expect(10);clause.param=this.parseCatchClauseParam();this.expect(11);}else{clause.param=null;this.scope.enter(0);}clause.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(false,false));this.scope.exit();node.handler=this.finishNode(clause,"CatchClause");}node.finalizer=this.eat(67)?this.parseBlock():null;if(!node.handler&&!node.finalizer){this.raise(Errors.NoCatchOrFinally,node);}return this.finishNode(node,"TryStatement");}parseVarStatement(node,kind,allowMissingInitializer=false){this.next();this.parseVar(node,false,kind,allowMissingInitializer);this.semicolon();return this.finishNode(node,"VariableDeclaration");}parseWhileStatement(node){this.next();node.test=this.parseHeaderExpression();this.state.labels.push(loopLabel);node.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement());this.state.labels.pop();return this.finishNode(node,"WhileStatement");}parseWithStatement(node){if(this.state.strict){this.raise(Errors.StrictWith,this.state.startLoc);}this.next();node.object=this.parseHeaderExpression();node.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement());return this.finishNode(node,"WithStatement");}parseEmptyStatement(node){this.next();return this.finishNode(node,"EmptyStatement");}parseLabeledStatement(node,maybeName,expr,flags){for(const label of this.state.labels){if(label.name===maybeName){this.raise(Errors.LabelRedeclaration,expr,{labelName:maybeName});}}const kind=tokenIsLoop(this.state.type)?1:this.match(71)?2:null;for(let i=this.state.labels.length-1;i>=0;i--){const label=this.state.labels[i];if(label.statementStart===node.start){label.statementStart=this.sourceToOffsetPos(this.state.start);label.kind=kind;}else{break;}}this.state.labels.push({name:maybeName,kind:kind,statementStart:this.sourceToOffsetPos(this.state.start)});node.body=flags&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(true):this.parseStatement();this.state.labels.pop();node.label=expr;return this.finishNode(node,"LabeledStatement");}parseExpressionStatement(node,expr,decorators){node.expression=expr;this.semicolon();return this.finishNode(node,"ExpressionStatement");}parseBlock(allowDirectives=false,createNewLexicalScope=true,afterBlockParse){const node=this.startNode();if(allowDirectives){this.state.strictErrors.clear();}this.expect(5);if(createNewLexicalScope){this.scope.enter(0);}this.parseBlockBody(node,allowDirectives,false,8,afterBlockParse);if(createNewLexicalScope){this.scope.exit();}return this.finishNode(node,"BlockStatement");}isValidDirective(stmt){return stmt.type==="ExpressionStatement"&&stmt.expression.type==="StringLiteral"&&!stmt.expression.extra.parenthesized;}parseBlockBody(node,allowDirectives,topLevel,end,afterBlockParse){const body=node.body=[];const directives=node.directives=[];this.parseBlockOrModuleBlockBody(body,allowDirectives?directives:undefined,topLevel,end,afterBlockParse);}parseBlockOrModuleBlockBody(body,directives,topLevel,end,afterBlockParse){const oldStrict=this.state.strict;let hasStrictModeDirective=false;let parsedNonDirective=false;while(!this.match(end)){const stmt=topLevel?this.parseModuleItem():this.parseStatementListItem();if(directives&&!parsedNonDirective){if(this.isValidDirective(stmt)){const directive=this.stmtToDirective(stmt);directives.push(directive);if(!hasStrictModeDirective&&directive.value.value==="use strict"){hasStrictModeDirective=true;this.setStrict(true);}continue;}parsedNonDirective=true;this.state.strictErrors.clear();}body.push(stmt);}afterBlockParse==null||afterBlockParse.call(this,hasStrictModeDirective);if(!oldStrict){this.setStrict(false);}this.next();}parseFor(node,init){node.init=init;this.semicolon(false);node.test=this.match(13)?null:this.parseExpression();this.semicolon(false);node.update=this.match(11)?null:this.parseExpression();this.expect(11);node.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement());this.scope.exit();this.state.labels.pop();return this.finishNode(node,"ForStatement");}parseForIn(node,init,awaitAt){const isForIn=this.match(58);this.next();if(isForIn){if(awaitAt!==null)this.unexpected(awaitAt);}else{node.await=awaitAt!==null;}if(init.type==="VariableDeclaration"&&init.declarations[0].init!=null&&(!isForIn||!this.options.annexB||this.state.strict||init.kind!=="var"||init.declarations[0].id.type!=="Identifier")){this.raise(Errors.ForInOfLoopInitializer,init,{type:isForIn?"ForInStatement":"ForOfStatement"});}if(init.type==="AssignmentPattern"){this.raise(Errors.InvalidLhs,init,{ancestor:{type:"ForStatement"}});}node.left=init;node.right=isForIn?this.parseExpression():this.parseMaybeAssignAllowIn();this.expect(11);node.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement());this.scope.exit();this.state.labels.pop();return this.finishNode(node,isForIn?"ForInStatement":"ForOfStatement");}parseVar(node,isFor,kind,allowMissingInitializer=false){const declarations=node.declarations=[];node.kind=kind;for(;;){const decl=this.startNode();this.parseVarId(decl,kind);decl.init=!this.eat(29)?null:isFor?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn();if(decl.init===null&&!allowMissingInitializer){if(decl.id.type!=="Identifier"&&!(isFor&&(this.match(58)||this.isContextual(102)))){this.raise(Errors.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"});}else if((kind==="const"||kind==="using"||kind==="await using")&&!(this.match(58)||this.isContextual(102))){this.raise(Errors.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind});}}declarations.push(this.finishNode(decl,"VariableDeclarator"));if(!this.eat(12))break;}return node;}parseVarId(decl,kind){const id=this.parseBindingAtom();if(kind==="using"||kind==="await using"){if(id.type==="ArrayPattern"||id.type==="ObjectPattern"){this.raise(Errors.UsingDeclarationHasBindingPattern,id.loc.start);}}this.checkLVal(id,{type:"VariableDeclarator"},kind==="var"?5:8201);decl.id=id;}parseAsyncFunctionExpression(node){return this.parseFunction(node,8);}parseFunction(node,flags=0){const hangingDeclaration=flags&2;const isDeclaration=!!(flags&1);const requireId=isDeclaration&&!(flags&4);const isAsync=!!(flags&8);this.initFunction(node,isAsync);if(this.match(55)){if(hangingDeclaration){this.raise(Errors.GeneratorInSingleStatementContext,this.state.startLoc);}this.next();node.generator=true;}if(isDeclaration){node.id=this.parseFunctionId(requireId);}const oldMaybeInArrowParameters=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=false;this.scope.enter(2);this.prodParam.enter(functionFlags(isAsync,node.generator));if(!isDeclaration){node.id=this.parseFunctionId();}this.parseFunctionParams(node,false);this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(node,isDeclaration?"FunctionDeclaration":"FunctionExpression");});this.prodParam.exit();this.scope.exit();if(isDeclaration&&!hangingDeclaration){this.registerFunctionStatementId(node);}this.state.maybeInArrowParameters=oldMaybeInArrowParameters;return node;}parseFunctionId(requireId){return requireId||tokenIsIdentifier(this.state.type)?this.parseIdentifier():null;}parseFunctionParams(node,isConstructor){this.expect(10);this.expressionScope.enter(newParameterDeclarationScope());node.params=this.parseBindingList(11,41,2|(isConstructor?4:0));this.expressionScope.exit();}registerFunctionStatementId(node){if(!node.id)return;this.scope.declareName(node.id.name,!this.options.annexB||this.state.strict||node.generator||node.async?this.scope.treatFunctionsAsVar?5:8201:17,node.id.loc.start);}parseClass(node,isStatement,optionalId){this.next();const oldStrict=this.state.strict;this.state.strict=true;this.parseClassId(node,isStatement,optionalId);this.parseClassSuper(node);node.body=this.parseClassBody(!!node.superClass,oldStrict);return this.finishNode(node,isStatement?"ClassDeclaration":"ClassExpression");}isClassProperty(){return this.match(29)||this.match(13)||this.match(8);}isClassMethod(){return this.match(10);}nameIsConstructor(key){return key.type==="Identifier"&&key.name==="constructor"||key.type==="StringLiteral"&&key.value==="constructor";}isNonstaticConstructor(method){return!method.computed&&!method.static&&this.nameIsConstructor(method.key);}parseClassBody(hadSuperClass,oldStrict){this.classScope.enter();const state={hadConstructor:false,hadSuperClass};let decorators=[];const classBody=this.startNode();classBody.body=[];this.expect(5);this.withSmartMixTopicForbiddingContext(()=>{while(!this.match(8)){if(this.eat(13)){if(decorators.length>0){throw this.raise(Errors.DecoratorSemicolon,this.state.lastTokEndLoc);}continue;}if(this.match(26)){decorators.push(this.parseDecorator());continue;}const member=this.startNode();if(decorators.length){member.decorators=decorators;this.resetStartLocationFromNode(member,decorators[0]);decorators=[];}this.parseClassMember(classBody,member,state);if(member.kind==="constructor"&&member.decorators&&member.decorators.length>0){this.raise(Errors.DecoratorConstructor,member);}}});this.state.strict=oldStrict;this.next();if(decorators.length){throw this.raise(Errors.TrailingDecorator,this.state.startLoc);}this.classScope.exit();return this.finishNode(classBody,"ClassBody");}parseClassMemberFromModifier(classBody,member){const key=this.parseIdentifier(true);if(this.isClassMethod()){const method=member;method.kind="method";method.computed=false;method.key=key;method.static=false;this.pushClassMethod(classBody,method,false,false,false,false);return true;}else if(this.isClassProperty()){const prop=member;prop.computed=false;prop.key=key;prop.static=false;classBody.body.push(this.parseClassProperty(prop));return true;}this.resetPreviousNodeTrailingComments(key);return false;}parseClassMember(classBody,member,state){const isStatic=this.isContextual(106);if(isStatic){if(this.parseClassMemberFromModifier(classBody,member)){return;}if(this.eat(5)){this.parseClassStaticBlock(classBody,member);return;}}this.parseClassMemberWithIsStatic(classBody,member,state,isStatic);}parseClassMemberWithIsStatic(classBody,member,state,isStatic){const publicMethod=member;const privateMethod=member;const publicProp=member;const privateProp=member;const accessorProp=member;const method=publicMethod;const publicMember=publicMethod;member.static=isStatic;this.parsePropertyNamePrefixOperator(member);if(this.eat(55)){method.kind="method";const isPrivateName=this.match(139);this.parseClassElementName(method);if(isPrivateName){this.pushClassPrivateMethod(classBody,privateMethod,true,false);return;}if(this.isNonstaticConstructor(publicMethod)){this.raise(Errors.ConstructorIsGenerator,publicMethod.key);}this.pushClassMethod(classBody,publicMethod,true,false,false,false);return;}const isContextual=!this.state.containsEsc&&tokenIsIdentifier(this.state.type);const key=this.parseClassElementName(member);const maybeContextualKw=isContextual?key.name:null;const isPrivate=this.isPrivateName(key);const maybeQuestionTokenStartLoc=this.state.startLoc;this.parsePostMemberNameModifiers(publicMember);if(this.isClassMethod()){method.kind="method";if(isPrivate){this.pushClassPrivateMethod(classBody,privateMethod,false,false);return;}const isConstructor=this.isNonstaticConstructor(publicMethod);let allowsDirectSuper=false;if(isConstructor){publicMethod.kind="constructor";if(state.hadConstructor&&!this.hasPlugin("typescript")){this.raise(Errors.DuplicateConstructor,key);}if(isConstructor&&this.hasPlugin("typescript")&&member.override){this.raise(Errors.OverrideOnConstructor,key);}state.hadConstructor=true;allowsDirectSuper=state.hadSuperClass;}this.pushClassMethod(classBody,publicMethod,false,false,isConstructor,allowsDirectSuper);}else if(this.isClassProperty()){if(isPrivate){this.pushClassPrivateProperty(classBody,privateProp);}else{this.pushClassProperty(classBody,publicProp);}}else if(maybeContextualKw==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(key);const isGenerator=this.eat(55);if(publicMember.optional){this.unexpected(maybeQuestionTokenStartLoc);}method.kind="method";const isPrivate=this.match(139);this.parseClassElementName(method);this.parsePostMemberNameModifiers(publicMember);if(isPrivate){this.pushClassPrivateMethod(classBody,privateMethod,isGenerator,true);}else{if(this.isNonstaticConstructor(publicMethod)){this.raise(Errors.ConstructorIsAsync,publicMethod.key);}this.pushClassMethod(classBody,publicMethod,isGenerator,true,false,false);}}else if((maybeContextualKw==="get"||maybeContextualKw==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(key);method.kind=maybeContextualKw;const isPrivate=this.match(139);this.parseClassElementName(publicMethod);if(isPrivate){this.pushClassPrivateMethod(classBody,privateMethod,false,false);}else{if(this.isNonstaticConstructor(publicMethod)){this.raise(Errors.ConstructorIsAccessor,publicMethod.key);}this.pushClassMethod(classBody,publicMethod,false,false,false,false);}this.checkGetterSetterParams(publicMethod);}else if(maybeContextualKw==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors");this.resetPreviousNodeTrailingComments(key);const isPrivate=this.match(139);this.parseClassElementName(publicProp);this.pushClassAccessorProperty(classBody,accessorProp,isPrivate);}else if(this.isLineTerminator()){if(isPrivate){this.pushClassPrivateProperty(classBody,privateProp);}else{this.pushClassProperty(classBody,publicProp);}}else{this.unexpected();}}parseClassElementName(member){const{type,value}=this.state;if((type===132||type===134)&&member.static&&value==="prototype"){this.raise(Errors.StaticPrototype,this.state.startLoc);}if(type===139){if(value==="constructor"){this.raise(Errors.ConstructorClassPrivateField,this.state.startLoc);}const key=this.parsePrivateName();member.key=key;return key;}this.parsePropertyName(member);return member.key;}parseClassStaticBlock(classBody,member){var _member$decorators;this.scope.enter(64|128|16);const oldLabels=this.state.labels;this.state.labels=[];this.prodParam.enter(0);const body=member.body=[];this.parseBlockOrModuleBlockBody(body,undefined,false,8);this.prodParam.exit();this.scope.exit();this.state.labels=oldLabels;classBody.body.push(this.finishNode(member,"StaticBlock"));if((_member$decorators=member.decorators)!=null&&_member$decorators.length){this.raise(Errors.DecoratorStaticBlock,member);}}pushClassProperty(classBody,prop){if(!prop.computed&&this.nameIsConstructor(prop.key)){this.raise(Errors.ConstructorClassField,prop.key);}classBody.body.push(this.parseClassProperty(prop));}pushClassPrivateProperty(classBody,prop){const node=this.parseClassPrivateProperty(prop);classBody.body.push(node);this.classScope.declarePrivateName(this.getPrivateNameSV(node.key),0,node.key.loc.start);}pushClassAccessorProperty(classBody,prop,isPrivate){if(!isPrivate&&!prop.computed&&this.nameIsConstructor(prop.key)){this.raise(Errors.ConstructorClassField,prop.key);}const node=this.parseClassAccessorProperty(prop);classBody.body.push(node);if(isPrivate){this.classScope.declarePrivateName(this.getPrivateNameSV(node.key),0,node.key.loc.start);}}pushClassMethod(classBody,method,isGenerator,isAsync,isConstructor,allowsDirectSuper){classBody.body.push(this.parseMethod(method,isGenerator,isAsync,isConstructor,allowsDirectSuper,"ClassMethod",true));}pushClassPrivateMethod(classBody,method,isGenerator,isAsync){const node=this.parseMethod(method,isGenerator,isAsync,false,false,"ClassPrivateMethod",true);classBody.body.push(node);const kind=node.kind==="get"?node.static?6:2:node.kind==="set"?node.static?5:1:0;this.declareClassPrivateMethodInScope(node,kind);}declareClassPrivateMethodInScope(node,kind){this.classScope.declarePrivateName(this.getPrivateNameSV(node.key),kind,node.key.loc.start);}parsePostMemberNameModifiers(methodOrProp){}parseClassPrivateProperty(node){this.parseInitializer(node);this.semicolon();return this.finishNode(node,"ClassPrivateProperty");}parseClassProperty(node){this.parseInitializer(node);this.semicolon();return this.finishNode(node,"ClassProperty");}parseClassAccessorProperty(node){this.parseInitializer(node);this.semicolon();return this.finishNode(node,"ClassAccessorProperty");}parseInitializer(node){this.scope.enter(64|16);this.expressionScope.enter(newExpressionScope());this.prodParam.enter(0);node.value=this.eat(29)?this.parseMaybeAssignAllowIn():null;this.expressionScope.exit();this.prodParam.exit();this.scope.exit();}parseClassId(node,isStatement,optionalId,bindingType=8331){if(tokenIsIdentifier(this.state.type)){node.id=this.parseIdentifier();if(isStatement){this.declareNameFromIdentifier(node.id,bindingType);}}else{if(optionalId||!isStatement){node.id=null;}else{throw this.raise(Errors.MissingClassName,this.state.startLoc);}}}parseClassSuper(node){node.superClass=this.eat(81)?this.parseExprSubscripts():null;}parseExport(node,decorators){const maybeDefaultIdentifier=this.parseMaybeImportPhase(node,true);const hasDefault=this.maybeParseExportDefaultSpecifier(node,maybeDefaultIdentifier);const parseAfterDefault=!hasDefault||this.eat(12);const hasStar=parseAfterDefault&&this.eatExportStar(node);const hasNamespace=hasStar&&this.maybeParseExportNamespaceSpecifier(node);const parseAfterNamespace=parseAfterDefault&&(!hasNamespace||this.eat(12));const isFromRequired=hasDefault||hasStar;if(hasStar&&!hasNamespace){if(hasDefault)this.unexpected();if(decorators){throw this.raise(Errors.UnsupportedDecoratorExport,node);}this.parseExportFrom(node,true);this.sawUnambiguousESM=true;return this.finishNode(node,"ExportAllDeclaration");}const hasSpecifiers=this.maybeParseExportNamedSpecifiers(node);if(hasDefault&&parseAfterDefault&&!hasStar&&!hasSpecifiers){this.unexpected(null,5);}if(hasNamespace&&parseAfterNamespace){this.unexpected(null,98);}let hasDeclaration;if(isFromRequired||hasSpecifiers){hasDeclaration=false;if(decorators){throw this.raise(Errors.UnsupportedDecoratorExport,node);}this.parseExportFrom(node,isFromRequired);}else{hasDeclaration=this.maybeParseExportDeclaration(node);}if(isFromRequired||hasSpecifiers||hasDeclaration){var _node2$declaration;const node2=node;this.checkExport(node2,true,false,!!node2.source);if(((_node2$declaration=node2.declaration)==null?void 0:_node2$declaration.type)==="ClassDeclaration"){this.maybeTakeDecorators(decorators,node2.declaration,node2);}else if(decorators){throw this.raise(Errors.UnsupportedDecoratorExport,node);}this.sawUnambiguousESM=true;return this.finishNode(node2,"ExportNamedDeclaration");}if(this.eat(65)){const node2=node;const decl=this.parseExportDefaultExpression();node2.declaration=decl;if(decl.type==="ClassDeclaration"){this.maybeTakeDecorators(decorators,decl,node2);}else if(decorators){throw this.raise(Errors.UnsupportedDecoratorExport,node);}this.checkExport(node2,true,true);this.sawUnambiguousESM=true;return this.finishNode(node2,"ExportDefaultDeclaration");}this.unexpected(null,5);}eatExportStar(node){return this.eat(55);}maybeParseExportDefaultSpecifier(node,maybeDefaultIdentifier){if(maybeDefaultIdentifier||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",maybeDefaultIdentifier==null?void 0:maybeDefaultIdentifier.loc.start);const id=maybeDefaultIdentifier||this.parseIdentifier(true);const specifier=this.startNodeAtNode(id);specifier.exported=id;node.specifiers=[this.finishNode(specifier,"ExportDefaultSpecifier")];return true;}return false;}maybeParseExportNamespaceSpecifier(node){if(this.isContextual(93)){var _ref,_ref$specifiers;(_ref$specifiers=(_ref=node).specifiers)!=null?_ref$specifiers:_ref.specifiers=[];const specifier=this.startNodeAt(this.state.lastTokStartLoc);this.next();specifier.exported=this.parseModuleExportName();node.specifiers.push(this.finishNode(specifier,"ExportNamespaceSpecifier"));return true;}return false;}maybeParseExportNamedSpecifiers(node){if(this.match(5)){const node2=node;if(!node2.specifiers)node2.specifiers=[];const isTypeExport=node2.exportKind==="type";node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));node2.source=null;if(this.hasPlugin("importAssertions")){node2.assertions=[];}else{node2.attributes=[];}node2.declaration=null;return true;}return false;}maybeParseExportDeclaration(node){if(this.shouldParseExportDeclaration()){node.specifiers=[];node.source=null;if(this.hasPlugin("importAssertions")){node.assertions=[];}else{node.attributes=[];}node.declaration=this.parseExportDeclaration(node);return true;}return false;}isAsyncFunction(){if(!this.isContextual(95))return false;const next=this.nextTokenInLineStart();return this.isUnparsedContextual(next,"function");}parseExportDefaultExpression(){const expr=this.startNode();if(this.match(68)){this.next();return this.parseFunction(expr,1|4);}else if(this.isAsyncFunction()){this.next();this.next();return this.parseFunction(expr,1|4|8);}if(this.match(80)){return this.parseClass(expr,true,true);}if(this.match(26)){if(this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===true){this.raise(Errors.DecoratorBeforeExport,this.state.startLoc);}return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false),this.startNode()),true,true);}if(this.match(75)||this.match(74)||this.isLet()){throw this.raise(Errors.UnsupportedDefaultExport,this.state.startLoc);}const res=this.parseMaybeAssignAllowIn();this.semicolon();return res;}parseExportDeclaration(node){if(this.match(80)){const node=this.parseClass(this.startNode(),true,false);return node;}return this.parseStatementListItem();}isExportDefaultSpecifier(){const{type}=this.state;if(tokenIsIdentifier(type)){if(type===95&&!this.state.containsEsc||type===100){return false;}if((type===130||type===129)&&!this.state.containsEsc){const{type:nextType}=this.lookahead();if(tokenIsIdentifier(nextType)&&nextType!==98||nextType===5){this.expectOnePlugin(["flow","typescript"]);return false;}}}else if(!this.match(65)){return false;}const next=this.nextTokenStart();const hasFrom=this.isUnparsedContextual(next,"from");if(this.input.charCodeAt(next)===44||tokenIsIdentifier(this.state.type)&&hasFrom){return true;}if(this.match(65)&&hasFrom){const nextAfterFrom=this.input.charCodeAt(this.nextTokenStartSince(next+4));return nextAfterFrom===34||nextAfterFrom===39;}return false;}parseExportFrom(node,expect){if(this.eatContextual(98)){node.source=this.parseImportSource();this.checkExport(node);this.maybeParseImportAttributes(node);this.checkJSONModuleImport(node);}else if(expect){this.unexpected();}this.semicolon();}shouldParseExportDeclaration(){const{type}=this.state;if(type===26){this.expectOnePlugin(["decorators","decorators-legacy"]);if(this.hasPlugin("decorators")){if(this.getPluginOption("decorators","decoratorsBeforeExport")===true){this.raise(Errors.DecoratorBeforeExport,this.state.startLoc);}return true;}}if(this.isContextual(107)){this.raise(Errors.UsingDeclarationExport,this.state.startLoc);return true;}if(this.isContextual(96)&&this.startsAwaitUsing()){this.raise(Errors.UsingDeclarationExport,this.state.startLoc);return true;}return type===74||type===75||type===68||type===80||this.isLet()||this.isAsyncFunction();}checkExport(node,checkNames,isDefault,isFrom){if(checkNames){var _node$specifiers;if(isDefault){this.checkDuplicateExports(node,"default");if(this.hasPlugin("exportDefaultFrom")){var _declaration$extra;const declaration=node.declaration;if(declaration.type==="Identifier"&&declaration.name==="from"&&declaration.end-declaration.start===4&&!((_declaration$extra=declaration.extra)!=null&&_declaration$extra.parenthesized)){this.raise(Errors.ExportDefaultFromAsIdentifier,declaration);}}}else if((_node$specifiers=node.specifiers)!=null&&_node$specifiers.length){for(const specifier of node.specifiers){const{exported}=specifier;const exportName=exported.type==="Identifier"?exported.name:exported.value;this.checkDuplicateExports(specifier,exportName);if(!isFrom&&specifier.local){const{local}=specifier;if(local.type!=="Identifier"){this.raise(Errors.ExportBindingIsString,specifier,{localName:local.value,exportName});}else{this.checkReservedWord(local.name,local.loc.start,true,false);this.scope.checkLocalExport(local);}}}}else if(node.declaration){const decl=node.declaration;if(decl.type==="FunctionDeclaration"||decl.type==="ClassDeclaration"){const{id}=decl;if(!id)throw new Error("Assertion failure");this.checkDuplicateExports(node,id.name);}else if(decl.type==="VariableDeclaration"){for(const declaration of decl.declarations){this.checkDeclaration(declaration.id);}}}}}checkDeclaration(node){if(node.type==="Identifier"){this.checkDuplicateExports(node,node.name);}else if(node.type==="ObjectPattern"){for(const prop of node.properties){this.checkDeclaration(prop);}}else if(node.type==="ArrayPattern"){for(const elem of node.elements){if(elem){this.checkDeclaration(elem);}}}else if(node.type==="ObjectProperty"){this.checkDeclaration(node.value);}else if(node.type==="RestElement"){this.checkDeclaration(node.argument);}else if(node.type==="AssignmentPattern"){this.checkDeclaration(node.left);}}checkDuplicateExports(node,exportName){if(this.exportedIdentifiers.has(exportName)){if(exportName==="default"){this.raise(Errors.DuplicateDefaultExport,node);}else{this.raise(Errors.DuplicateExport,node,{exportName});}}this.exportedIdentifiers.add(exportName);}parseExportSpecifiers(isInTypeExport){const nodes=[];let first=true;this.expect(5);while(!this.eat(8)){if(first){first=false;}else{this.expect(12);if(this.eat(8))break;}const isMaybeTypeOnly=this.isContextual(130);const isString=this.match(134);const node=this.startNode();node.local=this.parseModuleExportName();nodes.push(this.parseExportSpecifier(node,isString,isInTypeExport,isMaybeTypeOnly));}return nodes;}parseExportSpecifier(node,isString,isInTypeExport,isMaybeTypeOnly){if(this.eatContextual(93)){node.exported=this.parseModuleExportName();}else if(isString){node.exported=this.cloneStringLiteral(node.local);}else if(!node.exported){node.exported=this.cloneIdentifier(node.local);}return this.finishNode(node,"ExportSpecifier");}parseModuleExportName(){if(this.match(134)){const result=this.parseStringLiteral(this.state.value);const surrogate=loneSurrogate.exec(result.value);if(surrogate){this.raise(Errors.ModuleExportNameHasLoneSurrogate,result,{surrogateCharCode:surrogate[0].charCodeAt(0)});}return result;}return this.parseIdentifier(true);}isJSONModuleImport(node){if(node.assertions!=null){return node.assertions.some(({key,value})=>{return value.value==="json"&&(key.type==="Identifier"?key.name==="type":key.value==="type");});}return false;}checkImportReflection(node){const{specifiers}=node;const singleBindingType=specifiers.length===1?specifiers[0].type:null;if(node.phase==="source"){if(singleBindingType!=="ImportDefaultSpecifier"){this.raise(Errors.SourcePhaseImportRequiresDefault,specifiers[0].loc.start);}}else if(node.phase==="defer"){if(singleBindingType!=="ImportNamespaceSpecifier"){this.raise(Errors.DeferImportRequiresNamespace,specifiers[0].loc.start);}}else if(node.module){var _node$assertions;if(singleBindingType!=="ImportDefaultSpecifier"){this.raise(Errors.ImportReflectionNotBinding,specifiers[0].loc.start);}if(((_node$assertions=node.assertions)==null?void 0:_node$assertions.length)>0){this.raise(Errors.ImportReflectionHasAssertion,specifiers[0].loc.start);}}}checkJSONModuleImport(node){if(this.isJSONModuleImport(node)&&node.type!=="ExportAllDeclaration"){const{specifiers}=node;if(specifiers!=null){const nonDefaultNamedSpecifier=specifiers.find(specifier=>{let imported;if(specifier.type==="ExportSpecifier"){imported=specifier.local;}else if(specifier.type==="ImportSpecifier"){imported=specifier.imported;}if(imported!==undefined){return imported.type==="Identifier"?imported.name!=="default":imported.value!=="default";}});if(nonDefaultNamedSpecifier!==undefined){this.raise(Errors.ImportJSONBindingNotDefault,nonDefaultNamedSpecifier.loc.start);}}}}isPotentialImportPhase(isExport){if(isExport)return false;return this.isContextual(105)||this.isContextual(97)||this.isContextual(127);}applyImportPhase(node,isExport,phase,loc){if(isExport){return;}if(phase==="module"){this.expectPlugin("importReflection",loc);node.module=true;}else if(this.hasPlugin("importReflection")){node.module=false;}if(phase==="source"){this.expectPlugin("sourcePhaseImports",loc);node.phase="source";}else if(phase==="defer"){this.expectPlugin("deferredImportEvaluation",loc);node.phase="defer";}else if(this.hasPlugin("sourcePhaseImports")){node.phase=null;}}parseMaybeImportPhase(node,isExport){if(!this.isPotentialImportPhase(isExport)){this.applyImportPhase(node,isExport,null);return null;}const phaseIdentifier=this.parseIdentifier(true);const{type}=this.state;const isImportPhase=tokenIsKeywordOrIdentifier(type)?type!==98||this.lookaheadCharCode()===102:type!==12;if(isImportPhase){this.resetPreviousIdentifierLeadingComments(phaseIdentifier);this.applyImportPhase(node,isExport,phaseIdentifier.name,phaseIdentifier.loc.start);return null;}else{this.applyImportPhase(node,isExport,null);return phaseIdentifier;}}isPrecedingIdImportPhase(phase){const{type}=this.state;return tokenIsIdentifier(type)?type!==98||this.lookaheadCharCode()===102:type!==12;}parseImport(node){if(this.match(134)){return this.parseImportSourceAndAttributes(node);}return this.parseImportSpecifiersAndAfter(node,this.parseMaybeImportPhase(node,false));}parseImportSpecifiersAndAfter(node,maybeDefaultIdentifier){node.specifiers=[];const hasDefault=this.maybeParseDefaultImportSpecifier(node,maybeDefaultIdentifier);const parseNext=!hasDefault||this.eat(12);const hasStar=parseNext&&this.maybeParseStarImportSpecifier(node);if(parseNext&&!hasStar)this.parseNamedImportSpecifiers(node);this.expectContextual(98);return this.parseImportSourceAndAttributes(node);}parseImportSourceAndAttributes(node){var _node$specifiers2;(_node$specifiers2=node.specifiers)!=null?_node$specifiers2:node.specifiers=[];node.source=this.parseImportSource();this.maybeParseImportAttributes(node);this.checkImportReflection(node);this.checkJSONModuleImport(node);this.semicolon();this.sawUnambiguousESM=true;return this.finishNode(node,"ImportDeclaration");}parseImportSource(){if(!this.match(134))this.unexpected();return this.parseExprAtom();}parseImportSpecifierLocal(node,specifier,type){specifier.local=this.parseIdentifier();node.specifiers.push(this.finishImportSpecifier(specifier,type));}finishImportSpecifier(specifier,type,bindingType=8201){this.checkLVal(specifier.local,{type},bindingType);return this.finishNode(specifier,type);}parseImportAttributes(){this.expect(5);const attrs=[];const attrNames=new Set();do{if(this.match(8)){break;}const node=this.startNode();const keyName=this.state.value;if(attrNames.has(keyName)){this.raise(Errors.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:keyName});}attrNames.add(keyName);if(this.match(134)){node.key=this.parseStringLiteral(keyName);}else{node.key=this.parseIdentifier(true);}this.expect(14);if(!this.match(134)){throw this.raise(Errors.ModuleAttributeInvalidValue,this.state.startLoc);}node.value=this.parseStringLiteral(this.state.value);attrs.push(this.finishNode(node,"ImportAttribute"));}while(this.eat(12));this.expect(8);return attrs;}parseModuleAttributes(){const attrs=[];const attributes=new Set();do{const node=this.startNode();node.key=this.parseIdentifier(true);if(node.key.name!=="type"){this.raise(Errors.ModuleAttributeDifferentFromType,node.key);}if(attributes.has(node.key.name)){this.raise(Errors.ModuleAttributesWithDuplicateKeys,node.key,{key:node.key.name});}attributes.add(node.key.name);this.expect(14);if(!this.match(134)){throw this.raise(Errors.ModuleAttributeInvalidValue,this.state.startLoc);}node.value=this.parseStringLiteral(this.state.value);attrs.push(this.finishNode(node,"ImportAttribute"));}while(this.eat(12));return attrs;}maybeParseImportAttributes(node){let attributes;{var useWith=false;}if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40){return;}this.next();if(this.hasPlugin("moduleAttributes")){attributes=this.parseModuleAttributes();this.addExtra(node,"deprecatedWithLegacySyntax",true);}else{attributes=this.parseImportAttributes();}{useWith=true;}}else if(this.isContextual(94)&&!this.hasPrecedingLineBreak()){if(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")){this.raise(Errors.ImportAttributesUseAssert,this.state.startLoc);}if(!this.hasPlugin("importAssertions")){this.addExtra(node,"deprecatedAssertSyntax",true);}this.next();attributes=this.parseImportAttributes();}else{attributes=[];}if(!useWith&&this.hasPlugin("importAssertions")){node.assertions=attributes;}else{node.attributes=attributes;}}maybeParseDefaultImportSpecifier(node,maybeDefaultIdentifier){if(maybeDefaultIdentifier){const specifier=this.startNodeAtNode(maybeDefaultIdentifier);specifier.local=maybeDefaultIdentifier;node.specifiers.push(this.finishImportSpecifier(specifier,"ImportDefaultSpecifier"));return true;}else if(tokenIsKeywordOrIdentifier(this.state.type)){this.parseImportSpecifierLocal(node,this.startNode(),"ImportDefaultSpecifier");return true;}return false;}maybeParseStarImportSpecifier(node){if(this.match(55)){const specifier=this.startNode();this.next();this.expectContextual(93);this.parseImportSpecifierLocal(node,specifier,"ImportNamespaceSpecifier");return true;}return false;}parseNamedImportSpecifiers(node){let first=true;this.expect(5);while(!this.eat(8)){if(first){first=false;}else{if(this.eat(14)){throw this.raise(Errors.DestructureNamedImport,this.state.startLoc);}this.expect(12);if(this.eat(8))break;}const specifier=this.startNode();const importedIsString=this.match(134);const isMaybeTypeOnly=this.isContextual(130);specifier.imported=this.parseModuleExportName();const importSpecifier=this.parseImportSpecifier(specifier,importedIsString,node.importKind==="type"||node.importKind==="typeof",isMaybeTypeOnly,undefined);node.specifiers.push(importSpecifier);}}parseImportSpecifier(specifier,importedIsString,isInTypeOnlyImport,isMaybeTypeOnly,bindingType){if(this.eatContextual(93)){specifier.local=this.parseIdentifier();}else{const{imported}=specifier;if(importedIsString){throw this.raise(Errors.ImportBindingIsString,specifier,{importName:imported.value});}this.checkReservedWord(imported.name,specifier.loc.start,true,true);if(!specifier.local){specifier.local=this.cloneIdentifier(imported);}}return this.finishImportSpecifier(specifier,"ImportSpecifier",bindingType);}isThisParam(param){return param.type==="Identifier"&¶m.name==="this";}}class Parser extends StatementParser{constructor(options,input,pluginsMap){options=getOptions(options);super(options,input);this.options=options;this.initializeScopes();this.plugins=pluginsMap;this.filename=options.sourceFilename;this.startIndex=options.startIndex;let optionFlags=0;if(options.allowAwaitOutsideFunction){optionFlags|=1;}if(options.allowReturnOutsideFunction){optionFlags|=2;}if(options.allowImportExportEverywhere){optionFlags|=8;}if(options.allowSuperOutsideMethod){optionFlags|=16;}if(options.allowUndeclaredExports){optionFlags|=64;}if(options.allowNewTargetOutsideFunction){optionFlags|=4;}if(options.allowYieldOutsideFunction){optionFlags|=32;}if(options.ranges){optionFlags|=128;}if(options.tokens){optionFlags|=256;}if(options.createImportExpressions){optionFlags|=512;}if(options.createParenthesizedExpressions){optionFlags|=1024;}if(options.errorRecovery){optionFlags|=2048;}if(options.attachComment){optionFlags|=4096;}if(options.annexB){optionFlags|=8192;}this.optionFlags=optionFlags;}getScopeHandler(){return ScopeHandler;}parse(){this.enterInitialScopes();const file=this.startNode();const program=this.startNode();this.nextToken();file.errors=null;this.parseTopLevel(file,program);file.errors=this.state.errors;file.comments.length=this.state.commentsLen;return file;}}function parse(input,options){var _options;if(((_options=options)==null?void 0:_options.sourceType)==="unambiguous"){options=Object.assign({},options);try{options.sourceType="module";const parser=getParser(options,input);const ast=parser.parse();if(parser.sawUnambiguousESM){return ast;}if(parser.ambiguousScriptDifferentAst){try{options.sourceType="script";return getParser(options,input).parse();}catch(_unused){}}else{ast.program.sourceType="script";}return ast;}catch(moduleError){try{options.sourceType="script";return getParser(options,input).parse();}catch(_unused2){}throw moduleError;}}else{return getParser(options,input).parse();}}function parseExpression(input,options){const parser=getParser(options,input);if(parser.options.strictMode){parser.state.strict=true;}return parser.getExpression();}function generateExportedTokenTypes(internalTokenTypes){const tokenTypes={};for(const typeName of Object.keys(internalTokenTypes)){tokenTypes[typeName]=getExportedToken(internalTokenTypes[typeName]);}return tokenTypes;}const tokTypes=generateExportedTokenTypes(tt);function getParser(options,input){let cls=Parser;const pluginsMap=new Map();if(options!=null&&options.plugins){for(const plugin of options.plugins){let name,opts;if(typeof plugin==="string"){name=plugin;}else{[name,opts]=plugin;}if(!pluginsMap.has(name)){pluginsMap.set(name,opts||{});}}validatePlugins(pluginsMap);cls=getParserClass(pluginsMap);}return new cls(options,input,pluginsMap);}const parserClassCache=new Map();function getParserClass(pluginsMap){const pluginList=[];for(const name of mixinPluginNames){if(pluginsMap.has(name)){pluginList.push(name);}}const key=pluginList.join("|");let cls=parserClassCache.get(key);if(!cls){cls=Parser;for(const plugin of pluginList){cls=mixinPlugins[plugin](cls);}parserClassCache.set(key,cls);}return cls;}exports.parse=parse;exports.parseExpression=parseExpression;exports.tokTypes=tokTypes;
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 613:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-function _objectWithoutPropertiesLoose(r, e) {
- if (null == r) return {};
- var t = {};
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
- if (-1 !== e.indexOf(n)) continue;
- t[n] = r[n];
- }
- return t;
-}
-class Position {
- constructor(line, col, index) {
- this.line = void 0;
- this.column = void 0;
- this.index = void 0;
- this.line = line;
- this.column = col;
- this.index = index;
- }
-}
-class SourceLocation {
- constructor(start, end) {
- this.start = void 0;
- this.end = void 0;
- this.filename = void 0;
- this.identifierName = void 0;
- this.start = start;
- this.end = end;
- }
-}
-function createPositionWithColumnOffset(position, columnOffset) {
- const {
- line,
- column,
- index
- } = position;
- return new Position(line, column + columnOffset, index + columnOffset);
-}
-const code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
-var ModuleErrors = {
- ImportMetaOutsideModule: {
- message: `import.meta may appear only with 'sourceType: "module"'`,
- code
- },
- ImportOutsideModule: {
- message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
- code
- }
-};
-const NodeDescriptions = {
- ArrayPattern: "array destructuring pattern",
- AssignmentExpression: "assignment expression",
- AssignmentPattern: "assignment expression",
- ArrowFunctionExpression: "arrow function expression",
- ConditionalExpression: "conditional expression",
- CatchClause: "catch clause",
- ForOfStatement: "for-of statement",
- ForInStatement: "for-in statement",
- ForStatement: "for-loop",
- FormalParameters: "function parameter list",
- Identifier: "identifier",
- ImportSpecifier: "import specifier",
- ImportDefaultSpecifier: "import default specifier",
- ImportNamespaceSpecifier: "import namespace specifier",
- ObjectPattern: "object destructuring pattern",
- ParenthesizedExpression: "parenthesized expression",
- RestElement: "rest element",
- UpdateExpression: {
- true: "prefix operation",
- false: "postfix operation"
- },
- VariableDeclarator: "variable declaration",
- YieldExpression: "yield expression"
-};
-const toNodeDescription = node => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
-var StandardErrors = {
- AccessorIsGenerator: ({
- kind
- }) => `A ${kind}ter cannot be a generator.`,
- ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
- AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
- AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
- AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
- AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
- AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.",
- AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
- BadGetterArity: "A 'get' accessor must not have any formal parameters.",
- BadSetterArity: "A 'set' accessor must have exactly one formal parameter.",
- BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.",
- ConstructorClassField: "Classes may not have a field named 'constructor'.",
- ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
- ConstructorIsAccessor: "Class constructor may not be an accessor.",
- ConstructorIsAsync: "Constructor can't be an async function.",
- ConstructorIsGenerator: "Constructor can't be a generator.",
- DeclarationMissingInitializer: ({
- kind
- }) => `Missing initializer in ${kind} declaration.`,
- DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
- DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",
- DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",
- DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
- DecoratorExportClass: "Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",
- DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
- DecoratorStaticBlock: "Decorators can't be used with a static block.",
- DeferImportRequiresNamespace: 'Only `import defer * as x from "./module"` is valid.',
- DeletePrivateField: "Deleting a private field is not allowed.",
- DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
- DuplicateConstructor: "Duplicate constructor in the same class.",
- DuplicateDefaultExport: "Only one default export allowed per module.",
- DuplicateExport: ({
- exportName
- }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
- DuplicateProto: "Redefinition of __proto__ property.",
- DuplicateRegExpFlags: "Duplicate regular expression flag.",
- DynamicImportPhaseRequiresImportExpressions: ({
- phase
- }) => `'import.${phase}(...)' can only be parsed when using the 'createImportExpressions' option.`,
- ElementAfterRest: "Rest element must be last element.",
- EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
- ExportBindingIsString: ({
- localName,
- exportName
- }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
- ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
- ForInOfLoopInitializer: ({
- type
- }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`,
- ForInUsing: "For-in loop may not start with 'using' declaration.",
- ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
- ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
- GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
- IllegalBreakContinue: ({
- type
- }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
- IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
- IllegalReturn: "'return' outside of function.",
- ImportAttributesUseAssert: "The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",
- ImportBindingIsString: ({
- importName
- }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,
- ImportCallArity: `\`import()\` requires exactly one or two arguments.`,
- ImportCallNotNewExpression: "Cannot use new with import(...).",
- ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
- ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
- ImportReflectionHasAssertion: "`import module x` cannot have assertions.",
- ImportReflectionNotBinding: 'Only `import module x from "./module"` is valid.',
- IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
- InvalidBigIntLiteral: "Invalid BigIntLiteral.",
- InvalidCodePoint: "Code point out of bounds.",
- InvalidCoverInitializedName: "Invalid shorthand property initializer.",
- InvalidDecimal: "Invalid decimal.",
- InvalidDigit: ({
- radix
- }) => `Expected number in radix ${radix}.`,
- InvalidEscapeSequence: "Bad character escape sequence.",
- InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
- InvalidEscapedReservedWord: ({
- reservedWord
- }) => `Escape sequence in keyword ${reservedWord}.`,
- InvalidIdentifier: ({
- identifierName
- }) => `Invalid identifier ${identifierName}.`,
- InvalidLhs: ({
- ancestor
- }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
- InvalidLhsBinding: ({
- ancestor
- }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
- InvalidLhsOptionalChaining: ({
- ancestor
- }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
- InvalidNumber: "Invalid number.",
- InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
- InvalidOrUnexpectedToken: ({
- unexpected
- }) => `Unexpected character '${unexpected}'.`,
- InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
- InvalidPrivateFieldResolution: ({
- identifierName
- }) => `Private name #${identifierName} is not defined.`,
- InvalidPropertyBindingPattern: "Binding member expression.",
- InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions.",
- InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
- LabelRedeclaration: ({
- labelName
- }) => `Label '${labelName}' is already declared.`,
- LetInLexicalBinding: "'let' is disallowed as a lexically bound name.",
- LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
- MalformedRegExpFlags: "Invalid regular expression flag.",
- MissingClassName: "A class name is required.",
- MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
- MissingSemicolon: "Missing semicolon.",
- MissingPlugin: ({
- missingPlugin
- }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map(name => JSON.stringify(name)).join(", ")}.`,
- MissingOneOfPlugins: ({
- missingPlugin
- }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map(name => JSON.stringify(name)).join(", ")}.`,
- MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
- MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
- ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`.",
- ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
- ModuleAttributesWithDuplicateKeys: ({
- key
- }) => `Duplicate key "${key}" is not allowed in module attributes.`,
- ModuleExportNameHasLoneSurrogate: ({
- surrogateCharCode
- }) => `An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`,
- ModuleExportUndefined: ({
- localName
- }) => `Export '${localName}' is not defined.`,
- MultipleDefaultsInSwitch: "Multiple default clauses.",
- NewlineAfterThrow: "Illegal newline after throw.",
- NoCatchOrFinally: "Missing catch or finally clause.",
- NumberIdentifier: "Identifier directly after number.",
- NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
- ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
- OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
- OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
- OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
- ParamDupe: "Argument name clash.",
- PatternHasAccessor: "Object pattern can't contain getter or setter.",
- PatternHasMethod: "Object pattern can't contain methods.",
- PrivateInExpectedIn: ({
- identifierName
- }) => `Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`,
- PrivateNameRedeclaration: ({
- identifierName
- }) => `Duplicate private name #${identifierName}.`,
- RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
- RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
- RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
- RecordNoProto: "'__proto__' is not allowed in Record expressions.",
- RestTrailingComma: "Unexpected trailing comma after rest element.",
- SloppyFunction: "In non-strict mode code, functions can only be declared at top level or inside a block.",
- SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
- SourcePhaseImportRequiresDefault: 'Only `import source x from "./module"` is valid.',
- StaticPrototype: "Classes may not have static property named prototype.",
- SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
- SuperPrivateField: "Private fields can't be accessed on super.",
- TrailingDecorator: "Decorators must be attached to a class element.",
- TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
- TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
- TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
- UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
- UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',
- UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
- UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
- UnexpectedKeyword: ({
- keyword
- }) => `Unexpected keyword '${keyword}'.`,
- UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
- UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
- UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
- UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
- UnexpectedPrivateField: "Unexpected private name.",
- UnexpectedReservedWord: ({
- reservedWord
- }) => `Unexpected reserved word '${reservedWord}'.`,
- UnexpectedSuper: "'super' is only allowed in object methods and classes.",
- UnexpectedToken: ({
- expected,
- unexpected
- }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
- UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
- UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script`.",
- UnsupportedBind: "Binding should be performed on object property.",
- UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
- UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
- UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
- UnsupportedMetaProperty: ({
- target,
- onlyValidPropertyName
- }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,
- UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
- UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
- UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
- UnterminatedComment: "Unterminated comment.",
- UnterminatedRegExp: "Unterminated regular expression.",
- UnterminatedString: "Unterminated string constant.",
- UnterminatedTemplate: "Unterminated template.",
- UsingDeclarationExport: "Using declaration cannot be exported.",
- UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
- VarRedeclaration: ({
- identifierName
- }) => `Identifier '${identifierName}' has already been declared.`,
- YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
- YieldInParameter: "Yield expression is not allowed in formal parameters.",
- YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
- ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
-};
-var StrictModeErrors = {
- StrictDelete: "Deleting local variable in strict mode.",
- StrictEvalArguments: ({
- referenceName
- }) => `Assigning to '${referenceName}' in strict mode.`,
- StrictEvalArgumentsBinding: ({
- bindingName
- }) => `Binding '${bindingName}' in strict mode.`,
- StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
- StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
- StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
- StrictWith: "'with' in strict mode."
-};
-const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
-var PipelineOperatorErrors = Object.assign({
- PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
- PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
- PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
- PipeTopicUnconfiguredToken: ({
- token
- }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,
- PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
- PipeUnparenthesizedBody: ({
- type
- }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({
- type
- })}; please wrap it in parentheses.`
-}, {
- PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
- PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
- PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
- PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
- PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
- PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
-});
-const _excluded = ["message"];
-function defineHidden(obj, key, value) {
- Object.defineProperty(obj, key, {
- enumerable: false,
- configurable: true,
- value
- });
-}
-function toParseErrorConstructor({
- toMessage,
- code,
- reasonCode,
- syntaxPlugin
-}) {
- const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
- {
- const oldReasonCodes = {
- AccessorCannotDeclareThisParameter: "AccesorCannotDeclareThisParameter",
- AccessorCannotHaveTypeParameters: "AccesorCannotHaveTypeParameters",
- ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",
- SetAccessorCannotHaveOptionalParameter: "SetAccesorCannotHaveOptionalParameter",
- SetAccessorCannotHaveRestParameter: "SetAccesorCannotHaveRestParameter",
- SetAccessorCannotHaveReturnType: "SetAccesorCannotHaveReturnType"
- };
- if (oldReasonCodes[reasonCode]) {
- reasonCode = oldReasonCodes[reasonCode];
- }
- }
- return function constructor(loc, details) {
- const error = new SyntaxError();
- error.code = code;
- error.reasonCode = reasonCode;
- error.loc = loc;
- error.pos = loc.index;
- error.syntaxPlugin = syntaxPlugin;
- if (hasMissingPlugin) {
- error.missingPlugin = details.missingPlugin;
- }
- defineHidden(error, "clone", function clone(overrides = {}) {
- var _overrides$loc;
- const {
- line,
- column,
- index
- } = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
- return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
- });
- defineHidden(error, "details", details);
- Object.defineProperty(error, "message", {
- configurable: true,
- get() {
- const message = `${toMessage(details)} (${loc.line}:${loc.column})`;
- this.message = message;
- return message;
- },
- set(value) {
- Object.defineProperty(this, "message", {
- value,
- writable: true
- });
- }
- });
- return error;
- };
-}
-function ParseErrorEnum(argument, syntaxPlugin) {
- if (Array.isArray(argument)) {
- return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]);
- }
- const ParseErrorConstructors = {};
- for (const reasonCode of Object.keys(argument)) {
- const template = argument[reasonCode];
- const _ref = typeof template === "string" ? {
- message: () => template
- } : typeof template === "function" ? {
- message: template
- } : template,
- {
- message
- } = _ref,
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
- const toMessage = typeof message === "string" ? () => message : message;
- ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
- code: "BABEL_PARSER_SYNTAX_ERROR",
- reasonCode,
- toMessage
- }, syntaxPlugin ? {
- syntaxPlugin
- } : {}, rest));
- }
- return ParseErrorConstructors;
-}
-const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
-function createDefaultOptions() {
- return {
- sourceType: "script",
- sourceFilename: undefined,
- startIndex: 0,
- startColumn: 0,
- startLine: 1,
- allowAwaitOutsideFunction: false,
- allowReturnOutsideFunction: false,
- allowNewTargetOutsideFunction: false,
- allowImportExportEverywhere: false,
- allowSuperOutsideMethod: false,
- allowUndeclaredExports: false,
- allowYieldOutsideFunction: false,
- plugins: [],
- strictMode: null,
- ranges: false,
- tokens: false,
- createImportExpressions: false,
- createParenthesizedExpressions: false,
- errorRecovery: false,
- attachComment: true,
- annexB: true
- };
-}
-function getOptions(opts) {
- const options = createDefaultOptions();
- if (opts == null) {
- return options;
- }
- if (opts.annexB != null && opts.annexB !== false) {
- throw new Error("The `annexB` option can only be set to `false`.");
- }
- for (const key of Object.keys(options)) {
- if (opts[key] != null) options[key] = opts[key];
- }
- if (options.startLine === 1) {
- if (opts.startIndex == null && options.startColumn > 0) {
- options.startIndex = options.startColumn;
- } else if (opts.startColumn == null && options.startIndex > 0) {
- options.startColumn = options.startIndex;
- }
- } else if (opts.startColumn == null || opts.startIndex == null) {
- if (opts.startIndex != null) {
- throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
- }
- }
- return options;
-}
-const {
- defineProperty
-} = Object;
-const toUnenumerable = (object, key) => {
- if (object) {
- defineProperty(object, key, {
- enumerable: false,
- value: object[key]
- });
- }
-};
-function toESTreeLocation(node) {
- toUnenumerable(node.loc.start, "index");
- toUnenumerable(node.loc.end, "index");
- return node;
-}
-var estree = superClass => class ESTreeParserMixin extends superClass {
- parse() {
- const file = toESTreeLocation(super.parse());
- if (this.optionFlags & 256) {
- file.tokens = file.tokens.map(toESTreeLocation);
- }
- return file;
- }
- parseRegExpLiteral({
- pattern,
- flags
- }) {
- let regex = null;
- try {
- regex = new RegExp(pattern, flags);
- } catch (_) {}
- const node = this.estreeParseLiteral(regex);
- node.regex = {
- pattern,
- flags
- };
- return node;
- }
- parseBigIntLiteral(value) {
- let bigInt;
- try {
- bigInt = BigInt(value);
- } catch (_unused) {
- bigInt = null;
- }
- const node = this.estreeParseLiteral(bigInt);
- node.bigint = String(node.value || value);
- return node;
- }
- parseDecimalLiteral(value) {
- const decimal = null;
- const node = this.estreeParseLiteral(decimal);
- node.decimal = String(node.value || value);
- return node;
- }
- estreeParseLiteral(value) {
- return this.parseLiteral(value, "Literal");
- }
- parseStringLiteral(value) {
- return this.estreeParseLiteral(value);
- }
- parseNumericLiteral(value) {
- return this.estreeParseLiteral(value);
- }
- parseNullLiteral() {
- return this.estreeParseLiteral(null);
- }
- parseBooleanLiteral(value) {
- return this.estreeParseLiteral(value);
- }
- directiveToStmt(directive) {
- const expression = directive.value;
- delete directive.value;
- expression.type = "Literal";
- expression.raw = expression.extra.raw;
- expression.value = expression.extra.expressionValue;
- const stmt = directive;
- stmt.type = "ExpressionStatement";
- stmt.expression = expression;
- stmt.directive = expression.extra.rawValue;
- delete expression.extra;
- return stmt;
- }
- initFunction(node, isAsync) {
- super.initFunction(node, isAsync);
- node.expression = false;
- }
- checkDeclaration(node) {
- if (node != null && this.isObjectProperty(node)) {
- this.checkDeclaration(node.value);
- } else {
- super.checkDeclaration(node);
- }
- }
- getObjectOrClassMethodParams(method) {
- return method.value.params;
- }
- isValidDirective(stmt) {
- var _stmt$expression$extr;
- return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized);
- }
- parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
- super.parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse);
- const directiveStatements = node.directives.map(d => this.directiveToStmt(d));
- node.body = directiveStatements.concat(node.body);
- delete node.directives;
- }
- parsePrivateName() {
- const node = super.parsePrivateName();
- {
- if (!this.getPluginOption("estree", "classFeatures")) {
- return node;
- }
- }
- return this.convertPrivateNameToPrivateIdentifier(node);
- }
- convertPrivateNameToPrivateIdentifier(node) {
- const name = super.getPrivateNameSV(node);
- node = node;
- delete node.id;
- node.name = name;
- node.type = "PrivateIdentifier";
- return node;
- }
- isPrivateName(node) {
- {
- if (!this.getPluginOption("estree", "classFeatures")) {
- return super.isPrivateName(node);
- }
- }
- return node.type === "PrivateIdentifier";
- }
- getPrivateNameSV(node) {
- {
- if (!this.getPluginOption("estree", "classFeatures")) {
- return super.getPrivateNameSV(node);
- }
- }
- return node.name;
- }
- parseLiteral(value, type) {
- const node = super.parseLiteral(value, type);
- node.raw = node.extra.raw;
- delete node.extra;
- return node;
- }
- parseFunctionBody(node, allowExpression, isMethod = false) {
- super.parseFunctionBody(node, allowExpression, isMethod);
- node.expression = node.body.type !== "BlockStatement";
- }
- parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
- let funcNode = this.startNode();
- funcNode.kind = node.kind;
- funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
- funcNode.type = "FunctionExpression";
- delete funcNode.kind;
- node.value = funcNode;
- const {
- typeParameters
- } = node;
- if (typeParameters) {
- delete node.typeParameters;
- funcNode.typeParameters = typeParameters;
- this.resetStartLocationFromNode(funcNode, typeParameters);
- }
- if (type === "ClassPrivateMethod") {
- node.computed = false;
- }
- return this.finishNode(node, "MethodDefinition");
- }
- nameIsConstructor(key) {
- if (key.type === "Literal") return key.value === "constructor";
- return super.nameIsConstructor(key);
- }
- parseClassProperty(...args) {
- const propertyNode = super.parseClassProperty(...args);
- {
- if (!this.getPluginOption("estree", "classFeatures")) {
- return propertyNode;
- }
- }
- {
- propertyNode.type = "PropertyDefinition";
- }
- return propertyNode;
- }
- parseClassPrivateProperty(...args) {
- const propertyNode = super.parseClassPrivateProperty(...args);
- {
- if (!this.getPluginOption("estree", "classFeatures")) {
- return propertyNode;
+exports["default"] = createTemplateBuilder;
+var _options = __nccwpck_require__(4510);
+var _string = __nccwpck_require__(6674);
+var _literal = __nccwpck_require__(9479);
+const NO_PLACEHOLDER = (0, _options.validate)({
+ placeholderPattern: false
+});
+function createTemplateBuilder(formatter, defaultOpts) {
+ const templateFnCache = new WeakMap();
+ const templateAstCache = new WeakMap();
+ const cachedOpts = defaultOpts || (0, _options.validate)(null);
+ return Object.assign((tpl, ...args) => {
+ if (typeof tpl === "string") {
+ if (args.length > 1) throw new Error("Unexpected extra params.");
+ return extendedTrace((0, _string.default)(formatter, tpl, (0, _options.merge)(cachedOpts, (0, _options.validate)(args[0]))));
+ } else if (Array.isArray(tpl)) {
+ let builder = templateFnCache.get(tpl);
+ if (!builder) {
+ builder = (0, _literal.default)(formatter, tpl, cachedOpts);
+ templateFnCache.set(tpl, builder);
}
+ return extendedTrace(builder(args));
+ } else if (typeof tpl === "object" && tpl) {
+ if (args.length > 0) throw new Error("Unexpected extra params.");
+ return createTemplateBuilder(formatter, (0, _options.merge)(cachedOpts, (0, _options.validate)(tpl)));
}
- {
- propertyNode.type = "PropertyDefinition";
- }
- propertyNode.computed = false;
- return propertyNode;
- }
- parseClassAccessorProperty(node) {
- const accessorPropertyNode = super.parseClassAccessorProperty(node);
- {
- if (!this.getPluginOption("estree", "classFeatures")) {
- return accessorPropertyNode;
+ throw new Error(`Unexpected template param ${typeof tpl}`);
+ }, {
+ ast: (tpl, ...args) => {
+ if (typeof tpl === "string") {
+ if (args.length > 1) throw new Error("Unexpected extra params.");
+ return (0, _string.default)(formatter, tpl, (0, _options.merge)((0, _options.merge)(cachedOpts, (0, _options.validate)(args[0])), NO_PLACEHOLDER))();
+ } else if (Array.isArray(tpl)) {
+ let builder = templateAstCache.get(tpl);
+ if (!builder) {
+ builder = (0, _literal.default)(formatter, tpl, (0, _options.merge)(cachedOpts, NO_PLACEHOLDER));
+ templateAstCache.set(tpl, builder);
+ }
+ return builder(args)();
}
+ throw new Error(`Unexpected template param ${typeof tpl}`);
}
- accessorPropertyNode.type = "AccessorProperty";
- return accessorPropertyNode;
- }
- parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
- const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor);
- if (node) {
- node.type = "Property";
- if (node.kind === "method") {
- node.kind = "init";
- }
- node.shorthand = false;
+ });
+}
+function extendedTrace(fn) {
+ let rootStack = "";
+ try {
+ throw new Error();
+ } catch (error) {
+ if (error.stack) {
+ rootStack = error.stack.split("\n").slice(3).join("\n");
}
- return node;
}
- parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
- const node = super.parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors);
- if (node) {
- node.kind = "init";
- node.type = "Property";
+ return arg => {
+ try {
+ return fn(arg);
+ } catch (err) {
+ err.stack += `\n =============\n${rootStack}`;
+ throw err;
}
- return node;
- }
- isValidLVal(type, isUnparenthesizedInAssign, binding) {
- return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding);
- }
- isAssignable(node, isBinding) {
- if (node != null && this.isObjectProperty(node)) {
- return this.isAssignable(node.value, isBinding);
+ };
+}
+
+//# sourceMappingURL=builder.js.map
+
+
+/***/ }),
+
+/***/ 86:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.statements = exports.statement = exports.smart = exports.program = exports.expression = void 0;
+var _t = __nccwpck_require__(7912);
+const {
+ assertExpressionStatement
+} = _t;
+function makeStatementFormatter(fn) {
+ return {
+ code: str => `/* @babel/template */;\n${str}`,
+ validate: () => {},
+ unwrap: ast => {
+ return fn(ast.program.body.slice(1));
}
- return super.isAssignable(node, isBinding);
+ };
+}
+const smart = exports.smart = makeStatementFormatter(body => {
+ if (body.length > 1) {
+ return body;
+ } else {
+ return body[0];
}
- toAssignable(node, isLHS = false) {
- if (node != null && this.isObjectProperty(node)) {
- const {
- key,
- value
- } = node;
- if (this.isPrivateName(key)) {
- this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
- }
- this.toAssignable(value, isLHS);
- } else {
- super.toAssignable(node, isLHS);
- }
+});
+const statements = exports.statements = makeStatementFormatter(body => body);
+const statement = exports.statement = makeStatementFormatter(body => {
+ if (body.length === 0) {
+ throw new Error("Found nothing to return.");
}
- toAssignableObjectExpressionProp(prop, isLast, isLHS) {
- if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) {
- this.raise(Errors.PatternHasAccessor, prop.key);
- } else if (prop.type === "Property" && prop.method) {
- this.raise(Errors.PatternHasMethod, prop.key);
- } else {
- super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
- }
+ if (body.length > 1) {
+ throw new Error("Found multiple statements but wanted one");
}
- finishCallExpression(unfinished, optional) {
- const node = super.finishCallExpression(unfinished, optional);
- if (node.callee.type === "Import") {
- var _ref, _ref2;
- node.type = "ImportExpression";
- node.source = node.arguments[0];
- node.options = (_ref = node.arguments[1]) != null ? _ref : null;
- node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
- delete node.arguments;
- delete node.callee;
+ return body[0];
+});
+const expression = exports.expression = {
+ code: str => `(\n${str}\n)`,
+ validate: ast => {
+ if (ast.program.body.length > 1) {
+ throw new Error("Found multiple statements but wanted one");
}
- return node;
- }
- toReferencedArguments(node) {
- if (node.type === "ImportExpression") {
- return;
+ if (expression.unwrap(ast).start === 0) {
+ throw new Error("Parse result included parens.");
}
- super.toReferencedArguments(node);
+ },
+ unwrap: ({
+ program
+ }) => {
+ const [stmt] = program.body;
+ assertExpressionStatement(stmt);
+ return stmt.expression;
}
- parseExport(unfinished, decorators) {
- const exportStartLoc = this.state.lastTokStartLoc;
- const node = super.parseExport(unfinished, decorators);
- switch (node.type) {
- case "ExportAllDeclaration":
- node.exported = null;
- break;
- case "ExportNamedDeclaration":
- if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
- node.type = "ExportAllDeclaration";
- node.exported = node.specifiers[0].exported;
- delete node.specifiers;
- }
- case "ExportDefaultDeclaration":
- {
- var _declaration$decorato;
- const {
- declaration
- } = node;
- if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 && declaration.start === node.start) {
- this.resetStartLocation(node, exportStartLoc);
- }
- }
- break;
- }
- return node;
- }
- parseSubscript(base, startLoc, noCalls, state) {
- const node = super.parseSubscript(base, startLoc, noCalls, state);
- if (state.optionalChainMember) {
- if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
- node.type = node.type.substring(8);
- }
- if (state.stop) {
- const chain = this.startNodeAtNode(node);
- chain.expression = node;
- return this.finishNode(chain, "ChainExpression");
+};
+const program = exports.program = {
+ code: str => str,
+ validate: () => {},
+ unwrap: ast => ast.program
+};
+
+//# sourceMappingURL=formatters.js.map
+
+
+/***/ }),
+
+/***/ 3412:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.statements = exports.statement = exports.smart = exports.program = exports.expression = exports["default"] = void 0;
+var formatters = __nccwpck_require__(86);
+var _builder = __nccwpck_require__(613);
+const smart = exports.smart = (0, _builder.default)(formatters.smart);
+const statement = exports.statement = (0, _builder.default)(formatters.statement);
+const statements = exports.statements = (0, _builder.default)(formatters.statements);
+const expression = exports.expression = (0, _builder.default)(formatters.expression);
+const program = exports.program = (0, _builder.default)(formatters.program);
+var _default = exports["default"] = Object.assign(smart.bind(undefined), {
+ smart,
+ statement,
+ statements,
+ expression,
+ program,
+ ast: smart.ast
+});
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 9479:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = literalTemplate;
+var _options = __nccwpck_require__(4510);
+var _parse = __nccwpck_require__(7942);
+var _populate = __nccwpck_require__(3807);
+function literalTemplate(formatter, tpl, opts) {
+ const {
+ metadata,
+ names
+ } = buildLiteralData(formatter, tpl, opts);
+ return arg => {
+ const defaultReplacements = {};
+ arg.forEach((replacement, i) => {
+ defaultReplacements[names[i]] = replacement;
+ });
+ return arg => {
+ const replacements = (0, _options.normalizeReplacements)(arg);
+ if (replacements) {
+ Object.keys(replacements).forEach(key => {
+ if (hasOwnProperty.call(defaultReplacements, key)) {
+ throw new Error("Unexpected replacement overlap.");
+ }
+ });
}
- } else if (node.type === "MemberExpression" || node.type === "CallExpression") {
- node.optional = false;
- }
- return node;
- }
- isOptionalMemberExpression(node) {
- if (node.type === "ChainExpression") {
- return node.expression.type === "MemberExpression";
- }
- return super.isOptionalMemberExpression(node);
- }
- hasPropertyAsPrivateName(node) {
- if (node.type === "ChainExpression") {
- node = node.expression;
- }
- return super.hasPropertyAsPrivateName(node);
+ return formatter.unwrap((0, _populate.default)(metadata, replacements ? Object.assign(replacements, defaultReplacements) : defaultReplacements));
+ };
+ };
+}
+function buildLiteralData(formatter, tpl, opts) {
+ let prefix = "BABEL_TPL$";
+ const raw = tpl.join("");
+ do {
+ prefix = "$$" + prefix;
+ } while (raw.includes(prefix));
+ const {
+ names,
+ code
+ } = buildTemplateCode(tpl, prefix);
+ const metadata = (0, _parse.default)(formatter, formatter.code(code), {
+ parser: opts.parser,
+ placeholderWhitelist: new Set(names.concat(opts.placeholderWhitelist ? Array.from(opts.placeholderWhitelist) : [])),
+ placeholderPattern: opts.placeholderPattern,
+ preserveComments: opts.preserveComments,
+ syntacticPlaceholders: opts.syntacticPlaceholders
+ });
+ return {
+ metadata,
+ names
+ };
+}
+function buildTemplateCode(tpl, prefix) {
+ const names = [];
+ let code = tpl[0];
+ for (let i = 1; i < tpl.length; i++) {
+ const value = `${prefix}${i - 1}`;
+ names.push(value);
+ code += value + tpl[i];
}
- isObjectProperty(node) {
- return node.type === "Property" && node.kind === "init" && !node.method;
+ return {
+ names,
+ code
+ };
+}
+
+//# sourceMappingURL=literal.js.map
+
+
+/***/ }),
+
+/***/ 4510:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.merge = merge;
+exports.normalizeReplacements = normalizeReplacements;
+exports.validate = validate;
+const _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"];
+function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
+function merge(a, b) {
+ const {
+ placeholderWhitelist = a.placeholderWhitelist,
+ placeholderPattern = a.placeholderPattern,
+ preserveComments = a.preserveComments,
+ syntacticPlaceholders = a.syntacticPlaceholders
+ } = b;
+ return {
+ parser: Object.assign({}, a.parser, b.parser),
+ placeholderWhitelist,
+ placeholderPattern,
+ preserveComments,
+ syntacticPlaceholders
+ };
+}
+function validate(opts) {
+ if (opts != null && typeof opts !== "object") {
+ throw new Error("Unknown template options.");
}
- isObjectMethod(node) {
- return node.type === "Property" && (node.method || node.kind === "get" || node.kind === "set");
+ const _ref = opts || {},
+ {
+ placeholderWhitelist,
+ placeholderPattern,
+ preserveComments,
+ syntacticPlaceholders
+ } = _ref,
+ parser = _objectWithoutPropertiesLoose(_ref, _excluded);
+ if (placeholderWhitelist != null && !(placeholderWhitelist instanceof Set)) {
+ throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined");
}
- finishNodeAt(node, type, endLoc) {
- return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
+ if (placeholderPattern != null && !(placeholderPattern instanceof RegExp) && placeholderPattern !== false) {
+ throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined");
}
- resetStartLocation(node, startLoc) {
- super.resetStartLocation(node, startLoc);
- toESTreeLocation(node);
+ if (preserveComments != null && typeof preserveComments !== "boolean") {
+ throw new Error("'.preserveComments' must be a boolean, null, or undefined");
}
- resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
- super.resetEndLocation(node, endLoc);
- toESTreeLocation(node);
+ if (syntacticPlaceholders != null && typeof syntacticPlaceholders !== "boolean") {
+ throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined");
}
-};
-class TokContext {
- constructor(token, preserveSpace) {
- this.token = void 0;
- this.preserveSpace = void 0;
- this.token = token;
- this.preserveSpace = !!preserveSpace;
- }
-}
-const types = {
- brace: new TokContext("{"),
- j_oTag: new TokContext("...", true)
-};
-{
- types.template = new TokContext("`", true);
-}
-const beforeExpr = true;
-const startsExpr = true;
-const isLoop = true;
-const isAssign = true;
-const prefix = true;
-const postfix = true;
-class ExportedTokenType {
- constructor(label, conf = {}) {
- this.label = void 0;
- this.keyword = void 0;
- this.beforeExpr = void 0;
- this.startsExpr = void 0;
- this.rightAssociative = void 0;
- this.isLoop = void 0;
- this.isAssign = void 0;
- this.prefix = void 0;
- this.postfix = void 0;
- this.binop = void 0;
- this.label = label;
- this.keyword = conf.keyword;
- this.beforeExpr = !!conf.beforeExpr;
- this.startsExpr = !!conf.startsExpr;
- this.rightAssociative = !!conf.rightAssociative;
- this.isLoop = !!conf.isLoop;
- this.isAssign = !!conf.isAssign;
- this.prefix = !!conf.prefix;
- this.postfix = !!conf.postfix;
- this.binop = conf.binop != null ? conf.binop : null;
- {
- this.updateContext = null;
- }
+ if (syntacticPlaceholders === true && (placeholderWhitelist != null || placeholderPattern != null)) {
+ throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible" + " with '.syntacticPlaceholders: true'");
}
+ return {
+ parser,
+ placeholderWhitelist: placeholderWhitelist || undefined,
+ placeholderPattern: placeholderPattern == null ? undefined : placeholderPattern,
+ preserveComments: preserveComments == null ? undefined : preserveComments,
+ syntacticPlaceholders: syntacticPlaceholders == null ? undefined : syntacticPlaceholders
+ };
}
-const keywords$1 = new Map();
-function createKeyword(name, options = {}) {
- options.keyword = name;
- const token = createToken(name, options);
- keywords$1.set(name, token);
- return token;
+function normalizeReplacements(replacements) {
+ if (Array.isArray(replacements)) {
+ return replacements.reduce((acc, replacement, i) => {
+ acc["$" + i] = replacement;
+ return acc;
+ }, {});
+ } else if (typeof replacements === "object" || replacements == null) {
+ return replacements || undefined;
+ }
+ throw new Error("Template replacements must be an array, object, null, or undefined");
}
-function createBinop(name, binop) {
- return createToken(name, {
- beforeExpr,
- binop
+
+//# sourceMappingURL=options.js.map
+
+
+/***/ }),
+
+/***/ 7942:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = parseAndBuildMetadata;
+var _t = __nccwpck_require__(7912);
+var _parser = __nccwpck_require__(5026);
+var _codeFrame = __nccwpck_require__(1322);
+const {
+ isCallExpression,
+ isExpressionStatement,
+ isFunction,
+ isIdentifier,
+ isJSXIdentifier,
+ isNewExpression,
+ isPlaceholder,
+ isStatement,
+ isStringLiteral,
+ removePropertiesDeep,
+ traverse
+} = _t;
+const PATTERN = /^[_$A-Z0-9]+$/;
+function parseAndBuildMetadata(formatter, code, opts) {
+ const {
+ placeholderWhitelist,
+ placeholderPattern,
+ preserveComments,
+ syntacticPlaceholders
+ } = opts;
+ const ast = parseWithCodeFrame(code, opts.parser, syntacticPlaceholders);
+ removePropertiesDeep(ast, {
+ preserveComments
});
+ formatter.validate(ast);
+ const state = {
+ syntactic: {
+ placeholders: [],
+ placeholderNames: new Set()
+ },
+ legacy: {
+ placeholders: [],
+ placeholderNames: new Set()
+ },
+ placeholderWhitelist,
+ placeholderPattern,
+ syntacticPlaceholders
+ };
+ traverse(ast, placeholderVisitorHandler, state);
+ return Object.assign({
+ ast
+ }, state.syntactic.placeholders.length ? state.syntactic : state.legacy);
}
-let tokenTypeCounter = -1;
-const tokenTypes = [];
-const tokenLabels = [];
-const tokenBinops = [];
-const tokenBeforeExprs = [];
-const tokenStartsExprs = [];
-const tokenPrefixes = [];
-function createToken(name, options = {}) {
- var _options$binop, _options$beforeExpr, _options$startsExpr, _options$prefix;
- ++tokenTypeCounter;
- tokenLabels.push(name);
- tokenBinops.push((_options$binop = options.binop) != null ? _options$binop : -1);
- tokenBeforeExprs.push((_options$beforeExpr = options.beforeExpr) != null ? _options$beforeExpr : false);
- tokenStartsExprs.push((_options$startsExpr = options.startsExpr) != null ? _options$startsExpr : false);
- tokenPrefixes.push((_options$prefix = options.prefix) != null ? _options$prefix : false);
- tokenTypes.push(new ExportedTokenType(name, options));
- return tokenTypeCounter;
-}
-function createKeywordLike(name, options = {}) {
- var _options$binop2, _options$beforeExpr2, _options$startsExpr2, _options$prefix2;
- ++tokenTypeCounter;
- keywords$1.set(name, tokenTypeCounter);
- tokenLabels.push(name);
- tokenBinops.push((_options$binop2 = options.binop) != null ? _options$binop2 : -1);
- tokenBeforeExprs.push((_options$beforeExpr2 = options.beforeExpr) != null ? _options$beforeExpr2 : false);
- tokenStartsExprs.push((_options$startsExpr2 = options.startsExpr) != null ? _options$startsExpr2 : false);
- tokenPrefixes.push((_options$prefix2 = options.prefix) != null ? _options$prefix2 : false);
- tokenTypes.push(new ExportedTokenType("name", options));
- return tokenTypeCounter;
-}
-const tt = {
- bracketL: createToken("[", {
- beforeExpr,
- startsExpr
- }),
- bracketHashL: createToken("#[", {
- beforeExpr,
- startsExpr
- }),
- bracketBarL: createToken("[|", {
- beforeExpr,
- startsExpr
- }),
- bracketR: createToken("]"),
- bracketBarR: createToken("|]"),
- braceL: createToken("{", {
- beforeExpr,
- startsExpr
- }),
- braceBarL: createToken("{|", {
- beforeExpr,
- startsExpr
- }),
- braceHashL: createToken("#{", {
- beforeExpr,
- startsExpr
- }),
- braceR: createToken("}"),
- braceBarR: createToken("|}"),
- parenL: createToken("(", {
- beforeExpr,
- startsExpr
- }),
- parenR: createToken(")"),
- comma: createToken(",", {
- beforeExpr
- }),
- semi: createToken(";", {
- beforeExpr
- }),
- colon: createToken(":", {
- beforeExpr
- }),
- doubleColon: createToken("::", {
- beforeExpr
- }),
- dot: createToken("."),
- question: createToken("?", {
- beforeExpr
- }),
- questionDot: createToken("?."),
- arrow: createToken("=>", {
- beforeExpr
- }),
- template: createToken("template"),
- ellipsis: createToken("...", {
- beforeExpr
- }),
- backQuote: createToken("`", {
- startsExpr
- }),
- dollarBraceL: createToken("${", {
- beforeExpr,
- startsExpr
- }),
- templateTail: createToken("...`", {
- startsExpr
- }),
- templateNonTail: createToken("...${", {
- beforeExpr,
- startsExpr
- }),
- at: createToken("@"),
- hash: createToken("#", {
- startsExpr
- }),
- interpreterDirective: createToken("#!..."),
- eq: createToken("=", {
- beforeExpr,
- isAssign
- }),
- assign: createToken("_=", {
- beforeExpr,
- isAssign
- }),
- slashAssign: createToken("_=", {
- beforeExpr,
- isAssign
- }),
- xorAssign: createToken("_=", {
- beforeExpr,
- isAssign
- }),
- moduloAssign: createToken("_=", {
- beforeExpr,
- isAssign
- }),
- incDec: createToken("++/--", {
- prefix,
- postfix,
- startsExpr
- }),
- bang: createToken("!", {
- beforeExpr,
- prefix,
- startsExpr
- }),
- tilde: createToken("~", {
- beforeExpr,
- prefix,
- startsExpr
- }),
- doubleCaret: createToken("^^", {
- startsExpr
- }),
- doubleAt: createToken("@@", {
- startsExpr
- }),
- pipeline: createBinop("|>", 0),
- nullishCoalescing: createBinop("??", 1),
- logicalOR: createBinop("||", 1),
- logicalAND: createBinop("&&", 2),
- bitwiseOR: createBinop("|", 3),
- bitwiseXOR: createBinop("^", 4),
- bitwiseAND: createBinop("&", 5),
- equality: createBinop("==/!=/===/!==", 6),
- lt: createBinop(">/<=/>=", 7),
- gt: createBinop(">/<=/>=", 7),
- relational: createBinop(">/<=/>=", 7),
- bitShift: createBinop("<>>/>>>", 8),
- bitShiftL: createBinop("<>>/>>>", 8),
- bitShiftR: createBinop("<>>/>>>", 8),
- plusMin: createToken("+/-", {
- beforeExpr,
- binop: 9,
- prefix,
- startsExpr
- }),
- modulo: createToken("%", {
- binop: 10,
- startsExpr
- }),
- star: createToken("*", {
- binop: 10
- }),
- slash: createBinop("/", 10),
- exponent: createToken("**", {
- beforeExpr,
- binop: 11,
- rightAssociative: true
- }),
- _in: createKeyword("in", {
- beforeExpr,
- binop: 7
- }),
- _instanceof: createKeyword("instanceof", {
- beforeExpr,
- binop: 7
- }),
- _break: createKeyword("break"),
- _case: createKeyword("case", {
- beforeExpr
- }),
- _catch: createKeyword("catch"),
- _continue: createKeyword("continue"),
- _debugger: createKeyword("debugger"),
- _default: createKeyword("default", {
- beforeExpr
- }),
- _else: createKeyword("else", {
- beforeExpr
- }),
- _finally: createKeyword("finally"),
- _function: createKeyword("function", {
- startsExpr
- }),
- _if: createKeyword("if"),
- _return: createKeyword("return", {
- beforeExpr
- }),
- _switch: createKeyword("switch"),
- _throw: createKeyword("throw", {
- beforeExpr,
- prefix,
- startsExpr
- }),
- _try: createKeyword("try"),
- _var: createKeyword("var"),
- _const: createKeyword("const"),
- _with: createKeyword("with"),
- _new: createKeyword("new", {
- beforeExpr,
- startsExpr
- }),
- _this: createKeyword("this", {
- startsExpr
- }),
- _super: createKeyword("super", {
- startsExpr
- }),
- _class: createKeyword("class", {
- startsExpr
- }),
- _extends: createKeyword("extends", {
- beforeExpr
- }),
- _export: createKeyword("export"),
- _import: createKeyword("import", {
- startsExpr
- }),
- _null: createKeyword("null", {
- startsExpr
- }),
- _true: createKeyword("true", {
- startsExpr
- }),
- _false: createKeyword("false", {
- startsExpr
- }),
- _typeof: createKeyword("typeof", {
- beforeExpr,
- prefix,
- startsExpr
- }),
- _void: createKeyword("void", {
- beforeExpr,
- prefix,
- startsExpr
- }),
- _delete: createKeyword("delete", {
- beforeExpr,
- prefix,
- startsExpr
- }),
- _do: createKeyword("do", {
- isLoop,
- beforeExpr
- }),
- _for: createKeyword("for", {
- isLoop
- }),
- _while: createKeyword("while", {
- isLoop
- }),
- _as: createKeywordLike("as", {
- startsExpr
- }),
- _assert: createKeywordLike("assert", {
- startsExpr
- }),
- _async: createKeywordLike("async", {
- startsExpr
- }),
- _await: createKeywordLike("await", {
- startsExpr
- }),
- _defer: createKeywordLike("defer", {
- startsExpr
- }),
- _from: createKeywordLike("from", {
- startsExpr
- }),
- _get: createKeywordLike("get", {
- startsExpr
- }),
- _let: createKeywordLike("let", {
- startsExpr
- }),
- _meta: createKeywordLike("meta", {
- startsExpr
- }),
- _of: createKeywordLike("of", {
- startsExpr
- }),
- _sent: createKeywordLike("sent", {
- startsExpr
- }),
- _set: createKeywordLike("set", {
- startsExpr
- }),
- _source: createKeywordLike("source", {
- startsExpr
- }),
- _static: createKeywordLike("static", {
- startsExpr
- }),
- _using: createKeywordLike("using", {
- startsExpr
- }),
- _yield: createKeywordLike("yield", {
- startsExpr
- }),
- _asserts: createKeywordLike("asserts", {
- startsExpr
- }),
- _checks: createKeywordLike("checks", {
- startsExpr
- }),
- _exports: createKeywordLike("exports", {
- startsExpr
- }),
- _global: createKeywordLike("global", {
- startsExpr
- }),
- _implements: createKeywordLike("implements", {
- startsExpr
- }),
- _intrinsic: createKeywordLike("intrinsic", {
- startsExpr
- }),
- _infer: createKeywordLike("infer", {
- startsExpr
- }),
- _is: createKeywordLike("is", {
- startsExpr
- }),
- _mixins: createKeywordLike("mixins", {
- startsExpr
- }),
- _proto: createKeywordLike("proto", {
- startsExpr
- }),
- _require: createKeywordLike("require", {
- startsExpr
- }),
- _satisfies: createKeywordLike("satisfies", {
- startsExpr
- }),
- _keyof: createKeywordLike("keyof", {
- startsExpr
- }),
- _readonly: createKeywordLike("readonly", {
- startsExpr
- }),
- _unique: createKeywordLike("unique", {
- startsExpr
- }),
- _abstract: createKeywordLike("abstract", {
- startsExpr
- }),
- _declare: createKeywordLike("declare", {
- startsExpr
- }),
- _enum: createKeywordLike("enum", {
- startsExpr
- }),
- _module: createKeywordLike("module", {
- startsExpr
- }),
- _namespace: createKeywordLike("namespace", {
- startsExpr
- }),
- _interface: createKeywordLike("interface", {
- startsExpr
- }),
- _type: createKeywordLike("type", {
- startsExpr
- }),
- _opaque: createKeywordLike("opaque", {
- startsExpr
- }),
- name: createToken("name", {
- startsExpr
- }),
- placeholder: createToken("%%", {
- startsExpr: true
- }),
- string: createToken("string", {
- startsExpr
- }),
- num: createToken("num", {
- startsExpr
- }),
- bigint: createToken("bigint", {
- startsExpr
- }),
- decimal: createToken("decimal", {
- startsExpr
- }),
- regexp: createToken("regexp", {
- startsExpr
- }),
- privateName: createToken("#name", {
- startsExpr
- }),
- eof: createToken("eof"),
- jsxName: createToken("jsxName"),
- jsxText: createToken("jsxText", {
- beforeExpr: true
- }),
- jsxTagStart: createToken("jsxTagStart", {
- startsExpr: true
- }),
- jsxTagEnd: createToken("jsxTagEnd")
-};
-function tokenIsIdentifier(token) {
- return token >= 93 && token <= 133;
-}
-function tokenKeywordOrIdentifierIsKeyword(token) {
- return token <= 92;
-}
-function tokenIsKeywordOrIdentifier(token) {
- return token >= 58 && token <= 133;
-}
-function tokenIsLiteralPropertyName(token) {
- return token >= 58 && token <= 137;
-}
-function tokenComesBeforeExpression(token) {
- return tokenBeforeExprs[token];
-}
-function tokenCanStartExpression(token) {
- return tokenStartsExprs[token];
-}
-function tokenIsAssignment(token) {
- return token >= 29 && token <= 33;
-}
-function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
- return token >= 129 && token <= 131;
-}
-function tokenIsLoop(token) {
- return token >= 90 && token <= 92;
-}
-function tokenIsKeyword(token) {
- return token >= 58 && token <= 92;
-}
-function tokenIsOperator(token) {
- return token >= 39 && token <= 59;
-}
-function tokenIsPostfix(token) {
- return token === 34;
-}
-function tokenIsPrefix(token) {
- return tokenPrefixes[token];
-}
-function tokenIsTSTypeOperator(token) {
- return token >= 121 && token <= 123;
-}
-function tokenIsTSDeclarationStart(token) {
- return token >= 124 && token <= 130;
-}
-function tokenLabelName(token) {
- return tokenLabels[token];
-}
-function tokenOperatorPrecedence(token) {
- return tokenBinops[token];
-}
-function tokenIsRightAssociative(token) {
- return token === 57;
-}
-function tokenIsTemplate(token) {
- return token >= 24 && token <= 25;
-}
-function getExportedToken(token) {
- return tokenTypes[token];
+function placeholderVisitorHandler(node, ancestors, state) {
+ var _state$placeholderWhi;
+ let name;
+ let hasSyntacticPlaceholders = state.syntactic.placeholders.length > 0;
+ if (isPlaceholder(node)) {
+ if (state.syntacticPlaceholders === false) {
+ throw new Error("%%foo%%-style placeholders can't be used when " + "'.syntacticPlaceholders' is false.");
+ }
+ name = node.name.name;
+ hasSyntacticPlaceholders = true;
+ } else if (hasSyntacticPlaceholders || state.syntacticPlaceholders) {
+ return;
+ } else if (isIdentifier(node) || isJSXIdentifier(node)) {
+ name = node.name;
+ } else if (isStringLiteral(node)) {
+ name = node.value;
+ } else {
+ return;
+ }
+ if (hasSyntacticPlaceholders && (state.placeholderPattern != null || state.placeholderWhitelist != null)) {
+ throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible" + " with '.syntacticPlaceholders: true'");
+ }
+ if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !((_state$placeholderWhi = state.placeholderWhitelist) != null && _state$placeholderWhi.has(name))) {
+ return;
+ }
+ ancestors = ancestors.slice();
+ const {
+ node: parent,
+ key
+ } = ancestors[ancestors.length - 1];
+ let type;
+ if (isStringLiteral(node) || isPlaceholder(node, {
+ expectedNode: "StringLiteral"
+ })) {
+ type = "string";
+ } else if (isNewExpression(parent) && key === "arguments" || isCallExpression(parent) && key === "arguments" || isFunction(parent) && key === "params") {
+ type = "param";
+ } else if (isExpressionStatement(parent) && !isPlaceholder(node)) {
+ type = "statement";
+ ancestors = ancestors.slice(0, -1);
+ } else if (isStatement(node) && isPlaceholder(node)) {
+ type = "statement";
+ } else {
+ type = "other";
+ }
+ const {
+ placeholders,
+ placeholderNames
+ } = !hasSyntacticPlaceholders ? state.legacy : state.syntactic;
+ placeholders.push({
+ name,
+ type,
+ resolve: ast => resolveAncestors(ast, ancestors),
+ isDuplicate: placeholderNames.has(name)
+ });
+ placeholderNames.add(name);
}
-{
- tokenTypes[8].updateContext = context => {
- context.pop();
- };
- tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = context => {
- context.push(types.brace);
- };
- tokenTypes[22].updateContext = context => {
- if (context[context.length - 1] === types.template) {
- context.pop();
+function resolveAncestors(ast, ancestors) {
+ let parent = ast;
+ for (let i = 0; i < ancestors.length - 1; i++) {
+ const {
+ key,
+ index
+ } = ancestors[i];
+ if (index === undefined) {
+ parent = parent[key];
} else {
- context.push(types.template);
+ parent = parent[key][index];
}
- };
- tokenTypes[143].updateContext = context => {
- context.push(types.j_expr, types.j_oTag);
+ }
+ const {
+ key,
+ index
+ } = ancestors[ancestors.length - 1];
+ return {
+ parent,
+ key,
+ index
};
}
-let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
-let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
-const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
-const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
-nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
-const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
-const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
-function isInAstralSet(code, set) {
- let pos = 0x10000;
- for (let i = 0, length = set.length; i < length; i += 2) {
- pos += set[i];
- if (pos > code) return false;
- pos += set[i + 1];
- if (pos >= code) return true;
+function parseWithCodeFrame(code, parserOpts, syntacticPlaceholders) {
+ const plugins = (parserOpts.plugins || []).slice();
+ if (syntacticPlaceholders !== false) {
+ plugins.push("placeholders");
}
- return false;
-}
-function isIdentifierStart(code) {
- if (code < 65) return code === 36;
- if (code <= 90) return true;
- if (code < 97) return code === 95;
- if (code <= 122) return true;
- if (code <= 0xffff) {
- return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
- }
- return isInAstralSet(code, astralIdentifierStartCodes);
-}
-function isIdentifierChar(code) {
- if (code < 48) return code === 36;
- if (code < 58) return true;
- if (code < 65) return false;
- if (code <= 90) return true;
- if (code < 97) return code === 95;
- if (code <= 122) return true;
- if (code <= 0xffff) {
- return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
- }
- return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
-}
-const reservedWords = {
- keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
- strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
- strictBind: ["eval", "arguments"]
-};
-const keywords = new Set(reservedWords.keyword);
-const reservedWordsStrictSet = new Set(reservedWords.strict);
-const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
-function isReservedWord(word, inModule) {
- return inModule && word === "await" || word === "enum";
-}
-function isStrictReservedWord(word, inModule) {
- return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
-}
-function isStrictBindOnlyReservedWord(word) {
- return reservedWordsStrictBindSet.has(word);
-}
-function isStrictBindReservedWord(word, inModule) {
- return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
-}
-function isKeyword(word) {
- return keywords.has(word);
-}
-function isIteratorStart(current, next, next2) {
- return current === 64 && next === 64 && isIdentifierStart(next2);
-}
-const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
-function canBeReservedWord(word) {
- return reservedWordLikeSet.has(word);
-}
-class Scope {
- constructor(flags) {
- this.flags = 0;
- this.names = new Map();
- this.firstLexicalName = "";
- this.flags = flags;
+ parserOpts = Object.assign({
+ allowAwaitOutsideFunction: true,
+ allowReturnOutsideFunction: true,
+ allowNewTargetOutsideFunction: true,
+ allowSuperOutsideMethod: true,
+ allowYieldOutsideFunction: true,
+ sourceType: "module"
+ }, parserOpts, {
+ plugins
+ });
+ try {
+ return (0, _parser.parse)(code, parserOpts);
+ } catch (err) {
+ const loc = err.loc;
+ if (loc) {
+ err.message += "\n" + (0, _codeFrame.codeFrameColumns)(code, {
+ start: loc
+ });
+ err.code = "BABEL_TEMPLATE_PARSE_ERROR";
+ }
+ throw err;
}
}
-class ScopeHandler {
- constructor(parser, inModule) {
- this.parser = void 0;
- this.scopeStack = [];
- this.inModule = void 0;
- this.undefinedExports = new Map();
- this.parser = parser;
- this.inModule = inModule;
- }
- get inTopLevel() {
- return (this.currentScope().flags & 1) > 0;
- }
- get inFunction() {
- return (this.currentVarScopeFlags() & 2) > 0;
- }
- get allowSuper() {
- return (this.currentThisScopeFlags() & 16) > 0;
- }
- get allowDirectSuper() {
- return (this.currentThisScopeFlags() & 32) > 0;
- }
- get inClass() {
- return (this.currentThisScopeFlags() & 64) > 0;
- }
- get inClassAndNotInNonArrowFunction() {
- const flags = this.currentThisScopeFlags();
- return (flags & 64) > 0 && (flags & 2) === 0;
- }
- get inStaticBlock() {
- for (let i = this.scopeStack.length - 1;; i--) {
- const {
- flags
- } = this.scopeStack[i];
- if (flags & 128) {
- return true;
- }
- if (flags & (387 | 64)) {
- return false;
- }
- }
- }
- get inNonArrowFunction() {
- return (this.currentThisScopeFlags() & 2) > 0;
- }
- get treatFunctionsAsVar() {
- return this.treatFunctionsAsVarInScope(this.currentScope());
- }
- createScope(flags) {
- return new Scope(flags);
- }
- enter(flags) {
- this.scopeStack.push(this.createScope(flags));
- }
- exit() {
- const scope = this.scopeStack.pop();
- return scope.flags;
- }
- treatFunctionsAsVarInScope(scope) {
- return !!(scope.flags & (2 | 128) || !this.parser.inModule && scope.flags & 1);
- }
- declareName(name, bindingType, loc) {
- let scope = this.currentScope();
- if (bindingType & 8 || bindingType & 16) {
- this.checkRedeclarationInScope(scope, name, bindingType, loc);
- let type = scope.names.get(name) || 0;
- if (bindingType & 16) {
- type = type | 4;
- } else {
- if (!scope.firstLexicalName) {
- scope.firstLexicalName = name;
- }
- type = type | 2;
- }
- scope.names.set(name, type);
- if (bindingType & 8) {
- this.maybeExportDefined(scope, name);
+
+//# sourceMappingURL=parse.js.map
+
+
+/***/ }),
+
+/***/ 3807:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = populatePlaceholders;
+var _t = __nccwpck_require__(7912);
+const {
+ blockStatement,
+ cloneNode,
+ emptyStatement,
+ expressionStatement,
+ identifier,
+ isStatement,
+ isStringLiteral,
+ stringLiteral,
+ validate
+} = _t;
+function populatePlaceholders(metadata, replacements) {
+ const ast = cloneNode(metadata.ast);
+ if (replacements) {
+ metadata.placeholders.forEach(placeholder => {
+ if (!hasOwnProperty.call(replacements, placeholder.name)) {
+ const placeholderName = placeholder.name;
+ throw new Error(`Error: No substitution given for "${placeholderName}". If this is not meant to be a
+ placeholder you may want to consider passing one of the following options to @babel/template:
+ - { placeholderPattern: false, placeholderWhitelist: new Set(['${placeholderName}'])}
+ - { placeholderPattern: /^${placeholderName}$/ }`);
}
- } else if (bindingType & 4) {
- for (let i = this.scopeStack.length - 1; i >= 0; --i) {
- scope = this.scopeStack[i];
- this.checkRedeclarationInScope(scope, name, bindingType, loc);
- scope.names.set(name, (scope.names.get(name) || 0) | 1);
- this.maybeExportDefined(scope, name);
- if (scope.flags & 387) break;
+ });
+ Object.keys(replacements).forEach(key => {
+ if (!metadata.placeholderNames.has(key)) {
+ throw new Error(`Unknown substitution "${key}" given`);
}
- }
- if (this.parser.inModule && scope.flags & 1) {
- this.undefinedExports.delete(name);
- }
+ });
}
- maybeExportDefined(scope, name) {
- if (this.parser.inModule && scope.flags & 1) {
- this.undefinedExports.delete(name);
+ metadata.placeholders.slice().reverse().forEach(placeholder => {
+ try {
+ applyReplacement(placeholder, ast, replacements && replacements[placeholder.name] || null);
+ } catch (e) {
+ e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`;
+ throw e;
}
- }
- checkRedeclarationInScope(scope, name, bindingType, loc) {
- if (this.isRedeclaredInScope(scope, name, bindingType)) {
- this.parser.raise(Errors.VarRedeclaration, loc, {
- identifierName: name
- });
+ });
+ return ast;
+}
+function applyReplacement(placeholder, ast, replacement) {
+ if (placeholder.isDuplicate) {
+ if (Array.isArray(replacement)) {
+ replacement = replacement.map(node => cloneNode(node));
+ } else if (typeof replacement === "object") {
+ replacement = cloneNode(replacement);
}
}
- isRedeclaredInScope(scope, name, bindingType) {
- if (!(bindingType & 1)) return false;
- if (bindingType & 8) {
- return scope.names.has(name);
- }
- const type = scope.names.get(name);
- if (bindingType & 16) {
- return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
+ const {
+ parent,
+ key,
+ index
+ } = placeholder.resolve(ast);
+ if (placeholder.type === "string") {
+ if (typeof replacement === "string") {
+ replacement = stringLiteral(replacement);
}
- return (type & 2) > 0 && !(scope.flags & 8 && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & 4) > 0;
- }
- checkLocalExport(id) {
- const {
- name
- } = id;
- const topLevelScope = this.scopeStack[0];
- if (!topLevelScope.names.has(name)) {
- this.undefinedExports.set(name, id.loc.start);
+ if (!replacement || !isStringLiteral(replacement)) {
+ throw new Error("Expected string substitution");
}
- }
- currentScope() {
- return this.scopeStack[this.scopeStack.length - 1];
- }
- currentVarScopeFlags() {
- for (let i = this.scopeStack.length - 1;; i--) {
- const {
- flags
- } = this.scopeStack[i];
- if (flags & 387) {
- return flags;
+ } else if (placeholder.type === "statement") {
+ if (index === undefined) {
+ if (!replacement) {
+ replacement = emptyStatement();
+ } else if (Array.isArray(replacement)) {
+ replacement = blockStatement(replacement);
+ } else if (typeof replacement === "string") {
+ replacement = expressionStatement(identifier(replacement));
+ } else if (!isStatement(replacement)) {
+ replacement = expressionStatement(replacement);
}
- }
- }
- currentThisScopeFlags() {
- for (let i = this.scopeStack.length - 1;; i--) {
- const {
- flags
- } = this.scopeStack[i];
- if (flags & (387 | 64) && !(flags & 4)) {
- return flags;
+ } else {
+ if (replacement && !Array.isArray(replacement)) {
+ if (typeof replacement === "string") {
+ replacement = identifier(replacement);
+ }
+ if (!isStatement(replacement)) {
+ replacement = expressionStatement(replacement);
+ }
}
}
- }
-}
-class FlowScope extends Scope {
- constructor(...args) {
- super(...args);
- this.declareFunctions = new Set();
- }
-}
-class FlowScopeHandler extends ScopeHandler {
- createScope(flags) {
- return new FlowScope(flags);
- }
- declareName(name, bindingType, loc) {
- const scope = this.currentScope();
- if (bindingType & 2048) {
- this.checkRedeclarationInScope(scope, name, bindingType, loc);
- this.maybeExportDefined(scope, name);
- scope.declareFunctions.add(name);
- return;
+ } else if (placeholder.type === "param") {
+ if (typeof replacement === "string") {
+ replacement = identifier(replacement);
}
- super.declareName(name, bindingType, loc);
- }
- isRedeclaredInScope(scope, name, bindingType) {
- if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
- if (bindingType & 2048 && !scope.declareFunctions.has(name)) {
- const type = scope.names.get(name);
- return (type & 4) > 0 || (type & 2) > 0;
+ if (index === undefined) throw new Error("Assertion failure.");
+ } else {
+ if (typeof replacement === "string") {
+ replacement = identifier(replacement);
}
- return false;
- }
- checkLocalExport(id) {
- if (!this.scopeStack[0].declareFunctions.has(id.name)) {
- super.checkLocalExport(id);
+ if (Array.isArray(replacement)) {
+ throw new Error("Cannot replace single expression with an array.");
}
}
-}
-class BaseParser {
- constructor() {
- this.sawUnambiguousESM = false;
- this.ambiguousScriptDifferentAst = false;
- }
- sourceToOffsetPos(sourcePos) {
- return sourcePos + this.startIndex;
- }
- offsetToSourcePos(offsetPos) {
- return offsetPos - this.startIndex;
- }
- hasPlugin(pluginConfig) {
- if (typeof pluginConfig === "string") {
- return this.plugins.has(pluginConfig);
- } else {
- const [pluginName, pluginOptions] = pluginConfig;
- if (!this.hasPlugin(pluginName)) {
- return false;
+ function set(parent, key, value) {
+ const node = parent[key];
+ parent[key] = value;
+ if (node.type === "Identifier" || node.type === "Placeholder") {
+ if (node.typeAnnotation) {
+ value.typeAnnotation = node.typeAnnotation;
}
- const actualOptions = this.plugins.get(pluginName);
- for (const key of Object.keys(pluginOptions)) {
- if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
- return false;
- }
+ if (node.optional) {
+ value.optional = node.optional;
+ }
+ if (node.decorators) {
+ value.decorators = node.decorators;
}
- return true;
}
}
- getPluginOption(plugin, name) {
- var _this$plugins$get;
- return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
- }
-}
-function setTrailingComments(node, comments) {
- if (node.trailingComments === undefined) {
- node.trailingComments = comments;
- } else {
- node.trailingComments.unshift(...comments);
- }
-}
-function setLeadingComments(node, comments) {
- if (node.leadingComments === undefined) {
- node.leadingComments = comments;
- } else {
- node.leadingComments.unshift(...comments);
- }
-}
-function setInnerComments(node, comments) {
- if (node.innerComments === undefined) {
- node.innerComments = comments;
- } else {
- node.innerComments.unshift(...comments);
- }
-}
-function adjustInnerComments(node, elements, commentWS) {
- let lastElement = null;
- let i = elements.length;
- while (lastElement === null && i > 0) {
- lastElement = elements[--i];
- }
- if (lastElement === null || lastElement.start > commentWS.start) {
- setInnerComments(node, commentWS.comments);
+ if (index === undefined) {
+ validate(parent, key, replacement);
+ set(parent, key, replacement);
} else {
- setTrailingComments(lastElement, commentWS.comments);
- }
-}
-class CommentsParser extends BaseParser {
- addComment(comment) {
- if (this.filename) comment.loc.filename = this.filename;
- const {
- commentsLen
- } = this.state;
- if (this.comments.length !== commentsLen) {
- this.comments.length = commentsLen;
- }
- this.comments.push(comment);
- this.state.commentsLen++;
- }
- processComment(node) {
- const {
- commentStack
- } = this.state;
- const commentStackLength = commentStack.length;
- if (commentStackLength === 0) return;
- let i = commentStackLength - 1;
- const lastCommentWS = commentStack[i];
- if (lastCommentWS.start === node.end) {
- lastCommentWS.leadingNode = node;
- i--;
- }
- const {
- start: nodeStart
- } = node;
- for (; i >= 0; i--) {
- const commentWS = commentStack[i];
- const commentEnd = commentWS.end;
- if (commentEnd > nodeStart) {
- commentWS.containingNode = node;
- this.finalizeComment(commentWS);
- commentStack.splice(i, 1);
+ const items = parent[key].slice();
+ if (placeholder.type === "statement" || placeholder.type === "param") {
+ if (replacement == null) {
+ items.splice(index, 1);
+ } else if (Array.isArray(replacement)) {
+ items.splice(index, 1, ...replacement);
} else {
- if (commentEnd === nodeStart) {
- commentWS.trailingNode = node;
- }
- break;
- }
- }
- }
- finalizeComment(commentWS) {
- const {
- comments
- } = commentWS;
- if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) {
- if (commentWS.leadingNode !== null) {
- setTrailingComments(commentWS.leadingNode, comments);
- }
- if (commentWS.trailingNode !== null) {
- setLeadingComments(commentWS.trailingNode, comments);
+ set(items, index, replacement);
}
} else {
- const {
- containingNode: node,
- start: commentStart
- } = commentWS;
- if (this.input.charCodeAt(this.offsetToSourcePos(commentStart) - 1) === 44) {
- switch (node.type) {
- case "ObjectExpression":
- case "ObjectPattern":
- case "RecordExpression":
- adjustInnerComments(node, node.properties, commentWS);
- break;
- case "CallExpression":
- case "OptionalCallExpression":
- adjustInnerComments(node, node.arguments, commentWS);
- break;
- case "FunctionDeclaration":
- case "FunctionExpression":
- case "ArrowFunctionExpression":
- case "ObjectMethod":
- case "ClassMethod":
- case "ClassPrivateMethod":
- adjustInnerComments(node, node.params, commentWS);
- break;
- case "ArrayExpression":
- case "ArrayPattern":
- case "TupleExpression":
- adjustInnerComments(node, node.elements, commentWS);
- break;
- case "ExportNamedDeclaration":
- case "ImportDeclaration":
- adjustInnerComments(node, node.specifiers, commentWS);
- break;
- case "TSEnumDeclaration":
- {
- adjustInnerComments(node, node.members, commentWS);
- }
- break;
- case "TSEnumBody":
- adjustInnerComments(node, node.members, commentWS);
- break;
- default:
- {
- setInnerComments(node, comments);
- }
- }
- } else {
- setInnerComments(node, comments);
- }
- }
- }
- finalizeRemainingComments() {
- const {
- commentStack
- } = this.state;
- for (let i = commentStack.length - 1; i >= 0; i--) {
- this.finalizeComment(commentStack[i]);
- }
- this.state.commentStack = [];
- }
- resetPreviousNodeTrailingComments(node) {
- const {
- commentStack
- } = this.state;
- const {
- length
- } = commentStack;
- if (length === 0) return;
- const commentWS = commentStack[length - 1];
- if (commentWS.leadingNode === node) {
- commentWS.leadingNode = null;
- }
- }
- resetPreviousIdentifierLeadingComments(node) {
- const {
- commentStack
- } = this.state;
- const {
- length
- } = commentStack;
- if (length === 0) return;
- if (commentStack[length - 1].trailingNode === node) {
- commentStack[length - 1].trailingNode = null;
- } else if (length >= 2 && commentStack[length - 2].trailingNode === node) {
- commentStack[length - 2].trailingNode = null;
- }
- }
- takeSurroundingComments(node, start, end) {
- const {
- commentStack
- } = this.state;
- const commentStackLength = commentStack.length;
- if (commentStackLength === 0) return;
- let i = commentStackLength - 1;
- for (; i >= 0; i--) {
- const commentWS = commentStack[i];
- const commentEnd = commentWS.end;
- const commentStart = commentWS.start;
- if (commentStart === end) {
- commentWS.leadingNode = node;
- } else if (commentEnd === start) {
- commentWS.trailingNode = node;
- } else if (commentEnd < start) {
- break;
- }
+ set(items, index, replacement);
}
+ validate(parent, key, items);
+ parent[key] = items;
}
}
-const lineBreak = /\r\n|[\r\n\u2028\u2029]/;
-const lineBreakG = new RegExp(lineBreak.source, "g");
-function isNewLine(code) {
- switch (code) {
- case 10:
- case 13:
- case 8232:
- case 8233:
- return true;
- default:
- return false;
- }
+
+//# sourceMappingURL=populate.js.map
+
+
+/***/ }),
+
+/***/ 6674:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = stringTemplate;
+var _options = __nccwpck_require__(4510);
+var _parse = __nccwpck_require__(7942);
+var _populate = __nccwpck_require__(3807);
+function stringTemplate(formatter, code, opts) {
+ code = formatter.code(code);
+ let metadata;
+ return arg => {
+ const replacements = (0, _options.normalizeReplacements)(arg);
+ if (!metadata) metadata = (0, _parse.default)(formatter, code, opts);
+ return formatter.unwrap((0, _populate.default)(metadata, replacements));
+ };
}
-function hasNewLine(input, start, end) {
- for (let i = start; i < end; i++) {
- if (isNewLine(input.charCodeAt(i))) {
- return true;
- }
- }
- return false;
+
+//# sourceMappingURL=string.js.map
+
+
+/***/ }),
+
+/***/ 5069:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.clear = clear;
+exports.clearPath = clearPath;
+exports.clearScope = clearScope;
+exports.getCachedPaths = getCachedPaths;
+exports.getOrCreateCachedPaths = getOrCreateCachedPaths;
+exports.scope = exports.path = void 0;
+let pathsCache = new WeakMap();
+exports.path = pathsCache;
+let scope = new WeakMap();
+exports.scope = scope;
+function clear() {
+ clearPath();
+ clearScope();
}
-const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
-const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
-function isWhitespace(code) {
- switch (code) {
- case 0x0009:
- case 0x000b:
- case 0x000c:
- case 32:
- case 160:
- case 5760:
- case 0x2000:
- case 0x2001:
- case 0x2002:
- case 0x2003:
- case 0x2004:
- case 0x2005:
- case 0x2006:
- case 0x2007:
- case 0x2008:
- case 0x2009:
- case 0x200a:
- case 0x202f:
- case 0x205f:
- case 0x3000:
- case 0xfeff:
- return true;
- default:
- return false;
- }
+function clearPath() {
+ exports.path = pathsCache = new WeakMap();
}
-class State {
- constructor() {
- this.flags = 1024;
- this.startIndex = void 0;
- this.curLine = void 0;
- this.lineStart = void 0;
- this.startLoc = void 0;
- this.endLoc = void 0;
- this.errors = [];
- this.potentialArrowAt = -1;
- this.noArrowAt = [];
- this.noArrowParamsConversionAt = [];
- this.topicContext = {
- maxNumOfResolvableTopics: 0,
- maxTopicIndex: null
- };
- this.labels = [];
- this.commentsLen = 0;
- this.commentStack = [];
- this.pos = 0;
- this.type = 140;
- this.value = null;
- this.start = 0;
- this.end = 0;
- this.lastTokEndLoc = null;
- this.lastTokStartLoc = null;
- this.context = [types.brace];
- this.firstInvalidTemplateEscapePos = null;
- this.strictErrors = new Map();
- this.tokensLength = 0;
- }
- get strict() {
- return (this.flags & 1) > 0;
- }
- set strict(v) {
- if (v) this.flags |= 1;else this.flags &= -2;
- }
- init({
- strictMode,
- sourceType,
- startIndex,
- startLine,
- startColumn
- }) {
- this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
- this.startIndex = startIndex;
- this.curLine = startLine;
- this.lineStart = -startColumn;
- this.startLoc = this.endLoc = new Position(startLine, startColumn, startIndex);
- }
- get maybeInArrowParameters() {
- return (this.flags & 2) > 0;
- }
- set maybeInArrowParameters(v) {
- if (v) this.flags |= 2;else this.flags &= -3;
- }
- get inType() {
- return (this.flags & 4) > 0;
- }
- set inType(v) {
- if (v) this.flags |= 4;else this.flags &= -5;
- }
- get noAnonFunctionType() {
- return (this.flags & 8) > 0;
- }
- set noAnonFunctionType(v) {
- if (v) this.flags |= 8;else this.flags &= -9;
+function clearScope() {
+ exports.scope = scope = new WeakMap();
+}
+const nullHub = Object.freeze({});
+function getCachedPaths(hub, parent) {
+ var _pathsCache$get, _hub;
+ {
+ hub = null;
}
- get hasFlowComment() {
- return (this.flags & 16) > 0;
+ return (_pathsCache$get = pathsCache.get((_hub = hub) != null ? _hub : nullHub)) == null ? void 0 : _pathsCache$get.get(parent);
+}
+function getOrCreateCachedPaths(hub, parent) {
+ var _hub2, _hub3;
+ {
+ hub = null;
}
- set hasFlowComment(v) {
- if (v) this.flags |= 16;else this.flags &= -17;
+ let parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub);
+ if (!parents) pathsCache.set((_hub3 = hub) != null ? _hub3 : nullHub, parents = new WeakMap());
+ let paths = parents.get(parent);
+ if (!paths) parents.set(parent, paths = new Map());
+ return paths;
+}
+
+//# sourceMappingURL=cache.js.map
+
+
+/***/ }),
+
+/***/ 9089:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+var _index = __nccwpck_require__(8877);
+var _t = __nccwpck_require__(7912);
+const {
+ VISITOR_KEYS
+} = _t;
+class TraversalContext {
+ constructor(scope, opts, state, parentPath) {
+ this.queue = null;
+ this.priorityQueue = null;
+ this.parentPath = parentPath;
+ this.scope = scope;
+ this.state = state;
+ this.opts = opts;
}
- get isAmbientContext() {
- return (this.flags & 32) > 0;
+ shouldVisit(node) {
+ const opts = this.opts;
+ if (opts.enter || opts.exit) return true;
+ if (opts[node.type]) return true;
+ const keys = VISITOR_KEYS[node.type];
+ if (!(keys != null && keys.length)) return false;
+ for (const key of keys) {
+ if (node[key]) {
+ return true;
+ }
+ }
+ return false;
}
- set isAmbientContext(v) {
- if (v) this.flags |= 32;else this.flags &= -33;
+ create(node, container, key, listKey) {
+ return _index.default.get({
+ parentPath: this.parentPath,
+ parent: node,
+ container,
+ key: key,
+ listKey
+ });
}
- get inAbstractClass() {
- return (this.flags & 64) > 0;
+ maybeQueue(path, notPriority) {
+ if (this.queue) {
+ if (notPriority) {
+ this.queue.push(path);
+ } else {
+ this.priorityQueue.push(path);
+ }
+ }
}
- set inAbstractClass(v) {
- if (v) this.flags |= 64;else this.flags &= -65;
+ visitMultiple(container, parent, listKey) {
+ if (container.length === 0) return false;
+ const queue = [];
+ for (let key = 0; key < container.length; key++) {
+ const node = container[key];
+ if (node && this.shouldVisit(node)) {
+ queue.push(this.create(parent, container, key, listKey));
+ }
+ }
+ return this.visitQueue(queue);
}
- get inDisallowConditionalTypesContext() {
- return (this.flags & 128) > 0;
+ visitSingle(node, key) {
+ if (this.shouldVisit(node[key])) {
+ return this.visitQueue([this.create(node, node, key)]);
+ } else {
+ return false;
+ }
}
- set inDisallowConditionalTypesContext(v) {
- if (v) this.flags |= 128;else this.flags &= -129;
+ visitQueue(queue) {
+ this.queue = queue;
+ this.priorityQueue = [];
+ const visited = new WeakSet();
+ let stop = false;
+ for (const path of queue) {
+ path.resync();
+ if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
+ path.pushContext(this);
+ }
+ if (path.key === null) continue;
+ const {
+ node
+ } = path;
+ if (visited.has(node)) continue;
+ if (node) visited.add(node);
+ if (path.visit()) {
+ stop = true;
+ break;
+ }
+ if (this.priorityQueue.length) {
+ stop = this.visitQueue(this.priorityQueue);
+ this.priorityQueue = [];
+ this.queue = queue;
+ if (stop) break;
+ }
+ }
+ for (const path of queue) {
+ path.popContext();
+ }
+ this.queue = null;
+ return stop;
}
- get soloAwait() {
- return (this.flags & 256) > 0;
+ visit(node, key) {
+ const nodes = node[key];
+ if (!nodes) return false;
+ if (Array.isArray(nodes)) {
+ return this.visitMultiple(nodes, node, key);
+ } else {
+ return this.visitSingle(node, key);
+ }
}
- set soloAwait(v) {
- if (v) this.flags |= 256;else this.flags &= -257;
+}
+exports["default"] = TraversalContext;
+
+//# sourceMappingURL=context.js.map
+
+
+/***/ }),
+
+/***/ 9817:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+class Hub {
+ getCode() {}
+ getScope() {}
+ addHelper() {
+ throw new Error("Helpers are not supported by the default hub.");
}
- get inFSharpPipelineDirectBody() {
- return (this.flags & 512) > 0;
+ buildError(node, msg, Error = TypeError) {
+ return new Error(msg);
}
- set inFSharpPipelineDirectBody(v) {
- if (v) this.flags |= 512;else this.flags &= -513;
- }
- get canStartJSXElement() {
- return (this.flags & 1024) > 0;
- }
- set canStartJSXElement(v) {
- if (v) this.flags |= 1024;else this.flags &= -1025;
- }
- get containsEsc() {
- return (this.flags & 2048) > 0;
+}
+exports["default"] = Hub;
+
+//# sourceMappingURL=hub.js.map
+
+
+/***/ }),
+
+/***/ 1380:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+Object.defineProperty(exports, "Hub", ({
+ enumerable: true,
+ get: function () {
+ return _hub.default;
}
- set containsEsc(v) {
- if (v) this.flags |= 2048;else this.flags &= -2049;
+}));
+Object.defineProperty(exports, "NodePath", ({
+ enumerable: true,
+ get: function () {
+ return _index.default;
}
- get hasTopLevelAwait() {
- return (this.flags & 4096) > 0;
+}));
+Object.defineProperty(exports, "Scope", ({
+ enumerable: true,
+ get: function () {
+ return _index2.default;
}
- set hasTopLevelAwait(v) {
- if (v) this.flags |= 4096;else this.flags &= -4097;
+}));
+exports.visitors = exports["default"] = void 0;
+var visitors = __nccwpck_require__(3494);
+exports.visitors = visitors;
+var _t = __nccwpck_require__(7912);
+var cache = __nccwpck_require__(5069);
+var _traverseNode = __nccwpck_require__(1250);
+var _index = __nccwpck_require__(8877);
+var _index2 = __nccwpck_require__(891);
+var _hub = __nccwpck_require__(9817);
+const {
+ VISITOR_KEYS,
+ removeProperties,
+ traverseFast
+} = _t;
+function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) {
+ if (!parent) return;
+ if (!opts.noScope && !scope) {
+ if (parent.type !== "Program" && parent.type !== "File") {
+ throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");
+ }
}
- curPosition() {
- return new Position(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
+ if (!parentPath && visitSelf) {
+ throw new Error("visitSelf can only be used when providing a NodePath.");
}
- clone() {
- const state = new State();
- state.flags = this.flags;
- state.startIndex = this.startIndex;
- state.curLine = this.curLine;
- state.lineStart = this.lineStart;
- state.startLoc = this.startLoc;
- state.endLoc = this.endLoc;
- state.errors = this.errors.slice();
- state.potentialArrowAt = this.potentialArrowAt;
- state.noArrowAt = this.noArrowAt.slice();
- state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
- state.topicContext = this.topicContext;
- state.labels = this.labels.slice();
- state.commentsLen = this.commentsLen;
- state.commentStack = this.commentStack.slice();
- state.pos = this.pos;
- state.type = this.type;
- state.value = this.value;
- state.start = this.start;
- state.end = this.end;
- state.lastTokEndLoc = this.lastTokEndLoc;
- state.lastTokStartLoc = this.lastTokStartLoc;
- state.context = this.context.slice();
- state.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos;
- state.strictErrors = this.strictErrors;
- state.tokensLength = this.tokensLength;
- return state;
+ if (!VISITOR_KEYS[parent.type]) {
+ return;
}
+ visitors.explode(opts);
+ (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, null, visitSelf);
}
-var _isDigit = function isDigit(code) {
- return code >= 48 && code <= 57;
+var _default = traverse;
+exports["default"] = _default;
+traverse.visitors = visitors;
+traverse.verify = visitors.verify;
+traverse.explode = visitors.explode;
+traverse.cheap = function (node, enter) {
+ traverseFast(node, enter);
+ return;
};
-const forbiddenNumericSeparatorSiblings = {
- decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
- hex: new Set([46, 88, 95, 120])
+traverse.node = function (node, opts, scope, state, path, skipKeys) {
+ (0, _traverseNode.traverseNode)(node, opts, scope, state, path, skipKeys);
};
-const isAllowedNumericSeparatorSibling = {
- bin: ch => ch === 48 || ch === 49,
- oct: ch => ch >= 48 && ch <= 55,
- dec: ch => ch >= 48 && ch <= 57,
- hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
+traverse.clearNode = function (node, opts) {
+ removeProperties(node, opts);
};
-function readStringContents(type, input, pos, lineStart, curLine, errors) {
- const initialPos = pos;
- const initialLineStart = lineStart;
- const initialCurLine = curLine;
- let out = "";
- let firstInvalidLoc = null;
- let chunkStart = pos;
- const {
- length
- } = input;
- for (;;) {
- if (pos >= length) {
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
- out += input.slice(chunkStart, pos);
- break;
- }
- const ch = input.charCodeAt(pos);
- if (isStringEnd(type, ch, input, pos)) {
- out += input.slice(chunkStart, pos);
+traverse.removeProperties = function (tree, opts) {
+ traverseFast(tree, traverse.clearNode, opts);
+ return tree;
+};
+function hasDenylistedType(path, state) {
+ if (path.node.type === state.type) {
+ state.has = true;
+ path.stop();
+ }
+}
+traverse.hasType = function (tree, type, denylistTypes) {
+ if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
+ if (tree.type === type) return true;
+ const state = {
+ has: false,
+ type: type
+ };
+ traverse(tree, {
+ noScope: true,
+ denylist: denylistTypes,
+ enter: hasDenylistedType
+ }, null, state);
+ return state.has;
+};
+traverse.cache = cache;
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 6411:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.find = find;
+exports.findParent = findParent;
+exports.getAncestry = getAncestry;
+exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom;
+exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom;
+exports.getFunctionParent = getFunctionParent;
+exports.getStatementParent = getStatementParent;
+exports.inType = inType;
+exports.isAncestor = isAncestor;
+exports.isDescendant = isDescendant;
+var _t = __nccwpck_require__(7912);
+const {
+ VISITOR_KEYS
+} = _t;
+function findParent(callback) {
+ let path = this;
+ while (path = path.parentPath) {
+ if (callback(path)) return path;
+ }
+ return null;
+}
+function find(callback) {
+ let path = this;
+ do {
+ if (callback(path)) return path;
+ } while (path = path.parentPath);
+ return null;
+}
+function getFunctionParent() {
+ return this.findParent(p => p.isFunction());
+}
+function getStatementParent() {
+ let path = this;
+ do {
+ if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
break;
+ } else {
+ path = path.parentPath;
}
- if (ch === 92) {
- out += input.slice(chunkStart, pos);
- const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
- if (res.ch === null && !firstInvalidLoc) {
- firstInvalidLoc = {
- pos,
- lineStart,
- curLine
- };
- } else {
- out += res.ch;
+ } while (path);
+ if (path && (path.isProgram() || path.isFile())) {
+ throw new Error("File/Program node, we can't possibly find a statement parent to this");
+ }
+ return path;
+}
+function getEarliestCommonAncestorFrom(paths) {
+ return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
+ let earliest;
+ const keys = VISITOR_KEYS[deepest.type];
+ for (const ancestry of ancestries) {
+ const path = ancestry[i + 1];
+ if (!earliest) {
+ earliest = path;
+ continue;
}
- ({
- pos,
- lineStart,
- curLine
- } = res);
- chunkStart = pos;
- } else if (ch === 8232 || ch === 8233) {
- ++pos;
- ++curLine;
- lineStart = pos;
- } else if (ch === 10 || ch === 13) {
- if (type === "template") {
- out += input.slice(chunkStart, pos) + "\n";
- ++pos;
- if (ch === 13 && input.charCodeAt(pos) === 10) {
- ++pos;
+ if (path.listKey && earliest.listKey === path.listKey) {
+ if (path.key < earliest.key) {
+ earliest = path;
+ continue;
}
- ++curLine;
- chunkStart = lineStart = pos;
- } else {
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
}
- } else {
- ++pos;
+ const earliestKeyIndex = keys.indexOf(earliest.parentKey);
+ const currentKeyIndex = keys.indexOf(path.parentKey);
+ if (earliestKeyIndex > currentKeyIndex) {
+ earliest = path;
+ }
}
- }
- return {
- pos,
- str: out,
- firstInvalidLoc,
- lineStart,
- curLine,
- containsInvalid: !!firstInvalidLoc
- };
+ return earliest;
+ });
}
-function isStringEnd(type, ch, input, pos) {
- if (type === "template") {
- return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
+function getDeepestCommonAncestorFrom(paths, filter) {
+ if (!paths.length) {
+ return this;
}
- return ch === (type === "double" ? 34 : 39);
-}
-function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
- const throwOnInvalid = !inTemplate;
- pos++;
- const res = ch => ({
- pos,
- ch,
- lineStart,
- curLine
+ if (paths.length === 1) {
+ return paths[0];
+ }
+ let minDepth = Infinity;
+ let lastCommonIndex, lastCommon;
+ const ancestries = paths.map(path => {
+ const ancestry = [];
+ do {
+ ancestry.unshift(path);
+ } while ((path = path.parentPath) && path !== this);
+ if (ancestry.length < minDepth) {
+ minDepth = ancestry.length;
+ }
+ return ancestry;
});
- const ch = input.charCodeAt(pos++);
- switch (ch) {
- case 110:
- return res("\n");
- case 114:
- return res("\r");
- case 120:
- {
- let code;
- ({
- code,
- pos
- } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
- return res(code === null ? null : String.fromCharCode(code));
- }
- case 117:
- {
- let code;
- ({
- code,
- pos
- } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
- return res(code === null ? null : String.fromCodePoint(code));
- }
- case 116:
- return res("\t");
- case 98:
- return res("\b");
- case 118:
- return res("\u000b");
- case 102:
- return res("\f");
- case 13:
- if (input.charCodeAt(pos) === 10) {
- ++pos;
- }
- case 10:
- lineStart = pos;
- ++curLine;
- case 8232:
- case 8233:
- return res("");
- case 56:
- case 57:
- if (inTemplate) {
- return res(null);
- } else {
- errors.strictNumericEscape(pos - 1, lineStart, curLine);
- }
- default:
- if (ch >= 48 && ch <= 55) {
- const startPos = pos - 1;
- const match = /^[0-7]+/.exec(input.slice(startPos, pos + 2));
- let octalStr = match[0];
- let octal = parseInt(octalStr, 8);
- if (octal > 255) {
- octalStr = octalStr.slice(0, -1);
- octal = parseInt(octalStr, 8);
- }
- pos += octalStr.length - 1;
- const next = input.charCodeAt(pos);
- if (octalStr !== "0" || next === 56 || next === 57) {
- if (inTemplate) {
- return res(null);
- } else {
- errors.strictNumericEscape(startPos, lineStart, curLine);
- }
- }
- return res(String.fromCharCode(octal));
+ const first = ancestries[0];
+ depthLoop: for (let i = 0; i < minDepth; i++) {
+ const shouldMatch = first[i];
+ for (const ancestry of ancestries) {
+ if (ancestry[i] !== shouldMatch) {
+ break depthLoop;
}
- return res(String.fromCharCode(ch));
+ }
+ lastCommonIndex = i;
+ lastCommon = shouldMatch;
}
-}
-function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
- const initialPos = pos;
- let n;
- ({
- n,
- pos
- } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
- if (n === null) {
- if (throwOnInvalid) {
- errors.invalidEscapeSequence(initialPos, lineStart, curLine);
+ if (lastCommon) {
+ if (filter) {
+ return filter(lastCommon, lastCommonIndex, ancestries);
} else {
- pos = initialPos - 1;
+ return lastCommon;
}
+ } else {
+ throw new Error("Couldn't find intersection");
}
- return {
- code: n,
- pos
- };
}
-function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
- const start = pos;
- const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
- const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
- let invalid = false;
- let total = 0;
- for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
- const code = input.charCodeAt(pos);
- let val;
- if (code === 95 && allowNumSeparator !== "bail") {
- const prev = input.charCodeAt(pos - 1);
- const next = input.charCodeAt(pos + 1);
- if (!allowNumSeparator) {
- if (bailOnError) return {
- n: null,
- pos
- };
- errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
- } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
- if (bailOnError) return {
- n: null,
- pos
- };
- errors.unexpectedNumericSeparator(pos, lineStart, curLine);
- }
- ++pos;
- continue;
- }
- if (code >= 97) {
- val = code - 97 + 10;
- } else if (code >= 65) {
- val = code - 65 + 10;
- } else if (_isDigit(code)) {
- val = code - 48;
- } else {
- val = Infinity;
+function getAncestry() {
+ let path = this;
+ const paths = [];
+ do {
+ paths.push(path);
+ } while (path = path.parentPath);
+ return paths;
+}
+function isAncestor(maybeDescendant) {
+ return maybeDescendant.isDescendant(this);
+}
+function isDescendant(maybeAncestor) {
+ return !!this.findParent(parent => parent === maybeAncestor);
+}
+function inType(...candidateTypes) {
+ let path = this;
+ while (path) {
+ for (const type of candidateTypes) {
+ if (path.node.type === type) return true;
}
- if (val >= radix) {
- if (val <= 9 && bailOnError) {
- return {
- n: null,
- pos
- };
- } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
- val = 0;
- } else if (forceLen) {
- val = 0;
- invalid = true;
- } else {
- break;
- }
+ path = path.parentPath;
+ }
+ return false;
+}
+
+//# sourceMappingURL=ancestry.js.map
+
+
+/***/ }),
+
+/***/ 7354:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.addComment = addComment;
+exports.addComments = addComments;
+exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
+var _t = __nccwpck_require__(7912);
+const {
+ addComment: _addComment,
+ addComments: _addComments
+} = _t;
+function shareCommentsWithSiblings() {
+ if (typeof this.key === "string") return;
+ const node = this.node;
+ if (!node) return;
+ const trailing = node.trailingComments;
+ const leading = node.leadingComments;
+ if (!trailing && !leading) return;
+ const prev = this.getSibling(this.key - 1);
+ const next = this.getSibling(this.key + 1);
+ const hasPrev = Boolean(prev.node);
+ const hasNext = Boolean(next.node);
+ if (hasPrev) {
+ if (leading) {
+ prev.addComments("trailing", removeIfExisting(leading, prev.node.trailingComments));
}
- ++pos;
- total = total * radix + val;
+ if (trailing && !hasNext) prev.addComments("trailing", trailing);
}
- if (pos === start || len != null && pos - start !== len || invalid) {
- return {
- n: null,
- pos
- };
+ if (hasNext) {
+ if (trailing) {
+ next.addComments("leading", removeIfExisting(trailing, next.node.leadingComments));
+ }
+ if (leading && !hasPrev) next.addComments("leading", leading);
}
- return {
- n: total,
- pos
- };
}
-function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
- const ch = input.charCodeAt(pos);
- let code;
- if (ch === 123) {
- ++pos;
- ({
- code,
- pos
- } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
- ++pos;
- if (code !== null && code > 0x10ffff) {
- if (throwOnInvalid) {
- errors.invalidCodePoint(pos, lineStart, curLine);
- } else {
- return {
- code: null,
- pos
- };
- }
- }
- } else {
- ({
- code,
- pos
- } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
+function removeIfExisting(list, toRemove) {
+ if (!toRemove) return list;
+ let lastFoundIndex = -1;
+ return list.filter(el => {
+ const i = toRemove.indexOf(el, lastFoundIndex);
+ if (i === -1) return true;
+ lastFoundIndex = i;
+ });
+}
+function addComment(type, content, line) {
+ _addComment(this.node, type, content, line);
+}
+function addComments(type, comments) {
+ _addComments(this.node, type, comments);
+}
+
+//# sourceMappingURL=comments.js.map
+
+
+/***/ }),
+
+/***/ 4108:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._call = _call;
+exports._getQueueContexts = _getQueueContexts;
+exports._resyncKey = _resyncKey;
+exports._resyncList = _resyncList;
+exports._resyncParent = _resyncParent;
+exports._resyncRemoved = _resyncRemoved;
+exports.call = call;
+exports.isBlacklisted = exports.isDenylisted = isDenylisted;
+exports.popContext = popContext;
+exports.pushContext = pushContext;
+exports.requeue = requeue;
+exports.resync = resync;
+exports.setContext = setContext;
+exports.setKey = setKey;
+exports.setScope = setScope;
+exports.setup = setup;
+exports.skip = skip;
+exports.skipKey = skipKey;
+exports.stop = stop;
+exports.visit = visit;
+var _traverseNode = __nccwpck_require__(1250);
+var _index = __nccwpck_require__(8877);
+function call(key) {
+ const opts = this.opts;
+ this.debug(key);
+ if (this.node) {
+ if (this._call(opts[key])) return true;
}
- return {
- code,
- pos
- };
+ if (this.node) {
+ var _opts$this$node$type;
+ return this._call((_opts$this$node$type = opts[this.node.type]) == null ? void 0 : _opts$this$node$type[key]);
+ }
+ return false;
}
-function buildPosition(pos, lineStart, curLine) {
- return new Position(curLine, pos - lineStart, pos);
-}
-const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
-class Token {
- constructor(state) {
- const startIndex = state.startIndex || 0;
- this.type = state.type;
- this.value = state.value;
- this.start = startIndex + state.start;
- this.end = startIndex + state.end;
- this.loc = new SourceLocation(state.startLoc, state.endLoc);
- }
-}
-class Tokenizer extends CommentsParser {
- constructor(options, input) {
- super();
- this.isLookahead = void 0;
- this.tokens = [];
- this.errorHandlers_readInt = {
- invalidDigit: (pos, lineStart, curLine, radix) => {
- if (!(this.optionFlags & 2048)) return false;
- this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
- radix
- });
- return true;
- },
- numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),
- unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator)
- };
- this.errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, {
- invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence),
- invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint)
- });
- this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
- strictNumericEscape: (pos, lineStart, curLine) => {
- this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
- },
- unterminated: (pos, lineStart, curLine) => {
- throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
- }
- });
- this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
- strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
- unterminated: (pos, lineStart, curLine) => {
- throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
- }
- });
- this.state = new State();
- this.state.init(options);
- this.input = input;
- this.length = input.length;
- this.comments = [];
- this.isLookahead = false;
- }
- pushToken(token) {
- this.tokens.length = this.state.tokensLength;
- this.tokens.push(token);
- ++this.state.tokensLength;
- }
- next() {
- this.checkKeywordEscapes();
- if (this.optionFlags & 256) {
- this.pushToken(new Token(this.state));
- }
- this.state.lastTokEndLoc = this.state.endLoc;
- this.state.lastTokStartLoc = this.state.startLoc;
- this.nextToken();
- }
- eat(type) {
- if (this.match(type)) {
- this.next();
- return true;
- } else {
- return false;
+function _call(fns) {
+ if (!fns) return false;
+ for (const fn of fns) {
+ if (!fn) continue;
+ const node = this.node;
+ if (!node) return true;
+ const ret = fn.call(this.state, this, this.state);
+ if (ret && typeof ret === "object" && typeof ret.then === "function") {
+ throw new Error(`You appear to be using a plugin with an async traversal visitor, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
+ }
+ if (ret) {
+ throw new Error(`Unexpected return value from visitor method ${fn}`);
}
+ if (this.node !== node) return true;
+ if (this._traverseFlags > 0) return true;
}
- match(type) {
- return this.state.type === type;
+ return false;
+}
+function isDenylisted() {
+ var _this$opts$denylist;
+ const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
+ return denylist && denylist.indexOf(this.node.type) > -1;
+}
+function restoreContext(path, context) {
+ if (path.context !== context) {
+ path.context = context;
+ path.state = context.state;
+ path.opts = context.opts;
}
- createLookaheadState(state) {
- return {
- pos: state.pos,
- value: null,
- type: state.type,
- start: state.start,
- end: state.end,
- context: [this.curContext()],
- inType: state.inType,
- startLoc: state.startLoc,
- lastTokEndLoc: state.lastTokEndLoc,
- curLine: state.curLine,
- lineStart: state.lineStart,
- curPosition: state.curPosition
- };
+}
+function visit() {
+ var _this$opts$shouldSkip, _this$opts;
+ if (!this.node) {
+ return false;
}
- lookahead() {
- const old = this.state;
- this.state = this.createLookaheadState(old);
- this.isLookahead = true;
- this.nextToken();
- this.isLookahead = false;
- const curr = this.state;
- this.state = old;
- return curr;
+ if (this.isDenylisted()) {
+ return false;
}
- nextTokenStart() {
- return this.nextTokenStartSince(this.state.pos);
+ if ((_this$opts$shouldSkip = (_this$opts = this.opts).shouldSkip) != null && _this$opts$shouldSkip.call(_this$opts, this)) {
+ return false;
}
- nextTokenStartSince(pos) {
- skipWhiteSpace.lastIndex = pos;
- return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos;
+ const currentContext = this.context;
+ if (this.shouldSkip || this.call("enter")) {
+ this.debug("Skip...");
+ return this.shouldStop;
}
- lookaheadCharCode() {
- return this.input.charCodeAt(this.nextTokenStart());
+ restoreContext(this, currentContext);
+ this.debug("Recursing into...");
+ this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
+ restoreContext(this, currentContext);
+ this.call("exit");
+ return this.shouldStop;
+}
+function skip() {
+ this.shouldSkip = true;
+}
+function skipKey(key) {
+ if (this.skipKeys == null) {
+ this.skipKeys = {};
}
- nextTokenInLineStart() {
- return this.nextTokenInLineStartSince(this.state.pos);
+ this.skipKeys[key] = true;
+}
+function stop() {
+ this._traverseFlags |= _index.SHOULD_SKIP | _index.SHOULD_STOP;
+}
+function setScope() {
+ var _this$opts2, _this$scope;
+ if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return;
+ let path = this.parentPath;
+ if ((this.key === "key" || this.listKey === "decorators") && path.isMethod() || this.key === "discriminant" && path.isSwitchStatement()) {
+ path = path.parentPath;
}
- nextTokenInLineStartSince(pos) {
- skipWhiteSpaceInLine.lastIndex = pos;
- return skipWhiteSpaceInLine.test(this.input) ? skipWhiteSpaceInLine.lastIndex : pos;
+ let target;
+ while (path && !target) {
+ var _path$opts;
+ if ((_path$opts = path.opts) != null && _path$opts.noScope) return;
+ target = path.scope;
+ path = path.parentPath;
}
- lookaheadInLineCharCode() {
- return this.input.charCodeAt(this.nextTokenInLineStart());
+ this.scope = this.getScope(target);
+ (_this$scope = this.scope) == null ? void 0 : _this$scope.init();
+}
+function setContext(context) {
+ if (this.skipKeys != null) {
+ this.skipKeys = {};
}
- codePointAtPos(pos) {
- let cp = this.input.charCodeAt(pos);
- if ((cp & 0xfc00) === 0xd800 && ++pos < this.input.length) {
- const trail = this.input.charCodeAt(pos);
- if ((trail & 0xfc00) === 0xdc00) {
- cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
- }
- }
- return cp;
+ this._traverseFlags = 0;
+ if (context) {
+ this.context = context;
+ this.state = context.state;
+ this.opts = context.opts;
}
- setStrict(strict) {
- this.state.strict = strict;
- if (strict) {
- this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
- this.state.strictErrors.clear();
- }
+ this.setScope();
+ return this;
+}
+function resync() {
+ if (this.removed) return;
+ this._resyncParent();
+ this._resyncList();
+ this._resyncKey();
+}
+function _resyncParent() {
+ if (this.parentPath) {
+ this.parent = this.parentPath.node;
}
- curContext() {
- return this.state.context[this.state.context.length - 1];
+}
+function _resyncKey() {
+ if (!this.container) return;
+ if (this.node === this.container[this.key]) {
+ return;
}
- nextToken() {
- this.skipSpace();
- this.state.start = this.state.pos;
- if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
- if (this.state.pos >= this.length) {
- this.finishToken(140);
- return;
- }
- this.getTokenFromCode(this.codePointAtPos(this.state.pos));
- }
- skipBlockComment(commentEnd) {
- let startLoc;
- if (!this.isLookahead) startLoc = this.state.curPosition();
- const start = this.state.pos;
- const end = this.input.indexOf(commentEnd, start + 2);
- if (end === -1) {
- throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
- }
- this.state.pos = end + commentEnd.length;
- lineBreakG.lastIndex = start + 2;
- while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) {
- ++this.state.curLine;
- this.state.lineStart = lineBreakG.lastIndex;
- }
- if (this.isLookahead) return;
- const comment = {
- type: "CommentBlock",
- value: this.input.slice(start + 2, end),
- start: this.sourceToOffsetPos(start),
- end: this.sourceToOffsetPos(end + commentEnd.length),
- loc: new SourceLocation(startLoc, this.state.curPosition())
- };
- if (this.optionFlags & 256) this.pushToken(comment);
- return comment;
- }
- skipLineComment(startSkip) {
- const start = this.state.pos;
- let startLoc;
- if (!this.isLookahead) startLoc = this.state.curPosition();
- let ch = this.input.charCodeAt(this.state.pos += startSkip);
- if (this.state.pos < this.length) {
- while (!isNewLine(ch) && ++this.state.pos < this.length) {
- ch = this.input.charCodeAt(this.state.pos);
- }
- }
- if (this.isLookahead) return;
- const end = this.state.pos;
- const value = this.input.slice(start + startSkip, end);
- const comment = {
- type: "CommentLine",
- value,
- start: this.sourceToOffsetPos(start),
- end: this.sourceToOffsetPos(end),
- loc: new SourceLocation(startLoc, this.state.curPosition())
- };
- if (this.optionFlags & 256) this.pushToken(comment);
- return comment;
- }
- skipSpace() {
- const spaceStart = this.state.pos;
- const comments = this.optionFlags & 4096 ? [] : null;
- loop: while (this.state.pos < this.length) {
- const ch = this.input.charCodeAt(this.state.pos);
- switch (ch) {
- case 32:
- case 160:
- case 9:
- ++this.state.pos;
- break;
- case 13:
- if (this.input.charCodeAt(this.state.pos + 1) === 10) {
- ++this.state.pos;
- }
- case 10:
- case 8232:
- case 8233:
- ++this.state.pos;
- ++this.state.curLine;
- this.state.lineStart = this.state.pos;
- break;
- case 47:
- switch (this.input.charCodeAt(this.state.pos + 1)) {
- case 42:
- {
- const comment = this.skipBlockComment("*/");
- if (comment !== undefined) {
- this.addComment(comment);
- comments == null || comments.push(comment);
- }
- break;
- }
- case 47:
- {
- const comment = this.skipLineComment(2);
- if (comment !== undefined) {
- this.addComment(comment);
- comments == null || comments.push(comment);
- }
- break;
- }
- default:
- break loop;
- }
- break;
- default:
- if (isWhitespace(ch)) {
- ++this.state.pos;
- } else if (ch === 45 && !this.inModule && this.optionFlags & 8192) {
- const pos = this.state.pos;
- if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
- const comment = this.skipLineComment(3);
- if (comment !== undefined) {
- this.addComment(comment);
- comments == null || comments.push(comment);
- }
- } else {
- break loop;
- }
- } else if (ch === 60 && !this.inModule && this.optionFlags & 8192) {
- const pos = this.state.pos;
- if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) {
- const comment = this.skipLineComment(4);
- if (comment !== undefined) {
- this.addComment(comment);
- comments == null || comments.push(comment);
- }
- } else {
- break loop;
- }
- } else {
- break loop;
- }
+ if (Array.isArray(this.container)) {
+ for (let i = 0; i < this.container.length; i++) {
+ if (this.container[i] === this.node) {
+ this.setKey(i);
+ return;
}
}
- if ((comments == null ? void 0 : comments.length) > 0) {
- const end = this.state.pos;
- const commentWhitespace = {
- start: this.sourceToOffsetPos(spaceStart),
- end: this.sourceToOffsetPos(end),
- comments,
- leadingNode: null,
- trailingNode: null,
- containingNode: null
- };
- this.state.commentStack.push(commentWhitespace);
+ } else {
+ for (const key of Object.keys(this.container)) {
+ if (this.container[key] === this.node) {
+ this.setKey(key);
+ return;
+ }
}
}
- finishToken(type, val) {
- this.state.end = this.state.pos;
- this.state.endLoc = this.state.curPosition();
- const prevType = this.state.type;
- this.state.type = type;
- this.state.value = val;
- if (!this.isLookahead) {
- this.updateContext(prevType);
- }
+ this.key = null;
+}
+function _resyncList() {
+ if (!this.parent || !this.inList) return;
+ const newContainer = this.parent[this.listKey];
+ if (this.container === newContainer) return;
+ this.container = newContainer || null;
+}
+function _resyncRemoved() {
+ if (this.key == null || !this.container || this.container[this.key] !== this.node) {
+ this._markRemoved();
}
- replaceToken(type) {
- this.state.type = type;
- this.updateContext();
+}
+function popContext() {
+ this.contexts.pop();
+ if (this.contexts.length > 0) {
+ this.setContext(this.contexts[this.contexts.length - 1]);
+ } else {
+ this.setContext(undefined);
}
- readToken_numberSign() {
- if (this.state.pos === 0 && this.readToken_interpreter()) {
- return;
- }
- const nextPos = this.state.pos + 1;
- const next = this.codePointAtPos(nextPos);
- if (next >= 48 && next <= 57) {
- throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
- }
- if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
- this.expectPlugin("recordAndTuple");
- if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
- throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
- }
- this.state.pos += 2;
- if (next === 123) {
- this.finishToken(7);
- } else {
- this.finishToken(1);
- }
- } else if (isIdentifierStart(next)) {
- ++this.state.pos;
- this.finishToken(139, this.readWord1(next));
- } else if (next === 92) {
- ++this.state.pos;
- this.finishToken(139, this.readWord1());
- } else {
- this.finishOp(27, 1);
- }
+}
+function pushContext(context) {
+ this.contexts.push(context);
+ this.setContext(context);
+}
+function setup(parentPath, container, listKey, key) {
+ this.listKey = listKey;
+ this.container = container;
+ this.parentPath = parentPath || this.parentPath;
+ this.setKey(key);
+}
+function setKey(key) {
+ var _this$node;
+ this.key = key;
+ this.node = this.container[this.key];
+ this.type = (_this$node = this.node) == null ? void 0 : _this$node.type;
+}
+function requeue(pathToQueue = this) {
+ if (pathToQueue.removed) return;
+ ;
+ const contexts = this.contexts;
+ for (const context of contexts) {
+ context.maybeQueue(pathToQueue);
}
- readToken_dot() {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next >= 48 && next <= 57) {
- this.readNumber(true);
- return;
- }
- if (next === 46 && this.input.charCodeAt(this.state.pos + 2) === 46) {
- this.state.pos += 3;
- this.finishToken(21);
- } else {
- ++this.state.pos;
- this.finishToken(16);
- }
+}
+function _getQueueContexts() {
+ let path = this;
+ let contexts = this.contexts;
+ while (!contexts.length) {
+ path = path.parentPath;
+ if (!path) break;
+ contexts = path.contexts;
}
- readToken_slash() {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === 61) {
- this.finishOp(31, 2);
- } else {
- this.finishOp(56, 1);
- }
+ return contexts;
+}
+
+//# sourceMappingURL=context.js.map
+
+
+/***/ }),
+
+/***/ 277:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.arrowFunctionToExpression = arrowFunctionToExpression;
+exports.ensureBlock = ensureBlock;
+exports.toComputedKey = toComputedKey;
+exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment;
+var _t = __nccwpck_require__(7912);
+var _helperEnvironmentVisitor = __nccwpck_require__(1097);
+var _helperFunctionName = __nccwpck_require__(3968);
+var _visitors = __nccwpck_require__(3494);
+const {
+ arrowFunctionExpression,
+ assignmentExpression,
+ binaryExpression,
+ blockStatement,
+ callExpression,
+ conditionalExpression,
+ expressionStatement,
+ identifier,
+ isIdentifier,
+ jsxIdentifier,
+ logicalExpression,
+ LOGICAL_OPERATORS,
+ memberExpression,
+ metaProperty,
+ numericLiteral,
+ objectExpression,
+ restElement,
+ returnStatement,
+ sequenceExpression,
+ spreadElement,
+ stringLiteral,
+ super: _super,
+ thisExpression,
+ toExpression,
+ unaryExpression
+} = _t;
+function toComputedKey() {
+ let key;
+ if (this.isMemberExpression()) {
+ key = this.node.property;
+ } else if (this.isProperty() || this.isMethod()) {
+ key = this.node.key;
+ } else {
+ throw new ReferenceError("todo");
}
- readToken_interpreter() {
- if (this.state.pos !== 0 || this.length < 2) return false;
- let ch = this.input.charCodeAt(this.state.pos + 1);
- if (ch !== 33) return false;
- const start = this.state.pos;
- this.state.pos += 1;
- while (!isNewLine(ch) && ++this.state.pos < this.length) {
- ch = this.input.charCodeAt(this.state.pos);
- }
- const value = this.input.slice(start + 2, this.state.pos);
- this.finishToken(28, value);
- return true;
+ if (!this.node.computed) {
+ if (isIdentifier(key)) key = stringLiteral(key.name);
}
- readToken_mult_modulo(code) {
- let type = code === 42 ? 55 : 54;
- let width = 1;
- let next = this.input.charCodeAt(this.state.pos + 1);
- if (code === 42 && next === 42) {
- width++;
- next = this.input.charCodeAt(this.state.pos + 2);
- type = 57;
- }
- if (next === 61 && !this.state.inType) {
- width++;
- type = code === 37 ? 33 : 30;
- }
- this.finishOp(type, width);
- }
- readToken_pipe_amp(code) {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === code) {
- if (this.input.charCodeAt(this.state.pos + 2) === 61) {
- this.finishOp(30, 3);
- } else {
- this.finishOp(code === 124 ? 41 : 42, 2);
- }
- return;
- }
- if (code === 124) {
- if (next === 62) {
- this.finishOp(39, 2);
- return;
- }
- if (this.hasPlugin("recordAndTuple") && next === 125) {
- if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
- throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
- }
- this.state.pos += 2;
- this.finishToken(9);
- return;
- }
- if (this.hasPlugin("recordAndTuple") && next === 93) {
- if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
- throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
- }
- this.state.pos += 2;
- this.finishToken(4);
- return;
- }
- }
- if (next === 61) {
- this.finishOp(30, 2);
- return;
- }
- this.finishOp(code === 124 ? 43 : 45, 1);
- }
- readToken_caret() {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === 61 && !this.state.inType) {
- this.finishOp(32, 2);
- } else if (next === 94 && this.hasPlugin(["pipelineOperator", {
- proposal: "hack",
- topicToken: "^^"
- }])) {
- this.finishOp(37, 2);
- const lookaheadCh = this.input.codePointAt(this.state.pos);
- if (lookaheadCh === 94) {
- this.unexpected();
- }
- } else {
- this.finishOp(44, 1);
- }
+ return key;
+}
+function ensureBlock() {
+ const body = this.get("body");
+ const bodyNode = body.node;
+ if (Array.isArray(body)) {
+ throw new Error("Can't convert array path to a block statement");
}
- readToken_atSign() {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === 64 && this.hasPlugin(["pipelineOperator", {
- proposal: "hack",
- topicToken: "@@"
- }])) {
- this.finishOp(38, 2);
- } else {
- this.finishOp(26, 1);
- }
+ if (!bodyNode) {
+ throw new Error("Can't convert node without a body");
}
- readToken_plus_min(code) {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === code) {
- this.finishOp(34, 2);
- return;
- }
- if (next === 61) {
- this.finishOp(30, 2);
+ if (body.isBlockStatement()) {
+ return bodyNode;
+ }
+ const statements = [];
+ let stringPath = "body";
+ let key;
+ let listKey;
+ if (body.isStatement()) {
+ listKey = "body";
+ key = 0;
+ statements.push(body.node);
+ } else {
+ stringPath += ".body.0";
+ if (this.isFunction()) {
+ key = "argument";
+ statements.push(returnStatement(body.node));
} else {
- this.finishOp(53, 1);
+ key = "expression";
+ statements.push(expressionStatement(body.node));
}
}
- readToken_lt() {
- const {
- pos
- } = this.state;
- const next = this.input.charCodeAt(pos + 1);
- if (next === 60) {
- if (this.input.charCodeAt(pos + 2) === 61) {
- this.finishOp(30, 3);
- return;
- }
- this.finishOp(51, 2);
- return;
- }
- if (next === 61) {
- this.finishOp(49, 2);
- return;
- }
- this.finishOp(47, 1);
+ this.node.body = blockStatement(statements);
+ const parentPath = this.get(stringPath);
+ body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
+ return this.node;
+}
+{
+ exports.arrowFunctionToShadowed = function () {
+ if (!this.isArrowFunctionExpression()) return;
+ this.arrowFunctionToExpression();
+ };
+}
+function unwrapFunctionEnvironment() {
+ if (!this.isArrowFunctionExpression() && !this.isFunctionExpression() && !this.isFunctionDeclaration()) {
+ throw this.buildCodeFrameError("Can only unwrap the environment of a function.");
}
- readToken_gt() {
- const {
- pos
- } = this.state;
- const next = this.input.charCodeAt(pos + 1);
- if (next === 62) {
- const size = this.input.charCodeAt(pos + 2) === 62 ? 3 : 2;
- if (this.input.charCodeAt(pos + size) === 61) {
- this.finishOp(30, size + 1);
- return;
- }
- this.finishOp(52, size);
- return;
- }
- if (next === 61) {
- this.finishOp(49, 2);
- return;
- }
- this.finishOp(48, 1);
+ hoistFunctionEnvironment(this);
+}
+function setType(path, type) {
+ path.node.type = type;
+}
+function arrowFunctionToExpression({
+ allowInsertArrow = true,
+ allowInsertArrowWithRest = allowInsertArrow,
+ noNewArrows = !(_arguments$ => (_arguments$ = arguments[0]) == null ? void 0 : _arguments$.specCompliant)()
+} = {}) {
+ if (!this.isArrowFunctionExpression()) {
+ throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression.");
}
- readToken_eq_excl(code) {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === 61) {
- this.finishOp(46, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
- return;
- }
- if (code === 61 && next === 62) {
- this.state.pos += 2;
- this.finishToken(19);
- return;
+ const {
+ thisBinding,
+ fnPath: fn
+ } = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow, allowInsertArrowWithRest);
+ fn.ensureBlock();
+ setType(fn, "FunctionExpression");
+ if (!noNewArrows) {
+ const checkBinding = thisBinding ? null : fn.scope.generateUidIdentifier("arrowCheckId");
+ if (checkBinding) {
+ fn.parentPath.scope.push({
+ id: checkBinding,
+ init: objectExpression([])
+ });
}
- this.finishOp(code === 61 ? 29 : 35, 1);
+ fn.get("body").unshiftContainer("body", expressionStatement(callExpression(this.hub.addHelper("newArrowCheck"), [thisExpression(), checkBinding ? identifier(checkBinding.name) : identifier(thisBinding)])));
+ fn.replaceWith(callExpression(memberExpression((0, _helperFunctionName.default)(this, true) || fn.node, identifier("bind")), [checkBinding ? identifier(checkBinding.name) : thisExpression()]));
+ return fn.get("callee.object");
}
- readToken_question() {
- const next = this.input.charCodeAt(this.state.pos + 1);
- const next2 = this.input.charCodeAt(this.state.pos + 2);
- if (next === 63) {
- if (next2 === 61) {
- this.finishOp(30, 3);
- } else {
- this.finishOp(40, 2);
- }
- } else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
- this.state.pos += 2;
- this.finishToken(18);
+ return fn;
+}
+const getSuperCallsVisitor = (0, _visitors.merge)([{
+ CallExpression(child, {
+ allSuperCalls
+ }) {
+ if (!child.get("callee").isSuper()) return;
+ allSuperCalls.push(child);
+ }
+}, _helperEnvironmentVisitor.default]);
+function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow = true, allowInsertArrowWithRest = true) {
+ let arrowParent;
+ let thisEnvFn = fnPath.findParent(p => {
+ if (p.isArrowFunctionExpression()) {
+ var _arrowParent;
+ (_arrowParent = arrowParent) != null ? _arrowParent : arrowParent = p;
+ return false;
+ }
+ return p.isFunction() || p.isProgram() || p.isClassProperty({
+ static: false
+ }) || p.isClassPrivateProperty({
+ static: false
+ });
+ });
+ const inConstructor = thisEnvFn.isClassMethod({
+ kind: "constructor"
+ });
+ if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {
+ if (arrowParent) {
+ thisEnvFn = arrowParent;
+ } else if (allowInsertArrow) {
+ fnPath.replaceWith(callExpression(arrowFunctionExpression([], toExpression(fnPath.node)), []));
+ thisEnvFn = fnPath.get("callee");
+ fnPath = thisEnvFn.get("body");
} else {
- ++this.state.pos;
- this.finishToken(17);
+ throw fnPath.buildCodeFrameError("Unable to transform arrow inside class property");
}
}
- getTokenFromCode(code) {
- switch (code) {
- case 46:
- this.readToken_dot();
- return;
- case 40:
- ++this.state.pos;
- this.finishToken(10);
- return;
- case 41:
- ++this.state.pos;
- this.finishToken(11);
- return;
- case 59:
- ++this.state.pos;
- this.finishToken(13);
- return;
- case 44:
- ++this.state.pos;
- this.finishToken(12);
- return;
- case 91:
- if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
- if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
- throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
- }
- this.state.pos += 2;
- this.finishToken(2);
- } else {
- ++this.state.pos;
- this.finishToken(0);
- }
- return;
- case 93:
- ++this.state.pos;
- this.finishToken(3);
- return;
- case 123:
- if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
- if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
- throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
- }
- this.state.pos += 2;
- this.finishToken(6);
- } else {
- ++this.state.pos;
- this.finishToken(5);
- }
- return;
- case 125:
- ++this.state.pos;
- this.finishToken(8);
- return;
- case 58:
- if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
- this.finishOp(15, 2);
- } else {
- ++this.state.pos;
- this.finishToken(14);
- }
- return;
- case 63:
- this.readToken_question();
- return;
- case 96:
- this.readTemplateToken();
- return;
- case 48:
- {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (next === 120 || next === 88) {
- this.readRadixNumber(16);
- return;
- }
- if (next === 111 || next === 79) {
- this.readRadixNumber(8);
- return;
- }
- if (next === 98 || next === 66) {
- this.readRadixNumber(2);
- return;
- }
- }
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- this.readNumber(false);
- return;
- case 34:
- case 39:
- this.readString(code);
- return;
- case 47:
- this.readToken_slash();
- return;
- case 37:
- case 42:
- this.readToken_mult_modulo(code);
- return;
- case 124:
- case 38:
- this.readToken_pipe_amp(code);
- return;
- case 94:
- this.readToken_caret();
- return;
- case 43:
- case 45:
- this.readToken_plus_min(code);
- return;
- case 60:
- this.readToken_lt();
- return;
- case 62:
- this.readToken_gt();
- return;
- case 61:
- case 33:
- this.readToken_eq_excl(code);
- return;
- case 126:
- this.finishOp(36, 1);
- return;
- case 64:
- this.readToken_atSign();
- return;
- case 35:
- this.readToken_numberSign();
- return;
- case 92:
- this.readWord();
- return;
- default:
- if (isIdentifierStart(code)) {
- this.readWord(code);
- return;
- }
+ const {
+ thisPaths,
+ argumentsPaths,
+ newTargetPaths,
+ superProps,
+ superCalls
+ } = getScopeInformation(fnPath);
+ if (inConstructor && superCalls.length > 0) {
+ if (!allowInsertArrow) {
+ throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super()` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
+ }
+ if (!allowInsertArrowWithRest) {
+ throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-parameters', " + "it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
}
- throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
- unexpected: String.fromCodePoint(code)
+ const allSuperCalls = [];
+ thisEnvFn.traverse(getSuperCallsVisitor, {
+ allSuperCalls
+ });
+ const superBinding = getSuperBinding(thisEnvFn);
+ allSuperCalls.forEach(superCall => {
+ const callee = identifier(superBinding);
+ callee.loc = superCall.node.callee.loc;
+ superCall.get("callee").replaceWith(callee);
});
}
- finishOp(type, size) {
- const str = this.input.slice(this.state.pos, this.state.pos + size);
- this.state.pos += size;
- this.finishToken(type, str);
- }
- readRegexp() {
- const startLoc = this.state.startLoc;
- const start = this.state.start + 1;
- let escaped, inClass;
- let {
- pos
- } = this.state;
- for (;; ++pos) {
- if (pos >= this.length) {
- throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
- }
- const ch = this.input.charCodeAt(pos);
- if (isNewLine(ch)) {
- throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
- }
- if (escaped) {
- escaped = false;
- } else {
- if (ch === 91) {
- inClass = true;
- } else if (ch === 93 && inClass) {
- inClass = false;
- } else if (ch === 47 && !inClass) {
- break;
- }
- escaped = ch === 92;
- }
- }
- const content = this.input.slice(start, pos);
- ++pos;
- let mods = "";
- const nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start);
- while (pos < this.length) {
- const cp = this.codePointAtPos(pos);
- const char = String.fromCharCode(cp);
- if (VALID_REGEX_FLAGS.has(cp)) {
- if (cp === 118) {
- if (mods.includes("u")) {
- this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
- }
- } else if (cp === 117) {
- if (mods.includes("v")) {
- this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
- }
- }
- if (mods.includes(char)) {
- this.raise(Errors.DuplicateRegExpFlags, nextPos());
- }
- } else if (isIdentifierChar(cp) || cp === 92) {
- this.raise(Errors.MalformedRegExpFlags, nextPos());
+ if (argumentsPaths.length > 0) {
+ const argumentsBinding = getBinding(thisEnvFn, "arguments", () => {
+ const args = () => identifier("arguments");
+ if (thisEnvFn.scope.path.isProgram()) {
+ return conditionalExpression(binaryExpression("===", unaryExpression("typeof", args()), stringLiteral("undefined")), thisEnvFn.scope.buildUndefinedNode(), args());
} else {
- break;
+ return args();
}
- ++pos;
- mods += char;
- }
- this.state.pos = pos;
- this.finishToken(138, {
- pattern: content,
- flags: mods
+ });
+ argumentsPaths.forEach(argumentsChild => {
+ const argsRef = identifier(argumentsBinding);
+ argsRef.loc = argumentsChild.node.loc;
+ argumentsChild.replaceWith(argsRef);
});
}
- readInt(radix, len, forceLen = false, allowNumSeparator = true) {
- const {
- n,
- pos
- } = readInt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt, false);
- this.state.pos = pos;
- return n;
- }
- readRadixNumber(radix) {
- const start = this.state.pos;
- const startLoc = this.state.curPosition();
- let isBigInt = false;
- this.state.pos += 2;
- const val = this.readInt(radix);
- if (val == null) {
- this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
- radix
- });
- }
- const next = this.input.charCodeAt(this.state.pos);
- if (next === 110) {
- ++this.state.pos;
- isBigInt = true;
- } else if (next === 109) {
- throw this.raise(Errors.InvalidDecimal, startLoc);
- }
- if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
- throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
- }
- if (isBigInt) {
- const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
- this.finishToken(136, str);
- return;
- }
- this.finishToken(135, val);
- }
- readNumber(startsWithDot) {
- const start = this.state.pos;
- const startLoc = this.state.curPosition();
- let isFloat = false;
- let isBigInt = false;
- let hasExponent = false;
- let isOctal = false;
- if (!startsWithDot && this.readInt(10) === null) {
- this.raise(Errors.InvalidNumber, this.state.curPosition());
- }
- const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
- if (hasLeadingZero) {
- const integer = this.input.slice(start, this.state.pos);
- this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
- if (!this.state.strict) {
- const underscorePos = integer.indexOf("_");
- if (underscorePos > 0) {
- this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
- }
- }
- isOctal = hasLeadingZero && !/[89]/.test(integer);
- }
- let next = this.input.charCodeAt(this.state.pos);
- if (next === 46 && !isOctal) {
- ++this.state.pos;
- this.readInt(10);
- isFloat = true;
- next = this.input.charCodeAt(this.state.pos);
- }
- if ((next === 69 || next === 101) && !isOctal) {
- next = this.input.charCodeAt(++this.state.pos);
- if (next === 43 || next === 45) {
- ++this.state.pos;
- }
- if (this.readInt(10) === null) {
- this.raise(Errors.InvalidOrMissingExponent, startLoc);
- }
- isFloat = true;
- hasExponent = true;
- next = this.input.charCodeAt(this.state.pos);
+ if (newTargetPaths.length > 0) {
+ const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => metaProperty(identifier("new"), identifier("target")));
+ newTargetPaths.forEach(targetChild => {
+ const targetRef = identifier(newTargetBinding);
+ targetRef.loc = targetChild.node.loc;
+ targetChild.replaceWith(targetRef);
+ });
+ }
+ if (superProps.length > 0) {
+ if (!allowInsertArrow) {
+ throw superProps[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super.prop` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
}
- if (next === 110) {
- if (isFloat || hasLeadingZero) {
- this.raise(Errors.InvalidBigIntLiteral, startLoc);
+ const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []);
+ flatSuperProps.forEach(superProp => {
+ const key = superProp.node.computed ? "" : superProp.get("property").node.name;
+ const superParentPath = superProp.parentPath;
+ const isAssignment = superParentPath.isAssignmentExpression({
+ left: superProp.node
+ });
+ const isCall = superParentPath.isCallExpression({
+ callee: superProp.node
+ });
+ const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({
+ tag: superProp.node
+ });
+ const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
+ const args = [];
+ if (superProp.node.computed) {
+ args.push(superProp.get("property").node);
}
- ++this.state.pos;
- isBigInt = true;
- }
- if (next === 109) {
- this.expectPlugin("decimal", this.state.curPosition());
- if (hasExponent || hasLeadingZero) {
- this.raise(Errors.InvalidDecimal, startLoc);
+ if (isAssignment) {
+ const value = superParentPath.node.right;
+ args.push(value);
}
- ++this.state.pos;
- var isDecimal = true;
- }
- if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
- throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
- }
- const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
- if (isBigInt) {
- this.finishToken(136, str);
- return;
- }
- if (isDecimal) {
- this.finishToken(137, str);
- return;
- }
- const val = isOctal ? parseInt(str, 8) : parseFloat(str);
- this.finishToken(135, val);
- }
- readCodePoint(throwOnInvalid) {
- const {
- code,
- pos
- } = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
- this.state.pos = pos;
- return code;
- }
- readString(quote) {
- const {
- str,
- pos,
- curLine,
- lineStart
- } = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
- this.state.pos = pos + 1;
- this.state.lineStart = lineStart;
- this.state.curLine = curLine;
- this.finishToken(134, str);
- }
- readTemplateContinuation() {
- if (!this.match(8)) {
- this.unexpected(null, 8);
- }
- this.state.pos--;
- this.readTemplateToken();
- }
- readTemplateToken() {
- const opening = this.input[this.state.pos];
- const {
- str,
- firstInvalidLoc,
- pos,
- curLine,
- lineStart
- } = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
- this.state.pos = pos + 1;
- this.state.lineStart = lineStart;
- this.state.curLine = curLine;
- if (firstInvalidLoc) {
- this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
- }
- if (this.input.codePointAt(pos) === 96) {
- this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
- } else {
- this.state.pos++;
- this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
- }
- }
- recordStrictModeErrors(toParseError, at) {
- const index = at.index;
- if (this.state.strict && !this.state.strictErrors.has(index)) {
- this.raise(toParseError, at);
- } else {
- this.state.strictErrors.set(index, [toParseError, at]);
- }
- }
- readWord1(firstCode) {
- this.state.containsEsc = false;
- let word = "";
- const start = this.state.pos;
- let chunkStart = this.state.pos;
- if (firstCode !== undefined) {
- this.state.pos += firstCode <= 0xffff ? 1 : 2;
- }
- while (this.state.pos < this.length) {
- const ch = this.codePointAtPos(this.state.pos);
- if (isIdentifierChar(ch)) {
- this.state.pos += ch <= 0xffff ? 1 : 2;
- } else if (ch === 92) {
- this.state.containsEsc = true;
- word += this.input.slice(chunkStart, this.state.pos);
- const escStart = this.state.curPosition();
- const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
- if (this.input.charCodeAt(++this.state.pos) !== 117) {
- this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
- chunkStart = this.state.pos - 1;
- continue;
- }
- ++this.state.pos;
- const esc = this.readCodePoint(true);
- if (esc !== null) {
- if (!identifierCheck(esc)) {
- this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
- }
- word += String.fromCodePoint(esc);
- }
- chunkStart = this.state.pos;
+ const call = callExpression(identifier(superBinding), args);
+ if (isCall) {
+ superParentPath.unshiftContainer("arguments", thisExpression());
+ superProp.replaceWith(memberExpression(call, identifier("call")));
+ thisPaths.push(superParentPath.get("arguments.0"));
+ } else if (isAssignment) {
+ superParentPath.replaceWith(call);
+ } else if (isTaggedTemplate) {
+ superProp.replaceWith(callExpression(memberExpression(call, identifier("bind"), false), [thisExpression()]));
+ thisPaths.push(superProp.get("arguments.0"));
} else {
- break;
- }
- }
- return word + this.input.slice(chunkStart, this.state.pos);
- }
- readWord(firstCode) {
- const word = this.readWord1(firstCode);
- const type = keywords$1.get(word);
- if (type !== undefined) {
- this.finishToken(type, tokenLabelName(type));
- } else {
- this.finishToken(132, word);
- }
- }
- checkKeywordEscapes() {
- const {
- type
- } = this.state;
- if (tokenIsKeyword(type) && this.state.containsEsc) {
- this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
- reservedWord: tokenLabelName(type)
- });
- }
- }
- raise(toParseError, at, details = {}) {
- const loc = at instanceof Position ? at : at.loc.start;
- const error = toParseError(loc, details);
- if (!(this.optionFlags & 2048)) throw error;
- if (!this.isLookahead) this.state.errors.push(error);
- return error;
- }
- raiseOverwrite(toParseError, at, details = {}) {
- const loc = at instanceof Position ? at : at.loc.start;
- const pos = loc.index;
- const errors = this.state.errors;
- for (let i = errors.length - 1; i >= 0; i--) {
- const error = errors[i];
- if (error.loc.index === pos) {
- return errors[i] = toParseError(loc, details);
+ superProp.replaceWith(call);
}
- if (error.loc.index < pos) break;
- }
- return this.raise(toParseError, at, details);
- }
- updateContext(prevType) {}
- unexpected(loc, type) {
- throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, {
- expected: type ? tokenLabelName(type) : null
- });
- }
- expectPlugin(pluginName, loc) {
- if (this.hasPlugin(pluginName)) {
- return true;
- }
- throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
- missingPlugin: [pluginName]
});
}
- expectOnePlugin(pluginNames) {
- if (!pluginNames.some(name => this.hasPlugin(name))) {
- throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
- missingPlugin: pluginNames
+ let thisBinding;
+ if (thisPaths.length > 0 || !noNewArrows) {
+ thisBinding = getThisBinding(thisEnvFn, inConstructor);
+ if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) {
+ thisPaths.forEach(thisChild => {
+ const thisRef = thisChild.isJSX() ? jsxIdentifier(thisBinding) : identifier(thisBinding);
+ thisRef.loc = thisChild.node.loc;
+ thisChild.replaceWith(thisRef);
});
+ if (!noNewArrows) thisBinding = null;
}
}
- errorBuilder(error) {
- return (pos, lineStart, curLine) => {
- this.raise(error, buildPosition(pos, lineStart, curLine));
- };
- }
+ return {
+ thisBinding,
+ fnPath
+ };
}
-class ClassScope {
- constructor() {
- this.privateNames = new Set();
- this.loneAccessors = new Map();
- this.undefinedPrivateNames = new Map();
- }
+function isLogicalOp(op) {
+ return LOGICAL_OPERATORS.includes(op);
}
-class ClassScopeHandler {
- constructor(parser) {
- this.parser = void 0;
- this.stack = [];
- this.undefinedPrivateNames = new Map();
- this.parser = parser;
- }
- current() {
- return this.stack[this.stack.length - 1];
- }
- enter() {
- this.stack.push(new ClassScope());
- }
- exit() {
- const oldClassScope = this.stack.pop();
- const current = this.current();
- for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) {
- if (current) {
- if (!current.undefinedPrivateNames.has(name)) {
- current.undefinedPrivateNames.set(name, loc);
- }
- } else {
- this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
- identifierName: name
- });
- }
+function standardizeSuperProperty(superProp) {
+ if (superProp.parentPath.isAssignmentExpression() && superProp.parentPath.node.operator !== "=") {
+ const assignmentPath = superProp.parentPath;
+ const op = assignmentPath.node.operator.slice(0, -1);
+ const value = assignmentPath.node.right;
+ const isLogicalAssignment = isLogicalOp(op);
+ if (superProp.node.computed) {
+ const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
+ const object = superProp.node.object;
+ const property = superProp.node.property;
+ assignmentPath.get("left").replaceWith(memberExpression(object, assignmentExpression("=", tmp, property), true));
+ assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(tmp.name), true), value));
+ } else {
+ const object = superProp.node.object;
+ const property = superProp.node.property;
+ assignmentPath.get("left").replaceWith(memberExpression(object, property));
+ assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(property.name)), value));
}
- }
- declarePrivateName(name, elementType, loc) {
- const {
- privateNames,
- loneAccessors,
- undefinedPrivateNames
- } = this.current();
- let redefined = privateNames.has(name);
- if (elementType & 3) {
- const accessor = redefined && loneAccessors.get(name);
- if (accessor) {
- const oldStatic = accessor & 4;
- const newStatic = elementType & 4;
- const oldKind = accessor & 3;
- const newKind = elementType & 3;
- redefined = oldKind === newKind || oldStatic !== newStatic;
- if (!redefined) loneAccessors.delete(name);
- } else if (!redefined) {
- loneAccessors.set(name, elementType);
- }
- }
- if (redefined) {
- this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
- identifierName: name
- });
+ if (isLogicalAssignment) {
+ assignmentPath.replaceWith(logicalExpression(op, assignmentPath.node.left, assignmentPath.node.right));
+ } else {
+ assignmentPath.node.operator = "=";
}
- privateNames.add(name);
- undefinedPrivateNames.delete(name);
- }
- usePrivateName(name, loc) {
- let classScope;
- for (classScope of this.stack) {
- if (classScope.privateNames.has(name)) return;
+ return [assignmentPath.get("left"), assignmentPath.get("right").get("left")];
+ } else if (superProp.parentPath.isUpdateExpression()) {
+ const updateExpr = superProp.parentPath;
+ const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
+ const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
+ const parts = [assignmentExpression("=", tmp, memberExpression(superProp.node.object, computedKey ? assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), assignmentExpression("=", memberExpression(superProp.node.object, computedKey ? identifier(computedKey.name) : superProp.node.property, superProp.node.computed), binaryExpression(superProp.parentPath.node.operator[0], identifier(tmp.name), numericLiteral(1)))];
+ if (!superProp.parentPath.node.prefix) {
+ parts.push(identifier(tmp.name));
}
- if (classScope) {
- classScope.undefinedPrivateNames.set(name, loc);
+ updateExpr.replaceWith(sequenceExpression(parts));
+ const left = updateExpr.get("expressions.0.right");
+ const right = updateExpr.get("expressions.1.left");
+ return [left, right];
+ }
+ return [superProp];
+ function rightExpression(op, left, right) {
+ if (op === "=") {
+ return assignmentExpression("=", left, right);
} else {
- this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
- identifierName: name
- });
+ return binaryExpression(op, left, right);
}
}
}
-class ExpressionScope {
- constructor(type = 0) {
- this.type = type;
- }
- canBeArrowParameterDeclaration() {
- return this.type === 2 || this.type === 1;
- }
- isCertainlyParameterDeclaration() {
- return this.type === 3;
- }
+function hasSuperClass(thisEnvFn) {
+ return thisEnvFn.isClassMethod() && !!thisEnvFn.parentPath.parentPath.node.superClass;
}
-class ArrowHeadParsingScope extends ExpressionScope {
- constructor(type) {
- super(type);
- this.declarationErrors = new Map();
- }
- recordDeclarationError(ParsingErrorClass, at) {
- const index = at.index;
- this.declarationErrors.set(index, [ParsingErrorClass, at]);
- }
- clearDeclarationError(index) {
- this.declarationErrors.delete(index);
- }
- iterateErrors(iterator) {
- this.declarationErrors.forEach(iterator);
+const assignSuperThisVisitor = (0, _visitors.merge)([{
+ CallExpression(child, {
+ supers,
+ thisBinding
+ }) {
+ if (!child.get("callee").isSuper()) return;
+ if (supers.has(child.node)) return;
+ supers.add(child.node);
+ child.replaceWithMultiple([child.node, assignmentExpression("=", identifier(thisBinding), identifier("this"))]);
}
+}, _helperEnvironmentVisitor.default]);
+function getThisBinding(thisEnvFn, inConstructor) {
+ return getBinding(thisEnvFn, "this", thisBinding => {
+ if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();
+ thisEnvFn.traverse(assignSuperThisVisitor, {
+ supers: new WeakSet(),
+ thisBinding
+ });
+ });
}
-class ExpressionScopeHandler {
- constructor(parser) {
- this.parser = void 0;
- this.stack = [new ExpressionScope()];
- this.parser = parser;
- }
- enter(scope) {
- this.stack.push(scope);
- }
- exit() {
- this.stack.pop();
- }
- recordParameterInitializerError(toParseError, node) {
- const origin = node.loc.start;
- const {
- stack
- } = this;
- let i = stack.length - 1;
- let scope = stack[i];
- while (!scope.isCertainlyParameterDeclaration()) {
- if (scope.canBeArrowParameterDeclaration()) {
- scope.recordDeclarationError(toParseError, origin);
- } else {
- return;
- }
- scope = stack[--i];
+function getSuperBinding(thisEnvFn) {
+ return getBinding(thisEnvFn, "supercall", () => {
+ const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
+ return arrowFunctionExpression([restElement(argsBinding)], callExpression(_super(), [spreadElement(identifier(argsBinding.name))]));
+ });
+}
+function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
+ const op = isAssignment ? "set" : "get";
+ return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => {
+ const argsList = [];
+ let fnBody;
+ if (propName) {
+ fnBody = memberExpression(_super(), identifier(propName));
+ } else {
+ const method = thisEnvFn.scope.generateUidIdentifier("prop");
+ argsList.unshift(method);
+ fnBody = memberExpression(_super(), identifier(method.name), true);
+ }
+ if (isAssignment) {
+ const valueIdent = thisEnvFn.scope.generateUidIdentifier("value");
+ argsList.push(valueIdent);
+ fnBody = assignmentExpression("=", fnBody, identifier(valueIdent.name));
}
- this.parser.raise(toParseError, origin);
+ return arrowFunctionExpression(argsList, fnBody);
+ });
+}
+function getBinding(thisEnvFn, key, init) {
+ const cacheKey = "binding:" + key;
+ let data = thisEnvFn.getData(cacheKey);
+ if (!data) {
+ const id = thisEnvFn.scope.generateUidIdentifier(key);
+ data = id.name;
+ thisEnvFn.setData(cacheKey, data);
+ thisEnvFn.scope.push({
+ id: id,
+ init: init(data)
+ });
}
- recordArrowParameterBindingError(error, node) {
- const {
- stack
- } = this;
- const scope = stack[stack.length - 1];
- const origin = node.loc.start;
- if (scope.isCertainlyParameterDeclaration()) {
- this.parser.raise(error, origin);
- } else if (scope.canBeArrowParameterDeclaration()) {
- scope.recordDeclarationError(error, origin);
- } else {
+ return data;
+}
+const getScopeInformationVisitor = (0, _visitors.merge)([{
+ ThisExpression(child, {
+ thisPaths
+ }) {
+ thisPaths.push(child);
+ },
+ JSXIdentifier(child, {
+ thisPaths
+ }) {
+ if (child.node.name !== "this") return;
+ if (!child.parentPath.isJSXMemberExpression({
+ object: child.node
+ }) && !child.parentPath.isJSXOpeningElement({
+ name: child.node
+ })) {
return;
}
- }
- recordAsyncArrowParametersError(at) {
- const {
- stack
- } = this;
- let i = stack.length - 1;
- let scope = stack[i];
- while (scope.canBeArrowParameterDeclaration()) {
- if (scope.type === 2) {
- scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
+ thisPaths.push(child);
+ },
+ CallExpression(child, {
+ superCalls
+ }) {
+ if (child.get("callee").isSuper()) superCalls.push(child);
+ },
+ MemberExpression(child, {
+ superProps
+ }) {
+ if (child.get("object").isSuper()) superProps.push(child);
+ },
+ Identifier(child, {
+ argumentsPaths
+ }) {
+ if (!child.isReferencedIdentifier({
+ name: "arguments"
+ })) return;
+ let curr = child.scope;
+ do {
+ if (curr.hasOwnBinding("arguments")) {
+ curr.rename("arguments");
+ return;
}
- scope = stack[--i];
- }
- }
- validateAsPattern() {
- const {
- stack
- } = this;
- const currentScope = stack[stack.length - 1];
- if (!currentScope.canBeArrowParameterDeclaration()) return;
- currentScope.iterateErrors(([toParseError, loc]) => {
- this.parser.raise(toParseError, loc);
- let i = stack.length - 2;
- let scope = stack[i];
- while (scope.canBeArrowParameterDeclaration()) {
- scope.clearDeclarationError(loc.index);
- scope = stack[--i];
+ if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {
+ break;
}
- });
+ } while (curr = curr.parent);
+ argumentsPaths.push(child);
+ },
+ MetaProperty(child, {
+ newTargetPaths
+ }) {
+ if (!child.get("meta").isIdentifier({
+ name: "new"
+ })) return;
+ if (!child.get("property").isIdentifier({
+ name: "target"
+ })) return;
+ newTargetPaths.push(child);
}
+}, _helperEnvironmentVisitor.default]);
+function getScopeInformation(fnPath) {
+ const thisPaths = [];
+ const argumentsPaths = [];
+ const newTargetPaths = [];
+ const superProps = [];
+ const superCalls = [];
+ fnPath.traverse(getScopeInformationVisitor, {
+ thisPaths,
+ argumentsPaths,
+ newTargetPaths,
+ superProps,
+ superCalls
+ });
+ return {
+ thisPaths,
+ argumentsPaths,
+ newTargetPaths,
+ superProps,
+ superCalls
+ };
}
-function newParameterDeclarationScope() {
- return new ExpressionScope(3);
-}
-function newArrowHeadScope() {
- return new ArrowHeadParsingScope(1);
+
+//# sourceMappingURL=conversion.js.map
+
+
+/***/ }),
+
+/***/ 7969:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.evaluate = evaluate;
+exports.evaluateTruthy = evaluateTruthy;
+const VALID_OBJECT_CALLEES = ["Number", "String", "Math"];
+const VALID_IDENTIFIER_CALLEES = ["isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", null, null];
+const INVALID_METHODS = ["random"];
+function isValidObjectCallee(val) {
+ return VALID_OBJECT_CALLEES.includes(val);
}
-function newAsyncArrowScope() {
- return new ArrowHeadParsingScope(2);
+function isValidIdentifierCallee(val) {
+ return VALID_IDENTIFIER_CALLEES.includes(val);
}
-function newExpressionScope() {
- return new ExpressionScope();
+function isInvalidMethod(val) {
+ return INVALID_METHODS.includes(val);
}
-class ProductionParameterHandler {
- constructor() {
- this.stacks = [];
- }
- enter(flags) {
- this.stacks.push(flags);
- }
- exit() {
- this.stacks.pop();
- }
- currentFlags() {
- return this.stacks[this.stacks.length - 1];
- }
- get hasAwait() {
- return (this.currentFlags() & 2) > 0;
- }
- get hasYield() {
- return (this.currentFlags() & 1) > 0;
- }
- get hasReturn() {
- return (this.currentFlags() & 4) > 0;
- }
- get hasIn() {
- return (this.currentFlags() & 8) > 0;
- }
+function evaluateTruthy() {
+ const res = this.evaluate();
+ if (res.confident) return !!res.value;
}
-function functionFlags(isAsync, isGenerator) {
- return (isAsync ? 2 : 0) | (isGenerator ? 1 : 0);
+function deopt(path, state) {
+ if (!state.confident) return;
+ state.deoptPath = path;
+ state.confident = false;
}
-class UtilParser extends Tokenizer {
- addExtra(node, key, value, enumerable = true) {
- if (!node) return;
- let {
- extra
- } = node;
- if (extra == null) {
- extra = {};
- node.extra = extra;
- }
- if (enumerable) {
- extra[key] = value;
+const Globals = new Map([["undefined", undefined], ["Infinity", Infinity], ["NaN", NaN]]);
+function evaluateCached(path, state) {
+ const {
+ node
+ } = path;
+ const {
+ seen
+ } = state;
+ if (seen.has(node)) {
+ const existing = seen.get(node);
+ if (existing.resolved) {
+ return existing.value;
} else {
- Object.defineProperty(extra, key, {
- enumerable,
- value
- });
+ deopt(path, state);
+ return;
+ }
+ } else {
+ const item = {
+ resolved: false
+ };
+ seen.set(node, item);
+ const val = _evaluate(path, state);
+ if (state.confident) {
+ item.resolved = true;
+ item.value = val;
}
+ return val;
}
- isContextual(token) {
- return this.state.type === token && !this.state.containsEsc;
+}
+function _evaluate(path, state) {
+ if (!state.confident) return;
+ if (path.isSequenceExpression()) {
+ const exprs = path.get("expressions");
+ return evaluateCached(exprs[exprs.length - 1], state);
}
- isUnparsedContextual(nameStart, name) {
- const nameEnd = nameStart + name.length;
- if (this.input.slice(nameStart, nameEnd) === name) {
- const nextCh = this.input.charCodeAt(nameEnd);
- return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
- }
- return false;
+ if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
+ return path.node.value;
}
- isLookaheadContextual(name) {
- const next = this.nextTokenStart();
- return this.isUnparsedContextual(next, name);
+ if (path.isNullLiteral()) {
+ return null;
}
- eatContextual(token) {
- if (this.isContextual(token)) {
- this.next();
- return true;
- }
- return false;
+ if (path.isTemplateLiteral()) {
+ return evaluateQuasis(path, path.node.quasis, state);
}
- expectContextual(token, toParseError) {
- if (!this.eatContextual(token)) {
- if (toParseError != null) {
- throw this.raise(toParseError, this.state.startLoc);
+ if (path.isTaggedTemplateExpression() && path.get("tag").isMemberExpression()) {
+ const object = path.get("tag.object");
+ const {
+ node: {
+ name
}
- this.unexpected(null, token);
+ } = object;
+ const property = path.get("tag.property");
+ if (object.isIdentifier() && name === "String" && !path.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
+ return evaluateQuasis(path, path.node.quasi.quasis, state, true);
}
}
- canInsertSemicolon() {
- return this.match(140) || this.match(8) || this.hasPrecedingLineBreak();
- }
- hasPrecedingLineBreak() {
- return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
- }
- hasFollowingLineBreak() {
- return hasNewLine(this.input, this.state.end, this.nextTokenStart());
- }
- isLineTerminator() {
- return this.eat(13) || this.canInsertSemicolon();
- }
- semicolon(allowAsi = true) {
- if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
- this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
- }
- expect(type, loc) {
- if (!this.eat(type)) {
- this.unexpected(loc, type);
- }
- }
- tryParse(fn, oldState = this.state.clone()) {
- const abortSignal = {
- node: null
- };
- try {
- const node = fn((node = null) => {
- abortSignal.node = node;
- throw abortSignal;
- });
- if (this.state.errors.length > oldState.errors.length) {
- const failState = this.state;
- this.state = oldState;
- this.state.tokensLength = failState.tokensLength;
- return {
- node,
- error: failState.errors[oldState.errors.length],
- thrown: false,
- aborted: false,
- failState
- };
- }
- return {
- node,
- error: null,
- thrown: false,
- aborted: false,
- failState: null
- };
- } catch (error) {
- const failState = this.state;
- this.state = oldState;
- if (error instanceof SyntaxError) {
- return {
- node: null,
- error,
- thrown: true,
- aborted: false,
- failState
- };
- }
- if (error === abortSignal) {
- return {
- node: abortSignal.node,
- error: null,
- thrown: false,
- aborted: true,
- failState
- };
- }
- throw error;
- }
- }
- checkExpressionErrors(refExpressionErrors, andThrow) {
- if (!refExpressionErrors) return false;
- const {
- shorthandAssignLoc,
- doubleProtoLoc,
- privateKeyLoc,
- optionalParametersLoc
- } = refExpressionErrors;
- const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
- if (!andThrow) {
- return hasErrors;
- }
- if (shorthandAssignLoc != null) {
- this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
- }
- if (doubleProtoLoc != null) {
- this.raise(Errors.DuplicateProto, doubleProtoLoc);
- }
- if (privateKeyLoc != null) {
- this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
- }
- if (optionalParametersLoc != null) {
- this.unexpected(optionalParametersLoc);
- }
- }
- isLiteralPropertyName() {
- return tokenIsLiteralPropertyName(this.state.type);
- }
- isPrivateName(node) {
- return node.type === "PrivateName";
- }
- getPrivateNameSV(node) {
- return node.id.name;
- }
- hasPropertyAsPrivateName(node) {
- return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property);
- }
- isObjectProperty(node) {
- return node.type === "ObjectProperty";
- }
- isObjectMethod(node) {
- return node.type === "ObjectMethod";
- }
- initializeScopes(inModule = this.options.sourceType === "module") {
- const oldLabels = this.state.labels;
- this.state.labels = [];
- const oldExportedIdentifiers = this.exportedIdentifiers;
- this.exportedIdentifiers = new Set();
- const oldInModule = this.inModule;
- this.inModule = inModule;
- const oldScope = this.scope;
- const ScopeHandler = this.getScopeHandler();
- this.scope = new ScopeHandler(this, inModule);
- const oldProdParam = this.prodParam;
- this.prodParam = new ProductionParameterHandler();
- const oldClassScope = this.classScope;
- this.classScope = new ClassScopeHandler(this);
- const oldExpressionScope = this.expressionScope;
- this.expressionScope = new ExpressionScopeHandler(this);
- return () => {
- this.state.labels = oldLabels;
- this.exportedIdentifiers = oldExportedIdentifiers;
- this.inModule = oldInModule;
- this.scope = oldScope;
- this.prodParam = oldProdParam;
- this.classScope = oldClassScope;
- this.expressionScope = oldExpressionScope;
- };
- }
- enterInitialScopes() {
- let paramFlags = 0;
- if (this.inModule) {
- paramFlags |= 2;
- }
- if (this.optionFlags & 32) {
- paramFlags |= 1;
- }
- this.scope.enter(1);
- this.prodParam.enter(paramFlags);
- }
- checkDestructuringPrivate(refExpressionErrors) {
- const {
- privateKeyLoc
- } = refExpressionErrors;
- if (privateKeyLoc !== null) {
- this.expectPlugin("destructuringPrivate", privateKeyLoc);
- }
- }
-}
-class ExpressionErrors {
- constructor() {
- this.shorthandAssignLoc = null;
- this.doubleProtoLoc = null;
- this.privateKeyLoc = null;
- this.optionalParametersLoc = null;
- }
-}
-class Node {
- constructor(parser, pos, loc) {
- this.type = "";
- this.start = pos;
- this.end = 0;
- this.loc = new SourceLocation(loc);
- if ((parser == null ? void 0 : parser.optionFlags) & 128) this.range = [pos, 0];
- if (parser != null && parser.filename) this.loc.filename = parser.filename;
- }
-}
-const NodePrototype = Node.prototype;
-{
- NodePrototype.__clone = function () {
- const newNode = new Node(undefined, this.start, this.loc.start);
- const keys = Object.keys(this);
- for (let i = 0, length = keys.length; i < length; i++) {
- const key = keys[i];
- if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") {
- newNode[key] = this[key];
- }
- }
- return newNode;
- };
-}
-function clonePlaceholder(node) {
- return cloneIdentifier(node);
-}
-function cloneIdentifier(node) {
- const {
- type,
- start,
- end,
- loc,
- range,
- extra,
- name
- } = node;
- const cloned = Object.create(NodePrototype);
- cloned.type = type;
- cloned.start = start;
- cloned.end = end;
- cloned.loc = loc;
- cloned.range = range;
- cloned.extra = extra;
- cloned.name = name;
- if (type === "Placeholder") {
- cloned.expectedNode = node.expectedNode;
- }
- return cloned;
-}
-function cloneStringLiteral(node) {
- const {
- type,
- start,
- end,
- loc,
- range,
- extra
- } = node;
- if (type === "Placeholder") {
- return clonePlaceholder(node);
- }
- const cloned = Object.create(NodePrototype);
- cloned.type = type;
- cloned.start = start;
- cloned.end = end;
- cloned.loc = loc;
- cloned.range = range;
- if (node.raw !== undefined) {
- cloned.raw = node.raw;
- } else {
- cloned.extra = extra;
- }
- cloned.value = node.value;
- return cloned;
-}
-class NodeUtils extends UtilParser {
- startNode() {
- const loc = this.state.startLoc;
- return new Node(this, loc.index, loc);
- }
- startNodeAt(loc) {
- return new Node(this, loc.index, loc);
- }
- startNodeAtNode(type) {
- return this.startNodeAt(type.loc.start);
- }
- finishNode(node, type) {
- return this.finishNodeAt(node, type, this.state.lastTokEndLoc);
- }
- finishNodeAt(node, type, endLoc) {
- node.type = type;
- node.end = endLoc.index;
- node.loc.end = endLoc;
- if (this.optionFlags & 128) node.range[1] = endLoc.index;
- if (this.optionFlags & 4096) {
- this.processComment(node);
+ if (path.isConditionalExpression()) {
+ const testResult = evaluateCached(path.get("test"), state);
+ if (!state.confident) return;
+ if (testResult) {
+ return evaluateCached(path.get("consequent"), state);
+ } else {
+ return evaluateCached(path.get("alternate"), state);
}
- return node;
- }
- resetStartLocation(node, startLoc) {
- node.start = startLoc.index;
- node.loc.start = startLoc;
- if (this.optionFlags & 128) node.range[0] = startLoc.index;
- }
- resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
- node.end = endLoc.index;
- node.loc.end = endLoc;
- if (this.optionFlags & 128) node.range[1] = endLoc.index;
- }
- resetStartLocationFromNode(node, locationNode) {
- this.resetStartLocation(node, locationNode.loc.start);
- }
-}
-const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
-const FlowErrors = ParseErrorEnum`flow`({
- AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
- AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
- AssignReservedType: ({
- reservedType
- }) => `Cannot overwrite reserved type ${reservedType}.`,
- DeclareClassElement: "The `declare` modifier can only appear on class fields.",
- DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
- DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
- EnumBooleanMemberNotInitialized: ({
- memberName,
- enumName
- }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,
- EnumDuplicateMemberName: ({
- memberName,
- enumName
- }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,
- EnumInconsistentMemberValues: ({
- enumName
- }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,
- EnumInvalidExplicitType: ({
- invalidEnumType,
- enumName
- }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
- EnumInvalidExplicitTypeUnknownSupplied: ({
- enumName
- }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
- EnumInvalidMemberInitializerPrimaryType: ({
- enumName,
- memberName,
- explicitType
- }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,
- EnumInvalidMemberInitializerSymbolType: ({
- enumName,
- memberName
- }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,
- EnumInvalidMemberInitializerUnknownType: ({
- enumName,
- memberName
- }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,
- EnumInvalidMemberName: ({
- enumName,
- memberName,
- suggestion
- }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,
- EnumNumberMemberNotInitialized: ({
- enumName,
- memberName
- }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,
- EnumStringMemberInconsistentlyInitialized: ({
- enumName
- }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,
- GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
- ImportReflectionHasImportType: "An `import module` declaration can not use `type` or `typeof` keyword.",
- ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
- InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
- InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
- InexactVariance: "Explicit inexact syntax cannot have variance.",
- InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
- MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
- NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
- NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
- PatternIsOptional: Object.assign({
- message: "A binding pattern parameter cannot be optional in an implementation signature."
- }, {
- reasonCode: "OptionalBindingPattern"
- }),
- SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
- SpreadVariance: "Spread properties cannot have variance.",
- ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
- ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
- ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
- ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
- ThisParamNoDefault: "The `this` parameter may not have a default value.",
- TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
- TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
- UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
- UnexpectedReservedType: ({
- reservedType
- }) => `Unexpected reserved type ${reservedType}.`,
- UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
- UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
- UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
- UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".',
- UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
- UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.",
- UnsupportedDeclareExportKind: ({
- unsupportedExportKind,
- suggestion
- }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,
- UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
- UnterminatedFlowComment: "Unterminated flow-comment."
-});
-function isEsModuleType(bodyElement) {
- return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
-}
-function hasTypeImportKind(node) {
- return node.importKind === "type" || node.importKind === "typeof";
-}
-const exportSuggestions = {
- const: "declare export var",
- let: "declare export var",
- type: "export type",
- interface: "export interface"
-};
-function partition(list, test) {
- const list1 = [];
- const list2 = [];
- for (let i = 0; i < list.length; i++) {
- (test(list[i], i, list) ? list1 : list2).push(list[i]);
}
- return [list1, list2];
-}
-const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
-var flow = superClass => class FlowParserMixin extends superClass {
- constructor(...args) {
- super(...args);
- this.flowPragma = undefined;
- }
- getScopeHandler() {
- return FlowScopeHandler;
- }
- shouldParseTypes() {
- return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
+ if (path.isExpressionWrapper()) {
+ return evaluateCached(path.get("expression"), state);
}
- finishToken(type, val) {
- if (type !== 134 && type !== 13 && type !== 28) {
- if (this.flowPragma === undefined) {
- this.flowPragma = null;
+ if (path.isMemberExpression() && !path.parentPath.isCallExpression({
+ callee: path.node
+ })) {
+ const property = path.get("property");
+ const object = path.get("object");
+ if (object.isLiteral()) {
+ const value = object.node.value;
+ const type = typeof value;
+ let key = null;
+ if (path.node.computed) {
+ key = evaluateCached(property, state);
+ if (!state.confident) return;
+ } else if (property.isIdentifier()) {
+ key = property.node.name;
}
- }
- super.finishToken(type, val);
- }
- addComment(comment) {
- if (this.flowPragma === undefined) {
- const matches = FLOW_PRAGMA_REGEX.exec(comment.value);
- if (!matches) ;else if (matches[1] === "flow") {
- this.flowPragma = "flow";
- } else if (matches[1] === "noflow") {
- this.flowPragma = "noflow";
- } else {
- throw new Error("Unexpected flow pragma");
+ if ((type === "number" || type === "string") && key != null && (typeof key === "number" || typeof key === "string")) {
+ return value[key];
}
}
- super.addComment(comment);
- }
- flowParseTypeInitialiser(tok) {
- const oldInType = this.state.inType;
- this.state.inType = true;
- this.expect(tok || 14);
- const type = this.flowParseType();
- this.state.inType = oldInType;
- return type;
- }
- flowParsePredicate() {
- const node = this.startNode();
- const moduloLoc = this.state.startLoc;
- this.next();
- this.expectContextual(110);
- if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
- this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
- }
- if (this.eat(10)) {
- node.value = super.parseExpression();
- this.expect(11);
- return this.finishNode(node, "DeclaredPredicate");
- } else {
- return this.finishNode(node, "InferredPredicate");
- }
- }
- flowParseTypeAndPredicateInitialiser() {
- const oldInType = this.state.inType;
- this.state.inType = true;
- this.expect(14);
- let type = null;
- let predicate = null;
- if (this.match(54)) {
- this.state.inType = oldInType;
- predicate = this.flowParsePredicate();
- } else {
- type = this.flowParseType();
- this.state.inType = oldInType;
- if (this.match(54)) {
- predicate = this.flowParsePredicate();
- }
- }
- return [type, predicate];
- }
- flowParseDeclareClass(node) {
- this.next();
- this.flowParseInterfaceish(node, true);
- return this.finishNode(node, "DeclareClass");
- }
- flowParseDeclareFunction(node) {
- this.next();
- const id = node.id = this.parseIdentifier();
- const typeNode = this.startNode();
- const typeContainer = this.startNode();
- if (this.match(47)) {
- typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
- } else {
- typeNode.typeParameters = null;
- }
- this.expect(10);
- const tmp = this.flowParseFunctionTypeParams();
- typeNode.params = tmp.params;
- typeNode.rest = tmp.rest;
- typeNode.this = tmp._this;
- this.expect(11);
- [typeNode.returnType, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
- typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
- id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
- this.resetEndLocation(id);
- this.semicolon();
- this.scope.declareName(node.id.name, 2048, node.id.loc.start);
- return this.finishNode(node, "DeclareFunction");
- }
- flowParseDeclare(node, insideModule) {
- if (this.match(80)) {
- return this.flowParseDeclareClass(node);
- } else if (this.match(68)) {
- return this.flowParseDeclareFunction(node);
- } else if (this.match(74)) {
- return this.flowParseDeclareVariable(node);
- } else if (this.eatContextual(127)) {
- if (this.match(16)) {
- return this.flowParseDeclareModuleExports(node);
- } else {
- if (insideModule) {
- this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
- }
- return this.flowParseDeclareModule(node);
- }
- } else if (this.isContextual(130)) {
- return this.flowParseDeclareTypeAlias(node);
- } else if (this.isContextual(131)) {
- return this.flowParseDeclareOpaqueType(node);
- } else if (this.isContextual(129)) {
- return this.flowParseDeclareInterface(node);
- } else if (this.match(82)) {
- return this.flowParseDeclareExportDeclaration(node, insideModule);
- } else {
- this.unexpected();
- }
- }
- flowParseDeclareVariable(node) {
- this.next();
- node.id = this.flowParseTypeAnnotatableIdentifier(true);
- this.scope.declareName(node.id.name, 5, node.id.loc.start);
- this.semicolon();
- return this.finishNode(node, "DeclareVariable");
}
- flowParseDeclareModule(node) {
- this.scope.enter(0);
- if (this.match(134)) {
- node.id = super.parseExprAtom();
- } else {
- node.id = this.parseIdentifier();
- }
- const bodyNode = node.body = this.startNode();
- const body = bodyNode.body = [];
- this.expect(5);
- while (!this.match(8)) {
- let bodyNode = this.startNode();
- if (this.match(83)) {
- this.next();
- if (!this.isContextual(130) && !this.match(87)) {
- this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
- }
- super.parseImport(bodyNode);
- } else {
- this.expectContextual(125, FlowErrors.UnsupportedStatementInDeclareModule);
- bodyNode = this.flowParseDeclare(bodyNode, true);
- }
- body.push(bodyNode);
- }
- this.scope.exit();
- this.expect(8);
- this.finishNode(bodyNode, "BlockStatement");
- let kind = null;
- let hasModuleExport = false;
- body.forEach(bodyElement => {
- if (isEsModuleType(bodyElement)) {
- if (kind === "CommonJS") {
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
- }
- kind = "ES";
- } else if (bodyElement.type === "DeclareModuleExports") {
- if (hasModuleExport) {
- this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
- }
- if (kind === "ES") {
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
- }
- kind = "CommonJS";
- hasModuleExport = true;
- }
- });
- node.kind = kind || "CommonJS";
- return this.finishNode(node, "DeclareModule");
- }
- flowParseDeclareExportDeclaration(node, insideModule) {
- this.expect(82);
- if (this.eat(65)) {
- if (this.match(68) || this.match(80)) {
- node.declaration = this.flowParseDeclare(this.startNode());
- } else {
- node.declaration = this.flowParseType();
- this.semicolon();
- }
- node.default = true;
- return this.finishNode(node, "DeclareExportDeclaration");
- } else {
- if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
- const label = this.state.value;
- throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
- unsupportedExportKind: label,
- suggestion: exportSuggestions[label]
- });
+ if (path.isReferencedIdentifier()) {
+ const binding = path.scope.getBinding(path.node.name);
+ if (binding) {
+ if (binding.constantViolations.length > 0 || path.node.start < binding.path.node.end) {
+ deopt(binding.path, state);
+ return;
}
- if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(131)) {
- node.declaration = this.flowParseDeclare(this.startNode());
- node.default = false;
- return this.finishNode(node, "DeclareExportDeclaration");
- } else if (this.match(55) || this.match(5) || this.isContextual(129) || this.isContextual(130) || this.isContextual(131)) {
- node = this.parseExport(node, null);
- if (node.type === "ExportNamedDeclaration") {
- node.type = "ExportDeclaration";
- node.default = false;
- delete node.exportKind;
- }
- node.type = "Declare" + node.type;
- return node;
+ if (binding.hasValue) {
+ return binding.value;
}
}
- this.unexpected();
- }
- flowParseDeclareModuleExports(node) {
- this.next();
- this.expectContextual(111);
- node.typeAnnotation = this.flowParseTypeAnnotation();
- this.semicolon();
- return this.finishNode(node, "DeclareModuleExports");
- }
- flowParseDeclareTypeAlias(node) {
- this.next();
- const finished = this.flowParseTypeAlias(node);
- finished.type = "DeclareTypeAlias";
- return finished;
- }
- flowParseDeclareOpaqueType(node) {
- this.next();
- const finished = this.flowParseOpaqueType(node, true);
- finished.type = "DeclareOpaqueType";
- return finished;
- }
- flowParseDeclareInterface(node) {
- this.next();
- this.flowParseInterfaceish(node, false);
- return this.finishNode(node, "DeclareInterface");
- }
- flowParseInterfaceish(node, isClass) {
- node.id = this.flowParseRestrictedIdentifier(!isClass, true);
- this.scope.declareName(node.id.name, isClass ? 17 : 8201, node.id.loc.start);
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- } else {
- node.typeParameters = null;
- }
- node.extends = [];
- if (this.eat(81)) {
- do {
- node.extends.push(this.flowParseInterfaceExtends());
- } while (!isClass && this.eat(12));
- }
- if (isClass) {
- node.implements = [];
- node.mixins = [];
- if (this.eatContextual(117)) {
- do {
- node.mixins.push(this.flowParseInterfaceExtends());
- } while (this.eat(12));
- }
- if (this.eatContextual(113)) {
- do {
- node.implements.push(this.flowParseInterfaceExtends());
- } while (this.eat(12));
+ const name = path.node.name;
+ if (Globals.has(name)) {
+ if (!binding) {
+ return Globals.get(name);
}
+ deopt(binding.path, state);
+ return;
}
- node.body = this.flowParseObjectType({
- allowStatic: isClass,
- allowExact: false,
- allowSpread: false,
- allowProto: isClass,
- allowInexact: false
- });
- }
- flowParseInterfaceExtends() {
- const node = this.startNode();
- node.id = this.flowParseQualifiedTypeIdentifier();
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterInstantiation();
+ const resolved = path.resolve();
+ if (resolved === path) {
+ deopt(path, state);
+ return;
} else {
- node.typeParameters = null;
- }
- return this.finishNode(node, "InterfaceExtends");
- }
- flowParseInterface(node) {
- this.flowParseInterfaceish(node, false);
- return this.finishNode(node, "InterfaceDeclaration");
- }
- checkNotUnderscore(word) {
- if (word === "_") {
- this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
+ return evaluateCached(resolved, state);
}
}
- checkReservedType(word, startLoc, declaration) {
- if (!reservedTypes.has(word)) return;
- this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
- reservedType: word
- });
- }
- flowParseRestrictedIdentifier(liberal, declaration) {
- this.checkReservedType(this.state.value, this.state.startLoc, declaration);
- return this.parseIdentifier(liberal);
- }
- flowParseTypeAlias(node) {
- node.id = this.flowParseRestrictedIdentifier(false, true);
- this.scope.declareName(node.id.name, 8201, node.id.loc.start);
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- } else {
- node.typeParameters = null;
- }
- node.right = this.flowParseTypeInitialiser(29);
- this.semicolon();
- return this.finishNode(node, "TypeAlias");
- }
- flowParseOpaqueType(node, declare) {
- this.expectContextual(130);
- node.id = this.flowParseRestrictedIdentifier(true, true);
- this.scope.declareName(node.id.name, 8201, node.id.loc.start);
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- } else {
- node.typeParameters = null;
- }
- node.supertype = null;
- if (this.match(14)) {
- node.supertype = this.flowParseTypeInitialiser(14);
+ if (path.isUnaryExpression({
+ prefix: true
+ })) {
+ if (path.node.operator === "void") {
+ return undefined;
}
- node.impltype = null;
- if (!declare) {
- node.impltype = this.flowParseTypeInitialiser(29);
+ const argument = path.get("argument");
+ if (path.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
+ return "function";
}
- this.semicolon();
- return this.finishNode(node, "OpaqueType");
- }
- flowParseTypeParameter(requireDefault = false) {
- const nodeStartLoc = this.state.startLoc;
- const node = this.startNode();
- const variance = this.flowParseVariance();
- const ident = this.flowParseTypeAnnotatableIdentifier();
- node.name = ident.name;
- node.variance = variance;
- node.bound = ident.typeAnnotation;
- if (this.match(29)) {
- this.eat(29);
- node.default = this.flowParseType();
- } else {
- if (requireDefault) {
- this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
- }
+ const arg = evaluateCached(argument, state);
+ if (!state.confident) return;
+ switch (path.node.operator) {
+ case "!":
+ return !arg;
+ case "+":
+ return +arg;
+ case "-":
+ return -arg;
+ case "~":
+ return ~arg;
+ case "typeof":
+ return typeof arg;
}
- return this.finishNode(node, "TypeParameter");
}
- flowParseTypeParameterDeclaration() {
- const oldInType = this.state.inType;
- const node = this.startNode();
- node.params = [];
- this.state.inType = true;
- if (this.match(47) || this.match(143)) {
- this.next();
- } else {
- this.unexpected();
- }
- let defaultRequired = false;
- do {
- const typeParameter = this.flowParseTypeParameter(defaultRequired);
- node.params.push(typeParameter);
- if (typeParameter.default) {
- defaultRequired = true;
- }
- if (!this.match(48)) {
- this.expect(12);
- }
- } while (!this.match(48));
- this.expect(48);
- this.state.inType = oldInType;
- return this.finishNode(node, "TypeParameterDeclaration");
- }
- flowInTopLevelContext(cb) {
- if (this.curContext() !== types.brace) {
- const oldContext = this.state.context;
- this.state.context = [oldContext[0]];
- try {
- return cb();
- } finally {
- this.state.context = oldContext;
- }
- } else {
- return cb();
- }
- }
- flowParseTypeParameterInstantiationInExpression() {
- if (this.reScan_lt() !== 47) return;
- return this.flowParseTypeParameterInstantiation();
- }
- flowParseTypeParameterInstantiation() {
- const node = this.startNode();
- const oldInType = this.state.inType;
- this.state.inType = true;
- node.params = [];
- this.flowInTopLevelContext(() => {
- this.expect(47);
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
- this.state.noAnonFunctionType = false;
- while (!this.match(48)) {
- node.params.push(this.flowParseType());
- if (!this.match(48)) {
- this.expect(12);
- }
+ if (path.isArrayExpression()) {
+ const arr = [];
+ const elems = path.get("elements");
+ for (const elem of elems) {
+ const elemValue = elem.evaluate();
+ if (elemValue.confident) {
+ arr.push(elemValue.value);
+ } else {
+ deopt(elemValue.deopt, state);
+ return;
}
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
- });
- this.state.inType = oldInType;
- if (!this.state.inType && this.curContext() === types.brace) {
- this.reScan_lt_gt();
- }
- this.expect(48);
- return this.finishNode(node, "TypeParameterInstantiation");
- }
- flowParseTypeParameterInstantiationCallOrNew() {
- if (this.reScan_lt() !== 47) return;
- const node = this.startNode();
- const oldInType = this.state.inType;
- node.params = [];
- this.state.inType = true;
- this.expect(47);
- while (!this.match(48)) {
- node.params.push(this.flowParseTypeOrImplicitInstantiation());
- if (!this.match(48)) {
- this.expect(12);
- }
- }
- this.expect(48);
- this.state.inType = oldInType;
- return this.finishNode(node, "TypeParameterInstantiation");
- }
- flowParseInterfaceType() {
- const node = this.startNode();
- this.expectContextual(129);
- node.extends = [];
- if (this.eat(81)) {
- do {
- node.extends.push(this.flowParseInterfaceExtends());
- } while (this.eat(12));
- }
- node.body = this.flowParseObjectType({
- allowStatic: false,
- allowExact: false,
- allowSpread: false,
- allowProto: false,
- allowInexact: false
- });
- return this.finishNode(node, "InterfaceTypeAnnotation");
- }
- flowParseObjectPropertyKey() {
- return this.match(135) || this.match(134) ? super.parseExprAtom() : this.parseIdentifier(true);
+ }
+ return arr;
}
- flowParseObjectTypeIndexer(node, isStatic, variance) {
- node.static = isStatic;
- if (this.lookahead().type === 14) {
- node.id = this.flowParseObjectPropertyKey();
- node.key = this.flowParseTypeInitialiser();
- } else {
- node.id = null;
- node.key = this.flowParseType();
- }
- this.expect(3);
- node.value = this.flowParseTypeInitialiser();
- node.variance = variance;
- return this.finishNode(node, "ObjectTypeIndexer");
- }
- flowParseObjectTypeInternalSlot(node, isStatic) {
- node.static = isStatic;
- node.id = this.flowParseObjectPropertyKey();
- this.expect(3);
- this.expect(3);
- if (this.match(47) || this.match(10)) {
- node.method = true;
- node.optional = false;
- node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start));
- } else {
- node.method = false;
- if (this.eat(17)) {
- node.optional = true;
- }
- node.value = this.flowParseTypeInitialiser();
- }
- return this.finishNode(node, "ObjectTypeInternalSlot");
- }
- flowParseObjectTypeMethodish(node) {
- node.params = [];
- node.rest = null;
- node.typeParameters = null;
- node.this = null;
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- }
- this.expect(10);
- if (this.match(78)) {
- node.this = this.flowParseFunctionTypeParam(true);
- node.this.name = null;
- if (!this.match(11)) {
- this.expect(12);
- }
- }
- while (!this.match(11) && !this.match(21)) {
- node.params.push(this.flowParseFunctionTypeParam(false));
- if (!this.match(11)) {
- this.expect(12);
- }
- }
- if (this.eat(21)) {
- node.rest = this.flowParseFunctionTypeParam(false);
- }
- this.expect(11);
- node.returnType = this.flowParseTypeInitialiser();
- return this.finishNode(node, "FunctionTypeAnnotation");
- }
- flowParseObjectTypeCallProperty(node, isStatic) {
- const valueNode = this.startNode();
- node.static = isStatic;
- node.value = this.flowParseObjectTypeMethodish(valueNode);
- return this.finishNode(node, "ObjectTypeCallProperty");
- }
- flowParseObjectType({
- allowStatic,
- allowExact,
- allowSpread,
- allowProto,
- allowInexact
- }) {
- const oldInType = this.state.inType;
- this.state.inType = true;
- const nodeStart = this.startNode();
- nodeStart.callProperties = [];
- nodeStart.properties = [];
- nodeStart.indexers = [];
- nodeStart.internalSlots = [];
- let endDelim;
- let exact;
- let inexact = false;
- if (allowExact && this.match(6)) {
- this.expect(6);
- endDelim = 9;
- exact = true;
- } else {
- this.expect(5);
- endDelim = 8;
- exact = false;
- }
- nodeStart.exact = exact;
- while (!this.match(endDelim)) {
- let isStatic = false;
- let protoStartLoc = null;
- let inexactStartLoc = null;
- const node = this.startNode();
- if (allowProto && this.isContextual(118)) {
- const lookahead = this.lookahead();
- if (lookahead.type !== 14 && lookahead.type !== 17) {
- this.next();
- protoStartLoc = this.state.startLoc;
- allowStatic = false;
- }
- }
- if (allowStatic && this.isContextual(106)) {
- const lookahead = this.lookahead();
- if (lookahead.type !== 14 && lookahead.type !== 17) {
- this.next();
- isStatic = true;
- }
+ if (path.isObjectExpression()) {
+ const obj = {};
+ const props = path.get("properties");
+ for (const prop of props) {
+ if (prop.isObjectMethod() || prop.isSpreadElement()) {
+ deopt(prop, state);
+ return;
}
- const variance = this.flowParseVariance();
- if (this.eat(0)) {
- if (protoStartLoc != null) {
- this.unexpected(protoStartLoc);
- }
- if (this.eat(0)) {
- if (variance) {
- this.unexpected(variance.loc.start);
- }
- nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic));
- } else {
- nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
- }
- } else if (this.match(10) || this.match(47)) {
- if (protoStartLoc != null) {
- this.unexpected(protoStartLoc);
- }
- if (variance) {
- this.unexpected(variance.loc.start);
+ const keyPath = prop.get("key");
+ let key;
+ if (prop.node.computed) {
+ key = keyPath.evaluate();
+ if (!key.confident) {
+ deopt(key.deopt, state);
+ return;
}
- nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
+ key = key.value;
+ } else if (keyPath.isIdentifier()) {
+ key = keyPath.node.name;
} else {
- let kind = "init";
- if (this.isContextual(99) || this.isContextual(104)) {
- const lookahead = this.lookahead();
- if (tokenIsLiteralPropertyName(lookahead.type)) {
- kind = this.state.value;
- this.next();
- }
- }
- const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact != null ? allowInexact : !exact);
- if (propOrInexact === null) {
- inexact = true;
- inexactStartLoc = this.state.lastTokStartLoc;
- } else {
- nodeStart.properties.push(propOrInexact);
- }
+ key = keyPath.node.value;
}
- this.flowObjectTypeSemicolon();
- if (inexactStartLoc && !this.match(8) && !this.match(9)) {
- this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
+ const valuePath = prop.get("value");
+ let value = valuePath.evaluate();
+ if (!value.confident) {
+ deopt(value.deopt, state);
+ return;
}
+ value = value.value;
+ obj[key] = value;
}
- this.expect(endDelim);
- if (allowSpread) {
- nodeStart.inexact = inexact;
- }
- const out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
- this.state.inType = oldInType;
- return out;
- }
- flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact) {
- if (this.eat(21)) {
- const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
- if (isInexactToken) {
- if (!allowSpread) {
- this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
- } else if (!allowInexact) {
- this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
- }
- if (variance) {
- this.raise(FlowErrors.InexactVariance, variance);
- }
- return null;
- }
- if (!allowSpread) {
- this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
- }
- if (protoStartLoc != null) {
- this.unexpected(protoStartLoc);
- }
- if (variance) {
- this.raise(FlowErrors.SpreadVariance, variance);
- }
- node.argument = this.flowParseType();
- return this.finishNode(node, "ObjectTypeSpreadProperty");
- } else {
- node.key = this.flowParseObjectPropertyKey();
- node.static = isStatic;
- node.proto = protoStartLoc != null;
- node.kind = kind;
- let optional = false;
- if (this.match(47) || this.match(10)) {
- node.method = true;
- if (protoStartLoc != null) {
- this.unexpected(protoStartLoc);
- }
- if (variance) {
- this.unexpected(variance.loc.start);
- }
- node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start));
- if (kind === "get" || kind === "set") {
- this.flowCheckGetterSetterParams(node);
- }
- if (!allowSpread && node.key.name === "constructor" && node.value.this) {
- this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
- }
- } else {
- if (kind !== "init") this.unexpected();
- node.method = false;
- if (this.eat(17)) {
- optional = true;
- }
- node.value = this.flowParseTypeInitialiser();
- node.variance = variance;
- }
- node.optional = optional;
- return this.finishNode(node, "ObjectTypeProperty");
- }
+ return obj;
}
- flowCheckGetterSetterParams(property) {
- const paramCount = property.kind === "get" ? 0 : 1;
- const length = property.value.params.length + (property.value.rest ? 1 : 0);
- if (property.value.this) {
- this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
- }
- if (length !== paramCount) {
- this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
- }
- if (property.kind === "set" && property.value.rest) {
- this.raise(Errors.BadSetterRestParameter, property);
+ if (path.isLogicalExpression()) {
+ const wasConfident = state.confident;
+ const left = evaluateCached(path.get("left"), state);
+ const leftConfident = state.confident;
+ state.confident = wasConfident;
+ const right = evaluateCached(path.get("right"), state);
+ const rightConfident = state.confident;
+ switch (path.node.operator) {
+ case "||":
+ state.confident = leftConfident && (!!left || rightConfident);
+ if (!state.confident) return;
+ return left || right;
+ case "&&":
+ state.confident = leftConfident && (!left || rightConfident);
+ if (!state.confident) return;
+ return left && right;
+ case "??":
+ state.confident = leftConfident && (left != null || rightConfident);
+ if (!state.confident) return;
+ return left != null ? left : right;
}
}
- flowObjectTypeSemicolon() {
- if (!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9)) {
- this.unexpected();
+ if (path.isBinaryExpression()) {
+ const left = evaluateCached(path.get("left"), state);
+ if (!state.confident) return;
+ const right = evaluateCached(path.get("right"), state);
+ if (!state.confident) return;
+ switch (path.node.operator) {
+ case "-":
+ return left - right;
+ case "+":
+ return left + right;
+ case "/":
+ return left / right;
+ case "*":
+ return left * right;
+ case "%":
+ return left % right;
+ case "**":
+ return Math.pow(left, right);
+ case "<":
+ return left < right;
+ case ">":
+ return left > right;
+ case "<=":
+ return left <= right;
+ case ">=":
+ return left >= right;
+ case "==":
+ return left == right;
+ case "!=":
+ return left != right;
+ case "===":
+ return left === right;
+ case "!==":
+ return left !== right;
+ case "|":
+ return left | right;
+ case "&":
+ return left & right;
+ case "^":
+ return left ^ right;
+ case "<<":
+ return left << right;
+ case ">>":
+ return left >> right;
+ case ">>>":
+ return left >>> right;
}
}
- flowParseQualifiedTypeIdentifier(startLoc, id) {
- startLoc != null ? startLoc : startLoc = this.state.startLoc;
- let node = id || this.flowParseRestrictedIdentifier(true);
- while (this.eat(16)) {
- const node2 = this.startNodeAt(startLoc);
- node2.qualification = node;
- node2.id = this.flowParseRestrictedIdentifier(true);
- node = this.finishNode(node2, "QualifiedTypeIdentifier");
+ if (path.isCallExpression()) {
+ const callee = path.get("callee");
+ let context;
+ let func;
+ if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && (isValidObjectCallee(callee.node.name) || isValidIdentifierCallee(callee.node.name))) {
+ func = global[callee.node.name];
}
- return node;
- }
- flowParseGenericType(startLoc, id) {
- const node = this.startNodeAt(startLoc);
- node.typeParameters = null;
- node.id = this.flowParseQualifiedTypeIdentifier(startLoc, id);
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterInstantiation();
- }
- return this.finishNode(node, "GenericTypeAnnotation");
- }
- flowParseTypeofType() {
- const node = this.startNode();
- this.expect(87);
- node.argument = this.flowParsePrimaryType();
- return this.finishNode(node, "TypeofTypeAnnotation");
- }
- flowParseTupleType() {
- const node = this.startNode();
- node.types = [];
- this.expect(0);
- while (this.state.pos < this.length && !this.match(3)) {
- node.types.push(this.flowParseType());
- if (this.match(3)) break;
- this.expect(12);
- }
- this.expect(3);
- return this.finishNode(node, "TupleTypeAnnotation");
- }
- flowParseFunctionTypeParam(first) {
- let name = null;
- let optional = false;
- let typeAnnotation = null;
- const node = this.startNode();
- const lh = this.lookahead();
- const isThis = this.state.type === 78;
- if (lh.type === 14 || lh.type === 17) {
- if (isThis && !first) {
- this.raise(FlowErrors.ThisParamMustBeFirst, node);
- }
- name = this.parseIdentifier(isThis);
- if (this.eat(17)) {
- optional = true;
- if (isThis) {
- this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
+ if (callee.isMemberExpression()) {
+ const object = callee.get("object");
+ const property = callee.get("property");
+ if (object.isIdentifier() && property.isIdentifier() && isValidObjectCallee(object.node.name) && !isInvalidMethod(property.node.name)) {
+ context = global[object.node.name];
+ const key = property.node.name;
+ if (Object.hasOwnProperty.call(context, key)) {
+ func = context[key];
}
}
- typeAnnotation = this.flowParseTypeInitialiser();
- } else {
- typeAnnotation = this.flowParseType();
- }
- node.name = name;
- node.optional = optional;
- node.typeAnnotation = typeAnnotation;
- return this.finishNode(node, "FunctionTypeParam");
- }
- reinterpretTypeAsFunctionTypeParam(type) {
- const node = this.startNodeAt(type.loc.start);
- node.name = null;
- node.optional = false;
- node.typeAnnotation = type;
- return this.finishNode(node, "FunctionTypeParam");
- }
- flowParseFunctionTypeParams(params = []) {
- let rest = null;
- let _this = null;
- if (this.match(78)) {
- _this = this.flowParseFunctionTypeParam(true);
- _this.name = null;
- if (!this.match(11)) {
- this.expect(12);
- }
- }
- while (!this.match(11) && !this.match(21)) {
- params.push(this.flowParseFunctionTypeParam(false));
- if (!this.match(11)) {
- this.expect(12);
- }
- }
- if (this.eat(21)) {
- rest = this.flowParseFunctionTypeParam(false);
- }
- return {
- params,
- rest,
- _this
- };
- }
- flowIdentToTypeAnnotation(startLoc, node, id) {
- switch (id.name) {
- case "any":
- return this.finishNode(node, "AnyTypeAnnotation");
- case "bool":
- case "boolean":
- return this.finishNode(node, "BooleanTypeAnnotation");
- case "mixed":
- return this.finishNode(node, "MixedTypeAnnotation");
- case "empty":
- return this.finishNode(node, "EmptyTypeAnnotation");
- case "number":
- return this.finishNode(node, "NumberTypeAnnotation");
- case "string":
- return this.finishNode(node, "StringTypeAnnotation");
- case "symbol":
- return this.finishNode(node, "SymbolTypeAnnotation");
- default:
- this.checkNotUnderscore(id.name);
- return this.flowParseGenericType(startLoc, id);
- }
- }
- flowParsePrimaryType() {
- const startLoc = this.state.startLoc;
- const node = this.startNode();
- let tmp;
- let type;
- let isGroupedType = false;
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
- switch (this.state.type) {
- case 5:
- return this.flowParseObjectType({
- allowStatic: false,
- allowExact: false,
- allowSpread: true,
- allowProto: false,
- allowInexact: true
- });
- case 6:
- return this.flowParseObjectType({
- allowStatic: false,
- allowExact: true,
- allowSpread: true,
- allowProto: false,
- allowInexact: false
- });
- case 0:
- this.state.noAnonFunctionType = false;
- type = this.flowParseTupleType();
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
- return type;
- case 47:
- {
- const node = this.startNode();
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- this.expect(10);
- tmp = this.flowParseFunctionTypeParams();
- node.params = tmp.params;
- node.rest = tmp.rest;
- node.this = tmp._this;
- this.expect(11);
- this.expect(19);
- node.returnType = this.flowParseType();
- return this.finishNode(node, "FunctionTypeAnnotation");
- }
- case 10:
- {
- const node = this.startNode();
- this.next();
- if (!this.match(11) && !this.match(21)) {
- if (tokenIsIdentifier(this.state.type) || this.match(78)) {
- const token = this.lookahead().type;
- isGroupedType = token !== 17 && token !== 14;
- } else {
- isGroupedType = true;
- }
- }
- if (isGroupedType) {
- this.state.noAnonFunctionType = false;
- type = this.flowParseType();
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
- if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
- this.expect(11);
- return type;
- } else {
- this.eat(12);
- }
- }
- if (type) {
- tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
- } else {
- tmp = this.flowParseFunctionTypeParams();
- }
- node.params = tmp.params;
- node.rest = tmp.rest;
- node.this = tmp._this;
- this.expect(11);
- this.expect(19);
- node.returnType = this.flowParseType();
- node.typeParameters = null;
- return this.finishNode(node, "FunctionTypeAnnotation");
- }
- case 134:
- return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
- case 85:
- case 86:
- node.value = this.match(85);
- this.next();
- return this.finishNode(node, "BooleanLiteralTypeAnnotation");
- case 53:
- if (this.state.value === "-") {
- this.next();
- if (this.match(135)) {
- return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
- }
- if (this.match(136)) {
- return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
- }
- throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
- }
- this.unexpected();
- return;
- case 135:
- return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
- case 136:
- return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
- case 88:
- this.next();
- return this.finishNode(node, "VoidTypeAnnotation");
- case 84:
- this.next();
- return this.finishNode(node, "NullLiteralTypeAnnotation");
- case 78:
- this.next();
- return this.finishNode(node, "ThisTypeAnnotation");
- case 55:
- this.next();
- return this.finishNode(node, "ExistsTypeAnnotation");
- case 87:
- return this.flowParseTypeofType();
- default:
- if (tokenIsKeyword(this.state.type)) {
- const label = tokenLabelName(this.state.type);
- this.next();
- return super.createIdentifier(node, label);
- } else if (tokenIsIdentifier(this.state.type)) {
- if (this.isContextual(129)) {
- return this.flowParseInterfaceType();
- }
- return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier());
- }
- }
- this.unexpected();
- }
- flowParsePostfixType() {
- const startLoc = this.state.startLoc;
- let type = this.flowParsePrimaryType();
- let seenOptionalIndexedAccess = false;
- while ((this.match(0) || this.match(18)) && !this.canInsertSemicolon()) {
- const node = this.startNodeAt(startLoc);
- const optional = this.eat(18);
- seenOptionalIndexedAccess = seenOptionalIndexedAccess || optional;
- this.expect(0);
- if (!optional && this.match(3)) {
- node.elementType = type;
- this.next();
- type = this.finishNode(node, "ArrayTypeAnnotation");
- } else {
- node.objectType = type;
- node.indexType = this.flowParseType();
- this.expect(3);
- if (seenOptionalIndexedAccess) {
- node.optional = optional;
- type = this.finishNode(node, "OptionalIndexedAccessType");
- } else {
- type = this.finishNode(node, "IndexedAccessType");
+ if (object.isLiteral() && property.isIdentifier()) {
+ const type = typeof object.node.value;
+ if (type === "string" || type === "number") {
+ context = object.node.value;
+ func = context[property.node.name];
}
}
}
- return type;
- }
- flowParsePrefixType() {
- const node = this.startNode();
- if (this.eat(17)) {
- node.typeAnnotation = this.flowParsePrefixType();
- return this.finishNode(node, "NullableTypeAnnotation");
- } else {
- return this.flowParsePostfixType();
- }
- }
- flowParseAnonFunctionWithoutParens() {
- const param = this.flowParsePrefixType();
- if (!this.state.noAnonFunctionType && this.eat(19)) {
- const node = this.startNodeAt(param.loc.start);
- node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
- node.rest = null;
- node.this = null;
- node.returnType = this.flowParseType();
- node.typeParameters = null;
- return this.finishNode(node, "FunctionTypeAnnotation");
- }
- return param;
- }
- flowParseIntersectionType() {
- const node = this.startNode();
- this.eat(45);
- const type = this.flowParseAnonFunctionWithoutParens();
- node.types = [type];
- while (this.eat(45)) {
- node.types.push(this.flowParseAnonFunctionWithoutParens());
- }
- return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
- }
- flowParseUnionType() {
- const node = this.startNode();
- this.eat(43);
- const type = this.flowParseIntersectionType();
- node.types = [type];
- while (this.eat(43)) {
- node.types.push(this.flowParseIntersectionType());
- }
- return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
- }
- flowParseType() {
- const oldInType = this.state.inType;
- this.state.inType = true;
- const type = this.flowParseUnionType();
- this.state.inType = oldInType;
- return type;
- }
- flowParseTypeOrImplicitInstantiation() {
- if (this.state.type === 132 && this.state.value === "_") {
- const startLoc = this.state.startLoc;
- const node = this.parseIdentifier();
- return this.flowParseGenericType(startLoc, node);
- } else {
- return this.flowParseType();
+ if (func) {
+ const args = path.get("arguments").map(arg => evaluateCached(arg, state));
+ if (!state.confident) return;
+ return func.apply(context, args);
}
}
- flowParseTypeAnnotation() {
- const node = this.startNode();
- node.typeAnnotation = this.flowParseTypeInitialiser();
- return this.finishNode(node, "TypeAnnotation");
+ deopt(path, state);
+}
+function evaluateQuasis(path, quasis, state, raw = false) {
+ let str = "";
+ let i = 0;
+ const exprs = path.isTemplateLiteral() ? path.get("expressions") : path.get("quasi.expressions");
+ for (const elem of quasis) {
+ if (!state.confident) break;
+ str += raw ? elem.value.raw : elem.value.cooked;
+ const expr = exprs[i++];
+ if (expr) str += String(evaluateCached(expr, state));
}
- flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
- const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();
- if (this.match(14)) {
- ident.typeAnnotation = this.flowParseTypeAnnotation();
- this.resetEndLocation(ident);
- }
- return ident;
+ if (!state.confident) return;
+ return str;
+}
+function evaluate() {
+ const state = {
+ confident: true,
+ deoptPath: null,
+ seen: new Map()
+ };
+ let value = evaluateCached(this, state);
+ if (!state.confident) value = undefined;
+ return {
+ confident: state.confident,
+ deopt: state.deoptPath,
+ value: value
+ };
+}
+
+//# sourceMappingURL=evaluation.js.map
+
+
+/***/ }),
+
+/***/ 9853:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._getKey = _getKey;
+exports._getPattern = _getPattern;
+exports.get = get;
+exports.getAllNextSiblings = getAllNextSiblings;
+exports.getAllPrevSiblings = getAllPrevSiblings;
+exports.getBindingIdentifierPaths = getBindingIdentifierPaths;
+exports.getBindingIdentifiers = getBindingIdentifiers;
+exports.getCompletionRecords = getCompletionRecords;
+exports.getNextSibling = getNextSibling;
+exports.getOpposite = getOpposite;
+exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
+exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
+exports.getPrevSibling = getPrevSibling;
+exports.getSibling = getSibling;
+var _index = __nccwpck_require__(8877);
+var _t = __nccwpck_require__(7912);
+const {
+ getBindingIdentifiers: _getBindingIdentifiers,
+ getOuterBindingIdentifiers: _getOuterBindingIdentifiers,
+ isDeclaration,
+ numericLiteral,
+ unaryExpression
+} = _t;
+const NORMAL_COMPLETION = 0;
+const BREAK_COMPLETION = 1;
+function NormalCompletion(path) {
+ return {
+ type: NORMAL_COMPLETION,
+ path
+ };
+}
+function BreakCompletion(path) {
+ return {
+ type: BREAK_COMPLETION,
+ path
+ };
+}
+function getOpposite() {
+ if (this.key === "left") {
+ return this.getSibling("right");
+ } else if (this.key === "right") {
+ return this.getSibling("left");
}
- typeCastToParameter(node) {
- node.expression.typeAnnotation = node.typeAnnotation;
- this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
- return node.expression;
+ return null;
+}
+function addCompletionRecords(path, records, context) {
+ if (path) {
+ records.push(..._getCompletionRecords(path, context));
}
- flowParseVariance() {
- let variance = null;
- if (this.match(53)) {
- variance = this.startNode();
- if (this.state.value === "+") {
- variance.kind = "plus";
- } else {
- variance.kind = "minus";
+ return records;
+}
+function completionRecordForSwitch(cases, records, context) {
+ let lastNormalCompletions = [];
+ for (let i = 0; i < cases.length; i++) {
+ const casePath = cases[i];
+ const caseCompletions = _getCompletionRecords(casePath, context);
+ const normalCompletions = [];
+ const breakCompletions = [];
+ for (const c of caseCompletions) {
+ if (c.type === NORMAL_COMPLETION) {
+ normalCompletions.push(c);
}
- this.next();
- return this.finishNode(variance, "Variance");
- }
- return variance;
- }
- parseFunctionBody(node, allowExpressionBody, isMethod = false) {
- if (allowExpressionBody) {
- this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod));
- return;
- }
- super.parseFunctionBody(node, false, isMethod);
- }
- parseFunctionBodyAndFinish(node, type, isMethod = false) {
- if (this.match(14)) {
- const typeNode = this.startNode();
- [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
- node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
- }
- return super.parseFunctionBodyAndFinish(node, type, isMethod);
- }
- parseStatementLike(flags) {
- if (this.state.strict && this.isContextual(129)) {
- const lookahead = this.lookahead();
- if (tokenIsKeywordOrIdentifier(lookahead.type)) {
- const node = this.startNode();
- this.next();
- return this.flowParseInterface(node);
+ if (c.type === BREAK_COMPLETION) {
+ breakCompletions.push(c);
}
- } else if (this.isContextual(126)) {
- const node = this.startNode();
- this.next();
- return this.flowParseEnumDeclaration(node);
}
- const stmt = super.parseStatementLike(flags);
- if (this.flowPragma === undefined && !this.isValidDirective(stmt)) {
- this.flowPragma = null;
+ if (normalCompletions.length) {
+ lastNormalCompletions = normalCompletions;
}
- return stmt;
+ records.push(...breakCompletions);
}
- parseExpressionStatement(node, expr, decorators) {
- if (expr.type === "Identifier") {
- if (expr.name === "declare") {
- if (this.match(80) || tokenIsIdentifier(this.state.type) || this.match(68) || this.match(74) || this.match(82)) {
- return this.flowParseDeclare(node);
- }
- } else if (tokenIsIdentifier(this.state.type)) {
- if (expr.name === "interface") {
- return this.flowParseInterface(node);
- } else if (expr.name === "type") {
- return this.flowParseTypeAlias(node);
- } else if (expr.name === "opaque") {
- return this.flowParseOpaqueType(node, false);
- }
+ records.push(...lastNormalCompletions);
+ return records;
+}
+function normalCompletionToBreak(completions) {
+ completions.forEach(c => {
+ c.type = BREAK_COMPLETION;
+ });
+}
+function replaceBreakStatementInBreakCompletion(completions, reachable) {
+ completions.forEach(c => {
+ if (c.path.isBreakStatement({
+ label: null
+ })) {
+ if (reachable) {
+ c.path.replaceWith(unaryExpression("void", numericLiteral(0)));
+ } else {
+ c.path.remove();
}
}
- return super.parseExpressionStatement(node, expr, decorators);
- }
- shouldParseExportDeclaration() {
- const {
- type
- } = this.state;
- if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
- return !this.state.containsEsc;
- }
- return super.shouldParseExportDeclaration();
- }
- isExportDefaultSpecifier() {
- const {
- type
- } = this.state;
- if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
- return this.state.containsEsc;
- }
- return super.isExportDefaultSpecifier();
- }
- parseExportDefaultExpression() {
- if (this.isContextual(126)) {
- const node = this.startNode();
- this.next();
- return this.flowParseEnumDeclaration(node);
- }
- return super.parseExportDefaultExpression();
- }
- parseConditional(expr, startLoc, refExpressionErrors) {
- if (!this.match(17)) return expr;
- if (this.state.maybeInArrowParameters) {
- const nextCh = this.lookaheadCharCode();
- if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
- this.setOptionalParametersError(refExpressionErrors);
- return expr;
- }
- }
- this.expect(17);
- const state = this.state.clone();
- const originalNoArrowAt = this.state.noArrowAt;
- const node = this.startNodeAt(startLoc);
- let {
- consequent,
- failed
- } = this.tryParseConditionalConsequent();
- let [valid, invalid] = this.getArrowLikeExpressions(consequent);
- if (failed || invalid.length > 0) {
- const noArrowAt = [...originalNoArrowAt];
- if (invalid.length > 0) {
- this.state = state;
- this.state.noArrowAt = noArrowAt;
- for (let i = 0; i < invalid.length; i++) {
- noArrowAt.push(invalid[i].start);
- }
- ({
- consequent,
- failed
- } = this.tryParseConditionalConsequent());
- [valid, invalid] = this.getArrowLikeExpressions(consequent);
- }
- if (failed && valid.length > 1) {
- this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
- }
- if (failed && valid.length === 1) {
- this.state = state;
- noArrowAt.push(valid[0].start);
- this.state.noArrowAt = noArrowAt;
- ({
- consequent,
- failed
- } = this.tryParseConditionalConsequent());
- }
- }
- this.getArrowLikeExpressions(consequent, true);
- this.state.noArrowAt = originalNoArrowAt;
- this.expect(14);
- node.test = expr;
- node.consequent = consequent;
- node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(undefined, undefined));
- return this.finishNode(node, "ConditionalExpression");
- }
- tryParseConditionalConsequent() {
- this.state.noArrowParamsConversionAt.push(this.state.start);
- const consequent = this.parseMaybeAssignAllowIn();
- const failed = !this.match(14);
- this.state.noArrowParamsConversionAt.pop();
- return {
- consequent,
- failed
- };
- }
- getArrowLikeExpressions(node, disallowInvalid) {
- const stack = [node];
- const arrows = [];
- while (stack.length !== 0) {
- const node = stack.pop();
- if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
- if (node.typeParameters || !node.returnType) {
- this.finishArrowValidation(node);
+ });
+}
+function getStatementListCompletion(paths, context) {
+ const completions = [];
+ if (context.canHaveBreak) {
+ let lastNormalCompletions = [];
+ for (let i = 0; i < paths.length; i++) {
+ const path = paths[i];
+ const newContext = Object.assign({}, context, {
+ inCaseClause: false
+ });
+ if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
+ newContext.shouldPopulateBreak = true;
+ } else {
+ newContext.shouldPopulateBreak = false;
+ }
+ const statementCompletions = _getCompletionRecords(path, newContext);
+ if (statementCompletions.length > 0 && statementCompletions.every(c => c.type === BREAK_COMPLETION)) {
+ if (lastNormalCompletions.length > 0 && statementCompletions.every(c => c.path.isBreakStatement({
+ label: null
+ }))) {
+ normalCompletionToBreak(lastNormalCompletions);
+ completions.push(...lastNormalCompletions);
+ if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
+ completions.push(...statementCompletions);
+ replaceBreakStatementInBreakCompletion(statementCompletions, true);
+ }
+ replaceBreakStatementInBreakCompletion(statementCompletions, false);
} else {
- arrows.push(node);
+ completions.push(...statementCompletions);
+ if (!context.shouldPopulateBreak) {
+ replaceBreakStatementInBreakCompletion(statementCompletions, true);
+ }
}
- stack.push(node.body);
- } else if (node.type === "ConditionalExpression") {
- stack.push(node.consequent);
- stack.push(node.alternate);
+ break;
}
- }
- if (disallowInvalid) {
- arrows.forEach(node => this.finishArrowValidation(node));
- return [arrows, []];
- }
- return partition(arrows, node => node.params.every(param => this.isAssignable(param, true)));
- }
- finishArrowValidation(node) {
- var _node$extra;
- this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
- this.scope.enter(2 | 4);
- super.checkParams(node, false, true);
- this.scope.exit();
- }
- forwardNoArrowParamsConversionAt(node, parse) {
- let result;
- if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
- this.state.noArrowParamsConversionAt.push(this.state.start);
- result = parse();
- this.state.noArrowParamsConversionAt.pop();
- } else {
- result = parse();
- }
- return result;
- }
- parseParenItem(node, startLoc) {
- const newNode = super.parseParenItem(node, startLoc);
- if (this.eat(17)) {
- newNode.optional = true;
- this.resetEndLocation(node);
- }
- if (this.match(14)) {
- const typeCastNode = this.startNodeAt(startLoc);
- typeCastNode.expression = newNode;
- typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
- return this.finishNode(typeCastNode, "TypeCastExpression");
- }
- return newNode;
- }
- assertModuleNodeAllowed(node) {
- if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
- return;
- }
- super.assertModuleNodeAllowed(node);
- }
- parseExportDeclaration(node) {
- if (this.isContextual(130)) {
- node.exportKind = "type";
- const declarationNode = this.startNode();
- this.next();
- if (this.match(5)) {
- node.specifiers = this.parseExportSpecifiers(true);
- super.parseExportFrom(node);
- return null;
+ if (i === paths.length - 1) {
+ completions.push(...statementCompletions);
} else {
- return this.flowParseTypeAlias(declarationNode);
- }
- } else if (this.isContextual(131)) {
- node.exportKind = "type";
- const declarationNode = this.startNode();
- this.next();
- return this.flowParseOpaqueType(declarationNode, false);
- } else if (this.isContextual(129)) {
- node.exportKind = "type";
- const declarationNode = this.startNode();
- this.next();
- return this.flowParseInterface(declarationNode);
- } else if (this.isContextual(126)) {
- node.exportKind = "value";
- const declarationNode = this.startNode();
- this.next();
- return this.flowParseEnumDeclaration(declarationNode);
- } else {
- return super.parseExportDeclaration(node);
- }
- }
- eatExportStar(node) {
- if (super.eatExportStar(node)) return true;
- if (this.isContextual(130) && this.lookahead().type === 55) {
- node.exportKind = "type";
- this.next();
- this.next();
- return true;
- }
- return false;
- }
- maybeParseExportNamespaceSpecifier(node) {
- const {
- startLoc
- } = this.state;
- const hasNamespace = super.maybeParseExportNamespaceSpecifier(node);
- if (hasNamespace && node.exportKind === "type") {
- this.unexpected(startLoc);
- }
- return hasNamespace;
- }
- parseClassId(node, isStatement, optionalId) {
- super.parseClassId(node, isStatement, optionalId);
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- }
- }
- parseClassMember(classBody, member, state) {
- const {
- startLoc
- } = this.state;
- if (this.isContextual(125)) {
- if (super.parseClassMemberFromModifier(classBody, member)) {
- return;
+ lastNormalCompletions = [];
+ for (let i = 0; i < statementCompletions.length; i++) {
+ const c = statementCompletions[i];
+ if (c.type === BREAK_COMPLETION) {
+ completions.push(c);
+ }
+ if (c.type === NORMAL_COMPLETION) {
+ lastNormalCompletions.push(c);
+ }
+ }
}
- member.declare = true;
}
- super.parseClassMember(classBody, member, state);
- if (member.declare) {
- if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
- this.raise(FlowErrors.DeclareClassElement, startLoc);
- } else if (member.value) {
- this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
+ } else if (paths.length) {
+ for (let i = paths.length - 1; i >= 0; i--) {
+ const pathCompletions = _getCompletionRecords(paths[i], context);
+ if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
+ completions.push(...pathCompletions);
+ break;
}
}
}
- isIterator(word) {
- return word === "iterator" || word === "asyncIterator";
+ return completions;
+}
+function _getCompletionRecords(path, context) {
+ let records = [];
+ if (path.isIfStatement()) {
+ records = addCompletionRecords(path.get("consequent"), records, context);
+ records = addCompletionRecords(path.get("alternate"), records, context);
+ } else if (path.isDoExpression() || path.isFor() || path.isWhile() || path.isLabeledStatement()) {
+ return addCompletionRecords(path.get("body"), records, context);
+ } else if (path.isProgram() || path.isBlockStatement()) {
+ return getStatementListCompletion(path.get("body"), context);
+ } else if (path.isFunction()) {
+ return _getCompletionRecords(path.get("body"), context);
+ } else if (path.isTryStatement()) {
+ records = addCompletionRecords(path.get("block"), records, context);
+ records = addCompletionRecords(path.get("handler"), records, context);
+ } else if (path.isCatchClause()) {
+ return addCompletionRecords(path.get("body"), records, context);
+ } else if (path.isSwitchStatement()) {
+ return completionRecordForSwitch(path.get("cases"), records, context);
+ } else if (path.isSwitchCase()) {
+ return getStatementListCompletion(path.get("consequent"), {
+ canHaveBreak: true,
+ shouldPopulateBreak: false,
+ inCaseClause: true
+ });
+ } else if (path.isBreakStatement()) {
+ records.push(BreakCompletion(path));
+ } else {
+ records.push(NormalCompletion(path));
}
- readIterator() {
- const word = super.readWord1();
- const fullWord = "@@" + word;
- if (!this.isIterator(word) || !this.state.inType) {
- this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
- identifierName: fullWord
- });
- }
- this.finishToken(132, fullWord);
- }
- getTokenFromCode(code) {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (code === 123 && next === 124) {
- this.finishOp(6, 2);
- } else if (this.state.inType && (code === 62 || code === 60)) {
- this.finishOp(code === 62 ? 48 : 47, 1);
- } else if (this.state.inType && code === 63) {
- if (next === 46) {
- this.finishOp(18, 2);
- } else {
- this.finishOp(17, 1);
- }
- } else if (isIteratorStart(code, next, this.input.charCodeAt(this.state.pos + 2))) {
- this.state.pos += 2;
- this.readIterator();
- } else {
- super.getTokenFromCode(code);
- }
+ return records;
+}
+function getCompletionRecords() {
+ const records = _getCompletionRecords(this, {
+ canHaveBreak: false,
+ shouldPopulateBreak: false,
+ inCaseClause: false
+ });
+ return records.map(r => r.path);
+}
+function getSibling(key) {
+ return _index.default.get({
+ parentPath: this.parentPath,
+ parent: this.parent,
+ container: this.container,
+ listKey: this.listKey,
+ key: key
+ }).setContext(this.context);
+}
+function getPrevSibling() {
+ return this.getSibling(this.key - 1);
+}
+function getNextSibling() {
+ return this.getSibling(this.key + 1);
+}
+function getAllNextSiblings() {
+ let _key = this.key;
+ let sibling = this.getSibling(++_key);
+ const siblings = [];
+ while (sibling.node) {
+ siblings.push(sibling);
+ sibling = this.getSibling(++_key);
}
- isAssignable(node, isBinding) {
- if (node.type === "TypeCastExpression") {
- return this.isAssignable(node.expression, isBinding);
- } else {
- return super.isAssignable(node, isBinding);
- }
+ return siblings;
+}
+function getAllPrevSiblings() {
+ let _key = this.key;
+ let sibling = this.getSibling(--_key);
+ const siblings = [];
+ while (sibling.node) {
+ siblings.push(sibling);
+ sibling = this.getSibling(--_key);
}
- toAssignable(node, isLHS = false) {
- if (!isLHS && node.type === "AssignmentExpression" && node.left.type === "TypeCastExpression") {
- node.left = this.typeCastToParameter(node.left);
- }
- super.toAssignable(node, isLHS);
+ return siblings;
+}
+function get(key, context = true) {
+ if (context === true) context = this.context;
+ const parts = key.split(".");
+ if (parts.length === 1) {
+ return this._getKey(key, context);
+ } else {
+ return this._getPattern(parts, context);
}
- toAssignableList(exprList, trailingCommaLoc, isLHS) {
- for (let i = 0; i < exprList.length; i++) {
- const expr = exprList[i];
- if ((expr == null ? void 0 : expr.type) === "TypeCastExpression") {
- exprList[i] = this.typeCastToParameter(expr);
- }
- }
- super.toAssignableList(exprList, trailingCommaLoc, isLHS);
+}
+function _getKey(key, context) {
+ const node = this.node;
+ const container = node[key];
+ if (Array.isArray(container)) {
+ return container.map((_, i) => {
+ return _index.default.get({
+ listKey: key,
+ parentPath: this,
+ parent: node,
+ container: container,
+ key: i
+ }).setContext(context);
+ });
+ } else {
+ return _index.default.get({
+ parentPath: this,
+ parent: node,
+ container: node,
+ key: key
+ }).setContext(context);
}
- toReferencedList(exprList, isParenthesizedExpr) {
- for (let i = 0; i < exprList.length; i++) {
- var _expr$extra;
- const expr = exprList[i];
- if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
- this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
+}
+function _getPattern(parts, context) {
+ let path = this;
+ for (const part of parts) {
+ if (part === ".") {
+ path = path.parentPath;
+ } else {
+ if (Array.isArray(path)) {
+ path = path[part];
+ } else {
+ path = path.get(part, context);
}
}
- return exprList;
- }
- parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
- const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
- if (canBePattern && !this.state.maybeInArrowParameters) {
- this.toReferencedList(node.elements);
- }
- return node;
- }
- isValidLVal(type, isParenthesized, binding) {
- return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
- }
- parseClassProperty(node) {
- if (this.match(14)) {
- node.typeAnnotation = this.flowParseTypeAnnotation();
- }
- return super.parseClassProperty(node);
- }
- parseClassPrivateProperty(node) {
- if (this.match(14)) {
- node.typeAnnotation = this.flowParseTypeAnnotation();
- }
- return super.parseClassPrivateProperty(node);
}
- isClassMethod() {
- return this.match(47) || super.isClassMethod();
- }
- isClassProperty() {
- return this.match(14) || super.isClassProperty();
- }
- isNonstaticConstructor(method) {
- return !this.match(14) && super.isNonstaticConstructor(method);
- }
- pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
- if (method.variance) {
- this.unexpected(method.variance.loc.start);
- }
- delete method.variance;
- if (this.match(47)) {
- method.typeParameters = this.flowParseTypeParameterDeclaration();
- }
- super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
- if (method.params && isConstructor) {
- const params = method.params;
- if (params.length > 0 && this.isThisParam(params[0])) {
- this.raise(FlowErrors.ThisParamBannedInConstructor, method);
- }
- } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
- const params = method.value.params;
- if (params.length > 0 && this.isThisParam(params[0])) {
- this.raise(FlowErrors.ThisParamBannedInConstructor, method);
+ return path;
+}
+function getBindingIdentifiers(duplicates) {
+ return _getBindingIdentifiers(this.node, duplicates);
+}
+function getOuterBindingIdentifiers(duplicates) {
+ return _getOuterBindingIdentifiers(this.node, duplicates);
+}
+function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
+ const path = this;
+ const search = [path];
+ const ids = Object.create(null);
+ while (search.length) {
+ const id = search.shift();
+ if (!id) continue;
+ if (!id.node) continue;
+ const keys = _getBindingIdentifiers.keys[id.node.type];
+ if (id.isIdentifier()) {
+ if (duplicates) {
+ const _ids = ids[id.node.name] = ids[id.node.name] || [];
+ _ids.push(id);
+ } else {
+ ids[id.node.name] = id;
}
+ continue;
}
- }
- pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
- if (method.variance) {
- this.unexpected(method.variance.loc.start);
- }
- delete method.variance;
- if (this.match(47)) {
- method.typeParameters = this.flowParseTypeParameterDeclaration();
+ if (id.isExportDeclaration()) {
+ const declaration = id.get("declaration");
+ if (isDeclaration(declaration)) {
+ search.push(declaration);
+ }
+ continue;
}
- super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
- }
- parseClassSuper(node) {
- super.parseClassSuper(node);
- if (node.superClass && (this.match(47) || this.match(51))) {
- {
- node.superTypeParameters = this.flowParseTypeParameterInstantiationInExpression();
+ if (outerOnly) {
+ if (id.isFunctionDeclaration()) {
+ search.push(id.get("id"));
+ continue;
+ }
+ if (id.isFunctionExpression()) {
+ continue;
}
}
- if (this.isContextual(113)) {
- this.next();
- const implemented = node.implements = [];
- do {
- const node = this.startNode();
- node.id = this.flowParseRestrictedIdentifier(true);
- if (this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterInstantiation();
- } else {
- node.typeParameters = null;
+ if (keys) {
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ const child = id.get(key);
+ if (Array.isArray(child)) {
+ search.push(...child);
+ } else if (child.node) {
+ search.push(child);
}
- implemented.push(this.finishNode(node, "ClassImplements"));
- } while (this.eat(12));
- }
- }
- checkGetterSetterParams(method) {
- super.checkGetterSetterParams(method);
- const params = this.getObjectOrClassMethodParams(method);
- if (params.length > 0) {
- const param = params[0];
- if (this.isThisParam(param) && method.kind === "get") {
- this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
- } else if (this.isThisParam(param)) {
- this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
}
}
}
- parsePropertyNamePrefixOperator(node) {
- node.variance = this.flowParseVariance();
+ return ids;
+}
+function getOuterBindingIdentifierPaths(duplicates = false) {
+ return this.getBindingIdentifierPaths(duplicates, true);
+}
+
+//# sourceMappingURL=family.js.map
+
+
+/***/ }),
+
+/***/ 8877:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = exports.SHOULD_STOP = exports.SHOULD_SKIP = exports.REMOVED = void 0;
+var virtualTypes = __nccwpck_require__(4425);
+var _debug = __nccwpck_require__(8237);
+var _index = __nccwpck_require__(1380);
+var _index2 = __nccwpck_require__(891);
+var _t = __nccwpck_require__(7912);
+var t = _t;
+var cache = __nccwpck_require__(5069);
+var _generator = __nccwpck_require__(2332);
+var NodePath_ancestry = __nccwpck_require__(6411);
+var NodePath_inference = __nccwpck_require__(8045);
+var NodePath_replacement = __nccwpck_require__(8805);
+var NodePath_evaluation = __nccwpck_require__(7969);
+var NodePath_conversion = __nccwpck_require__(277);
+var NodePath_introspection = __nccwpck_require__(217);
+var NodePath_context = __nccwpck_require__(4108);
+var NodePath_removal = __nccwpck_require__(408);
+var NodePath_modification = __nccwpck_require__(7575);
+var NodePath_family = __nccwpck_require__(9853);
+var NodePath_comments = __nccwpck_require__(7354);
+var NodePath_virtual_types_validator = __nccwpck_require__(4859);
+const {
+ validate
+} = _t;
+const debug = _debug("babel");
+const REMOVED = 1 << 0;
+exports.REMOVED = REMOVED;
+const SHOULD_STOP = 1 << 1;
+exports.SHOULD_STOP = SHOULD_STOP;
+const SHOULD_SKIP = 1 << 2;
+exports.SHOULD_SKIP = SHOULD_SKIP;
+class NodePath {
+ constructor(hub, parent) {
+ this.contexts = [];
+ this.state = null;
+ this.opts = null;
+ this._traverseFlags = 0;
+ this.skipKeys = null;
+ this.parentPath = null;
+ this.container = null;
+ this.listKey = null;
+ this.key = null;
+ this.node = null;
+ this.type = null;
+ this.parent = parent;
+ this.hub = hub;
+ this.data = null;
+ this.context = null;
+ this.scope = null;
}
- parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
- if (prop.variance) {
- this.unexpected(prop.variance.loc.start);
+ static get({
+ hub,
+ parentPath,
+ parent,
+ container,
+ listKey,
+ key
+ }) {
+ if (!hub && parentPath) {
+ hub = parentPath.hub;
}
- delete prop.variance;
- let typeParameters;
- if (this.match(47) && !isAccessor) {
- typeParameters = this.flowParseTypeParameterDeclaration();
- if (!this.match(10)) this.unexpected();
+ if (!parent) {
+ throw new Error("To get a node path the parent needs to exist");
}
- const result = super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
- if (typeParameters) {
- (result.value || result).typeParameters = typeParameters;
+ const targetNode = container[key];
+ const paths = cache.getOrCreateCachedPaths(hub, parent);
+ let path = paths.get(targetNode);
+ if (!path) {
+ path = new NodePath(hub, parent);
+ if (targetNode) paths.set(targetNode, path);
}
- return result;
+ path.setup(parentPath, container, listKey, key);
+ return path;
}
- parseFunctionParamType(param) {
- if (this.eat(17)) {
- if (param.type !== "Identifier") {
- this.raise(FlowErrors.PatternIsOptional, param);
- }
- if (this.isThisParam(param)) {
- this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
- }
- param.optional = true;
- }
- if (this.match(14)) {
- param.typeAnnotation = this.flowParseTypeAnnotation();
- } else if (this.isThisParam(param)) {
- this.raise(FlowErrors.ThisParamAnnotationRequired, param);
- }
- if (this.match(29) && this.isThisParam(param)) {
- this.raise(FlowErrors.ThisParamNoDefault, param);
- }
- this.resetEndLocation(param);
- return param;
+ getScope(scope) {
+ return this.isScope() ? new _index2.default(this) : scope;
}
- parseMaybeDefault(startLoc, left) {
- const node = super.parseMaybeDefault(startLoc, left);
- if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
- this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
+ setData(key, val) {
+ if (this.data == null) {
+ this.data = Object.create(null);
}
- return node;
+ return this.data[key] = val;
}
- checkImportReflection(node) {
- super.checkImportReflection(node);
- if (node.module && node.importKind !== "value") {
- this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
+ getData(key, def) {
+ if (this.data == null) {
+ this.data = Object.create(null);
}
+ let val = this.data[key];
+ if (val === undefined && def !== undefined) val = this.data[key] = def;
+ return val;
}
- parseImportSpecifierLocal(node, specifier, type) {
- specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier();
- node.specifiers.push(this.finishImportSpecifier(specifier, type));
+ hasNode() {
+ return this.node != null;
}
- isPotentialImportPhase(isExport) {
- if (super.isPotentialImportPhase(isExport)) return true;
- if (this.isContextual(130)) {
- if (!isExport) return true;
- const ch = this.lookaheadCharCode();
- return ch === 123 || ch === 42;
- }
- return !isExport && this.isContextual(87);
+ buildCodeFrameError(msg, Error = SyntaxError) {
+ return this.hub.buildError(this.node, msg, Error);
}
- applyImportPhase(node, isExport, phase, loc) {
- super.applyImportPhase(node, isExport, phase, loc);
- if (isExport) {
- if (!phase && this.match(65)) {
- return;
- }
- node.exportKind = phase === "type" ? phase : "value";
- } else {
- if (phase === "type" && this.match(55)) this.unexpected();
- node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
- }
- }
- parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
- const firstIdent = specifier.imported;
- let specifierTypeKind = null;
- if (firstIdent.type === "Identifier") {
- if (firstIdent.name === "type") {
- specifierTypeKind = "type";
- } else if (firstIdent.name === "typeof") {
- specifierTypeKind = "typeof";
- }
- }
- let isBinding = false;
- if (this.isContextual(93) && !this.isLookaheadContextual("as")) {
- const as_ident = this.parseIdentifier(true);
- if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
- specifier.imported = as_ident;
- specifier.importKind = specifierTypeKind;
- specifier.local = cloneIdentifier(as_ident);
- } else {
- specifier.imported = firstIdent;
- specifier.importKind = null;
- specifier.local = this.parseIdentifier();
- }
- } else {
- if (specifierTypeKind !== null && tokenIsKeywordOrIdentifier(this.state.type)) {
- specifier.imported = this.parseIdentifier(true);
- specifier.importKind = specifierTypeKind;
- } else {
- if (importedIsString) {
- throw this.raise(Errors.ImportBindingIsString, specifier, {
- importName: firstIdent.value
- });
- }
- specifier.imported = firstIdent;
- specifier.importKind = null;
- }
- if (this.eatContextual(93)) {
- specifier.local = this.parseIdentifier();
- } else {
- isBinding = true;
- specifier.local = cloneIdentifier(specifier.imported);
- }
- }
- const specifierIsTypeImport = hasTypeImportKind(specifier);
- if (isInTypeOnlyImport && specifierIsTypeImport) {
- this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
- }
- if (isInTypeOnlyImport || specifierIsTypeImport) {
- this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
- }
- if (isBinding && !isInTypeOnlyImport && !specifierIsTypeImport) {
- this.checkReservedWord(specifier.local.name, specifier.loc.start, true, true);
- }
- return this.finishImportSpecifier(specifier, "ImportSpecifier");
+ traverse(visitor, state) {
+ (0, _index.default)(this.node, visitor, this.scope, state, this);
}
- parseBindingAtom() {
- switch (this.state.type) {
- case 78:
- return this.parseIdentifier(true);
- default:
- return super.parseBindingAtom();
- }
+ set(key, node) {
+ validate(this.node, key, node);
+ this.node[key] = node;
}
- parseFunctionParams(node, isConstructor) {
- const kind = node.kind;
- if (kind !== "get" && kind !== "set" && this.match(47)) {
- node.typeParameters = this.flowParseTypeParameterDeclaration();
- }
- super.parseFunctionParams(node, isConstructor);
+ getPathLocation() {
+ const parts = [];
+ let path = this;
+ do {
+ let key = path.key;
+ if (path.inList) key = `${path.listKey}[${key}]`;
+ parts.unshift(key);
+ } while (path = path.parentPath);
+ return parts.join(".");
}
- parseVarId(decl, kind) {
- super.parseVarId(decl, kind);
- if (this.match(14)) {
- decl.id.typeAnnotation = this.flowParseTypeAnnotation();
- this.resetEndLocation(decl.id);
- }
+ debug(message) {
+ if (!debug.enabled) return;
+ debug(`${this.getPathLocation()} ${this.type}: ${message}`);
}
- parseAsyncArrowFromCallExpression(node, call) {
- if (this.match(14)) {
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
- this.state.noAnonFunctionType = true;
- node.returnType = this.flowParseTypeAnnotation();
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
- }
- return super.parseAsyncArrowFromCallExpression(node, call);
+ toString() {
+ return (0, _generator.default)(this.node).code;
}
- shouldParseAsyncArrow() {
- return this.match(14) || super.shouldParseAsyncArrow();
+ get inList() {
+ return !!this.listKey;
}
- parseMaybeAssign(refExpressionErrors, afterLeftParse) {
- var _jsx;
- let state = null;
- let jsx;
- if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
- state = this.state.clone();
- jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
- if (!jsx.error) return jsx.node;
- const {
- context
- } = this.state;
- const currentContext = context[context.length - 1];
- if (currentContext === types.j_oTag || currentContext === types.j_expr) {
- context.pop();
- }
- }
- if ((_jsx = jsx) != null && _jsx.error || this.match(47)) {
- var _jsx2, _jsx3;
- state = state || this.state.clone();
- let typeParameters;
- const arrow = this.tryParse(abort => {
- var _arrowExpression$extr;
- typeParameters = this.flowParseTypeParameterDeclaration();
- const arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, () => {
- const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
- this.resetStartLocationFromNode(result, typeParameters);
- return result;
- });
- if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort();
- const expr = this.maybeUnwrapTypeCastExpression(arrowExpression);
- if (expr.type !== "ArrowFunctionExpression") abort();
- expr.typeParameters = typeParameters;
- this.resetStartLocationFromNode(expr, typeParameters);
- return arrowExpression;
- }, state);
- let arrowExpression = null;
- if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
- if (!arrow.error && !arrow.aborted) {
- if (arrow.node.async) {
- this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
- }
- return arrow.node;
- }
- arrowExpression = arrow.node;
- }
- if ((_jsx2 = jsx) != null && _jsx2.node) {
- this.state = jsx.failState;
- return jsx.node;
- }
- if (arrowExpression) {
- this.state = arrow.failState;
- return arrowExpression;
- }
- if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
- if (arrow.thrown) throw arrow.error;
- throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
- }
- return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
- }
- parseArrow(node) {
- if (this.match(14)) {
- const result = this.tryParse(() => {
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
- this.state.noAnonFunctionType = true;
- const typeNode = this.startNode();
- [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
- if (this.canInsertSemicolon()) this.unexpected();
- if (!this.match(19)) this.unexpected();
- return typeNode;
- });
- if (result.thrown) return null;
- if (result.error) this.state = result.failState;
- node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null;
+ set inList(inList) {
+ if (!inList) {
+ this.listKey = null;
}
- return super.parseArrow(node);
- }
- shouldParseArrow(params) {
- return this.match(14) || super.shouldParseArrow(params);
}
- setArrowFunctionParameters(node, params) {
- if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
- node.params = params;
- } else {
- super.setArrowFunctionParameters(node, params);
- }
+ get parentKey() {
+ return this.listKey || this.key;
}
- checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
- if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
- return;
- }
- for (let i = 0; i < node.params.length; i++) {
- if (this.isThisParam(node.params[i]) && i > 0) {
- this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
- }
- }
- super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
- }
- parseParenAndDistinguishExpression(canBeArrow) {
- return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));
- }
- parseSubscripts(base, startLoc, noCalls) {
- if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
- this.next();
- const node = this.startNodeAt(startLoc);
- node.callee = base;
- node.arguments = super.parseCallExpressionArguments(11);
- base = this.finishNode(node, "CallExpression");
- } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
- const state = this.state.clone();
- const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state);
- if (!arrow.error && !arrow.aborted) return arrow.node;
- const result = this.tryParse(() => super.parseSubscripts(base, startLoc, noCalls), state);
- if (result.node && !result.error) return result.node;
- if (arrow.node) {
- this.state = arrow.failState;
- return arrow.node;
- }
- if (result.node) {
- this.state = result.failState;
- return result.node;
- }
- throw arrow.error || result.error;
- }
- return super.parseSubscripts(base, startLoc, noCalls);
- }
- parseSubscript(base, startLoc, noCalls, subscriptState) {
- if (this.match(18) && this.isLookaheadToken_lt()) {
- subscriptState.optionalChainMember = true;
- if (noCalls) {
- subscriptState.stop = true;
- return base;
- }
- this.next();
- const node = this.startNodeAt(startLoc);
- node.callee = base;
- node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
- this.expect(10);
- node.arguments = this.parseCallExpressionArguments(11);
- node.optional = true;
- return this.finishCallExpression(node, true);
- } else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
- const node = this.startNodeAt(startLoc);
- node.callee = base;
- const result = this.tryParse(() => {
- node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
- this.expect(10);
- node.arguments = super.parseCallExpressionArguments(11);
- if (subscriptState.optionalChainMember) {
- node.optional = false;
- }
- return this.finishCallExpression(node, subscriptState.optionalChainMember);
- });
- if (result.node) {
- if (result.error) this.state = result.failState;
- return result.node;
- }
- }
- return super.parseSubscript(base, startLoc, noCalls, subscriptState);
+ get shouldSkip() {
+ return !!(this._traverseFlags & SHOULD_SKIP);
}
- parseNewCallee(node) {
- super.parseNewCallee(node);
- let targs = null;
- if (this.shouldParseTypes() && this.match(47)) {
- targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
+ set shouldSkip(v) {
+ if (v) {
+ this._traverseFlags |= SHOULD_SKIP;
+ } else {
+ this._traverseFlags &= ~SHOULD_SKIP;
}
- node.typeArguments = targs;
}
- parseAsyncArrowWithTypeParameters(startLoc) {
- const node = this.startNodeAt(startLoc);
- this.parseFunctionParams(node, false);
- if (!this.parseArrow(node)) return;
- return super.parseArrowExpression(node, undefined, true);
+ get shouldStop() {
+ return !!(this._traverseFlags & SHOULD_STOP);
}
- readToken_mult_modulo(code) {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (code === 42 && next === 47 && this.state.hasFlowComment) {
- this.state.hasFlowComment = false;
- this.state.pos += 2;
- this.nextToken();
- return;
+ set shouldStop(v) {
+ if (v) {
+ this._traverseFlags |= SHOULD_STOP;
+ } else {
+ this._traverseFlags &= ~SHOULD_STOP;
}
- super.readToken_mult_modulo(code);
}
- readToken_pipe_amp(code) {
- const next = this.input.charCodeAt(this.state.pos + 1);
- if (code === 124 && next === 125) {
- this.finishOp(9, 2);
- return;
- }
- super.readToken_pipe_amp(code);
+ get removed() {
+ return !!(this._traverseFlags & REMOVED);
}
- parseTopLevel(file, program) {
- const fileNode = super.parseTopLevel(file, program);
- if (this.state.hasFlowComment) {
- this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
+ set removed(v) {
+ if (v) {
+ this._traverseFlags |= REMOVED;
+ } else {
+ this._traverseFlags &= ~REMOVED;
}
- return fileNode;
}
- skipBlockComment() {
- if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
- if (this.state.hasFlowComment) {
- throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
- }
- this.hasFlowCommentCompletion();
- const commentSkip = this.skipFlowComment();
- if (commentSkip) {
- this.state.pos += commentSkip;
- this.state.hasFlowComment = true;
- }
- return;
- }
- return super.skipBlockComment(this.state.hasFlowComment ? "*-/" : "*/");
- }
- skipFlowComment() {
- const {
- pos
- } = this.state;
- let shiftToFirstNonWhiteSpace = 2;
- while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
- shiftToFirstNonWhiteSpace++;
- }
- const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos);
- const ch3 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos + 1);
- if (ch2 === 58 && ch3 === 58) {
- return shiftToFirstNonWhiteSpace + 2;
- }
- if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") {
- return shiftToFirstNonWhiteSpace + 12;
- }
- if (ch2 === 58 && ch3 !== 58) {
- return shiftToFirstNonWhiteSpace;
- }
- return false;
- }
- hasFlowCommentCompletion() {
- const end = this.input.indexOf("*/", this.state.pos);
- if (end === -1) {
- throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
- }
- }
- flowEnumErrorBooleanMemberNotInitialized(loc, {
- enumName,
- memberName
- }) {
- this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
- memberName,
- enumName
- });
- }
- flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
- return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
- }
- flowEnumErrorNumberMemberNotInitialized(loc, details) {
- this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
- }
- flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
- this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
- }
- flowEnumMemberInit() {
- const startLoc = this.state.startLoc;
- const endOfInit = () => this.match(12) || this.match(8);
- switch (this.state.type) {
- case 135:
- {
- const literal = this.parseNumericLiteral(this.state.value);
- if (endOfInit()) {
- return {
- type: "number",
- loc: literal.loc.start,
- value: literal
- };
- }
- return {
- type: "invalid",
- loc: startLoc
- };
- }
- case 134:
- {
- const literal = this.parseStringLiteral(this.state.value);
- if (endOfInit()) {
- return {
- type: "string",
- loc: literal.loc.start,
- value: literal
- };
- }
- return {
- type: "invalid",
- loc: startLoc
- };
- }
- case 85:
- case 86:
- {
- const literal = this.parseBooleanLiteral(this.match(85));
- if (endOfInit()) {
- return {
- type: "boolean",
- loc: literal.loc.start,
- value: literal
- };
- }
- return {
- type: "invalid",
- loc: startLoc
- };
- }
- default:
- return {
- type: "invalid",
- loc: startLoc
- };
+}
+Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
+{
+ NodePath.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
+}
+for (const type of t.TYPES) {
+ const typeKey = `is${type}`;
+ const fn = t[typeKey];
+ NodePath.prototype[typeKey] = function (opts) {
+ return fn(this.node, opts);
+ };
+ NodePath.prototype[`assert${type}`] = function (opts) {
+ if (!fn(this.node, opts)) {
+ throw new TypeError(`Expected node path of type ${type}`);
}
+ };
+}
+Object.assign(NodePath.prototype, NodePath_virtual_types_validator);
+for (const type of Object.keys(virtualTypes)) {
+ if (type[0] === "_") continue;
+ if (!t.TYPES.includes(type)) t.TYPES.push(type);
+}
+var _default = NodePath;
+exports["default"] = _default;
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 8045:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._getTypeAnnotation = _getTypeAnnotation;
+exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches;
+exports.couldBeBaseType = couldBeBaseType;
+exports.getTypeAnnotation = getTypeAnnotation;
+exports.isBaseType = isBaseType;
+exports.isGenericType = isGenericType;
+var inferers = __nccwpck_require__(9129);
+var _t = __nccwpck_require__(7912);
+const {
+ anyTypeAnnotation,
+ isAnyTypeAnnotation,
+ isArrayTypeAnnotation,
+ isBooleanTypeAnnotation,
+ isEmptyTypeAnnotation,
+ isFlowBaseAnnotation,
+ isGenericTypeAnnotation,
+ isIdentifier,
+ isMixedTypeAnnotation,
+ isNumberTypeAnnotation,
+ isStringTypeAnnotation,
+ isTSArrayType,
+ isTSTypeAnnotation,
+ isTSTypeReference,
+ isTupleTypeAnnotation,
+ isTypeAnnotation,
+ isUnionTypeAnnotation,
+ isVoidTypeAnnotation,
+ stringTypeAnnotation,
+ voidTypeAnnotation
+} = _t;
+function getTypeAnnotation() {
+ let type = this.getData("typeAnnotation");
+ if (type != null) {
+ return type;
}
- flowEnumMemberRaw() {
- const loc = this.state.startLoc;
- const id = this.parseIdentifier(true);
- const init = this.eat(29) ? this.flowEnumMemberInit() : {
- type: "none",
- loc
- };
- return {
- id,
- init
- };
- }
- flowEnumCheckExplicitTypeMismatch(loc, context, expectedType) {
- const {
- explicitType
- } = context;
- if (explicitType === null) {
- return;
- }
- if (explicitType !== expectedType) {
- this.flowEnumErrorInvalidMemberInitializer(loc, context);
- }
+ type = this._getTypeAnnotation() || anyTypeAnnotation();
+ if (isTypeAnnotation(type) || isTSTypeAnnotation(type)) {
+ type = type.typeAnnotation;
}
- flowEnumMembers({
- enumName,
- explicitType
- }) {
- const seenNames = new Set();
- const members = {
- booleanMembers: [],
- numberMembers: [],
- stringMembers: [],
- defaultedMembers: []
- };
- let hasUnknownMembers = false;
- while (!this.match(8)) {
- if (this.eat(21)) {
- hasUnknownMembers = true;
- break;
- }
- const memberNode = this.startNode();
- const {
- id,
- init
- } = this.flowEnumMemberRaw();
- const memberName = id.name;
- if (memberName === "") {
- continue;
- }
- if (/^[a-z]/.test(memberName)) {
- this.raise(FlowErrors.EnumInvalidMemberName, id, {
- memberName,
- suggestion: memberName[0].toUpperCase() + memberName.slice(1),
- enumName
- });
- }
- if (seenNames.has(memberName)) {
- this.raise(FlowErrors.EnumDuplicateMemberName, id, {
- memberName,
- enumName
- });
- }
- seenNames.add(memberName);
- const context = {
- enumName,
- explicitType,
- memberName
- };
- memberNode.id = id;
- switch (init.type) {
- case "boolean":
- {
- this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "boolean");
- memberNode.init = init.value;
- members.booleanMembers.push(this.finishNode(memberNode, "EnumBooleanMember"));
- break;
- }
- case "number":
- {
- this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "number");
- memberNode.init = init.value;
- members.numberMembers.push(this.finishNode(memberNode, "EnumNumberMember"));
- break;
- }
- case "string":
- {
- this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "string");
- memberNode.init = init.value;
- members.stringMembers.push(this.finishNode(memberNode, "EnumStringMember"));
- break;
- }
- case "invalid":
- {
- throw this.flowEnumErrorInvalidMemberInitializer(init.loc, context);
- }
- case "none":
- {
- switch (explicitType) {
- case "boolean":
- this.flowEnumErrorBooleanMemberNotInitialized(init.loc, context);
- break;
- case "number":
- this.flowEnumErrorNumberMemberNotInitialized(init.loc, context);
- break;
- default:
- members.defaultedMembers.push(this.finishNode(memberNode, "EnumDefaultedMember"));
- }
- }
- }
- if (!this.match(8)) {
- this.expect(12);
+ this.setData("typeAnnotation", type);
+ return type;
+}
+const typeAnnotationInferringNodes = new WeakSet();
+function _getTypeAnnotation() {
+ const node = this.node;
+ if (!node) {
+ if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
+ const declar = this.parentPath.parentPath;
+ const declarParent = declar.parentPath;
+ if (declar.key === "left" && declarParent.isForInStatement()) {
+ return stringTypeAnnotation();
}
- }
- return {
- members,
- hasUnknownMembers
- };
- }
- flowEnumStringMembers(initializedMembers, defaultedMembers, {
- enumName
- }) {
- if (initializedMembers.length === 0) {
- return defaultedMembers;
- } else if (defaultedMembers.length === 0) {
- return initializedMembers;
- } else if (defaultedMembers.length > initializedMembers.length) {
- for (const member of initializedMembers) {
- this.flowEnumErrorStringMemberInconsistentlyInitialized(member, {
- enumName
- });
+ if (declar.key === "left" && declarParent.isForOfStatement()) {
+ return anyTypeAnnotation();
}
- return defaultedMembers;
+ return voidTypeAnnotation();
} else {
- for (const member of defaultedMembers) {
- this.flowEnumErrorStringMemberInconsistentlyInitialized(member, {
- enumName
- });
- }
- return initializedMembers;
+ return;
}
}
- flowEnumParseExplicitType({
- enumName
- }) {
- if (!this.eatContextual(102)) return null;
- if (!tokenIsIdentifier(this.state.type)) {
- throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
- enumName
- });
+ if (node.typeAnnotation) {
+ return node.typeAnnotation;
+ }
+ if (typeAnnotationInferringNodes.has(node)) {
+ return;
+ }
+ typeAnnotationInferringNodes.add(node);
+ try {
+ var _inferer;
+ let inferer = inferers[node.type];
+ if (inferer) {
+ return inferer.call(this, node);
}
- const {
- value
- } = this.state;
- this.next();
- if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
- this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
- enumName,
- invalidEnumType: value
- });
+ inferer = inferers[this.parentPath.type];
+ if ((_inferer = inferer) != null && _inferer.validParent) {
+ return this.parentPath.getTypeAnnotation();
}
- return value;
+ } finally {
+ typeAnnotationInferringNodes.delete(node);
}
- flowEnumBody(node, id) {
- const enumName = id.name;
- const nameLoc = id.loc.start;
- const explicitType = this.flowEnumParseExplicitType({
- enumName
- });
- this.expect(5);
- const {
- members,
- hasUnknownMembers
- } = this.flowEnumMembers({
- enumName,
- explicitType
- });
- node.hasUnknownMembers = hasUnknownMembers;
- switch (explicitType) {
- case "boolean":
- node.explicitType = true;
- node.members = members.booleanMembers;
- this.expect(8);
- return this.finishNode(node, "EnumBooleanBody");
- case "number":
- node.explicitType = true;
- node.members = members.numberMembers;
- this.expect(8);
- return this.finishNode(node, "EnumNumberBody");
- case "string":
- node.explicitType = true;
- node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
- enumName
- });
- this.expect(8);
- return this.finishNode(node, "EnumStringBody");
- case "symbol":
- node.members = members.defaultedMembers;
- this.expect(8);
- return this.finishNode(node, "EnumSymbolBody");
- default:
- {
- const empty = () => {
- node.members = [];
- this.expect(8);
- return this.finishNode(node, "EnumStringBody");
- };
- node.explicitType = false;
- const boolsLen = members.booleanMembers.length;
- const numsLen = members.numberMembers.length;
- const strsLen = members.stringMembers.length;
- const defaultedLen = members.defaultedMembers.length;
- if (!boolsLen && !numsLen && !strsLen && !defaultedLen) {
- return empty();
- } else if (!boolsLen && !numsLen) {
- node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
- enumName
- });
- this.expect(8);
- return this.finishNode(node, "EnumStringBody");
- } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) {
- for (const member of members.defaultedMembers) {
- this.flowEnumErrorBooleanMemberNotInitialized(member.loc.start, {
- enumName,
- memberName: member.id.name
- });
- }
- node.members = members.booleanMembers;
- this.expect(8);
- return this.finishNode(node, "EnumBooleanBody");
- } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) {
- for (const member of members.defaultedMembers) {
- this.flowEnumErrorNumberMemberNotInitialized(member.loc.start, {
- enumName,
- memberName: member.id.name
- });
- }
- node.members = members.numberMembers;
- this.expect(8);
- return this.finishNode(node, "EnumNumberBody");
- } else {
- this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
- enumName
- });
- return empty();
- }
- }
+}
+function isBaseType(baseName, soft) {
+ return _isBaseType(baseName, this.getTypeAnnotation(), soft);
+}
+function _isBaseType(baseName, type, soft) {
+ if (baseName === "string") {
+ return isStringTypeAnnotation(type);
+ } else if (baseName === "number") {
+ return isNumberTypeAnnotation(type);
+ } else if (baseName === "boolean") {
+ return isBooleanTypeAnnotation(type);
+ } else if (baseName === "any") {
+ return isAnyTypeAnnotation(type);
+ } else if (baseName === "mixed") {
+ return isMixedTypeAnnotation(type);
+ } else if (baseName === "empty") {
+ return isEmptyTypeAnnotation(type);
+ } else if (baseName === "void") {
+ return isVoidTypeAnnotation(type);
+ } else {
+ if (soft) {
+ return false;
+ } else {
+ throw new Error(`Unknown base type ${baseName}`);
}
}
- flowParseEnumDeclaration(node) {
- const id = this.parseIdentifier();
- node.id = id;
- node.body = this.flowEnumBody(this.startNode(), id);
- return this.finishNode(node, "EnumDeclaration");
- }
- jsxParseOpeningElementAfterName(node) {
- if (this.shouldParseTypes()) {
- if (this.match(47) || this.match(51)) {
- node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
+}
+function couldBeBaseType(name) {
+ const type = this.getTypeAnnotation();
+ if (isAnyTypeAnnotation(type)) return true;
+ if (isUnionTypeAnnotation(type)) {
+ for (const type2 of type.types) {
+ if (isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
+ return true;
}
}
- return super.jsxParseOpeningElementAfterName(node);
- }
- isLookaheadToken_lt() {
- const next = this.nextTokenStart();
- if (this.input.charCodeAt(next) === 60) {
- const afterNext = this.input.charCodeAt(next + 1);
- return afterNext !== 60 && afterNext !== 61;
- }
return false;
+ } else {
+ return _isBaseType(name, type, true);
}
- reScan_lt_gt() {
- const {
- type
- } = this.state;
- if (type === 47) {
- this.state.pos -= 1;
- this.readToken_lt();
- } else if (type === 48) {
- this.state.pos -= 1;
- this.readToken_gt();
- }
+}
+function baseTypeStrictlyMatches(rightArg) {
+ const left = this.getTypeAnnotation();
+ const right = rightArg.getTypeAnnotation();
+ if (!isAnyTypeAnnotation(left) && isFlowBaseAnnotation(left)) {
+ return right.type === left.type;
}
- reScan_lt() {
- const {
- type
- } = this.state;
- if (type === 51) {
- this.state.pos -= 2;
- this.finishOp(47, 1);
- return 47;
- }
- return type;
- }
- maybeUnwrapTypeCastExpression(node) {
- return node.type === "TypeCastExpression" ? node.expression : node;
- }
-};
-const entities = {
- __proto__: null,
- quot: "\u0022",
- amp: "&",
- apos: "\u0027",
- lt: "<",
- gt: ">",
- nbsp: "\u00A0",
- iexcl: "\u00A1",
- cent: "\u00A2",
- pound: "\u00A3",
- curren: "\u00A4",
- yen: "\u00A5",
- brvbar: "\u00A6",
- sect: "\u00A7",
- uml: "\u00A8",
- copy: "\u00A9",
- ordf: "\u00AA",
- laquo: "\u00AB",
- not: "\u00AC",
- shy: "\u00AD",
- reg: "\u00AE",
- macr: "\u00AF",
- deg: "\u00B0",
- plusmn: "\u00B1",
- sup2: "\u00B2",
- sup3: "\u00B3",
- acute: "\u00B4",
- micro: "\u00B5",
- para: "\u00B6",
- middot: "\u00B7",
- cedil: "\u00B8",
- sup1: "\u00B9",
- ordm: "\u00BA",
- raquo: "\u00BB",
- frac14: "\u00BC",
- frac12: "\u00BD",
- frac34: "\u00BE",
- iquest: "\u00BF",
- Agrave: "\u00C0",
- Aacute: "\u00C1",
- Acirc: "\u00C2",
- Atilde: "\u00C3",
- Auml: "\u00C4",
- Aring: "\u00C5",
- AElig: "\u00C6",
- Ccedil: "\u00C7",
- Egrave: "\u00C8",
- Eacute: "\u00C9",
- Ecirc: "\u00CA",
- Euml: "\u00CB",
- Igrave: "\u00CC",
- Iacute: "\u00CD",
- Icirc: "\u00CE",
- Iuml: "\u00CF",
- ETH: "\u00D0",
- Ntilde: "\u00D1",
- Ograve: "\u00D2",
- Oacute: "\u00D3",
- Ocirc: "\u00D4",
- Otilde: "\u00D5",
- Ouml: "\u00D6",
- times: "\u00D7",
- Oslash: "\u00D8",
- Ugrave: "\u00D9",
- Uacute: "\u00DA",
- Ucirc: "\u00DB",
- Uuml: "\u00DC",
- Yacute: "\u00DD",
- THORN: "\u00DE",
- szlig: "\u00DF",
- agrave: "\u00E0",
- aacute: "\u00E1",
- acirc: "\u00E2",
- atilde: "\u00E3",
- auml: "\u00E4",
- aring: "\u00E5",
- aelig: "\u00E6",
- ccedil: "\u00E7",
- egrave: "\u00E8",
- eacute: "\u00E9",
- ecirc: "\u00EA",
- euml: "\u00EB",
- igrave: "\u00EC",
- iacute: "\u00ED",
- icirc: "\u00EE",
- iuml: "\u00EF",
- eth: "\u00F0",
- ntilde: "\u00F1",
- ograve: "\u00F2",
- oacute: "\u00F3",
- ocirc: "\u00F4",
- otilde: "\u00F5",
- ouml: "\u00F6",
- divide: "\u00F7",
- oslash: "\u00F8",
- ugrave: "\u00F9",
- uacute: "\u00FA",
- ucirc: "\u00FB",
- uuml: "\u00FC",
- yacute: "\u00FD",
- thorn: "\u00FE",
- yuml: "\u00FF",
- OElig: "\u0152",
- oelig: "\u0153",
- Scaron: "\u0160",
- scaron: "\u0161",
- Yuml: "\u0178",
- fnof: "\u0192",
- circ: "\u02C6",
- tilde: "\u02DC",
- Alpha: "\u0391",
- Beta: "\u0392",
- Gamma: "\u0393",
- Delta: "\u0394",
- Epsilon: "\u0395",
- Zeta: "\u0396",
- Eta: "\u0397",
- Theta: "\u0398",
- Iota: "\u0399",
- Kappa: "\u039A",
- Lambda: "\u039B",
- Mu: "\u039C",
- Nu: "\u039D",
- Xi: "\u039E",
- Omicron: "\u039F",
- Pi: "\u03A0",
- Rho: "\u03A1",
- Sigma: "\u03A3",
- Tau: "\u03A4",
- Upsilon: "\u03A5",
- Phi: "\u03A6",
- Chi: "\u03A7",
- Psi: "\u03A8",
- Omega: "\u03A9",
- alpha: "\u03B1",
- beta: "\u03B2",
- gamma: "\u03B3",
- delta: "\u03B4",
- epsilon: "\u03B5",
- zeta: "\u03B6",
- eta: "\u03B7",
- theta: "\u03B8",
- iota: "\u03B9",
- kappa: "\u03BA",
- lambda: "\u03BB",
- mu: "\u03BC",
- nu: "\u03BD",
- xi: "\u03BE",
- omicron: "\u03BF",
- pi: "\u03C0",
- rho: "\u03C1",
- sigmaf: "\u03C2",
- sigma: "\u03C3",
- tau: "\u03C4",
- upsilon: "\u03C5",
- phi: "\u03C6",
- chi: "\u03C7",
- psi: "\u03C8",
- omega: "\u03C9",
- thetasym: "\u03D1",
- upsih: "\u03D2",
- piv: "\u03D6",
- ensp: "\u2002",
- emsp: "\u2003",
- thinsp: "\u2009",
- zwnj: "\u200C",
- zwj: "\u200D",
- lrm: "\u200E",
- rlm: "\u200F",
- ndash: "\u2013",
- mdash: "\u2014",
- lsquo: "\u2018",
- rsquo: "\u2019",
- sbquo: "\u201A",
- ldquo: "\u201C",
- rdquo: "\u201D",
- bdquo: "\u201E",
- dagger: "\u2020",
- Dagger: "\u2021",
- bull: "\u2022",
- hellip: "\u2026",
- permil: "\u2030",
- prime: "\u2032",
- Prime: "\u2033",
- lsaquo: "\u2039",
- rsaquo: "\u203A",
- oline: "\u203E",
- frasl: "\u2044",
- euro: "\u20AC",
- image: "\u2111",
- weierp: "\u2118",
- real: "\u211C",
- trade: "\u2122",
- alefsym: "\u2135",
- larr: "\u2190",
- uarr: "\u2191",
- rarr: "\u2192",
- darr: "\u2193",
- harr: "\u2194",
- crarr: "\u21B5",
- lArr: "\u21D0",
- uArr: "\u21D1",
- rArr: "\u21D2",
- dArr: "\u21D3",
- hArr: "\u21D4",
- forall: "\u2200",
- part: "\u2202",
- exist: "\u2203",
- empty: "\u2205",
- nabla: "\u2207",
- isin: "\u2208",
- notin: "\u2209",
- ni: "\u220B",
- prod: "\u220F",
- sum: "\u2211",
- minus: "\u2212",
- lowast: "\u2217",
- radic: "\u221A",
- prop: "\u221D",
- infin: "\u221E",
- ang: "\u2220",
- and: "\u2227",
- or: "\u2228",
- cap: "\u2229",
- cup: "\u222A",
- int: "\u222B",
- there4: "\u2234",
- sim: "\u223C",
- cong: "\u2245",
- asymp: "\u2248",
- ne: "\u2260",
- equiv: "\u2261",
- le: "\u2264",
- ge: "\u2265",
- sub: "\u2282",
- sup: "\u2283",
- nsub: "\u2284",
- sube: "\u2286",
- supe: "\u2287",
- oplus: "\u2295",
- otimes: "\u2297",
- perp: "\u22A5",
- sdot: "\u22C5",
- lceil: "\u2308",
- rceil: "\u2309",
- lfloor: "\u230A",
- rfloor: "\u230B",
- lang: "\u2329",
- rang: "\u232A",
- loz: "\u25CA",
- spades: "\u2660",
- clubs: "\u2663",
- hearts: "\u2665",
- diams: "\u2666"
-};
-const JsxErrors = ParseErrorEnum`jsx`({
- AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
- MissingClosingTagElement: ({
- openingTagName
- }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
- MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
- UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
- UnexpectedToken: ({
- unexpected,
- HTMLEntity
- }) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,
- UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
- UnterminatedJsxContent: "Unterminated JSX contents.",
- UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...>?"
-});
-function isFragment(object) {
- return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
-}
-function getQualifiedJSXName(object) {
- if (object.type === "JSXIdentifier") {
- return object.name;
- }
- if (object.type === "JSXNamespacedName") {
- return object.namespace.name + ":" + object.name.name;
- }
- if (object.type === "JSXMemberExpression") {
- return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
- }
- throw new Error("Node had unexpected type: " + object.type);
-}
-var jsx = superClass => class JSXParserMixin extends superClass {
- jsxReadToken() {
- let out = "";
- let chunkStart = this.state.pos;
- for (;;) {
- if (this.state.pos >= this.length) {
- throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
- }
- const ch = this.input.charCodeAt(this.state.pos);
- switch (ch) {
- case 60:
- case 123:
- if (this.state.pos === this.state.start) {
- if (ch === 60 && this.state.canStartJSXElement) {
- ++this.state.pos;
- this.finishToken(143);
- } else {
- super.getTokenFromCode(ch);
- }
- return;
- }
- out += this.input.slice(chunkStart, this.state.pos);
- this.finishToken(142, out);
- return;
- case 38:
- out += this.input.slice(chunkStart, this.state.pos);
- out += this.jsxReadEntity();
- chunkStart = this.state.pos;
- break;
- case 62:
- case 125:
- default:
- if (isNewLine(ch)) {
- out += this.input.slice(chunkStart, this.state.pos);
- out += this.jsxReadNewLine(true);
- chunkStart = this.state.pos;
- } else {
- ++this.state.pos;
- }
- }
- }
- }
- jsxReadNewLine(normalizeCRLF) {
- const ch = this.input.charCodeAt(this.state.pos);
- let out;
- ++this.state.pos;
- if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
- ++this.state.pos;
- out = normalizeCRLF ? "\n" : "\r\n";
- } else {
- out = String.fromCharCode(ch);
- }
- ++this.state.curLine;
- this.state.lineStart = this.state.pos;
- return out;
- }
- jsxReadString(quote) {
- let out = "";
- let chunkStart = ++this.state.pos;
- for (;;) {
- if (this.state.pos >= this.length) {
- throw this.raise(Errors.UnterminatedString, this.state.startLoc);
- }
- const ch = this.input.charCodeAt(this.state.pos);
- if (ch === quote) break;
- if (ch === 38) {
- out += this.input.slice(chunkStart, this.state.pos);
- out += this.jsxReadEntity();
- chunkStart = this.state.pos;
- } else if (isNewLine(ch)) {
- out += this.input.slice(chunkStart, this.state.pos);
- out += this.jsxReadNewLine(false);
- chunkStart = this.state.pos;
- } else {
- ++this.state.pos;
- }
+ return false;
+}
+function isGenericType(genericName) {
+ const type = this.getTypeAnnotation();
+ if (genericName === "Array") {
+ if (isTSArrayType(type) || isArrayTypeAnnotation(type) || isTupleTypeAnnotation(type)) {
+ return true;
}
- out += this.input.slice(chunkStart, this.state.pos++);
- this.finishToken(134, out);
}
- jsxReadEntity() {
- const startPos = ++this.state.pos;
- if (this.codePointAtPos(this.state.pos) === 35) {
- ++this.state.pos;
- let radix = 10;
- if (this.codePointAtPos(this.state.pos) === 120) {
- radix = 16;
- ++this.state.pos;
- }
- const codePoint = this.readInt(radix, undefined, false, "bail");
- if (codePoint !== null && this.codePointAtPos(this.state.pos) === 59) {
- ++this.state.pos;
- return String.fromCodePoint(codePoint);
- }
+ return isGenericTypeAnnotation(type) && isIdentifier(type.id, {
+ name: genericName
+ }) || isTSTypeReference(type) && isIdentifier(type.typeName, {
+ name: genericName
+ });
+}
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 2354:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = _default;
+var _t = __nccwpck_require__(7912);
+var _util = __nccwpck_require__(8456);
+const {
+ BOOLEAN_NUMBER_BINARY_OPERATORS,
+ createTypeAnnotationBasedOnTypeof,
+ numberTypeAnnotation,
+ voidTypeAnnotation
+} = _t;
+function _default(node) {
+ if (!this.isReferenced()) return;
+ const binding = this.scope.getBinding(node.name);
+ if (binding) {
+ if (binding.identifier.typeAnnotation) {
+ return binding.identifier.typeAnnotation;
} else {
- let count = 0;
- let semi = false;
- while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) === 59)) {
- ++this.state.pos;
- }
- if (semi) {
- const desc = this.input.slice(startPos, this.state.pos);
- const entity = entities[desc];
- ++this.state.pos;
- if (entity) {
- return entity;
- }
- }
+ return getTypeAnnotationBindingConstantViolations(binding, this, node.name);
}
- this.state.pos = startPos;
- return "&";
}
- jsxReadWord() {
- let ch;
- const start = this.state.pos;
- do {
- ch = this.input.charCodeAt(++this.state.pos);
- } while (isIdentifierChar(ch) || ch === 45);
- this.finishToken(141, this.input.slice(start, this.state.pos));
- }
- jsxParseIdentifier() {
- const node = this.startNode();
- if (this.match(141)) {
- node.name = this.state.value;
- } else if (tokenIsKeyword(this.state.type)) {
- node.name = tokenLabelName(this.state.type);
- } else {
- this.unexpected();
- }
- this.next();
- return this.finishNode(node, "JSXIdentifier");
- }
- jsxParseNamespacedName() {
- const startLoc = this.state.startLoc;
- const name = this.jsxParseIdentifier();
- if (!this.eat(14)) return name;
- const node = this.startNodeAt(startLoc);
- node.namespace = name;
- node.name = this.jsxParseIdentifier();
- return this.finishNode(node, "JSXNamespacedName");
- }
- jsxParseElementName() {
- const startLoc = this.state.startLoc;
- let node = this.jsxParseNamespacedName();
- if (node.type === "JSXNamespacedName") {
- return node;
- }
- while (this.eat(16)) {
- const newNode = this.startNodeAt(startLoc);
- newNode.object = node;
- newNode.property = this.jsxParseIdentifier();
- node = this.finishNode(newNode, "JSXMemberExpression");
- }
- return node;
+ if (node.name === "undefined") {
+ return voidTypeAnnotation();
+ } else if (node.name === "NaN" || node.name === "Infinity") {
+ return numberTypeAnnotation();
+ } else if (node.name === "arguments") {}
+}
+function getTypeAnnotationBindingConstantViolations(binding, path, name) {
+ const types = [];
+ const functionConstantViolations = [];
+ let constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations);
+ const testType = getConditionalAnnotation(binding, path, name);
+ if (testType) {
+ const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
+ constantViolations = constantViolations.filter(path => testConstantViolations.indexOf(path) < 0);
+ types.push(testType.typeAnnotation);
}
- jsxParseAttributeValue() {
- let node;
- switch (this.state.type) {
- case 5:
- node = this.startNode();
- this.setContext(types.brace);
- this.next();
- node = this.jsxParseExpressionContainer(node, types.j_oTag);
- if (node.expression.type === "JSXEmptyExpression") {
- this.raise(JsxErrors.AttributeIsEmpty, node);
- }
- return node;
- case 143:
- case 134:
- return this.parseExprAtom();
- default:
- throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
+ if (constantViolations.length) {
+ constantViolations.push(...functionConstantViolations);
+ for (const violation of constantViolations) {
+ types.push(violation.getTypeAnnotation());
}
}
- jsxParseEmptyExpression() {
- const node = this.startNodeAt(this.state.lastTokEndLoc);
- return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc);
+ if (!types.length) {
+ return;
}
- jsxParseSpreadChild(node) {
- this.next();
- node.expression = this.parseExpression();
- this.setContext(types.j_expr);
- this.state.canStartJSXElement = true;
- this.expect(8);
- return this.finishNode(node, "JSXSpreadChild");
+ return (0, _util.createUnionType)(types);
+}
+function getConstantViolationsBefore(binding, path, functions) {
+ const violations = binding.constantViolations.slice();
+ violations.unshift(binding.path);
+ return violations.filter(violation => {
+ violation = violation.resolve();
+ const status = violation._guessExecutionStatusRelativeTo(path);
+ if (functions && status === "unknown") functions.push(violation);
+ return status === "before";
+ });
+}
+function inferAnnotationFromBinaryExpression(name, path) {
+ const operator = path.node.operator;
+ const right = path.get("right").resolve();
+ const left = path.get("left").resolve();
+ let target;
+ if (left.isIdentifier({
+ name
+ })) {
+ target = right;
+ } else if (right.isIdentifier({
+ name
+ })) {
+ target = left;
}
- jsxParseExpressionContainer(node, previousContext) {
- if (this.match(8)) {
- node.expression = this.jsxParseEmptyExpression();
- } else {
- const expression = this.parseExpression();
- node.expression = expression;
- }
- this.setContext(previousContext);
- this.state.canStartJSXElement = true;
- this.expect(8);
- return this.finishNode(node, "JSXExpressionContainer");
- }
- jsxParseAttribute() {
- const node = this.startNode();
- if (this.match(5)) {
- this.setContext(types.brace);
- this.next();
- this.expect(21);
- node.argument = this.parseMaybeAssignAllowIn();
- this.setContext(types.j_oTag);
- this.state.canStartJSXElement = true;
- this.expect(8);
- return this.finishNode(node, "JSXSpreadAttribute");
- }
- node.name = this.jsxParseNamespacedName();
- node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
- return this.finishNode(node, "JSXAttribute");
- }
- jsxParseOpeningElementAt(startLoc) {
- const node = this.startNodeAt(startLoc);
- if (this.eat(144)) {
- return this.finishNode(node, "JSXOpeningFragment");
- }
- node.name = this.jsxParseElementName();
- return this.jsxParseOpeningElementAfterName(node);
- }
- jsxParseOpeningElementAfterName(node) {
- const attributes = [];
- while (!this.match(56) && !this.match(144)) {
- attributes.push(this.jsxParseAttribute());
- }
- node.attributes = attributes;
- node.selfClosing = this.eat(56);
- this.expect(144);
- return this.finishNode(node, "JSXOpeningElement");
- }
- jsxParseClosingElementAt(startLoc) {
- const node = this.startNodeAt(startLoc);
- if (this.eat(144)) {
- return this.finishNode(node, "JSXClosingFragment");
- }
- node.name = this.jsxParseElementName();
- this.expect(144);
- return this.finishNode(node, "JSXClosingElement");
- }
- jsxParseElementAt(startLoc) {
- const node = this.startNodeAt(startLoc);
- const children = [];
- const openingElement = this.jsxParseOpeningElementAt(startLoc);
- let closingElement = null;
- if (!openingElement.selfClosing) {
- contents: for (;;) {
- switch (this.state.type) {
- case 143:
- startLoc = this.state.startLoc;
- this.next();
- if (this.eat(56)) {
- closingElement = this.jsxParseClosingElementAt(startLoc);
- break contents;
- }
- children.push(this.jsxParseElementAt(startLoc));
- break;
- case 142:
- children.push(this.parseLiteral(this.state.value, "JSXText"));
- break;
- case 5:
- {
- const node = this.startNode();
- this.setContext(types.brace);
- this.next();
- if (this.match(21)) {
- children.push(this.jsxParseSpreadChild(node));
- } else {
- children.push(this.jsxParseExpressionContainer(node, types.j_expr));
- }
- break;
- }
- default:
- this.unexpected();
- }
- }
- if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
- this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
- } else if (!isFragment(openingElement) && isFragment(closingElement)) {
- this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
- openingTagName: getQualifiedJSXName(openingElement.name)
- });
- } else if (!isFragment(openingElement) && !isFragment(closingElement)) {
- if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
- this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
- openingTagName: getQualifiedJSXName(openingElement.name)
- });
- }
- }
- }
- if (isFragment(openingElement)) {
- node.openingFragment = openingElement;
- node.closingFragment = closingElement;
- } else {
- node.openingElement = openingElement;
- node.closingElement = closingElement;
- }
- node.children = children;
- if (this.match(47)) {
- throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
+ if (target) {
+ if (operator === "===") {
+ return target.getTypeAnnotation();
}
- return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
- }
- jsxParseElement() {
- const startLoc = this.state.startLoc;
- this.next();
- return this.jsxParseElementAt(startLoc);
- }
- setContext(newContext) {
- const {
- context
- } = this.state;
- context[context.length - 1] = newContext;
- }
- parseExprAtom(refExpressionErrors) {
- if (this.match(143)) {
- return this.jsxParseElement();
- } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
- this.replaceToken(143);
- return this.jsxParseElement();
- } else {
- return super.parseExprAtom(refExpressionErrors);
+ if (BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
+ return numberTypeAnnotation();
}
+ return;
}
- skipSpace() {
- const curContext = this.curContext();
- if (!curContext.preserveSpace) super.skipSpace();
+ if (operator !== "===" && operator !== "==") return;
+ let typeofPath;
+ let typePath;
+ if (left.isUnaryExpression({
+ operator: "typeof"
+ })) {
+ typeofPath = left;
+ typePath = right;
+ } else if (right.isUnaryExpression({
+ operator: "typeof"
+ })) {
+ typeofPath = right;
+ typePath = left;
}
- getTokenFromCode(code) {
- const context = this.curContext();
- if (context === types.j_expr) {
- this.jsxReadToken();
- return;
- }
- if (context === types.j_oTag || context === types.j_cTag) {
- if (isIdentifierStart(code)) {
- this.jsxReadWord();
- return;
- }
- if (code === 62) {
- ++this.state.pos;
- this.finishToken(144);
- return;
- }
- if ((code === 34 || code === 39) && context === types.j_oTag) {
- this.jsxReadString(code);
+ if (!typeofPath) return;
+ if (!typeofPath.get("argument").isIdentifier({
+ name
+ })) return;
+ typePath = typePath.resolve();
+ if (!typePath.isLiteral()) return;
+ const typeValue = typePath.node.value;
+ if (typeof typeValue !== "string") return;
+ return createTypeAnnotationBasedOnTypeof(typeValue);
+}
+function getParentConditionalPath(binding, path, name) {
+ let parentPath;
+ while (parentPath = path.parentPath) {
+ if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
+ if (path.key === "test") {
return;
}
+ return parentPath;
}
- if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
- ++this.state.pos;
- this.finishToken(143);
- return;
- }
- super.getTokenFromCode(code);
- }
- updateContext(prevType) {
- const {
- context,
- type
- } = this.state;
- if (type === 56 && prevType === 143) {
- context.splice(-2, 2, types.j_cTag);
- this.state.canStartJSXElement = false;
- } else if (type === 143) {
- context.push(types.j_oTag);
- } else if (type === 144) {
- const out = context[context.length - 1];
- if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
- context.pop();
- this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
- } else {
- this.setContext(types.j_expr);
- this.state.canStartJSXElement = true;
- }
- } else {
- this.state.canStartJSXElement = tokenComesBeforeExpression(type);
+ if (parentPath.isFunction()) {
+ if (parentPath.parentPath.scope.getBinding(name) !== binding) return;
}
- }
-};
-class TypeScriptScope extends Scope {
- constructor(...args) {
- super(...args);
- this.tsNames = new Map();
+ path = parentPath;
}
}
-class TypeScriptScopeHandler extends ScopeHandler {
- constructor(...args) {
- super(...args);
- this.importsStack = [];
- }
- createScope(flags) {
- this.importsStack.push(new Set());
- return new TypeScriptScope(flags);
- }
- enter(flags) {
- if (flags === 256) {
- this.importsStack.push(new Set());
- }
- super.enter(flags);
- }
- exit() {
- const flags = super.exit();
- if (flags === 256) {
- this.importsStack.pop();
- }
- return flags;
- }
- hasImport(name, allowShadow) {
- const len = this.importsStack.length;
- if (this.importsStack[len - 1].has(name)) {
- return true;
- }
- if (!allowShadow && len > 1) {
- for (let i = 0; i < len - 1; i++) {
- if (this.importsStack[i].has(name)) return true;
- }
- }
- return false;
- }
- declareName(name, bindingType, loc) {
- if (bindingType & 4096) {
- if (this.hasImport(name, true)) {
- this.parser.raise(Errors.VarRedeclaration, loc, {
- identifierName: name
- });
- }
- this.importsStack[this.importsStack.length - 1].add(name);
- return;
- }
- const scope = this.currentScope();
- let type = scope.tsNames.get(name) || 0;
- if (bindingType & 1024) {
- this.maybeExportDefined(scope, name);
- scope.tsNames.set(name, type | 16);
- return;
- }
- super.declareName(name, bindingType, loc);
- if (bindingType & 2) {
- if (!(bindingType & 1)) {
- this.checkRedeclarationInScope(scope, name, bindingType, loc);
- this.maybeExportDefined(scope, name);
- }
- type = type | 1;
- }
- if (bindingType & 256) {
- type = type | 2;
- }
- if (bindingType & 512) {
- type = type | 4;
- }
- if (bindingType & 128) {
- type = type | 8;
- }
- if (type) scope.tsNames.set(name, type);
- }
- isRedeclaredInScope(scope, name, bindingType) {
- const type = scope.tsNames.get(name);
- if ((type & 2) > 0) {
- if (bindingType & 256) {
- const isConst = !!(bindingType & 512);
- const wasConst = (type & 4) > 0;
- return isConst !== wasConst;
- }
- return true;
- }
- if (bindingType & 128 && (type & 8) > 0) {
- if (scope.names.get(name) & 2) {
- return !!(bindingType & 1);
- } else {
- return false;
+function getConditionalAnnotation(binding, path, name) {
+ const ifStatement = getParentConditionalPath(binding, path, name);
+ if (!ifStatement) return;
+ const test = ifStatement.get("test");
+ const paths = [test];
+ const types = [];
+ for (let i = 0; i < paths.length; i++) {
+ const path = paths[i];
+ if (path.isLogicalExpression()) {
+ if (path.node.operator === "&&") {
+ paths.push(path.get("left"));
+ paths.push(path.get("right"));
}
+ } else if (path.isBinaryExpression()) {
+ const type = inferAnnotationFromBinaryExpression(name, path);
+ if (type) types.push(type);
}
- if (bindingType & 2 && (type & 1) > 0) {
- return true;
- }
- return super.isRedeclaredInScope(scope, name, bindingType);
}
- checkLocalExport(id) {
- const {
- name
- } = id;
- if (this.hasImport(name)) return;
- const len = this.scopeStack.length;
- for (let i = len - 1; i >= 0; i--) {
- const scope = this.scopeStack[i];
- const type = scope.tsNames.get(name);
- if ((type & 1) > 0 || (type & 16) > 0) {
- return;
- }
- }
- super.checkLocalExport(id);
+ if (types.length) {
+ return {
+ typeAnnotation: (0, _util.createUnionType)(types),
+ ifStatement
+ };
}
+ return getConditionalAnnotation(binding, ifStatement, name);
}
-const unwrapParenthesizedExpression = node => {
- return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
-};
-class LValParser extends NodeUtils {
- toAssignable(node, isLHS = false) {
- var _node$extra, _node$extra3;
- let parenthesized = undefined;
- if (node.type === "ParenthesizedExpression" || (_node$extra = node.extra) != null && _node$extra.parenthesized) {
- parenthesized = unwrapParenthesizedExpression(node);
- if (isLHS) {
- if (parenthesized.type === "Identifier") {
- this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
- } else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
- this.raise(Errors.InvalidParenthesizedAssignment, node);
- }
- } else {
- this.raise(Errors.InvalidParenthesizedAssignment, node);
- }
- }
- switch (node.type) {
- case "Identifier":
- case "ObjectPattern":
- case "ArrayPattern":
- case "AssignmentPattern":
- case "RestElement":
- break;
- case "ObjectExpression":
- node.type = "ObjectPattern";
- for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
- var _node$extra2;
- const prop = node.properties[i];
- const isLast = i === last;
- this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
- if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
- this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
- }
- }
- break;
- case "ObjectProperty":
- {
- const {
- key,
- value
- } = node;
- if (this.isPrivateName(key)) {
- this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
- }
- this.toAssignable(value, isLHS);
- break;
- }
- case "SpreadElement":
- {
- throw new Error("Internal @babel/parser error (this is a bug, please report it)." + " SpreadElement should be converted by .toAssignable's caller.");
- }
- case "ArrayExpression":
- node.type = "ArrayPattern";
- this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingCommaLoc, isLHS);
- break;
- case "AssignmentExpression":
- if (node.operator !== "=") {
- this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
- }
- node.type = "AssignmentPattern";
- delete node.operator;
- this.toAssignable(node.left, isLHS);
- break;
- case "ParenthesizedExpression":
- this.toAssignable(parenthesized, isLHS);
- break;
- }
- }
- toAssignableObjectExpressionProp(prop, isLast, isLHS) {
- if (prop.type === "ObjectMethod") {
- this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
- } else if (prop.type === "SpreadElement") {
- prop.type = "RestElement";
- const arg = prop.argument;
- this.checkToRestConversion(arg, false);
- this.toAssignable(arg, isLHS);
- if (!isLast) {
- this.raise(Errors.RestTrailingComma, prop);
- }
- } else {
- this.toAssignable(prop, isLHS);
- }
- }
- toAssignableList(exprList, trailingCommaLoc, isLHS) {
- const end = exprList.length - 1;
- for (let i = 0; i <= end; i++) {
- const elt = exprList[i];
- if (!elt) continue;
- this.toAssignableListItem(exprList, i, isLHS);
- if (elt.type === "RestElement") {
- if (i < end) {
- this.raise(Errors.RestTrailingComma, elt);
- } else if (trailingCommaLoc) {
- this.raise(Errors.RestTrailingComma, trailingCommaLoc);
- }
- }
- }
- }
- toAssignableListItem(exprList, index, isLHS) {
- const node = exprList[index];
- if (node.type === "SpreadElement") {
- node.type = "RestElement";
- const arg = node.argument;
- this.checkToRestConversion(arg, true);
- this.toAssignable(arg, isLHS);
- } else {
- this.toAssignable(node, isLHS);
- }
+
+//# sourceMappingURL=inferer-reference.js.map
+
+
+/***/ }),
+
+/***/ 9129:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.ArrayExpression = ArrayExpression;
+exports.AssignmentExpression = AssignmentExpression;
+exports.BinaryExpression = BinaryExpression;
+exports.BooleanLiteral = BooleanLiteral;
+exports.CallExpression = CallExpression;
+exports.ConditionalExpression = ConditionalExpression;
+exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = Func;
+Object.defineProperty(exports, "Identifier", ({
+ enumerable: true,
+ get: function () {
+ return _infererReference.default;
}
- isAssignable(node, isBinding) {
- switch (node.type) {
- case "Identifier":
- case "ObjectPattern":
- case "ArrayPattern":
- case "AssignmentPattern":
- case "RestElement":
- return true;
- case "ObjectExpression":
- {
- const last = node.properties.length - 1;
- return node.properties.every((prop, i) => {
- return prop.type !== "ObjectMethod" && (i === last || prop.type !== "SpreadElement") && this.isAssignable(prop);
- });
- }
- case "ObjectProperty":
- return this.isAssignable(node.value);
- case "SpreadElement":
- return this.isAssignable(node.argument);
- case "ArrayExpression":
- return node.elements.every(element => element === null || this.isAssignable(element));
- case "AssignmentExpression":
- return node.operator === "=";
- case "ParenthesizedExpression":
- return this.isAssignable(node.expression);
- case "MemberExpression":
- case "OptionalMemberExpression":
- return !isBinding;
- default:
- return false;
- }
+}));
+exports.LogicalExpression = LogicalExpression;
+exports.NewExpression = NewExpression;
+exports.NullLiteral = NullLiteral;
+exports.NumericLiteral = NumericLiteral;
+exports.ObjectExpression = ObjectExpression;
+exports.ParenthesizedExpression = ParenthesizedExpression;
+exports.RegExpLiteral = RegExpLiteral;
+exports.RestElement = RestElement;
+exports.SequenceExpression = SequenceExpression;
+exports.StringLiteral = StringLiteral;
+exports.TSAsExpression = TSAsExpression;
+exports.TSNonNullExpression = TSNonNullExpression;
+exports.TaggedTemplateExpression = TaggedTemplateExpression;
+exports.TemplateLiteral = TemplateLiteral;
+exports.TypeCastExpression = TypeCastExpression;
+exports.UnaryExpression = UnaryExpression;
+exports.UpdateExpression = UpdateExpression;
+exports.VariableDeclarator = VariableDeclarator;
+var _t = __nccwpck_require__(7912);
+var _infererReference = __nccwpck_require__(2354);
+var _util = __nccwpck_require__(8456);
+const {
+ BOOLEAN_BINARY_OPERATORS,
+ BOOLEAN_UNARY_OPERATORS,
+ NUMBER_BINARY_OPERATORS,
+ NUMBER_UNARY_OPERATORS,
+ STRING_UNARY_OPERATORS,
+ anyTypeAnnotation,
+ arrayTypeAnnotation,
+ booleanTypeAnnotation,
+ buildMatchMemberExpression,
+ genericTypeAnnotation,
+ identifier,
+ nullLiteralTypeAnnotation,
+ numberTypeAnnotation,
+ stringTypeAnnotation,
+ tupleTypeAnnotation,
+ unionTypeAnnotation,
+ voidTypeAnnotation,
+ isIdentifier
+} = _t;
+function VariableDeclarator() {
+ if (!this.get("id").isIdentifier()) return;
+ return this.get("init").getTypeAnnotation();
+}
+function TypeCastExpression(node) {
+ return node.typeAnnotation;
+}
+TypeCastExpression.validParent = true;
+function TSAsExpression(node) {
+ return node.typeAnnotation;
+}
+TSAsExpression.validParent = true;
+function TSNonNullExpression() {
+ return this.get("expression").getTypeAnnotation();
+}
+function NewExpression(node) {
+ if (node.callee.type === "Identifier") {
+ return genericTypeAnnotation(node.callee);
}
- toReferencedList(exprList, isParenthesizedExpr) {
- return exprList;
+}
+function TemplateLiteral() {
+ return stringTypeAnnotation();
+}
+function UnaryExpression(node) {
+ const operator = node.operator;
+ if (operator === "void") {
+ return voidTypeAnnotation();
+ } else if (NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
+ return numberTypeAnnotation();
+ } else if (STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
+ return stringTypeAnnotation();
+ } else if (BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
+ return booleanTypeAnnotation();
}
- toReferencedListDeep(exprList, isParenthesizedExpr) {
- this.toReferencedList(exprList, isParenthesizedExpr);
- for (const expr of exprList) {
- if ((expr == null ? void 0 : expr.type) === "ArrayExpression") {
- this.toReferencedListDeep(expr.elements);
- }
+}
+function BinaryExpression(node) {
+ const operator = node.operator;
+ if (NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
+ return numberTypeAnnotation();
+ } else if (BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
+ return booleanTypeAnnotation();
+ } else if (operator === "+") {
+ const right = this.get("right");
+ const left = this.get("left");
+ if (left.isBaseType("number") && right.isBaseType("number")) {
+ return numberTypeAnnotation();
+ } else if (left.isBaseType("string") || right.isBaseType("string")) {
+ return stringTypeAnnotation();
}
+ return unionTypeAnnotation([stringTypeAnnotation(), numberTypeAnnotation()]);
}
- parseSpread(refExpressionErrors) {
- const node = this.startNode();
- this.next();
- node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined);
- return this.finishNode(node, "SpreadElement");
+}
+function LogicalExpression() {
+ const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];
+ return (0, _util.createUnionType)(argumentTypes);
+}
+function ConditionalExpression() {
+ const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()];
+ return (0, _util.createUnionType)(argumentTypes);
+}
+function SequenceExpression() {
+ return this.get("expressions").pop().getTypeAnnotation();
+}
+function ParenthesizedExpression() {
+ return this.get("expression").getTypeAnnotation();
+}
+function AssignmentExpression() {
+ return this.get("right").getTypeAnnotation();
+}
+function UpdateExpression(node) {
+ const operator = node.operator;
+ if (operator === "++" || operator === "--") {
+ return numberTypeAnnotation();
}
- parseRestBinding() {
- const node = this.startNode();
- this.next();
- node.argument = this.parseBindingAtom();
- return this.finishNode(node, "RestElement");
+}
+function StringLiteral() {
+ return stringTypeAnnotation();
+}
+function NumericLiteral() {
+ return numberTypeAnnotation();
+}
+function BooleanLiteral() {
+ return booleanTypeAnnotation();
+}
+function NullLiteral() {
+ return nullLiteralTypeAnnotation();
+}
+function RegExpLiteral() {
+ return genericTypeAnnotation(identifier("RegExp"));
+}
+function ObjectExpression() {
+ return genericTypeAnnotation(identifier("Object"));
+}
+function ArrayExpression() {
+ return genericTypeAnnotation(identifier("Array"));
+}
+function RestElement() {
+ return ArrayExpression();
+}
+RestElement.validParent = true;
+function Func() {
+ return genericTypeAnnotation(identifier("Function"));
+}
+const isArrayFrom = buildMatchMemberExpression("Array.from");
+const isObjectKeys = buildMatchMemberExpression("Object.keys");
+const isObjectValues = buildMatchMemberExpression("Object.values");
+const isObjectEntries = buildMatchMemberExpression("Object.entries");
+function CallExpression() {
+ const {
+ callee
+ } = this.node;
+ if (isObjectKeys(callee)) {
+ return arrayTypeAnnotation(stringTypeAnnotation());
+ } else if (isArrayFrom(callee) || isObjectValues(callee) || isIdentifier(callee, {
+ name: "Array"
+ })) {
+ return arrayTypeAnnotation(anyTypeAnnotation());
+ } else if (isObjectEntries(callee)) {
+ return arrayTypeAnnotation(tupleTypeAnnotation([stringTypeAnnotation(), anyTypeAnnotation()]));
}
- parseBindingAtom() {
- switch (this.state.type) {
- case 0:
- {
- const node = this.startNode();
- this.next();
- node.elements = this.parseBindingList(3, 93, 1);
- return this.finishNode(node, "ArrayPattern");
- }
- case 5:
- return this.parseObjectLike(8, true);
- }
- return this.parseIdentifier();
- }
- parseBindingList(close, closeCharCode, flags) {
- const allowEmpty = flags & 1;
- const elts = [];
- let first = true;
- while (!this.eat(close)) {
- if (first) {
- first = false;
- } else {
- this.expect(12);
- }
- if (allowEmpty && this.match(12)) {
- elts.push(null);
- } else if (this.eat(close)) {
- break;
- } else if (this.match(21)) {
- let rest = this.parseRestBinding();
- if (this.hasPlugin("flow") || flags & 2) {
- rest = this.parseFunctionParamType(rest);
- }
- elts.push(rest);
- if (!this.checkCommaAfterRest(closeCharCode)) {
- this.expect(close);
- break;
- }
+ return resolveCall(this.get("callee"));
+}
+function TaggedTemplateExpression() {
+ return resolveCall(this.get("tag"));
+}
+function resolveCall(callee) {
+ callee = callee.resolve();
+ if (callee.isFunction()) {
+ const {
+ node
+ } = callee;
+ if (node.async) {
+ if (node.generator) {
+ return genericTypeAnnotation(identifier("AsyncIterator"));
} else {
- const decorators = [];
- if (flags & 2) {
- if (this.match(26) && this.hasPlugin("decorators")) {
- this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
- }
- while (this.match(26)) {
- decorators.push(this.parseDecorator());
- }
- }
- elts.push(this.parseBindingElement(flags, decorators));
+ return genericTypeAnnotation(identifier("Promise"));
}
- }
- return elts;
- }
- parseBindingRestProperty(prop) {
- this.next();
- prop.argument = this.parseIdentifier();
- this.checkCommaAfterRest(125);
- return this.finishNode(prop, "RestElement");
- }
- parseBindingProperty() {
- const {
- type,
- startLoc
- } = this.state;
- if (type === 21) {
- return this.parseBindingRestProperty(this.startNode());
- }
- const prop = this.startNode();
- if (type === 139) {
- this.expectPlugin("destructuringPrivate", startLoc);
- this.classScope.usePrivateName(this.state.value, startLoc);
- prop.key = this.parsePrivateName();
} else {
- this.parsePropertyName(prop);
- }
- prop.method = false;
- return this.parseObjPropValue(prop, startLoc, false, false, true, false);
- }
- parseBindingElement(flags, decorators) {
- const left = this.parseMaybeDefault();
- if (this.hasPlugin("flow") || flags & 2) {
- this.parseFunctionParamType(left);
- }
- const elt = this.parseMaybeDefault(left.loc.start, left);
- if (decorators.length) {
- left.decorators = decorators;
- }
- return elt;
- }
- parseFunctionParamType(param) {
- return param;
- }
- parseMaybeDefault(startLoc, left) {
- startLoc != null ? startLoc : startLoc = this.state.startLoc;
- left = left != null ? left : this.parseBindingAtom();
- if (!this.eat(29)) return left;
- const node = this.startNodeAt(startLoc);
- node.left = left;
- node.right = this.parseMaybeAssignAllowIn();
- return this.finishNode(node, "AssignmentPattern");
- }
- isValidLVal(type, isUnparenthesizedInAssign, binding) {
- switch (type) {
- case "AssignmentPattern":
- return "left";
- case "RestElement":
- return "argument";
- case "ObjectProperty":
- return "value";
- case "ParenthesizedExpression":
- return "expression";
- case "ArrayPattern":
- return "elements";
- case "ObjectPattern":
- return "properties";
+ if (node.generator) {
+ return genericTypeAnnotation(identifier("Iterator"));
+ } else if (callee.node.returnType) {
+ return callee.node.returnType;
+ } else {}
}
- return false;
}
- isOptionalMemberExpression(expression) {
- return expression.type === "OptionalMemberExpression";
- }
- checkLVal(expression, ancestor, binding = 64, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false) {
- var _expression$extra;
- const type = expression.type;
- if (this.isObjectMethod(expression)) return;
- const isOptionalMemberExpression = this.isOptionalMemberExpression(expression);
- if (isOptionalMemberExpression || type === "MemberExpression") {
- if (isOptionalMemberExpression) {
- this.expectPlugin("optionalChainingAssign", expression.loc.start);
- if (ancestor.type !== "AssignmentExpression") {
- this.raise(Errors.InvalidLhsOptionalChaining, expression, {
- ancestor
- });
- }
- }
- if (binding !== 64) {
- this.raise(Errors.InvalidPropertyBindingPattern, expression);
- }
- return;
- }
- if (type === "Identifier") {
- this.checkIdentifier(expression, binding, strictModeChanged);
- const {
- name
- } = expression;
- if (checkClashes) {
- if (checkClashes.has(name)) {
- this.raise(Errors.ParamDupe, expression);
- } else {
- checkClashes.add(name);
- }
+}
+
+//# sourceMappingURL=inferers.js.map
+
+
+/***/ }),
+
+/***/ 8456:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.createUnionType = createUnionType;
+var _t = __nccwpck_require__(7912);
+const {
+ createFlowUnionType,
+ createTSUnionType,
+ createUnionTypeAnnotation,
+ isFlowType,
+ isTSType
+} = _t;
+function createUnionType(types) {
+ {
+ if (isFlowType(types[0])) {
+ if (createFlowUnionType) {
+ return createFlowUnionType(types);
}
- return;
- }
- const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
- if (validity === true) return;
- if (validity === false) {
- const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
- this.raise(ParseErrorClass, expression, {
- ancestor
- });
- return;
- }
- let key, isParenthesizedExpression;
- if (typeof validity === "string") {
- key = validity;
- isParenthesizedExpression = type === "ParenthesizedExpression";
+ return createUnionTypeAnnotation(types);
} else {
- [key, isParenthesizedExpression] = validity;
- }
- const nextAncestor = type === "ArrayPattern" || type === "ObjectPattern" ? {
- type
- } : ancestor;
- const val = expression[key];
- if (Array.isArray(val)) {
- for (const child of val) {
- if (child) {
- this.checkLVal(child, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
- }
- }
- } else if (val) {
- this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
- }
- }
- checkIdentifier(at, bindingType, strictModeChanged = false) {
- if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
- if (bindingType === 64) {
- this.raise(Errors.StrictEvalArguments, at, {
- referenceName: at.name
- });
- } else {
- this.raise(Errors.StrictEvalArgumentsBinding, at, {
- bindingName: at.name
- });
+ if (createTSUnionType) {
+ return createTSUnionType(types);
}
}
- if (bindingType & 8192 && at.name === "let") {
- this.raise(Errors.LetInLexicalBinding, at);
- }
- if (!(bindingType & 64)) {
- this.declareNameFromIdentifier(at, bindingType);
- }
- }
- declareNameFromIdentifier(identifier, binding) {
- this.scope.declareName(identifier.name, binding, identifier.loc.start);
- }
- checkToRestConversion(node, allowPattern) {
- switch (node.type) {
- case "ParenthesizedExpression":
- this.checkToRestConversion(node.expression, allowPattern);
- break;
- case "Identifier":
- case "MemberExpression":
- break;
- case "ArrayExpression":
- case "ObjectExpression":
- if (allowPattern) break;
- default:
- this.raise(Errors.InvalidRestAssignmentPattern, node);
- }
- }
- checkCommaAfterRest(close) {
- if (!this.match(12)) {
- return false;
- }
- this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
- return true;
}
}
-function nonNull(x) {
- if (x == null) {
- throw new Error(`Unexpected ${x} value.`);
- }
- return x;
-}
-function assert(x) {
- if (!x) {
- throw new Error("Assert fail");
- }
-}
-const TSErrors = ParseErrorEnum`typescript`({
- AbstractMethodHasImplementation: ({
- methodName
- }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
- AbstractPropertyHasInitializer: ({
- propertyName
- }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
- AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
- AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
- AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
- ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
- ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
- ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
- ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
- DeclareAccessor: ({
- kind
- }) => `'declare' is not allowed in ${kind}ters.`,
- DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
- DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
- DuplicateAccessibilityModifier: ({
- modifier
- }) => `Accessibility modifier already seen.`,
- DuplicateModifier: ({
- modifier
- }) => `Duplicate modifier: '${modifier}'.`,
- EmptyHeritageClauseType: ({
- token
- }) => `'${token}' list cannot be empty.`,
- EmptyTypeArguments: "Type argument list cannot be empty.",
- EmptyTypeParameters: "Type parameter list cannot be empty.",
- ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
- ImportAliasHasImportType: "An import alias can not use 'import type'.",
- ImportReflectionHasImportType: "An `import module` declaration can not use `type` modifier",
- IncompatibleModifiers: ({
- modifiers
- }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,
- IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
- IndexSignatureHasAccessibility: ({
- modifier
- }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`,
- IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
- IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
- IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
- InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
- InvalidHeritageClauseType: ({
- token
- }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
- InvalidModifierOnTypeMember: ({
- modifier
- }) => `'${modifier}' modifier cannot appear on a type member.`,
- InvalidModifierOnTypeParameter: ({
- modifier
- }) => `'${modifier}' modifier cannot appear on a type parameter.`,
- InvalidModifierOnTypeParameterPositions: ({
- modifier
- }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
- InvalidModifiersOrder: ({
- orderedModifiers
- }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
- InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
- InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
- MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
- NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
- NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
- OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
- OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
- PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
- PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
- PrivateElementHasAccessibility: ({
- modifier
- }) => `Private elements cannot have an accessibility modifier ('${modifier}').`,
- ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
- ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `() => ...`.",
- ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
- SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
- SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
- SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
- SingleTypeParameterWithoutTrailingComma: ({
- typeParameterName
- }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
- StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
- TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",
- TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
- TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
- TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
- TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
- UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
- UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
- UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
- UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
- UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
- UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
- UnsupportedSignatureParameterKind: ({
- type
- }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
-});
-function keywordTypeFromName(value) {
- switch (value) {
- case "any":
- return "TSAnyKeyword";
- case "boolean":
- return "TSBooleanKeyword";
- case "bigint":
- return "TSBigIntKeyword";
- case "never":
- return "TSNeverKeyword";
- case "number":
- return "TSNumberKeyword";
- case "object":
- return "TSObjectKeyword";
- case "string":
- return "TSStringKeyword";
- case "symbol":
- return "TSSymbolKeyword";
- case "undefined":
- return "TSUndefinedKeyword";
- case "unknown":
- return "TSUnknownKeyword";
- default:
- return undefined;
+
+//# sourceMappingURL=util.js.map
+
+
+/***/ }),
+
+/***/ 217:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo;
+exports._resolve = _resolve;
+exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression;
+exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement;
+exports.equals = equals;
+exports.getSource = getSource;
+exports.has = has;
+exports.is = void 0;
+exports.isCompletionRecord = isCompletionRecord;
+exports.isConstantExpression = isConstantExpression;
+exports.isInStrictMode = isInStrictMode;
+exports.isNodeType = isNodeType;
+exports.isStatementOrBlock = isStatementOrBlock;
+exports.isStatic = isStatic;
+exports.isnt = isnt;
+exports.matchesPattern = matchesPattern;
+exports.referencesImport = referencesImport;
+exports.resolve = resolve;
+exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
+var _t = __nccwpck_require__(7912);
+const {
+ STATEMENT_OR_BLOCK_KEYS,
+ VISITOR_KEYS,
+ isBlockStatement,
+ isExpression,
+ isIdentifier,
+ isLiteral,
+ isStringLiteral,
+ isType,
+ matchesPattern: _matchesPattern
+} = _t;
+function matchesPattern(pattern, allowPartial) {
+ return _matchesPattern(this.node, pattern, allowPartial);
+}
+function has(key) {
+ const val = this.node && this.node[key];
+ if (val && Array.isArray(val)) {
+ return !!val.length;
+ } else {
+ return !!val;
}
}
-function tsIsAccessModifier(modifier) {
- return modifier === "private" || modifier === "public" || modifier === "protected";
+function isStatic() {
+ return this.scope.isStatic(this.node);
+}
+const is = has;
+exports.is = is;
+function isnt(key) {
+ return !this.has(key);
}
-function tsIsVarianceAnnotations(modifier) {
- return modifier === "in" || modifier === "out";
+function equals(key, value) {
+ return this.node[key] === value;
}
-var typescript = superClass => class TypeScriptParserMixin extends superClass {
- constructor(...args) {
- super(...args);
- this.tsParseInOutModifiers = this.tsParseModifiers.bind(this, {
- allowedModifiers: ["in", "out"],
- disallowedModifiers: ["const", "public", "private", "protected", "readonly", "declare", "abstract", "override"],
- errorTemplate: TSErrors.InvalidModifierOnTypeParameter
- });
- this.tsParseConstModifier = this.tsParseModifiers.bind(this, {
- allowedModifiers: ["const"],
- disallowedModifiers: ["in", "out"],
- errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
- });
- this.tsParseInOutConstModifiers = this.tsParseModifiers.bind(this, {
- allowedModifiers: ["in", "out", "const"],
- disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
- errorTemplate: TSErrors.InvalidModifierOnTypeParameter
- });
- }
- getScopeHandler() {
- return TypeScriptScopeHandler;
- }
- tsIsIdentifier() {
- return tokenIsIdentifier(this.state.type);
+function isNodeType(type) {
+ return isType(this.type, type);
+}
+function canHaveVariableDeclarationOrExpression() {
+ return (this.key === "init" || this.key === "left") && this.parentPath.isFor();
+}
+function canSwapBetweenExpressionAndStatement(replacement) {
+ if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) {
+ return false;
}
- tsTokenCanFollowModifier() {
- return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(139) || this.isLiteralPropertyName();
+ if (this.isExpression()) {
+ return isBlockStatement(replacement);
+ } else if (this.isBlockStatement()) {
+ return isExpression(replacement);
}
- tsNextTokenOnSameLineAndCanFollowModifier() {
- this.next();
- if (this.hasPrecedingLineBreak()) {
+ return false;
+}
+function isCompletionRecord(allowInsideFunction) {
+ let path = this;
+ let first = true;
+ do {
+ const {
+ type,
+ container
+ } = path;
+ if (!first && (path.isFunction() || type === "StaticBlock")) {
+ return !!allowInsideFunction;
+ }
+ first = false;
+ if (Array.isArray(container) && path.key !== container.length - 1) {
return false;
}
- return this.tsTokenCanFollowModifier();
+ } while ((path = path.parentPath) && !path.isProgram() && !path.isDoExpression());
+ return true;
+}
+function isStatementOrBlock() {
+ if (this.parentPath.isLabeledStatement() || isBlockStatement(this.container)) {
+ return false;
+ } else {
+ return STATEMENT_OR_BLOCK_KEYS.includes(this.key);
}
- tsNextTokenCanFollowModifier() {
- if (this.match(106)) {
- this.next();
- return this.tsTokenCanFollowModifier();
+}
+function referencesImport(moduleSource, importName) {
+ if (!this.isReferencedIdentifier()) {
+ if (this.isJSXMemberExpression() && this.node.property.name === importName || (this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? isStringLiteral(this.node.property, {
+ value: importName
+ }) : this.node.property.name === importName)) {
+ const object = this.get("object");
+ return object.isReferencedIdentifier() && object.referencesImport(moduleSource, "*");
}
- return this.tsNextTokenOnSameLineAndCanFollowModifier();
+ return false;
}
- tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
- if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75) {
- return undefined;
- }
- const modifier = this.state.value;
- if (allowedModifiers.includes(modifier)) {
- if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
- return undefined;
- }
- if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
- return modifier;
- }
- }
- return undefined;
+ const binding = this.scope.getBinding(this.node.name);
+ if (!binding || binding.kind !== "module") return false;
+ const path = binding.path;
+ const parent = path.parentPath;
+ if (!parent.isImportDeclaration()) return false;
+ if (parent.node.source.value === moduleSource) {
+ if (!importName) return true;
+ } else {
+ return false;
}
- tsParseModifiers({
- allowedModifiers,
- disallowedModifiers,
- stopOnStartOfClassStaticBlock,
- errorTemplate = TSErrors.InvalidModifierOnTypeMember
- }, modified) {
- const enforceOrder = (loc, modifier, before, after) => {
- if (modifier === before && modified[after]) {
- this.raise(TSErrors.InvalidModifiersOrder, loc, {
- orderedModifiers: [before, after]
- });
- }
- };
- const incompatible = (loc, modifier, mod1, mod2) => {
- if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
- this.raise(TSErrors.IncompatibleModifiers, loc, {
- modifiers: [mod1, mod2]
- });
- }
- };
- for (;;) {
- const {
- startLoc
- } = this.state;
- const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock);
- if (!modifier) break;
- if (tsIsAccessModifier(modifier)) {
- if (modified.accessibility) {
- this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
- modifier
- });
- } else {
- enforceOrder(startLoc, modifier, modifier, "override");
- enforceOrder(startLoc, modifier, modifier, "static");
- enforceOrder(startLoc, modifier, modifier, "readonly");
- modified.accessibility = modifier;
- }
- } else if (tsIsVarianceAnnotations(modifier)) {
- if (modified[modifier]) {
- this.raise(TSErrors.DuplicateModifier, startLoc, {
- modifier
- });
- }
- modified[modifier] = true;
- enforceOrder(startLoc, modifier, "in", "out");
- } else {
- if (hasOwnProperty.call(modified, modifier)) {
- this.raise(TSErrors.DuplicateModifier, startLoc, {
- modifier
- });
- } else {
- enforceOrder(startLoc, modifier, "static", "readonly");
- enforceOrder(startLoc, modifier, "static", "override");
- enforceOrder(startLoc, modifier, "override", "readonly");
- enforceOrder(startLoc, modifier, "abstract", "override");
- incompatible(startLoc, modifier, "declare", "override");
- incompatible(startLoc, modifier, "static", "abstract");
- }
- modified[modifier] = true;
- }
- if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
- this.raise(errorTemplate, startLoc, {
- modifier
- });
- }
- }
+ if (path.isImportDefaultSpecifier() && importName === "default") {
+ return true;
}
- tsIsListTerminator(kind) {
- switch (kind) {
- case "EnumMembers":
- case "TypeMembers":
- return this.match(8);
- case "HeritageClauseElement":
- return this.match(5);
- case "TupleElementTypes":
- return this.match(3);
- case "TypeParametersOrArguments":
- return this.match(48);
- }
+ if (path.isImportNamespaceSpecifier() && importName === "*") {
+ return true;
}
- tsParseList(kind, parseElement) {
- const result = [];
- while (!this.tsIsListTerminator(kind)) {
- result.push(parseElement());
- }
- return result;
+ if (path.isImportSpecifier() && isIdentifier(path.node.imported, {
+ name: importName
+ })) {
+ return true;
}
- tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) {
- return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true, refTrailingCommaPos));
+ return false;
+}
+function getSource() {
+ const node = this.node;
+ if (node.end) {
+ const code = this.hub.getCode();
+ if (code) return code.slice(node.start, node.end);
}
- tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) {
- const result = [];
- let trailingCommaPos = -1;
- for (;;) {
- if (this.tsIsListTerminator(kind)) {
- break;
- }
- trailingCommaPos = -1;
- const element = parseElement();
- if (element == null) {
- return undefined;
- }
- result.push(element);
- if (this.eat(12)) {
- trailingCommaPos = this.state.lastTokStartLoc.index;
- continue;
- }
- if (this.tsIsListTerminator(kind)) {
- break;
- }
- if (expectSuccess) {
- this.expect(12);
- }
- return undefined;
- }
- if (refTrailingCommaPos) {
- refTrailingCommaPos.value = trailingCommaPos;
- }
- return result;
+ return "";
+}
+function willIMaybeExecuteBefore(target) {
+ return this._guessExecutionStatusRelativeTo(target) !== "after";
+}
+function getOuterFunction(path) {
+ return path.isProgram() ? path : (path.parentPath.scope.getFunctionParent() || path.parentPath.scope.getProgramParent()).path;
+}
+function isExecutionUncertain(type, key) {
+ switch (type) {
+ case "LogicalExpression":
+ return key === "right";
+ case "ConditionalExpression":
+ case "IfStatement":
+ return key === "consequent" || key === "alternate";
+ case "WhileStatement":
+ case "DoWhileStatement":
+ case "ForInStatement":
+ case "ForOfStatement":
+ return key === "body";
+ case "ForStatement":
+ return key === "body" || key === "update";
+ case "SwitchStatement":
+ return key === "cases";
+ case "TryStatement":
+ return key === "handler";
+ case "AssignmentPattern":
+ return key === "right";
+ case "OptionalMemberExpression":
+ return key === "property";
+ case "OptionalCallExpression":
+ return key === "arguments";
+ default:
+ return false;
}
- tsParseBracketedList(kind, parseElement, bracket, skipFirstToken, refTrailingCommaPos) {
- if (!skipFirstToken) {
- if (bracket) {
- this.expect(0);
- } else {
- this.expect(47);
- }
- }
- const result = this.tsParseDelimitedList(kind, parseElement, refTrailingCommaPos);
- if (bracket) {
- this.expect(3);
- } else {
- this.expect(48);
+}
+function isExecutionUncertainInList(paths, maxIndex) {
+ for (let i = 0; i < maxIndex; i++) {
+ const path = paths[i];
+ if (isExecutionUncertain(path.parent.type, path.parentKey)) {
+ return true;
}
- return result;
}
- tsParseImportType() {
- const node = this.startNode();
- this.expect(83);
- this.expect(10);
- if (!this.match(134)) {
- this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
- {
- node.argument = super.parseExprAtom();
- }
- } else {
- {
- node.argument = this.parseStringLiteral(this.state.value);
- }
- }
- if (this.eat(12) && !this.match(11)) {
- node.options = super.parseMaybeAssignAllowIn();
- this.eat(12);
- } else {
- node.options = null;
- }
- this.expect(11);
- if (this.eat(16)) {
- node.qualifier = this.tsParseEntityName(1 | 2);
- }
- if (this.match(47)) {
- {
- node.typeParameters = this.tsParseTypeArguments();
- }
- }
- return this.finishNode(node, "TSImportType");
+ return false;
+}
+const SYMBOL_CHECKING = Symbol();
+function _guessExecutionStatusRelativeTo(target) {
+ return _guessExecutionStatusRelativeToCached(this, target, new Map());
+}
+function _guessExecutionStatusRelativeToCached(base, target, cache) {
+ const funcParent = {
+ this: getOuterFunction(base),
+ target: getOuterFunction(target)
+ };
+ if (funcParent.target.node !== funcParent.this.node) {
+ return _guessExecutionStatusRelativeToDifferentFunctionsCached(base, funcParent.target, cache);
}
- tsParseEntityName(flags) {
- let entity;
- if (flags & 1 && this.match(78)) {
- if (flags & 2) {
- entity = this.parseIdentifier(true);
- } else {
- const node = this.startNode();
- this.next();
- entity = this.finishNode(node, "ThisExpression");
- }
+ const paths = {
+ target: target.getAncestry(),
+ this: base.getAncestry()
+ };
+ if (paths.target.indexOf(base) >= 0) return "after";
+ if (paths.this.indexOf(target) >= 0) return "before";
+ let commonPath;
+ const commonIndex = {
+ target: 0,
+ this: 0
+ };
+ while (!commonPath && commonIndex.this < paths.this.length) {
+ const path = paths.this[commonIndex.this];
+ commonIndex.target = paths.target.indexOf(path);
+ if (commonIndex.target >= 0) {
+ commonPath = path;
} else {
- entity = this.parseIdentifier(!!(flags & 1));
- }
- while (this.eat(16)) {
- const node = this.startNodeAtNode(entity);
- node.left = entity;
- node.right = this.parseIdentifier(!!(flags & 1));
- entity = this.finishNode(node, "TSQualifiedName");
+ commonIndex.this++;
}
- return entity;
}
- tsParseTypeReference() {
- const node = this.startNode();
- node.typeName = this.tsParseEntityName(1);
- if (!this.hasPrecedingLineBreak() && this.match(47)) {
- {
- node.typeParameters = this.tsParseTypeArguments();
- }
- }
- return this.finishNode(node, "TSTypeReference");
+ if (!commonPath) {
+ throw new Error("Internal Babel error - The two compared nodes" + " don't appear to belong to the same program.");
+ }
+ if (isExecutionUncertainInList(paths.this, commonIndex.this - 1) || isExecutionUncertainInList(paths.target, commonIndex.target - 1)) {
+ return "unknown";
}
- tsParseThisTypePredicate(lhs) {
- this.next();
- const node = this.startNodeAtNode(lhs);
- node.parameterName = lhs;
- node.typeAnnotation = this.tsParseTypeAnnotation(false);
- node.asserts = false;
- return this.finishNode(node, "TSTypePredicate");
+ const divergence = {
+ this: paths.this[commonIndex.this - 1],
+ target: paths.target[commonIndex.target - 1]
+ };
+ if (divergence.target.listKey && divergence.this.listKey && divergence.target.container === divergence.this.container) {
+ return divergence.target.key > divergence.this.key ? "before" : "after";
}
- tsParseThisTypeNode() {
- const node = this.startNode();
- this.next();
- return this.finishNode(node, "TSThisType");
+ const keys = VISITOR_KEYS[commonPath.type];
+ const keyPosition = {
+ this: keys.indexOf(divergence.this.parentKey),
+ target: keys.indexOf(divergence.target.parentKey)
+ };
+ return keyPosition.target > keyPosition.this ? "before" : "after";
+}
+function _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache) {
+ if (!target.isFunctionDeclaration()) {
+ if (_guessExecutionStatusRelativeToCached(base, target, cache) === "before") {
+ return "before";
+ }
+ return "unknown";
+ } else if (target.parentPath.isExportDeclaration()) {
+ return "unknown";
}
- tsParseTypeQuery() {
- const node = this.startNode();
- this.expect(87);
- if (this.match(83)) {
- node.exprName = this.tsParseImportType();
- } else {
- {
- node.exprName = this.tsParseEntityName(1 | 2);
- }
+ const binding = target.scope.getBinding(target.node.id.name);
+ if (!binding.references) return "before";
+ const referencePaths = binding.referencePaths;
+ let allStatus;
+ for (const path of referencePaths) {
+ const childOfFunction = !!path.find(path => path.node === target.node);
+ if (childOfFunction) continue;
+ if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
+ return "unknown";
}
- if (!this.hasPrecedingLineBreak() && this.match(47)) {
- {
- node.typeParameters = this.tsParseTypeArguments();
- }
+ const status = _guessExecutionStatusRelativeToCached(base, path, cache);
+ if (allStatus && allStatus !== status) {
+ return "unknown";
+ } else {
+ allStatus = status;
}
- return this.finishNode(node, "TSTypeQuery");
}
- tsParseTypeParameter(parseModifiers) {
- const node = this.startNode();
- parseModifiers(node);
- node.name = this.tsParseTypeParameterName();
- node.constraint = this.tsEatThenParseType(81);
- node.default = this.tsEatThenParseType(29);
- return this.finishNode(node, "TSTypeParameter");
- }
- tsTryParseTypeParameters(parseModifiers) {
- if (this.match(47)) {
- return this.tsParseTypeParameters(parseModifiers);
+ return allStatus;
+}
+function _guessExecutionStatusRelativeToDifferentFunctionsCached(base, target, cache) {
+ let nodeMap = cache.get(base.node);
+ let cached;
+ if (!nodeMap) {
+ cache.set(base.node, nodeMap = new Map());
+ } else if (cached = nodeMap.get(target.node)) {
+ if (cached === SYMBOL_CHECKING) {
+ return "unknown";
}
+ return cached;
}
- tsParseTypeParameters(parseModifiers) {
- const node = this.startNode();
- if (this.match(47) || this.match(143)) {
- this.next();
- } else {
- this.unexpected();
+ nodeMap.set(target.node, SYMBOL_CHECKING);
+ const result = _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache);
+ nodeMap.set(target.node, result);
+ return result;
+}
+function resolve(dangerous, resolved) {
+ return this._resolve(dangerous, resolved) || this;
+}
+function _resolve(dangerous, resolved) {
+ if (resolved && resolved.indexOf(this) >= 0) return;
+ resolved = resolved || [];
+ resolved.push(this);
+ if (this.isVariableDeclarator()) {
+ if (this.get("id").isIdentifier()) {
+ return this.get("init").resolve(dangerous, resolved);
+ } else {}
+ } else if (this.isReferencedIdentifier()) {
+ const binding = this.scope.getBinding(this.node.name);
+ if (!binding) return;
+ if (!binding.constant) return;
+ if (binding.kind === "module") return;
+ if (binding.path !== this) {
+ const ret = binding.path.resolve(dangerous, resolved);
+ if (this.find(parent => parent.node === ret.node)) return;
+ return ret;
}
- const refTrailingCommaPos = {
- value: -1
- };
- node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
- if (node.params.length === 0) {
- this.raise(TSErrors.EmptyTypeParameters, node);
- }
- if (refTrailingCommaPos.value !== -1) {
- this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
- }
- return this.finishNode(node, "TSTypeParameterDeclaration");
- }
- tsFillSignature(returnToken, signature) {
- const returnTokenRequired = returnToken === 19;
- const paramsKey = "parameters";
- const returnTypeKey = "typeAnnotation";
- signature.typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
- this.expect(10);
- signature[paramsKey] = this.tsParseBindingListForSignature();
- if (returnTokenRequired) {
- signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
- } else if (this.match(returnToken)) {
- signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
- }
- }
- tsParseBindingListForSignature() {
- const list = super.parseBindingList(11, 41, 2);
- for (const pattern of list) {
- const {
- type
- } = pattern;
- if (type === "AssignmentPattern" || type === "TSParameterProperty") {
- this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
- type
+ } else if (this.isTypeCastExpression()) {
+ return this.get("expression").resolve(dangerous, resolved);
+ } else if (dangerous && this.isMemberExpression()) {
+ const targetKey = this.toComputedKey();
+ if (!isLiteral(targetKey)) return;
+ const targetName = targetKey.value;
+ const target = this.get("object").resolve(dangerous, resolved);
+ if (target.isObjectExpression()) {
+ const props = target.get("properties");
+ for (const prop of props) {
+ if (!prop.isProperty()) continue;
+ const key = prop.get("key");
+ let match = prop.isnt("computed") && key.isIdentifier({
+ name: targetName
+ });
+ match = match || key.isLiteral({
+ value: targetName
});
+ if (match) return prop.get("value").resolve(dangerous, resolved);
}
- }
- return list;
- }
- tsParseTypeMemberSemicolon() {
- if (!this.eat(12) && !this.isLineTerminator()) {
- this.expect(13);
+ } else if (target.isArrayExpression() && !isNaN(+targetName)) {
+ const elems = target.get("elements");
+ const elem = elems[targetName];
+ if (elem) return elem.resolve(dangerous, resolved);
}
}
- tsParseSignatureMember(kind, node) {
- this.tsFillSignature(14, node);
- this.tsParseTypeMemberSemicolon();
- return this.finishNode(node, kind);
+}
+function isConstantExpression() {
+ if (this.isIdentifier()) {
+ const binding = this.scope.getBinding(this.node.name);
+ if (!binding) return false;
+ return binding.constant;
}
- tsIsUnambiguouslyIndexSignature() {
- this.next();
- if (tokenIsIdentifier(this.state.type)) {
- this.next();
- return this.match(14);
+ if (this.isLiteral()) {
+ if (this.isRegExpLiteral()) {
+ return false;
}
- return false;
+ if (this.isTemplateLiteral()) {
+ return this.get("expressions").every(expression => expression.isConstantExpression());
+ }
+ return true;
}
- tsTryParseIndexSignature(node) {
- if (!(this.match(0) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
- return;
+ if (this.isUnaryExpression()) {
+ if (this.node.operator !== "void") {
+ return false;
}
- this.expect(0);
- const id = this.parseIdentifier();
- id.typeAnnotation = this.tsParseTypeAnnotation();
- this.resetEndLocation(id);
- this.expect(3);
- node.parameters = [id];
- const type = this.tsTryParseTypeAnnotation();
- if (type) node.typeAnnotation = type;
- this.tsParseTypeMemberSemicolon();
- return this.finishNode(node, "TSIndexSignature");
- }
- tsParsePropertyOrMethodSignature(node, readonly) {
- if (this.eat(17)) node.optional = true;
- const nodeAny = node;
- if (this.match(10) || this.match(47)) {
- if (readonly) {
- this.raise(TSErrors.ReadonlyForMethodSignature, node);
- }
- const method = nodeAny;
- if (method.kind && this.match(47)) {
- this.raise(TSErrors.AccessorCannotHaveTypeParameters, this.state.curPosition());
- }
- this.tsFillSignature(14, method);
- this.tsParseTypeMemberSemicolon();
- const paramsKey = "parameters";
- const returnTypeKey = "typeAnnotation";
- if (method.kind === "get") {
- if (method[paramsKey].length > 0) {
- this.raise(Errors.BadGetterArity, this.state.curPosition());
- if (this.isThisParam(method[paramsKey][0])) {
- this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition());
- }
- }
- } else if (method.kind === "set") {
- if (method[paramsKey].length !== 1) {
- this.raise(Errors.BadSetterArity, this.state.curPosition());
- } else {
- const firstParameter = method[paramsKey][0];
- if (this.isThisParam(firstParameter)) {
- this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition());
- }
- if (firstParameter.type === "Identifier" && firstParameter.optional) {
- this.raise(TSErrors.SetAccessorCannotHaveOptionalParameter, this.state.curPosition());
- }
- if (firstParameter.type === "RestElement") {
- this.raise(TSErrors.SetAccessorCannotHaveRestParameter, this.state.curPosition());
- }
- }
- if (method[returnTypeKey]) {
- this.raise(TSErrors.SetAccessorCannotHaveReturnType, method[returnTypeKey]);
- }
- } else {
- method.kind = "method";
- }
- return this.finishNode(method, "TSMethodSignature");
- } else {
- const property = nodeAny;
- if (readonly) property.readonly = true;
- const type = this.tsTryParseTypeAnnotation();
- if (type) property.typeAnnotation = type;
- this.tsParseTypeMemberSemicolon();
- return this.finishNode(property, "TSPropertySignature");
- }
- }
- tsParseTypeMember() {
- const node = this.startNode();
- if (this.match(10) || this.match(47)) {
- return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
- }
- if (this.match(77)) {
- const id = this.startNode();
- this.next();
- if (this.match(10) || this.match(47)) {
- return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
- } else {
- node.key = this.createIdentifier(id, "new");
- return this.tsParsePropertyOrMethodSignature(node, false);
- }
- }
- this.tsParseModifiers({
- allowedModifiers: ["readonly"],
- disallowedModifiers: ["declare", "abstract", "private", "protected", "public", "static", "override"]
- }, node);
- const idx = this.tsTryParseIndexSignature(node);
- if (idx) {
- return idx;
- }
- super.parsePropertyName(node);
- if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) {
- node.kind = node.key.name;
- super.parsePropertyName(node);
- }
- return this.tsParsePropertyOrMethodSignature(node, !!node.readonly);
- }
- tsParseTypeLiteral() {
- const node = this.startNode();
- node.members = this.tsParseObjectTypeMembers();
- return this.finishNode(node, "TSTypeLiteral");
+ return this.get("argument").isConstantExpression();
}
- tsParseObjectTypeMembers() {
- this.expect(5);
- const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
- this.expect(8);
- return members;
+ if (this.isBinaryExpression()) {
+ const {
+ operator
+ } = this.node;
+ return operator !== "in" && operator !== "instanceof" && this.get("left").isConstantExpression() && this.get("right").isConstantExpression();
}
- tsIsStartOfMappedType() {
- this.next();
- if (this.eat(53)) {
- return this.isContextual(122);
- }
- if (this.isContextual(122)) {
- this.next();
- }
- if (!this.match(0)) {
+ return false;
+}
+function isInStrictMode() {
+ const start = this.isProgram() ? this : this.parentPath;
+ const strictParent = start.find(path => {
+ if (path.isProgram({
+ sourceType: "module"
+ })) return true;
+ if (path.isClass()) return true;
+ if (path.isArrowFunctionExpression() && !path.get("body").isBlockStatement()) {
return false;
}
- this.next();
- if (!this.tsIsIdentifier()) {
+ let body;
+ if (path.isFunction()) {
+ body = path.node.body;
+ } else if (path.isProgram()) {
+ body = path.node;
+ } else {
return false;
}
- this.next();
- return this.match(58);
- }
- tsParseMappedType() {
- const node = this.startNode();
- this.expect(5);
- if (this.match(53)) {
- node.readonly = this.state.value;
- this.next();
- this.expectContextual(122);
- } else if (this.eatContextual(122)) {
- node.readonly = true;
- }
- this.expect(0);
- {
- const typeParameter = this.startNode();
- typeParameter.name = this.tsParseTypeParameterName();
- typeParameter.constraint = this.tsExpectThenParseType(58);
- node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
- }
- node.nameType = this.eatContextual(93) ? this.tsParseType() : null;
- this.expect(3);
- if (this.match(53)) {
- node.optional = this.state.value;
- this.next();
- this.expect(17);
- } else if (this.eat(17)) {
- node.optional = true;
- }
- node.typeAnnotation = this.tsTryParseType();
- this.semicolon();
- this.expect(8);
- return this.finishNode(node, "TSMappedType");
- }
- tsParseTupleType() {
- const node = this.startNode();
- node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
- let seenOptionalElement = false;
- node.elementTypes.forEach(elementNode => {
- const {
- type
- } = elementNode;
- if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
- this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
- }
- seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
- });
- return this.finishNode(node, "TSTupleType");
- }
- tsParseTupleElementType() {
- const restStartLoc = this.state.startLoc;
- const rest = this.eat(21);
- const {
- startLoc
- } = this.state;
- let labeled;
- let label;
- let optional;
- let type;
- const isWord = tokenIsKeywordOrIdentifier(this.state.type);
- const chAfterWord = isWord ? this.lookaheadCharCode() : null;
- if (chAfterWord === 58) {
- labeled = true;
- optional = false;
- label = this.parseIdentifier(true);
- this.expect(14);
- type = this.tsParseType();
- } else if (chAfterWord === 63) {
- optional = true;
- const wordName = this.state.value;
- const typeOrLabel = this.tsParseNonArrayType();
- if (this.lookaheadCharCode() === 58) {
- labeled = true;
- label = this.createIdentifier(this.startNodeAt(startLoc), wordName);
- this.expect(17);
- this.expect(14);
- type = this.tsParseType();
- } else {
- labeled = false;
- type = typeOrLabel;
- this.expect(17);
+ for (const directive of body.directives) {
+ if (directive.value.value === "use strict") {
+ return true;
}
- } else {
- type = this.tsParseType();
- optional = this.eat(17);
- labeled = this.eat(14);
- }
- if (labeled) {
- let labeledNode;
- if (label) {
- labeledNode = this.startNodeAt(startLoc);
- labeledNode.optional = optional;
- labeledNode.label = label;
- labeledNode.elementType = type;
- if (this.eat(17)) {
- labeledNode.optional = true;
- this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
- }
- } else {
- labeledNode = this.startNodeAt(startLoc);
- labeledNode.optional = optional;
- this.raise(TSErrors.InvalidTupleMemberLabel, type);
- labeledNode.label = type;
- labeledNode.elementType = this.tsParseType();
- }
- type = this.finishNode(labeledNode, "TSNamedTupleMember");
- } else if (optional) {
- const optionalTypeNode = this.startNodeAt(startLoc);
- optionalTypeNode.typeAnnotation = type;
- type = this.finishNode(optionalTypeNode, "TSOptionalType");
- }
- if (rest) {
- const restNode = this.startNodeAt(restStartLoc);
- restNode.typeAnnotation = type;
- type = this.finishNode(restNode, "TSRestType");
- }
- return type;
- }
- tsParseParenthesizedType() {
- const node = this.startNode();
- this.expect(10);
- node.typeAnnotation = this.tsParseType();
- this.expect(11);
- return this.finishNode(node, "TSParenthesizedType");
- }
- tsParseFunctionOrConstructorType(type, abstract) {
- const node = this.startNode();
- if (type === "TSConstructorType") {
- node.abstract = !!abstract;
- if (abstract) this.next();
- this.next();
- }
- this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node));
- return this.finishNode(node, type);
- }
- tsParseLiteralTypeNode() {
- const node = this.startNode();
- switch (this.state.type) {
- case 135:
- case 136:
- case 134:
- case 85:
- case 86:
- node.literal = super.parseExprAtom();
- break;
- default:
- this.unexpected();
}
- return this.finishNode(node, "TSLiteralType");
- }
- tsParseTemplateLiteralType() {
- {
- const node = this.startNode();
- node.literal = super.parseTemplate(false);
- return this.finishNode(node, "TSLiteralType");
+ });
+ return !!strictParent;
+}
+
+//# sourceMappingURL=introspection.js.map
+
+
+/***/ }),
+
+/***/ 1225:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+var _t = __nccwpck_require__(7912);
+var _t2 = _t;
+const {
+ react
+} = _t;
+const {
+ cloneNode,
+ jsxExpressionContainer,
+ variableDeclaration,
+ variableDeclarator
+} = _t2;
+const referenceVisitor = {
+ ReferencedIdentifier(path, state) {
+ if (path.isJSXIdentifier() && react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
+ return;
}
- }
- parseTemplateSubstitution() {
- if (this.state.inType) return this.tsParseType();
- return super.parseTemplateSubstitution();
- }
- tsParseThisTypeOrThisTypePredicate() {
- const thisKeyword = this.tsParseThisTypeNode();
- if (this.isContextual(116) && !this.hasPrecedingLineBreak()) {
- return this.tsParseThisTypePredicate(thisKeyword);
- } else {
- return thisKeyword;
- }
- }
- tsParseNonArrayType() {
- switch (this.state.type) {
- case 134:
- case 135:
- case 136:
- case 85:
- case 86:
- return this.tsParseLiteralTypeNode();
- case 53:
- if (this.state.value === "-") {
- const node = this.startNode();
- const nextToken = this.lookahead();
- if (nextToken.type !== 135 && nextToken.type !== 136) {
- this.unexpected();
- }
- node.literal = this.parseMaybeUnary();
- return this.finishNode(node, "TSLiteralType");
- }
- break;
- case 78:
- return this.tsParseThisTypeOrThisTypePredicate();
- case 87:
- return this.tsParseTypeQuery();
- case 83:
- return this.tsParseImportType();
- case 5:
- return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
- case 0:
- return this.tsParseTupleType();
- case 10:
- return this.tsParseParenthesizedType();
- case 25:
- case 24:
- return this.tsParseTemplateLiteralType();
- default:
- {
- const {
- type
- } = this.state;
- if (tokenIsIdentifier(type) || type === 88 || type === 84) {
- const nodeType = type === 88 ? "TSVoidKeyword" : type === 84 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
- if (nodeType !== undefined && this.lookaheadCharCode() !== 46) {
- const node = this.startNode();
- this.next();
- return this.finishNode(node, nodeType);
- }
- return this.tsParseTypeReference();
- }
+ if (path.node.name === "this") {
+ let scope = path.scope;
+ do {
+ if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
+ break;
}
+ } while (scope = scope.parent);
+ if (scope) state.breakOnScopePaths.push(scope.path);
}
- this.unexpected();
- }
- tsParseArrayTypeOrHigher() {
- const {
- startLoc
- } = this.state;
- let type = this.tsParseNonArrayType();
- while (!this.hasPrecedingLineBreak() && this.eat(0)) {
- if (this.match(3)) {
- const node = this.startNodeAt(startLoc);
- node.elementType = type;
- this.expect(3);
- type = this.finishNode(node, "TSArrayType");
- } else {
- const node = this.startNodeAt(startLoc);
- node.objectType = type;
- node.indexType = this.tsParseType();
- this.expect(3);
- type = this.finishNode(node, "TSIndexedAccessType");
- }
- }
- return type;
- }
- tsParseTypeOperator() {
- const node = this.startNode();
- const operator = this.state.value;
- this.next();
- node.operator = operator;
- node.typeAnnotation = this.tsParseTypeOperatorOrHigher();
- if (operator === "readonly") {
- this.tsCheckTypeAnnotationForReadOnly(node);
- }
- return this.finishNode(node, "TSTypeOperator");
- }
- tsCheckTypeAnnotationForReadOnly(node) {
- switch (node.typeAnnotation.type) {
- case "TSTupleType":
- case "TSArrayType":
+ const binding = path.scope.getBinding(path.node.name);
+ if (!binding) return;
+ for (const violation of binding.constantViolations) {
+ if (violation.scope !== binding.path.scope) {
+ state.mutableBinding = true;
+ path.stop();
return;
- default:
- this.raise(TSErrors.UnexpectedReadonly, node);
+ }
}
+ if (binding !== state.scope.getBinding(path.node.name)) return;
+ state.bindings[path.node.name] = binding;
}
- tsParseInferType() {
- const node = this.startNode();
- this.expectContextual(115);
- const typeParameter = this.startNode();
- typeParameter.name = this.tsParseTypeParameterName();
- typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
- node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
- return this.finishNode(node, "TSInferType");
+};
+class PathHoister {
+ constructor(path, scope) {
+ this.breakOnScopePaths = void 0;
+ this.bindings = void 0;
+ this.mutableBinding = void 0;
+ this.scopes = void 0;
+ this.scope = void 0;
+ this.path = void 0;
+ this.attachAfter = void 0;
+ this.breakOnScopePaths = [];
+ this.bindings = {};
+ this.mutableBinding = false;
+ this.scopes = [];
+ this.scope = scope;
+ this.path = path;
+ this.attachAfter = false;
}
- tsParseConstraintForInferType() {
- if (this.eat(81)) {
- const constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());
- if (this.state.inDisallowConditionalTypesContext || !this.match(17)) {
- return constraint;
+ isCompatibleScope(scope) {
+ for (const key of Object.keys(this.bindings)) {
+ const binding = this.bindings[key];
+ if (!scope.bindingIdentifierEquals(key, binding.identifier)) {
+ return false;
}
}
+ return true;
}
- tsParseTypeOperatorOrHigher() {
- const isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
- return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(115) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
- }
- tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- const node = this.startNode();
- const hasLeadingOperator = this.eat(operator);
- const types = [];
+ getCompatibleScopes() {
+ let scope = this.path.scope;
do {
- types.push(parseConstituentType());
- } while (this.eat(operator));
- if (types.length === 1 && !hasLeadingOperator) {
- return types[0];
- }
- node.types = types;
- return this.finishNode(node, kind);
- }
- tsParseIntersectionTypeOrHigher() {
- return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 45);
- }
- tsParseUnionTypeOrHigher() {
- return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 43);
- }
- tsIsStartOfFunctionType() {
- if (this.match(47)) {
- return true;
- }
- return this.match(10) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
- }
- tsSkipParameterStart() {
- if (tokenIsIdentifier(this.state.type) || this.match(78)) {
- this.next();
- return true;
- }
- if (this.match(5)) {
- const {
- errors
- } = this.state;
- const previousErrorCount = errors.length;
- try {
- this.parseObjectLike(8, true);
- return errors.length === previousErrorCount;
- } catch (_unused) {
- return false;
+ if (this.isCompatibleScope(scope)) {
+ this.scopes.push(scope);
+ } else {
+ break;
}
- }
- if (this.match(0)) {
- this.next();
- const {
- errors
- } = this.state;
- const previousErrorCount = errors.length;
- try {
- super.parseBindingList(3, 93, 1);
- return errors.length === previousErrorCount;
- } catch (_unused2) {
- return false;
+ if (this.breakOnScopePaths.indexOf(scope.path) >= 0) {
+ break;
}
- }
- return false;
+ } while (scope = scope.parent);
}
- tsIsUnambiguouslyStartOfFunctionType() {
- this.next();
- if (this.match(11) || this.match(21)) {
- return true;
+ getAttachmentPath() {
+ let path = this._getAttachmentPath();
+ if (!path) return;
+ let targetScope = path.scope;
+ if (targetScope.path === path) {
+ targetScope = path.scope.parent;
}
- if (this.tsSkipParameterStart()) {
- if (this.match(14) || this.match(12) || this.match(17) || this.match(29)) {
- return true;
- }
- if (this.match(11)) {
- this.next();
- if (this.match(19)) {
- return true;
+ if (targetScope.path.isProgram() || targetScope.path.isFunction()) {
+ for (const name of Object.keys(this.bindings)) {
+ if (!targetScope.hasOwnBinding(name)) continue;
+ const binding = this.bindings[name];
+ if (binding.kind === "param" || binding.path.parentKey === "params") {
+ continue;
+ }
+ const bindingParentPath = this.getAttachmentParentForPath(binding.path);
+ if (bindingParentPath.key >= path.key) {
+ this.attachAfter = true;
+ path = binding.path;
+ for (const violationPath of binding.constantViolations) {
+ if (this.getAttachmentParentForPath(violationPath).key > path.key) {
+ path = violationPath;
+ }
+ }
}
}
}
- return false;
+ return path;
}
- tsParseTypeOrTypePredicateAnnotation(returnToken) {
- return this.tsInType(() => {
- const t = this.startNode();
- this.expect(returnToken);
- const node = this.startNode();
- const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
- if (asserts && this.match(78)) {
- let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
- if (thisTypePredicate.type === "TSThisType") {
- node.parameterName = thisTypePredicate;
- node.asserts = true;
- node.typeAnnotation = null;
- thisTypePredicate = this.finishNode(node, "TSTypePredicate");
- } else {
- this.resetStartLocationFromNode(thisTypePredicate, node);
- thisTypePredicate.asserts = true;
+ _getAttachmentPath() {
+ const scopes = this.scopes;
+ const scope = scopes.pop();
+ if (!scope) return;
+ if (scope.path.isFunction()) {
+ if (this.hasOwnParamBindings(scope)) {
+ if (this.scope === scope) return;
+ const bodies = scope.path.get("body").get("body");
+ for (let i = 0; i < bodies.length; i++) {
+ if (bodies[i].node._blockHoist) continue;
+ return bodies[i];
}
- t.typeAnnotation = thisTypePredicate;
- return this.finishNode(t, "TSTypeAnnotation");
+ } else {
+ return this.getNextScopeAttachmentParent();
}
- const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));
- if (!typePredicateVariable) {
- if (!asserts) {
- return this.tsParseTypeAnnotation(false, t);
- }
- node.parameterName = this.parseIdentifier();
- node.asserts = asserts;
- node.typeAnnotation = null;
- t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
- return this.finishNode(t, "TSTypeAnnotation");
- }
- const type = this.tsParseTypeAnnotation(false);
- node.parameterName = typePredicateVariable;
- node.typeAnnotation = type;
- node.asserts = asserts;
- t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
- return this.finishNode(t, "TSTypeAnnotation");
- });
- }
- tsTryParseTypeOrTypePredicateAnnotation() {
- if (this.match(14)) {
- return this.tsParseTypeOrTypePredicateAnnotation(14);
+ } else if (scope.path.isProgram()) {
+ return this.getNextScopeAttachmentParent();
}
}
- tsTryParseTypeAnnotation() {
- if (this.match(14)) {
- return this.tsParseTypeAnnotation();
- }
+ getNextScopeAttachmentParent() {
+ const scope = this.scopes.pop();
+ if (scope) return this.getAttachmentParentForPath(scope.path);
}
- tsTryParseType() {
- return this.tsEatThenParseType(14);
+ getAttachmentParentForPath(path) {
+ do {
+ if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
+ return path;
+ }
+ } while (path = path.parentPath);
}
- tsParseTypePredicatePrefix() {
- const id = this.parseIdentifier();
- if (this.isContextual(116) && !this.hasPrecedingLineBreak()) {
- this.next();
- return id;
+ hasOwnParamBindings(scope) {
+ for (const name of Object.keys(this.bindings)) {
+ if (!scope.hasOwnBinding(name)) continue;
+ const binding = this.bindings[name];
+ if (binding.kind === "param" && binding.constant) return true;
}
+ return false;
}
- tsParseTypePredicateAsserts() {
- if (this.state.type !== 109) {
- return false;
+ run() {
+ this.path.traverse(referenceVisitor, this);
+ if (this.mutableBinding) return;
+ this.getCompatibleScopes();
+ const attachTo = this.getAttachmentPath();
+ if (!attachTo) return;
+ if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
+ let uid = attachTo.scope.generateUidIdentifier("ref");
+ const declarator = variableDeclarator(uid, this.path.node);
+ const insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
+ const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : variableDeclaration("var", [declarator])]);
+ const parent = this.path.parentPath;
+ if (parent.isJSXElement() && this.path.container === parent.node.children) {
+ uid = jsxExpressionContainer(uid);
}
- const containsEsc = this.state.containsEsc;
- this.next();
- if (!tokenIsIdentifier(this.state.type) && !this.match(78)) {
- return false;
- }
- if (containsEsc) {
- this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
- reservedWord: "asserts"
- });
- }
- return true;
- }
- tsParseTypeAnnotation(eatColon = true, t = this.startNode()) {
- this.tsInType(() => {
- if (eatColon) this.expect(14);
- t.typeAnnotation = this.tsParseType();
- });
- return this.finishNode(t, "TSTypeAnnotation");
- }
- tsParseType() {
- assert(this.state.inType);
- const type = this.tsParseNonConditionalType();
- if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(81)) {
- return type;
- }
- const node = this.startNodeAtNode(type);
- node.checkType = type;
- node.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType());
- this.expect(17);
- node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
- this.expect(14);
- node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
- return this.finishNode(node, "TSConditionalType");
- }
- isAbstractConstructorSignature() {
- return this.isContextual(124) && this.lookahead().type === 77;
- }
- tsParseNonConditionalType() {
- if (this.tsIsStartOfFunctionType()) {
- return this.tsParseFunctionOrConstructorType("TSFunctionType");
- }
- if (this.match(77)) {
- return this.tsParseFunctionOrConstructorType("TSConstructorType");
- } else if (this.isAbstractConstructorSignature()) {
- return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
- }
- return this.tsParseUnionTypeOrHigher();
- }
- tsParseTypeAssertion() {
- if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
- this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
- }
- const node = this.startNode();
- node.typeAnnotation = this.tsInType(() => {
- this.next();
- return this.match(75) ? this.tsParseTypeReference() : this.tsParseType();
- });
- this.expect(48);
- node.expression = this.parseMaybeUnary();
- return this.finishNode(node, "TSTypeAssertion");
+ this.path.replaceWith(cloneNode(uid));
+ return attachTo.isVariableDeclarator() ? attached.get("init") : attached.get("declarations.0.init");
}
- tsParseHeritageClause(token) {
- const originalStartLoc = this.state.startLoc;
- const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
- {
- const node = this.startNode();
- node.expression = this.tsParseEntityName(1 | 2);
- if (this.match(47)) {
- node.typeParameters = this.tsParseTypeArguments();
- }
- return this.finishNode(node, "TSExpressionWithTypeArguments");
- }
- });
- if (!delimitedList.length) {
- this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
- token
- });
- }
- return delimitedList;
+}
+exports["default"] = PathHoister;
+
+//# sourceMappingURL=hoister.js.map
+
+
+/***/ }),
+
+/***/ 1587:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.hooks = void 0;
+const hooks = [function (self, parent) {
+ const removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement();
+ if (removeParent) {
+ parent.remove();
+ return true;
}
- tsParseInterfaceDeclaration(node, properties = {}) {
- if (this.hasFollowingLineBreak()) return null;
- this.expectContextual(129);
- if (properties.declare) node.declare = true;
- if (tokenIsIdentifier(this.state.type)) {
- node.id = this.parseIdentifier();
- this.checkIdentifier(node.id, 130);
- } else {
- node.id = null;
- this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
- }
- node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
- if (this.eat(81)) {
- node.extends = this.tsParseHeritageClause("extends");
- }
- const body = this.startNode();
- body.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this));
- node.body = this.finishNode(body, "TSInterfaceBody");
- return this.finishNode(node, "TSInterfaceDeclaration");
- }
- tsParseTypeAliasDeclaration(node) {
- node.id = this.parseIdentifier();
- this.checkIdentifier(node.id, 2);
- node.typeAnnotation = this.tsInType(() => {
- node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
- this.expect(29);
- if (this.isContextual(114) && this.lookahead().type !== 16) {
- const node = this.startNode();
- this.next();
- return this.finishNode(node, "TSIntrinsicKeyword");
- }
- return this.tsParseType();
- });
- this.semicolon();
- return this.finishNode(node, "TSTypeAliasDeclaration");
+}, function (self, parent) {
+ if (parent.isSequenceExpression() && parent.node.expressions.length === 1) {
+ parent.replaceWith(parent.node.expressions[0]);
+ return true;
}
- tsInTopLevelContext(cb) {
- if (this.curContext() !== types.brace) {
- const oldContext = this.state.context;
- this.state.context = [oldContext[0]];
- try {
- return cb();
- } finally {
- this.state.context = oldContext;
- }
+}, function (self, parent) {
+ if (parent.isBinary()) {
+ if (self.key === "left") {
+ parent.replaceWith(parent.node.right);
} else {
- return cb();
- }
- }
- tsInType(cb) {
- const oldInType = this.state.inType;
- this.state.inType = true;
- try {
- return cb();
- } finally {
- this.state.inType = oldInType;
- }
- }
- tsInDisallowConditionalTypesContext(cb) {
- const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
- this.state.inDisallowConditionalTypesContext = true;
- try {
- return cb();
- } finally {
- this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
- }
- }
- tsInAllowConditionalTypesContext(cb) {
- const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
- this.state.inDisallowConditionalTypesContext = false;
- try {
- return cb();
- } finally {
- this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
- }
- }
- tsEatThenParseType(token) {
- if (this.match(token)) {
- return this.tsNextThenParseType();
+ parent.replaceWith(parent.node.left);
}
+ return true;
}
- tsExpectThenParseType(token) {
- return this.tsInType(() => {
- this.expect(token);
- return this.tsParseType();
- });
- }
- tsNextThenParseType() {
- return this.tsInType(() => {
- this.next();
- return this.tsParseType();
+}, function (self, parent) {
+ if (parent.isIfStatement() && self.key === "consequent" || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
+ self.replaceWith({
+ type: "BlockStatement",
+ body: []
});
+ return true;
}
- tsParseEnumMember() {
- const node = this.startNode();
- node.id = this.match(134) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
- if (this.eat(29)) {
- node.initializer = super.parseMaybeAssignAllowIn();
- }
- return this.finishNode(node, "TSEnumMember");
- }
- tsParseEnumDeclaration(node, properties = {}) {
- if (properties.const) node.const = true;
- if (properties.declare) node.declare = true;
- this.expectContextual(126);
- node.id = this.parseIdentifier();
- this.checkIdentifier(node.id, node.const ? 8971 : 8459);
- {
- this.expect(5);
- node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
- this.expect(8);
- }
- return this.finishNode(node, "TSEnumDeclaration");
- }
- tsParseEnumBody() {
- const node = this.startNode();
- this.expect(5);
- node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
- this.expect(8);
- return this.finishNode(node, "TSEnumBody");
- }
- tsParseModuleBlock() {
- const node = this.startNode();
- this.scope.enter(0);
- this.expect(5);
- super.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 8);
- this.scope.exit();
- return this.finishNode(node, "TSModuleBlock");
- }
- tsParseModuleOrNamespaceDeclaration(node, nested = false) {
- node.id = this.parseIdentifier();
- if (!nested) {
- this.checkIdentifier(node.id, 1024);
- }
- if (this.eat(16)) {
- const inner = this.startNode();
- this.tsParseModuleOrNamespaceDeclaration(inner, true);
- node.body = inner;
- } else {
- this.scope.enter(256);
- this.prodParam.enter(0);
- node.body = this.tsParseModuleBlock();
- this.prodParam.exit();
- this.scope.exit();
- }
- return this.finishNode(node, "TSModuleDeclaration");
- }
- tsParseAmbientExternalModuleDeclaration(node) {
- if (this.isContextual(112)) {
- node.kind = "global";
- {
- node.global = true;
- }
- node.id = this.parseIdentifier();
- } else if (this.match(134)) {
- node.kind = "module";
- node.id = super.parseStringLiteral(this.state.value);
- } else {
- this.unexpected();
- }
- if (this.match(5)) {
- this.scope.enter(256);
- this.prodParam.enter(0);
- node.body = this.tsParseModuleBlock();
- this.prodParam.exit();
- this.scope.exit();
+}];
+exports.hooks = hooks;
+
+//# sourceMappingURL=removal-hooks.js.map
+
+
+/***/ }),
+
+/***/ 4859:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.isBindingIdentifier = isBindingIdentifier;
+exports.isBlockScoped = isBlockScoped;
+exports.isExpression = isExpression;
+exports.isFlow = isFlow;
+exports.isForAwaitStatement = isForAwaitStatement;
+exports.isGenerated = isGenerated;
+exports.isPure = isPure;
+exports.isReferenced = isReferenced;
+exports.isReferencedIdentifier = isReferencedIdentifier;
+exports.isReferencedMemberExpression = isReferencedMemberExpression;
+exports.isRestProperty = isRestProperty;
+exports.isScope = isScope;
+exports.isSpreadProperty = isSpreadProperty;
+exports.isStatement = isStatement;
+exports.isUser = isUser;
+exports.isVar = isVar;
+var _t = __nccwpck_require__(7912);
+const {
+ isBinding,
+ isBlockScoped: nodeIsBlockScoped,
+ isExportDeclaration,
+ isExpression: nodeIsExpression,
+ isFlow: nodeIsFlow,
+ isForStatement,
+ isForXStatement,
+ isIdentifier,
+ isImportDeclaration,
+ isImportSpecifier,
+ isJSXIdentifier,
+ isJSXMemberExpression,
+ isMemberExpression,
+ isRestElement: nodeIsRestElement,
+ isReferenced: nodeIsReferenced,
+ isScope: nodeIsScope,
+ isStatement: nodeIsStatement,
+ isVar: nodeIsVar,
+ isVariableDeclaration,
+ react,
+ isForOfStatement
+} = _t;
+const {
+ isCompatTag
+} = react;
+function isReferencedIdentifier(opts) {
+ const {
+ node,
+ parent
+ } = this;
+ if (!isIdentifier(node, opts) && !isJSXMemberExpression(parent, opts)) {
+ if (isJSXIdentifier(node, opts)) {
+ if (isCompatTag(node.name)) return false;
} else {
- this.semicolon();
- }
- return this.finishNode(node, "TSModuleDeclaration");
- }
- tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
- {
- node.isExport = isExport || false;
- }
- node.id = maybeDefaultIdentifier || this.parseIdentifier();
- this.checkIdentifier(node.id, 4096);
- this.expect(29);
- const moduleReference = this.tsParseModuleReference();
- if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
- this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
- }
- node.moduleReference = moduleReference;
- this.semicolon();
- return this.finishNode(node, "TSImportEqualsDeclaration");
- }
- tsIsExternalModuleReference() {
- return this.isContextual(119) && this.lookaheadCharCode() === 40;
- }
- tsParseModuleReference() {
- return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
- }
- tsParseExternalModuleReference() {
- const node = this.startNode();
- this.expectContextual(119);
- this.expect(10);
- if (!this.match(134)) {
- this.unexpected();
+ return false;
}
- node.expression = super.parseExprAtom();
- this.expect(11);
- this.sawUnambiguousESM = true;
- return this.finishNode(node, "TSExternalModuleReference");
}
- tsLookAhead(f) {
- const state = this.state.clone();
- const res = f();
- this.state = state;
- return res;
- }
- tsTryParseAndCatch(f) {
- const result = this.tryParse(abort => f() || abort());
- if (result.aborted || !result.node) return;
- if (result.error) this.state = result.failState;
- return result.node;
- }
- tsTryParse(f) {
- const state = this.state.clone();
- const result = f();
- if (result !== undefined && result !== false) {
- return result;
+ return nodeIsReferenced(node, parent, this.parentPath.parent);
+}
+function isReferencedMemberExpression() {
+ const {
+ node,
+ parent
+ } = this;
+ return isMemberExpression(node) && nodeIsReferenced(node, parent);
+}
+function isBindingIdentifier() {
+ const {
+ node,
+ parent
+ } = this;
+ const grandparent = this.parentPath.parent;
+ return isIdentifier(node) && isBinding(node, parent, grandparent);
+}
+function isStatement() {
+ const {
+ node,
+ parent
+ } = this;
+ if (nodeIsStatement(node)) {
+ if (isVariableDeclaration(node)) {
+ if (isForXStatement(parent, {
+ left: node
+ })) return false;
+ if (isForStatement(parent, {
+ init: node
+ })) return false;
}
- this.state = state;
+ return true;
+ } else {
+ return false;
}
- tsTryParseDeclare(nany) {
- if (this.isLineTerminator()) {
- return;
- }
- let startType = this.state.type;
- let kind;
- if (this.isContextual(100)) {
- startType = 74;
- kind = "let";
- }
- return this.tsInAmbientContext(() => {
- switch (startType) {
- case 68:
- nany.declare = true;
- return super.parseFunctionStatement(nany, false, false);
- case 80:
- nany.declare = true;
- return this.parseClass(nany, true, false);
- case 126:
- return this.tsParseEnumDeclaration(nany, {
- declare: true
- });
- case 112:
- return this.tsParseAmbientExternalModuleDeclaration(nany);
- case 75:
- case 74:
- if (!this.match(75) || !this.isLookaheadContextual("enum")) {
- nany.declare = true;
- return this.parseVarStatement(nany, kind || this.state.value, true);
- }
- this.expect(75);
- return this.tsParseEnumDeclaration(nany, {
- const: true,
- declare: true
- });
- case 129:
- {
- const result = this.tsParseInterfaceDeclaration(nany, {
- declare: true
- });
- if (result) return result;
- }
- default:
- if (tokenIsIdentifier(startType)) {
- return this.tsParseDeclaration(nany, this.state.value, true, null);
- }
- }
- });
+}
+function isExpression() {
+ if (this.isIdentifier()) {
+ return this.isReferencedIdentifier();
+ } else {
+ return nodeIsExpression(this.node);
}
- tsTryParseExportDeclaration() {
- return this.tsParseDeclaration(this.startNode(), this.state.value, true, null);
+}
+function isScope() {
+ return nodeIsScope(this.node, this.parent);
+}
+function isReferenced() {
+ return nodeIsReferenced(this.node, this.parent);
+}
+function isBlockScoped() {
+ return nodeIsBlockScoped(this.node);
+}
+function isVar() {
+ return nodeIsVar(this.node);
+}
+function isUser() {
+ return this.node && !!this.node.loc;
+}
+function isGenerated() {
+ return !this.isUser();
+}
+function isPure(constantsOnly) {
+ return this.scope.isPure(this.node, constantsOnly);
+}
+function isFlow() {
+ const {
+ node
+ } = this;
+ if (nodeIsFlow(node)) {
+ return true;
+ } else if (isImportDeclaration(node)) {
+ return node.importKind === "type" || node.importKind === "typeof";
+ } else if (isExportDeclaration(node)) {
+ return node.exportKind === "type";
+ } else if (isImportSpecifier(node)) {
+ return node.importKind === "type" || node.importKind === "typeof";
+ } else {
+ return false;
}
- tsParseExpressionStatement(node, expr, decorators) {
- switch (expr.name) {
- case "declare":
- {
- const declaration = this.tsTryParseDeclare(node);
- if (declaration) {
- declaration.declare = true;
- }
- return declaration;
- }
- case "global":
- if (this.match(5)) {
- this.scope.enter(256);
- this.prodParam.enter(0);
- const mod = node;
- mod.kind = "global";
- {
- node.global = true;
- }
- mod.id = expr;
- mod.body = this.tsParseModuleBlock();
- this.scope.exit();
- this.prodParam.exit();
- return this.finishNode(mod, "TSModuleDeclaration");
- }
- break;
- default:
- return this.tsParseDeclaration(node, expr.name, false, decorators);
- }
+}
+function isRestProperty() {
+ return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectPattern();
+}
+function isSpreadProperty() {
+ return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectExpression();
+}
+function isForAwaitStatement() {
+ return isForOfStatement(this.node, {
+ await: true
+ });
+}
+{
+ exports.isExistentialTypeParam = function isExistentialTypeParam() {
+ throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.");
+ };
+ exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() {
+ throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.");
+ };
+}
+
+//# sourceMappingURL=virtual-types-validator.js.map
+
+
+/***/ }),
+
+/***/ 4425:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.Var = exports.User = exports.Statement = exports.SpreadProperty = exports.Scope = exports.RestProperty = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = exports.Referenced = exports.Pure = exports.NumericLiteralTypeAnnotation = exports.Generated = exports.ForAwaitStatement = exports.Flow = exports.Expression = exports.ExistentialTypeParam = exports.BlockScoped = exports.BindingIdentifier = void 0;
+const ReferencedIdentifier = ["Identifier", "JSXIdentifier"];
+exports.ReferencedIdentifier = ReferencedIdentifier;
+const ReferencedMemberExpression = ["MemberExpression"];
+exports.ReferencedMemberExpression = ReferencedMemberExpression;
+const BindingIdentifier = ["Identifier"];
+exports.BindingIdentifier = BindingIdentifier;
+const Statement = ["Statement"];
+exports.Statement = Statement;
+const Expression = ["Expression"];
+exports.Expression = Expression;
+const Scope = ["Scopable", "Pattern"];
+exports.Scope = Scope;
+const Referenced = null;
+exports.Referenced = Referenced;
+const BlockScoped = null;
+exports.BlockScoped = BlockScoped;
+const Var = ["VariableDeclaration"];
+exports.Var = Var;
+const User = null;
+exports.User = User;
+const Generated = null;
+exports.Generated = Generated;
+const Pure = null;
+exports.Pure = Pure;
+const Flow = ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"];
+exports.Flow = Flow;
+const RestProperty = ["RestElement"];
+exports.RestProperty = RestProperty;
+const SpreadProperty = ["RestElement"];
+exports.SpreadProperty = SpreadProperty;
+const ExistentialTypeParam = ["ExistsTypeAnnotation"];
+exports.ExistentialTypeParam = ExistentialTypeParam;
+const NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"];
+exports.NumericLiteralTypeAnnotation = NumericLiteralTypeAnnotation;
+const ForAwaitStatement = ["ForOfStatement"];
+exports.ForAwaitStatement = ForAwaitStatement;
+
+//# sourceMappingURL=virtual-types.js.map
+
+
+/***/ }),
+
+/***/ 7575:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._containerInsert = _containerInsert;
+exports._containerInsertAfter = _containerInsertAfter;
+exports._containerInsertBefore = _containerInsertBefore;
+exports._verifyNodeList = _verifyNodeList;
+exports.hoist = hoist;
+exports.insertAfter = insertAfter;
+exports.insertBefore = insertBefore;
+exports.pushContainer = pushContainer;
+exports.unshiftContainer = unshiftContainer;
+exports.updateSiblingKeys = updateSiblingKeys;
+var _cache = __nccwpck_require__(5069);
+var _hoister = __nccwpck_require__(1225);
+var _index = __nccwpck_require__(8877);
+var _t = __nccwpck_require__(7912);
+const {
+ arrowFunctionExpression,
+ assertExpression,
+ assignmentExpression,
+ blockStatement,
+ callExpression,
+ cloneNode,
+ expressionStatement,
+ isAssignmentExpression,
+ isCallExpression,
+ isExportNamedDeclaration,
+ isExpression,
+ isIdentifier,
+ isSequenceExpression,
+ isSuper,
+ thisExpression
+} = _t;
+function insertBefore(nodes_) {
+ this._assertUnremoved();
+ const nodes = this._verifyNodeList(nodes_);
+ const {
+ parentPath,
+ parent
+ } = this;
+ if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || isExportNamedDeclaration(parent) || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
+ return parentPath.insertBefore(nodes);
+ } else if (this.isNodeType("Expression") && !this.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
+ if (this.node) nodes.push(this.node);
+ return this.replaceExpressionWithStatements(nodes);
+ } else if (Array.isArray(this.container)) {
+ return this._containerInsertBefore(nodes);
+ } else if (this.isStatementOrBlock()) {
+ const node = this.node;
+ const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
+ this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
+ return this.unshiftContainer("body", nodes);
+ } else {
+ throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
}
- tsParseDeclaration(node, value, next, decorators) {
- switch (value) {
- case "abstract":
- if (this.tsCheckLineTerminator(next) && (this.match(80) || tokenIsIdentifier(this.state.type))) {
- return this.tsParseAbstractDeclaration(node, decorators);
- }
- break;
- case "module":
- if (this.tsCheckLineTerminator(next)) {
- if (this.match(134)) {
- return this.tsParseAmbientExternalModuleDeclaration(node);
- } else if (tokenIsIdentifier(this.state.type)) {
- node.kind = "module";
- return this.tsParseModuleOrNamespaceDeclaration(node);
- }
- }
- break;
- case "namespace":
- if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
- node.kind = "namespace";
- return this.tsParseModuleOrNamespaceDeclaration(node);
- }
- break;
- case "type":
- if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
- return this.tsParseTypeAliasDeclaration(node);
- }
- break;
+}
+function _containerInsert(from, nodes) {
+ this.updateSiblingKeys(from, nodes.length);
+ const paths = [];
+ this.container.splice(from, 0, ...nodes);
+ for (let i = 0; i < nodes.length; i++) {
+ var _this$context;
+ const to = from + i;
+ const path = this.getSibling(to);
+ paths.push(path);
+ if ((_this$context = this.context) != null && _this$context.queue) {
+ path.pushContext(this.context);
}
}
- tsCheckLineTerminator(next) {
- if (next) {
- if (this.hasFollowingLineBreak()) return false;
- this.next();
- return true;
- }
- return !this.isLineTerminator();
- }
- tsTryParseGenericAsyncArrowFunction(startLoc) {
- if (!this.match(47)) return;
- const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
- this.state.maybeInArrowParameters = true;
- const res = this.tsTryParseAndCatch(() => {
- const node = this.startNodeAt(startLoc);
- node.typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
- super.parseFunctionParams(node);
- node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation();
- this.expect(19);
- return node;
- });
- this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
- if (!res) return;
- return super.parseArrowExpression(res, null, true);
- }
- tsParseTypeArgumentsInExpression() {
- if (this.reScan_lt() !== 47) return;
- return this.tsParseTypeArguments();
- }
- tsParseTypeArguments() {
- const node = this.startNode();
- node.params = this.tsInType(() => this.tsInTopLevelContext(() => {
- this.expect(47);
- return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
- }));
- if (node.params.length === 0) {
- this.raise(TSErrors.EmptyTypeArguments, node);
- } else if (!this.state.inType && this.curContext() === types.brace) {
- this.reScan_lt_gt();
+ const contexts = this._getQueueContexts();
+ for (const path of paths) {
+ path.setScope();
+ path.debug("Inserted.");
+ for (const context of contexts) {
+ context.maybeQueue(path, true);
}
- this.expect(48);
- return this.finishNode(node, "TSTypeParameterInstantiation");
}
- tsIsDeclarationStart() {
- return tokenIsTSDeclarationStart(this.state.type);
+ return paths;
+}
+function _containerInsertBefore(nodes) {
+ return this._containerInsert(this.key, nodes);
+}
+function _containerInsertAfter(nodes) {
+ return this._containerInsert(this.key + 1, nodes);
+}
+const last = arr => arr[arr.length - 1];
+function isHiddenInSequenceExpression(path) {
+ return isSequenceExpression(path.parent) && (last(path.parent.expressions) !== path.node || isHiddenInSequenceExpression(path.parentPath));
+}
+function isAlmostConstantAssignment(node, scope) {
+ if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {
+ return false;
}
- isExportDefaultSpecifier() {
- if (this.tsIsDeclarationStart()) return false;
- return super.isExportDefaultSpecifier();
+ const blockScope = scope.getBlockParent();
+ return blockScope.hasOwnBinding(node.left.name) && blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1;
+}
+function insertAfter(nodes_) {
+ this._assertUnremoved();
+ if (this.isSequenceExpression()) {
+ return last(this.get("expressions")).insertAfter(nodes_);
}
- parseBindingElement(flags, decorators) {
- const startLoc = this.state.startLoc;
- const modified = {};
- this.tsParseModifiers({
- allowedModifiers: ["public", "private", "protected", "override", "readonly"]
- }, modified);
- const accessibility = modified.accessibility;
- const override = modified.override;
- const readonly = modified.readonly;
- if (!(flags & 4) && (accessibility || readonly || override)) {
- this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
- }
- const left = this.parseMaybeDefault();
- if (flags & 2) {
- this.parseFunctionParamType(left);
- }
- const elt = this.parseMaybeDefault(left.loc.start, left);
- if (accessibility || readonly || override) {
- const pp = this.startNodeAt(startLoc);
- if (decorators.length) {
- pp.decorators = decorators;
+ const nodes = this._verifyNodeList(nodes_);
+ const {
+ parentPath,
+ parent
+ } = this;
+ if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || isExportNamedDeclaration(parent) || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
+ return parentPath.insertAfter(nodes.map(node => {
+ return isExpression(node) ? expressionStatement(node) : node;
+ }));
+ } else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
+ if (this.node) {
+ const node = this.node;
+ let {
+ scope
+ } = this;
+ if (scope.path.isPattern()) {
+ assertExpression(node);
+ this.replaceWith(callExpression(arrowFunctionExpression([], node), []));
+ this.get("callee.body").insertAfter(nodes);
+ return [this];
}
- if (accessibility) pp.accessibility = accessibility;
- if (readonly) pp.readonly = readonly;
- if (override) pp.override = override;
- if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
- this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
+ if (isHiddenInSequenceExpression(this)) {
+ nodes.unshift(node);
+ } else if (isCallExpression(node) && isSuper(node.callee)) {
+ nodes.unshift(node);
+ nodes.push(thisExpression());
+ } else if (isAlmostConstantAssignment(node, scope)) {
+ nodes.unshift(node);
+ nodes.push(cloneNode(node.left));
+ } else if (scope.isPure(node, true)) {
+ nodes.push(node);
+ } else {
+ if (parentPath.isMethod({
+ computed: true,
+ key: node
+ })) {
+ scope = scope.parent;
+ }
+ const temp = scope.generateDeclaredUidIdentifier();
+ nodes.unshift(expressionStatement(assignmentExpression("=", cloneNode(temp), node)));
+ nodes.push(expressionStatement(cloneNode(temp)));
}
- pp.parameter = elt;
- return this.finishNode(pp, "TSParameterProperty");
}
- if (decorators.length) {
- left.decorators = decorators;
- }
- return elt;
- }
- isSimpleParameter(node) {
- return node.type === "TSParameterProperty" && super.isSimpleParameter(node.parameter) || super.isSimpleParameter(node);
+ return this.replaceExpressionWithStatements(nodes);
+ } else if (Array.isArray(this.container)) {
+ return this._containerInsertAfter(nodes);
+ } else if (this.isStatementOrBlock()) {
+ const node = this.node;
+ const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
+ this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
+ return this.pushContainer("body", nodes);
+ } else {
+ throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
}
- tsDisallowOptionalPattern(node) {
- for (const param of node.params) {
- if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
- this.raise(TSErrors.PatternIsOptional, param);
- }
+}
+function updateSiblingKeys(fromIndex, incrementBy) {
+ if (!this.parent) return;
+ const paths = (0, _cache.getCachedPaths)(this.hub, this.parent) || [];
+ for (const [, path] of paths) {
+ if (typeof path.key === "number" && path.key >= fromIndex) {
+ path.key += incrementBy;
}
}
- setArrowFunctionParameters(node, params, trailingCommaLoc) {
- super.setArrowFunctionParameters(node, params, trailingCommaLoc);
- this.tsDisallowOptionalPattern(node);
+}
+function _verifyNodeList(nodes) {
+ if (!nodes) {
+ return [];
}
- parseFunctionBodyAndFinish(node, type, isMethod = false) {
- if (this.match(14)) {
- node.returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
- }
- const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : undefined;
- if (bodilessType && !this.match(5) && this.isLineTerminator()) {
- return this.finishNode(node, bodilessType);
+ if (!Array.isArray(nodes)) {
+ nodes = [nodes];
+ }
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ let msg;
+ if (!node) {
+ msg = "has falsy node";
+ } else if (typeof node !== "object") {
+ msg = "contains a non-object node";
+ } else if (!node.type) {
+ msg = "without a type";
+ } else if (node instanceof _index.default) {
+ msg = "has a NodePath when it expected a raw object";
}
- if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
- this.raise(TSErrors.DeclareFunctionHasImplementation, node);
- if (node.declare) {
- return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
- }
+ if (msg) {
+ const type = Array.isArray(node) ? "array" : typeof node;
+ throw new Error(`Node list ${msg} with the index of ${i} and type of ${type}`);
}
- this.tsDisallowOptionalPattern(node);
- return super.parseFunctionBodyAndFinish(node, type, isMethod);
}
- registerFunctionStatementId(node) {
- if (!node.body && node.id) {
- this.checkIdentifier(node.id, 1024);
- } else {
- super.registerFunctionStatementId(node);
- }
+ return nodes;
+}
+function unshiftContainer(listKey, nodes) {
+ this._assertUnremoved();
+ nodes = this._verifyNodeList(nodes);
+ const path = _index.default.get({
+ parentPath: this,
+ parent: this.node,
+ container: this.node[listKey],
+ listKey,
+ key: 0
+ }).setContext(this.context);
+ return path._containerInsertBefore(nodes);
+}
+function pushContainer(listKey, nodes) {
+ this._assertUnremoved();
+ const verifiedNodes = this._verifyNodeList(nodes);
+ const container = this.node[listKey];
+ const path = _index.default.get({
+ parentPath: this,
+ parent: this.node,
+ container: container,
+ listKey,
+ key: container.length
+ }).setContext(this.context);
+ return path.replaceWithMultiple(verifiedNodes);
+}
+function hoist(scope = this.scope) {
+ const hoister = new _hoister.default(this, scope);
+ return hoister.run();
+}
+
+//# sourceMappingURL=modification.js.map
+
+
+/***/ }),
+
+/***/ 408:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._assertUnremoved = _assertUnremoved;
+exports._callRemovalHooks = _callRemovalHooks;
+exports._markRemoved = _markRemoved;
+exports._remove = _remove;
+exports._removeFromScope = _removeFromScope;
+exports.remove = remove;
+var _removalHooks = __nccwpck_require__(1587);
+var _cache = __nccwpck_require__(5069);
+var _index = __nccwpck_require__(8877);
+function remove() {
+ var _this$opts;
+ this._assertUnremoved();
+ this.resync();
+ if (!((_this$opts = this.opts) != null && _this$opts.noScope)) {
+ this._removeFromScope();
}
- tsCheckForInvalidTypeCasts(items) {
- items.forEach(node => {
- if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
- this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
- }
- });
+ if (this._callRemovalHooks()) {
+ this._markRemoved();
+ return;
}
- toReferencedList(exprList, isInParens) {
- this.tsCheckForInvalidTypeCasts(exprList);
- return exprList;
+ this.shareCommentsWithSiblings();
+ this._remove();
+ this._markRemoved();
+}
+function _removeFromScope() {
+ const bindings = this.getBindingIdentifiers();
+ Object.keys(bindings).forEach(name => this.scope.removeBinding(name));
+}
+function _callRemovalHooks() {
+ for (const fn of _removalHooks.hooks) {
+ if (fn(this, this.parentPath)) return true;
}
- parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
- const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
- if (node.type === "ArrayExpression") {
- this.tsCheckForInvalidTypeCasts(node.elements);
- }
- return node;
+}
+function _remove() {
+ if (Array.isArray(this.container)) {
+ this.container.splice(this.key, 1);
+ this.updateSiblingKeys(this.key, -1);
+ } else {
+ this._replaceWith(null);
}
- parseSubscript(base, startLoc, noCalls, state) {
- if (!this.hasPrecedingLineBreak() && this.match(35)) {
- this.state.canStartJSXElement = false;
- this.next();
- const nonNullExpression = this.startNodeAt(startLoc);
- nonNullExpression.expression = base;
- return this.finishNode(nonNullExpression, "TSNonNullExpression");
- }
- let isOptionalCall = false;
- if (this.match(18) && this.lookaheadCharCode() === 60) {
- if (noCalls) {
- state.stop = true;
- return base;
- }
- state.optionalChainMember = isOptionalCall = true;
- this.next();
- }
- if (this.match(47) || this.match(51)) {
- let missingParenErrorLoc;
- const result = this.tsTryParseAndCatch(() => {
- if (!noCalls && this.atPossibleAsyncArrow(base)) {
- const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc);
- if (asyncArrowFn) {
- return asyncArrowFn;
- }
- }
- const typeArguments = this.tsParseTypeArgumentsInExpression();
- if (!typeArguments) return;
- if (isOptionalCall && !this.match(10)) {
- missingParenErrorLoc = this.state.curPosition();
- return;
- }
- if (tokenIsTemplate(this.state.type)) {
- const result = super.parseTaggedTemplateExpression(base, startLoc, state);
- {
- result.typeParameters = typeArguments;
- }
- return result;
- }
- if (!noCalls && this.eat(10)) {
- const node = this.startNodeAt(startLoc);
- node.callee = base;
- node.arguments = this.parseCallExpressionArguments(11);
- this.tsCheckForInvalidTypeCasts(node.arguments);
- {
- node.typeParameters = typeArguments;
- }
- if (state.optionalChainMember) {
- node.optional = isOptionalCall;
- }
- return this.finishCallExpression(node, state.optionalChainMember);
- }
- const tokenType = this.state.type;
- if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
- return;
- }
- const node = this.startNodeAt(startLoc);
- node.expression = base;
- {
- node.typeParameters = typeArguments;
- }
- return this.finishNode(node, "TSInstantiationExpression");
- });
- if (missingParenErrorLoc) {
- this.unexpected(missingParenErrorLoc, 10);
- }
- if (result) {
- if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
- this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
- }
- return result;
- }
- }
- return super.parseSubscript(base, startLoc, noCalls, state);
+}
+function _markRemoved() {
+ this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED;
+ if (this.parent) {
+ (0, _cache.getCachedPaths)(this.hub, this.parent).delete(this.node);
}
- parseNewCallee(node) {
- var _callee$extra;
- super.parseNewCallee(node);
- const {
- callee
- } = node;
- if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) {
- {
- node.typeParameters = callee.typeParameters;
- }
- node.callee = callee.expression;
- }
- }
- parseExprOp(left, leftStartLoc, minPrec) {
- let isSatisfies;
- if (tokenOperatorPrecedence(58) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(93) || (isSatisfies = this.isContextual(120)))) {
- const node = this.startNodeAt(leftStartLoc);
- node.expression = left;
- node.typeAnnotation = this.tsInType(() => {
- this.next();
- if (this.match(75)) {
- if (isSatisfies) {
- this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
- keyword: "const"
- });
- }
- return this.tsParseTypeReference();
+ this.node = null;
+}
+function _assertUnremoved() {
+ if (this.removed) {
+ throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
+ }
+}
+
+//# sourceMappingURL=removal.js.map
+
+
+/***/ }),
+
+/***/ 8805:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports._replaceWith = _replaceWith;
+exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
+exports.replaceInline = replaceInline;
+exports.replaceWith = replaceWith;
+exports.replaceWithMultiple = replaceWithMultiple;
+exports.replaceWithSourceString = replaceWithSourceString;
+var _codeFrame = __nccwpck_require__(1322);
+var _index = __nccwpck_require__(1380);
+var _index2 = __nccwpck_require__(8877);
+var _cache = __nccwpck_require__(5069);
+var _parser = __nccwpck_require__(5026);
+var _t = __nccwpck_require__(7912);
+var _helperHoistVariables = __nccwpck_require__(6934);
+const {
+ FUNCTION_TYPES,
+ arrowFunctionExpression,
+ assignmentExpression,
+ awaitExpression,
+ blockStatement,
+ callExpression,
+ cloneNode,
+ expressionStatement,
+ identifier,
+ inheritLeadingComments,
+ inheritTrailingComments,
+ inheritsComments,
+ isExpression,
+ isProgram,
+ isStatement,
+ removeComments,
+ returnStatement,
+ toSequenceExpression,
+ validate,
+ yieldExpression
+} = _t;
+function replaceWithMultiple(nodes) {
+ var _getCachedPaths;
+ this.resync();
+ nodes = this._verifyNodeList(nodes);
+ inheritLeadingComments(nodes[0], this.node);
+ inheritTrailingComments(nodes[nodes.length - 1], this.node);
+ (_getCachedPaths = (0, _cache.getCachedPaths)(this.hub, this.parent)) == null ? void 0 : _getCachedPaths.delete(this.node);
+ this.node = this.container[this.key] = null;
+ const paths = this.insertAfter(nodes);
+ if (this.node) {
+ this.requeue();
+ } else {
+ this.remove();
+ }
+ return paths;
+}
+function replaceWithSourceString(replacement) {
+ this.resync();
+ let ast;
+ try {
+ replacement = `(${replacement})`;
+ ast = (0, _parser.parse)(replacement);
+ } catch (err) {
+ const loc = err.loc;
+ if (loc) {
+ err.message += " - make sure this is an expression.\n" + (0, _codeFrame.codeFrameColumns)(replacement, {
+ start: {
+ line: loc.line,
+ column: loc.column + 1
}
- return this.tsParseType();
});
- this.finishNode(node, isSatisfies ? "TSSatisfiesExpression" : "TSAsExpression");
- this.reScan_lt_gt();
- return this.parseExprOp(node, leftStartLoc, minPrec);
+ err.code = "BABEL_REPLACE_SOURCE_ERROR";
}
- return super.parseExprOp(left, leftStartLoc, minPrec);
+ throw err;
}
- checkReservedWord(word, startLoc, checkKeywords, isBinding) {
- if (!this.state.isAmbientContext) {
- super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
- }
+ const expressionAST = ast.program.body[0].expression;
+ _index.default.removeProperties(expressionAST);
+ return this.replaceWith(expressionAST);
+}
+function replaceWith(replacementPath) {
+ this.resync();
+ if (this.removed) {
+ throw new Error("You can't replace this node, we've already removed it");
}
- checkImportReflection(node) {
- super.checkImportReflection(node);
- if (node.module && node.importKind !== "value") {
- this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
- }
+ let replacement = replacementPath instanceof _index2.default ? replacementPath.node : replacementPath;
+ if (!replacement) {
+ throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");
}
- checkDuplicateExports() {}
- isPotentialImportPhase(isExport) {
- if (super.isPotentialImportPhase(isExport)) return true;
- if (this.isContextual(130)) {
- const ch = this.lookaheadCharCode();
- return isExport ? ch === 123 || ch === 42 : ch !== 61;
- }
- return !isExport && this.isContextual(87);
+ if (this.node === replacement) {
+ return [this];
}
- applyImportPhase(node, isExport, phase, loc) {
- super.applyImportPhase(node, isExport, phase, loc);
- if (isExport) {
- node.exportKind = phase === "type" ? "type" : "value";
- } else {
- node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
- }
- }
- parseImport(node) {
- if (this.match(134)) {
- node.importKind = "value";
- return super.parseImport(node);
- }
- let importNode;
- if (tokenIsIdentifier(this.state.type) && this.lookaheadCharCode() === 61) {
- node.importKind = "value";
- return this.tsParseImportEqualsDeclaration(node);
- } else if (this.isContextual(130)) {
- const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
- if (this.lookaheadCharCode() === 61) {
- return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier);
- } else {
- importNode = super.parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier);
- }
- } else {
- importNode = super.parseImport(node);
- }
- if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
- this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
- }
- return importNode;
+ if (this.isProgram() && !isProgram(replacement)) {
+ throw new Error("You can only replace a Program root node with another Program node");
}
- parseExport(node, decorators) {
- if (this.match(83)) {
- const nodeImportEquals = node;
- this.next();
- let maybeDefaultIdentifier = null;
- if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
- maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
- } else {
- nodeImportEquals.importKind = "value";
- }
- const declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
- {
- return declaration;
- }
- } else if (this.eat(29)) {
- const assign = node;
- assign.expression = super.parseExpression();
- this.semicolon();
- this.sawUnambiguousESM = true;
- return this.finishNode(assign, "TSExportAssignment");
- } else if (this.eatContextual(93)) {
- const decl = node;
- this.expectContextual(128);
- decl.id = this.parseIdentifier();
- this.semicolon();
- return this.finishNode(decl, "TSNamespaceExportDeclaration");
- } else {
- return super.parseExport(node, decorators);
- }
- }
- isAbstractClass() {
- return this.isContextual(124) && this.lookahead().type === 80;
+ if (Array.isArray(replacement)) {
+ throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");
}
- parseExportDefaultExpression() {
- if (this.isAbstractClass()) {
- const cls = this.startNode();
- this.next();
- cls.abstract = true;
- return this.parseClass(cls, true, true);
- }
- if (this.match(129)) {
- const result = this.tsParseInterfaceDeclaration(this.startNode());
- if (result) return result;
- }
- return super.parseExportDefaultExpression();
+ if (typeof replacement === "string") {
+ throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");
}
- parseVarStatement(node, kind, allowMissingInitializer = false) {
- const {
- isAmbientContext
- } = this.state;
- const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
- if (!isAmbientContext) return declaration;
- for (const {
- id,
- init
- } of declaration.declarations) {
- if (!init) continue;
- if (kind !== "const" || !!id.typeAnnotation) {
- this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
- } else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
- this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
- }
- }
- return declaration;
- }
- parseStatementContent(flags, decorators) {
- if (this.match(75) && this.isLookaheadContextual("enum")) {
- const node = this.startNode();
- this.expect(75);
- return this.tsParseEnumDeclaration(node, {
- const: true
- });
- }
- if (this.isContextual(126)) {
- return this.tsParseEnumDeclaration(this.startNode());
- }
- if (this.isContextual(129)) {
- const result = this.tsParseInterfaceDeclaration(this.startNode());
- if (result) return result;
+ let nodePath = "";
+ if (this.isNodeType("Statement") && isExpression(replacement)) {
+ if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
+ replacement = expressionStatement(replacement);
+ nodePath = "expression";
}
- return super.parseStatementContent(flags, decorators);
- }
- parseAccessModifier() {
- return this.tsParseModifier(["public", "protected", "private"]);
- }
- tsHasSomeModifiers(member, modifiers) {
- return modifiers.some(modifier => {
- if (tsIsAccessModifier(modifier)) {
- return member.accessibility === modifier;
- }
- return !!member[modifier];
- });
}
- tsIsStartOfStaticBlocks() {
- return this.isContextual(106) && this.lookaheadCharCode() === 123;
- }
- parseClassMember(classBody, member, state) {
- const modifiers = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"];
- this.tsParseModifiers({
- allowedModifiers: modifiers,
- disallowedModifiers: ["in", "out"],
- stopOnStartOfClassStaticBlock: true,
- errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
- }, member);
- const callParseClassMemberWithIsStatic = () => {
- if (this.tsIsStartOfStaticBlocks()) {
- this.next();
- this.next();
- if (this.tsHasSomeModifiers(member, modifiers)) {
- this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
- }
- super.parseClassStaticBlock(classBody, member);
- } else {
- this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
- }
- };
- if (member.declare) {
- this.tsInAmbientContext(callParseClassMemberWithIsStatic);
- } else {
- callParseClassMemberWithIsStatic();
+ if (this.isNodeType("Expression") && isStatement(replacement)) {
+ if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
+ return this.replaceExpressionWithStatements([replacement]);
}
}
- parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
- const idx = this.tsTryParseIndexSignature(member);
- if (idx) {
- classBody.body.push(idx);
- if (member.abstract) {
- this.raise(TSErrors.IndexSignatureHasAbstract, member);
- }
- if (member.accessibility) {
- this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
- modifier: member.accessibility
- });
- }
- if (member.declare) {
- this.raise(TSErrors.IndexSignatureHasDeclare, member);
- }
- if (member.override) {
- this.raise(TSErrors.IndexSignatureHasOverride, member);
- }
- return;
- }
- if (!this.state.inAbstractClass && member.abstract) {
- this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
- }
- if (member.override) {
- if (!state.hadSuperClass) {
- this.raise(TSErrors.OverrideNotInSubClass, member);
- }
- }
- super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
+ const oldNode = this.node;
+ if (oldNode) {
+ inheritsComments(replacement, oldNode);
+ removeComments(oldNode);
}
- parsePostMemberNameModifiers(methodOrProp) {
- const optional = this.eat(17);
- if (optional) methodOrProp.optional = true;
- if (methodOrProp.readonly && this.match(10)) {
- this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
- }
- if (methodOrProp.declare && this.match(10)) {
- this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
- }
+ this._replaceWith(replacement);
+ this.type = replacement.type;
+ this.setScope();
+ this.requeue();
+ return [nodePath ? this.get(nodePath) : this];
+}
+function _replaceWith(node) {
+ var _getCachedPaths2;
+ if (!this.container) {
+ throw new ReferenceError("Container is falsy");
}
- parseExpressionStatement(node, expr, decorators) {
- const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr, decorators) : undefined;
- return decl || super.parseExpressionStatement(node, expr, decorators);
+ if (this.inList) {
+ validate(this.parent, this.key, [node]);
+ } else {
+ validate(this.parent, this.key, node);
}
- shouldParseExportDeclaration() {
- if (this.tsIsDeclarationStart()) return true;
- return super.shouldParseExportDeclaration();
+ this.debug(`Replace with ${node == null ? void 0 : node.type}`);
+ (_getCachedPaths2 = (0, _cache.getCachedPaths)(this.hub, this.parent)) == null ? void 0 : _getCachedPaths2.set(node, this).delete(this.node);
+ this.node = this.container[this.key] = node;
+}
+function replaceExpressionWithStatements(nodes) {
+ this.resync();
+ const nodesAsSequenceExpression = toSequenceExpression(nodes, this.scope);
+ if (nodesAsSequenceExpression) {
+ return this.replaceWith(nodesAsSequenceExpression)[0].get("expressions");
}
- parseConditional(expr, startLoc, refExpressionErrors) {
- if (!this.match(17)) return expr;
- if (this.state.maybeInArrowParameters) {
- const nextCh = this.lookaheadCharCode();
- if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
- this.setOptionalParametersError(refExpressionErrors);
- return expr;
+ const functionParent = this.getFunctionParent();
+ const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
+ const isParentGenerator = functionParent == null ? void 0 : functionParent.is("generator");
+ const container = arrowFunctionExpression([], blockStatement(nodes));
+ this.replaceWith(callExpression(container, []));
+ const callee = this.get("callee");
+ (0, _helperHoistVariables.default)(callee.get("body"), id => {
+ this.scope.push({
+ id
+ });
+ }, "var");
+ const completionRecords = this.get("callee").getCompletionRecords();
+ for (const path of completionRecords) {
+ if (!path.isExpressionStatement()) continue;
+ const loop = path.findParent(path => path.isLoop());
+ if (loop) {
+ let uid = loop.getData("expressionReplacementReturnUid");
+ if (!uid) {
+ uid = callee.scope.generateDeclaredUidIdentifier("ret");
+ callee.get("body").pushContainer("body", returnStatement(cloneNode(uid)));
+ loop.setData("expressionReplacementReturnUid", uid);
+ } else {
+ uid = identifier(uid.name);
}
+ path.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path.node.expression));
+ } else {
+ path.replaceWith(returnStatement(path.node.expression));
}
- return super.parseConditional(expr, startLoc, refExpressionErrors);
- }
- parseParenItem(node, startLoc) {
- const newNode = super.parseParenItem(node, startLoc);
- if (this.eat(17)) {
- newNode.optional = true;
- this.resetEndLocation(node);
- }
- if (this.match(14)) {
- const typeCastNode = this.startNodeAt(startLoc);
- typeCastNode.expression = node;
- typeCastNode.typeAnnotation = this.tsParseTypeAnnotation();
- return this.finishNode(typeCastNode, "TSTypeCastExpression");
- }
- return node;
- }
- parseExportDeclaration(node) {
- if (!this.state.isAmbientContext && this.isContextual(125)) {
- return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
- }
- const startLoc = this.state.startLoc;
- const isDeclare = this.eatContextual(125);
- if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
- throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
- }
- const isIdentifier = tokenIsIdentifier(this.state.type);
- const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
- if (!declaration) return null;
- if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) {
- node.exportKind = "type";
- }
- if (isDeclare && declaration.type !== "TSImportEqualsDeclaration") {
- this.resetStartLocation(declaration, startLoc);
- declaration.declare = true;
- }
- return declaration;
}
- parseClassId(node, isStatement, optionalId, bindingType) {
- if ((!isStatement || optionalId) && this.isContextual(113)) {
- return;
+ callee.arrowFunctionToExpression();
+ const newCallee = callee;
+ const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", FUNCTION_TYPES);
+ const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", FUNCTION_TYPES);
+ if (needToAwaitFunction) {
+ newCallee.set("async", true);
+ if (!needToYieldFunction) {
+ this.replaceWith(awaitExpression(this.node));
}
- super.parseClassId(node, isStatement, optionalId, node.declare ? 1024 : 8331);
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
- if (typeParameters) node.typeParameters = typeParameters;
}
- parseClassPropertyAnnotation(node) {
- if (!node.optional) {
- if (this.eat(35)) {
- node.definite = true;
- } else if (this.eat(17)) {
- node.optional = true;
- }
- }
- const type = this.tsTryParseTypeAnnotation();
- if (type) node.typeAnnotation = type;
+ if (needToYieldFunction) {
+ newCallee.set("generator", true);
+ this.replaceWith(yieldExpression(this.node, true));
}
- parseClassProperty(node) {
- this.parseClassPropertyAnnotation(node);
- if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
- this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
- }
- if (node.abstract && this.match(29)) {
- const {
- key
- } = node;
- this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
- propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
- });
+ return newCallee.get("body.body");
+}
+function replaceInline(nodes) {
+ this.resync();
+ if (Array.isArray(nodes)) {
+ if (Array.isArray(this.container)) {
+ nodes = this._verifyNodeList(nodes);
+ const paths = this._containerInsertAfter(nodes);
+ this.remove();
+ return paths;
+ } else {
+ return this.replaceWithMultiple(nodes);
}
- return super.parseClassProperty(node);
+ } else {
+ return this.replaceWith(nodes);
}
- parseClassPrivateProperty(node) {
- if (node.abstract) {
- this.raise(TSErrors.PrivateElementHasAbstract, node);
- }
- if (node.accessibility) {
- this.raise(TSErrors.PrivateElementHasAccessibility, node, {
- modifier: node.accessibility
- });
+}
+
+//# sourceMappingURL=replacement.js.map
+
+
+/***/ }),
+
+/***/ 1410:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+class Binding {
+ constructor({
+ identifier,
+ scope,
+ path,
+ kind
+ }) {
+ this.identifier = void 0;
+ this.scope = void 0;
+ this.path = void 0;
+ this.kind = void 0;
+ this.constantViolations = [];
+ this.constant = true;
+ this.referencePaths = [];
+ this.referenced = false;
+ this.references = 0;
+ this.identifier = identifier;
+ this.scope = scope;
+ this.path = path;
+ this.kind = kind;
+ if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) {
+ this.reassign(path);
}
- this.parseClassPropertyAnnotation(node);
- return super.parseClassPrivateProperty(node);
+ this.clearValue();
}
- parseClassAccessorProperty(node) {
- this.parseClassPropertyAnnotation(node);
- if (node.optional) {
- this.raise(TSErrors.AccessorCannotBeOptional, node);
- }
- return super.parseClassAccessorProperty(node);
+ deoptValue() {
+ this.clearValue();
+ this.hasDeoptedValue = true;
}
- pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
- if (typeParameters && isConstructor) {
- this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
- }
- const {
- declare = false,
- kind
- } = method;
- if (declare && (kind === "get" || kind === "set")) {
- this.raise(TSErrors.DeclareAccessor, method, {
- kind
- });
- }
- if (typeParameters) method.typeParameters = typeParameters;
- super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
+ setValue(value) {
+ if (this.hasDeoptedValue) return;
+ this.hasValue = true;
+ this.value = value;
}
- pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
- if (typeParameters) method.typeParameters = typeParameters;
- super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
+ clearValue() {
+ this.hasDeoptedValue = false;
+ this.hasValue = false;
+ this.value = null;
}
- declareClassPrivateMethodInScope(node, kind) {
- if (node.type === "TSDeclareMethod") return;
- if (node.type === "MethodDefinition" && !hasOwnProperty.call(node.value, "body")) {
+ reassign(path) {
+ this.constant = false;
+ if (this.constantViolations.indexOf(path) !== -1) {
return;
}
- super.declareClassPrivateMethodInScope(node, kind);
- }
- parseClassSuper(node) {
- super.parseClassSuper(node);
- if (node.superClass && (this.match(47) || this.match(51))) {
- {
- node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
- }
- }
- if (this.eatContextual(113)) {
- node.implements = this.tsParseHeritageClause("implements");
- }
- }
- parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
- if (typeParameters) prop.typeParameters = typeParameters;
- return super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
- }
- parseFunctionParams(node, isConstructor) {
- const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
- if (typeParameters) node.typeParameters = typeParameters;
- super.parseFunctionParams(node, isConstructor);
- }
- parseVarId(decl, kind) {
- super.parseVarId(decl, kind);
- if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(35)) {
- decl.definite = true;
- }
- const type = this.tsTryParseTypeAnnotation();
- if (type) {
- decl.id.typeAnnotation = type;
- this.resetEndLocation(decl.id);
- }
- }
- parseAsyncArrowFromCallExpression(node, call) {
- if (this.match(14)) {
- node.returnType = this.tsParseTypeAnnotation();
- }
- return super.parseAsyncArrowFromCallExpression(node, call);
- }
- parseMaybeAssign(refExpressionErrors, afterLeftParse) {
- var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2;
- let state;
- let jsx;
- let typeCast;
- if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
- state = this.state.clone();
- jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
- if (!jsx.error) return jsx.node;
- const {
- context
- } = this.state;
- const currentContext = context[context.length - 1];
- if (currentContext === types.j_oTag || currentContext === types.j_expr) {
- context.pop();
- }
- }
- if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
- return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
- }
- if (!state || state === this.state) state = this.state.clone();
- let typeParameters;
- const arrow = this.tryParse(abort => {
- var _expr$extra, _typeParameters;
- typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
- const expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
- if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
- abort();
- }
- if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) {
- this.resetStartLocationFromNode(expr, typeParameters);
- }
- expr.typeParameters = typeParameters;
- return expr;
- }, state);
- if (!arrow.error && !arrow.aborted) {
- if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
- return arrow.node;
- }
- if (!jsx) {
- assert(!this.hasPlugin("jsx"));
- typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
- if (!typeCast.error) return typeCast.node;
- }
- if ((_jsx2 = jsx) != null && _jsx2.node) {
- this.state = jsx.failState;
- return jsx.node;
- }
- if (arrow.node) {
- this.state = arrow.failState;
- if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
- return arrow.node;
- }
- if ((_typeCast = typeCast) != null && _typeCast.node) {
- this.state = typeCast.failState;
- return typeCast.node;
- }
- throw ((_jsx3 = jsx) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error);
- }
- reportReservedArrowTypeParam(node) {
- var _node$extra2;
- if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra2 = node.extra) != null && _node$extra2.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
- this.raise(TSErrors.ReservedArrowTypeParam, node);
- }
- }
- parseMaybeUnary(refExpressionErrors, sawUnary) {
- if (!this.hasPlugin("jsx") && this.match(47)) {
- return this.tsParseTypeAssertion();
- }
- return super.parseMaybeUnary(refExpressionErrors, sawUnary);
- }
- parseArrow(node) {
- if (this.match(14)) {
- const result = this.tryParse(abort => {
- const returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
- if (this.canInsertSemicolon() || !this.match(19)) abort();
- return returnType;
- });
- if (result.aborted) return;
- if (!result.thrown) {
- if (result.error) this.state = result.failState;
- node.returnType = result.node;
- }
- }
- return super.parseArrow(node);
- }
- parseFunctionParamType(param) {
- if (this.eat(17)) {
- param.optional = true;
- }
- const type = this.tsTryParseTypeAnnotation();
- if (type) param.typeAnnotation = type;
- this.resetEndLocation(param);
- return param;
+ this.constantViolations.push(path);
}
- isAssignable(node, isBinding) {
- switch (node.type) {
- case "TSTypeCastExpression":
- return this.isAssignable(node.expression, isBinding);
- case "TSParameterProperty":
- return true;
- default:
- return super.isAssignable(node, isBinding);
+ reference(path) {
+ if (this.referencePaths.indexOf(path) !== -1) {
+ return;
}
+ this.referenced = true;
+ this.references++;
+ this.referencePaths.push(path);
}
- toAssignable(node, isLHS = false) {
- switch (node.type) {
- case "ParenthesizedExpression":
- this.toAssignableParenthesizedExpression(node, isLHS);
- break;
- case "TSAsExpression":
- case "TSSatisfiesExpression":
- case "TSNonNullExpression":
- case "TSTypeAssertion":
- if (isLHS) {
- this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
- } else {
- this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
- }
- this.toAssignable(node.expression, isLHS);
- break;
- case "AssignmentExpression":
- if (!isLHS && node.left.type === "TSTypeCastExpression") {
- node.left = this.typeCastToParameter(node.left);
- }
- default:
- super.toAssignable(node, isLHS);
- }
+ dereference() {
+ this.references--;
+ this.referenced = !!this.references;
}
- toAssignableParenthesizedExpression(node, isLHS) {
- switch (node.expression.type) {
- case "TSAsExpression":
- case "TSSatisfiesExpression":
- case "TSNonNullExpression":
- case "TSTypeAssertion":
- case "ParenthesizedExpression":
- this.toAssignable(node.expression, isLHS);
- break;
- default:
- super.toAssignable(node, isLHS);
+}
+exports["default"] = Binding;
+function isDeclaredInLoop(path) {
+ for (let {
+ parentPath,
+ key
+ } = path; parentPath; ({
+ parentPath,
+ key
+ } = parentPath)) {
+ if (parentPath.isFunctionParent()) return false;
+ if (parentPath.isWhile() || parentPath.isForXStatement() || parentPath.isForStatement() && key === "body") {
+ return true;
}
}
- checkToRestConversion(node, allowPattern) {
- switch (node.type) {
- case "TSAsExpression":
- case "TSSatisfiesExpression":
- case "TSTypeAssertion":
- case "TSNonNullExpression":
- this.checkToRestConversion(node.expression, false);
- break;
- default:
- super.checkToRestConversion(node, allowPattern);
- }
- }
- isValidLVal(type, isUnparenthesizedInAssign, binding) {
- switch (type) {
- case "TSTypeCastExpression":
- return true;
- case "TSParameterProperty":
- return "parameter";
- case "TSNonNullExpression":
- return "expression";
- case "TSAsExpression":
- case "TSSatisfiesExpression":
- case "TSTypeAssertion":
- return (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true];
- default:
- return super.isValidLVal(type, isUnparenthesizedInAssign, binding);
- }
- }
- parseBindingAtom() {
- if (this.state.type === 78) {
- return this.parseIdentifier(true);
- }
- return super.parseBindingAtom();
- }
- parseMaybeDecoratorArguments(expr, startLoc) {
- if (this.match(47) || this.match(51)) {
- const typeArguments = this.tsParseTypeArgumentsInExpression();
- if (this.match(10)) {
- const call = super.parseMaybeDecoratorArguments(expr, startLoc);
- {
- call.typeParameters = typeArguments;
+ return false;
+}
+
+//# sourceMappingURL=binding.js.map
+
+
+/***/ }),
+
+/***/ 891:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+var _renamer = __nccwpck_require__(3708);
+var _index = __nccwpck_require__(1380);
+var _binding = __nccwpck_require__(1410);
+var _globals = __nccwpck_require__(455);
+var _t = __nccwpck_require__(7912);
+var t = _t;
+var _cache = __nccwpck_require__(5069);
+var _visitors = __nccwpck_require__(3494);
+const {
+ NOT_LOCAL_BINDING,
+ callExpression,
+ cloneNode,
+ getBindingIdentifiers,
+ identifier,
+ isArrayExpression,
+ isBinary,
+ isClass,
+ isClassBody,
+ isClassDeclaration,
+ isExportAllDeclaration,
+ isExportDefaultDeclaration,
+ isExportNamedDeclaration,
+ isFunctionDeclaration,
+ isIdentifier,
+ isImportDeclaration,
+ isLiteral,
+ isMethod,
+ isModuleSpecifier,
+ isNullLiteral,
+ isObjectExpression,
+ isProperty,
+ isPureish,
+ isRegExpLiteral,
+ isSuper,
+ isTaggedTemplateExpression,
+ isTemplateLiteral,
+ isThisExpression,
+ isUnaryExpression,
+ isVariableDeclaration,
+ matchesPattern,
+ memberExpression,
+ numericLiteral,
+ toIdentifier,
+ variableDeclaration,
+ variableDeclarator,
+ isRecordExpression,
+ isTupleExpression,
+ isObjectProperty,
+ isTopicReference,
+ isMetaProperty,
+ isPrivateName,
+ isExportDeclaration,
+ buildUndefinedNode
+} = _t;
+function gatherNodeParts(node, parts) {
+ switch (node == null ? void 0 : node.type) {
+ default:
+ if (isImportDeclaration(node) || isExportDeclaration(node)) {
+ var _node$specifiers;
+ if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) {
+ gatherNodeParts(node.source, parts);
+ } else if ((isExportNamedDeclaration(node) || isImportDeclaration(node)) && (_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
+ for (const e of node.specifiers) gatherNodeParts(e, parts);
+ } else if ((isExportDefaultDeclaration(node) || isExportNamedDeclaration(node)) && node.declaration) {
+ gatherNodeParts(node.declaration, parts);
}
- return call;
- }
- this.unexpected(null, 10);
- }
- return super.parseMaybeDecoratorArguments(expr, startLoc);
- }
- checkCommaAfterRest(close) {
- if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) {
- this.next();
- return false;
- }
- return super.checkCommaAfterRest(close);
- }
- isClassMethod() {
- return this.match(47) || super.isClassMethod();
- }
- isClassProperty() {
- return this.match(35) || this.match(14) || super.isClassProperty();
- }
- parseMaybeDefault(startLoc, left) {
- const node = super.parseMaybeDefault(startLoc, left);
- if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
- this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
- }
- return node;
- }
- getTokenFromCode(code) {
- if (this.state.inType) {
- if (code === 62) {
- this.finishOp(48, 1);
- return;
+ } else if (isModuleSpecifier(node)) {
+ gatherNodeParts(node.local, parts);
+ } else if (isLiteral(node) && !isNullLiteral(node) && !isRegExpLiteral(node) && !isTemplateLiteral(node)) {
+ parts.push(node.value);
}
- if (code === 60) {
- this.finishOp(47, 1);
- return;
+ break;
+ case "MemberExpression":
+ case "OptionalMemberExpression":
+ case "JSXMemberExpression":
+ gatherNodeParts(node.object, parts);
+ gatherNodeParts(node.property, parts);
+ break;
+ case "Identifier":
+ case "JSXIdentifier":
+ parts.push(node.name);
+ break;
+ case "CallExpression":
+ case "OptionalCallExpression":
+ case "NewExpression":
+ gatherNodeParts(node.callee, parts);
+ break;
+ case "ObjectExpression":
+ case "ObjectPattern":
+ for (const e of node.properties) {
+ gatherNodeParts(e, parts);
}
- }
- super.getTokenFromCode(code);
- }
- reScan_lt_gt() {
- const {
- type
- } = this.state;
- if (type === 47) {
- this.state.pos -= 1;
- this.readToken_lt();
- } else if (type === 48) {
- this.state.pos -= 1;
- this.readToken_gt();
- }
- }
- reScan_lt() {
- const {
- type
- } = this.state;
- if (type === 51) {
- this.state.pos -= 2;
- this.finishOp(47, 1);
- return 47;
- }
- return type;
- }
- toAssignableListItem(exprList, index, isLHS) {
- const node = exprList[index];
- if (node.type === "TSTypeCastExpression") {
- exprList[index] = this.typeCastToParameter(node);
- }
- super.toAssignableListItem(exprList, index, isLHS);
- }
- typeCastToParameter(node) {
- node.expression.typeAnnotation = node.typeAnnotation;
- this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
- return node.expression;
+ break;
+ case "SpreadElement":
+ case "RestElement":
+ gatherNodeParts(node.argument, parts);
+ break;
+ case "ObjectProperty":
+ case "ObjectMethod":
+ case "ClassProperty":
+ case "ClassMethod":
+ case "ClassPrivateProperty":
+ case "ClassPrivateMethod":
+ gatherNodeParts(node.key, parts);
+ break;
+ case "ThisExpression":
+ parts.push("this");
+ break;
+ case "Super":
+ parts.push("super");
+ break;
+ case "Import":
+ parts.push("import");
+ break;
+ case "DoExpression":
+ parts.push("do");
+ break;
+ case "YieldExpression":
+ parts.push("yield");
+ gatherNodeParts(node.argument, parts);
+ break;
+ case "AwaitExpression":
+ parts.push("await");
+ gatherNodeParts(node.argument, parts);
+ break;
+ case "AssignmentExpression":
+ gatherNodeParts(node.left, parts);
+ break;
+ case "VariableDeclarator":
+ gatherNodeParts(node.id, parts);
+ break;
+ case "FunctionExpression":
+ case "FunctionDeclaration":
+ case "ClassExpression":
+ case "ClassDeclaration":
+ gatherNodeParts(node.id, parts);
+ break;
+ case "PrivateName":
+ gatherNodeParts(node.id, parts);
+ break;
+ case "ParenthesizedExpression":
+ gatherNodeParts(node.expression, parts);
+ break;
+ case "UnaryExpression":
+ case "UpdateExpression":
+ gatherNodeParts(node.argument, parts);
+ break;
+ case "MetaProperty":
+ gatherNodeParts(node.meta, parts);
+ gatherNodeParts(node.property, parts);
+ break;
+ case "JSXElement":
+ gatherNodeParts(node.openingElement, parts);
+ break;
+ case "JSXOpeningElement":
+ gatherNodeParts(node.name, parts);
+ break;
+ case "JSXFragment":
+ gatherNodeParts(node.openingFragment, parts);
+ break;
+ case "JSXOpeningFragment":
+ parts.push("Fragment");
+ break;
+ case "JSXNamespacedName":
+ gatherNodeParts(node.namespace, parts);
+ gatherNodeParts(node.name, parts);
+ break;
}
- shouldParseArrow(params) {
- if (this.match(14)) {
- return params.every(expr => this.isAssignable(expr, true));
+}
+const collectorVisitor = {
+ ForStatement(path) {
+ const declar = path.get("init");
+ if (declar.isVar()) {
+ const {
+ scope
+ } = path;
+ const parentScope = scope.getFunctionParent() || scope.getProgramParent();
+ parentScope.registerBinding("var", declar);
}
- return super.shouldParseArrow(params);
- }
- shouldParseAsyncArrow() {
- return this.match(14) || super.shouldParseAsyncArrow();
- }
- canHaveLeadingDecorator() {
- return super.canHaveLeadingDecorator() || this.isAbstractClass();
- }
- jsxParseOpeningElementAfterName(node) {
- if (this.match(47) || this.match(51)) {
- const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
- if (typeArguments) {
- {
- node.typeParameters = typeArguments;
- }
- }
+ },
+ Declaration(path) {
+ if (path.isBlockScoped()) return;
+ if (path.isImportDeclaration()) return;
+ if (path.isExportDeclaration()) return;
+ const parent = path.scope.getFunctionParent() || path.scope.getProgramParent();
+ parent.registerDeclaration(path);
+ },
+ ImportDeclaration(path) {
+ const parent = path.scope.getBlockParent();
+ parent.registerDeclaration(path);
+ },
+ ReferencedIdentifier(path, state) {
+ state.references.push(path);
+ },
+ ForXStatement(path, state) {
+ const left = path.get("left");
+ if (left.isPattern() || left.isIdentifier()) {
+ state.constantViolations.push(path);
+ } else if (left.isVar()) {
+ const {
+ scope
+ } = path;
+ const parentScope = scope.getFunctionParent() || scope.getProgramParent();
+ parentScope.registerBinding("var", left);
}
- return super.jsxParseOpeningElementAfterName(node);
- }
- getGetterSetterExpectedParamCount(method) {
- const baseCount = super.getGetterSetterExpectedParamCount(method);
- const params = this.getObjectOrClassMethodParams(method);
- const firstParam = params[0];
- const hasContextParam = firstParam && this.isThisParam(firstParam);
- return hasContextParam ? baseCount + 1 : baseCount;
- }
- parseCatchClauseParam() {
- const param = super.parseCatchClauseParam();
- const type = this.tsTryParseTypeAnnotation();
- if (type) {
- param.typeAnnotation = type;
- this.resetEndLocation(param);
- }
- return param;
- }
- tsInAmbientContext(cb) {
- const {
- isAmbientContext: oldIsAmbientContext,
- strict: oldStrict
- } = this.state;
- this.state.isAmbientContext = true;
- this.state.strict = false;
- try {
- return cb();
- } finally {
- this.state.isAmbientContext = oldIsAmbientContext;
- this.state.strict = oldStrict;
- }
- }
- parseClass(node, isStatement, optionalId) {
- const oldInAbstractClass = this.state.inAbstractClass;
- this.state.inAbstractClass = !!node.abstract;
- try {
- return super.parseClass(node, isStatement, optionalId);
- } finally {
- this.state.inAbstractClass = oldInAbstractClass;
- }
- }
- tsParseAbstractDeclaration(node, decorators) {
- if (this.match(80)) {
- node.abstract = true;
- return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
- } else if (this.isContextual(129)) {
- if (!this.hasFollowingLineBreak()) {
- node.abstract = true;
- this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
- return this.tsParseInterfaceDeclaration(node);
- }
- } else {
- this.unexpected(null, 80);
- }
- }
- parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
- const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
- if (method.abstract) {
- const hasEstreePlugin = this.hasPlugin("estree");
- const methodFn = hasEstreePlugin ? method.value : method;
- if (methodFn.body) {
- const {
- key
- } = method;
- this.raise(TSErrors.AbstractMethodHasImplementation, method, {
- methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
- });
- }
- }
- return method;
- }
- tsParseTypeParameterName() {
- const typeName = this.parseIdentifier();
- return typeName.name;
- }
- shouldParseAsAmbientContext() {
- return !!this.getPluginOption("typescript", "dts");
- }
- parse() {
- if (this.shouldParseAsAmbientContext()) {
- this.state.isAmbientContext = true;
- }
- return super.parse();
- }
- getExpression() {
- if (this.shouldParseAsAmbientContext()) {
- this.state.isAmbientContext = true;
- }
- return super.getExpression();
- }
- parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
- if (!isString && isMaybeTypeOnly) {
- this.parseTypeOnlyImportExportSpecifier(node, false, isInTypeExport);
- return this.finishNode(node, "ExportSpecifier");
- }
- node.exportKind = "value";
- return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
- }
- parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
- if (!importedIsString && isMaybeTypeOnly) {
- this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
- return this.finishNode(specifier, "ImportSpecifier");
- }
- specifier.importKind = "value";
- return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, isInTypeOnlyImport ? 4098 : 4096);
- }
- parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) {
- const leftOfAsKey = isImport ? "imported" : "local";
- const rightOfAsKey = isImport ? "local" : "exported";
- let leftOfAs = node[leftOfAsKey];
- let rightOfAs;
- let hasTypeSpecifier = false;
- let canParseAsKeyword = true;
- const loc = leftOfAs.loc.start;
- if (this.isContextual(93)) {
- const firstAs = this.parseIdentifier();
- if (this.isContextual(93)) {
- const secondAs = this.parseIdentifier();
- if (tokenIsKeywordOrIdentifier(this.state.type)) {
- hasTypeSpecifier = true;
- leftOfAs = firstAs;
- rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
- canParseAsKeyword = false;
- } else {
- rightOfAs = secondAs;
- canParseAsKeyword = false;
- }
- } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
- canParseAsKeyword = false;
- rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
- } else {
- hasTypeSpecifier = true;
- leftOfAs = firstAs;
- }
- } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
- hasTypeSpecifier = true;
- if (isImport) {
- leftOfAs = this.parseIdentifier(true);
- if (!this.isContextual(93)) {
- this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
+ },
+ ExportDeclaration: {
+ exit(path) {
+ const {
+ node,
+ scope
+ } = path;
+ if (isExportAllDeclaration(node)) return;
+ const declar = node.declaration;
+ if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) {
+ const id = declar.id;
+ if (!id) return;
+ const binding = scope.getBinding(id.name);
+ binding == null ? void 0 : binding.reference(path);
+ } else if (isVariableDeclaration(declar)) {
+ for (const decl of declar.declarations) {
+ for (const name of Object.keys(getBindingIdentifiers(decl))) {
+ const binding = scope.getBinding(name);
+ binding == null ? void 0 : binding.reference(path);
+ }
}
- } else {
- leftOfAs = this.parseModuleExportName();
}
}
- if (hasTypeSpecifier && isInTypeOnlyImportExport) {
- this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
- }
- node[leftOfAsKey] = leftOfAs;
- node[rightOfAsKey] = rightOfAs;
- const kindKey = isImport ? "importKind" : "exportKind";
- node[kindKey] = hasTypeSpecifier ? "type" : "value";
- if (canParseAsKeyword && this.eatContextual(93)) {
- node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
+ },
+ LabeledStatement(path) {
+ path.scope.getBlockParent().registerDeclaration(path);
+ },
+ AssignmentExpression(path, state) {
+ state.assignments.push(path);
+ },
+ UpdateExpression(path, state) {
+ state.constantViolations.push(path);
+ },
+ UnaryExpression(path, state) {
+ if (path.node.operator === "delete") {
+ state.constantViolations.push(path);
}
- if (!node[rightOfAsKey]) {
- node[rightOfAsKey] = cloneIdentifier(node[leftOfAsKey]);
+ },
+ BlockScoped(path) {
+ let scope = path.scope;
+ if (scope.path === path) scope = scope.parent;
+ const parent = scope.getBlockParent();
+ parent.registerDeclaration(path);
+ if (path.isClassDeclaration() && path.node.id) {
+ const id = path.node.id;
+ const name = id.name;
+ path.scope.bindings[name] = path.scope.parent.getBinding(name);
}
- if (isImport) {
- this.checkIdentifier(node[rightOfAsKey], hasTypeSpecifier ? 4098 : 4096);
+ },
+ CatchClause(path) {
+ path.scope.registerBinding("let", path);
+ },
+ Function(path) {
+ const params = path.get("params");
+ for (const param of params) {
+ path.scope.registerBinding("param", param);
}
- }
-};
-function isPossiblyLiteralEnum(expression) {
- if (expression.type !== "MemberExpression") return false;
- const {
- computed,
- property
- } = expression;
- if (computed && property.type !== "StringLiteral" && (property.type !== "TemplateLiteral" || property.expressions.length > 0)) {
- return false;
- }
- return isUncomputedMemberExpressionChain(expression.object);
-}
-function isValidAmbientConstInitializer(expression, estree) {
- var _expression$extra;
- const {
- type
- } = expression;
- if ((_expression$extra = expression.extra) != null && _expression$extra.parenthesized) {
- return false;
- }
- if (estree) {
- if (type === "Literal") {
- const {
- value
- } = expression;
- if (typeof value === "string" || typeof value === "boolean") {
- return true;
- }
+ if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
+ path.scope.registerBinding("local", path.get("id"), path);
}
- } else {
- if (type === "StringLiteral" || type === "BooleanLiteral") {
- return true;
+ },
+ ClassExpression(path) {
+ if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
+ path.scope.registerBinding("local", path);
}
}
- if (isNumber(expression, estree) || isNegativeNumber(expression, estree)) {
- return true;
- }
- if (type === "TemplateLiteral" && expression.expressions.length === 0) {
- return true;
- }
- if (isPossiblyLiteralEnum(expression)) {
- return true;
- }
- return false;
-}
-function isNumber(expression, estree) {
- if (estree) {
- return expression.type === "Literal" && (typeof expression.value === "number" || "bigint" in expression);
- }
- return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral";
-}
-function isNegativeNumber(expression, estree) {
- if (expression.type === "UnaryExpression") {
+};
+let uid = 0;
+class Scope {
+ constructor(path) {
+ this.uid = void 0;
+ this.path = void 0;
+ this.block = void 0;
+ this.labels = void 0;
+ this.inited = void 0;
+ this.bindings = void 0;
+ this.references = void 0;
+ this.globals = void 0;
+ this.uids = void 0;
+ this.data = void 0;
+ this.crawling = void 0;
const {
- operator,
- argument
- } = expression;
- if (operator === "-" && isNumber(argument, estree)) {
- return true;
+ node
+ } = path;
+ const cached = _cache.scope.get(node);
+ if ((cached == null ? void 0 : cached.path) === path) {
+ return cached;
}
+ _cache.scope.set(node, this);
+ this.uid = uid++;
+ this.block = node;
+ this.path = path;
+ this.labels = new Map();
+ this.inited = false;
}
- return false;
-}
-function isUncomputedMemberExpressionChain(expression) {
- if (expression.type === "Identifier") return true;
- if (expression.type !== "MemberExpression" || expression.computed) {
- return false;
+ get parent() {
+ var _parent;
+ let parent,
+ path = this.path;
+ do {
+ const shouldSkip = path.key === "key" || path.listKey === "decorators";
+ path = path.parentPath;
+ if (shouldSkip && path.isMethod()) path = path.parentPath;
+ if (path && path.isScope()) parent = path;
+ } while (path && !parent);
+ return (_parent = parent) == null ? void 0 : _parent.scope;
}
- return isUncomputedMemberExpressionChain(expression.object);
-}
-const PlaceholderErrors = ParseErrorEnum`placeholders`({
- ClassNameIsRequired: "A class name is required.",
- UnexpectedSpace: "Unexpected space in placeholder."
-});
-var placeholders = superClass => class PlaceholdersParserMixin extends superClass {
- parsePlaceholder(expectedNode) {
- if (this.match(133)) {
- const node = this.startNode();
- this.next();
- this.assertNoSpace();
- node.name = super.parseIdentifier(true);
- this.assertNoSpace();
- this.expect(133);
- return this.finishPlaceholder(node, expectedNode);
- }
+ get parentBlock() {
+ return this.path.parent;
}
- finishPlaceholder(node, expectedNode) {
- let placeholder = node;
- if (!placeholder.expectedNode || !placeholder.type) {
- placeholder = this.finishNode(placeholder, "Placeholder");
- }
- placeholder.expectedNode = expectedNode;
- return placeholder;
+ get hub() {
+ return this.path.hub;
}
- getTokenFromCode(code) {
- if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
- this.finishOp(133, 2);
- } else {
- super.getTokenFromCode(code);
- }
+ traverse(node, opts, state) {
+ (0, _index.default)(node, opts, this, state, this.path);
}
- parseExprAtom(refExpressionErrors) {
- return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors);
+ generateDeclaredUidIdentifier(name) {
+ const id = this.generateUidIdentifier(name);
+ this.push({
+ id
+ });
+ return cloneNode(id);
}
- parseIdentifier(liberal) {
- return this.parsePlaceholder("Identifier") || super.parseIdentifier(liberal);
+ generateUidIdentifier(name) {
+ return identifier(this.generateUid(name));
}
- checkReservedWord(word, startLoc, checkKeywords, isBinding) {
- if (word !== undefined) {
- super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
- }
+ generateUid(name = "temp") {
+ name = toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
+ let uid;
+ let i = 1;
+ do {
+ uid = this._generateUid(name, i);
+ i++;
+ } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
+ const program = this.getProgramParent();
+ program.references[uid] = true;
+ program.uids[uid] = true;
+ return uid;
}
- parseBindingAtom() {
- return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
+ _generateUid(name, i) {
+ let id = name;
+ if (i > 1) id += i;
+ return `_${id}`;
}
- isValidLVal(type, isParenthesized, binding) {
- return type === "Placeholder" || super.isValidLVal(type, isParenthesized, binding);
+ generateUidBasedOnNode(node, defaultName) {
+ const parts = [];
+ gatherNodeParts(node, parts);
+ let id = parts.join("$");
+ id = id.replace(/^_/, "") || defaultName || "ref";
+ return this.generateUid(id.slice(0, 20));
}
- toAssignable(node, isLHS) {
- if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
- node.expectedNode = "Pattern";
- } else {
- super.toAssignable(node, isLHS);
- }
+ generateUidIdentifierBasedOnNode(node, defaultName) {
+ return identifier(this.generateUidBasedOnNode(node, defaultName));
}
- chStartsBindingIdentifier(ch, pos) {
- if (super.chStartsBindingIdentifier(ch, pos)) {
+ isStatic(node) {
+ if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) {
return true;
}
- const nextToken = this.lookahead();
- if (nextToken.type === 133) {
- return true;
+ if (isIdentifier(node)) {
+ const binding = this.getBinding(node.name);
+ if (binding) {
+ return binding.constant;
+ } else {
+ return this.hasBinding(node.name);
+ }
}
return false;
}
- verifyBreakContinue(node, isBreak) {
- if (node.label && node.label.type === "Placeholder") return;
- super.verifyBreakContinue(node, isBreak);
- }
- parseExpressionStatement(node, expr) {
- var _expr$extra;
- if (expr.type !== "Placeholder" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
- return super.parseExpressionStatement(node, expr);
- }
- if (this.match(14)) {
- const stmt = node;
- stmt.label = this.finishPlaceholder(expr, "Identifier");
- this.next();
- stmt.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration();
- return this.finishNode(stmt, "LabeledStatement");
- }
- this.semicolon();
- const stmtPlaceholder = node;
- stmtPlaceholder.name = expr.name;
- return this.finishPlaceholder(stmtPlaceholder, "Statement");
- }
- parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
- return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
- }
- parseFunctionId(requireId) {
- return this.parsePlaceholder("Identifier") || super.parseFunctionId(requireId);
- }
- parseClass(node, isStatement, optionalId) {
- const type = isStatement ? "ClassDeclaration" : "ClassExpression";
- this.next();
- const oldStrict = this.state.strict;
- const placeholder = this.parsePlaceholder("Identifier");
- if (placeholder) {
- if (this.match(81) || this.match(133) || this.match(5)) {
- node.id = placeholder;
- } else if (optionalId || !isStatement) {
- node.id = null;
- node.body = this.finishPlaceholder(placeholder, "ClassBody");
- return this.finishNode(node, type);
- } else {
- throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
- }
+ maybeGenerateMemoised(node, dontPush) {
+ if (this.isStatic(node)) {
+ return null;
} else {
- this.parseClassId(node, isStatement, optionalId);
- }
- super.parseClassSuper(node);
- node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict);
- return this.finishNode(node, type);
- }
- parseExport(node, decorators) {
- const placeholder = this.parsePlaceholder("Identifier");
- if (!placeholder) return super.parseExport(node, decorators);
- const node2 = node;
- if (!this.isContextual(98) && !this.match(12)) {
- node2.specifiers = [];
- node2.source = null;
- node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
- return this.finishNode(node2, "ExportNamedDeclaration");
- }
- this.expectPlugin("exportDefaultFrom");
- const specifier = this.startNode();
- specifier.exported = placeholder;
- node2.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
- return super.parseExport(node2, decorators);
- }
- isExportDefaultSpecifier() {
- if (this.match(65)) {
- const next = this.nextTokenStart();
- if (this.isUnparsedContextual(next, "from")) {
- if (this.input.startsWith(tokenLabelName(133), this.nextTokenStartSince(next + 4))) {
- return true;
- }
+ const id = this.generateUidIdentifierBasedOnNode(node);
+ if (!dontPush) {
+ this.push({
+ id
+ });
+ return cloneNode(id);
}
+ return id;
}
- return super.isExportDefaultSpecifier();
- }
- maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
- var _specifiers;
- if ((_specifiers = node.specifiers) != null && _specifiers.length) {
- return true;
- }
- return super.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
- }
- checkExport(node) {
- const {
- specifiers
- } = node;
- if (specifiers != null && specifiers.length) {
- node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
- }
- super.checkExport(node);
- node.specifiers = specifiers;
- }
- parseImport(node) {
- const placeholder = this.parsePlaceholder("Identifier");
- if (!placeholder) return super.parseImport(node);
- node.specifiers = [];
- if (!this.isContextual(98) && !this.match(12)) {
- node.source = this.finishPlaceholder(placeholder, "StringLiteral");
- this.semicolon();
- return this.finishNode(node, "ImportDeclaration");
- }
- const specifier = this.startNodeAtNode(placeholder);
- specifier.local = placeholder;
- node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
- if (this.eat(12)) {
- const hasStarImport = this.maybeParseStarImportSpecifier(node);
- if (!hasStarImport) this.parseNamedImportSpecifiers(node);
- }
- this.expectContextual(98);
- node.source = this.parseImportSource();
- this.semicolon();
- return this.finishNode(node, "ImportDeclaration");
}
- parseImportSource() {
- return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
- }
- assertNoSpace() {
- if (this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index)) {
- this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
+ checkBlockScopedCollisions(local, kind, name, id) {
+ if (kind === "param") return;
+ if (local.kind === "local") return;
+ const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const";
+ if (duplicate) {
+ throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);
}
}
-};
-var v8intrinsic = superClass => class V8IntrinsicMixin extends superClass {
- parseV8Intrinsic() {
- if (this.match(54)) {
- const v8IntrinsicStartLoc = this.state.startLoc;
- const node = this.startNode();
- this.next();
- if (tokenIsIdentifier(this.state.type)) {
- const name = this.parseIdentifierName();
- const identifier = this.createIdentifier(node, name);
- identifier.type = "V8IntrinsicIdentifier";
- if (this.match(10)) {
- return identifier;
- }
+ rename(oldName, newName) {
+ const binding = this.getBinding(oldName);
+ if (binding) {
+ newName || (newName = this.generateUidIdentifier(oldName).name);
+ const renamer = new _renamer.default(binding, oldName, newName);
+ {
+ renamer.rename(arguments[2]);
}
- this.unexpected(v8IntrinsicStartLoc);
}
}
- parseExprAtom(refExpressionErrors) {
- return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
- }
-};
-const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
-const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
-function validatePlugins(pluginsMap) {
- if (pluginsMap.has("decorators")) {
- if (pluginsMap.has("decorators-legacy")) {
- throw new Error("Cannot use the decorators and decorators-legacy plugin together");
- }
- const decoratorsBeforeExport = pluginsMap.get("decorators").decoratorsBeforeExport;
- if (decoratorsBeforeExport != null && typeof decoratorsBeforeExport !== "boolean") {
- throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");
- }
- const allowCallParenthesized = pluginsMap.get("decorators").allowCallParenthesized;
- if (allowCallParenthesized != null && typeof allowCallParenthesized !== "boolean") {
- throw new Error("'allowCallParenthesized' must be a boolean.");
+ _renameFromMap(map, oldName, newName, value) {
+ if (map[oldName]) {
+ map[newName] = value;
+ map[oldName] = null;
}
}
- if (pluginsMap.has("flow") && pluginsMap.has("typescript")) {
- throw new Error("Cannot combine flow and typescript plugins.");
- }
- if (pluginsMap.has("placeholders") && pluginsMap.has("v8intrinsic")) {
- throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
- }
- if (pluginsMap.has("pipelineOperator")) {
- var _pluginsMap$get;
- const proposal = pluginsMap.get("pipelineOperator").proposal;
- if (!PIPELINE_PROPOSALS.includes(proposal)) {
- const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
- throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
- }
- const tupleSyntaxIsHash = ((_pluginsMap$get = pluginsMap.get("recordAndTuple")) == null ? void 0 : _pluginsMap$get.syntaxType) === "hash";
- if (proposal === "hack") {
- if (pluginsMap.has("placeholders")) {
- throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
- }
- if (pluginsMap.has("v8intrinsic")) {
- throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");
- }
- const topicToken = pluginsMap.get("pipelineOperator").topicToken;
- if (!TOPIC_TOKENS.includes(topicToken)) {
- const tokenList = TOPIC_TOKENS.map(t => `"${t}"`).join(", ");
- throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
- }
- if (topicToken === "#" && tupleSyntaxIsHash) {
- throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
+ dump() {
+ const sep = "-".repeat(60);
+ console.log(sep);
+ let scope = this;
+ do {
+ console.log("#", scope.block.type);
+ for (const name of Object.keys(scope.bindings)) {
+ const binding = scope.bindings[name];
+ console.log(" -", name, {
+ constant: binding.constant,
+ references: binding.references,
+ violations: binding.constantViolations.length,
+ kind: binding.kind
+ });
}
- } else if (proposal === "smart" && tupleSyntaxIsHash) {
- throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
- }
+ } while (scope = scope.parent);
+ console.log(sep);
}
- if (pluginsMap.has("moduleAttributes")) {
- {
- if (pluginsMap.has("deprecatedImportAssert") || pluginsMap.has("importAssertions")) {
- throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");
- }
- const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
- if (moduleAttributesVersionPluginOption !== "may-2020") {
- throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
+ toArray(node, i, arrayLikeIsIterable) {
+ if (isIdentifier(node)) {
+ const binding = this.getBinding(node.name);
+ if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
+ return node;
}
}
- }
- if (pluginsMap.has("importAssertions")) {
- if (pluginsMap.has("deprecatedImportAssert")) {
- throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");
+ if (isArrayExpression(node)) {
+ return node;
}
- }
- if (!pluginsMap.has("deprecatedImportAssert") && pluginsMap.has("importAttributes") && pluginsMap.get("importAttributes").deprecatedAssertSyntax) {
- {
- pluginsMap.set("deprecatedImportAssert", {});
+ if (isIdentifier(node, {
+ name: "arguments"
+ })) {
+ return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
}
- }
- if (pluginsMap.has("recordAndTuple")) {
- const syntaxType = pluginsMap.get("recordAndTuple").syntaxType;
- if (syntaxType != null) {
- {
- const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
- if (!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)) {
- throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
- }
- }
+ let helperName;
+ const args = [node];
+ if (i === true) {
+ helperName = "toConsumableArray";
+ } else if (typeof i === "number") {
+ args.push(numericLiteral(i));
+ helperName = "slicedToArray";
+ } else {
+ helperName = "toArray";
}
- }
- if (pluginsMap.has("asyncDoExpressions") && !pluginsMap.has("doExpressions")) {
- const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
- error.missingPlugins = "doExpressions";
- throw error;
- }
- if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07") {
- throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is '2023-07'.");
- }
-}
-const mixinPlugins = {
- estree,
- jsx,
- flow,
- typescript,
- v8intrinsic,
- placeholders
-};
-const mixinPluginNames = Object.keys(mixinPlugins);
-class ExpressionParser extends LValParser {
- checkProto(prop, isRecord, sawProto, refExpressionErrors) {
- if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
- return sawProto;
- }
- const key = prop.key;
- const name = key.type === "Identifier" ? key.name : key.value;
- if (name === "__proto__") {
- if (isRecord) {
- this.raise(Errors.RecordNoProto, key);
- return true;
- }
- if (sawProto) {
- if (refExpressionErrors) {
- if (refExpressionErrors.doubleProtoLoc === null) {
- refExpressionErrors.doubleProtoLoc = key.loc.start;
- }
- } else {
- this.raise(Errors.DuplicateProto, key);
- }
- }
- return true;
+ if (arrayLikeIsIterable) {
+ args.unshift(this.hub.addHelper(helperName));
+ helperName = "maybeArrayLike";
}
- return sawProto;
+ return callExpression(this.hub.addHelper(helperName), args);
}
- shouldExitDescending(expr, potentialArrowAt) {
- return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
+ hasLabel(name) {
+ return !!this.getLabel(name);
}
- getExpression() {
- this.enterInitialScopes();
- this.nextToken();
- const expr = this.parseExpression();
- if (!this.match(140)) {
- this.unexpected();
- }
- this.finalizeRemainingComments();
- expr.comments = this.comments;
- expr.errors = this.state.errors;
- if (this.optionFlags & 256) {
- expr.tokens = this.tokens;
- }
- return expr;
+ getLabel(name) {
+ return this.labels.get(name);
}
- parseExpression(disallowIn, refExpressionErrors) {
- if (disallowIn) {
- return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors));
- }
- return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors));
+ registerLabel(path) {
+ this.labels.set(path.node.label.name, path);
}
- parseExpressionBase(refExpressionErrors) {
- const startLoc = this.state.startLoc;
- const expr = this.parseMaybeAssign(refExpressionErrors);
- if (this.match(12)) {
- const node = this.startNodeAt(startLoc);
- node.expressions = [expr];
- while (this.eat(12)) {
- node.expressions.push(this.parseMaybeAssign(refExpressionErrors));
+ registerDeclaration(path) {
+ if (path.isLabeledStatement()) {
+ this.registerLabel(path);
+ } else if (path.isFunctionDeclaration()) {
+ this.registerBinding("hoisted", path.get("id"), path);
+ } else if (path.isVariableDeclaration()) {
+ const declarations = path.get("declarations");
+ const {
+ kind
+ } = path.node;
+ for (const declar of declarations) {
+ this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar);
}
- this.toReferencedList(node.expressions);
- return this.finishNode(node, "SequenceExpression");
- }
- return expr;
- }
- parseMaybeAssignDisallowIn(refExpressionErrors, afterLeftParse) {
- return this.disallowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
- }
- parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
- return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
- }
- setOptionalParametersError(refExpressionErrors) {
- refExpressionErrors.optionalParametersLoc = this.state.startLoc;
- }
- parseMaybeAssign(refExpressionErrors, afterLeftParse) {
- const startLoc = this.state.startLoc;
- const isYield = this.isContextual(108);
- if (isYield) {
- if (this.prodParam.hasYield) {
- this.next();
- let left = this.parseYield(startLoc);
- if (afterLeftParse) {
- left = afterLeftParse.call(this, left, startLoc);
- }
- return left;
+ } else if (path.isClassDeclaration()) {
+ if (path.node.declare) return;
+ this.registerBinding("let", path);
+ } else if (path.isImportDeclaration()) {
+ const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof";
+ const specifiers = path.get("specifiers");
+ for (const specifier of specifiers) {
+ const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof");
+ this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
+ }
+ } else if (path.isExportDeclaration()) {
+ const declar = path.get("declaration");
+ if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) {
+ this.registerDeclaration(declar);
}
- }
- let ownExpressionErrors;
- if (refExpressionErrors) {
- ownExpressionErrors = false;
} else {
- refExpressionErrors = new ExpressionErrors();
- ownExpressionErrors = true;
+ this.registerBinding("unknown", path);
}
- const {
- type
- } = this.state;
- if (type === 10 || tokenIsIdentifier(type)) {
- this.state.potentialArrowAt = this.state.start;
- }
- let left = this.parseMaybeConditional(refExpressionErrors);
- if (afterLeftParse) {
- left = afterLeftParse.call(this, left, startLoc);
- }
- if (tokenIsAssignment(this.state.type)) {
- const node = this.startNodeAt(startLoc);
- const operator = this.state.value;
- node.operator = operator;
- if (this.match(29)) {
- this.toAssignable(left, true);
- node.left = left;
- const startIndex = startLoc.index;
- if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startIndex) {
- refExpressionErrors.doubleProtoLoc = null;
- }
- if (refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startIndex) {
- refExpressionErrors.shorthandAssignLoc = null;
- }
- if (refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startIndex) {
- this.checkDestructuringPrivate(refExpressionErrors);
- refExpressionErrors.privateKeyLoc = null;
- }
- } else {
- node.left = left;
- }
- this.next();
- node.right = this.parseMaybeAssign();
- this.checkLVal(left, this.finishNode(node, "AssignmentExpression"));
- return node;
- } else if (ownExpressionErrors) {
- this.checkExpressionErrors(refExpressionErrors, true);
+ }
+ buildUndefinedNode() {
+ return buildUndefinedNode();
+ }
+ registerConstantViolation(path) {
+ const ids = path.getBindingIdentifiers();
+ for (const name of Object.keys(ids)) {
+ var _this$getBinding;
+ (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.reassign(path);
}
- if (isYield) {
- const {
- type
- } = this.state;
- const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
- if (startsExpr && !this.isAmbiguousPrefixOrIdentifier()) {
- this.raiseOverwrite(Errors.YieldNotInGeneratorFunction, startLoc);
- return this.parseYield(startLoc);
- }
- }
- return left;
- }
- parseMaybeConditional(refExpressionErrors) {
- const startLoc = this.state.startLoc;
- const potentialArrowAt = this.state.potentialArrowAt;
- const expr = this.parseExprOps(refExpressionErrors);
- if (this.shouldExitDescending(expr, potentialArrowAt)) {
- return expr;
- }
- return this.parseConditional(expr, startLoc, refExpressionErrors);
- }
- parseConditional(expr, startLoc, refExpressionErrors) {
- if (this.eat(17)) {
- const node = this.startNodeAt(startLoc);
- node.test = expr;
- node.consequent = this.parseMaybeAssignAllowIn();
- this.expect(14);
- node.alternate = this.parseMaybeAssign();
- return this.finishNode(node, "ConditionalExpression");
- }
- return expr;
- }
- parseMaybeUnaryOrPrivate(refExpressionErrors) {
- return this.match(139) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
- }
- parseExprOps(refExpressionErrors) {
- const startLoc = this.state.startLoc;
- const potentialArrowAt = this.state.potentialArrowAt;
- const expr = this.parseMaybeUnaryOrPrivate(refExpressionErrors);
- if (this.shouldExitDescending(expr, potentialArrowAt)) {
- return expr;
- }
- return this.parseExprOp(expr, startLoc, -1);
- }
- parseExprOp(left, leftStartLoc, minPrec) {
- if (this.isPrivateName(left)) {
- const value = this.getPrivateNameSV(left);
- if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
- this.raise(Errors.PrivateInExpectedIn, left, {
- identifierName: value
- });
+ }
+ registerBinding(kind, path, bindingPath = path) {
+ if (!kind) throw new ReferenceError("no `kind`");
+ if (path.isVariableDeclaration()) {
+ const declarators = path.get("declarations");
+ for (const declar of declarators) {
+ this.registerBinding(kind, declar);
}
- this.classScope.usePrivateName(value, left.loc.start);
+ return;
}
- const op = this.state.type;
- if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(58))) {
- let prec = tokenOperatorPrecedence(op);
- if (prec > minPrec) {
- if (op === 39) {
- this.expectPlugin("pipelineOperator");
- if (this.state.inFSharpPipelineDirectBody) {
- return left;
- }
- this.checkPipelineAtInfixOperator(left, leftStartLoc);
- }
- const node = this.startNodeAt(leftStartLoc);
- node.left = left;
- node.operator = this.state.value;
- const logical = op === 41 || op === 42;
- const coalesce = op === 40;
- if (coalesce) {
- prec = tokenOperatorPrecedence(42);
- }
- this.next();
- if (op === 39 && this.hasPlugin(["pipelineOperator", {
- proposal: "minimal"
- }])) {
- if (this.state.type === 96 && this.prodParam.hasAwait) {
- throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
- }
+ const parent = this.getProgramParent();
+ const ids = path.getOuterBindingIdentifiers(true);
+ for (const name of Object.keys(ids)) {
+ parent.references[name] = true;
+ for (const id of ids[name]) {
+ const local = this.getOwnBinding(name);
+ if (local) {
+ if (local.identifier === id) continue;
+ this.checkBlockScopedCollisions(local, kind, name, id);
}
- node.right = this.parseExprOpRightExpr(op, prec);
- const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
- const nextOp = this.state.type;
- if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
- throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
+ if (local) {
+ this.registerConstantViolation(bindingPath);
+ } else {
+ this.bindings[name] = new _binding.default({
+ identifier: id,
+ scope: this,
+ path: bindingPath,
+ kind: kind
+ });
}
- return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
}
}
- return left;
}
- parseExprOpRightExpr(op, prec) {
- const startLoc = this.state.startLoc;
- switch (op) {
- case 39:
- switch (this.getPluginOption("pipelineOperator", "proposal")) {
- case "hack":
- return this.withTopicBindingContext(() => {
- return this.parseHackPipeBody();
- });
- case "fsharp":
- return this.withSoloAwaitPermittingContext(() => {
- return this.parseFSharpPipelineBody(prec);
- });
- }
- if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
- return this.withTopicBindingContext(() => {
- if (this.prodParam.hasYield && this.isContextual(108)) {
- throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
- }
- return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
- });
- }
- default:
- return this.parseExprOpBaseRightExpr(op, prec);
- }
+ addGlobal(node) {
+ this.globals[node.name] = node;
+ }
+ hasUid(name) {
+ let scope = this;
+ do {
+ if (scope.uids[name]) return true;
+ } while (scope = scope.parent);
+ return false;
}
- parseExprOpBaseRightExpr(op, prec) {
- const startLoc = this.state.startLoc;
- return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec);
+ hasGlobal(name) {
+ let scope = this;
+ do {
+ if (scope.globals[name]) return true;
+ } while (scope = scope.parent);
+ return false;
}
- parseHackPipeBody() {
- var _body$extra;
- const {
- startLoc
- } = this.state;
- const body = this.parseMaybeAssign();
- const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
- if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
- this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
- type: body.type
- });
- }
- if (!this.topicReferenceWasUsedInCurrentContext()) {
- this.raise(Errors.PipeTopicUnused, startLoc);
- }
- return body;
+ hasReference(name) {
+ return !!this.getProgramParent().references[name];
}
- checkExponentialAfterUnary(node) {
- if (this.match(57)) {
- this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
- }
- }
- parseMaybeUnary(refExpressionErrors, sawUnary) {
- const startLoc = this.state.startLoc;
- const isAwait = this.isContextual(96);
- if (isAwait && this.recordAwaitIfAllowed()) {
- this.next();
- const expr = this.parseAwait(startLoc);
- if (!sawUnary) this.checkExponentialAfterUnary(expr);
- return expr;
- }
- const update = this.match(34);
- const node = this.startNode();
- if (tokenIsPrefix(this.state.type)) {
- node.operator = this.state.value;
- node.prefix = true;
- if (this.match(72)) {
- this.expectPlugin("throwExpressions");
- }
- const isDelete = this.match(89);
- this.next();
- node.argument = this.parseMaybeUnary(null, true);
- this.checkExpressionErrors(refExpressionErrors, true);
- if (this.state.strict && isDelete) {
- const arg = node.argument;
- if (arg.type === "Identifier") {
- this.raise(Errors.StrictDelete, node);
- } else if (this.hasPropertyAsPrivateName(arg)) {
- this.raise(Errors.DeletePrivateField, node);
- }
+ isPure(node, constantsOnly) {
+ if (isIdentifier(node)) {
+ const binding = this.getBinding(node.name);
+ if (!binding) return false;
+ if (constantsOnly) return binding.constant;
+ return true;
+ } else if (isThisExpression(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName(node)) {
+ return true;
+ } else if (isClass(node)) {
+ var _node$decorators;
+ if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
+ return false;
}
- if (!update) {
- if (!sawUnary) {
- this.checkExponentialAfterUnary(node);
- }
- return this.finishNode(node, "UnaryExpression");
+ if (((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0) {
+ return false;
}
- }
- const expr = this.parseUpdate(node, update, refExpressionErrors);
- if (isAwait) {
- const {
- type
- } = this.state;
- const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
- if (startsExpr && !this.isAmbiguousPrefixOrIdentifier()) {
- this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
- return this.parseAwait(startLoc);
+ return this.isPure(node.body, constantsOnly);
+ } else if (isClassBody(node)) {
+ for (const method of node.body) {
+ if (!this.isPure(method, constantsOnly)) return false;
}
- }
- return expr;
- }
- parseUpdate(node, update, refExpressionErrors) {
- if (update) {
- const updateExpressionNode = node;
- this.checkLVal(updateExpressionNode.argument, this.finishNode(updateExpressionNode, "UpdateExpression"));
- return node;
- }
- const startLoc = this.state.startLoc;
- let expr = this.parseExprSubscripts(refExpressionErrors);
- if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
- while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
- const node = this.startNodeAt(startLoc);
- node.operator = this.state.value;
- node.prefix = false;
- node.argument = expr;
- this.next();
- this.checkLVal(expr, expr = this.finishNode(node, "UpdateExpression"));
- }
- return expr;
- }
- parseExprSubscripts(refExpressionErrors) {
- const startLoc = this.state.startLoc;
- const potentialArrowAt = this.state.potentialArrowAt;
- const expr = this.parseExprAtom(refExpressionErrors);
- if (this.shouldExitDescending(expr, potentialArrowAt)) {
- return expr;
- }
- return this.parseSubscripts(expr, startLoc);
- }
- parseSubscripts(base, startLoc, noCalls) {
- const state = {
- optionalChainMember: false,
- maybeAsyncArrow: this.atPossibleAsyncArrow(base),
- stop: false
- };
- do {
- base = this.parseSubscript(base, startLoc, noCalls, state);
- state.maybeAsyncArrow = false;
- } while (!state.stop);
- return base;
- }
- parseSubscript(base, startLoc, noCalls, state) {
- const {
- type
- } = this.state;
- if (!noCalls && type === 15) {
- return this.parseBind(base, startLoc, noCalls, state);
- } else if (tokenIsTemplate(type)) {
- return this.parseTaggedTemplateExpression(base, startLoc, state);
- }
- let optional = false;
- if (type === 18) {
- if (noCalls) {
- this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
- if (this.lookaheadCharCode() === 40) {
- state.stop = true;
- return base;
- }
+ return true;
+ } else if (isBinary(node)) {
+ return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
+ } else if (isArrayExpression(node) || isTupleExpression(node)) {
+ for (const elem of node.elements) {
+ if (elem !== null && !this.isPure(elem, constantsOnly)) return false;
}
- state.optionalChainMember = optional = true;
- this.next();
- }
- if (!noCalls && this.match(10)) {
- return this.parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional);
- } else {
- const computed = this.eat(0);
- if (computed || optional || this.eat(16)) {
- return this.parseMember(base, startLoc, state, computed, optional);
- } else {
- state.stop = true;
- return base;
+ return true;
+ } else if (isObjectExpression(node) || isRecordExpression(node)) {
+ for (const prop of node.properties) {
+ if (!this.isPure(prop, constantsOnly)) return false;
}
- }
- }
- parseMember(base, startLoc, state, computed, optional) {
- const node = this.startNodeAt(startLoc);
- node.object = base;
- node.computed = computed;
- if (computed) {
- node.property = this.parseExpression();
- this.expect(3);
- } else if (this.match(139)) {
- if (base.type === "Super") {
- this.raise(Errors.SuperPrivateField, startLoc);
+ return true;
+ } else if (isMethod(node)) {
+ var _node$decorators2;
+ if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
+ if (((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0) {
+ return false;
}
- this.classScope.usePrivateName(this.state.value, this.state.startLoc);
- node.property = this.parsePrivateName();
- } else {
- node.property = this.parseIdentifier(true);
- }
- if (state.optionalChainMember) {
- node.optional = optional;
- return this.finishNode(node, "OptionalMemberExpression");
- } else {
- return this.finishNode(node, "MemberExpression");
- }
- }
- parseBind(base, startLoc, noCalls, state) {
- const node = this.startNodeAt(startLoc);
- node.object = base;
- this.next();
- node.callee = this.parseNoCallExpr();
- state.stop = true;
- return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, noCalls);
- }
- parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) {
- const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
- let refExpressionErrors = null;
- this.state.maybeInArrowParameters = true;
- this.next();
- const node = this.startNodeAt(startLoc);
- node.callee = base;
- const {
- maybeAsyncArrow,
- optionalChainMember
- } = state;
- if (maybeAsyncArrow) {
- this.expressionScope.enter(newAsyncArrowScope());
- refExpressionErrors = new ExpressionErrors();
- }
- if (optionalChainMember) {
- node.optional = optional;
- }
- if (optional) {
- node.arguments = this.parseCallExpressionArguments(11);
- } else {
- node.arguments = this.parseCallExpressionArguments(11, base.type !== "Super", node, refExpressionErrors);
- }
- let finishedNode = this.finishCallExpression(node, optionalChainMember);
- if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
- state.stop = true;
- this.checkDestructuringPrivate(refExpressionErrors);
- this.expressionScope.validateAsPattern();
- this.expressionScope.exit();
- finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startLoc), finishedNode);
- } else {
- if (maybeAsyncArrow) {
- this.checkExpressionErrors(refExpressionErrors, true);
- this.expressionScope.exit();
+ return true;
+ } else if (isProperty(node)) {
+ var _node$decorators3;
+ if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
+ if (((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0) {
+ return false;
}
- this.toReferencedArguments(finishedNode);
- }
- this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
- return finishedNode;
- }
- toReferencedArguments(node, isParenthesizedExpr) {
- this.toReferencedListDeep(node.arguments, isParenthesizedExpr);
- }
- parseTaggedTemplateExpression(base, startLoc, state) {
- const node = this.startNodeAt(startLoc);
- node.tag = base;
- node.quasi = this.parseTemplate(true);
- if (state.optionalChainMember) {
- this.raise(Errors.OptionalChainingNoTemplate, startLoc);
- }
- return this.finishNode(node, "TaggedTemplateExpression");
- }
- atPossibleAsyncArrow(base) {
- return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.offsetToSourcePos(base.start) === this.state.potentialArrowAt;
- }
- finishCallExpression(node, optional) {
- if (node.callee.type === "Import") {
- if (node.arguments.length === 0 || node.arguments.length > 2) {
- this.raise(Errors.ImportCallArity, node);
- } else {
- for (const arg of node.arguments) {
- if (arg.type === "SpreadElement") {
- this.raise(Errors.ImportCallSpreadArgument, arg);
- }
+ if (isObjectProperty(node) || node.static) {
+ if (node.value !== null && !this.isPure(node.value, constantsOnly)) {
+ return false;
}
}
- }
- return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
- }
- parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
- const elts = [];
- let first = true;
- const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
- this.state.inFSharpPipelineDirectBody = false;
- while (!this.eat(close)) {
- if (first) {
- first = false;
- } else {
- this.expect(12);
- if (this.match(close)) {
- if (nodeForExtra) {
- this.addTrailingCommaExtraToNode(nodeForExtra);
- }
- this.next();
- break;
- }
+ return true;
+ } else if (isUnaryExpression(node)) {
+ return this.isPure(node.argument, constantsOnly);
+ } else if (isTaggedTemplateExpression(node)) {
+ return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
+ } else if (isTemplateLiteral(node)) {
+ for (const expression of node.expressions) {
+ if (!this.isPure(expression, constantsOnly)) return false;
}
- elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder));
+ return true;
+ } else {
+ return isPureish(node);
}
- this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
- return elts;
}
- shouldParseAsyncArrow() {
- return this.match(19) && !this.canInsertSemicolon();
- }
- parseAsyncArrowFromCallExpression(node, call) {
- var _call$extra;
- this.resetPreviousNodeTrailingComments(call);
- this.expect(19);
- this.parseArrowExpression(node, call.arguments, true, (_call$extra = call.extra) == null ? void 0 : _call$extra.trailingCommaLoc);
- if (call.innerComments) {
- setInnerComments(node, call.innerComments);
- }
- if (call.callee.trailingComments) {
- setInnerComments(node, call.callee.trailingComments);
- }
- return node;
+ setData(key, val) {
+ return this.data[key] = val;
}
- parseNoCallExpr() {
- const startLoc = this.state.startLoc;
- return this.parseSubscripts(this.parseExprAtom(), startLoc, true);
+ getData(key) {
+ let scope = this;
+ do {
+ const data = scope.data[key];
+ if (data != null) return data;
+ } while (scope = scope.parent);
}
- parseExprAtom(refExpressionErrors) {
- let node;
- let decorators = null;
- const {
- type
- } = this.state;
- switch (type) {
- case 79:
- return this.parseSuper();
- case 83:
- node = this.startNode();
- this.next();
- if (this.match(16)) {
- return this.parseImportMetaProperty(node);
- }
- if (this.match(10)) {
- if (this.optionFlags & 512) {
- return this.parseImportCall(node);
- } else {
- return this.finishNode(node, "Import");
- }
- } else {
- this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
- return this.finishNode(node, "Import");
- }
- case 78:
- node = this.startNode();
- this.next();
- return this.finishNode(node, "ThisExpression");
- case 90:
- {
- return this.parseDo(this.startNode(), false);
- }
- case 56:
- case 31:
- {
- this.readRegexp();
- return this.parseRegExpLiteral(this.state.value);
- }
- case 135:
- return this.parseNumericLiteral(this.state.value);
- case 136:
- return this.parseBigIntLiteral(this.state.value);
- case 134:
- return this.parseStringLiteral(this.state.value);
- case 84:
- return this.parseNullLiteral();
- case 85:
- return this.parseBooleanLiteral(true);
- case 86:
- return this.parseBooleanLiteral(false);
- case 10:
- {
- const canBeArrow = this.state.potentialArrowAt === this.state.start;
- return this.parseParenAndDistinguishExpression(canBeArrow);
- }
- case 2:
- case 1:
- {
- return this.parseArrayLike(this.state.type === 2 ? 4 : 3, false, true);
- }
- case 0:
- {
- return this.parseArrayLike(3, true, false, refExpressionErrors);
- }
- case 6:
- case 7:
- {
- return this.parseObjectLike(this.state.type === 6 ? 9 : 8, false, true);
- }
- case 5:
- {
- return this.parseObjectLike(8, false, false, refExpressionErrors);
- }
- case 68:
- return this.parseFunctionOrFunctionSent();
- case 26:
- decorators = this.parseDecorators();
- case 80:
- return this.parseClass(this.maybeTakeDecorators(decorators, this.startNode()), false);
- case 77:
- return this.parseNewOrNewTarget();
- case 25:
- case 24:
- return this.parseTemplate(false);
- case 15:
- {
- node = this.startNode();
- this.next();
- node.object = null;
- const callee = node.callee = this.parseNoCallExpr();
- if (callee.type === "MemberExpression") {
- return this.finishNode(node, "BindExpression");
- } else {
- throw this.raise(Errors.UnsupportedBind, callee);
- }
- }
- case 139:
- {
- this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
- identifierName: this.state.value
- });
- return this.parsePrivateName();
- }
- case 33:
- {
- return this.parseTopicReferenceThenEqualsSign(54, "%");
- }
- case 32:
- {
- return this.parseTopicReferenceThenEqualsSign(44, "^");
- }
- case 37:
- case 38:
- {
- return this.parseTopicReference("hack");
- }
- case 44:
- case 54:
- case 27:
- {
- const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
- if (pipeProposal) {
- return this.parseTopicReference(pipeProposal);
- }
- this.unexpected();
- break;
- }
- case 47:
- {
- const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
- if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
- this.expectOnePlugin(["jsx", "flow", "typescript"]);
- } else {
- this.unexpected();
- }
- break;
- }
- default:
- if (type === 137) {
- return this.parseDecimalLiteral(this.state.value);
- }
- if (tokenIsIdentifier(type)) {
- if (this.isContextual(127) && this.lookaheadInLineCharCode() === 123) {
- return this.parseModuleExpression();
- }
- const canBeArrow = this.state.potentialArrowAt === this.state.start;
- const containsEsc = this.state.containsEsc;
- const id = this.parseIdentifier();
- if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) {
- const {
- type
- } = this.state;
- if (type === 68) {
- this.resetPreviousNodeTrailingComments(id);
- this.next();
- return this.parseAsyncFunctionExpression(this.startNodeAtNode(id));
- } else if (tokenIsIdentifier(type)) {
- if (this.lookaheadCharCode() === 61) {
- return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));
- } else {
- return id;
- }
- } else if (type === 90) {
- this.resetPreviousNodeTrailingComments(id);
- return this.parseDo(this.startNodeAtNode(id), true);
- }
- }
- if (canBeArrow && this.match(19) && !this.canInsertSemicolon()) {
- this.next();
- return this.parseArrowExpression(this.startNodeAtNode(id), [id], false);
- }
- return id;
- } else {
- this.unexpected();
- }
- }
+ removeData(key) {
+ let scope = this;
+ do {
+ const data = scope.data[key];
+ if (data != null) scope.data[key] = null;
+ } while (scope = scope.parent);
}
- parseTopicReferenceThenEqualsSign(topicTokenType, topicTokenValue) {
- const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
- if (pipeProposal) {
- this.state.type = topicTokenType;
- this.state.value = topicTokenValue;
- this.state.pos--;
- this.state.end--;
- this.state.endLoc = createPositionWithColumnOffset(this.state.endLoc, -1);
- return this.parseTopicReference(pipeProposal);
- } else {
- this.unexpected();
+ init() {
+ if (!this.inited) {
+ this.inited = true;
+ this.crawl();
}
}
- parseTopicReference(pipeProposal) {
- const node = this.startNode();
- const startLoc = this.state.startLoc;
- const tokenType = this.state.type;
- this.next();
- return this.finishTopicReference(node, startLoc, pipeProposal, tokenType);
- }
- finishTopicReference(node, startLoc, pipeProposal, tokenType) {
- if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
- if (pipeProposal === "hack") {
- if (!this.topicReferenceIsAllowedInCurrentContext()) {
- this.raise(Errors.PipeTopicUnbound, startLoc);
- }
- this.registerTopicReference();
- return this.finishNode(node, "TopicReference");
- } else {
- if (!this.topicReferenceIsAllowedInCurrentContext()) {
- this.raise(Errors.PrimaryTopicNotAllowed, startLoc);
- }
- this.registerTopicReference();
- return this.finishNode(node, "PipelinePrimaryTopicReference");
+ crawl() {
+ const path = this.path;
+ this.references = Object.create(null);
+ this.bindings = Object.create(null);
+ this.globals = Object.create(null);
+ this.uids = Object.create(null);
+ this.data = Object.create(null);
+ const programParent = this.getProgramParent();
+ if (programParent.crawling) return;
+ const state = {
+ references: [],
+ constantViolations: [],
+ assignments: []
+ };
+ this.crawling = true;
+ if (path.type !== "Program" && (0, _visitors.isExplodedVisitor)(collectorVisitor)) {
+ for (const visit of collectorVisitor.enter) {
+ visit.call(state, path, state);
}
- } else {
- throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
- token: tokenLabelName(tokenType)
- });
- }
- }
- testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
- switch (pipeProposal) {
- case "hack":
- {
- return this.hasPlugin(["pipelineOperator", {
- topicToken: tokenLabelName(tokenType)
- }]);
+ const typeVisitors = collectorVisitor[path.type];
+ if (typeVisitors) {
+ for (const visit of typeVisitors.enter) {
+ visit.call(state, path, state);
}
- case "smart":
- return tokenType === 27;
- default:
- throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
- }
- }
- parseAsyncArrowUnaryFunction(node) {
- this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
- const params = [this.parseIdentifier()];
- this.prodParam.exit();
- if (this.hasPrecedingLineBreak()) {
- this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
- }
- this.expect(19);
- return this.parseArrowExpression(node, params, true);
- }
- parseDo(node, isAsync) {
- this.expectPlugin("doExpressions");
- if (isAsync) {
- this.expectPlugin("asyncDoExpressions");
- }
- node.async = isAsync;
- this.next();
- const oldLabels = this.state.labels;
- this.state.labels = [];
- if (isAsync) {
- this.prodParam.enter(2);
- node.body = this.parseBlock();
- this.prodParam.exit();
- } else {
- node.body = this.parseBlock();
- }
- this.state.labels = oldLabels;
- return this.finishNode(node, "DoExpression");
- }
- parseSuper() {
- const node = this.startNode();
- this.next();
- if (this.match(10) && !this.scope.allowDirectSuper && !(this.optionFlags & 16)) {
- this.raise(Errors.SuperNotAllowed, node);
- } else if (!this.scope.allowSuper && !(this.optionFlags & 16)) {
- this.raise(Errors.UnexpectedSuper, node);
- }
- if (!this.match(10) && !this.match(0) && !this.match(16)) {
- this.raise(Errors.UnsupportedSuper, node);
- }
- return this.finishNode(node, "Super");
- }
- parsePrivateName() {
- const node = this.startNode();
- const id = this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc, 1));
- const name = this.state.value;
- this.next();
- node.id = this.createIdentifier(id, name);
- return this.finishNode(node, "PrivateName");
- }
- parseFunctionOrFunctionSent() {
- const node = this.startNode();
- this.next();
- if (this.prodParam.hasYield && this.match(16)) {
- const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
- this.next();
- if (this.match(103)) {
- this.expectPlugin("functionSent");
- } else if (!this.hasPlugin("functionSent")) {
- this.unexpected();
- }
- return this.parseMetaProperty(node, meta, "sent");
- }
- return this.parseFunction(node);
- }
- parseMetaProperty(node, meta, propertyName) {
- node.meta = meta;
- const containsEsc = this.state.containsEsc;
- node.property = this.parseIdentifier(true);
- if (node.property.name !== propertyName || containsEsc) {
- this.raise(Errors.UnsupportedMetaProperty, node.property, {
- target: meta.name,
- onlyValidPropertyName: propertyName
- });
+ }
}
- return this.finishNode(node, "MetaProperty");
- }
- parseImportMetaProperty(node) {
- const id = this.createIdentifier(this.startNodeAtNode(node), "import");
- this.next();
- if (this.isContextual(101)) {
- if (!this.inModule) {
- this.raise(Errors.ImportMetaOutsideModule, id);
- }
- this.sawUnambiguousESM = true;
- } else if (this.isContextual(105) || this.isContextual(97)) {
- const isSource = this.isContextual(105);
- this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
- if (!(this.optionFlags & 512)) {
- throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
- phase: this.state.value
- });
+ path.traverse(collectorVisitor, state);
+ this.crawling = false;
+ for (const path of state.assignments) {
+ const ids = path.getBindingIdentifiers();
+ for (const name of Object.keys(ids)) {
+ if (path.scope.getBinding(name)) continue;
+ programParent.addGlobal(ids[name]);
}
- this.next();
- node.phase = isSource ? "source" : "defer";
- return this.parseImportCall(node);
+ path.scope.registerConstantViolation(path);
}
- return this.parseMetaProperty(node, id, "meta");
- }
- parseLiteralAtNode(value, type, node) {
- this.addExtra(node, "rawValue", value);
- this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
- node.value = value;
- this.next();
- return this.finishNode(node, type);
- }
- parseLiteral(value, type) {
- const node = this.startNode();
- return this.parseLiteralAtNode(value, type, node);
- }
- parseStringLiteral(value) {
- return this.parseLiteral(value, "StringLiteral");
- }
- parseNumericLiteral(value) {
- return this.parseLiteral(value, "NumericLiteral");
- }
- parseBigIntLiteral(value) {
- return this.parseLiteral(value, "BigIntLiteral");
- }
- parseDecimalLiteral(value) {
- return this.parseLiteral(value, "DecimalLiteral");
- }
- parseRegExpLiteral(value) {
- const node = this.startNode();
- this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
- node.pattern = value.pattern;
- node.flags = value.flags;
- this.next();
- return this.finishNode(node, "RegExpLiteral");
- }
- parseBooleanLiteral(value) {
- const node = this.startNode();
- node.value = value;
- this.next();
- return this.finishNode(node, "BooleanLiteral");
- }
- parseNullLiteral() {
- const node = this.startNode();
- this.next();
- return this.finishNode(node, "NullLiteral");
- }
- parseParenAndDistinguishExpression(canBeArrow) {
- const startLoc = this.state.startLoc;
- let val;
- this.next();
- this.expressionScope.enter(newArrowHeadScope());
- const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
- const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
- this.state.maybeInArrowParameters = true;
- this.state.inFSharpPipelineDirectBody = false;
- const innerStartLoc = this.state.startLoc;
- const exprList = [];
- const refExpressionErrors = new ExpressionErrors();
- let first = true;
- let spreadStartLoc;
- let optionalCommaStartLoc;
- while (!this.match(11)) {
- if (first) {
- first = false;
+ for (const ref of state.references) {
+ const binding = ref.scope.getBinding(ref.node.name);
+ if (binding) {
+ binding.reference(ref);
} else {
- this.expect(12, refExpressionErrors.optionalParametersLoc === null ? null : refExpressionErrors.optionalParametersLoc);
- if (this.match(11)) {
- optionalCommaStartLoc = this.state.startLoc;
- break;
- }
+ programParent.addGlobal(ref.node);
}
- if (this.match(21)) {
- const spreadNodeStartLoc = this.state.startLoc;
- spreadStartLoc = this.state.startLoc;
- exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartLoc));
- if (!this.checkCommaAfterRest(41)) {
- break;
- }
- } else {
- exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
- }
- }
- const innerEndLoc = this.state.lastTokEndLoc;
- this.expect(11);
- this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
- this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
- let arrowNode = this.startNodeAt(startLoc);
- if (canBeArrow && this.shouldParseArrow(exprList) && (arrowNode = this.parseArrow(arrowNode))) {
- this.checkDestructuringPrivate(refExpressionErrors);
- this.expressionScope.validateAsPattern();
- this.expressionScope.exit();
- this.parseArrowExpression(arrowNode, exprList, false);
- return arrowNode;
- }
- this.expressionScope.exit();
- if (!exprList.length) {
- this.unexpected(this.state.lastTokStartLoc);
- }
- if (optionalCommaStartLoc) this.unexpected(optionalCommaStartLoc);
- if (spreadStartLoc) this.unexpected(spreadStartLoc);
- this.checkExpressionErrors(refExpressionErrors, true);
- this.toReferencedListDeep(exprList, true);
- if (exprList.length > 1) {
- val = this.startNodeAt(innerStartLoc);
- val.expressions = exprList;
- this.finishNode(val, "SequenceExpression");
- this.resetEndLocation(val, innerEndLoc);
- } else {
- val = exprList[0];
- }
- return this.wrapParenthesis(startLoc, val);
- }
- wrapParenthesis(startLoc, expression) {
- if (!(this.optionFlags & 1024)) {
- this.addExtra(expression, "parenthesized", true);
- this.addExtra(expression, "parenStart", startLoc.index);
- this.takeSurroundingComments(expression, startLoc.index, this.state.lastTokEndLoc.index);
- return expression;
}
- const parenExpression = this.startNodeAt(startLoc);
- parenExpression.expression = expression;
- return this.finishNode(parenExpression, "ParenthesizedExpression");
- }
- shouldParseArrow(params) {
- return !this.canInsertSemicolon();
- }
- parseArrow(node) {
- if (this.eat(19)) {
- return node;
+ for (const path of state.constantViolations) {
+ path.scope.registerConstantViolation(path);
}
}
- parseParenItem(node, startLoc) {
- return node;
- }
- parseNewOrNewTarget() {
- const node = this.startNode();
- this.next();
- if (this.match(16)) {
- const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
- this.next();
- const metaProp = this.parseMetaProperty(node, meta, "target");
- if (!this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4)) {
- this.raise(Errors.UnexpectedNewTarget, metaProp);
- }
- return metaProp;
- }
- return this.parseNew(node);
- }
- parseNew(node) {
- this.parseNewCallee(node);
- if (this.eat(10)) {
- const args = this.parseExprList(11);
- this.toReferencedList(args);
- node.arguments = args;
- } else {
- node.arguments = [];
+ push(opts) {
+ let path = this.path;
+ if (path.isPattern()) {
+ path = this.getPatternParent().path;
+ } else if (!path.isBlockStatement() && !path.isProgram()) {
+ path = this.getBlockParent().path;
}
- return this.finishNode(node, "NewExpression");
- }
- parseNewCallee(node) {
- const isImport = this.match(83);
- const callee = this.parseNoCallExpr();
- node.callee = callee;
- if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
- this.raise(Errors.ImportCallNotNewExpression, callee);
+ if (path.isSwitchStatement()) {
+ path = (this.getFunctionParent() || this.getProgramParent()).path;
}
- }
- parseTemplateElement(isTagged) {
const {
- start,
- startLoc,
- end,
- value
- } = this.state;
- const elemStart = start + 1;
- const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
- if (value === null) {
- if (!isTagged) {
- this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
- }
- }
- const isTail = this.match(24);
- const endOffset = isTail ? -1 : -2;
- const elemEnd = end + endOffset;
- elem.value = {
- raw: this.input.slice(elemStart, elemEnd).replace(/\r\n?/g, "\n"),
- cooked: value === null ? null : value.slice(1, endOffset)
- };
- elem.tail = isTail;
- this.next();
- const finishedNode = this.finishNode(elem, "TemplateElement");
- this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
- return finishedNode;
- }
- parseTemplate(isTagged) {
- const node = this.startNode();
- let curElt = this.parseTemplateElement(isTagged);
- const quasis = [curElt];
- const substitutions = [];
- while (!curElt.tail) {
- substitutions.push(this.parseTemplateSubstitution());
- this.readTemplateContinuation();
- quasis.push(curElt = this.parseTemplateElement(isTagged));
- }
- node.expressions = substitutions;
- node.quasis = quasis;
- return this.finishNode(node, "TemplateLiteral");
- }
- parseTemplateSubstitution() {
- return this.parseExpression();
- }
- parseObjectLike(close, isPattern, isRecord, refExpressionErrors) {
- if (isRecord) {
- this.expectPlugin("recordAndTuple");
- }
- const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
- this.state.inFSharpPipelineDirectBody = false;
- let sawProto = false;
- let first = true;
- const node = this.startNode();
- node.properties = [];
- this.next();
- while (!this.match(close)) {
- if (first) {
- first = false;
- } else {
- this.expect(12);
- if (this.match(close)) {
- this.addTrailingCommaExtraToNode(node);
- break;
- }
- }
- let prop;
- if (isPattern) {
- prop = this.parseBindingProperty();
- } else {
- prop = this.parsePropertyDefinition(refExpressionErrors);
- sawProto = this.checkProto(prop, isRecord, sawProto, refExpressionErrors);
- }
- if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
- this.raise(Errors.InvalidRecordProperty, prop);
- }
- {
- if (prop.shorthand) {
- this.addExtra(prop, "shorthand", true);
- }
- }
- node.properties.push(prop);
+ init,
+ unique,
+ kind = "var",
+ id
+ } = opts;
+ if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && t.isCallExpression(path.parent, {
+ callee: path.node
+ }) && path.parent.arguments.length <= path.node.params.length && t.isIdentifier(id)) {
+ path.pushContainer("params", id);
+ path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]);
+ return;
+ }
+ if (path.isLoop() || path.isCatchClause() || path.isFunction()) {
+ path.ensureBlock();
+ path = path.get("body");
}
- this.next();
- this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
- let type = "ObjectExpression";
- if (isPattern) {
- type = "ObjectPattern";
- } else if (isRecord) {
- type = "RecordExpression";
+ const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
+ const dataKey = `declaration:${kind}:${blockHoist}`;
+ let declarPath = !unique && path.getData(dataKey);
+ if (!declarPath) {
+ const declar = variableDeclaration(kind, []);
+ declar._blockHoist = blockHoist;
+ [declarPath] = path.unshiftContainer("body", [declar]);
+ if (!unique) path.setData(dataKey, declarPath);
}
- return this.finishNode(node, type);
+ const declarator = variableDeclarator(id, init);
+ const len = declarPath.node.declarations.push(declarator);
+ path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
}
- addTrailingCommaExtraToNode(node) {
- this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
- this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
+ getProgramParent() {
+ let scope = this;
+ do {
+ if (scope.path.isProgram()) {
+ return scope;
+ }
+ } while (scope = scope.parent);
+ throw new Error("Couldn't find a Program");
}
- maybeAsyncOrAccessorProp(prop) {
- return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(55));
+ getFunctionParent() {
+ let scope = this;
+ do {
+ if (scope.path.isFunctionParent()) {
+ return scope;
+ }
+ } while (scope = scope.parent);
+ return null;
}
- parsePropertyDefinition(refExpressionErrors) {
- let decorators = [];
- if (this.match(26)) {
- if (this.hasPlugin("decorators")) {
- this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
+ getBlockParent() {
+ let scope = this;
+ do {
+ if (scope.path.isBlockParent()) {
+ return scope;
}
- while (this.match(26)) {
- decorators.push(this.parseDecorator());
+ } while (scope = scope.parent);
+ throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
+ }
+ getPatternParent() {
+ let scope = this;
+ do {
+ if (!scope.path.isPattern()) {
+ return scope.getBlockParent();
}
- }
- const prop = this.startNode();
- let isAsync = false;
- let isAccessor = false;
- let startLoc;
- if (this.match(21)) {
- if (decorators.length) this.unexpected();
- return this.parseSpread();
- }
- if (decorators.length) {
- prop.decorators = decorators;
- decorators = [];
- }
- prop.method = false;
- if (refExpressionErrors) {
- startLoc = this.state.startLoc;
- }
- let isGenerator = this.eat(55);
- this.parsePropertyNamePrefixOperator(prop);
- const containsEsc = this.state.containsEsc;
- this.parsePropertyName(prop, refExpressionErrors);
- if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
- const {
- key
- } = prop;
- const keyName = key.name;
- if (keyName === "async" && !this.hasPrecedingLineBreak()) {
- isAsync = true;
- this.resetPreviousNodeTrailingComments(key);
- isGenerator = this.eat(55);
- this.parsePropertyName(prop);
- }
- if (keyName === "get" || keyName === "set") {
- isAccessor = true;
- this.resetPreviousNodeTrailingComments(key);
- prop.kind = keyName;
- if (this.match(55)) {
- isGenerator = true;
- this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
- kind: keyName
- });
- this.next();
+ } while (scope = scope.parent.parent);
+ throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
+ }
+ getAllBindings() {
+ const ids = Object.create(null);
+ let scope = this;
+ do {
+ for (const key of Object.keys(scope.bindings)) {
+ if (key in ids === false) {
+ ids[key] = scope.bindings[key];
}
- this.parsePropertyName(prop);
}
- }
- return this.parseObjPropValue(prop, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors);
- }
- getGetterSetterExpectedParamCount(method) {
- return method.kind === "get" ? 0 : 1;
- }
- getObjectOrClassMethodParams(method) {
- return method.params;
+ scope = scope.parent;
+ } while (scope);
+ return ids;
}
- checkGetterSetterParams(method) {
- var _params;
- const paramCount = this.getGetterSetterExpectedParamCount(method);
- const params = this.getObjectOrClassMethodParams(method);
- if (params.length !== paramCount) {
- this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
- }
- if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
- this.raise(Errors.BadSetterRestParameter, method);
+ getAllBindingsOfKind(...kinds) {
+ const ids = Object.create(null);
+ for (const kind of kinds) {
+ let scope = this;
+ do {
+ for (const name of Object.keys(scope.bindings)) {
+ const binding = scope.bindings[name];
+ if (binding.kind === kind) ids[name] = binding;
+ }
+ scope = scope.parent;
+ } while (scope);
}
+ return ids;
}
- parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
- if (isAccessor) {
- const finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
- this.checkGetterSetterParams(finishedProp);
- return finishedProp;
- }
- if (isAsync || isGenerator || this.match(10)) {
- if (isPattern) this.unexpected();
- prop.kind = "method";
- prop.method = true;
- return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod");
- }
+ bindingIdentifierEquals(name, node) {
+ return this.getBindingIdentifier(name) === node;
}
- parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
- prop.shorthand = false;
- if (this.eat(14)) {
- prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors);
- return this.finishNode(prop, "ObjectProperty");
- }
- if (!prop.computed && prop.key.type === "Identifier") {
- this.checkReservedWord(prop.key.name, prop.key.loc.start, true, false);
- if (isPattern) {
- prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
- } else if (this.match(29)) {
- const shorthandAssignLoc = this.state.startLoc;
- if (refExpressionErrors != null) {
- if (refExpressionErrors.shorthandAssignLoc === null) {
- refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
- }
- } else {
- this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
+ getBinding(name) {
+ let scope = this;
+ let previousPath;
+ do {
+ const binding = scope.getOwnBinding(name);
+ if (binding) {
+ var _previousPath;
+ if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {} else {
+ return binding;
}
- prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
- } else {
- prop.value = cloneIdentifier(prop.key);
+ } else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
+ break;
}
- prop.shorthand = true;
- return this.finishNode(prop, "ObjectProperty");
- }
+ previousPath = scope.path;
+ } while (scope = scope.parent);
}
- parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
- const node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) || this.parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors);
- if (!node) this.unexpected();
- return node;
+ getOwnBinding(name) {
+ return this.bindings[name];
}
- parsePropertyName(prop, refExpressionErrors) {
- if (this.eat(0)) {
- prop.computed = true;
- prop.key = this.parseMaybeAssignAllowIn();
- this.expect(3);
- } else {
- const {
- type,
- value
- } = this.state;
- let key;
- if (tokenIsKeywordOrIdentifier(type)) {
- key = this.parseIdentifier(true);
- } else {
- switch (type) {
- case 135:
- key = this.parseNumericLiteral(value);
- break;
- case 134:
- key = this.parseStringLiteral(value);
- break;
- case 136:
- key = this.parseBigIntLiteral(value);
- break;
- case 139:
- {
- const privateKeyLoc = this.state.startLoc;
- if (refExpressionErrors != null) {
- if (refExpressionErrors.privateKeyLoc === null) {
- refExpressionErrors.privateKeyLoc = privateKeyLoc;
- }
- } else {
- this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
- }
- key = this.parsePrivateName();
- break;
- }
- default:
- if (type === 137) {
- key = this.parseDecimalLiteral(value);
- break;
- }
- this.unexpected();
- }
- }
- prop.key = key;
- if (type !== 139) {
- prop.computed = false;
- }
- }
- }
- initFunction(node, isAsync) {
- node.id = null;
- node.generator = false;
- node.async = isAsync;
- }
- parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
- this.initFunction(node, isAsync);
- node.generator = isGenerator;
- this.scope.enter(2 | 16 | (inClassScope ? 64 : 0) | (allowDirectSuper ? 32 : 0));
- this.prodParam.enter(functionFlags(isAsync, node.generator));
- this.parseFunctionParams(node, isConstructor);
- const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
- this.prodParam.exit();
- this.scope.exit();
- return finishedNode;
- }
- parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
- if (isTuple) {
- this.expectPlugin("recordAndTuple");
- }
- const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
- this.state.inFSharpPipelineDirectBody = false;
- const node = this.startNode();
- this.next();
- node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node);
- this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
- return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
- }
- parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
- this.scope.enter(2 | 4);
- let flags = functionFlags(isAsync, false);
- if (!this.match(5) && this.prodParam.hasIn) {
- flags |= 8;
- }
- this.prodParam.enter(flags);
- this.initFunction(node, isAsync);
- const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
- if (params) {
- this.state.maybeInArrowParameters = true;
- this.setArrowFunctionParameters(node, params, trailingCommaLoc);
- }
- this.state.maybeInArrowParameters = false;
- this.parseFunctionBody(node, true);
- this.prodParam.exit();
- this.scope.exit();
- this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
- return this.finishNode(node, "ArrowFunctionExpression");
- }
- setArrowFunctionParameters(node, params, trailingCommaLoc) {
- this.toAssignableList(params, trailingCommaLoc, false);
- node.params = params;
- }
- parseFunctionBodyAndFinish(node, type, isMethod = false) {
- this.parseFunctionBody(node, false, isMethod);
- return this.finishNode(node, type);
- }
- parseFunctionBody(node, allowExpression, isMethod = false) {
- const isExpression = allowExpression && !this.match(5);
- this.expressionScope.enter(newExpressionScope());
- if (isExpression) {
- node.body = this.parseMaybeAssign();
- this.checkParams(node, false, allowExpression, false);
- } else {
- const oldStrict = this.state.strict;
- const oldLabels = this.state.labels;
- this.state.labels = [];
- this.prodParam.enter(this.prodParam.currentFlags() | 4);
- node.body = this.parseBlock(true, false, hasStrictModeDirective => {
- const nonSimple = !this.isSimpleParamList(node.params);
- if (hasStrictModeDirective && nonSimple) {
- this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
- }
- const strictModeChanged = !oldStrict && this.state.strict;
- this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
- if (this.state.strict && node.id) {
- this.checkIdentifier(node.id, 65, strictModeChanged);
- }
- });
- this.prodParam.exit();
- this.state.labels = oldLabels;
- }
- this.expressionScope.exit();
+ getBindingIdentifier(name) {
+ var _this$getBinding2;
+ return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier;
}
- isSimpleParameter(node) {
- return node.type === "Identifier";
+ getOwnBindingIdentifier(name) {
+ const binding = this.bindings[name];
+ return binding == null ? void 0 : binding.identifier;
}
- isSimpleParamList(params) {
- for (let i = 0, len = params.length; i < len; i++) {
- if (!this.isSimpleParameter(params[i])) return false;
- }
- return true;
+ hasOwnBinding(name) {
+ return !!this.getOwnBinding(name);
}
- checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
- const checkClashes = !allowDuplicates && new Set();
- const formalParameters = {
- type: "FormalParameters"
- };
- for (const param of node.params) {
- this.checkLVal(param, formalParameters, 5, checkClashes, strictModeChanged);
+ hasBinding(name, opts) {
+ var _opts, _opts2, _opts3;
+ if (!name) return false;
+ if (this.hasOwnBinding(name)) return true;
+ {
+ if (typeof opts === "boolean") opts = {
+ noGlobals: opts
+ };
}
+ if (this.parentHasBinding(name, opts)) return true;
+ if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true;
+ if (!((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name)) return true;
+ if (!((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name)) return true;
+ return false;
}
- parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
- const elts = [];
- let first = true;
- while (!this.eat(close)) {
- if (first) {
- first = false;
- } else {
- this.expect(12);
- if (this.match(close)) {
- if (nodeForExtra) {
- this.addTrailingCommaExtraToNode(nodeForExtra);
- }
- this.next();
- break;
- }
- }
- elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
- }
- return elts;
+ parentHasBinding(name, opts) {
+ var _this$parent;
+ return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts);
}
- parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
- let elt;
- if (this.match(12)) {
- if (!allowEmpty) {
- this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
- unexpected: ","
- });
- }
- elt = null;
- } else if (this.match(21)) {
- const spreadNodeStartLoc = this.state.startLoc;
- elt = this.parseParenItem(this.parseSpread(refExpressionErrors), spreadNodeStartLoc);
- } else if (this.match(17)) {
- this.expectPlugin("partialApplication");
- if (!allowPlaceholder) {
- this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
- }
- const node = this.startNode();
- this.next();
- elt = this.finishNode(node, "ArgumentPlaceholder");
- } else {
- elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
+ moveBindingTo(name, scope) {
+ const info = this.getBinding(name);
+ if (info) {
+ info.scope.removeOwnBinding(name);
+ info.scope = scope;
+ scope.bindings[name] = info;
}
- return elt;
}
- parseIdentifier(liberal) {
- const node = this.startNode();
- const name = this.parseIdentifierName(liberal);
- return this.createIdentifier(node, name);
+ removeOwnBinding(name) {
+ delete this.bindings[name];
}
- createIdentifier(node, name) {
- node.name = name;
- node.loc.identifierName = name;
- return this.finishNode(node, "Identifier");
+ removeBinding(name) {
+ var _this$getBinding3;
+ (_this$getBinding3 = this.getBinding(name)) == null ? void 0 : _this$getBinding3.scope.removeOwnBinding(name);
+ let scope = this;
+ do {
+ if (scope.uids[name]) {
+ scope.uids[name] = false;
+ }
+ } while (scope = scope.parent);
}
- parseIdentifierName(liberal) {
- let name;
- const {
- startLoc,
- type
- } = this.state;
- if (tokenIsKeywordOrIdentifier(type)) {
- name = this.state.value;
- } else {
- this.unexpected();
+}
+exports["default"] = Scope;
+Scope.globals = Object.keys(_globals.builtin);
+Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 3708:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+var _helperSplitExportDeclaration = __nccwpck_require__(5176);
+var t = __nccwpck_require__(7912);
+var _helperEnvironmentVisitor = __nccwpck_require__(1097);
+var _traverseNode = __nccwpck_require__(1250);
+var _visitors = __nccwpck_require__(3494);
+const renameVisitor = {
+ ReferencedIdentifier({
+ node
+ }, state) {
+ if (node.name === state.oldName) {
+ node.name = state.newName;
}
- const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type);
- if (liberal) {
- if (tokenIsKeyword) {
- this.replaceToken(132);
+ },
+ Scope(path, state) {
+ if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
+ path.skip();
+ if (path.isMethod()) {
+ (0, _helperEnvironmentVisitor.requeueComputedKeyAndDecorators)(path);
}
- } else {
- this.checkReservedWord(name, startLoc, tokenIsKeyword, false);
}
- this.next();
- return name;
- }
- checkReservedWord(word, startLoc, checkKeywords, isBinding) {
- if (word.length > 10) {
- return;
+ },
+ ObjectProperty({
+ node,
+ scope
+ }, state) {
+ const {
+ name
+ } = node.key;
+ if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) {
+ var _node$extra;
+ node.shorthand = false;
+ if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
}
- if (!canBeReservedWord(word)) {
- return;
+ },
+ "AssignmentExpression|Declaration|VariableDeclarator"(path, state) {
+ if (path.isVariableDeclaration()) return;
+ const ids = path.getOuterBindingIdentifiers();
+ for (const name in ids) {
+ if (name === state.oldName) ids[name].name = state.newName;
}
- if (checkKeywords && isKeyword(word)) {
- this.raise(Errors.UnexpectedKeyword, startLoc, {
- keyword: word
- });
+ }
+};
+class Renamer {
+ constructor(binding, oldName, newName) {
+ this.newName = newName;
+ this.oldName = oldName;
+ this.binding = binding;
+ }
+ maybeConvertFromExportDeclaration(parentDeclar) {
+ const maybeExportDeclar = parentDeclar.parentPath;
+ if (!maybeExportDeclar.isExportDeclaration()) {
return;
}
- const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
- if (reservedTest(word, this.inModule)) {
- this.raise(Errors.UnexpectedReservedWord, startLoc, {
- reservedWord: word
- });
- return;
- } else if (word === "yield") {
- if (this.prodParam.hasYield) {
- this.raise(Errors.YieldBindingIdentifier, startLoc);
- return;
- }
- } else if (word === "await") {
- if (this.prodParam.hasAwait) {
- this.raise(Errors.AwaitBindingIdentifier, startLoc);
- return;
- }
- if (this.scope.inStaticBlock) {
- this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
- return;
- }
- this.expressionScope.recordAsyncArrowParametersError(startLoc);
- } else if (word === "arguments") {
- if (this.scope.inClassAndNotInNonArrowFunction) {
- this.raise(Errors.ArgumentsInClass, startLoc);
+ if (maybeExportDeclar.isExportDefaultDeclaration()) {
+ const {
+ declaration
+ } = maybeExportDeclar.node;
+ if (t.isDeclaration(declaration) && !declaration.id) {
return;
}
}
- }
- recordAwaitIfAllowed() {
- const isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
- if (isAwaitAllowed && !this.scope.inFunction) {
- this.state.hasTopLevelAwait = true;
+ if (maybeExportDeclar.isExportAllDeclaration()) {
+ return;
}
- return isAwaitAllowed;
+ (0, _helperSplitExportDeclaration.default)(maybeExportDeclar);
}
- parseAwait(startLoc) {
- const node = this.startNodeAt(startLoc);
- this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
- if (this.eat(55)) {
- this.raise(Errors.ObsoleteAwaitStar, node);
- }
- if (!this.scope.inFunction && !(this.optionFlags & 1)) {
- if (this.isAmbiguousPrefixOrIdentifier()) {
- this.ambiguousScriptDifferentAst = true;
- } else {
- this.sawUnambiguousESM = true;
- }
- }
- if (!this.state.soloAwait) {
- node.argument = this.parseMaybeUnary(null, true);
- }
- return this.finishNode(node, "AwaitExpression");
+ maybeConvertFromClassFunctionDeclaration(path) {
+ return path;
}
- isAmbiguousPrefixOrIdentifier() {
- if (this.hasPrecedingLineBreak()) return true;
- const {
- type
- } = this.state;
- return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 138 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
- }
- parseYield(startLoc) {
- const node = this.startNodeAt(startLoc);
- this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
- let delegating = false;
- let argument = null;
- if (!this.hasPrecedingLineBreak()) {
- delegating = this.eat(55);
- switch (this.state.type) {
- case 13:
- case 140:
- case 8:
- case 11:
- case 3:
- case 9:
- case 14:
- case 12:
- if (!delegating) break;
- default:
- argument = this.parseMaybeAssign();
- }
- }
- node.delegate = delegating;
- node.argument = argument;
- return this.finishNode(node, "YieldExpression");
- }
- parseImportCall(node) {
- this.next();
- node.source = this.parseMaybeAssignAllowIn();
- node.options = null;
- if (this.eat(12)) {
- if (!this.match(11)) {
- node.options = this.parseMaybeAssignAllowIn();
- if (this.eat(12) && !this.match(11)) {
- do {
- this.parseMaybeAssignAllowIn();
- } while (this.eat(12) && !this.match(11));
- this.raise(Errors.ImportCallArity, node);
- }
- }
- }
- this.expect(11);
- return this.finishNode(node, "ImportExpression");
+ maybeConvertFromClassFunctionExpression(path) {
+ return path;
}
- checkPipelineAtInfixOperator(left, leftStartLoc) {
- if (this.hasPlugin(["pipelineOperator", {
- proposal: "smart"
- }])) {
- if (left.type === "SequenceExpression") {
- this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
+ rename() {
+ const {
+ binding,
+ oldName,
+ newName
+ } = this;
+ const {
+ scope,
+ path
+ } = binding;
+ const parentDeclar = path.find(path => path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression());
+ if (parentDeclar) {
+ const bindingIds = parentDeclar.getOuterBindingIdentifiers();
+ if (bindingIds[oldName] === binding.identifier) {
+ this.maybeConvertFromExportDeclaration(parentDeclar);
}
}
- }
- parseSmartPipelineBodyInStyle(childExpr, startLoc) {
- if (this.isSimpleReference(childExpr)) {
- const bodyNode = this.startNodeAt(startLoc);
- bodyNode.callee = childExpr;
- return this.finishNode(bodyNode, "PipelineBareFunction");
- } else {
- const bodyNode = this.startNodeAt(startLoc);
- this.checkSmartPipeTopicBodyEarlyErrors(startLoc);
- bodyNode.expression = childExpr;
- return this.finishNode(bodyNode, "PipelineTopicExpression");
- }
- }
- isSimpleReference(expression) {
- switch (expression.type) {
- case "MemberExpression":
- return !expression.computed && this.isSimpleReference(expression.object);
- case "Identifier":
- return true;
- default:
- return false;
- }
- }
- checkSmartPipeTopicBodyEarlyErrors(startLoc) {
- if (this.match(19)) {
- throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
+ const blockToTraverse = arguments[0] || scope.block;
+ (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, {
+ discriminant: true
+ });
+ if (!arguments[0]) {
+ scope.removeOwnBinding(oldName);
+ scope.bindings[newName] = binding;
+ this.binding.identifier.name = newName;
}
- if (!this.topicReferenceWasUsedInCurrentContext()) {
- this.raise(Errors.PipelineTopicUnused, startLoc);
+ if (parentDeclar) {
+ this.maybeConvertFromClassFunctionDeclaration(path);
+ this.maybeConvertFromClassFunctionExpression(path);
}
}
- withTopicBindingContext(callback) {
- const outerContextTopicState = this.state.topicContext;
- this.state.topicContext = {
- maxNumOfResolvableTopics: 1,
- maxTopicIndex: null
- };
- try {
- return callback();
- } finally {
- this.state.topicContext = outerContextTopicState;
- }
- }
- withSmartMixTopicForbiddingContext(callback) {
- if (this.hasPlugin(["pipelineOperator", {
- proposal: "smart"
- }])) {
- const outerContextTopicState = this.state.topicContext;
- this.state.topicContext = {
- maxNumOfResolvableTopics: 0,
- maxTopicIndex: null
- };
- try {
- return callback();
- } finally {
- this.state.topicContext = outerContextTopicState;
- }
- } else {
- return callback();
+}
+exports["default"] = Renamer;
+
+//# sourceMappingURL=renamer.js.map
+
+
+/***/ }),
+
+/***/ 1250:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.traverseNode = traverseNode;
+var _context = __nccwpck_require__(9089);
+var _t = __nccwpck_require__(7912);
+const {
+ VISITOR_KEYS
+} = _t;
+function traverseNode(node, opts, scope, state, path, skipKeys, visitSelf) {
+ const keys = VISITOR_KEYS[node.type];
+ if (!keys) return false;
+ const context = new _context.default(scope, opts, state, path);
+ if (visitSelf) {
+ if (skipKeys != null && skipKeys[path.parentKey]) return false;
+ return context.visitQueue([path]);
+ }
+ for (const key of keys) {
+ if (skipKeys != null && skipKeys[key]) continue;
+ if (context.visit(node, key)) {
+ return true;
}
}
- withSoloAwaitPermittingContext(callback) {
- const outerContextSoloAwaitState = this.state.soloAwait;
- this.state.soloAwait = true;
- try {
- return callback();
- } finally {
- this.state.soloAwait = outerContextSoloAwaitState;
+ return false;
+}
+
+//# sourceMappingURL=traverse-node.js.map
+
+
+/***/ }),
+
+/***/ 3494:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.explode = explode;
+exports.isExplodedVisitor = isExplodedVisitor;
+exports.merge = merge;
+exports.verify = verify;
+var virtualTypes = __nccwpck_require__(4425);
+var _t = __nccwpck_require__(7912);
+const {
+ DEPRECATED_KEYS,
+ DEPRECATED_ALIASES,
+ FLIPPED_ALIAS_KEYS,
+ TYPES,
+ __internal__deprecationWarning: deprecationWarning
+} = _t;
+function isVirtualType(type) {
+ return type in virtualTypes;
+}
+function isExplodedVisitor(visitor) {
+ return visitor == null ? void 0 : visitor._exploded;
+}
+function explode(visitor) {
+ if (isExplodedVisitor(visitor)) return visitor;
+ visitor._exploded = true;
+ for (const nodeType of Object.keys(visitor)) {
+ if (shouldIgnoreKey(nodeType)) continue;
+ const parts = nodeType.split("|");
+ if (parts.length === 1) continue;
+ const fns = visitor[nodeType];
+ delete visitor[nodeType];
+ for (const part of parts) {
+ visitor[part] = fns;
}
}
- allowInAnd(callback) {
- const flags = this.prodParam.currentFlags();
- const prodParamToSet = 8 & ~flags;
- if (prodParamToSet) {
- this.prodParam.enter(flags | 8);
- try {
- return callback();
- } finally {
- this.prodParam.exit();
+ verify(visitor);
+ delete visitor.__esModule;
+ ensureEntranceObjects(visitor);
+ ensureCallbackArrays(visitor);
+ for (const nodeType of Object.keys(visitor)) {
+ if (shouldIgnoreKey(nodeType)) continue;
+ if (!isVirtualType(nodeType)) continue;
+ const fns = visitor[nodeType];
+ for (const type of Object.keys(fns)) {
+ fns[type] = wrapCheck(nodeType, fns[type]);
+ }
+ delete visitor[nodeType];
+ const types = virtualTypes[nodeType];
+ if (types !== null) {
+ for (const type of types) {
+ if (visitor[type]) {
+ mergePair(visitor[type], fns);
+ } else {
+ visitor[type] = fns;
+ }
}
+ } else {
+ mergePair(visitor, fns);
}
- return callback();
}
- disallowInAnd(callback) {
- const flags = this.prodParam.currentFlags();
- const prodParamToClear = 8 & flags;
- if (prodParamToClear) {
- this.prodParam.enter(flags & ~8);
- try {
- return callback();
- } finally {
- this.prodParam.exit();
+ for (const nodeType of Object.keys(visitor)) {
+ if (shouldIgnoreKey(nodeType)) continue;
+ let aliases = FLIPPED_ALIAS_KEYS[nodeType];
+ if (nodeType in DEPRECATED_KEYS) {
+ const deprecatedKey = DEPRECATED_KEYS[nodeType];
+ deprecationWarning(nodeType, deprecatedKey, "Visitor ");
+ aliases = [deprecatedKey];
+ } else if (nodeType in DEPRECATED_ALIASES) {
+ const deprecatedAlias = DEPRECATED_ALIASES[nodeType];
+ deprecationWarning(nodeType, deprecatedAlias, "Visitor ");
+ aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias];
+ }
+ if (!aliases) continue;
+ const fns = visitor[nodeType];
+ delete visitor[nodeType];
+ for (const alias of aliases) {
+ const existing = visitor[alias];
+ if (existing) {
+ mergePair(existing, fns);
+ } else {
+ visitor[alias] = Object.assign({}, fns);
}
}
- return callback();
}
- registerTopicReference() {
- this.state.topicContext.maxTopicIndex = 0;
- }
- topicReferenceIsAllowedInCurrentContext() {
- return this.state.topicContext.maxNumOfResolvableTopics >= 1;
- }
- topicReferenceWasUsedInCurrentContext() {
- return this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0;
+ for (const nodeType of Object.keys(visitor)) {
+ if (shouldIgnoreKey(nodeType)) continue;
+ ensureCallbackArrays(visitor[nodeType]);
}
- parseFSharpPipelineBody(prec) {
- const startLoc = this.state.startLoc;
- this.state.potentialArrowAt = this.state.start;
- const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
- this.state.inFSharpPipelineDirectBody = true;
- const ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, prec);
- this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
- return ret;
+ return visitor;
+}
+function verify(visitor) {
+ if (visitor._verified) return;
+ if (typeof visitor === "function") {
+ throw new Error("You passed `traverse()` a function when it expected a visitor object, " + "are you sure you didn't mean `{ enter: Function }`?");
}
- parseModuleExpression() {
- this.expectPlugin("moduleBlocks");
- const node = this.startNode();
- this.next();
- if (!this.match(5)) {
- this.unexpected(null, 5);
- }
- const program = this.startNodeAt(this.state.endLoc);
- this.next();
- const revertScopes = this.initializeScopes(true);
- this.enterInitialScopes();
- try {
- node.body = this.parseProgram(program, 8, "module");
- } finally {
- revertScopes();
+ for (const nodeType of Object.keys(visitor)) {
+ if (nodeType === "enter" || nodeType === "exit") {
+ validateVisitorMethods(nodeType, visitor[nodeType]);
}
- return this.finishNode(node, "ModuleExpression");
- }
- parsePropertyNamePrefixOperator(prop) {}
-}
-const loopLabel = {
- kind: 1
- },
- switchLabel = {
- kind: 2
- };
-const loneSurrogate = /[\uD800-\uDFFF]/u;
-const keywordRelationalOperator = /in(?:stanceof)?/y;
-function babel7CompatTokens(tokens, input, startIndex) {
- for (let i = 0; i < tokens.length; i++) {
- const token = tokens[i];
- const {
- type
- } = token;
- if (typeof type === "number") {
- {
- if (type === 139) {
- const {
- loc,
- start,
- value,
- end
- } = token;
- const hashEndPos = start + 1;
- const hashEndLoc = createPositionWithColumnOffset(loc.start, 1);
- tokens.splice(i, 1, new Token({
- type: getExportedToken(27),
- value: "#",
- start: start,
- end: hashEndPos,
- startLoc: loc.start,
- endLoc: hashEndLoc
- }), new Token({
- type: getExportedToken(132),
- value: value,
- start: hashEndPos,
- end: end,
- startLoc: hashEndLoc,
- endLoc: loc.end
- }));
- i++;
- continue;
- }
- if (tokenIsTemplate(type)) {
- const {
- loc,
- start,
- value,
- end
- } = token;
- const backquoteEnd = start + 1;
- const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
- let startToken;
- if (input.charCodeAt(start - startIndex) === 96) {
- startToken = new Token({
- type: getExportedToken(22),
- value: "`",
- start: start,
- end: backquoteEnd,
- startLoc: loc.start,
- endLoc: backquoteEndLoc
- });
- } else {
- startToken = new Token({
- type: getExportedToken(8),
- value: "}",
- start: start,
- end: backquoteEnd,
- startLoc: loc.start,
- endLoc: backquoteEndLoc
- });
- }
- let templateValue, templateElementEnd, templateElementEndLoc, endToken;
- if (type === 24) {
- templateElementEnd = end - 1;
- templateElementEndLoc = createPositionWithColumnOffset(loc.end, -1);
- templateValue = value === null ? null : value.slice(1, -1);
- endToken = new Token({
- type: getExportedToken(22),
- value: "`",
- start: templateElementEnd,
- end: end,
- startLoc: templateElementEndLoc,
- endLoc: loc.end
- });
- } else {
- templateElementEnd = end - 2;
- templateElementEndLoc = createPositionWithColumnOffset(loc.end, -2);
- templateValue = value === null ? null : value.slice(1, -2);
- endToken = new Token({
- type: getExportedToken(23),
- value: "${",
- start: templateElementEnd,
- end: end,
- startLoc: templateElementEndLoc,
- endLoc: loc.end
- });
- }
- tokens.splice(i, 1, startToken, new Token({
- type: getExportedToken(20),
- value: templateValue,
- start: backquoteEnd,
- end: templateElementEnd,
- startLoc: backquoteEndLoc,
- endLoc: templateElementEndLoc
- }), endToken);
- i += 2;
- continue;
+ if (shouldIgnoreKey(nodeType)) continue;
+ if (TYPES.indexOf(nodeType) < 0) {
+ throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type`);
+ }
+ const visitors = visitor[nodeType];
+ if (typeof visitors === "object") {
+ for (const visitorKey of Object.keys(visitors)) {
+ if (visitorKey === "enter" || visitorKey === "exit") {
+ validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]);
+ } else {
+ throw new Error("You passed `traverse()` a visitor object with the property " + `${nodeType} that has the invalid property ${visitorKey}`);
}
}
- token.type = getExportedToken(type);
}
}
- return tokens;
+ visitor._verified = true;
}
-class StatementParser extends ExpressionParser {
- parseTopLevel(file, program) {
- file.program = this.parseProgram(program);
- file.comments = this.comments;
- if (this.optionFlags & 256) {
- file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
- }
- return this.finishNode(file, "File");
- }
- parseProgram(program, end = 140, sourceType = this.options.sourceType) {
- program.sourceType = sourceType;
- program.interpreter = this.parseInterpreterDirective();
- this.parseBlockBody(program, true, true, end);
- if (this.inModule) {
- if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0) {
- for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
- this.raise(Errors.ModuleExportUndefined, at, {
- localName
- });
- }
- }
- this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
- }
- let finishedProgram;
- if (end === 140) {
- finishedProgram = this.finishNode(program, "Program");
- } else {
- finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
- }
- return finishedProgram;
- }
- stmtToDirective(stmt) {
- const directive = stmt;
- directive.type = "Directive";
- directive.value = directive.expression;
- delete directive.expression;
- const directiveLiteral = directive.value;
- const expressionValue = directiveLiteral.value;
- const raw = this.input.slice(this.offsetToSourcePos(directiveLiteral.start), this.offsetToSourcePos(directiveLiteral.end));
- const val = directiveLiteral.value = raw.slice(1, -1);
- this.addExtra(directiveLiteral, "raw", raw);
- this.addExtra(directiveLiteral, "rawValue", val);
- this.addExtra(directiveLiteral, "expressionValue", expressionValue);
- directiveLiteral.type = "DirectiveLiteral";
- return directive;
- }
- parseInterpreterDirective() {
- if (!this.match(28)) {
- return null;
+function validateVisitorMethods(path, val) {
+ const fns = [].concat(val);
+ for (const fn of fns) {
+ if (typeof fn !== "function") {
+ throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`);
}
- const node = this.startNode();
- node.value = this.state.value;
- this.next();
- return this.finishNode(node, "InterpreterDirective");
}
- isLet() {
- if (!this.isContextual(100)) {
- return false;
+}
+function merge(visitors, states = [], wrapper) {
+ const mergedVisitor = {};
+ for (let i = 0; i < visitors.length; i++) {
+ const visitor = explode(visitors[i]);
+ const state = states[i];
+ let topVisitor = visitor;
+ if (state || wrapper) {
+ topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper);
}
- return this.hasFollowingBindingAtom();
- }
- chStartsBindingIdentifier(ch, pos) {
- if (isIdentifierStart(ch)) {
- keywordRelationalOperator.lastIndex = pos;
- if (keywordRelationalOperator.test(this.input)) {
- const endCh = this.codePointAtPos(keywordRelationalOperator.lastIndex);
- if (!isIdentifierChar(endCh) && endCh !== 92) {
- return false;
- }
+ mergePair(mergedVisitor, topVisitor);
+ for (const key of Object.keys(visitor)) {
+ if (shouldIgnoreKey(key)) continue;
+ let typeVisitor = visitor[key];
+ if (state || wrapper) {
+ typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper);
}
- return true;
- } else if (ch === 92) {
- return true;
- } else {
- return false;
+ const nodeVisitor = mergedVisitor[key] || (mergedVisitor[key] = {});
+ mergePair(nodeVisitor, typeVisitor);
}
}
- chStartsBindingPattern(ch) {
- return ch === 91 || ch === 123;
- }
- hasFollowingBindingAtom() {
- const next = this.nextTokenStart();
- const nextCh = this.codePointAtPos(next);
- return this.chStartsBindingPattern(nextCh) || this.chStartsBindingIdentifier(nextCh, next);
- }
- hasInLineFollowingBindingIdentifierOrBrace() {
- const next = this.nextTokenInLineStart();
- const nextCh = this.codePointAtPos(next);
- return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
+ ;
+ return mergedVisitor;
+}
+function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
+ const newVisitor = {};
+ for (const phase of ["enter", "exit"]) {
+ let fns = oldVisitor[phase];
+ if (!Array.isArray(fns)) continue;
+ fns = fns.map(function (fn) {
+ let newFn = fn;
+ if (state) {
+ newFn = function (path) {
+ fn.call(state, path, state);
+ };
+ }
+ if (wrapper) {
+ newFn = wrapper(state == null ? void 0 : state.key, phase, newFn);
+ }
+ if (newFn !== fn) {
+ newFn.toString = () => fn.toString();
+ }
+ return newFn;
+ });
+ newVisitor[phase] = fns;
}
- startsUsingForOf() {
- const {
- type,
- containsEsc
- } = this.lookahead();
- if (type === 102 && !containsEsc) {
- return false;
- } else if (tokenIsIdentifier(type) && !this.hasFollowingLineBreak()) {
- this.expectPlugin("explicitResourceManagement");
- return true;
+ return newVisitor;
+}
+function ensureEntranceObjects(obj) {
+ for (const key of Object.keys(obj)) {
+ if (shouldIgnoreKey(key)) continue;
+ const fns = obj[key];
+ if (typeof fns === "function") {
+ obj[key] = {
+ enter: fns
+ };
}
}
- startsAwaitUsing() {
- let next = this.nextTokenInLineStart();
- if (this.isUnparsedContextual(next, "using")) {
- next = this.nextTokenInLineStartSince(next + 5);
- const nextCh = this.codePointAtPos(next);
- if (this.chStartsBindingIdentifier(nextCh, next)) {
- this.expectPlugin("explicitResourceManagement");
- return true;
- }
- }
- return false;
- }
- parseModuleItem() {
- return this.parseStatementLike(1 | 2 | 4 | 8);
- }
- parseStatementListItem() {
- return this.parseStatementLike(2 | 4 | (!this.options.annexB || this.state.strict ? 0 : 8));
- }
- parseStatementOrSloppyAnnexBFunctionDeclaration(allowLabeledFunction = false) {
- let flags = 0;
- if (this.options.annexB && !this.state.strict) {
- flags |= 4;
- if (allowLabeledFunction) {
- flags |= 8;
- }
- }
- return this.parseStatementLike(flags);
- }
- parseStatement() {
- return this.parseStatementLike(0);
- }
- parseStatementLike(flags) {
- let decorators = null;
- if (this.match(26)) {
- decorators = this.parseDecorators(true);
- }
- return this.parseStatementContent(flags, decorators);
- }
- parseStatementContent(flags, decorators) {
- const startType = this.state.type;
- const node = this.startNode();
- const allowDeclaration = !!(flags & 2);
- const allowFunctionDeclaration = !!(flags & 4);
- const topLevel = flags & 1;
- switch (startType) {
- case 60:
- return this.parseBreakContinueStatement(node, true);
- case 63:
- return this.parseBreakContinueStatement(node, false);
- case 64:
- return this.parseDebuggerStatement(node);
- case 90:
- return this.parseDoWhileStatement(node);
- case 91:
- return this.parseForStatement(node);
- case 68:
- if (this.lookaheadCharCode() === 46) break;
- if (!allowFunctionDeclaration) {
- this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
- }
- return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
- case 80:
- if (!allowDeclaration) this.unexpected();
- return this.parseClass(this.maybeTakeDecorators(decorators, node), true);
- case 69:
- return this.parseIfStatement(node);
- case 70:
- return this.parseReturnStatement(node);
- case 71:
- return this.parseSwitchStatement(node);
- case 72:
- return this.parseThrowStatement(node);
- case 73:
- return this.parseTryStatement(node);
- case 96:
- if (!this.state.containsEsc && this.startsAwaitUsing()) {
- if (!this.recordAwaitIfAllowed()) {
- this.raise(Errors.AwaitUsingNotInAsyncContext, node);
- } else if (!allowDeclaration) {
- this.raise(Errors.UnexpectedLexicalDeclaration, node);
- }
- this.next();
- return this.parseVarStatement(node, "await using");
- }
- break;
- case 107:
- if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) {
- break;
- }
- this.expectPlugin("explicitResourceManagement");
- if (!this.scope.inModule && this.scope.inTopLevel) {
- this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
- } else if (!allowDeclaration) {
- this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
- }
- return this.parseVarStatement(node, "using");
- case 100:
- {
- if (this.state.containsEsc) {
- break;
- }
- const next = this.nextTokenStart();
- const nextCh = this.codePointAtPos(next);
- if (nextCh !== 91) {
- if (!allowDeclaration && this.hasFollowingLineBreak()) break;
- if (!this.chStartsBindingIdentifier(nextCh, next) && nextCh !== 123) {
- break;
- }
- }
- }
- case 75:
- {
- if (!allowDeclaration) {
- this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
- }
- }
- case 74:
- {
- const kind = this.state.value;
- return this.parseVarStatement(node, kind);
- }
- case 92:
- return this.parseWhileStatement(node);
- case 76:
- return this.parseWithStatement(node);
- case 5:
- return this.parseBlock();
- case 13:
- return this.parseEmptyStatement(node);
- case 83:
- {
- const nextTokenCharCode = this.lookaheadCharCode();
- if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
- break;
- }
- }
- case 82:
- {
- if (!(this.optionFlags & 8) && !topLevel) {
- this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
- }
- this.next();
- let result;
- if (startType === 83) {
- result = this.parseImport(node);
- } else {
- result = this.parseExport(node, decorators);
- }
- this.assertModuleNodeAllowed(result);
- return result;
- }
- default:
- {
- if (this.isAsyncFunction()) {
- if (!allowDeclaration) {
- this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
- }
- this.next();
- return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
- }
- }
- }
- const maybeName = this.state.value;
- const expr = this.parseExpression();
- if (tokenIsIdentifier(startType) && expr.type === "Identifier" && this.eat(14)) {
- return this.parseLabeledStatement(node, maybeName, expr, flags);
- } else {
- return this.parseExpressionStatement(node, expr, decorators);
- }
- }
- assertModuleNodeAllowed(node) {
- if (!(this.optionFlags & 8) && !this.inModule) {
- this.raise(Errors.ImportOutsideModule, node);
- }
- }
- decoratorsEnabledBeforeExport() {
- if (this.hasPlugin("decorators-legacy")) return true;
- return this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") !== false;
- }
- maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
- if (maybeDecorators) {
- var _classNode$decorators;
- if ((_classNode$decorators = classNode.decorators) != null && _classNode$decorators.length) {
- if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
- this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
- }
- classNode.decorators.unshift(...maybeDecorators);
- } else {
- classNode.decorators = maybeDecorators;
- }
- this.resetStartLocationFromNode(classNode, maybeDecorators[0]);
- if (exportNode) this.resetStartLocationFromNode(exportNode, classNode);
- }
- return classNode;
- }
- canHaveLeadingDecorator() {
- return this.match(80);
- }
- parseDecorators(allowExport) {
- const decorators = [];
- do {
- decorators.push(this.parseDecorator());
- } while (this.match(26));
- if (this.match(82)) {
- if (!allowExport) {
- this.unexpected();
- }
- if (!this.decoratorsEnabledBeforeExport()) {
- this.raise(Errors.DecoratorExportClass, this.state.startLoc);
- }
- } else if (!this.canHaveLeadingDecorator()) {
- throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
- }
- return decorators;
- }
- parseDecorator() {
- this.expectOnePlugin(["decorators", "decorators-legacy"]);
- const node = this.startNode();
- this.next();
- if (this.hasPlugin("decorators")) {
- const startLoc = this.state.startLoc;
- let expr;
- if (this.match(10)) {
- const startLoc = this.state.startLoc;
- this.next();
- expr = this.parseExpression();
- this.expect(11);
- expr = this.wrapParenthesis(startLoc, expr);
- const paramsStartLoc = this.state.startLoc;
- node.expression = this.parseMaybeDecoratorArguments(expr, startLoc);
- if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
- this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
- }
- } else {
- expr = this.parseIdentifier(false);
- while (this.eat(16)) {
- const node = this.startNodeAt(startLoc);
- node.object = expr;
- if (this.match(139)) {
- this.classScope.usePrivateName(this.state.value, this.state.startLoc);
- node.property = this.parsePrivateName();
- } else {
- node.property = this.parseIdentifier(true);
- }
- node.computed = false;
- expr = this.finishNode(node, "MemberExpression");
- }
- node.expression = this.parseMaybeDecoratorArguments(expr, startLoc);
- }
- } else {
- node.expression = this.parseExprSubscripts();
- }
- return this.finishNode(node, "Decorator");
- }
- parseMaybeDecoratorArguments(expr, startLoc) {
- if (this.eat(10)) {
- const node = this.startNodeAt(startLoc);
- node.callee = expr;
- node.arguments = this.parseCallExpressionArguments(11);
- this.toReferencedList(node.arguments);
- return this.finishNode(node, "CallExpression");
- }
- return expr;
- }
- parseBreakContinueStatement(node, isBreak) {
- this.next();
- if (this.isLineTerminator()) {
- node.label = null;
- } else {
- node.label = this.parseIdentifier();
- this.semicolon();
- }
- this.verifyBreakContinue(node, isBreak);
- return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
- }
- verifyBreakContinue(node, isBreak) {
- let i;
- for (i = 0; i < this.state.labels.length; ++i) {
- const lab = this.state.labels[i];
- if (node.label == null || lab.name === node.label.name) {
- if (lab.kind != null && (isBreak || lab.kind === 1)) {
- break;
- }
- if (node.label && isBreak) break;
- }
- }
- if (i === this.state.labels.length) {
- const type = isBreak ? "BreakStatement" : "ContinueStatement";
- this.raise(Errors.IllegalBreakContinue, node, {
- type
- });
- }
- }
- parseDebuggerStatement(node) {
- this.next();
- this.semicolon();
- return this.finishNode(node, "DebuggerStatement");
- }
- parseHeaderExpression() {
- this.expect(10);
- const val = this.parseExpression();
- this.expect(11);
- return val;
- }
- parseDoWhileStatement(node) {
- this.next();
- this.state.labels.push(loopLabel);
- node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
- this.state.labels.pop();
- this.expect(92);
- node.test = this.parseHeaderExpression();
- this.eat(13);
- return this.finishNode(node, "DoWhileStatement");
- }
- parseForStatement(node) {
- this.next();
- this.state.labels.push(loopLabel);
- let awaitAt = null;
- if (this.isContextual(96) && this.recordAwaitIfAllowed()) {
- awaitAt = this.state.startLoc;
- this.next();
- }
- this.scope.enter(0);
- this.expect(10);
- if (this.match(13)) {
- if (awaitAt !== null) {
- this.unexpected(awaitAt);
- }
- return this.parseFor(node, null);
- }
- const startsWithLet = this.isContextual(100);
- {
- const startsWithAwaitUsing = this.isContextual(96) && this.startsAwaitUsing();
- const starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.startsUsingForOf();
- const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
- if (this.match(74) || this.match(75) || isLetOrUsing) {
- const initNode = this.startNode();
- let kind;
- if (startsWithAwaitUsing) {
- kind = "await using";
- if (!this.recordAwaitIfAllowed()) {
- this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
- }
- this.next();
- } else {
- kind = this.state.value;
- }
- this.next();
- this.parseVar(initNode, true, kind);
- const init = this.finishNode(initNode, "VariableDeclaration");
- const isForIn = this.match(58);
- if (isForIn && starsWithUsingDeclaration) {
- this.raise(Errors.ForInUsing, init);
- }
- if ((isForIn || this.isContextual(102)) && init.declarations.length === 1) {
- return this.parseForIn(node, init, awaitAt);
- }
- if (awaitAt !== null) {
- this.unexpected(awaitAt);
- }
- return this.parseFor(node, init);
- }
- }
- const startsWithAsync = this.isContextual(95);
- const refExpressionErrors = new ExpressionErrors();
- const init = this.parseExpression(true, refExpressionErrors);
- const isForOf = this.isContextual(102);
- if (isForOf) {
- if (startsWithLet) {
- this.raise(Errors.ForOfLet, init);
- }
- if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
- this.raise(Errors.ForOfAsync, init);
- }
- }
- if (isForOf || this.match(58)) {
- this.checkDestructuringPrivate(refExpressionErrors);
- this.toAssignable(init, true);
- const type = isForOf ? "ForOfStatement" : "ForInStatement";
- this.checkLVal(init, {
- type
- });
- return this.parseForIn(node, init, awaitAt);
- } else {
- this.checkExpressionErrors(refExpressionErrors, true);
- }
- if (awaitAt !== null) {
- this.unexpected(awaitAt);
- }
- return this.parseFor(node, init);
- }
- parseFunctionStatement(node, isAsync, isHangingDeclaration) {
- this.next();
- return this.parseFunction(node, 1 | (isHangingDeclaration ? 2 : 0) | (isAsync ? 8 : 0));
- }
- parseIfStatement(node) {
- this.next();
- node.test = this.parseHeaderExpression();
- node.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration();
- node.alternate = this.eat(66) ? this.parseStatementOrSloppyAnnexBFunctionDeclaration() : null;
- return this.finishNode(node, "IfStatement");
- }
- parseReturnStatement(node) {
- if (!this.prodParam.hasReturn && !(this.optionFlags & 2)) {
- this.raise(Errors.IllegalReturn, this.state.startLoc);
- }
- this.next();
- if (this.isLineTerminator()) {
- node.argument = null;
- } else {
- node.argument = this.parseExpression();
- this.semicolon();
- }
- return this.finishNode(node, "ReturnStatement");
- }
- parseSwitchStatement(node) {
- this.next();
- node.discriminant = this.parseHeaderExpression();
- const cases = node.cases = [];
- this.expect(5);
- this.state.labels.push(switchLabel);
- this.scope.enter(0);
- let cur;
- for (let sawDefault; !this.match(8);) {
- if (this.match(61) || this.match(65)) {
- const isCase = this.match(61);
- if (cur) this.finishNode(cur, "SwitchCase");
- cases.push(cur = this.startNode());
- cur.consequent = [];
- this.next();
- if (isCase) {
- cur.test = this.parseExpression();
- } else {
- if (sawDefault) {
- this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
- }
- sawDefault = true;
- cur.test = null;
- }
- this.expect(14);
- } else {
- if (cur) {
- cur.consequent.push(this.parseStatementListItem());
- } else {
- this.unexpected();
- }
- }
- }
- this.scope.exit();
- if (cur) this.finishNode(cur, "SwitchCase");
- this.next();
- this.state.labels.pop();
- return this.finishNode(node, "SwitchStatement");
- }
- parseThrowStatement(node) {
- this.next();
- if (this.hasPrecedingLineBreak()) {
- this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
- }
- node.argument = this.parseExpression();
- this.semicolon();
- return this.finishNode(node, "ThrowStatement");
- }
- parseCatchClauseParam() {
- const param = this.parseBindingAtom();
- this.scope.enter(this.options.annexB && param.type === "Identifier" ? 8 : 0);
- this.checkLVal(param, {
- type: "CatchClause"
- }, 9);
- return param;
- }
- parseTryStatement(node) {
- this.next();
- node.block = this.parseBlock();
- node.handler = null;
- if (this.match(62)) {
- const clause = this.startNode();
- this.next();
- if (this.match(10)) {
- this.expect(10);
- clause.param = this.parseCatchClauseParam();
- this.expect(11);
- } else {
- clause.param = null;
- this.scope.enter(0);
- }
- clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false));
- this.scope.exit();
- node.handler = this.finishNode(clause, "CatchClause");
- }
- node.finalizer = this.eat(67) ? this.parseBlock() : null;
- if (!node.handler && !node.finalizer) {
- this.raise(Errors.NoCatchOrFinally, node);
- }
- return this.finishNode(node, "TryStatement");
- }
- parseVarStatement(node, kind, allowMissingInitializer = false) {
- this.next();
- this.parseVar(node, false, kind, allowMissingInitializer);
- this.semicolon();
- return this.finishNode(node, "VariableDeclaration");
- }
- parseWhileStatement(node) {
- this.next();
- node.test = this.parseHeaderExpression();
- this.state.labels.push(loopLabel);
- node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
- this.state.labels.pop();
- return this.finishNode(node, "WhileStatement");
- }
- parseWithStatement(node) {
- if (this.state.strict) {
- this.raise(Errors.StrictWith, this.state.startLoc);
- }
- this.next();
- node.object = this.parseHeaderExpression();
- node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
- return this.finishNode(node, "WithStatement");
- }
- parseEmptyStatement(node) {
- this.next();
- return this.finishNode(node, "EmptyStatement");
- }
- parseLabeledStatement(node, maybeName, expr, flags) {
- for (const label of this.state.labels) {
- if (label.name === maybeName) {
- this.raise(Errors.LabelRedeclaration, expr, {
- labelName: maybeName
- });
- }
- }
- const kind = tokenIsLoop(this.state.type) ? 1 : this.match(71) ? 2 : null;
- for (let i = this.state.labels.length - 1; i >= 0; i--) {
- const label = this.state.labels[i];
- if (label.statementStart === node.start) {
- label.statementStart = this.sourceToOffsetPos(this.state.start);
- label.kind = kind;
- } else {
- break;
- }
- }
- this.state.labels.push({
- name: maybeName,
- kind: kind,
- statementStart: this.sourceToOffsetPos(this.state.start)
- });
- node.body = flags & 8 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement();
- this.state.labels.pop();
- node.label = expr;
- return this.finishNode(node, "LabeledStatement");
- }
- parseExpressionStatement(node, expr, decorators) {
- node.expression = expr;
- this.semicolon();
- return this.finishNode(node, "ExpressionStatement");
- }
- parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) {
- const node = this.startNode();
- if (allowDirectives) {
- this.state.strictErrors.clear();
- }
- this.expect(5);
- if (createNewLexicalScope) {
- this.scope.enter(0);
- }
- this.parseBlockBody(node, allowDirectives, false, 8, afterBlockParse);
- if (createNewLexicalScope) {
- this.scope.exit();
- }
- return this.finishNode(node, "BlockStatement");
- }
- isValidDirective(stmt) {
- return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
- }
- parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
- const body = node.body = [];
- const directives = node.directives = [];
- this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse);
- }
- parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) {
- const oldStrict = this.state.strict;
- let hasStrictModeDirective = false;
- let parsedNonDirective = false;
- while (!this.match(end)) {
- const stmt = topLevel ? this.parseModuleItem() : this.parseStatementListItem();
- if (directives && !parsedNonDirective) {
- if (this.isValidDirective(stmt)) {
- const directive = this.stmtToDirective(stmt);
- directives.push(directive);
- if (!hasStrictModeDirective && directive.value.value === "use strict") {
- hasStrictModeDirective = true;
- this.setStrict(true);
- }
- continue;
- }
- parsedNonDirective = true;
- this.state.strictErrors.clear();
- }
- body.push(stmt);
- }
- afterBlockParse == null || afterBlockParse.call(this, hasStrictModeDirective);
- if (!oldStrict) {
- this.setStrict(false);
- }
- this.next();
- }
- parseFor(node, init) {
- node.init = init;
- this.semicolon(false);
- node.test = this.match(13) ? null : this.parseExpression();
- this.semicolon(false);
- node.update = this.match(11) ? null : this.parseExpression();
- this.expect(11);
- node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
- this.scope.exit();
- this.state.labels.pop();
- return this.finishNode(node, "ForStatement");
- }
- parseForIn(node, init, awaitAt) {
- const isForIn = this.match(58);
- this.next();
- if (isForIn) {
- if (awaitAt !== null) this.unexpected(awaitAt);
- } else {
- node.await = awaitAt !== null;
- }
- if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
- this.raise(Errors.ForInOfLoopInitializer, init, {
- type: isForIn ? "ForInStatement" : "ForOfStatement"
- });
- }
- if (init.type === "AssignmentPattern") {
- this.raise(Errors.InvalidLhs, init, {
- ancestor: {
- type: "ForStatement"
- }
- });
- }
- node.left = init;
- node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn();
- this.expect(11);
- node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
- this.scope.exit();
- this.state.labels.pop();
- return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
- }
- parseVar(node, isFor, kind, allowMissingInitializer = false) {
- const declarations = node.declarations = [];
- node.kind = kind;
- for (;;) {
- const decl = this.startNode();
- this.parseVarId(decl, kind);
- decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
- if (decl.init === null && !allowMissingInitializer) {
- if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
- this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
- kind: "destructuring"
- });
- } else if ((kind === "const" || kind === "using" || kind === "await using") && !(this.match(58) || this.isContextual(102))) {
- this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
- kind
- });
- }
- }
- declarations.push(this.finishNode(decl, "VariableDeclarator"));
- if (!this.eat(12)) break;
- }
- return node;
- }
- parseVarId(decl, kind) {
- const id = this.parseBindingAtom();
- if (kind === "using" || kind === "await using") {
- if (id.type === "ArrayPattern" || id.type === "ObjectPattern") {
- this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start);
- }
- }
- this.checkLVal(id, {
- type: "VariableDeclarator"
- }, kind === "var" ? 5 : 8201);
- decl.id = id;
- }
- parseAsyncFunctionExpression(node) {
- return this.parseFunction(node, 8);
- }
- parseFunction(node, flags = 0) {
- const hangingDeclaration = flags & 2;
- const isDeclaration = !!(flags & 1);
- const requireId = isDeclaration && !(flags & 4);
- const isAsync = !!(flags & 8);
- this.initFunction(node, isAsync);
- if (this.match(55)) {
- if (hangingDeclaration) {
- this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
- }
- this.next();
- node.generator = true;
- }
- if (isDeclaration) {
- node.id = this.parseFunctionId(requireId);
- }
- const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
- this.state.maybeInArrowParameters = false;
- this.scope.enter(2);
- this.prodParam.enter(functionFlags(isAsync, node.generator));
- if (!isDeclaration) {
- node.id = this.parseFunctionId();
- }
- this.parseFunctionParams(node, false);
- this.withSmartMixTopicForbiddingContext(() => {
- this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
- });
- this.prodParam.exit();
- this.scope.exit();
- if (isDeclaration && !hangingDeclaration) {
- this.registerFunctionStatementId(node);
+}
+function ensureCallbackArrays(obj) {
+ if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter];
+ if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit];
+}
+function wrapCheck(nodeType, fn) {
+ const newFn = function (path) {
+ if (path[`is${nodeType}`]()) {
+ return fn.apply(this, arguments);
}
- this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
- return node;
- }
- parseFunctionId(requireId) {
- return requireId || tokenIsIdentifier(this.state.type) ? this.parseIdentifier() : null;
- }
- parseFunctionParams(node, isConstructor) {
- this.expect(10);
- this.expressionScope.enter(newParameterDeclarationScope());
- node.params = this.parseBindingList(11, 41, 2 | (isConstructor ? 4 : 0));
- this.expressionScope.exit();
- }
- registerFunctionStatementId(node) {
- if (!node.id) return;
- this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, node.id.loc.start);
- }
- parseClass(node, isStatement, optionalId) {
- this.next();
- const oldStrict = this.state.strict;
- this.state.strict = true;
- this.parseClassId(node, isStatement, optionalId);
- this.parseClassSuper(node);
- node.body = this.parseClassBody(!!node.superClass, oldStrict);
- return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
- }
- isClassProperty() {
- return this.match(29) || this.match(13) || this.match(8);
- }
- isClassMethod() {
- return this.match(10);
- }
- nameIsConstructor(key) {
- return key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor";
- }
- isNonstaticConstructor(method) {
- return !method.computed && !method.static && this.nameIsConstructor(method.key);
+ };
+ newFn.toString = () => fn.toString();
+ return newFn;
+}
+function shouldIgnoreKey(key) {
+ if (key[0] === "_") return true;
+ if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
+ if (key === "denylist" || key === "noScope" || key === "skipKeys") {
+ return true;
}
- parseClassBody(hadSuperClass, oldStrict) {
- this.classScope.enter();
- const state = {
- hadConstructor: false,
- hadSuperClass
- };
- let decorators = [];
- const classBody = this.startNode();
- classBody.body = [];
- this.expect(5);
- this.withSmartMixTopicForbiddingContext(() => {
- while (!this.match(8)) {
- if (this.eat(13)) {
- if (decorators.length > 0) {
- throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
- }
- continue;
- }
- if (this.match(26)) {
- decorators.push(this.parseDecorator());
- continue;
- }
- const member = this.startNode();
- if (decorators.length) {
- member.decorators = decorators;
- this.resetStartLocationFromNode(member, decorators[0]);
- decorators = [];
- }
- this.parseClassMember(classBody, member, state);
- if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
- this.raise(Errors.DecoratorConstructor, member);
- }
- }
- });
- this.state.strict = oldStrict;
- this.next();
- if (decorators.length) {
- throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
- }
- this.classScope.exit();
- return this.finishNode(classBody, "ClassBody");
- }
- parseClassMemberFromModifier(classBody, member) {
- const key = this.parseIdentifier(true);
- if (this.isClassMethod()) {
- const method = member;
- method.kind = "method";
- method.computed = false;
- method.key = key;
- method.static = false;
- this.pushClassMethod(classBody, method, false, false, false, false);
- return true;
- } else if (this.isClassProperty()) {
- const prop = member;
- prop.computed = false;
- prop.key = key;
- prop.static = false;
- classBody.body.push(this.parseClassProperty(prop));
+ {
+ if (key === "blacklist") {
return true;
}
- this.resetPreviousNodeTrailingComments(key);
- return false;
- }
- parseClassMember(classBody, member, state) {
- const isStatic = this.isContextual(106);
- if (isStatic) {
- if (this.parseClassMemberFromModifier(classBody, member)) {
- return;
- }
- if (this.eat(5)) {
- this.parseClassStaticBlock(classBody, member);
- return;
- }
- }
- this.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
- }
- parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
- const publicMethod = member;
- const privateMethod = member;
- const publicProp = member;
- const privateProp = member;
- const accessorProp = member;
- const method = publicMethod;
- const publicMember = publicMethod;
- member.static = isStatic;
- this.parsePropertyNamePrefixOperator(member);
- if (this.eat(55)) {
- method.kind = "method";
- const isPrivateName = this.match(139);
- this.parseClassElementName(method);
- if (isPrivateName) {
- this.pushClassPrivateMethod(classBody, privateMethod, true, false);
- return;
- }
- if (this.isNonstaticConstructor(publicMethod)) {
- this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
- }
- this.pushClassMethod(classBody, publicMethod, true, false, false, false);
- return;
- }
- const isContextual = !this.state.containsEsc && tokenIsIdentifier(this.state.type);
- const key = this.parseClassElementName(member);
- const maybeContextualKw = isContextual ? key.name : null;
- const isPrivate = this.isPrivateName(key);
- const maybeQuestionTokenStartLoc = this.state.startLoc;
- this.parsePostMemberNameModifiers(publicMember);
- if (this.isClassMethod()) {
- method.kind = "method";
- if (isPrivate) {
- this.pushClassPrivateMethod(classBody, privateMethod, false, false);
- return;
- }
- const isConstructor = this.isNonstaticConstructor(publicMethod);
- let allowsDirectSuper = false;
- if (isConstructor) {
- publicMethod.kind = "constructor";
- if (state.hadConstructor && !this.hasPlugin("typescript")) {
- this.raise(Errors.DuplicateConstructor, key);
- }
- if (isConstructor && this.hasPlugin("typescript") && member.override) {
- this.raise(Errors.OverrideOnConstructor, key);
- }
- state.hadConstructor = true;
- allowsDirectSuper = state.hadSuperClass;
- }
- this.pushClassMethod(classBody, publicMethod, false, false, isConstructor, allowsDirectSuper);
- } else if (this.isClassProperty()) {
- if (isPrivate) {
- this.pushClassPrivateProperty(classBody, privateProp);
- } else {
- this.pushClassProperty(classBody, publicProp);
- }
- } else if (maybeContextualKw === "async" && !this.isLineTerminator()) {
- this.resetPreviousNodeTrailingComments(key);
- const isGenerator = this.eat(55);
- if (publicMember.optional) {
- this.unexpected(maybeQuestionTokenStartLoc);
- }
- method.kind = "method";
- const isPrivate = this.match(139);
- this.parseClassElementName(method);
- this.parsePostMemberNameModifiers(publicMember);
- if (isPrivate) {
- this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
- } else {
- if (this.isNonstaticConstructor(publicMethod)) {
- this.raise(Errors.ConstructorIsAsync, publicMethod.key);
- }
- this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
- }
- } else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
- this.resetPreviousNodeTrailingComments(key);
- method.kind = maybeContextualKw;
- const isPrivate = this.match(139);
- this.parseClassElementName(publicMethod);
- if (isPrivate) {
- this.pushClassPrivateMethod(classBody, privateMethod, false, false);
- } else {
- if (this.isNonstaticConstructor(publicMethod)) {
- this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
- }
- this.pushClassMethod(classBody, publicMethod, false, false, false, false);
- }
- this.checkGetterSetterParams(publicMethod);
- } else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
- this.expectPlugin("decoratorAutoAccessors");
- this.resetPreviousNodeTrailingComments(key);
- const isPrivate = this.match(139);
- this.parseClassElementName(publicProp);
- this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
- } else if (this.isLineTerminator()) {
- if (isPrivate) {
- this.pushClassPrivateProperty(classBody, privateProp);
- } else {
- this.pushClassProperty(classBody, publicProp);
- }
- } else {
- this.unexpected();
- }
}
- parseClassElementName(member) {
- const {
- type,
- value
- } = this.state;
- if ((type === 132 || type === 134) && member.static && value === "prototype") {
- this.raise(Errors.StaticPrototype, this.state.startLoc);
- }
- if (type === 139) {
- if (value === "constructor") {
- this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
- }
- const key = this.parsePrivateName();
- member.key = key;
- return key;
- }
- this.parsePropertyName(member);
- return member.key;
- }
- parseClassStaticBlock(classBody, member) {
- var _member$decorators;
- this.scope.enter(64 | 128 | 16);
- const oldLabels = this.state.labels;
- this.state.labels = [];
- this.prodParam.enter(0);
- const body = member.body = [];
- this.parseBlockOrModuleBlockBody(body, undefined, false, 8);
- this.prodParam.exit();
- this.scope.exit();
- this.state.labels = oldLabels;
- classBody.body.push(this.finishNode(member, "StaticBlock"));
- if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
- this.raise(Errors.DecoratorStaticBlock, member);
- }
- }
- pushClassProperty(classBody, prop) {
- if (!prop.computed && this.nameIsConstructor(prop.key)) {
- this.raise(Errors.ConstructorClassField, prop.key);
- }
- classBody.body.push(this.parseClassProperty(prop));
- }
- pushClassPrivateProperty(classBody, prop) {
- const node = this.parseClassPrivateProperty(prop);
- classBody.body.push(node);
- this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
- }
- pushClassAccessorProperty(classBody, prop, isPrivate) {
- if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
- this.raise(Errors.ConstructorClassField, prop.key);
- }
- const node = this.parseClassAccessorProperty(prop);
- classBody.body.push(node);
- if (isPrivate) {
- this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
- }
- }
- pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
- classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true));
- }
- pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
- const node = this.parseMethod(method, isGenerator, isAsync, false, false, "ClassPrivateMethod", true);
- classBody.body.push(node);
- const kind = node.kind === "get" ? node.static ? 6 : 2 : node.kind === "set" ? node.static ? 5 : 1 : 0;
- this.declareClassPrivateMethodInScope(node, kind);
- }
- declareClassPrivateMethodInScope(node, kind) {
- this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start);
- }
- parsePostMemberNameModifiers(methodOrProp) {}
- parseClassPrivateProperty(node) {
- this.parseInitializer(node);
- this.semicolon();
- return this.finishNode(node, "ClassPrivateProperty");
- }
- parseClassProperty(node) {
- this.parseInitializer(node);
- this.semicolon();
- return this.finishNode(node, "ClassProperty");
- }
- parseClassAccessorProperty(node) {
- this.parseInitializer(node);
- this.semicolon();
- return this.finishNode(node, "ClassAccessorProperty");
- }
- parseInitializer(node) {
- this.scope.enter(64 | 16);
- this.expressionScope.enter(newExpressionScope());
- this.prodParam.enter(0);
- node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
- this.expressionScope.exit();
- this.prodParam.exit();
- this.scope.exit();
- }
- parseClassId(node, isStatement, optionalId, bindingType = 8331) {
- if (tokenIsIdentifier(this.state.type)) {
- node.id = this.parseIdentifier();
- if (isStatement) {
- this.declareNameFromIdentifier(node.id, bindingType);
- }
- } else {
- if (optionalId || !isStatement) {
- node.id = null;
- } else {
- throw this.raise(Errors.MissingClassName, this.state.startLoc);
- }
- }
+ return false;
+}
+function mergePair(dest, src) {
+ for (const phase of ["enter", "exit"]) {
+ if (!src[phase]) continue;
+ dest[phase] = [].concat(dest[phase] || [], src[phase]);
}
- parseClassSuper(node) {
- node.superClass = this.eat(81) ? this.parseExprSubscripts() : null;
+}
+
+//# sourceMappingURL=visitors.js.map
+
+
+/***/ }),
+
+/***/ 3111:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = assertNode;
+var _isNode = __nccwpck_require__(8520);
+function assertNode(node) {
+ if (!(0, _isNode.default)(node)) {
+ var _node$type;
+ const type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node);
+ throw new TypeError(`Not a valid node of type "${type}"`);
}
- parseExport(node, decorators) {
- const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, true);
- const hasDefault = this.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
- const parseAfterDefault = !hasDefault || this.eat(12);
- const hasStar = parseAfterDefault && this.eatExportStar(node);
- const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
- const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(12));
- const isFromRequired = hasDefault || hasStar;
- if (hasStar && !hasNamespace) {
- if (hasDefault) this.unexpected();
- if (decorators) {
- throw this.raise(Errors.UnsupportedDecoratorExport, node);
- }
- this.parseExportFrom(node, true);
- this.sawUnambiguousESM = true;
- return this.finishNode(node, "ExportAllDeclaration");
- }
- const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
- if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) {
- this.unexpected(null, 5);
- }
- if (hasNamespace && parseAfterNamespace) {
- this.unexpected(null, 98);
- }
- let hasDeclaration;
- if (isFromRequired || hasSpecifiers) {
- hasDeclaration = false;
- if (decorators) {
- throw this.raise(Errors.UnsupportedDecoratorExport, node);
- }
- this.parseExportFrom(node, isFromRequired);
- } else {
- hasDeclaration = this.maybeParseExportDeclaration(node);
- }
- if (isFromRequired || hasSpecifiers || hasDeclaration) {
- var _node2$declaration;
- const node2 = node;
- this.checkExport(node2, true, false, !!node2.source);
- if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
- this.maybeTakeDecorators(decorators, node2.declaration, node2);
- } else if (decorators) {
- throw this.raise(Errors.UnsupportedDecoratorExport, node);
- }
- this.sawUnambiguousESM = true;
- return this.finishNode(node2, "ExportNamedDeclaration");
- }
- if (this.eat(65)) {
- const node2 = node;
- const decl = this.parseExportDefaultExpression();
- node2.declaration = decl;
- if (decl.type === "ClassDeclaration") {
- this.maybeTakeDecorators(decorators, decl, node2);
- } else if (decorators) {
- throw this.raise(Errors.UnsupportedDecoratorExport, node);
- }
- this.checkExport(node2, true, true);
- this.sawUnambiguousESM = true;
- return this.finishNode(node2, "ExportDefaultDeclaration");
- }
- this.unexpected(null, 5);
- }
- eatExportStar(node) {
- return this.eat(55);
- }
- maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
- if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) {
- this.expectPlugin("exportDefaultFrom", maybeDefaultIdentifier == null ? void 0 : maybeDefaultIdentifier.loc.start);
- const id = maybeDefaultIdentifier || this.parseIdentifier(true);
- const specifier = this.startNodeAtNode(id);
- specifier.exported = id;
- node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
- return true;
- }
- return false;
- }
- maybeParseExportNamespaceSpecifier(node) {
- if (this.isContextual(93)) {
- var _ref, _ref$specifiers;
- (_ref$specifiers = (_ref = node).specifiers) != null ? _ref$specifiers : _ref.specifiers = [];
- const specifier = this.startNodeAt(this.state.lastTokStartLoc);
- this.next();
- specifier.exported = this.parseModuleExportName();
- node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"));
- return true;
- }
- return false;
- }
- maybeParseExportNamedSpecifiers(node) {
- if (this.match(5)) {
- const node2 = node;
- if (!node2.specifiers) node2.specifiers = [];
- const isTypeExport = node2.exportKind === "type";
- node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
- node2.source = null;
- if (this.hasPlugin("importAssertions")) {
- node2.assertions = [];
- } else {
- node2.attributes = [];
- }
- node2.declaration = null;
- return true;
- }
- return false;
- }
- maybeParseExportDeclaration(node) {
- if (this.shouldParseExportDeclaration()) {
- node.specifiers = [];
- node.source = null;
- if (this.hasPlugin("importAssertions")) {
- node.assertions = [];
- } else {
- node.attributes = [];
- }
- node.declaration = this.parseExportDeclaration(node);
- return true;
- }
- return false;
- }
- isAsyncFunction() {
- if (!this.isContextual(95)) return false;
- const next = this.nextTokenInLineStart();
- return this.isUnparsedContextual(next, "function");
- }
- parseExportDefaultExpression() {
- const expr = this.startNode();
- if (this.match(68)) {
- this.next();
- return this.parseFunction(expr, 1 | 4);
- } else if (this.isAsyncFunction()) {
- this.next();
- this.next();
- return this.parseFunction(expr, 1 | 4 | 8);
- }
- if (this.match(80)) {
- return this.parseClass(expr, true, true);
- }
- if (this.match(26)) {
- if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
- this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
- }
- return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
- }
- if (this.match(75) || this.match(74) || this.isLet()) {
- throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
- }
- const res = this.parseMaybeAssignAllowIn();
- this.semicolon();
- return res;
- }
- parseExportDeclaration(node) {
- if (this.match(80)) {
- const node = this.parseClass(this.startNode(), true, false);
- return node;
- }
- return this.parseStatementListItem();
- }
- isExportDefaultSpecifier() {
- const {
- type
- } = this.state;
- if (tokenIsIdentifier(type)) {
- if (type === 95 && !this.state.containsEsc || type === 100) {
- return false;
- }
- if ((type === 130 || type === 129) && !this.state.containsEsc) {
- const {
- type: nextType
- } = this.lookahead();
- if (tokenIsIdentifier(nextType) && nextType !== 98 || nextType === 5) {
- this.expectOnePlugin(["flow", "typescript"]);
- return false;
- }
- }
- } else if (!this.match(65)) {
- return false;
- }
- const next = this.nextTokenStart();
- const hasFrom = this.isUnparsedContextual(next, "from");
- if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.state.type) && hasFrom) {
- return true;
- }
- if (this.match(65) && hasFrom) {
- const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
- return nextAfterFrom === 34 || nextAfterFrom === 39;
- }
- return false;
- }
- parseExportFrom(node, expect) {
- if (this.eatContextual(98)) {
- node.source = this.parseImportSource();
- this.checkExport(node);
- this.maybeParseImportAttributes(node);
- this.checkJSONModuleImport(node);
- } else if (expect) {
- this.unexpected();
- }
- this.semicolon();
- }
- shouldParseExportDeclaration() {
- const {
- type
- } = this.state;
- if (type === 26) {
- this.expectOnePlugin(["decorators", "decorators-legacy"]);
- if (this.hasPlugin("decorators")) {
- if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
- this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
- }
- return true;
- }
- }
- if (this.isContextual(107)) {
- this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
- return true;
- }
- if (this.isContextual(96) && this.startsAwaitUsing()) {
- this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
- return true;
- }
- return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
- }
- checkExport(node, checkNames, isDefault, isFrom) {
- if (checkNames) {
- var _node$specifiers;
- if (isDefault) {
- this.checkDuplicateExports(node, "default");
- if (this.hasPlugin("exportDefaultFrom")) {
- var _declaration$extra;
- const declaration = node.declaration;
- if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
- this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
- }
- }
- } else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
- for (const specifier of node.specifiers) {
- const {
- exported
- } = specifier;
- const exportName = exported.type === "Identifier" ? exported.name : exported.value;
- this.checkDuplicateExports(specifier, exportName);
- if (!isFrom && specifier.local) {
- const {
- local
- } = specifier;
- if (local.type !== "Identifier") {
- this.raise(Errors.ExportBindingIsString, specifier, {
- localName: local.value,
- exportName
- });
- } else {
- this.checkReservedWord(local.name, local.loc.start, true, false);
- this.scope.checkLocalExport(local);
- }
- }
- }
- } else if (node.declaration) {
- const decl = node.declaration;
- if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
- const {
- id
- } = decl;
- if (!id) throw new Error("Assertion failure");
- this.checkDuplicateExports(node, id.name);
- } else if (decl.type === "VariableDeclaration") {
- for (const declaration of decl.declarations) {
- this.checkDeclaration(declaration.id);
- }
- }
- }
- }
- }
- checkDeclaration(node) {
- if (node.type === "Identifier") {
- this.checkDuplicateExports(node, node.name);
- } else if (node.type === "ObjectPattern") {
- for (const prop of node.properties) {
- this.checkDeclaration(prop);
- }
- } else if (node.type === "ArrayPattern") {
- for (const elem of node.elements) {
- if (elem) {
- this.checkDeclaration(elem);
- }
- }
- } else if (node.type === "ObjectProperty") {
- this.checkDeclaration(node.value);
- } else if (node.type === "RestElement") {
- this.checkDeclaration(node.argument);
- } else if (node.type === "AssignmentPattern") {
- this.checkDeclaration(node.left);
- }
- }
- checkDuplicateExports(node, exportName) {
- if (this.exportedIdentifiers.has(exportName)) {
- if (exportName === "default") {
- this.raise(Errors.DuplicateDefaultExport, node);
- } else {
- this.raise(Errors.DuplicateExport, node, {
- exportName
- });
- }
- }
- this.exportedIdentifiers.add(exportName);
- }
- parseExportSpecifiers(isInTypeExport) {
- const nodes = [];
- let first = true;
- this.expect(5);
- while (!this.eat(8)) {
- if (first) {
- first = false;
- } else {
- this.expect(12);
- if (this.eat(8)) break;
- }
- const isMaybeTypeOnly = this.isContextual(130);
- const isString = this.match(134);
- const node = this.startNode();
- node.local = this.parseModuleExportName();
- nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
- }
- return nodes;
- }
- parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
- if (this.eatContextual(93)) {
- node.exported = this.parseModuleExportName();
- } else if (isString) {
- node.exported = cloneStringLiteral(node.local);
- } else if (!node.exported) {
- node.exported = cloneIdentifier(node.local);
- }
- return this.finishNode(node, "ExportSpecifier");
- }
- parseModuleExportName() {
- if (this.match(134)) {
- const result = this.parseStringLiteral(this.state.value);
- const surrogate = loneSurrogate.exec(result.value);
- if (surrogate) {
- this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
- surrogateCharCode: surrogate[0].charCodeAt(0)
- });
- }
- return result;
- }
- return this.parseIdentifier(true);
- }
- isJSONModuleImport(node) {
- if (node.assertions != null) {
- return node.assertions.some(({
- key,
- value
- }) => {
- return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type");
- });
- }
- return false;
- }
- checkImportReflection(node) {
- const {
- specifiers
- } = node;
- const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
- if (node.phase === "source") {
- if (singleBindingType !== "ImportDefaultSpecifier") {
- this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
- }
- } else if (node.phase === "defer") {
- if (singleBindingType !== "ImportNamespaceSpecifier") {
- this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
- }
- } else if (node.module) {
- var _node$assertions;
- if (singleBindingType !== "ImportDefaultSpecifier") {
- this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
- }
- if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
- this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
- }
- }
- }
- checkJSONModuleImport(node) {
- if (this.isJSONModuleImport(node) && node.type !== "ExportAllDeclaration") {
- const {
- specifiers
- } = node;
- if (specifiers != null) {
- const nonDefaultNamedSpecifier = specifiers.find(specifier => {
- let imported;
- if (specifier.type === "ExportSpecifier") {
- imported = specifier.local;
- } else if (specifier.type === "ImportSpecifier") {
- imported = specifier.imported;
- }
- if (imported !== undefined) {
- return imported.type === "Identifier" ? imported.name !== "default" : imported.value !== "default";
- }
- });
- if (nonDefaultNamedSpecifier !== undefined) {
- this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
- }
- }
- }
- }
- isPotentialImportPhase(isExport) {
- if (isExport) return false;
- return this.isContextual(105) || this.isContextual(97) || this.isContextual(127);
- }
- applyImportPhase(node, isExport, phase, loc) {
- if (isExport) {
- return;
- }
- if (phase === "module") {
- this.expectPlugin("importReflection", loc);
- node.module = true;
- } else if (this.hasPlugin("importReflection")) {
- node.module = false;
- }
- if (phase === "source") {
- this.expectPlugin("sourcePhaseImports", loc);
- node.phase = "source";
- } else if (phase === "defer") {
- this.expectPlugin("deferredImportEvaluation", loc);
- node.phase = "defer";
- } else if (this.hasPlugin("sourcePhaseImports")) {
- node.phase = null;
- }
- }
- parseMaybeImportPhase(node, isExport) {
- if (!this.isPotentialImportPhase(isExport)) {
- this.applyImportPhase(node, isExport, null);
- return null;
- }
- const phaseIdentifier = this.parseIdentifier(true);
- const {
- type
- } = this.state;
- const isImportPhase = tokenIsKeywordOrIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
- if (isImportPhase) {
- this.resetPreviousIdentifierLeadingComments(phaseIdentifier);
- this.applyImportPhase(node, isExport, phaseIdentifier.name, phaseIdentifier.loc.start);
- return null;
- } else {
- this.applyImportPhase(node, isExport, null);
- return phaseIdentifier;
- }
- }
- isPrecedingIdImportPhase(phase) {
- const {
- type
- } = this.state;
- return tokenIsIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
- }
- parseImport(node) {
- if (this.match(134)) {
- return this.parseImportSourceAndAttributes(node);
- }
- return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
- }
- parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier) {
- node.specifiers = [];
- const hasDefault = this.maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier);
- const parseNext = !hasDefault || this.eat(12);
- const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
- if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
- this.expectContextual(98);
- return this.parseImportSourceAndAttributes(node);
- }
- parseImportSourceAndAttributes(node) {
- var _node$specifiers2;
- (_node$specifiers2 = node.specifiers) != null ? _node$specifiers2 : node.specifiers = [];
- node.source = this.parseImportSource();
- this.maybeParseImportAttributes(node);
- this.checkImportReflection(node);
- this.checkJSONModuleImport(node);
- this.semicolon();
- this.sawUnambiguousESM = true;
- return this.finishNode(node, "ImportDeclaration");
- }
- parseImportSource() {
- if (!this.match(134)) this.unexpected();
- return this.parseExprAtom();
- }
- parseImportSpecifierLocal(node, specifier, type) {
- specifier.local = this.parseIdentifier();
- node.specifiers.push(this.finishImportSpecifier(specifier, type));
- }
- finishImportSpecifier(specifier, type, bindingType = 8201) {
- this.checkLVal(specifier.local, {
- type
- }, bindingType);
- return this.finishNode(specifier, type);
- }
- parseImportAttributes() {
- this.expect(5);
- const attrs = [];
- const attrNames = new Set();
- do {
- if (this.match(8)) {
- break;
- }
- const node = this.startNode();
- const keyName = this.state.value;
- if (attrNames.has(keyName)) {
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
- key: keyName
- });
- }
- attrNames.add(keyName);
- if (this.match(134)) {
- node.key = this.parseStringLiteral(keyName);
- } else {
- node.key = this.parseIdentifier(true);
- }
- this.expect(14);
- if (!this.match(134)) {
- throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
- }
- node.value = this.parseStringLiteral(this.state.value);
- attrs.push(this.finishNode(node, "ImportAttribute"));
- } while (this.eat(12));
- this.expect(8);
- return attrs;
- }
- parseModuleAttributes() {
- const attrs = [];
- const attributes = new Set();
- do {
- const node = this.startNode();
- node.key = this.parseIdentifier(true);
- if (node.key.name !== "type") {
- this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
- }
- if (attributes.has(node.key.name)) {
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
- key: node.key.name
- });
- }
- attributes.add(node.key.name);
- this.expect(14);
- if (!this.match(134)) {
- throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
- }
- node.value = this.parseStringLiteral(this.state.value);
- attrs.push(this.finishNode(node, "ImportAttribute"));
- } while (this.eat(12));
- return attrs;
- }
- maybeParseImportAttributes(node) {
- let attributes;
- {
- var useWith = false;
- }
- if (this.match(76)) {
- if (this.hasPrecedingLineBreak() && this.lookaheadCharCode() === 40) {
- return;
- }
- this.next();
- if (this.hasPlugin("moduleAttributes")) {
- attributes = this.parseModuleAttributes();
- this.addExtra(node, "deprecatedWithLegacySyntax", true);
- } else {
- attributes = this.parseImportAttributes();
- }
- {
- useWith = true;
- }
- } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
- if (!this.hasPlugin("deprecatedImportAssert") && !this.hasPlugin("importAssertions")) {
- this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
- }
- if (!this.hasPlugin("importAssertions")) {
- this.addExtra(node, "deprecatedAssertSyntax", true);
- }
- this.next();
- attributes = this.parseImportAttributes();
- } else {
- attributes = [];
- }
- if (!useWith && this.hasPlugin("importAssertions")) {
- node.assertions = attributes;
- } else {
- node.attributes = attributes;
- }
- }
- maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier) {
- if (maybeDefaultIdentifier) {
- const specifier = this.startNodeAtNode(maybeDefaultIdentifier);
- specifier.local = maybeDefaultIdentifier;
- node.specifiers.push(this.finishImportSpecifier(specifier, "ImportDefaultSpecifier"));
- return true;
- } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
- this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier");
- return true;
- }
- return false;
- }
- maybeParseStarImportSpecifier(node) {
- if (this.match(55)) {
- const specifier = this.startNode();
- this.next();
- this.expectContextual(93);
- this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
- return true;
- }
- return false;
- }
- parseNamedImportSpecifiers(node) {
- let first = true;
- this.expect(5);
- while (!this.eat(8)) {
- if (first) {
- first = false;
- } else {
- if (this.eat(14)) {
- throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
- }
- this.expect(12);
- if (this.eat(8)) break;
- }
- const specifier = this.startNode();
- const importedIsString = this.match(134);
- const isMaybeTypeOnly = this.isContextual(130);
- specifier.imported = this.parseModuleExportName();
- const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, undefined);
- node.specifiers.push(importSpecifier);
- }
- }
- parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
- if (this.eatContextual(93)) {
- specifier.local = this.parseIdentifier();
- } else {
- const {
- imported
- } = specifier;
- if (importedIsString) {
- throw this.raise(Errors.ImportBindingIsString, specifier, {
- importName: imported.value
- });
- }
- this.checkReservedWord(imported.name, specifier.loc.start, true, true);
- if (!specifier.local) {
- specifier.local = cloneIdentifier(imported);
- }
- }
- return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType);
- }
- isThisParam(param) {
- return param.type === "Identifier" && param.name === "this";
- }
-}
-class Parser extends StatementParser {
- constructor(options, input, pluginsMap) {
- options = getOptions(options);
- super(options, input);
- this.options = options;
- this.initializeScopes();
- this.plugins = pluginsMap;
- this.filename = options.sourceFilename;
- this.startIndex = options.startIndex;
- let optionFlags = 0;
- if (options.allowAwaitOutsideFunction) {
- optionFlags |= 1;
- }
- if (options.allowReturnOutsideFunction) {
- optionFlags |= 2;
- }
- if (options.allowImportExportEverywhere) {
- optionFlags |= 8;
- }
- if (options.allowSuperOutsideMethod) {
- optionFlags |= 16;
- }
- if (options.allowUndeclaredExports) {
- optionFlags |= 64;
- }
- if (options.allowNewTargetOutsideFunction) {
- optionFlags |= 4;
- }
- if (options.allowYieldOutsideFunction) {
- optionFlags |= 32;
- }
- if (options.ranges) {
- optionFlags |= 128;
- }
- if (options.tokens) {
- optionFlags |= 256;
- }
- if (options.createImportExpressions) {
- optionFlags |= 512;
- }
- if (options.createParenthesizedExpressions) {
- optionFlags |= 1024;
- }
- if (options.errorRecovery) {
- optionFlags |= 2048;
- }
- if (options.attachComment) {
- optionFlags |= 4096;
- }
- if (options.annexB) {
- optionFlags |= 8192;
- }
- this.optionFlags = optionFlags;
- }
- getScopeHandler() {
- return ScopeHandler;
- }
- parse() {
- this.enterInitialScopes();
- const file = this.startNode();
- const program = this.startNode();
- this.nextToken();
- file.errors = null;
- this.parseTopLevel(file, program);
- file.errors = this.state.errors;
- file.comments.length = this.state.commentsLen;
- return file;
- }
-}
-function parse(input, options) {
- var _options;
- if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
- options = Object.assign({}, options);
- try {
- options.sourceType = "module";
- const parser = getParser(options, input);
- const ast = parser.parse();
- if (parser.sawUnambiguousESM) {
- return ast;
- }
- if (parser.ambiguousScriptDifferentAst) {
- try {
- options.sourceType = "script";
- return getParser(options, input).parse();
- } catch (_unused) {}
- } else {
- ast.program.sourceType = "script";
- }
- return ast;
- } catch (moduleError) {
- try {
- options.sourceType = "script";
- return getParser(options, input).parse();
- } catch (_unused2) {}
- throw moduleError;
- }
- } else {
- return getParser(options, input).parse();
- }
-}
-function parseExpression(input, options) {
- const parser = getParser(options, input);
- if (parser.options.strictMode) {
- parser.state.strict = true;
- }
- return parser.getExpression();
-}
-function generateExportedTokenTypes(internalTokenTypes) {
- const tokenTypes = {};
- for (const typeName of Object.keys(internalTokenTypes)) {
- tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
- }
- return tokenTypes;
-}
-const tokTypes = generateExportedTokenTypes(tt);
-function getParser(options, input) {
- let cls = Parser;
- const pluginsMap = new Map();
- if (options != null && options.plugins) {
- for (const plugin of options.plugins) {
- let name, opts;
- if (typeof plugin === "string") {
- name = plugin;
- } else {
- [name, opts] = plugin;
- }
- if (!pluginsMap.has(name)) {
- pluginsMap.set(name, opts || {});
- }
- }
- validatePlugins(pluginsMap);
- cls = getParserClass(pluginsMap);
- }
- return new cls(options, input, pluginsMap);
-}
-const parserClassCache = new Map();
-function getParserClass(pluginsMap) {
- const pluginList = [];
- for (const name of mixinPluginNames) {
- if (pluginsMap.has(name)) {
- pluginList.push(name);
- }
- }
- const key = pluginList.join("|");
- let cls = parserClassCache.get(key);
- if (!cls) {
- cls = Parser;
- for (const plugin of pluginList) {
- cls = mixinPlugins[plugin](cls);
- }
- parserClassCache.set(key, cls);
- }
- return cls;
}
-exports.parse = parse;
-exports.parseExpression = parseExpression;
-exports.tokTypes = tokTypes;
-//# sourceMappingURL=index.js.map
+
+//# sourceMappingURL=assertNode.js.map
/***/ }),
-/***/ 613:
+/***/ 7084:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
@@ -37077,11910 +28957,4519 @@ exports.tokTypes = tokTypes;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports["default"] = createTemplateBuilder;
-var _options = __nccwpck_require__(4510);
-var _string = __nccwpck_require__(6674);
-var _literal = __nccwpck_require__(9479);
-const NO_PLACEHOLDER = (0, _options.validate)({
- placeholderPattern: false
-});
-function createTemplateBuilder(formatter, defaultOpts) {
- const templateFnCache = new WeakMap();
- const templateAstCache = new WeakMap();
- const cachedOpts = defaultOpts || (0, _options.validate)(null);
- return Object.assign((tpl, ...args) => {
- if (typeof tpl === "string") {
- if (args.length > 1) throw new Error("Unexpected extra params.");
- return extendedTrace((0, _string.default)(formatter, tpl, (0, _options.merge)(cachedOpts, (0, _options.validate)(args[0]))));
- } else if (Array.isArray(tpl)) {
- let builder = templateFnCache.get(tpl);
- if (!builder) {
- builder = (0, _literal.default)(formatter, tpl, cachedOpts);
- templateFnCache.set(tpl, builder);
- }
- return extendedTrace(builder(args));
- } else if (typeof tpl === "object" && tpl) {
- if (args.length > 0) throw new Error("Unexpected extra params.");
- return createTemplateBuilder(formatter, (0, _options.merge)(cachedOpts, (0, _options.validate)(tpl)));
- }
- throw new Error(`Unexpected template param ${typeof tpl}`);
- }, {
- ast: (tpl, ...args) => {
- if (typeof tpl === "string") {
- if (args.length > 1) throw new Error("Unexpected extra params.");
- return (0, _string.default)(formatter, tpl, (0, _options.merge)((0, _options.merge)(cachedOpts, (0, _options.validate)(args[0])), NO_PLACEHOLDER))();
- } else if (Array.isArray(tpl)) {
- let builder = templateAstCache.get(tpl);
- if (!builder) {
- builder = (0, _literal.default)(formatter, tpl, (0, _options.merge)(cachedOpts, NO_PLACEHOLDER));
- templateAstCache.set(tpl, builder);
- }
- return builder(args)();
- }
- throw new Error(`Unexpected template param ${typeof tpl}`);
- }
- });
-}
-function extendedTrace(fn) {
- let rootStack = "";
- try {
- throw new Error();
- } catch (error) {
- if (error.stack) {
- rootStack = error.stack.split("\n").slice(3).join("\n");
- }
- }
- return arg => {
- try {
- return fn(arg);
- } catch (err) {
- err.stack += `\n =============\n${rootStack}`;
- throw err;
- }
- };
-}
-
-//# sourceMappingURL=builder.js.map
-
-
-/***/ }),
-
-/***/ 86:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.statements = exports.statement = exports.smart = exports.program = exports.expression = void 0;
-var _t = __nccwpck_require__(7912);
-const {
- assertExpressionStatement
-} = _t;
-function makeStatementFormatter(fn) {
- return {
- code: str => `/* @babel/template */;\n${str}`,
- validate: () => {},
- unwrap: ast => {
- return fn(ast.program.body.slice(1));
- }
- };
-}
-const smart = exports.smart = makeStatementFormatter(body => {
- if (body.length > 1) {
- return body;
- } else {
- return body[0];
- }
-});
-const statements = exports.statements = makeStatementFormatter(body => body);
-const statement = exports.statement = makeStatementFormatter(body => {
- if (body.length === 0) {
- throw new Error("Found nothing to return.");
- }
- if (body.length > 1) {
- throw new Error("Found multiple statements but wanted one");
- }
- return body[0];
-});
-const expression = exports.expression = {
- code: str => `(\n${str}\n)`,
- validate: ast => {
- if (ast.program.body.length > 1) {
- throw new Error("Found multiple statements but wanted one");
- }
- if (expression.unwrap(ast).start === 0) {
- throw new Error("Parse result included parens.");
- }
- },
- unwrap: ({
- program
- }) => {
- const [stmt] = program.body;
- assertExpressionStatement(stmt);
- return stmt.expression;
- }
-};
-const program = exports.program = {
- code: str => str,
- validate: () => {},
- unwrap: ast => ast.program
-};
-
-//# sourceMappingURL=formatters.js.map
-
-
-/***/ }),
-
-/***/ 3412:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.statements = exports.statement = exports.smart = exports.program = exports.expression = exports["default"] = void 0;
-var formatters = __nccwpck_require__(86);
-var _builder = __nccwpck_require__(613);
-const smart = exports.smart = (0, _builder.default)(formatters.smart);
-const statement = exports.statement = (0, _builder.default)(formatters.statement);
-const statements = exports.statements = (0, _builder.default)(formatters.statements);
-const expression = exports.expression = (0, _builder.default)(formatters.expression);
-const program = exports.program = (0, _builder.default)(formatters.program);
-var _default = exports["default"] = Object.assign(smart.bind(undefined), {
- smart,
- statement,
- statements,
- expression,
- program,
- ast: smart.ast
-});
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 9479:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = literalTemplate;
-var _options = __nccwpck_require__(4510);
-var _parse = __nccwpck_require__(7942);
-var _populate = __nccwpck_require__(3807);
-function literalTemplate(formatter, tpl, opts) {
- const {
- metadata,
- names
- } = buildLiteralData(formatter, tpl, opts);
- return arg => {
- const defaultReplacements = {};
- arg.forEach((replacement, i) => {
- defaultReplacements[names[i]] = replacement;
- });
- return arg => {
- const replacements = (0, _options.normalizeReplacements)(arg);
- if (replacements) {
- Object.keys(replacements).forEach(key => {
- if (hasOwnProperty.call(defaultReplacements, key)) {
- throw new Error("Unexpected replacement overlap.");
- }
- });
- }
- return formatter.unwrap((0, _populate.default)(metadata, replacements ? Object.assign(replacements, defaultReplacements) : defaultReplacements));
- };
- };
-}
-function buildLiteralData(formatter, tpl, opts) {
- let prefix = "BABEL_TPL$";
- const raw = tpl.join("");
- do {
- prefix = "$$" + prefix;
- } while (raw.includes(prefix));
- const {
- names,
- code
- } = buildTemplateCode(tpl, prefix);
- const metadata = (0, _parse.default)(formatter, formatter.code(code), {
- parser: opts.parser,
- placeholderWhitelist: new Set(names.concat(opts.placeholderWhitelist ? Array.from(opts.placeholderWhitelist) : [])),
- placeholderPattern: opts.placeholderPattern,
- preserveComments: opts.preserveComments,
- syntacticPlaceholders: opts.syntacticPlaceholders
- });
- return {
- metadata,
- names
- };
-}
-function buildTemplateCode(tpl, prefix) {
- const names = [];
- let code = tpl[0];
- for (let i = 1; i < tpl.length; i++) {
- const value = `${prefix}${i - 1}`;
- names.push(value);
- code += value + tpl[i];
- }
- return {
- names,
- code
- };
-}
-
-//# sourceMappingURL=literal.js.map
-
-
-/***/ }),
-
-/***/ 4510:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.merge = merge;
-exports.normalizeReplacements = normalizeReplacements;
-exports.validate = validate;
-const _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"];
-function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
-function merge(a, b) {
- const {
- placeholderWhitelist = a.placeholderWhitelist,
- placeholderPattern = a.placeholderPattern,
- preserveComments = a.preserveComments,
- syntacticPlaceholders = a.syntacticPlaceholders
- } = b;
- return {
- parser: Object.assign({}, a.parser, b.parser),
- placeholderWhitelist,
- placeholderPattern,
- preserveComments,
- syntacticPlaceholders
- };
-}
-function validate(opts) {
- if (opts != null && typeof opts !== "object") {
- throw new Error("Unknown template options.");
- }
- const _ref = opts || {},
- {
- placeholderWhitelist,
- placeholderPattern,
- preserveComments,
- syntacticPlaceholders
- } = _ref,
- parser = _objectWithoutPropertiesLoose(_ref, _excluded);
- if (placeholderWhitelist != null && !(placeholderWhitelist instanceof Set)) {
- throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined");
- }
- if (placeholderPattern != null && !(placeholderPattern instanceof RegExp) && placeholderPattern !== false) {
- throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined");
- }
- if (preserveComments != null && typeof preserveComments !== "boolean") {
- throw new Error("'.preserveComments' must be a boolean, null, or undefined");
- }
- if (syntacticPlaceholders != null && typeof syntacticPlaceholders !== "boolean") {
- throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined");
- }
- if (syntacticPlaceholders === true && (placeholderWhitelist != null || placeholderPattern != null)) {
- throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible" + " with '.syntacticPlaceholders: true'");
- }
- return {
- parser,
- placeholderWhitelist: placeholderWhitelist || undefined,
- placeholderPattern: placeholderPattern == null ? undefined : placeholderPattern,
- preserveComments: preserveComments == null ? undefined : preserveComments,
- syntacticPlaceholders: syntacticPlaceholders == null ? undefined : syntacticPlaceholders
- };
-}
-function normalizeReplacements(replacements) {
- if (Array.isArray(replacements)) {
- return replacements.reduce((acc, replacement, i) => {
- acc["$" + i] = replacement;
- return acc;
- }, {});
- } else if (typeof replacements === "object" || replacements == null) {
- return replacements || undefined;
- }
- throw new Error("Template replacements must be an array, object, null, or undefined");
-}
-
-//# sourceMappingURL=options.js.map
-
-
-/***/ }),
-
-/***/ 7942:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = parseAndBuildMetadata;
-var _t = __nccwpck_require__(7912);
-var _parser = __nccwpck_require__(5026);
-var _codeFrame = __nccwpck_require__(1322);
-const {
- isCallExpression,
- isExpressionStatement,
- isFunction,
- isIdentifier,
- isJSXIdentifier,
- isNewExpression,
- isPlaceholder,
- isStatement,
- isStringLiteral,
- removePropertiesDeep,
- traverse
-} = _t;
-const PATTERN = /^[_$A-Z0-9]+$/;
-function parseAndBuildMetadata(formatter, code, opts) {
- const {
- placeholderWhitelist,
- placeholderPattern,
- preserveComments,
- syntacticPlaceholders
- } = opts;
- const ast = parseWithCodeFrame(code, opts.parser, syntacticPlaceholders);
- removePropertiesDeep(ast, {
- preserveComments
- });
- formatter.validate(ast);
- const state = {
- syntactic: {
- placeholders: [],
- placeholderNames: new Set()
- },
- legacy: {
- placeholders: [],
- placeholderNames: new Set()
- },
- placeholderWhitelist,
- placeholderPattern,
- syntacticPlaceholders
- };
- traverse(ast, placeholderVisitorHandler, state);
- return Object.assign({
- ast
- }, state.syntactic.placeholders.length ? state.syntactic : state.legacy);
-}
-function placeholderVisitorHandler(node, ancestors, state) {
- var _state$placeholderWhi;
- let name;
- let hasSyntacticPlaceholders = state.syntactic.placeholders.length > 0;
- if (isPlaceholder(node)) {
- if (state.syntacticPlaceholders === false) {
- throw new Error("%%foo%%-style placeholders can't be used when " + "'.syntacticPlaceholders' is false.");
- }
- name = node.name.name;
- hasSyntacticPlaceholders = true;
- } else if (hasSyntacticPlaceholders || state.syntacticPlaceholders) {
- return;
- } else if (isIdentifier(node) || isJSXIdentifier(node)) {
- name = node.name;
- } else if (isStringLiteral(node)) {
- name = node.value;
- } else {
- return;
- }
- if (hasSyntacticPlaceholders && (state.placeholderPattern != null || state.placeholderWhitelist != null)) {
- throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible" + " with '.syntacticPlaceholders: true'");
- }
- if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !((_state$placeholderWhi = state.placeholderWhitelist) != null && _state$placeholderWhi.has(name))) {
- return;
- }
- ancestors = ancestors.slice();
- const {
- node: parent,
- key
- } = ancestors[ancestors.length - 1];
- let type;
- if (isStringLiteral(node) || isPlaceholder(node, {
- expectedNode: "StringLiteral"
- })) {
- type = "string";
- } else if (isNewExpression(parent) && key === "arguments" || isCallExpression(parent) && key === "arguments" || isFunction(parent) && key === "params") {
- type = "param";
- } else if (isExpressionStatement(parent) && !isPlaceholder(node)) {
- type = "statement";
- ancestors = ancestors.slice(0, -1);
- } else if (isStatement(node) && isPlaceholder(node)) {
- type = "statement";
- } else {
- type = "other";
- }
- const {
- placeholders,
- placeholderNames
- } = !hasSyntacticPlaceholders ? state.legacy : state.syntactic;
- placeholders.push({
- name,
- type,
- resolve: ast => resolveAncestors(ast, ancestors),
- isDuplicate: placeholderNames.has(name)
- });
- placeholderNames.add(name);
-}
-function resolveAncestors(ast, ancestors) {
- let parent = ast;
- for (let i = 0; i < ancestors.length - 1; i++) {
- const {
- key,
- index
- } = ancestors[i];
- if (index === undefined) {
- parent = parent[key];
- } else {
- parent = parent[key][index];
- }
- }
- const {
- key,
- index
- } = ancestors[ancestors.length - 1];
- return {
- parent,
- key,
- index
- };
-}
-function parseWithCodeFrame(code, parserOpts, syntacticPlaceholders) {
- const plugins = (parserOpts.plugins || []).slice();
- if (syntacticPlaceholders !== false) {
- plugins.push("placeholders");
- }
- parserOpts = Object.assign({
- allowAwaitOutsideFunction: true,
- allowReturnOutsideFunction: true,
- allowNewTargetOutsideFunction: true,
- allowSuperOutsideMethod: true,
- allowYieldOutsideFunction: true,
- sourceType: "module"
- }, parserOpts, {
- plugins
- });
- try {
- return (0, _parser.parse)(code, parserOpts);
- } catch (err) {
- const loc = err.loc;
- if (loc) {
- err.message += "\n" + (0, _codeFrame.codeFrameColumns)(code, {
- start: loc
- });
- err.code = "BABEL_TEMPLATE_PARSE_ERROR";
- }
- throw err;
- }
-}
-
-//# sourceMappingURL=parse.js.map
-
-
-/***/ }),
-
-/***/ 3807:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = populatePlaceholders;
-var _t = __nccwpck_require__(7912);
-const {
- blockStatement,
- cloneNode,
- emptyStatement,
- expressionStatement,
- identifier,
- isStatement,
- isStringLiteral,
- stringLiteral,
- validate
-} = _t;
-function populatePlaceholders(metadata, replacements) {
- const ast = cloneNode(metadata.ast);
- if (replacements) {
- metadata.placeholders.forEach(placeholder => {
- if (!hasOwnProperty.call(replacements, placeholder.name)) {
- const placeholderName = placeholder.name;
- throw new Error(`Error: No substitution given for "${placeholderName}". If this is not meant to be a
- placeholder you may want to consider passing one of the following options to @babel/template:
- - { placeholderPattern: false, placeholderWhitelist: new Set(['${placeholderName}'])}
- - { placeholderPattern: /^${placeholderName}$/ }`);
- }
- });
- Object.keys(replacements).forEach(key => {
- if (!metadata.placeholderNames.has(key)) {
- throw new Error(`Unknown substitution "${key}" given`);
- }
- });
- }
- metadata.placeholders.slice().reverse().forEach(placeholder => {
- try {
- applyReplacement(placeholder, ast, replacements && replacements[placeholder.name] || null);
- } catch (e) {
- e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`;
- throw e;
- }
- });
- return ast;
-}
-function applyReplacement(placeholder, ast, replacement) {
- if (placeholder.isDuplicate) {
- if (Array.isArray(replacement)) {
- replacement = replacement.map(node => cloneNode(node));
- } else if (typeof replacement === "object") {
- replacement = cloneNode(replacement);
- }
- }
- const {
- parent,
- key,
- index
- } = placeholder.resolve(ast);
- if (placeholder.type === "string") {
- if (typeof replacement === "string") {
- replacement = stringLiteral(replacement);
- }
- if (!replacement || !isStringLiteral(replacement)) {
- throw new Error("Expected string substitution");
- }
- } else if (placeholder.type === "statement") {
- if (index === undefined) {
- if (!replacement) {
- replacement = emptyStatement();
- } else if (Array.isArray(replacement)) {
- replacement = blockStatement(replacement);
- } else if (typeof replacement === "string") {
- replacement = expressionStatement(identifier(replacement));
- } else if (!isStatement(replacement)) {
- replacement = expressionStatement(replacement);
- }
- } else {
- if (replacement && !Array.isArray(replacement)) {
- if (typeof replacement === "string") {
- replacement = identifier(replacement);
- }
- if (!isStatement(replacement)) {
- replacement = expressionStatement(replacement);
- }
- }
- }
- } else if (placeholder.type === "param") {
- if (typeof replacement === "string") {
- replacement = identifier(replacement);
- }
- if (index === undefined) throw new Error("Assertion failure.");
- } else {
- if (typeof replacement === "string") {
- replacement = identifier(replacement);
- }
- if (Array.isArray(replacement)) {
- throw new Error("Cannot replace single expression with an array.");
- }
- }
- function set(parent, key, value) {
- const node = parent[key];
- parent[key] = value;
- if (node.type === "Identifier" || node.type === "Placeholder") {
- if (node.typeAnnotation) {
- value.typeAnnotation = node.typeAnnotation;
- }
- if (node.optional) {
- value.optional = node.optional;
- }
- if (node.decorators) {
- value.decorators = node.decorators;
- }
- }
- }
- if (index === undefined) {
- validate(parent, key, replacement);
- set(parent, key, replacement);
- } else {
- const items = parent[key].slice();
- if (placeholder.type === "statement" || placeholder.type === "param") {
- if (replacement == null) {
- items.splice(index, 1);
- } else if (Array.isArray(replacement)) {
- items.splice(index, 1, ...replacement);
- } else {
- set(items, index, replacement);
- }
- } else {
- set(items, index, replacement);
- }
- validate(parent, key, items);
- parent[key] = items;
- }
-}
-
-//# sourceMappingURL=populate.js.map
-
-
-/***/ }),
-
-/***/ 6674:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = stringTemplate;
-var _options = __nccwpck_require__(4510);
-var _parse = __nccwpck_require__(7942);
-var _populate = __nccwpck_require__(3807);
-function stringTemplate(formatter, code, opts) {
- code = formatter.code(code);
- let metadata;
- return arg => {
- const replacements = (0, _options.normalizeReplacements)(arg);
- if (!metadata) metadata = (0, _parse.default)(formatter, code, opts);
- return formatter.unwrap((0, _populate.default)(metadata, replacements));
- };
-}
-
-//# sourceMappingURL=string.js.map
-
-
-/***/ }),
-
-/***/ 5069:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.clear = clear;
-exports.clearPath = clearPath;
-exports.clearScope = clearScope;
-exports.getCachedPaths = getCachedPaths;
-exports.getOrCreateCachedPaths = getOrCreateCachedPaths;
-exports.scope = exports.path = void 0;
-let pathsCache = new WeakMap();
-exports.path = pathsCache;
-let scope = new WeakMap();
-exports.scope = scope;
-function clear() {
- clearPath();
- clearScope();
-}
-function clearPath() {
- exports.path = pathsCache = new WeakMap();
-}
-function clearScope() {
- exports.scope = scope = new WeakMap();
-}
-const nullHub = Object.freeze({});
-function getCachedPaths(hub, parent) {
- var _pathsCache$get, _hub;
- {
- hub = null;
- }
- return (_pathsCache$get = pathsCache.get((_hub = hub) != null ? _hub : nullHub)) == null ? void 0 : _pathsCache$get.get(parent);
-}
-function getOrCreateCachedPaths(hub, parent) {
- var _hub2, _hub3;
- {
- hub = null;
- }
- let parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub);
- if (!parents) pathsCache.set((_hub3 = hub) != null ? _hub3 : nullHub, parents = new WeakMap());
- let paths = parents.get(parent);
- if (!paths) parents.set(parent, paths = new Map());
- return paths;
-}
-
-//# sourceMappingURL=cache.js.map
-
-
-/***/ }),
-
-/***/ 9089:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-var _index = __nccwpck_require__(8877);
-var _t = __nccwpck_require__(7912);
-const {
- VISITOR_KEYS
-} = _t;
-class TraversalContext {
- constructor(scope, opts, state, parentPath) {
- this.queue = null;
- this.priorityQueue = null;
- this.parentPath = parentPath;
- this.scope = scope;
- this.state = state;
- this.opts = opts;
- }
- shouldVisit(node) {
- const opts = this.opts;
- if (opts.enter || opts.exit) return true;
- if (opts[node.type]) return true;
- const keys = VISITOR_KEYS[node.type];
- if (!(keys != null && keys.length)) return false;
- for (const key of keys) {
- if (node[key]) {
- return true;
- }
- }
- return false;
- }
- create(node, container, key, listKey) {
- return _index.default.get({
- parentPath: this.parentPath,
- parent: node,
- container,
- key: key,
- listKey
- });
- }
- maybeQueue(path, notPriority) {
- if (this.queue) {
- if (notPriority) {
- this.queue.push(path);
- } else {
- this.priorityQueue.push(path);
- }
- }
- }
- visitMultiple(container, parent, listKey) {
- if (container.length === 0) return false;
- const queue = [];
- for (let key = 0; key < container.length; key++) {
- const node = container[key];
- if (node && this.shouldVisit(node)) {
- queue.push(this.create(parent, container, key, listKey));
- }
- }
- return this.visitQueue(queue);
- }
- visitSingle(node, key) {
- if (this.shouldVisit(node[key])) {
- return this.visitQueue([this.create(node, node, key)]);
- } else {
- return false;
- }
- }
- visitQueue(queue) {
- this.queue = queue;
- this.priorityQueue = [];
- const visited = new WeakSet();
- let stop = false;
- for (const path of queue) {
- path.resync();
- if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
- path.pushContext(this);
- }
- if (path.key === null) continue;
- const {
- node
- } = path;
- if (visited.has(node)) continue;
- if (node) visited.add(node);
- if (path.visit()) {
- stop = true;
- break;
- }
- if (this.priorityQueue.length) {
- stop = this.visitQueue(this.priorityQueue);
- this.priorityQueue = [];
- this.queue = queue;
- if (stop) break;
- }
- }
- for (const path of queue) {
- path.popContext();
- }
- this.queue = null;
- return stop;
- }
- visit(node, key) {
- const nodes = node[key];
- if (!nodes) return false;
- if (Array.isArray(nodes)) {
- return this.visitMultiple(nodes, node, key);
- } else {
- return this.visitSingle(node, key);
- }
- }
-}
-exports["default"] = TraversalContext;
-
-//# sourceMappingURL=context.js.map
-
-
-/***/ }),
-
-/***/ 9817:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-class Hub {
- getCode() {}
- getScope() {}
- addHelper() {
- throw new Error("Helpers are not supported by the default hub.");
- }
- buildError(node, msg, Error = TypeError) {
- return new Error(msg);
- }
-}
-exports["default"] = Hub;
-
-//# sourceMappingURL=hub.js.map
-
-
-/***/ }),
-
-/***/ 1380:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-Object.defineProperty(exports, "Hub", ({
- enumerable: true,
- get: function () {
- return _hub.default;
- }
-}));
-Object.defineProperty(exports, "NodePath", ({
- enumerable: true,
- get: function () {
- return _index.default;
- }
-}));
-Object.defineProperty(exports, "Scope", ({
- enumerable: true,
- get: function () {
- return _index2.default;
- }
-}));
-exports.visitors = exports["default"] = void 0;
-var visitors = __nccwpck_require__(3494);
-exports.visitors = visitors;
-var _t = __nccwpck_require__(7912);
-var cache = __nccwpck_require__(5069);
-var _traverseNode = __nccwpck_require__(1250);
-var _index = __nccwpck_require__(8877);
-var _index2 = __nccwpck_require__(891);
-var _hub = __nccwpck_require__(9817);
-const {
- VISITOR_KEYS,
- removeProperties,
- traverseFast
-} = _t;
-function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) {
- if (!parent) return;
- if (!opts.noScope && !scope) {
- if (parent.type !== "Program" && parent.type !== "File") {
- throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");
- }
- }
- if (!parentPath && visitSelf) {
- throw new Error("visitSelf can only be used when providing a NodePath.");
- }
- if (!VISITOR_KEYS[parent.type]) {
- return;
- }
- visitors.explode(opts);
- (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, null, visitSelf);
-}
-var _default = traverse;
-exports["default"] = _default;
-traverse.visitors = visitors;
-traverse.verify = visitors.verify;
-traverse.explode = visitors.explode;
-traverse.cheap = function (node, enter) {
- traverseFast(node, enter);
- return;
-};
-traverse.node = function (node, opts, scope, state, path, skipKeys) {
- (0, _traverseNode.traverseNode)(node, opts, scope, state, path, skipKeys);
-};
-traverse.clearNode = function (node, opts) {
- removeProperties(node, opts);
-};
-traverse.removeProperties = function (tree, opts) {
- traverseFast(tree, traverse.clearNode, opts);
- return tree;
-};
-function hasDenylistedType(path, state) {
- if (path.node.type === state.type) {
- state.has = true;
- path.stop();
- }
-}
-traverse.hasType = function (tree, type, denylistTypes) {
- if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
- if (tree.type === type) return true;
- const state = {
- has: false,
- type: type
- };
- traverse(tree, {
- noScope: true,
- denylist: denylistTypes,
- enter: hasDenylistedType
- }, null, state);
- return state.has;
-};
-traverse.cache = cache;
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 6411:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.find = find;
-exports.findParent = findParent;
-exports.getAncestry = getAncestry;
-exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom;
-exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom;
-exports.getFunctionParent = getFunctionParent;
-exports.getStatementParent = getStatementParent;
-exports.inType = inType;
-exports.isAncestor = isAncestor;
-exports.isDescendant = isDescendant;
-var _t = __nccwpck_require__(7912);
-const {
- VISITOR_KEYS
-} = _t;
-function findParent(callback) {
- let path = this;
- while (path = path.parentPath) {
- if (callback(path)) return path;
- }
- return null;
-}
-function find(callback) {
- let path = this;
- do {
- if (callback(path)) return path;
- } while (path = path.parentPath);
- return null;
-}
-function getFunctionParent() {
- return this.findParent(p => p.isFunction());
-}
-function getStatementParent() {
- let path = this;
- do {
- if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
- break;
- } else {
- path = path.parentPath;
- }
- } while (path);
- if (path && (path.isProgram() || path.isFile())) {
- throw new Error("File/Program node, we can't possibly find a statement parent to this");
- }
- return path;
-}
-function getEarliestCommonAncestorFrom(paths) {
- return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
- let earliest;
- const keys = VISITOR_KEYS[deepest.type];
- for (const ancestry of ancestries) {
- const path = ancestry[i + 1];
- if (!earliest) {
- earliest = path;
- continue;
- }
- if (path.listKey && earliest.listKey === path.listKey) {
- if (path.key < earliest.key) {
- earliest = path;
- continue;
- }
- }
- const earliestKeyIndex = keys.indexOf(earliest.parentKey);
- const currentKeyIndex = keys.indexOf(path.parentKey);
- if (earliestKeyIndex > currentKeyIndex) {
- earliest = path;
- }
- }
- return earliest;
- });
-}
-function getDeepestCommonAncestorFrom(paths, filter) {
- if (!paths.length) {
- return this;
- }
- if (paths.length === 1) {
- return paths[0];
- }
- let minDepth = Infinity;
- let lastCommonIndex, lastCommon;
- const ancestries = paths.map(path => {
- const ancestry = [];
- do {
- ancestry.unshift(path);
- } while ((path = path.parentPath) && path !== this);
- if (ancestry.length < minDepth) {
- minDepth = ancestry.length;
- }
- return ancestry;
- });
- const first = ancestries[0];
- depthLoop: for (let i = 0; i < minDepth; i++) {
- const shouldMatch = first[i];
- for (const ancestry of ancestries) {
- if (ancestry[i] !== shouldMatch) {
- break depthLoop;
- }
- }
- lastCommonIndex = i;
- lastCommon = shouldMatch;
- }
- if (lastCommon) {
- if (filter) {
- return filter(lastCommon, lastCommonIndex, ancestries);
- } else {
- return lastCommon;
- }
- } else {
- throw new Error("Couldn't find intersection");
- }
-}
-function getAncestry() {
- let path = this;
- const paths = [];
- do {
- paths.push(path);
- } while (path = path.parentPath);
- return paths;
-}
-function isAncestor(maybeDescendant) {
- return maybeDescendant.isDescendant(this);
-}
-function isDescendant(maybeAncestor) {
- return !!this.findParent(parent => parent === maybeAncestor);
-}
-function inType(...candidateTypes) {
- let path = this;
- while (path) {
- for (const type of candidateTypes) {
- if (path.node.type === type) return true;
- }
- path = path.parentPath;
- }
- return false;
-}
-
-//# sourceMappingURL=ancestry.js.map
-
-
-/***/ }),
-
-/***/ 7354:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.addComment = addComment;
-exports.addComments = addComments;
-exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
-var _t = __nccwpck_require__(7912);
-const {
- addComment: _addComment,
- addComments: _addComments
-} = _t;
-function shareCommentsWithSiblings() {
- if (typeof this.key === "string") return;
- const node = this.node;
- if (!node) return;
- const trailing = node.trailingComments;
- const leading = node.leadingComments;
- if (!trailing && !leading) return;
- const prev = this.getSibling(this.key - 1);
- const next = this.getSibling(this.key + 1);
- const hasPrev = Boolean(prev.node);
- const hasNext = Boolean(next.node);
- if (hasPrev) {
- if (leading) {
- prev.addComments("trailing", removeIfExisting(leading, prev.node.trailingComments));
- }
- if (trailing && !hasNext) prev.addComments("trailing", trailing);
- }
- if (hasNext) {
- if (trailing) {
- next.addComments("leading", removeIfExisting(trailing, next.node.leadingComments));
- }
- if (leading && !hasPrev) next.addComments("leading", leading);
- }
-}
-function removeIfExisting(list, toRemove) {
- if (!toRemove) return list;
- let lastFoundIndex = -1;
- return list.filter(el => {
- const i = toRemove.indexOf(el, lastFoundIndex);
- if (i === -1) return true;
- lastFoundIndex = i;
- });
-}
-function addComment(type, content, line) {
- _addComment(this.node, type, content, line);
-}
-function addComments(type, comments) {
- _addComments(this.node, type, comments);
-}
-
-//# sourceMappingURL=comments.js.map
-
-
-/***/ }),
-
-/***/ 4108:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._call = _call;
-exports._getQueueContexts = _getQueueContexts;
-exports._resyncKey = _resyncKey;
-exports._resyncList = _resyncList;
-exports._resyncParent = _resyncParent;
-exports._resyncRemoved = _resyncRemoved;
-exports.call = call;
-exports.isBlacklisted = exports.isDenylisted = isDenylisted;
-exports.popContext = popContext;
-exports.pushContext = pushContext;
-exports.requeue = requeue;
-exports.resync = resync;
-exports.setContext = setContext;
-exports.setKey = setKey;
-exports.setScope = setScope;
-exports.setup = setup;
-exports.skip = skip;
-exports.skipKey = skipKey;
-exports.stop = stop;
-exports.visit = visit;
-var _traverseNode = __nccwpck_require__(1250);
-var _index = __nccwpck_require__(8877);
-function call(key) {
- const opts = this.opts;
- this.debug(key);
- if (this.node) {
- if (this._call(opts[key])) return true;
- }
- if (this.node) {
- var _opts$this$node$type;
- return this._call((_opts$this$node$type = opts[this.node.type]) == null ? void 0 : _opts$this$node$type[key]);
- }
- return false;
-}
-function _call(fns) {
- if (!fns) return false;
- for (const fn of fns) {
- if (!fn) continue;
- const node = this.node;
- if (!node) return true;
- const ret = fn.call(this.state, this, this.state);
- if (ret && typeof ret === "object" && typeof ret.then === "function") {
- throw new Error(`You appear to be using a plugin with an async traversal visitor, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
- }
- if (ret) {
- throw new Error(`Unexpected return value from visitor method ${fn}`);
- }
- if (this.node !== node) return true;
- if (this._traverseFlags > 0) return true;
- }
- return false;
-}
-function isDenylisted() {
- var _this$opts$denylist;
- const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
- return denylist && denylist.indexOf(this.node.type) > -1;
-}
-function restoreContext(path, context) {
- if (path.context !== context) {
- path.context = context;
- path.state = context.state;
- path.opts = context.opts;
- }
-}
-function visit() {
- var _this$opts$shouldSkip, _this$opts;
- if (!this.node) {
- return false;
- }
- if (this.isDenylisted()) {
- return false;
- }
- if ((_this$opts$shouldSkip = (_this$opts = this.opts).shouldSkip) != null && _this$opts$shouldSkip.call(_this$opts, this)) {
- return false;
- }
- const currentContext = this.context;
- if (this.shouldSkip || this.call("enter")) {
- this.debug("Skip...");
- return this.shouldStop;
- }
- restoreContext(this, currentContext);
- this.debug("Recursing into...");
- this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
- restoreContext(this, currentContext);
- this.call("exit");
- return this.shouldStop;
-}
-function skip() {
- this.shouldSkip = true;
-}
-function skipKey(key) {
- if (this.skipKeys == null) {
- this.skipKeys = {};
- }
- this.skipKeys[key] = true;
-}
-function stop() {
- this._traverseFlags |= _index.SHOULD_SKIP | _index.SHOULD_STOP;
-}
-function setScope() {
- var _this$opts2, _this$scope;
- if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return;
- let path = this.parentPath;
- if ((this.key === "key" || this.listKey === "decorators") && path.isMethod() || this.key === "discriminant" && path.isSwitchStatement()) {
- path = path.parentPath;
- }
- let target;
- while (path && !target) {
- var _path$opts;
- if ((_path$opts = path.opts) != null && _path$opts.noScope) return;
- target = path.scope;
- path = path.parentPath;
- }
- this.scope = this.getScope(target);
- (_this$scope = this.scope) == null ? void 0 : _this$scope.init();
-}
-function setContext(context) {
- if (this.skipKeys != null) {
- this.skipKeys = {};
- }
- this._traverseFlags = 0;
- if (context) {
- this.context = context;
- this.state = context.state;
- this.opts = context.opts;
- }
- this.setScope();
- return this;
-}
-function resync() {
- if (this.removed) return;
- this._resyncParent();
- this._resyncList();
- this._resyncKey();
-}
-function _resyncParent() {
- if (this.parentPath) {
- this.parent = this.parentPath.node;
- }
-}
-function _resyncKey() {
- if (!this.container) return;
- if (this.node === this.container[this.key]) {
- return;
- }
- if (Array.isArray(this.container)) {
- for (let i = 0; i < this.container.length; i++) {
- if (this.container[i] === this.node) {
- this.setKey(i);
- return;
- }
- }
- } else {
- for (const key of Object.keys(this.container)) {
- if (this.container[key] === this.node) {
- this.setKey(key);
- return;
- }
- }
- }
- this.key = null;
-}
-function _resyncList() {
- if (!this.parent || !this.inList) return;
- const newContainer = this.parent[this.listKey];
- if (this.container === newContainer) return;
- this.container = newContainer || null;
-}
-function _resyncRemoved() {
- if (this.key == null || !this.container || this.container[this.key] !== this.node) {
- this._markRemoved();
- }
-}
-function popContext() {
- this.contexts.pop();
- if (this.contexts.length > 0) {
- this.setContext(this.contexts[this.contexts.length - 1]);
- } else {
- this.setContext(undefined);
- }
-}
-function pushContext(context) {
- this.contexts.push(context);
- this.setContext(context);
-}
-function setup(parentPath, container, listKey, key) {
- this.listKey = listKey;
- this.container = container;
- this.parentPath = parentPath || this.parentPath;
- this.setKey(key);
-}
-function setKey(key) {
- var _this$node;
- this.key = key;
- this.node = this.container[this.key];
- this.type = (_this$node = this.node) == null ? void 0 : _this$node.type;
-}
-function requeue(pathToQueue = this) {
- if (pathToQueue.removed) return;
- ;
- const contexts = this.contexts;
- for (const context of contexts) {
- context.maybeQueue(pathToQueue);
- }
-}
-function _getQueueContexts() {
- let path = this;
- let contexts = this.contexts;
- while (!contexts.length) {
- path = path.parentPath;
- if (!path) break;
- contexts = path.contexts;
- }
- return contexts;
-}
-
-//# sourceMappingURL=context.js.map
-
-
-/***/ }),
-
-/***/ 277:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.arrowFunctionToExpression = arrowFunctionToExpression;
-exports.ensureBlock = ensureBlock;
-exports.toComputedKey = toComputedKey;
-exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment;
-var _t = __nccwpck_require__(7912);
-var _helperEnvironmentVisitor = __nccwpck_require__(1097);
-var _helperFunctionName = __nccwpck_require__(3968);
-var _visitors = __nccwpck_require__(3494);
-const {
- arrowFunctionExpression,
- assignmentExpression,
- binaryExpression,
- blockStatement,
- callExpression,
- conditionalExpression,
- expressionStatement,
- identifier,
- isIdentifier,
- jsxIdentifier,
- logicalExpression,
- LOGICAL_OPERATORS,
- memberExpression,
- metaProperty,
- numericLiteral,
- objectExpression,
- restElement,
- returnStatement,
- sequenceExpression,
- spreadElement,
- stringLiteral,
- super: _super,
- thisExpression,
- toExpression,
- unaryExpression
-} = _t;
-function toComputedKey() {
- let key;
- if (this.isMemberExpression()) {
- key = this.node.property;
- } else if (this.isProperty() || this.isMethod()) {
- key = this.node.key;
- } else {
- throw new ReferenceError("todo");
- }
- if (!this.node.computed) {
- if (isIdentifier(key)) key = stringLiteral(key.name);
- }
- return key;
-}
-function ensureBlock() {
- const body = this.get("body");
- const bodyNode = body.node;
- if (Array.isArray(body)) {
- throw new Error("Can't convert array path to a block statement");
- }
- if (!bodyNode) {
- throw new Error("Can't convert node without a body");
- }
- if (body.isBlockStatement()) {
- return bodyNode;
- }
- const statements = [];
- let stringPath = "body";
- let key;
- let listKey;
- if (body.isStatement()) {
- listKey = "body";
- key = 0;
- statements.push(body.node);
- } else {
- stringPath += ".body.0";
- if (this.isFunction()) {
- key = "argument";
- statements.push(returnStatement(body.node));
- } else {
- key = "expression";
- statements.push(expressionStatement(body.node));
- }
- }
- this.node.body = blockStatement(statements);
- const parentPath = this.get(stringPath);
- body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
- return this.node;
-}
-{
- exports.arrowFunctionToShadowed = function () {
- if (!this.isArrowFunctionExpression()) return;
- this.arrowFunctionToExpression();
- };
-}
-function unwrapFunctionEnvironment() {
- if (!this.isArrowFunctionExpression() && !this.isFunctionExpression() && !this.isFunctionDeclaration()) {
- throw this.buildCodeFrameError("Can only unwrap the environment of a function.");
- }
- hoistFunctionEnvironment(this);
-}
-function setType(path, type) {
- path.node.type = type;
-}
-function arrowFunctionToExpression({
- allowInsertArrow = true,
- allowInsertArrowWithRest = allowInsertArrow,
- noNewArrows = !(_arguments$ => (_arguments$ = arguments[0]) == null ? void 0 : _arguments$.specCompliant)()
-} = {}) {
- if (!this.isArrowFunctionExpression()) {
- throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression.");
- }
- const {
- thisBinding,
- fnPath: fn
- } = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow, allowInsertArrowWithRest);
- fn.ensureBlock();
- setType(fn, "FunctionExpression");
- if (!noNewArrows) {
- const checkBinding = thisBinding ? null : fn.scope.generateUidIdentifier("arrowCheckId");
- if (checkBinding) {
- fn.parentPath.scope.push({
- id: checkBinding,
- init: objectExpression([])
- });
- }
- fn.get("body").unshiftContainer("body", expressionStatement(callExpression(this.hub.addHelper("newArrowCheck"), [thisExpression(), checkBinding ? identifier(checkBinding.name) : identifier(thisBinding)])));
- fn.replaceWith(callExpression(memberExpression((0, _helperFunctionName.default)(this, true) || fn.node, identifier("bind")), [checkBinding ? identifier(checkBinding.name) : thisExpression()]));
- return fn.get("callee.object");
- }
- return fn;
-}
-const getSuperCallsVisitor = (0, _visitors.merge)([{
- CallExpression(child, {
- allSuperCalls
- }) {
- if (!child.get("callee").isSuper()) return;
- allSuperCalls.push(child);
- }
-}, _helperEnvironmentVisitor.default]);
-function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow = true, allowInsertArrowWithRest = true) {
- let arrowParent;
- let thisEnvFn = fnPath.findParent(p => {
- if (p.isArrowFunctionExpression()) {
- var _arrowParent;
- (_arrowParent = arrowParent) != null ? _arrowParent : arrowParent = p;
- return false;
- }
- return p.isFunction() || p.isProgram() || p.isClassProperty({
- static: false
- }) || p.isClassPrivateProperty({
- static: false
- });
- });
- const inConstructor = thisEnvFn.isClassMethod({
- kind: "constructor"
- });
- if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {
- if (arrowParent) {
- thisEnvFn = arrowParent;
- } else if (allowInsertArrow) {
- fnPath.replaceWith(callExpression(arrowFunctionExpression([], toExpression(fnPath.node)), []));
- thisEnvFn = fnPath.get("callee");
- fnPath = thisEnvFn.get("body");
- } else {
- throw fnPath.buildCodeFrameError("Unable to transform arrow inside class property");
- }
- }
- const {
- thisPaths,
- argumentsPaths,
- newTargetPaths,
- superProps,
- superCalls
- } = getScopeInformation(fnPath);
- if (inConstructor && superCalls.length > 0) {
- if (!allowInsertArrow) {
- throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super()` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
- }
- if (!allowInsertArrowWithRest) {
- throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-parameters', " + "it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
- }
- const allSuperCalls = [];
- thisEnvFn.traverse(getSuperCallsVisitor, {
- allSuperCalls
- });
- const superBinding = getSuperBinding(thisEnvFn);
- allSuperCalls.forEach(superCall => {
- const callee = identifier(superBinding);
- callee.loc = superCall.node.callee.loc;
- superCall.get("callee").replaceWith(callee);
- });
- }
- if (argumentsPaths.length > 0) {
- const argumentsBinding = getBinding(thisEnvFn, "arguments", () => {
- const args = () => identifier("arguments");
- if (thisEnvFn.scope.path.isProgram()) {
- return conditionalExpression(binaryExpression("===", unaryExpression("typeof", args()), stringLiteral("undefined")), thisEnvFn.scope.buildUndefinedNode(), args());
- } else {
- return args();
- }
- });
- argumentsPaths.forEach(argumentsChild => {
- const argsRef = identifier(argumentsBinding);
- argsRef.loc = argumentsChild.node.loc;
- argumentsChild.replaceWith(argsRef);
- });
- }
- if (newTargetPaths.length > 0) {
- const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => metaProperty(identifier("new"), identifier("target")));
- newTargetPaths.forEach(targetChild => {
- const targetRef = identifier(newTargetBinding);
- targetRef.loc = targetChild.node.loc;
- targetChild.replaceWith(targetRef);
- });
- }
- if (superProps.length > 0) {
- if (!allowInsertArrow) {
- throw superProps[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super.prop` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
- }
- const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []);
- flatSuperProps.forEach(superProp => {
- const key = superProp.node.computed ? "" : superProp.get("property").node.name;
- const superParentPath = superProp.parentPath;
- const isAssignment = superParentPath.isAssignmentExpression({
- left: superProp.node
- });
- const isCall = superParentPath.isCallExpression({
- callee: superProp.node
- });
- const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({
- tag: superProp.node
- });
- const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
- const args = [];
- if (superProp.node.computed) {
- args.push(superProp.get("property").node);
- }
- if (isAssignment) {
- const value = superParentPath.node.right;
- args.push(value);
- }
- const call = callExpression(identifier(superBinding), args);
- if (isCall) {
- superParentPath.unshiftContainer("arguments", thisExpression());
- superProp.replaceWith(memberExpression(call, identifier("call")));
- thisPaths.push(superParentPath.get("arguments.0"));
- } else if (isAssignment) {
- superParentPath.replaceWith(call);
- } else if (isTaggedTemplate) {
- superProp.replaceWith(callExpression(memberExpression(call, identifier("bind"), false), [thisExpression()]));
- thisPaths.push(superProp.get("arguments.0"));
- } else {
- superProp.replaceWith(call);
- }
- });
- }
- let thisBinding;
- if (thisPaths.length > 0 || !noNewArrows) {
- thisBinding = getThisBinding(thisEnvFn, inConstructor);
- if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) {
- thisPaths.forEach(thisChild => {
- const thisRef = thisChild.isJSX() ? jsxIdentifier(thisBinding) : identifier(thisBinding);
- thisRef.loc = thisChild.node.loc;
- thisChild.replaceWith(thisRef);
- });
- if (!noNewArrows) thisBinding = null;
- }
- }
- return {
- thisBinding,
- fnPath
- };
-}
-function isLogicalOp(op) {
- return LOGICAL_OPERATORS.includes(op);
-}
-function standardizeSuperProperty(superProp) {
- if (superProp.parentPath.isAssignmentExpression() && superProp.parentPath.node.operator !== "=") {
- const assignmentPath = superProp.parentPath;
- const op = assignmentPath.node.operator.slice(0, -1);
- const value = assignmentPath.node.right;
- const isLogicalAssignment = isLogicalOp(op);
- if (superProp.node.computed) {
- const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
- const object = superProp.node.object;
- const property = superProp.node.property;
- assignmentPath.get("left").replaceWith(memberExpression(object, assignmentExpression("=", tmp, property), true));
- assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(tmp.name), true), value));
- } else {
- const object = superProp.node.object;
- const property = superProp.node.property;
- assignmentPath.get("left").replaceWith(memberExpression(object, property));
- assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(property.name)), value));
- }
- if (isLogicalAssignment) {
- assignmentPath.replaceWith(logicalExpression(op, assignmentPath.node.left, assignmentPath.node.right));
- } else {
- assignmentPath.node.operator = "=";
- }
- return [assignmentPath.get("left"), assignmentPath.get("right").get("left")];
- } else if (superProp.parentPath.isUpdateExpression()) {
- const updateExpr = superProp.parentPath;
- const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
- const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
- const parts = [assignmentExpression("=", tmp, memberExpression(superProp.node.object, computedKey ? assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), assignmentExpression("=", memberExpression(superProp.node.object, computedKey ? identifier(computedKey.name) : superProp.node.property, superProp.node.computed), binaryExpression(superProp.parentPath.node.operator[0], identifier(tmp.name), numericLiteral(1)))];
- if (!superProp.parentPath.node.prefix) {
- parts.push(identifier(tmp.name));
- }
- updateExpr.replaceWith(sequenceExpression(parts));
- const left = updateExpr.get("expressions.0.right");
- const right = updateExpr.get("expressions.1.left");
- return [left, right];
- }
- return [superProp];
- function rightExpression(op, left, right) {
- if (op === "=") {
- return assignmentExpression("=", left, right);
- } else {
- return binaryExpression(op, left, right);
- }
- }
-}
-function hasSuperClass(thisEnvFn) {
- return thisEnvFn.isClassMethod() && !!thisEnvFn.parentPath.parentPath.node.superClass;
-}
-const assignSuperThisVisitor = (0, _visitors.merge)([{
- CallExpression(child, {
- supers,
- thisBinding
- }) {
- if (!child.get("callee").isSuper()) return;
- if (supers.has(child.node)) return;
- supers.add(child.node);
- child.replaceWithMultiple([child.node, assignmentExpression("=", identifier(thisBinding), identifier("this"))]);
- }
-}, _helperEnvironmentVisitor.default]);
-function getThisBinding(thisEnvFn, inConstructor) {
- return getBinding(thisEnvFn, "this", thisBinding => {
- if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();
- thisEnvFn.traverse(assignSuperThisVisitor, {
- supers: new WeakSet(),
- thisBinding
- });
- });
-}
-function getSuperBinding(thisEnvFn) {
- return getBinding(thisEnvFn, "supercall", () => {
- const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
- return arrowFunctionExpression([restElement(argsBinding)], callExpression(_super(), [spreadElement(identifier(argsBinding.name))]));
- });
-}
-function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
- const op = isAssignment ? "set" : "get";
- return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => {
- const argsList = [];
- let fnBody;
- if (propName) {
- fnBody = memberExpression(_super(), identifier(propName));
- } else {
- const method = thisEnvFn.scope.generateUidIdentifier("prop");
- argsList.unshift(method);
- fnBody = memberExpression(_super(), identifier(method.name), true);
- }
- if (isAssignment) {
- const valueIdent = thisEnvFn.scope.generateUidIdentifier("value");
- argsList.push(valueIdent);
- fnBody = assignmentExpression("=", fnBody, identifier(valueIdent.name));
- }
- return arrowFunctionExpression(argsList, fnBody);
- });
-}
-function getBinding(thisEnvFn, key, init) {
- const cacheKey = "binding:" + key;
- let data = thisEnvFn.getData(cacheKey);
- if (!data) {
- const id = thisEnvFn.scope.generateUidIdentifier(key);
- data = id.name;
- thisEnvFn.setData(cacheKey, data);
- thisEnvFn.scope.push({
- id: id,
- init: init(data)
- });
- }
- return data;
-}
-const getScopeInformationVisitor = (0, _visitors.merge)([{
- ThisExpression(child, {
- thisPaths
- }) {
- thisPaths.push(child);
- },
- JSXIdentifier(child, {
- thisPaths
- }) {
- if (child.node.name !== "this") return;
- if (!child.parentPath.isJSXMemberExpression({
- object: child.node
- }) && !child.parentPath.isJSXOpeningElement({
- name: child.node
- })) {
- return;
- }
- thisPaths.push(child);
- },
- CallExpression(child, {
- superCalls
- }) {
- if (child.get("callee").isSuper()) superCalls.push(child);
- },
- MemberExpression(child, {
- superProps
- }) {
- if (child.get("object").isSuper()) superProps.push(child);
- },
- Identifier(child, {
- argumentsPaths
- }) {
- if (!child.isReferencedIdentifier({
- name: "arguments"
- })) return;
- let curr = child.scope;
- do {
- if (curr.hasOwnBinding("arguments")) {
- curr.rename("arguments");
- return;
- }
- if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {
- break;
- }
- } while (curr = curr.parent);
- argumentsPaths.push(child);
- },
- MetaProperty(child, {
- newTargetPaths
- }) {
- if (!child.get("meta").isIdentifier({
- name: "new"
- })) return;
- if (!child.get("property").isIdentifier({
- name: "target"
- })) return;
- newTargetPaths.push(child);
- }
-}, _helperEnvironmentVisitor.default]);
-function getScopeInformation(fnPath) {
- const thisPaths = [];
- const argumentsPaths = [];
- const newTargetPaths = [];
- const superProps = [];
- const superCalls = [];
- fnPath.traverse(getScopeInformationVisitor, {
- thisPaths,
- argumentsPaths,
- newTargetPaths,
- superProps,
- superCalls
- });
- return {
- thisPaths,
- argumentsPaths,
- newTargetPaths,
- superProps,
- superCalls
- };
-}
-
-//# sourceMappingURL=conversion.js.map
-
-
-/***/ }),
-
-/***/ 7969:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.evaluate = evaluate;
-exports.evaluateTruthy = evaluateTruthy;
-const VALID_OBJECT_CALLEES = ["Number", "String", "Math"];
-const VALID_IDENTIFIER_CALLEES = ["isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", null, null];
-const INVALID_METHODS = ["random"];
-function isValidObjectCallee(val) {
- return VALID_OBJECT_CALLEES.includes(val);
-}
-function isValidIdentifierCallee(val) {
- return VALID_IDENTIFIER_CALLEES.includes(val);
-}
-function isInvalidMethod(val) {
- return INVALID_METHODS.includes(val);
-}
-function evaluateTruthy() {
- const res = this.evaluate();
- if (res.confident) return !!res.value;
-}
-function deopt(path, state) {
- if (!state.confident) return;
- state.deoptPath = path;
- state.confident = false;
-}
-const Globals = new Map([["undefined", undefined], ["Infinity", Infinity], ["NaN", NaN]]);
-function evaluateCached(path, state) {
- const {
- node
- } = path;
- const {
- seen
- } = state;
- if (seen.has(node)) {
- const existing = seen.get(node);
- if (existing.resolved) {
- return existing.value;
- } else {
- deopt(path, state);
- return;
- }
- } else {
- const item = {
- resolved: false
- };
- seen.set(node, item);
- const val = _evaluate(path, state);
- if (state.confident) {
- item.resolved = true;
- item.value = val;
- }
- return val;
- }
-}
-function _evaluate(path, state) {
- if (!state.confident) return;
- if (path.isSequenceExpression()) {
- const exprs = path.get("expressions");
- return evaluateCached(exprs[exprs.length - 1], state);
- }
- if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
- return path.node.value;
- }
- if (path.isNullLiteral()) {
- return null;
- }
- if (path.isTemplateLiteral()) {
- return evaluateQuasis(path, path.node.quasis, state);
- }
- if (path.isTaggedTemplateExpression() && path.get("tag").isMemberExpression()) {
- const object = path.get("tag.object");
- const {
- node: {
- name
- }
- } = object;
- const property = path.get("tag.property");
- if (object.isIdentifier() && name === "String" && !path.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
- return evaluateQuasis(path, path.node.quasi.quasis, state, true);
- }
- }
- if (path.isConditionalExpression()) {
- const testResult = evaluateCached(path.get("test"), state);
- if (!state.confident) return;
- if (testResult) {
- return evaluateCached(path.get("consequent"), state);
- } else {
- return evaluateCached(path.get("alternate"), state);
- }
- }
- if (path.isExpressionWrapper()) {
- return evaluateCached(path.get("expression"), state);
- }
- if (path.isMemberExpression() && !path.parentPath.isCallExpression({
- callee: path.node
- })) {
- const property = path.get("property");
- const object = path.get("object");
- if (object.isLiteral()) {
- const value = object.node.value;
- const type = typeof value;
- let key = null;
- if (path.node.computed) {
- key = evaluateCached(property, state);
- if (!state.confident) return;
- } else if (property.isIdentifier()) {
- key = property.node.name;
- }
- if ((type === "number" || type === "string") && key != null && (typeof key === "number" || typeof key === "string")) {
- return value[key];
- }
- }
- }
- if (path.isReferencedIdentifier()) {
- const binding = path.scope.getBinding(path.node.name);
- if (binding) {
- if (binding.constantViolations.length > 0 || path.node.start < binding.path.node.end) {
- deopt(binding.path, state);
- return;
- }
- if (binding.hasValue) {
- return binding.value;
- }
- }
- const name = path.node.name;
- if (Globals.has(name)) {
- if (!binding) {
- return Globals.get(name);
- }
- deopt(binding.path, state);
- return;
- }
- const resolved = path.resolve();
- if (resolved === path) {
- deopt(path, state);
- return;
- } else {
- return evaluateCached(resolved, state);
- }
- }
- if (path.isUnaryExpression({
- prefix: true
- })) {
- if (path.node.operator === "void") {
- return undefined;
- }
- const argument = path.get("argument");
- if (path.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
- return "function";
- }
- const arg = evaluateCached(argument, state);
- if (!state.confident) return;
- switch (path.node.operator) {
- case "!":
- return !arg;
- case "+":
- return +arg;
- case "-":
- return -arg;
- case "~":
- return ~arg;
- case "typeof":
- return typeof arg;
- }
- }
- if (path.isArrayExpression()) {
- const arr = [];
- const elems = path.get("elements");
- for (const elem of elems) {
- const elemValue = elem.evaluate();
- if (elemValue.confident) {
- arr.push(elemValue.value);
- } else {
- deopt(elemValue.deopt, state);
- return;
- }
- }
- return arr;
- }
- if (path.isObjectExpression()) {
- const obj = {};
- const props = path.get("properties");
- for (const prop of props) {
- if (prop.isObjectMethod() || prop.isSpreadElement()) {
- deopt(prop, state);
- return;
- }
- const keyPath = prop.get("key");
- let key;
- if (prop.node.computed) {
- key = keyPath.evaluate();
- if (!key.confident) {
- deopt(key.deopt, state);
- return;
- }
- key = key.value;
- } else if (keyPath.isIdentifier()) {
- key = keyPath.node.name;
- } else {
- key = keyPath.node.value;
- }
- const valuePath = prop.get("value");
- let value = valuePath.evaluate();
- if (!value.confident) {
- deopt(value.deopt, state);
- return;
- }
- value = value.value;
- obj[key] = value;
- }
- return obj;
- }
- if (path.isLogicalExpression()) {
- const wasConfident = state.confident;
- const left = evaluateCached(path.get("left"), state);
- const leftConfident = state.confident;
- state.confident = wasConfident;
- const right = evaluateCached(path.get("right"), state);
- const rightConfident = state.confident;
- switch (path.node.operator) {
- case "||":
- state.confident = leftConfident && (!!left || rightConfident);
- if (!state.confident) return;
- return left || right;
- case "&&":
- state.confident = leftConfident && (!left || rightConfident);
- if (!state.confident) return;
- return left && right;
- case "??":
- state.confident = leftConfident && (left != null || rightConfident);
- if (!state.confident) return;
- return left != null ? left : right;
- }
- }
- if (path.isBinaryExpression()) {
- const left = evaluateCached(path.get("left"), state);
- if (!state.confident) return;
- const right = evaluateCached(path.get("right"), state);
- if (!state.confident) return;
- switch (path.node.operator) {
- case "-":
- return left - right;
- case "+":
- return left + right;
- case "/":
- return left / right;
- case "*":
- return left * right;
- case "%":
- return left % right;
- case "**":
- return Math.pow(left, right);
- case "<":
- return left < right;
- case ">":
- return left > right;
- case "<=":
- return left <= right;
- case ">=":
- return left >= right;
- case "==":
- return left == right;
- case "!=":
- return left != right;
- case "===":
- return left === right;
- case "!==":
- return left !== right;
- case "|":
- return left | right;
- case "&":
- return left & right;
- case "^":
- return left ^ right;
- case "<<":
- return left << right;
- case ">>":
- return left >> right;
- case ">>>":
- return left >>> right;
- }
- }
- if (path.isCallExpression()) {
- const callee = path.get("callee");
- let context;
- let func;
- if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && (isValidObjectCallee(callee.node.name) || isValidIdentifierCallee(callee.node.name))) {
- func = global[callee.node.name];
- }
- if (callee.isMemberExpression()) {
- const object = callee.get("object");
- const property = callee.get("property");
- if (object.isIdentifier() && property.isIdentifier() && isValidObjectCallee(object.node.name) && !isInvalidMethod(property.node.name)) {
- context = global[object.node.name];
- const key = property.node.name;
- if (Object.hasOwnProperty.call(context, key)) {
- func = context[key];
- }
- }
- if (object.isLiteral() && property.isIdentifier()) {
- const type = typeof object.node.value;
- if (type === "string" || type === "number") {
- context = object.node.value;
- func = context[property.node.name];
- }
- }
- }
- if (func) {
- const args = path.get("arguments").map(arg => evaluateCached(arg, state));
- if (!state.confident) return;
- return func.apply(context, args);
- }
- }
- deopt(path, state);
-}
-function evaluateQuasis(path, quasis, state, raw = false) {
- let str = "";
- let i = 0;
- const exprs = path.isTemplateLiteral() ? path.get("expressions") : path.get("quasi.expressions");
- for (const elem of quasis) {
- if (!state.confident) break;
- str += raw ? elem.value.raw : elem.value.cooked;
- const expr = exprs[i++];
- if (expr) str += String(evaluateCached(expr, state));
- }
- if (!state.confident) return;
- return str;
-}
-function evaluate() {
- const state = {
- confident: true,
- deoptPath: null,
- seen: new Map()
- };
- let value = evaluateCached(this, state);
- if (!state.confident) value = undefined;
- return {
- confident: state.confident,
- deopt: state.deoptPath,
- value: value
- };
-}
-
-//# sourceMappingURL=evaluation.js.map
-
-
-/***/ }),
-
-/***/ 9853:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._getKey = _getKey;
-exports._getPattern = _getPattern;
-exports.get = get;
-exports.getAllNextSiblings = getAllNextSiblings;
-exports.getAllPrevSiblings = getAllPrevSiblings;
-exports.getBindingIdentifierPaths = getBindingIdentifierPaths;
-exports.getBindingIdentifiers = getBindingIdentifiers;
-exports.getCompletionRecords = getCompletionRecords;
-exports.getNextSibling = getNextSibling;
-exports.getOpposite = getOpposite;
-exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
-exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
-exports.getPrevSibling = getPrevSibling;
-exports.getSibling = getSibling;
-var _index = __nccwpck_require__(8877);
-var _t = __nccwpck_require__(7912);
-const {
- getBindingIdentifiers: _getBindingIdentifiers,
- getOuterBindingIdentifiers: _getOuterBindingIdentifiers,
- isDeclaration,
- numericLiteral,
- unaryExpression
-} = _t;
-const NORMAL_COMPLETION = 0;
-const BREAK_COMPLETION = 1;
-function NormalCompletion(path) {
- return {
- type: NORMAL_COMPLETION,
- path
- };
-}
-function BreakCompletion(path) {
- return {
- type: BREAK_COMPLETION,
- path
- };
-}
-function getOpposite() {
- if (this.key === "left") {
- return this.getSibling("right");
- } else if (this.key === "right") {
- return this.getSibling("left");
- }
- return null;
-}
-function addCompletionRecords(path, records, context) {
- if (path) {
- records.push(..._getCompletionRecords(path, context));
- }
- return records;
-}
-function completionRecordForSwitch(cases, records, context) {
- let lastNormalCompletions = [];
- for (let i = 0; i < cases.length; i++) {
- const casePath = cases[i];
- const caseCompletions = _getCompletionRecords(casePath, context);
- const normalCompletions = [];
- const breakCompletions = [];
- for (const c of caseCompletions) {
- if (c.type === NORMAL_COMPLETION) {
- normalCompletions.push(c);
- }
- if (c.type === BREAK_COMPLETION) {
- breakCompletions.push(c);
- }
- }
- if (normalCompletions.length) {
- lastNormalCompletions = normalCompletions;
- }
- records.push(...breakCompletions);
- }
- records.push(...lastNormalCompletions);
- return records;
-}
-function normalCompletionToBreak(completions) {
- completions.forEach(c => {
- c.type = BREAK_COMPLETION;
- });
-}
-function replaceBreakStatementInBreakCompletion(completions, reachable) {
- completions.forEach(c => {
- if (c.path.isBreakStatement({
- label: null
- })) {
- if (reachable) {
- c.path.replaceWith(unaryExpression("void", numericLiteral(0)));
- } else {
- c.path.remove();
- }
- }
- });
-}
-function getStatementListCompletion(paths, context) {
- const completions = [];
- if (context.canHaveBreak) {
- let lastNormalCompletions = [];
- for (let i = 0; i < paths.length; i++) {
- const path = paths[i];
- const newContext = Object.assign({}, context, {
- inCaseClause: false
- });
- if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
- newContext.shouldPopulateBreak = true;
- } else {
- newContext.shouldPopulateBreak = false;
- }
- const statementCompletions = _getCompletionRecords(path, newContext);
- if (statementCompletions.length > 0 && statementCompletions.every(c => c.type === BREAK_COMPLETION)) {
- if (lastNormalCompletions.length > 0 && statementCompletions.every(c => c.path.isBreakStatement({
- label: null
- }))) {
- normalCompletionToBreak(lastNormalCompletions);
- completions.push(...lastNormalCompletions);
- if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
- completions.push(...statementCompletions);
- replaceBreakStatementInBreakCompletion(statementCompletions, true);
- }
- replaceBreakStatementInBreakCompletion(statementCompletions, false);
- } else {
- completions.push(...statementCompletions);
- if (!context.shouldPopulateBreak) {
- replaceBreakStatementInBreakCompletion(statementCompletions, true);
- }
- }
- break;
- }
- if (i === paths.length - 1) {
- completions.push(...statementCompletions);
- } else {
- lastNormalCompletions = [];
- for (let i = 0; i < statementCompletions.length; i++) {
- const c = statementCompletions[i];
- if (c.type === BREAK_COMPLETION) {
- completions.push(c);
- }
- if (c.type === NORMAL_COMPLETION) {
- lastNormalCompletions.push(c);
- }
- }
- }
- }
- } else if (paths.length) {
- for (let i = paths.length - 1; i >= 0; i--) {
- const pathCompletions = _getCompletionRecords(paths[i], context);
- if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
- completions.push(...pathCompletions);
- break;
- }
- }
- }
- return completions;
-}
-function _getCompletionRecords(path, context) {
- let records = [];
- if (path.isIfStatement()) {
- records = addCompletionRecords(path.get("consequent"), records, context);
- records = addCompletionRecords(path.get("alternate"), records, context);
- } else if (path.isDoExpression() || path.isFor() || path.isWhile() || path.isLabeledStatement()) {
- return addCompletionRecords(path.get("body"), records, context);
- } else if (path.isProgram() || path.isBlockStatement()) {
- return getStatementListCompletion(path.get("body"), context);
- } else if (path.isFunction()) {
- return _getCompletionRecords(path.get("body"), context);
- } else if (path.isTryStatement()) {
- records = addCompletionRecords(path.get("block"), records, context);
- records = addCompletionRecords(path.get("handler"), records, context);
- } else if (path.isCatchClause()) {
- return addCompletionRecords(path.get("body"), records, context);
- } else if (path.isSwitchStatement()) {
- return completionRecordForSwitch(path.get("cases"), records, context);
- } else if (path.isSwitchCase()) {
- return getStatementListCompletion(path.get("consequent"), {
- canHaveBreak: true,
- shouldPopulateBreak: false,
- inCaseClause: true
- });
- } else if (path.isBreakStatement()) {
- records.push(BreakCompletion(path));
- } else {
- records.push(NormalCompletion(path));
- }
- return records;
-}
-function getCompletionRecords() {
- const records = _getCompletionRecords(this, {
- canHaveBreak: false,
- shouldPopulateBreak: false,
- inCaseClause: false
- });
- return records.map(r => r.path);
-}
-function getSibling(key) {
- return _index.default.get({
- parentPath: this.parentPath,
- parent: this.parent,
- container: this.container,
- listKey: this.listKey,
- key: key
- }).setContext(this.context);
-}
-function getPrevSibling() {
- return this.getSibling(this.key - 1);
-}
-function getNextSibling() {
- return this.getSibling(this.key + 1);
-}
-function getAllNextSiblings() {
- let _key = this.key;
- let sibling = this.getSibling(++_key);
- const siblings = [];
- while (sibling.node) {
- siblings.push(sibling);
- sibling = this.getSibling(++_key);
- }
- return siblings;
-}
-function getAllPrevSiblings() {
- let _key = this.key;
- let sibling = this.getSibling(--_key);
- const siblings = [];
- while (sibling.node) {
- siblings.push(sibling);
- sibling = this.getSibling(--_key);
- }
- return siblings;
-}
-function get(key, context = true) {
- if (context === true) context = this.context;
- const parts = key.split(".");
- if (parts.length === 1) {
- return this._getKey(key, context);
- } else {
- return this._getPattern(parts, context);
- }
-}
-function _getKey(key, context) {
- const node = this.node;
- const container = node[key];
- if (Array.isArray(container)) {
- return container.map((_, i) => {
- return _index.default.get({
- listKey: key,
- parentPath: this,
- parent: node,
- container: container,
- key: i
- }).setContext(context);
- });
- } else {
- return _index.default.get({
- parentPath: this,
- parent: node,
- container: node,
- key: key
- }).setContext(context);
- }
-}
-function _getPattern(parts, context) {
- let path = this;
- for (const part of parts) {
- if (part === ".") {
- path = path.parentPath;
- } else {
- if (Array.isArray(path)) {
- path = path[part];
- } else {
- path = path.get(part, context);
- }
- }
- }
- return path;
-}
-function getBindingIdentifiers(duplicates) {
- return _getBindingIdentifiers(this.node, duplicates);
-}
-function getOuterBindingIdentifiers(duplicates) {
- return _getOuterBindingIdentifiers(this.node, duplicates);
-}
-function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
- const path = this;
- const search = [path];
- const ids = Object.create(null);
- while (search.length) {
- const id = search.shift();
- if (!id) continue;
- if (!id.node) continue;
- const keys = _getBindingIdentifiers.keys[id.node.type];
- if (id.isIdentifier()) {
- if (duplicates) {
- const _ids = ids[id.node.name] = ids[id.node.name] || [];
- _ids.push(id);
- } else {
- ids[id.node.name] = id;
- }
- continue;
- }
- if (id.isExportDeclaration()) {
- const declaration = id.get("declaration");
- if (isDeclaration(declaration)) {
- search.push(declaration);
- }
- continue;
- }
- if (outerOnly) {
- if (id.isFunctionDeclaration()) {
- search.push(id.get("id"));
- continue;
- }
- if (id.isFunctionExpression()) {
- continue;
- }
- }
- if (keys) {
- for (let i = 0; i < keys.length; i++) {
- const key = keys[i];
- const child = id.get(key);
- if (Array.isArray(child)) {
- search.push(...child);
- } else if (child.node) {
- search.push(child);
- }
- }
- }
- }
- return ids;
-}
-function getOuterBindingIdentifierPaths(duplicates = false) {
- return this.getBindingIdentifierPaths(duplicates, true);
-}
-
-//# sourceMappingURL=family.js.map
-
-
-/***/ }),
-
-/***/ 8877:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = exports.SHOULD_STOP = exports.SHOULD_SKIP = exports.REMOVED = void 0;
-var virtualTypes = __nccwpck_require__(4425);
-var _debug = __nccwpck_require__(8237);
-var _index = __nccwpck_require__(1380);
-var _index2 = __nccwpck_require__(891);
-var _t = __nccwpck_require__(7912);
-var t = _t;
-var cache = __nccwpck_require__(5069);
-var _generator = __nccwpck_require__(2332);
-var NodePath_ancestry = __nccwpck_require__(6411);
-var NodePath_inference = __nccwpck_require__(8045);
-var NodePath_replacement = __nccwpck_require__(8805);
-var NodePath_evaluation = __nccwpck_require__(7969);
-var NodePath_conversion = __nccwpck_require__(277);
-var NodePath_introspection = __nccwpck_require__(217);
-var NodePath_context = __nccwpck_require__(4108);
-var NodePath_removal = __nccwpck_require__(408);
-var NodePath_modification = __nccwpck_require__(7575);
-var NodePath_family = __nccwpck_require__(9853);
-var NodePath_comments = __nccwpck_require__(7354);
-var NodePath_virtual_types_validator = __nccwpck_require__(4859);
-const {
- validate
-} = _t;
-const debug = _debug("babel");
-const REMOVED = 1 << 0;
-exports.REMOVED = REMOVED;
-const SHOULD_STOP = 1 << 1;
-exports.SHOULD_STOP = SHOULD_STOP;
-const SHOULD_SKIP = 1 << 2;
-exports.SHOULD_SKIP = SHOULD_SKIP;
-class NodePath {
- constructor(hub, parent) {
- this.contexts = [];
- this.state = null;
- this.opts = null;
- this._traverseFlags = 0;
- this.skipKeys = null;
- this.parentPath = null;
- this.container = null;
- this.listKey = null;
- this.key = null;
- this.node = null;
- this.type = null;
- this.parent = parent;
- this.hub = hub;
- this.data = null;
- this.context = null;
- this.scope = null;
- }
- static get({
- hub,
- parentPath,
- parent,
- container,
- listKey,
- key
- }) {
- if (!hub && parentPath) {
- hub = parentPath.hub;
- }
- if (!parent) {
- throw new Error("To get a node path the parent needs to exist");
- }
- const targetNode = container[key];
- const paths = cache.getOrCreateCachedPaths(hub, parent);
- let path = paths.get(targetNode);
- if (!path) {
- path = new NodePath(hub, parent);
- if (targetNode) paths.set(targetNode, path);
- }
- path.setup(parentPath, container, listKey, key);
- return path;
- }
- getScope(scope) {
- return this.isScope() ? new _index2.default(this) : scope;
- }
- setData(key, val) {
- if (this.data == null) {
- this.data = Object.create(null);
- }
- return this.data[key] = val;
- }
- getData(key, def) {
- if (this.data == null) {
- this.data = Object.create(null);
- }
- let val = this.data[key];
- if (val === undefined && def !== undefined) val = this.data[key] = def;
- return val;
- }
- hasNode() {
- return this.node != null;
- }
- buildCodeFrameError(msg, Error = SyntaxError) {
- return this.hub.buildError(this.node, msg, Error);
- }
- traverse(visitor, state) {
- (0, _index.default)(this.node, visitor, this.scope, state, this);
- }
- set(key, node) {
- validate(this.node, key, node);
- this.node[key] = node;
- }
- getPathLocation() {
- const parts = [];
- let path = this;
- do {
- let key = path.key;
- if (path.inList) key = `${path.listKey}[${key}]`;
- parts.unshift(key);
- } while (path = path.parentPath);
- return parts.join(".");
- }
- debug(message) {
- if (!debug.enabled) return;
- debug(`${this.getPathLocation()} ${this.type}: ${message}`);
- }
- toString() {
- return (0, _generator.default)(this.node).code;
- }
- get inList() {
- return !!this.listKey;
- }
- set inList(inList) {
- if (!inList) {
- this.listKey = null;
- }
- }
- get parentKey() {
- return this.listKey || this.key;
- }
- get shouldSkip() {
- return !!(this._traverseFlags & SHOULD_SKIP);
- }
- set shouldSkip(v) {
- if (v) {
- this._traverseFlags |= SHOULD_SKIP;
- } else {
- this._traverseFlags &= ~SHOULD_SKIP;
- }
- }
- get shouldStop() {
- return !!(this._traverseFlags & SHOULD_STOP);
- }
- set shouldStop(v) {
- if (v) {
- this._traverseFlags |= SHOULD_STOP;
- } else {
- this._traverseFlags &= ~SHOULD_STOP;
- }
- }
- get removed() {
- return !!(this._traverseFlags & REMOVED);
- }
- set removed(v) {
- if (v) {
- this._traverseFlags |= REMOVED;
- } else {
- this._traverseFlags &= ~REMOVED;
- }
- }
-}
-Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
-{
- NodePath.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
-}
-for (const type of t.TYPES) {
- const typeKey = `is${type}`;
- const fn = t[typeKey];
- NodePath.prototype[typeKey] = function (opts) {
- return fn(this.node, opts);
- };
- NodePath.prototype[`assert${type}`] = function (opts) {
- if (!fn(this.node, opts)) {
- throw new TypeError(`Expected node path of type ${type}`);
- }
- };
-}
-Object.assign(NodePath.prototype, NodePath_virtual_types_validator);
-for (const type of Object.keys(virtualTypes)) {
- if (type[0] === "_") continue;
- if (!t.TYPES.includes(type)) t.TYPES.push(type);
-}
-var _default = NodePath;
-exports["default"] = _default;
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 8045:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._getTypeAnnotation = _getTypeAnnotation;
-exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches;
-exports.couldBeBaseType = couldBeBaseType;
-exports.getTypeAnnotation = getTypeAnnotation;
-exports.isBaseType = isBaseType;
-exports.isGenericType = isGenericType;
-var inferers = __nccwpck_require__(9129);
-var _t = __nccwpck_require__(7912);
-const {
- anyTypeAnnotation,
- isAnyTypeAnnotation,
- isArrayTypeAnnotation,
- isBooleanTypeAnnotation,
- isEmptyTypeAnnotation,
- isFlowBaseAnnotation,
- isGenericTypeAnnotation,
- isIdentifier,
- isMixedTypeAnnotation,
- isNumberTypeAnnotation,
- isStringTypeAnnotation,
- isTSArrayType,
- isTSTypeAnnotation,
- isTSTypeReference,
- isTupleTypeAnnotation,
- isTypeAnnotation,
- isUnionTypeAnnotation,
- isVoidTypeAnnotation,
- stringTypeAnnotation,
- voidTypeAnnotation
-} = _t;
-function getTypeAnnotation() {
- let type = this.getData("typeAnnotation");
- if (type != null) {
- return type;
- }
- type = this._getTypeAnnotation() || anyTypeAnnotation();
- if (isTypeAnnotation(type) || isTSTypeAnnotation(type)) {
- type = type.typeAnnotation;
- }
- this.setData("typeAnnotation", type);
- return type;
-}
-const typeAnnotationInferringNodes = new WeakSet();
-function _getTypeAnnotation() {
- const node = this.node;
- if (!node) {
- if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
- const declar = this.parentPath.parentPath;
- const declarParent = declar.parentPath;
- if (declar.key === "left" && declarParent.isForInStatement()) {
- return stringTypeAnnotation();
- }
- if (declar.key === "left" && declarParent.isForOfStatement()) {
- return anyTypeAnnotation();
- }
- return voidTypeAnnotation();
- } else {
- return;
- }
- }
- if (node.typeAnnotation) {
- return node.typeAnnotation;
- }
- if (typeAnnotationInferringNodes.has(node)) {
- return;
- }
- typeAnnotationInferringNodes.add(node);
- try {
- var _inferer;
- let inferer = inferers[node.type];
- if (inferer) {
- return inferer.call(this, node);
- }
- inferer = inferers[this.parentPath.type];
- if ((_inferer = inferer) != null && _inferer.validParent) {
- return this.parentPath.getTypeAnnotation();
- }
- } finally {
- typeAnnotationInferringNodes.delete(node);
- }
-}
-function isBaseType(baseName, soft) {
- return _isBaseType(baseName, this.getTypeAnnotation(), soft);
-}
-function _isBaseType(baseName, type, soft) {
- if (baseName === "string") {
- return isStringTypeAnnotation(type);
- } else if (baseName === "number") {
- return isNumberTypeAnnotation(type);
- } else if (baseName === "boolean") {
- return isBooleanTypeAnnotation(type);
- } else if (baseName === "any") {
- return isAnyTypeAnnotation(type);
- } else if (baseName === "mixed") {
- return isMixedTypeAnnotation(type);
- } else if (baseName === "empty") {
- return isEmptyTypeAnnotation(type);
- } else if (baseName === "void") {
- return isVoidTypeAnnotation(type);
- } else {
- if (soft) {
- return false;
- } else {
- throw new Error(`Unknown base type ${baseName}`);
- }
- }
-}
-function couldBeBaseType(name) {
- const type = this.getTypeAnnotation();
- if (isAnyTypeAnnotation(type)) return true;
- if (isUnionTypeAnnotation(type)) {
- for (const type2 of type.types) {
- if (isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
- return true;
- }
- }
- return false;
- } else {
- return _isBaseType(name, type, true);
- }
-}
-function baseTypeStrictlyMatches(rightArg) {
- const left = this.getTypeAnnotation();
- const right = rightArg.getTypeAnnotation();
- if (!isAnyTypeAnnotation(left) && isFlowBaseAnnotation(left)) {
- return right.type === left.type;
- }
- return false;
-}
-function isGenericType(genericName) {
- const type = this.getTypeAnnotation();
- if (genericName === "Array") {
- if (isTSArrayType(type) || isArrayTypeAnnotation(type) || isTupleTypeAnnotation(type)) {
- return true;
- }
- }
- return isGenericTypeAnnotation(type) && isIdentifier(type.id, {
- name: genericName
- }) || isTSTypeReference(type) && isIdentifier(type.typeName, {
- name: genericName
- });
-}
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 2354:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = _default;
-var _t = __nccwpck_require__(7912);
-var _util = __nccwpck_require__(8456);
-const {
- BOOLEAN_NUMBER_BINARY_OPERATORS,
- createTypeAnnotationBasedOnTypeof,
- numberTypeAnnotation,
- voidTypeAnnotation
-} = _t;
-function _default(node) {
- if (!this.isReferenced()) return;
- const binding = this.scope.getBinding(node.name);
- if (binding) {
- if (binding.identifier.typeAnnotation) {
- return binding.identifier.typeAnnotation;
- } else {
- return getTypeAnnotationBindingConstantViolations(binding, this, node.name);
- }
- }
- if (node.name === "undefined") {
- return voidTypeAnnotation();
- } else if (node.name === "NaN" || node.name === "Infinity") {
- return numberTypeAnnotation();
- } else if (node.name === "arguments") {}
-}
-function getTypeAnnotationBindingConstantViolations(binding, path, name) {
- const types = [];
- const functionConstantViolations = [];
- let constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations);
- const testType = getConditionalAnnotation(binding, path, name);
- if (testType) {
- const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
- constantViolations = constantViolations.filter(path => testConstantViolations.indexOf(path) < 0);
- types.push(testType.typeAnnotation);
- }
- if (constantViolations.length) {
- constantViolations.push(...functionConstantViolations);
- for (const violation of constantViolations) {
- types.push(violation.getTypeAnnotation());
- }
- }
- if (!types.length) {
- return;
- }
- return (0, _util.createUnionType)(types);
-}
-function getConstantViolationsBefore(binding, path, functions) {
- const violations = binding.constantViolations.slice();
- violations.unshift(binding.path);
- return violations.filter(violation => {
- violation = violation.resolve();
- const status = violation._guessExecutionStatusRelativeTo(path);
- if (functions && status === "unknown") functions.push(violation);
- return status === "before";
- });
-}
-function inferAnnotationFromBinaryExpression(name, path) {
- const operator = path.node.operator;
- const right = path.get("right").resolve();
- const left = path.get("left").resolve();
- let target;
- if (left.isIdentifier({
- name
- })) {
- target = right;
- } else if (right.isIdentifier({
- name
- })) {
- target = left;
- }
- if (target) {
- if (operator === "===") {
- return target.getTypeAnnotation();
- }
- if (BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
- return numberTypeAnnotation();
- }
- return;
- }
- if (operator !== "===" && operator !== "==") return;
- let typeofPath;
- let typePath;
- if (left.isUnaryExpression({
- operator: "typeof"
- })) {
- typeofPath = left;
- typePath = right;
- } else if (right.isUnaryExpression({
- operator: "typeof"
- })) {
- typeofPath = right;
- typePath = left;
- }
- if (!typeofPath) return;
- if (!typeofPath.get("argument").isIdentifier({
- name
- })) return;
- typePath = typePath.resolve();
- if (!typePath.isLiteral()) return;
- const typeValue = typePath.node.value;
- if (typeof typeValue !== "string") return;
- return createTypeAnnotationBasedOnTypeof(typeValue);
-}
-function getParentConditionalPath(binding, path, name) {
- let parentPath;
- while (parentPath = path.parentPath) {
- if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
- if (path.key === "test") {
- return;
- }
- return parentPath;
- }
- if (parentPath.isFunction()) {
- if (parentPath.parentPath.scope.getBinding(name) !== binding) return;
- }
- path = parentPath;
- }
-}
-function getConditionalAnnotation(binding, path, name) {
- const ifStatement = getParentConditionalPath(binding, path, name);
- if (!ifStatement) return;
- const test = ifStatement.get("test");
- const paths = [test];
- const types = [];
- for (let i = 0; i < paths.length; i++) {
- const path = paths[i];
- if (path.isLogicalExpression()) {
- if (path.node.operator === "&&") {
- paths.push(path.get("left"));
- paths.push(path.get("right"));
- }
- } else if (path.isBinaryExpression()) {
- const type = inferAnnotationFromBinaryExpression(name, path);
- if (type) types.push(type);
- }
- }
- if (types.length) {
- return {
- typeAnnotation: (0, _util.createUnionType)(types),
- ifStatement
- };
- }
- return getConditionalAnnotation(binding, ifStatement, name);
-}
-
-//# sourceMappingURL=inferer-reference.js.map
-
-
-/***/ }),
-
-/***/ 9129:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.ArrayExpression = ArrayExpression;
-exports.AssignmentExpression = AssignmentExpression;
-exports.BinaryExpression = BinaryExpression;
-exports.BooleanLiteral = BooleanLiteral;
-exports.CallExpression = CallExpression;
-exports.ConditionalExpression = ConditionalExpression;
-exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = Func;
-Object.defineProperty(exports, "Identifier", ({
- enumerable: true,
- get: function () {
- return _infererReference.default;
- }
-}));
-exports.LogicalExpression = LogicalExpression;
-exports.NewExpression = NewExpression;
-exports.NullLiteral = NullLiteral;
-exports.NumericLiteral = NumericLiteral;
-exports.ObjectExpression = ObjectExpression;
-exports.ParenthesizedExpression = ParenthesizedExpression;
-exports.RegExpLiteral = RegExpLiteral;
-exports.RestElement = RestElement;
-exports.SequenceExpression = SequenceExpression;
-exports.StringLiteral = StringLiteral;
-exports.TSAsExpression = TSAsExpression;
-exports.TSNonNullExpression = TSNonNullExpression;
-exports.TaggedTemplateExpression = TaggedTemplateExpression;
-exports.TemplateLiteral = TemplateLiteral;
-exports.TypeCastExpression = TypeCastExpression;
-exports.UnaryExpression = UnaryExpression;
-exports.UpdateExpression = UpdateExpression;
-exports.VariableDeclarator = VariableDeclarator;
-var _t = __nccwpck_require__(7912);
-var _infererReference = __nccwpck_require__(2354);
-var _util = __nccwpck_require__(8456);
-const {
- BOOLEAN_BINARY_OPERATORS,
- BOOLEAN_UNARY_OPERATORS,
- NUMBER_BINARY_OPERATORS,
- NUMBER_UNARY_OPERATORS,
- STRING_UNARY_OPERATORS,
- anyTypeAnnotation,
- arrayTypeAnnotation,
- booleanTypeAnnotation,
- buildMatchMemberExpression,
- genericTypeAnnotation,
- identifier,
- nullLiteralTypeAnnotation,
- numberTypeAnnotation,
- stringTypeAnnotation,
- tupleTypeAnnotation,
- unionTypeAnnotation,
- voidTypeAnnotation,
- isIdentifier
-} = _t;
-function VariableDeclarator() {
- if (!this.get("id").isIdentifier()) return;
- return this.get("init").getTypeAnnotation();
-}
-function TypeCastExpression(node) {
- return node.typeAnnotation;
-}
-TypeCastExpression.validParent = true;
-function TSAsExpression(node) {
- return node.typeAnnotation;
-}
-TSAsExpression.validParent = true;
-function TSNonNullExpression() {
- return this.get("expression").getTypeAnnotation();
-}
-function NewExpression(node) {
- if (node.callee.type === "Identifier") {
- return genericTypeAnnotation(node.callee);
- }
-}
-function TemplateLiteral() {
- return stringTypeAnnotation();
-}
-function UnaryExpression(node) {
- const operator = node.operator;
- if (operator === "void") {
- return voidTypeAnnotation();
- } else if (NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
- return numberTypeAnnotation();
- } else if (STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
- return stringTypeAnnotation();
- } else if (BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
- return booleanTypeAnnotation();
- }
-}
-function BinaryExpression(node) {
- const operator = node.operator;
- if (NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
- return numberTypeAnnotation();
- } else if (BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
- return booleanTypeAnnotation();
- } else if (operator === "+") {
- const right = this.get("right");
- const left = this.get("left");
- if (left.isBaseType("number") && right.isBaseType("number")) {
- return numberTypeAnnotation();
- } else if (left.isBaseType("string") || right.isBaseType("string")) {
- return stringTypeAnnotation();
- }
- return unionTypeAnnotation([stringTypeAnnotation(), numberTypeAnnotation()]);
- }
-}
-function LogicalExpression() {
- const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];
- return (0, _util.createUnionType)(argumentTypes);
-}
-function ConditionalExpression() {
- const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()];
- return (0, _util.createUnionType)(argumentTypes);
-}
-function SequenceExpression() {
- return this.get("expressions").pop().getTypeAnnotation();
-}
-function ParenthesizedExpression() {
- return this.get("expression").getTypeAnnotation();
-}
-function AssignmentExpression() {
- return this.get("right").getTypeAnnotation();
-}
-function UpdateExpression(node) {
- const operator = node.operator;
- if (operator === "++" || operator === "--") {
- return numberTypeAnnotation();
- }
-}
-function StringLiteral() {
- return stringTypeAnnotation();
-}
-function NumericLiteral() {
- return numberTypeAnnotation();
-}
-function BooleanLiteral() {
- return booleanTypeAnnotation();
-}
-function NullLiteral() {
- return nullLiteralTypeAnnotation();
-}
-function RegExpLiteral() {
- return genericTypeAnnotation(identifier("RegExp"));
-}
-function ObjectExpression() {
- return genericTypeAnnotation(identifier("Object"));
-}
-function ArrayExpression() {
- return genericTypeAnnotation(identifier("Array"));
-}
-function RestElement() {
- return ArrayExpression();
-}
-RestElement.validParent = true;
-function Func() {
- return genericTypeAnnotation(identifier("Function"));
-}
-const isArrayFrom = buildMatchMemberExpression("Array.from");
-const isObjectKeys = buildMatchMemberExpression("Object.keys");
-const isObjectValues = buildMatchMemberExpression("Object.values");
-const isObjectEntries = buildMatchMemberExpression("Object.entries");
-function CallExpression() {
- const {
- callee
- } = this.node;
- if (isObjectKeys(callee)) {
- return arrayTypeAnnotation(stringTypeAnnotation());
- } else if (isArrayFrom(callee) || isObjectValues(callee) || isIdentifier(callee, {
- name: "Array"
- })) {
- return arrayTypeAnnotation(anyTypeAnnotation());
- } else if (isObjectEntries(callee)) {
- return arrayTypeAnnotation(tupleTypeAnnotation([stringTypeAnnotation(), anyTypeAnnotation()]));
- }
- return resolveCall(this.get("callee"));
-}
-function TaggedTemplateExpression() {
- return resolveCall(this.get("tag"));
-}
-function resolveCall(callee) {
- callee = callee.resolve();
- if (callee.isFunction()) {
- const {
- node
- } = callee;
- if (node.async) {
- if (node.generator) {
- return genericTypeAnnotation(identifier("AsyncIterator"));
- } else {
- return genericTypeAnnotation(identifier("Promise"));
- }
- } else {
- if (node.generator) {
- return genericTypeAnnotation(identifier("Iterator"));
- } else if (callee.node.returnType) {
- return callee.node.returnType;
- } else {}
- }
- }
-}
-
-//# sourceMappingURL=inferers.js.map
-
-
-/***/ }),
-
-/***/ 8456:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.createUnionType = createUnionType;
-var _t = __nccwpck_require__(7912);
-const {
- createFlowUnionType,
- createTSUnionType,
- createUnionTypeAnnotation,
- isFlowType,
- isTSType
-} = _t;
-function createUnionType(types) {
- {
- if (isFlowType(types[0])) {
- if (createFlowUnionType) {
- return createFlowUnionType(types);
- }
- return createUnionTypeAnnotation(types);
- } else {
- if (createTSUnionType) {
- return createTSUnionType(types);
- }
- }
- }
-}
-
-//# sourceMappingURL=util.js.map
-
-
-/***/ }),
-
-/***/ 217:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo;
-exports._resolve = _resolve;
-exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression;
-exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement;
-exports.equals = equals;
-exports.getSource = getSource;
-exports.has = has;
-exports.is = void 0;
-exports.isCompletionRecord = isCompletionRecord;
-exports.isConstantExpression = isConstantExpression;
-exports.isInStrictMode = isInStrictMode;
-exports.isNodeType = isNodeType;
-exports.isStatementOrBlock = isStatementOrBlock;
-exports.isStatic = isStatic;
-exports.isnt = isnt;
-exports.matchesPattern = matchesPattern;
-exports.referencesImport = referencesImport;
-exports.resolve = resolve;
-exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
-var _t = __nccwpck_require__(7912);
-const {
- STATEMENT_OR_BLOCK_KEYS,
- VISITOR_KEYS,
- isBlockStatement,
- isExpression,
- isIdentifier,
- isLiteral,
- isStringLiteral,
- isType,
- matchesPattern: _matchesPattern
-} = _t;
-function matchesPattern(pattern, allowPartial) {
- return _matchesPattern(this.node, pattern, allowPartial);
-}
-function has(key) {
- const val = this.node && this.node[key];
- if (val && Array.isArray(val)) {
- return !!val.length;
- } else {
- return !!val;
- }
-}
-function isStatic() {
- return this.scope.isStatic(this.node);
-}
-const is = has;
-exports.is = is;
-function isnt(key) {
- return !this.has(key);
-}
-function equals(key, value) {
- return this.node[key] === value;
-}
-function isNodeType(type) {
- return isType(this.type, type);
-}
-function canHaveVariableDeclarationOrExpression() {
- return (this.key === "init" || this.key === "left") && this.parentPath.isFor();
-}
-function canSwapBetweenExpressionAndStatement(replacement) {
- if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) {
- return false;
- }
- if (this.isExpression()) {
- return isBlockStatement(replacement);
- } else if (this.isBlockStatement()) {
- return isExpression(replacement);
- }
- return false;
-}
-function isCompletionRecord(allowInsideFunction) {
- let path = this;
- let first = true;
- do {
- const {
- type,
- container
- } = path;
- if (!first && (path.isFunction() || type === "StaticBlock")) {
- return !!allowInsideFunction;
- }
- first = false;
- if (Array.isArray(container) && path.key !== container.length - 1) {
- return false;
- }
- } while ((path = path.parentPath) && !path.isProgram() && !path.isDoExpression());
- return true;
-}
-function isStatementOrBlock() {
- if (this.parentPath.isLabeledStatement() || isBlockStatement(this.container)) {
- return false;
- } else {
- return STATEMENT_OR_BLOCK_KEYS.includes(this.key);
- }
-}
-function referencesImport(moduleSource, importName) {
- if (!this.isReferencedIdentifier()) {
- if (this.isJSXMemberExpression() && this.node.property.name === importName || (this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? isStringLiteral(this.node.property, {
- value: importName
- }) : this.node.property.name === importName)) {
- const object = this.get("object");
- return object.isReferencedIdentifier() && object.referencesImport(moduleSource, "*");
- }
- return false;
- }
- const binding = this.scope.getBinding(this.node.name);
- if (!binding || binding.kind !== "module") return false;
- const path = binding.path;
- const parent = path.parentPath;
- if (!parent.isImportDeclaration()) return false;
- if (parent.node.source.value === moduleSource) {
- if (!importName) return true;
- } else {
- return false;
- }
- if (path.isImportDefaultSpecifier() && importName === "default") {
- return true;
- }
- if (path.isImportNamespaceSpecifier() && importName === "*") {
- return true;
- }
- if (path.isImportSpecifier() && isIdentifier(path.node.imported, {
- name: importName
- })) {
- return true;
- }
- return false;
-}
-function getSource() {
- const node = this.node;
- if (node.end) {
- const code = this.hub.getCode();
- if (code) return code.slice(node.start, node.end);
- }
- return "";
-}
-function willIMaybeExecuteBefore(target) {
- return this._guessExecutionStatusRelativeTo(target) !== "after";
-}
-function getOuterFunction(path) {
- return path.isProgram() ? path : (path.parentPath.scope.getFunctionParent() || path.parentPath.scope.getProgramParent()).path;
-}
-function isExecutionUncertain(type, key) {
- switch (type) {
- case "LogicalExpression":
- return key === "right";
- case "ConditionalExpression":
- case "IfStatement":
- return key === "consequent" || key === "alternate";
- case "WhileStatement":
- case "DoWhileStatement":
- case "ForInStatement":
- case "ForOfStatement":
- return key === "body";
- case "ForStatement":
- return key === "body" || key === "update";
- case "SwitchStatement":
- return key === "cases";
- case "TryStatement":
- return key === "handler";
- case "AssignmentPattern":
- return key === "right";
- case "OptionalMemberExpression":
- return key === "property";
- case "OptionalCallExpression":
- return key === "arguments";
- default:
- return false;
- }
-}
-function isExecutionUncertainInList(paths, maxIndex) {
- for (let i = 0; i < maxIndex; i++) {
- const path = paths[i];
- if (isExecutionUncertain(path.parent.type, path.parentKey)) {
- return true;
- }
- }
- return false;
-}
-const SYMBOL_CHECKING = Symbol();
-function _guessExecutionStatusRelativeTo(target) {
- return _guessExecutionStatusRelativeToCached(this, target, new Map());
-}
-function _guessExecutionStatusRelativeToCached(base, target, cache) {
- const funcParent = {
- this: getOuterFunction(base),
- target: getOuterFunction(target)
- };
- if (funcParent.target.node !== funcParent.this.node) {
- return _guessExecutionStatusRelativeToDifferentFunctionsCached(base, funcParent.target, cache);
- }
- const paths = {
- target: target.getAncestry(),
- this: base.getAncestry()
- };
- if (paths.target.indexOf(base) >= 0) return "after";
- if (paths.this.indexOf(target) >= 0) return "before";
- let commonPath;
- const commonIndex = {
- target: 0,
- this: 0
- };
- while (!commonPath && commonIndex.this < paths.this.length) {
- const path = paths.this[commonIndex.this];
- commonIndex.target = paths.target.indexOf(path);
- if (commonIndex.target >= 0) {
- commonPath = path;
- } else {
- commonIndex.this++;
- }
- }
- if (!commonPath) {
- throw new Error("Internal Babel error - The two compared nodes" + " don't appear to belong to the same program.");
- }
- if (isExecutionUncertainInList(paths.this, commonIndex.this - 1) || isExecutionUncertainInList(paths.target, commonIndex.target - 1)) {
- return "unknown";
- }
- const divergence = {
- this: paths.this[commonIndex.this - 1],
- target: paths.target[commonIndex.target - 1]
- };
- if (divergence.target.listKey && divergence.this.listKey && divergence.target.container === divergence.this.container) {
- return divergence.target.key > divergence.this.key ? "before" : "after";
- }
- const keys = VISITOR_KEYS[commonPath.type];
- const keyPosition = {
- this: keys.indexOf(divergence.this.parentKey),
- target: keys.indexOf(divergence.target.parentKey)
- };
- return keyPosition.target > keyPosition.this ? "before" : "after";
-}
-function _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache) {
- if (!target.isFunctionDeclaration()) {
- if (_guessExecutionStatusRelativeToCached(base, target, cache) === "before") {
- return "before";
- }
- return "unknown";
- } else if (target.parentPath.isExportDeclaration()) {
- return "unknown";
- }
- const binding = target.scope.getBinding(target.node.id.name);
- if (!binding.references) return "before";
- const referencePaths = binding.referencePaths;
- let allStatus;
- for (const path of referencePaths) {
- const childOfFunction = !!path.find(path => path.node === target.node);
- if (childOfFunction) continue;
- if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
- return "unknown";
- }
- const status = _guessExecutionStatusRelativeToCached(base, path, cache);
- if (allStatus && allStatus !== status) {
- return "unknown";
- } else {
- allStatus = status;
- }
- }
- return allStatus;
-}
-function _guessExecutionStatusRelativeToDifferentFunctionsCached(base, target, cache) {
- let nodeMap = cache.get(base.node);
- let cached;
- if (!nodeMap) {
- cache.set(base.node, nodeMap = new Map());
- } else if (cached = nodeMap.get(target.node)) {
- if (cached === SYMBOL_CHECKING) {
- return "unknown";
- }
- return cached;
- }
- nodeMap.set(target.node, SYMBOL_CHECKING);
- const result = _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache);
- nodeMap.set(target.node, result);
- return result;
-}
-function resolve(dangerous, resolved) {
- return this._resolve(dangerous, resolved) || this;
-}
-function _resolve(dangerous, resolved) {
- if (resolved && resolved.indexOf(this) >= 0) return;
- resolved = resolved || [];
- resolved.push(this);
- if (this.isVariableDeclarator()) {
- if (this.get("id").isIdentifier()) {
- return this.get("init").resolve(dangerous, resolved);
- } else {}
- } else if (this.isReferencedIdentifier()) {
- const binding = this.scope.getBinding(this.node.name);
- if (!binding) return;
- if (!binding.constant) return;
- if (binding.kind === "module") return;
- if (binding.path !== this) {
- const ret = binding.path.resolve(dangerous, resolved);
- if (this.find(parent => parent.node === ret.node)) return;
- return ret;
- }
- } else if (this.isTypeCastExpression()) {
- return this.get("expression").resolve(dangerous, resolved);
- } else if (dangerous && this.isMemberExpression()) {
- const targetKey = this.toComputedKey();
- if (!isLiteral(targetKey)) return;
- const targetName = targetKey.value;
- const target = this.get("object").resolve(dangerous, resolved);
- if (target.isObjectExpression()) {
- const props = target.get("properties");
- for (const prop of props) {
- if (!prop.isProperty()) continue;
- const key = prop.get("key");
- let match = prop.isnt("computed") && key.isIdentifier({
- name: targetName
- });
- match = match || key.isLiteral({
- value: targetName
- });
- if (match) return prop.get("value").resolve(dangerous, resolved);
- }
- } else if (target.isArrayExpression() && !isNaN(+targetName)) {
- const elems = target.get("elements");
- const elem = elems[targetName];
- if (elem) return elem.resolve(dangerous, resolved);
- }
- }
-}
-function isConstantExpression() {
- if (this.isIdentifier()) {
- const binding = this.scope.getBinding(this.node.name);
- if (!binding) return false;
- return binding.constant;
- }
- if (this.isLiteral()) {
- if (this.isRegExpLiteral()) {
- return false;
- }
- if (this.isTemplateLiteral()) {
- return this.get("expressions").every(expression => expression.isConstantExpression());
- }
- return true;
- }
- if (this.isUnaryExpression()) {
- if (this.node.operator !== "void") {
- return false;
- }
- return this.get("argument").isConstantExpression();
- }
- if (this.isBinaryExpression()) {
- const {
- operator
- } = this.node;
- return operator !== "in" && operator !== "instanceof" && this.get("left").isConstantExpression() && this.get("right").isConstantExpression();
- }
- return false;
-}
-function isInStrictMode() {
- const start = this.isProgram() ? this : this.parentPath;
- const strictParent = start.find(path => {
- if (path.isProgram({
- sourceType: "module"
- })) return true;
- if (path.isClass()) return true;
- if (path.isArrowFunctionExpression() && !path.get("body").isBlockStatement()) {
- return false;
- }
- let body;
- if (path.isFunction()) {
- body = path.node.body;
- } else if (path.isProgram()) {
- body = path.node;
- } else {
- return false;
- }
- for (const directive of body.directives) {
- if (directive.value.value === "use strict") {
- return true;
- }
- }
- });
- return !!strictParent;
-}
-
-//# sourceMappingURL=introspection.js.map
-
-
-/***/ }),
-
-/***/ 1225:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-var _t = __nccwpck_require__(7912);
-var _t2 = _t;
-const {
- react
-} = _t;
-const {
- cloneNode,
- jsxExpressionContainer,
- variableDeclaration,
- variableDeclarator
-} = _t2;
-const referenceVisitor = {
- ReferencedIdentifier(path, state) {
- if (path.isJSXIdentifier() && react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
- return;
- }
- if (path.node.name === "this") {
- let scope = path.scope;
- do {
- if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
- break;
- }
- } while (scope = scope.parent);
- if (scope) state.breakOnScopePaths.push(scope.path);
- }
- const binding = path.scope.getBinding(path.node.name);
- if (!binding) return;
- for (const violation of binding.constantViolations) {
- if (violation.scope !== binding.path.scope) {
- state.mutableBinding = true;
- path.stop();
- return;
- }
- }
- if (binding !== state.scope.getBinding(path.node.name)) return;
- state.bindings[path.node.name] = binding;
- }
-};
-class PathHoister {
- constructor(path, scope) {
- this.breakOnScopePaths = void 0;
- this.bindings = void 0;
- this.mutableBinding = void 0;
- this.scopes = void 0;
- this.scope = void 0;
- this.path = void 0;
- this.attachAfter = void 0;
- this.breakOnScopePaths = [];
- this.bindings = {};
- this.mutableBinding = false;
- this.scopes = [];
- this.scope = scope;
- this.path = path;
- this.attachAfter = false;
- }
- isCompatibleScope(scope) {
- for (const key of Object.keys(this.bindings)) {
- const binding = this.bindings[key];
- if (!scope.bindingIdentifierEquals(key, binding.identifier)) {
- return false;
- }
- }
- return true;
- }
- getCompatibleScopes() {
- let scope = this.path.scope;
- do {
- if (this.isCompatibleScope(scope)) {
- this.scopes.push(scope);
- } else {
- break;
- }
- if (this.breakOnScopePaths.indexOf(scope.path) >= 0) {
- break;
- }
- } while (scope = scope.parent);
- }
- getAttachmentPath() {
- let path = this._getAttachmentPath();
- if (!path) return;
- let targetScope = path.scope;
- if (targetScope.path === path) {
- targetScope = path.scope.parent;
- }
- if (targetScope.path.isProgram() || targetScope.path.isFunction()) {
- for (const name of Object.keys(this.bindings)) {
- if (!targetScope.hasOwnBinding(name)) continue;
- const binding = this.bindings[name];
- if (binding.kind === "param" || binding.path.parentKey === "params") {
- continue;
- }
- const bindingParentPath = this.getAttachmentParentForPath(binding.path);
- if (bindingParentPath.key >= path.key) {
- this.attachAfter = true;
- path = binding.path;
- for (const violationPath of binding.constantViolations) {
- if (this.getAttachmentParentForPath(violationPath).key > path.key) {
- path = violationPath;
- }
- }
- }
- }
- }
- return path;
- }
- _getAttachmentPath() {
- const scopes = this.scopes;
- const scope = scopes.pop();
- if (!scope) return;
- if (scope.path.isFunction()) {
- if (this.hasOwnParamBindings(scope)) {
- if (this.scope === scope) return;
- const bodies = scope.path.get("body").get("body");
- for (let i = 0; i < bodies.length; i++) {
- if (bodies[i].node._blockHoist) continue;
- return bodies[i];
- }
- } else {
- return this.getNextScopeAttachmentParent();
- }
- } else if (scope.path.isProgram()) {
- return this.getNextScopeAttachmentParent();
- }
- }
- getNextScopeAttachmentParent() {
- const scope = this.scopes.pop();
- if (scope) return this.getAttachmentParentForPath(scope.path);
- }
- getAttachmentParentForPath(path) {
- do {
- if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
- return path;
- }
- } while (path = path.parentPath);
- }
- hasOwnParamBindings(scope) {
- for (const name of Object.keys(this.bindings)) {
- if (!scope.hasOwnBinding(name)) continue;
- const binding = this.bindings[name];
- if (binding.kind === "param" && binding.constant) return true;
- }
- return false;
- }
- run() {
- this.path.traverse(referenceVisitor, this);
- if (this.mutableBinding) return;
- this.getCompatibleScopes();
- const attachTo = this.getAttachmentPath();
- if (!attachTo) return;
- if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
- let uid = attachTo.scope.generateUidIdentifier("ref");
- const declarator = variableDeclarator(uid, this.path.node);
- const insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
- const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : variableDeclaration("var", [declarator])]);
- const parent = this.path.parentPath;
- if (parent.isJSXElement() && this.path.container === parent.node.children) {
- uid = jsxExpressionContainer(uid);
- }
- this.path.replaceWith(cloneNode(uid));
- return attachTo.isVariableDeclarator() ? attached.get("init") : attached.get("declarations.0.init");
- }
-}
-exports["default"] = PathHoister;
-
-//# sourceMappingURL=hoister.js.map
-
-
-/***/ }),
-
-/***/ 1587:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.hooks = void 0;
-const hooks = [function (self, parent) {
- const removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement();
- if (removeParent) {
- parent.remove();
- return true;
- }
-}, function (self, parent) {
- if (parent.isSequenceExpression() && parent.node.expressions.length === 1) {
- parent.replaceWith(parent.node.expressions[0]);
- return true;
- }
-}, function (self, parent) {
- if (parent.isBinary()) {
- if (self.key === "left") {
- parent.replaceWith(parent.node.right);
- } else {
- parent.replaceWith(parent.node.left);
- }
- return true;
- }
-}, function (self, parent) {
- if (parent.isIfStatement() && self.key === "consequent" || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
- self.replaceWith({
- type: "BlockStatement",
- body: []
- });
- return true;
- }
-}];
-exports.hooks = hooks;
-
-//# sourceMappingURL=removal-hooks.js.map
-
-
-/***/ }),
-
-/***/ 4859:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.isBindingIdentifier = isBindingIdentifier;
-exports.isBlockScoped = isBlockScoped;
-exports.isExpression = isExpression;
-exports.isFlow = isFlow;
-exports.isForAwaitStatement = isForAwaitStatement;
-exports.isGenerated = isGenerated;
-exports.isPure = isPure;
-exports.isReferenced = isReferenced;
-exports.isReferencedIdentifier = isReferencedIdentifier;
-exports.isReferencedMemberExpression = isReferencedMemberExpression;
-exports.isRestProperty = isRestProperty;
-exports.isScope = isScope;
-exports.isSpreadProperty = isSpreadProperty;
-exports.isStatement = isStatement;
-exports.isUser = isUser;
-exports.isVar = isVar;
-var _t = __nccwpck_require__(7912);
-const {
- isBinding,
- isBlockScoped: nodeIsBlockScoped,
- isExportDeclaration,
- isExpression: nodeIsExpression,
- isFlow: nodeIsFlow,
- isForStatement,
- isForXStatement,
- isIdentifier,
- isImportDeclaration,
- isImportSpecifier,
- isJSXIdentifier,
- isJSXMemberExpression,
- isMemberExpression,
- isRestElement: nodeIsRestElement,
- isReferenced: nodeIsReferenced,
- isScope: nodeIsScope,
- isStatement: nodeIsStatement,
- isVar: nodeIsVar,
- isVariableDeclaration,
- react,
- isForOfStatement
-} = _t;
-const {
- isCompatTag
-} = react;
-function isReferencedIdentifier(opts) {
- const {
- node,
- parent
- } = this;
- if (!isIdentifier(node, opts) && !isJSXMemberExpression(parent, opts)) {
- if (isJSXIdentifier(node, opts)) {
- if (isCompatTag(node.name)) return false;
- } else {
- return false;
- }
- }
- return nodeIsReferenced(node, parent, this.parentPath.parent);
-}
-function isReferencedMemberExpression() {
- const {
- node,
- parent
- } = this;
- return isMemberExpression(node) && nodeIsReferenced(node, parent);
-}
-function isBindingIdentifier() {
- const {
- node,
- parent
- } = this;
- const grandparent = this.parentPath.parent;
- return isIdentifier(node) && isBinding(node, parent, grandparent);
-}
-function isStatement() {
- const {
- node,
- parent
- } = this;
- if (nodeIsStatement(node)) {
- if (isVariableDeclaration(node)) {
- if (isForXStatement(parent, {
- left: node
- })) return false;
- if (isForStatement(parent, {
- init: node
- })) return false;
- }
- return true;
- } else {
- return false;
- }
-}
-function isExpression() {
- if (this.isIdentifier()) {
- return this.isReferencedIdentifier();
- } else {
- return nodeIsExpression(this.node);
- }
-}
-function isScope() {
- return nodeIsScope(this.node, this.parent);
-}
-function isReferenced() {
- return nodeIsReferenced(this.node, this.parent);
-}
-function isBlockScoped() {
- return nodeIsBlockScoped(this.node);
-}
-function isVar() {
- return nodeIsVar(this.node);
-}
-function isUser() {
- return this.node && !!this.node.loc;
-}
-function isGenerated() {
- return !this.isUser();
-}
-function isPure(constantsOnly) {
- return this.scope.isPure(this.node, constantsOnly);
-}
-function isFlow() {
- const {
- node
- } = this;
- if (nodeIsFlow(node)) {
- return true;
- } else if (isImportDeclaration(node)) {
- return node.importKind === "type" || node.importKind === "typeof";
- } else if (isExportDeclaration(node)) {
- return node.exportKind === "type";
- } else if (isImportSpecifier(node)) {
- return node.importKind === "type" || node.importKind === "typeof";
- } else {
- return false;
- }
-}
-function isRestProperty() {
- return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectPattern();
-}
-function isSpreadProperty() {
- return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectExpression();
-}
-function isForAwaitStatement() {
- return isForOfStatement(this.node, {
- await: true
- });
-}
-{
- exports.isExistentialTypeParam = function isExistentialTypeParam() {
- throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.");
- };
- exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() {
- throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.");
- };
-}
-
-//# sourceMappingURL=virtual-types-validator.js.map
-
-
-/***/ }),
-
-/***/ 4425:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.Var = exports.User = exports.Statement = exports.SpreadProperty = exports.Scope = exports.RestProperty = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = exports.Referenced = exports.Pure = exports.NumericLiteralTypeAnnotation = exports.Generated = exports.ForAwaitStatement = exports.Flow = exports.Expression = exports.ExistentialTypeParam = exports.BlockScoped = exports.BindingIdentifier = void 0;
-const ReferencedIdentifier = ["Identifier", "JSXIdentifier"];
-exports.ReferencedIdentifier = ReferencedIdentifier;
-const ReferencedMemberExpression = ["MemberExpression"];
-exports.ReferencedMemberExpression = ReferencedMemberExpression;
-const BindingIdentifier = ["Identifier"];
-exports.BindingIdentifier = BindingIdentifier;
-const Statement = ["Statement"];
-exports.Statement = Statement;
-const Expression = ["Expression"];
-exports.Expression = Expression;
-const Scope = ["Scopable", "Pattern"];
-exports.Scope = Scope;
-const Referenced = null;
-exports.Referenced = Referenced;
-const BlockScoped = null;
-exports.BlockScoped = BlockScoped;
-const Var = ["VariableDeclaration"];
-exports.Var = Var;
-const User = null;
-exports.User = User;
-const Generated = null;
-exports.Generated = Generated;
-const Pure = null;
-exports.Pure = Pure;
-const Flow = ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"];
-exports.Flow = Flow;
-const RestProperty = ["RestElement"];
-exports.RestProperty = RestProperty;
-const SpreadProperty = ["RestElement"];
-exports.SpreadProperty = SpreadProperty;
-const ExistentialTypeParam = ["ExistsTypeAnnotation"];
-exports.ExistentialTypeParam = ExistentialTypeParam;
-const NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"];
-exports.NumericLiteralTypeAnnotation = NumericLiteralTypeAnnotation;
-const ForAwaitStatement = ["ForOfStatement"];
-exports.ForAwaitStatement = ForAwaitStatement;
-
-//# sourceMappingURL=virtual-types.js.map
-
-
-/***/ }),
-
-/***/ 7575:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._containerInsert = _containerInsert;
-exports._containerInsertAfter = _containerInsertAfter;
-exports._containerInsertBefore = _containerInsertBefore;
-exports._verifyNodeList = _verifyNodeList;
-exports.hoist = hoist;
-exports.insertAfter = insertAfter;
-exports.insertBefore = insertBefore;
-exports.pushContainer = pushContainer;
-exports.unshiftContainer = unshiftContainer;
-exports.updateSiblingKeys = updateSiblingKeys;
-var _cache = __nccwpck_require__(5069);
-var _hoister = __nccwpck_require__(1225);
-var _index = __nccwpck_require__(8877);
-var _t = __nccwpck_require__(7912);
-const {
- arrowFunctionExpression,
- assertExpression,
- assignmentExpression,
- blockStatement,
- callExpression,
- cloneNode,
- expressionStatement,
- isAssignmentExpression,
- isCallExpression,
- isExportNamedDeclaration,
- isExpression,
- isIdentifier,
- isSequenceExpression,
- isSuper,
- thisExpression
-} = _t;
-function insertBefore(nodes_) {
- this._assertUnremoved();
- const nodes = this._verifyNodeList(nodes_);
- const {
- parentPath,
- parent
- } = this;
- if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || isExportNamedDeclaration(parent) || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
- return parentPath.insertBefore(nodes);
- } else if (this.isNodeType("Expression") && !this.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
- if (this.node) nodes.push(this.node);
- return this.replaceExpressionWithStatements(nodes);
- } else if (Array.isArray(this.container)) {
- return this._containerInsertBefore(nodes);
- } else if (this.isStatementOrBlock()) {
- const node = this.node;
- const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
- this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
- return this.unshiftContainer("body", nodes);
- } else {
- throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
- }
-}
-function _containerInsert(from, nodes) {
- this.updateSiblingKeys(from, nodes.length);
- const paths = [];
- this.container.splice(from, 0, ...nodes);
- for (let i = 0; i < nodes.length; i++) {
- var _this$context;
- const to = from + i;
- const path = this.getSibling(to);
- paths.push(path);
- if ((_this$context = this.context) != null && _this$context.queue) {
- path.pushContext(this.context);
- }
- }
- const contexts = this._getQueueContexts();
- for (const path of paths) {
- path.setScope();
- path.debug("Inserted.");
- for (const context of contexts) {
- context.maybeQueue(path, true);
- }
- }
- return paths;
-}
-function _containerInsertBefore(nodes) {
- return this._containerInsert(this.key, nodes);
-}
-function _containerInsertAfter(nodes) {
- return this._containerInsert(this.key + 1, nodes);
-}
-const last = arr => arr[arr.length - 1];
-function isHiddenInSequenceExpression(path) {
- return isSequenceExpression(path.parent) && (last(path.parent.expressions) !== path.node || isHiddenInSequenceExpression(path.parentPath));
-}
-function isAlmostConstantAssignment(node, scope) {
- if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {
- return false;
- }
- const blockScope = scope.getBlockParent();
- return blockScope.hasOwnBinding(node.left.name) && blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1;
-}
-function insertAfter(nodes_) {
- this._assertUnremoved();
- if (this.isSequenceExpression()) {
- return last(this.get("expressions")).insertAfter(nodes_);
- }
- const nodes = this._verifyNodeList(nodes_);
- const {
- parentPath,
- parent
- } = this;
- if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || isExportNamedDeclaration(parent) || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
- return parentPath.insertAfter(nodes.map(node => {
- return isExpression(node) ? expressionStatement(node) : node;
- }));
- } else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
- if (this.node) {
- const node = this.node;
- let {
- scope
- } = this;
- if (scope.path.isPattern()) {
- assertExpression(node);
- this.replaceWith(callExpression(arrowFunctionExpression([], node), []));
- this.get("callee.body").insertAfter(nodes);
- return [this];
- }
- if (isHiddenInSequenceExpression(this)) {
- nodes.unshift(node);
- } else if (isCallExpression(node) && isSuper(node.callee)) {
- nodes.unshift(node);
- nodes.push(thisExpression());
- } else if (isAlmostConstantAssignment(node, scope)) {
- nodes.unshift(node);
- nodes.push(cloneNode(node.left));
- } else if (scope.isPure(node, true)) {
- nodes.push(node);
- } else {
- if (parentPath.isMethod({
- computed: true,
- key: node
- })) {
- scope = scope.parent;
- }
- const temp = scope.generateDeclaredUidIdentifier();
- nodes.unshift(expressionStatement(assignmentExpression("=", cloneNode(temp), node)));
- nodes.push(expressionStatement(cloneNode(temp)));
- }
- }
- return this.replaceExpressionWithStatements(nodes);
- } else if (Array.isArray(this.container)) {
- return this._containerInsertAfter(nodes);
- } else if (this.isStatementOrBlock()) {
- const node = this.node;
- const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
- this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
- return this.pushContainer("body", nodes);
- } else {
- throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
- }
-}
-function updateSiblingKeys(fromIndex, incrementBy) {
- if (!this.parent) return;
- const paths = (0, _cache.getCachedPaths)(this.hub, this.parent) || [];
- for (const [, path] of paths) {
- if (typeof path.key === "number" && path.key >= fromIndex) {
- path.key += incrementBy;
- }
- }
-}
-function _verifyNodeList(nodes) {
- if (!nodes) {
- return [];
- }
- if (!Array.isArray(nodes)) {
- nodes = [nodes];
- }
- for (let i = 0; i < nodes.length; i++) {
- const node = nodes[i];
- let msg;
- if (!node) {
- msg = "has falsy node";
- } else if (typeof node !== "object") {
- msg = "contains a non-object node";
- } else if (!node.type) {
- msg = "without a type";
- } else if (node instanceof _index.default) {
- msg = "has a NodePath when it expected a raw object";
- }
- if (msg) {
- const type = Array.isArray(node) ? "array" : typeof node;
- throw new Error(`Node list ${msg} with the index of ${i} and type of ${type}`);
- }
- }
- return nodes;
-}
-function unshiftContainer(listKey, nodes) {
- this._assertUnremoved();
- nodes = this._verifyNodeList(nodes);
- const path = _index.default.get({
- parentPath: this,
- parent: this.node,
- container: this.node[listKey],
- listKey,
- key: 0
- }).setContext(this.context);
- return path._containerInsertBefore(nodes);
-}
-function pushContainer(listKey, nodes) {
- this._assertUnremoved();
- const verifiedNodes = this._verifyNodeList(nodes);
- const container = this.node[listKey];
- const path = _index.default.get({
- parentPath: this,
- parent: this.node,
- container: container,
- listKey,
- key: container.length
- }).setContext(this.context);
- return path.replaceWithMultiple(verifiedNodes);
-}
-function hoist(scope = this.scope) {
- const hoister = new _hoister.default(this, scope);
- return hoister.run();
-}
-
-//# sourceMappingURL=modification.js.map
-
-
-/***/ }),
-
-/***/ 408:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._assertUnremoved = _assertUnremoved;
-exports._callRemovalHooks = _callRemovalHooks;
-exports._markRemoved = _markRemoved;
-exports._remove = _remove;
-exports._removeFromScope = _removeFromScope;
-exports.remove = remove;
-var _removalHooks = __nccwpck_require__(1587);
-var _cache = __nccwpck_require__(5069);
-var _index = __nccwpck_require__(8877);
-function remove() {
- var _this$opts;
- this._assertUnremoved();
- this.resync();
- if (!((_this$opts = this.opts) != null && _this$opts.noScope)) {
- this._removeFromScope();
- }
- if (this._callRemovalHooks()) {
- this._markRemoved();
- return;
- }
- this.shareCommentsWithSiblings();
- this._remove();
- this._markRemoved();
-}
-function _removeFromScope() {
- const bindings = this.getBindingIdentifiers();
- Object.keys(bindings).forEach(name => this.scope.removeBinding(name));
-}
-function _callRemovalHooks() {
- for (const fn of _removalHooks.hooks) {
- if (fn(this, this.parentPath)) return true;
- }
-}
-function _remove() {
- if (Array.isArray(this.container)) {
- this.container.splice(this.key, 1);
- this.updateSiblingKeys(this.key, -1);
- } else {
- this._replaceWith(null);
- }
-}
-function _markRemoved() {
- this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED;
- if (this.parent) {
- (0, _cache.getCachedPaths)(this.hub, this.parent).delete(this.node);
- }
- this.node = null;
-}
-function _assertUnremoved() {
- if (this.removed) {
- throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
- }
-}
-
-//# sourceMappingURL=removal.js.map
-
-
-/***/ }),
-
-/***/ 8805:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports._replaceWith = _replaceWith;
-exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
-exports.replaceInline = replaceInline;
-exports.replaceWith = replaceWith;
-exports.replaceWithMultiple = replaceWithMultiple;
-exports.replaceWithSourceString = replaceWithSourceString;
-var _codeFrame = __nccwpck_require__(1322);
-var _index = __nccwpck_require__(1380);
-var _index2 = __nccwpck_require__(8877);
-var _cache = __nccwpck_require__(5069);
-var _parser = __nccwpck_require__(5026);
-var _t = __nccwpck_require__(7912);
-var _helperHoistVariables = __nccwpck_require__(6934);
-const {
- FUNCTION_TYPES,
- arrowFunctionExpression,
- assignmentExpression,
- awaitExpression,
- blockStatement,
- callExpression,
- cloneNode,
- expressionStatement,
- identifier,
- inheritLeadingComments,
- inheritTrailingComments,
- inheritsComments,
- isExpression,
- isProgram,
- isStatement,
- removeComments,
- returnStatement,
- toSequenceExpression,
- validate,
- yieldExpression
-} = _t;
-function replaceWithMultiple(nodes) {
- var _getCachedPaths;
- this.resync();
- nodes = this._verifyNodeList(nodes);
- inheritLeadingComments(nodes[0], this.node);
- inheritTrailingComments(nodes[nodes.length - 1], this.node);
- (_getCachedPaths = (0, _cache.getCachedPaths)(this.hub, this.parent)) == null ? void 0 : _getCachedPaths.delete(this.node);
- this.node = this.container[this.key] = null;
- const paths = this.insertAfter(nodes);
- if (this.node) {
- this.requeue();
- } else {
- this.remove();
- }
- return paths;
-}
-function replaceWithSourceString(replacement) {
- this.resync();
- let ast;
- try {
- replacement = `(${replacement})`;
- ast = (0, _parser.parse)(replacement);
- } catch (err) {
- const loc = err.loc;
- if (loc) {
- err.message += " - make sure this is an expression.\n" + (0, _codeFrame.codeFrameColumns)(replacement, {
- start: {
- line: loc.line,
- column: loc.column + 1
- }
- });
- err.code = "BABEL_REPLACE_SOURCE_ERROR";
- }
- throw err;
- }
- const expressionAST = ast.program.body[0].expression;
- _index.default.removeProperties(expressionAST);
- return this.replaceWith(expressionAST);
-}
-function replaceWith(replacementPath) {
- this.resync();
- if (this.removed) {
- throw new Error("You can't replace this node, we've already removed it");
- }
- let replacement = replacementPath instanceof _index2.default ? replacementPath.node : replacementPath;
- if (!replacement) {
- throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");
- }
- if (this.node === replacement) {
- return [this];
- }
- if (this.isProgram() && !isProgram(replacement)) {
- throw new Error("You can only replace a Program root node with another Program node");
- }
- if (Array.isArray(replacement)) {
- throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");
- }
- if (typeof replacement === "string") {
- throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");
- }
- let nodePath = "";
- if (this.isNodeType("Statement") && isExpression(replacement)) {
- if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
- replacement = expressionStatement(replacement);
- nodePath = "expression";
- }
- }
- if (this.isNodeType("Expression") && isStatement(replacement)) {
- if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
- return this.replaceExpressionWithStatements([replacement]);
- }
- }
- const oldNode = this.node;
- if (oldNode) {
- inheritsComments(replacement, oldNode);
- removeComments(oldNode);
- }
- this._replaceWith(replacement);
- this.type = replacement.type;
- this.setScope();
- this.requeue();
- return [nodePath ? this.get(nodePath) : this];
-}
-function _replaceWith(node) {
- var _getCachedPaths2;
- if (!this.container) {
- throw new ReferenceError("Container is falsy");
- }
- if (this.inList) {
- validate(this.parent, this.key, [node]);
- } else {
- validate(this.parent, this.key, node);
- }
- this.debug(`Replace with ${node == null ? void 0 : node.type}`);
- (_getCachedPaths2 = (0, _cache.getCachedPaths)(this.hub, this.parent)) == null ? void 0 : _getCachedPaths2.set(node, this).delete(this.node);
- this.node = this.container[this.key] = node;
-}
-function replaceExpressionWithStatements(nodes) {
- this.resync();
- const nodesAsSequenceExpression = toSequenceExpression(nodes, this.scope);
- if (nodesAsSequenceExpression) {
- return this.replaceWith(nodesAsSequenceExpression)[0].get("expressions");
- }
- const functionParent = this.getFunctionParent();
- const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
- const isParentGenerator = functionParent == null ? void 0 : functionParent.is("generator");
- const container = arrowFunctionExpression([], blockStatement(nodes));
- this.replaceWith(callExpression(container, []));
- const callee = this.get("callee");
- (0, _helperHoistVariables.default)(callee.get("body"), id => {
- this.scope.push({
- id
- });
- }, "var");
- const completionRecords = this.get("callee").getCompletionRecords();
- for (const path of completionRecords) {
- if (!path.isExpressionStatement()) continue;
- const loop = path.findParent(path => path.isLoop());
- if (loop) {
- let uid = loop.getData("expressionReplacementReturnUid");
- if (!uid) {
- uid = callee.scope.generateDeclaredUidIdentifier("ret");
- callee.get("body").pushContainer("body", returnStatement(cloneNode(uid)));
- loop.setData("expressionReplacementReturnUid", uid);
- } else {
- uid = identifier(uid.name);
- }
- path.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path.node.expression));
- } else {
- path.replaceWith(returnStatement(path.node.expression));
- }
- }
- callee.arrowFunctionToExpression();
- const newCallee = callee;
- const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", FUNCTION_TYPES);
- const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", FUNCTION_TYPES);
- if (needToAwaitFunction) {
- newCallee.set("async", true);
- if (!needToYieldFunction) {
- this.replaceWith(awaitExpression(this.node));
- }
- }
- if (needToYieldFunction) {
- newCallee.set("generator", true);
- this.replaceWith(yieldExpression(this.node, true));
- }
- return newCallee.get("body.body");
-}
-function replaceInline(nodes) {
- this.resync();
- if (Array.isArray(nodes)) {
- if (Array.isArray(this.container)) {
- nodes = this._verifyNodeList(nodes);
- const paths = this._containerInsertAfter(nodes);
- this.remove();
- return paths;
- } else {
- return this.replaceWithMultiple(nodes);
- }
- } else {
- return this.replaceWith(nodes);
- }
-}
-
-//# sourceMappingURL=replacement.js.map
-
-
-/***/ }),
-
-/***/ 1410:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-class Binding {
- constructor({
- identifier,
- scope,
- path,
- kind
- }) {
- this.identifier = void 0;
- this.scope = void 0;
- this.path = void 0;
- this.kind = void 0;
- this.constantViolations = [];
- this.constant = true;
- this.referencePaths = [];
- this.referenced = false;
- this.references = 0;
- this.identifier = identifier;
- this.scope = scope;
- this.path = path;
- this.kind = kind;
- if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) {
- this.reassign(path);
- }
- this.clearValue();
- }
- deoptValue() {
- this.clearValue();
- this.hasDeoptedValue = true;
- }
- setValue(value) {
- if (this.hasDeoptedValue) return;
- this.hasValue = true;
- this.value = value;
- }
- clearValue() {
- this.hasDeoptedValue = false;
- this.hasValue = false;
- this.value = null;
- }
- reassign(path) {
- this.constant = false;
- if (this.constantViolations.indexOf(path) !== -1) {
- return;
- }
- this.constantViolations.push(path);
- }
- reference(path) {
- if (this.referencePaths.indexOf(path) !== -1) {
- return;
- }
- this.referenced = true;
- this.references++;
- this.referencePaths.push(path);
- }
- dereference() {
- this.references--;
- this.referenced = !!this.references;
- }
-}
-exports["default"] = Binding;
-function isDeclaredInLoop(path) {
- for (let {
- parentPath,
- key
- } = path; parentPath; ({
- parentPath,
- key
- } = parentPath)) {
- if (parentPath.isFunctionParent()) return false;
- if (parentPath.isWhile() || parentPath.isForXStatement() || parentPath.isForStatement() && key === "body") {
- return true;
- }
- }
- return false;
-}
-
-//# sourceMappingURL=binding.js.map
-
-
-/***/ }),
-
-/***/ 891:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-var _renamer = __nccwpck_require__(3708);
-var _index = __nccwpck_require__(1380);
-var _binding = __nccwpck_require__(1410);
-var _globals = __nccwpck_require__(455);
-var _t = __nccwpck_require__(7912);
-var t = _t;
-var _cache = __nccwpck_require__(5069);
-var _visitors = __nccwpck_require__(3494);
-const {
- NOT_LOCAL_BINDING,
- callExpression,
- cloneNode,
- getBindingIdentifiers,
- identifier,
- isArrayExpression,
- isBinary,
- isClass,
- isClassBody,
- isClassDeclaration,
- isExportAllDeclaration,
- isExportDefaultDeclaration,
- isExportNamedDeclaration,
- isFunctionDeclaration,
- isIdentifier,
- isImportDeclaration,
- isLiteral,
- isMethod,
- isModuleSpecifier,
- isNullLiteral,
- isObjectExpression,
- isProperty,
- isPureish,
- isRegExpLiteral,
- isSuper,
- isTaggedTemplateExpression,
- isTemplateLiteral,
- isThisExpression,
- isUnaryExpression,
- isVariableDeclaration,
- matchesPattern,
- memberExpression,
- numericLiteral,
- toIdentifier,
- variableDeclaration,
- variableDeclarator,
- isRecordExpression,
- isTupleExpression,
- isObjectProperty,
- isTopicReference,
- isMetaProperty,
- isPrivateName,
- isExportDeclaration,
- buildUndefinedNode
-} = _t;
-function gatherNodeParts(node, parts) {
- switch (node == null ? void 0 : node.type) {
- default:
- if (isImportDeclaration(node) || isExportDeclaration(node)) {
- var _node$specifiers;
- if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) {
- gatherNodeParts(node.source, parts);
- } else if ((isExportNamedDeclaration(node) || isImportDeclaration(node)) && (_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
- for (const e of node.specifiers) gatherNodeParts(e, parts);
- } else if ((isExportDefaultDeclaration(node) || isExportNamedDeclaration(node)) && node.declaration) {
- gatherNodeParts(node.declaration, parts);
- }
- } else if (isModuleSpecifier(node)) {
- gatherNodeParts(node.local, parts);
- } else if (isLiteral(node) && !isNullLiteral(node) && !isRegExpLiteral(node) && !isTemplateLiteral(node)) {
- parts.push(node.value);
- }
- break;
- case "MemberExpression":
- case "OptionalMemberExpression":
- case "JSXMemberExpression":
- gatherNodeParts(node.object, parts);
- gatherNodeParts(node.property, parts);
- break;
- case "Identifier":
- case "JSXIdentifier":
- parts.push(node.name);
- break;
- case "CallExpression":
- case "OptionalCallExpression":
- case "NewExpression":
- gatherNodeParts(node.callee, parts);
- break;
- case "ObjectExpression":
- case "ObjectPattern":
- for (const e of node.properties) {
- gatherNodeParts(e, parts);
- }
- break;
- case "SpreadElement":
- case "RestElement":
- gatherNodeParts(node.argument, parts);
- break;
- case "ObjectProperty":
- case "ObjectMethod":
- case "ClassProperty":
- case "ClassMethod":
- case "ClassPrivateProperty":
- case "ClassPrivateMethod":
- gatherNodeParts(node.key, parts);
- break;
- case "ThisExpression":
- parts.push("this");
- break;
- case "Super":
- parts.push("super");
- break;
- case "Import":
- parts.push("import");
- break;
- case "DoExpression":
- parts.push("do");
- break;
- case "YieldExpression":
- parts.push("yield");
- gatherNodeParts(node.argument, parts);
- break;
- case "AwaitExpression":
- parts.push("await");
- gatherNodeParts(node.argument, parts);
- break;
- case "AssignmentExpression":
- gatherNodeParts(node.left, parts);
- break;
- case "VariableDeclarator":
- gatherNodeParts(node.id, parts);
- break;
- case "FunctionExpression":
- case "FunctionDeclaration":
- case "ClassExpression":
- case "ClassDeclaration":
- gatherNodeParts(node.id, parts);
- break;
- case "PrivateName":
- gatherNodeParts(node.id, parts);
- break;
- case "ParenthesizedExpression":
- gatherNodeParts(node.expression, parts);
- break;
- case "UnaryExpression":
- case "UpdateExpression":
- gatherNodeParts(node.argument, parts);
- break;
- case "MetaProperty":
- gatherNodeParts(node.meta, parts);
- gatherNodeParts(node.property, parts);
- break;
- case "JSXElement":
- gatherNodeParts(node.openingElement, parts);
- break;
- case "JSXOpeningElement":
- gatherNodeParts(node.name, parts);
- break;
- case "JSXFragment":
- gatherNodeParts(node.openingFragment, parts);
- break;
- case "JSXOpeningFragment":
- parts.push("Fragment");
- break;
- case "JSXNamespacedName":
- gatherNodeParts(node.namespace, parts);
- gatherNodeParts(node.name, parts);
- break;
- }
-}
-const collectorVisitor = {
- ForStatement(path) {
- const declar = path.get("init");
- if (declar.isVar()) {
- const {
- scope
- } = path;
- const parentScope = scope.getFunctionParent() || scope.getProgramParent();
- parentScope.registerBinding("var", declar);
- }
- },
- Declaration(path) {
- if (path.isBlockScoped()) return;
- if (path.isImportDeclaration()) return;
- if (path.isExportDeclaration()) return;
- const parent = path.scope.getFunctionParent() || path.scope.getProgramParent();
- parent.registerDeclaration(path);
- },
- ImportDeclaration(path) {
- const parent = path.scope.getBlockParent();
- parent.registerDeclaration(path);
- },
- ReferencedIdentifier(path, state) {
- state.references.push(path);
- },
- ForXStatement(path, state) {
- const left = path.get("left");
- if (left.isPattern() || left.isIdentifier()) {
- state.constantViolations.push(path);
- } else if (left.isVar()) {
- const {
- scope
- } = path;
- const parentScope = scope.getFunctionParent() || scope.getProgramParent();
- parentScope.registerBinding("var", left);
- }
- },
- ExportDeclaration: {
- exit(path) {
- const {
- node,
- scope
- } = path;
- if (isExportAllDeclaration(node)) return;
- const declar = node.declaration;
- if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) {
- const id = declar.id;
- if (!id) return;
- const binding = scope.getBinding(id.name);
- binding == null ? void 0 : binding.reference(path);
- } else if (isVariableDeclaration(declar)) {
- for (const decl of declar.declarations) {
- for (const name of Object.keys(getBindingIdentifiers(decl))) {
- const binding = scope.getBinding(name);
- binding == null ? void 0 : binding.reference(path);
- }
- }
- }
- }
- },
- LabeledStatement(path) {
- path.scope.getBlockParent().registerDeclaration(path);
- },
- AssignmentExpression(path, state) {
- state.assignments.push(path);
- },
- UpdateExpression(path, state) {
- state.constantViolations.push(path);
- },
- UnaryExpression(path, state) {
- if (path.node.operator === "delete") {
- state.constantViolations.push(path);
- }
- },
- BlockScoped(path) {
- let scope = path.scope;
- if (scope.path === path) scope = scope.parent;
- const parent = scope.getBlockParent();
- parent.registerDeclaration(path);
- if (path.isClassDeclaration() && path.node.id) {
- const id = path.node.id;
- const name = id.name;
- path.scope.bindings[name] = path.scope.parent.getBinding(name);
- }
- },
- CatchClause(path) {
- path.scope.registerBinding("let", path);
- },
- Function(path) {
- const params = path.get("params");
- for (const param of params) {
- path.scope.registerBinding("param", param);
- }
- if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
- path.scope.registerBinding("local", path.get("id"), path);
- }
- },
- ClassExpression(path) {
- if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
- path.scope.registerBinding("local", path);
- }
- }
-};
-let uid = 0;
-class Scope {
- constructor(path) {
- this.uid = void 0;
- this.path = void 0;
- this.block = void 0;
- this.labels = void 0;
- this.inited = void 0;
- this.bindings = void 0;
- this.references = void 0;
- this.globals = void 0;
- this.uids = void 0;
- this.data = void 0;
- this.crawling = void 0;
- const {
- node
- } = path;
- const cached = _cache.scope.get(node);
- if ((cached == null ? void 0 : cached.path) === path) {
- return cached;
- }
- _cache.scope.set(node, this);
- this.uid = uid++;
- this.block = node;
- this.path = path;
- this.labels = new Map();
- this.inited = false;
- }
- get parent() {
- var _parent;
- let parent,
- path = this.path;
- do {
- const shouldSkip = path.key === "key" || path.listKey === "decorators";
- path = path.parentPath;
- if (shouldSkip && path.isMethod()) path = path.parentPath;
- if (path && path.isScope()) parent = path;
- } while (path && !parent);
- return (_parent = parent) == null ? void 0 : _parent.scope;
- }
- get parentBlock() {
- return this.path.parent;
- }
- get hub() {
- return this.path.hub;
- }
- traverse(node, opts, state) {
- (0, _index.default)(node, opts, this, state, this.path);
- }
- generateDeclaredUidIdentifier(name) {
- const id = this.generateUidIdentifier(name);
- this.push({
- id
- });
- return cloneNode(id);
- }
- generateUidIdentifier(name) {
- return identifier(this.generateUid(name));
- }
- generateUid(name = "temp") {
- name = toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
- let uid;
- let i = 1;
- do {
- uid = this._generateUid(name, i);
- i++;
- } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
- const program = this.getProgramParent();
- program.references[uid] = true;
- program.uids[uid] = true;
- return uid;
- }
- _generateUid(name, i) {
- let id = name;
- if (i > 1) id += i;
- return `_${id}`;
- }
- generateUidBasedOnNode(node, defaultName) {
- const parts = [];
- gatherNodeParts(node, parts);
- let id = parts.join("$");
- id = id.replace(/^_/, "") || defaultName || "ref";
- return this.generateUid(id.slice(0, 20));
- }
- generateUidIdentifierBasedOnNode(node, defaultName) {
- return identifier(this.generateUidBasedOnNode(node, defaultName));
- }
- isStatic(node) {
- if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) {
- return true;
- }
- if (isIdentifier(node)) {
- const binding = this.getBinding(node.name);
- if (binding) {
- return binding.constant;
- } else {
- return this.hasBinding(node.name);
- }
- }
- return false;
- }
- maybeGenerateMemoised(node, dontPush) {
- if (this.isStatic(node)) {
- return null;
- } else {
- const id = this.generateUidIdentifierBasedOnNode(node);
- if (!dontPush) {
- this.push({
- id
- });
- return cloneNode(id);
- }
- return id;
- }
- }
- checkBlockScopedCollisions(local, kind, name, id) {
- if (kind === "param") return;
- if (local.kind === "local") return;
- const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const";
- if (duplicate) {
- throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);
- }
- }
- rename(oldName, newName) {
- const binding = this.getBinding(oldName);
- if (binding) {
- newName || (newName = this.generateUidIdentifier(oldName).name);
- const renamer = new _renamer.default(binding, oldName, newName);
- {
- renamer.rename(arguments[2]);
- }
- }
- }
- _renameFromMap(map, oldName, newName, value) {
- if (map[oldName]) {
- map[newName] = value;
- map[oldName] = null;
- }
- }
- dump() {
- const sep = "-".repeat(60);
- console.log(sep);
- let scope = this;
- do {
- console.log("#", scope.block.type);
- for (const name of Object.keys(scope.bindings)) {
- const binding = scope.bindings[name];
- console.log(" -", name, {
- constant: binding.constant,
- references: binding.references,
- violations: binding.constantViolations.length,
- kind: binding.kind
- });
- }
- } while (scope = scope.parent);
- console.log(sep);
- }
- toArray(node, i, arrayLikeIsIterable) {
- if (isIdentifier(node)) {
- const binding = this.getBinding(node.name);
- if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
- return node;
- }
- }
- if (isArrayExpression(node)) {
- return node;
- }
- if (isIdentifier(node, {
- name: "arguments"
- })) {
- return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
- }
- let helperName;
- const args = [node];
- if (i === true) {
- helperName = "toConsumableArray";
- } else if (typeof i === "number") {
- args.push(numericLiteral(i));
- helperName = "slicedToArray";
- } else {
- helperName = "toArray";
- }
- if (arrayLikeIsIterable) {
- args.unshift(this.hub.addHelper(helperName));
- helperName = "maybeArrayLike";
- }
- return callExpression(this.hub.addHelper(helperName), args);
- }
- hasLabel(name) {
- return !!this.getLabel(name);
- }
- getLabel(name) {
- return this.labels.get(name);
- }
- registerLabel(path) {
- this.labels.set(path.node.label.name, path);
- }
- registerDeclaration(path) {
- if (path.isLabeledStatement()) {
- this.registerLabel(path);
- } else if (path.isFunctionDeclaration()) {
- this.registerBinding("hoisted", path.get("id"), path);
- } else if (path.isVariableDeclaration()) {
- const declarations = path.get("declarations");
- const {
- kind
- } = path.node;
- for (const declar of declarations) {
- this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar);
- }
- } else if (path.isClassDeclaration()) {
- if (path.node.declare) return;
- this.registerBinding("let", path);
- } else if (path.isImportDeclaration()) {
- const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof";
- const specifiers = path.get("specifiers");
- for (const specifier of specifiers) {
- const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof");
- this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
- }
- } else if (path.isExportDeclaration()) {
- const declar = path.get("declaration");
- if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) {
- this.registerDeclaration(declar);
- }
- } else {
- this.registerBinding("unknown", path);
- }
- }
- buildUndefinedNode() {
- return buildUndefinedNode();
- }
- registerConstantViolation(path) {
- const ids = path.getBindingIdentifiers();
- for (const name of Object.keys(ids)) {
- var _this$getBinding;
- (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.reassign(path);
- }
- }
- registerBinding(kind, path, bindingPath = path) {
- if (!kind) throw new ReferenceError("no `kind`");
- if (path.isVariableDeclaration()) {
- const declarators = path.get("declarations");
- for (const declar of declarators) {
- this.registerBinding(kind, declar);
- }
- return;
- }
- const parent = this.getProgramParent();
- const ids = path.getOuterBindingIdentifiers(true);
- for (const name of Object.keys(ids)) {
- parent.references[name] = true;
- for (const id of ids[name]) {
- const local = this.getOwnBinding(name);
- if (local) {
- if (local.identifier === id) continue;
- this.checkBlockScopedCollisions(local, kind, name, id);
- }
- if (local) {
- this.registerConstantViolation(bindingPath);
- } else {
- this.bindings[name] = new _binding.default({
- identifier: id,
- scope: this,
- path: bindingPath,
- kind: kind
- });
- }
- }
- }
- }
- addGlobal(node) {
- this.globals[node.name] = node;
- }
- hasUid(name) {
- let scope = this;
- do {
- if (scope.uids[name]) return true;
- } while (scope = scope.parent);
- return false;
- }
- hasGlobal(name) {
- let scope = this;
- do {
- if (scope.globals[name]) return true;
- } while (scope = scope.parent);
- return false;
- }
- hasReference(name) {
- return !!this.getProgramParent().references[name];
- }
- isPure(node, constantsOnly) {
- if (isIdentifier(node)) {
- const binding = this.getBinding(node.name);
- if (!binding) return false;
- if (constantsOnly) return binding.constant;
- return true;
- } else if (isThisExpression(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName(node)) {
- return true;
- } else if (isClass(node)) {
- var _node$decorators;
- if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
- return false;
- }
- if (((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0) {
- return false;
- }
- return this.isPure(node.body, constantsOnly);
- } else if (isClassBody(node)) {
- for (const method of node.body) {
- if (!this.isPure(method, constantsOnly)) return false;
- }
- return true;
- } else if (isBinary(node)) {
- return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
- } else if (isArrayExpression(node) || isTupleExpression(node)) {
- for (const elem of node.elements) {
- if (elem !== null && !this.isPure(elem, constantsOnly)) return false;
- }
- return true;
- } else if (isObjectExpression(node) || isRecordExpression(node)) {
- for (const prop of node.properties) {
- if (!this.isPure(prop, constantsOnly)) return false;
- }
- return true;
- } else if (isMethod(node)) {
- var _node$decorators2;
- if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
- if (((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0) {
- return false;
- }
- return true;
- } else if (isProperty(node)) {
- var _node$decorators3;
- if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
- if (((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0) {
- return false;
- }
- if (isObjectProperty(node) || node.static) {
- if (node.value !== null && !this.isPure(node.value, constantsOnly)) {
- return false;
- }
- }
- return true;
- } else if (isUnaryExpression(node)) {
- return this.isPure(node.argument, constantsOnly);
- } else if (isTaggedTemplateExpression(node)) {
- return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
- } else if (isTemplateLiteral(node)) {
- for (const expression of node.expressions) {
- if (!this.isPure(expression, constantsOnly)) return false;
- }
- return true;
- } else {
- return isPureish(node);
- }
- }
- setData(key, val) {
- return this.data[key] = val;
- }
- getData(key) {
- let scope = this;
- do {
- const data = scope.data[key];
- if (data != null) return data;
- } while (scope = scope.parent);
- }
- removeData(key) {
- let scope = this;
- do {
- const data = scope.data[key];
- if (data != null) scope.data[key] = null;
- } while (scope = scope.parent);
- }
- init() {
- if (!this.inited) {
- this.inited = true;
- this.crawl();
- }
- }
- crawl() {
- const path = this.path;
- this.references = Object.create(null);
- this.bindings = Object.create(null);
- this.globals = Object.create(null);
- this.uids = Object.create(null);
- this.data = Object.create(null);
- const programParent = this.getProgramParent();
- if (programParent.crawling) return;
- const state = {
- references: [],
- constantViolations: [],
- assignments: []
- };
- this.crawling = true;
- if (path.type !== "Program" && (0, _visitors.isExplodedVisitor)(collectorVisitor)) {
- for (const visit of collectorVisitor.enter) {
- visit.call(state, path, state);
- }
- const typeVisitors = collectorVisitor[path.type];
- if (typeVisitors) {
- for (const visit of typeVisitors.enter) {
- visit.call(state, path, state);
- }
- }
- }
- path.traverse(collectorVisitor, state);
- this.crawling = false;
- for (const path of state.assignments) {
- const ids = path.getBindingIdentifiers();
- for (const name of Object.keys(ids)) {
- if (path.scope.getBinding(name)) continue;
- programParent.addGlobal(ids[name]);
- }
- path.scope.registerConstantViolation(path);
- }
- for (const ref of state.references) {
- const binding = ref.scope.getBinding(ref.node.name);
- if (binding) {
- binding.reference(ref);
- } else {
- programParent.addGlobal(ref.node);
- }
- }
- for (const path of state.constantViolations) {
- path.scope.registerConstantViolation(path);
- }
- }
- push(opts) {
- let path = this.path;
- if (path.isPattern()) {
- path = this.getPatternParent().path;
- } else if (!path.isBlockStatement() && !path.isProgram()) {
- path = this.getBlockParent().path;
- }
- if (path.isSwitchStatement()) {
- path = (this.getFunctionParent() || this.getProgramParent()).path;
- }
- const {
- init,
- unique,
- kind = "var",
- id
- } = opts;
- if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && t.isCallExpression(path.parent, {
- callee: path.node
- }) && path.parent.arguments.length <= path.node.params.length && t.isIdentifier(id)) {
- path.pushContainer("params", id);
- path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]);
- return;
- }
- if (path.isLoop() || path.isCatchClause() || path.isFunction()) {
- path.ensureBlock();
- path = path.get("body");
- }
- const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
- const dataKey = `declaration:${kind}:${blockHoist}`;
- let declarPath = !unique && path.getData(dataKey);
- if (!declarPath) {
- const declar = variableDeclaration(kind, []);
- declar._blockHoist = blockHoist;
- [declarPath] = path.unshiftContainer("body", [declar]);
- if (!unique) path.setData(dataKey, declarPath);
- }
- const declarator = variableDeclarator(id, init);
- const len = declarPath.node.declarations.push(declarator);
- path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
- }
- getProgramParent() {
- let scope = this;
- do {
- if (scope.path.isProgram()) {
- return scope;
- }
- } while (scope = scope.parent);
- throw new Error("Couldn't find a Program");
- }
- getFunctionParent() {
- let scope = this;
- do {
- if (scope.path.isFunctionParent()) {
- return scope;
- }
- } while (scope = scope.parent);
- return null;
- }
- getBlockParent() {
- let scope = this;
- do {
- if (scope.path.isBlockParent()) {
- return scope;
- }
- } while (scope = scope.parent);
- throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
- }
- getPatternParent() {
- let scope = this;
- do {
- if (!scope.path.isPattern()) {
- return scope.getBlockParent();
- }
- } while (scope = scope.parent.parent);
- throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
- }
- getAllBindings() {
- const ids = Object.create(null);
- let scope = this;
- do {
- for (const key of Object.keys(scope.bindings)) {
- if (key in ids === false) {
- ids[key] = scope.bindings[key];
- }
- }
- scope = scope.parent;
- } while (scope);
- return ids;
- }
- getAllBindingsOfKind(...kinds) {
- const ids = Object.create(null);
- for (const kind of kinds) {
- let scope = this;
- do {
- for (const name of Object.keys(scope.bindings)) {
- const binding = scope.bindings[name];
- if (binding.kind === kind) ids[name] = binding;
- }
- scope = scope.parent;
- } while (scope);
- }
- return ids;
- }
- bindingIdentifierEquals(name, node) {
- return this.getBindingIdentifier(name) === node;
- }
- getBinding(name) {
- let scope = this;
- let previousPath;
- do {
- const binding = scope.getOwnBinding(name);
- if (binding) {
- var _previousPath;
- if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {} else {
- return binding;
- }
- } else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
- break;
- }
- previousPath = scope.path;
- } while (scope = scope.parent);
- }
- getOwnBinding(name) {
- return this.bindings[name];
- }
- getBindingIdentifier(name) {
- var _this$getBinding2;
- return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier;
- }
- getOwnBindingIdentifier(name) {
- const binding = this.bindings[name];
- return binding == null ? void 0 : binding.identifier;
- }
- hasOwnBinding(name) {
- return !!this.getOwnBinding(name);
- }
- hasBinding(name, opts) {
- var _opts, _opts2, _opts3;
- if (!name) return false;
- if (this.hasOwnBinding(name)) return true;
- {
- if (typeof opts === "boolean") opts = {
- noGlobals: opts
- };
- }
- if (this.parentHasBinding(name, opts)) return true;
- if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true;
- if (!((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name)) return true;
- if (!((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name)) return true;
- return false;
- }
- parentHasBinding(name, opts) {
- var _this$parent;
- return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts);
- }
- moveBindingTo(name, scope) {
- const info = this.getBinding(name);
- if (info) {
- info.scope.removeOwnBinding(name);
- info.scope = scope;
- scope.bindings[name] = info;
- }
- }
- removeOwnBinding(name) {
- delete this.bindings[name];
- }
- removeBinding(name) {
- var _this$getBinding3;
- (_this$getBinding3 = this.getBinding(name)) == null ? void 0 : _this$getBinding3.scope.removeOwnBinding(name);
- let scope = this;
- do {
- if (scope.uids[name]) {
- scope.uids[name] = false;
- }
- } while (scope = scope.parent);
- }
-}
-exports["default"] = Scope;
-Scope.globals = Object.keys(_globals.builtin);
-Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 3708:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-var _helperSplitExportDeclaration = __nccwpck_require__(5176);
-var t = __nccwpck_require__(7912);
-var _helperEnvironmentVisitor = __nccwpck_require__(1097);
-var _traverseNode = __nccwpck_require__(1250);
-var _visitors = __nccwpck_require__(3494);
-const renameVisitor = {
- ReferencedIdentifier({
- node
- }, state) {
- if (node.name === state.oldName) {
- node.name = state.newName;
- }
- },
- Scope(path, state) {
- if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
- path.skip();
- if (path.isMethod()) {
- (0, _helperEnvironmentVisitor.requeueComputedKeyAndDecorators)(path);
- }
- }
- },
- ObjectProperty({
- node,
- scope
- }, state) {
- const {
- name
- } = node.key;
- if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) {
- var _node$extra;
- node.shorthand = false;
- if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
- }
- },
- "AssignmentExpression|Declaration|VariableDeclarator"(path, state) {
- if (path.isVariableDeclaration()) return;
- const ids = path.getOuterBindingIdentifiers();
- for (const name in ids) {
- if (name === state.oldName) ids[name].name = state.newName;
- }
- }
-};
-class Renamer {
- constructor(binding, oldName, newName) {
- this.newName = newName;
- this.oldName = oldName;
- this.binding = binding;
- }
- maybeConvertFromExportDeclaration(parentDeclar) {
- const maybeExportDeclar = parentDeclar.parentPath;
- if (!maybeExportDeclar.isExportDeclaration()) {
- return;
- }
- if (maybeExportDeclar.isExportDefaultDeclaration()) {
- const {
- declaration
- } = maybeExportDeclar.node;
- if (t.isDeclaration(declaration) && !declaration.id) {
- return;
- }
- }
- if (maybeExportDeclar.isExportAllDeclaration()) {
- return;
- }
- (0, _helperSplitExportDeclaration.default)(maybeExportDeclar);
- }
- maybeConvertFromClassFunctionDeclaration(path) {
- return path;
- }
- maybeConvertFromClassFunctionExpression(path) {
- return path;
- }
- rename() {
- const {
- binding,
- oldName,
- newName
- } = this;
- const {
- scope,
- path
- } = binding;
- const parentDeclar = path.find(path => path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression());
- if (parentDeclar) {
- const bindingIds = parentDeclar.getOuterBindingIdentifiers();
- if (bindingIds[oldName] === binding.identifier) {
- this.maybeConvertFromExportDeclaration(parentDeclar);
- }
- }
- const blockToTraverse = arguments[0] || scope.block;
- (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, {
- discriminant: true
- });
- if (!arguments[0]) {
- scope.removeOwnBinding(oldName);
- scope.bindings[newName] = binding;
- this.binding.identifier.name = newName;
- }
- if (parentDeclar) {
- this.maybeConvertFromClassFunctionDeclaration(path);
- this.maybeConvertFromClassFunctionExpression(path);
- }
- }
-}
-exports["default"] = Renamer;
-
-//# sourceMappingURL=renamer.js.map
-
-
-/***/ }),
-
-/***/ 1250:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.traverseNode = traverseNode;
-var _context = __nccwpck_require__(9089);
-var _t = __nccwpck_require__(7912);
-const {
- VISITOR_KEYS
-} = _t;
-function traverseNode(node, opts, scope, state, path, skipKeys, visitSelf) {
- const keys = VISITOR_KEYS[node.type];
- if (!keys) return false;
- const context = new _context.default(scope, opts, state, path);
- if (visitSelf) {
- if (skipKeys != null && skipKeys[path.parentKey]) return false;
- return context.visitQueue([path]);
- }
- for (const key of keys) {
- if (skipKeys != null && skipKeys[key]) continue;
- if (context.visit(node, key)) {
- return true;
- }
- }
- return false;
-}
-
-//# sourceMappingURL=traverse-node.js.map
-
-
-/***/ }),
-
-/***/ 3494:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.explode = explode;
-exports.isExplodedVisitor = isExplodedVisitor;
-exports.merge = merge;
-exports.verify = verify;
-var virtualTypes = __nccwpck_require__(4425);
-var _t = __nccwpck_require__(7912);
-const {
- DEPRECATED_KEYS,
- DEPRECATED_ALIASES,
- FLIPPED_ALIAS_KEYS,
- TYPES,
- __internal__deprecationWarning: deprecationWarning
-} = _t;
-function isVirtualType(type) {
- return type in virtualTypes;
-}
-function isExplodedVisitor(visitor) {
- return visitor == null ? void 0 : visitor._exploded;
-}
-function explode(visitor) {
- if (isExplodedVisitor(visitor)) return visitor;
- visitor._exploded = true;
- for (const nodeType of Object.keys(visitor)) {
- if (shouldIgnoreKey(nodeType)) continue;
- const parts = nodeType.split("|");
- if (parts.length === 1) continue;
- const fns = visitor[nodeType];
- delete visitor[nodeType];
- for (const part of parts) {
- visitor[part] = fns;
- }
- }
- verify(visitor);
- delete visitor.__esModule;
- ensureEntranceObjects(visitor);
- ensureCallbackArrays(visitor);
- for (const nodeType of Object.keys(visitor)) {
- if (shouldIgnoreKey(nodeType)) continue;
- if (!isVirtualType(nodeType)) continue;
- const fns = visitor[nodeType];
- for (const type of Object.keys(fns)) {
- fns[type] = wrapCheck(nodeType, fns[type]);
- }
- delete visitor[nodeType];
- const types = virtualTypes[nodeType];
- if (types !== null) {
- for (const type of types) {
- if (visitor[type]) {
- mergePair(visitor[type], fns);
- } else {
- visitor[type] = fns;
- }
- }
- } else {
- mergePair(visitor, fns);
- }
- }
- for (const nodeType of Object.keys(visitor)) {
- if (shouldIgnoreKey(nodeType)) continue;
- let aliases = FLIPPED_ALIAS_KEYS[nodeType];
- if (nodeType in DEPRECATED_KEYS) {
- const deprecatedKey = DEPRECATED_KEYS[nodeType];
- deprecationWarning(nodeType, deprecatedKey, "Visitor ");
- aliases = [deprecatedKey];
- } else if (nodeType in DEPRECATED_ALIASES) {
- const deprecatedAlias = DEPRECATED_ALIASES[nodeType];
- deprecationWarning(nodeType, deprecatedAlias, "Visitor ");
- aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias];
- }
- if (!aliases) continue;
- const fns = visitor[nodeType];
- delete visitor[nodeType];
- for (const alias of aliases) {
- const existing = visitor[alias];
- if (existing) {
- mergePair(existing, fns);
- } else {
- visitor[alias] = Object.assign({}, fns);
- }
- }
- }
- for (const nodeType of Object.keys(visitor)) {
- if (shouldIgnoreKey(nodeType)) continue;
- ensureCallbackArrays(visitor[nodeType]);
- }
- return visitor;
-}
-function verify(visitor) {
- if (visitor._verified) return;
- if (typeof visitor === "function") {
- throw new Error("You passed `traverse()` a function when it expected a visitor object, " + "are you sure you didn't mean `{ enter: Function }`?");
- }
- for (const nodeType of Object.keys(visitor)) {
- if (nodeType === "enter" || nodeType === "exit") {
- validateVisitorMethods(nodeType, visitor[nodeType]);
- }
- if (shouldIgnoreKey(nodeType)) continue;
- if (TYPES.indexOf(nodeType) < 0) {
- throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type`);
- }
- const visitors = visitor[nodeType];
- if (typeof visitors === "object") {
- for (const visitorKey of Object.keys(visitors)) {
- if (visitorKey === "enter" || visitorKey === "exit") {
- validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]);
- } else {
- throw new Error("You passed `traverse()` a visitor object with the property " + `${nodeType} that has the invalid property ${visitorKey}`);
- }
- }
- }
- }
- visitor._verified = true;
-}
-function validateVisitorMethods(path, val) {
- const fns = [].concat(val);
- for (const fn of fns) {
- if (typeof fn !== "function") {
- throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`);
- }
- }
-}
-function merge(visitors, states = [], wrapper) {
- const mergedVisitor = {};
- for (let i = 0; i < visitors.length; i++) {
- const visitor = explode(visitors[i]);
- const state = states[i];
- let topVisitor = visitor;
- if (state || wrapper) {
- topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper);
- }
- mergePair(mergedVisitor, topVisitor);
- for (const key of Object.keys(visitor)) {
- if (shouldIgnoreKey(key)) continue;
- let typeVisitor = visitor[key];
- if (state || wrapper) {
- typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper);
- }
- const nodeVisitor = mergedVisitor[key] || (mergedVisitor[key] = {});
- mergePair(nodeVisitor, typeVisitor);
- }
- }
- ;
- return mergedVisitor;
-}
-function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
- const newVisitor = {};
- for (const phase of ["enter", "exit"]) {
- let fns = oldVisitor[phase];
- if (!Array.isArray(fns)) continue;
- fns = fns.map(function (fn) {
- let newFn = fn;
- if (state) {
- newFn = function (path) {
- fn.call(state, path, state);
- };
- }
- if (wrapper) {
- newFn = wrapper(state == null ? void 0 : state.key, phase, newFn);
- }
- if (newFn !== fn) {
- newFn.toString = () => fn.toString();
- }
- return newFn;
- });
- newVisitor[phase] = fns;
- }
- return newVisitor;
-}
-function ensureEntranceObjects(obj) {
- for (const key of Object.keys(obj)) {
- if (shouldIgnoreKey(key)) continue;
- const fns = obj[key];
- if (typeof fns === "function") {
- obj[key] = {
- enter: fns
- };
- }
- }
-}
-function ensureCallbackArrays(obj) {
- if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter];
- if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit];
-}
-function wrapCheck(nodeType, fn) {
- const newFn = function (path) {
- if (path[`is${nodeType}`]()) {
- return fn.apply(this, arguments);
- }
- };
- newFn.toString = () => fn.toString();
- return newFn;
-}
-function shouldIgnoreKey(key) {
- if (key[0] === "_") return true;
- if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
- if (key === "denylist" || key === "noScope" || key === "skipKeys") {
- return true;
- }
- {
- if (key === "blacklist") {
- return true;
- }
- }
- return false;
-}
-function mergePair(dest, src) {
- for (const phase of ["enter", "exit"]) {
- if (!src[phase]) continue;
- dest[phase] = [].concat(dest[phase] || [], src[phase]);
- }
-}
-
-//# sourceMappingURL=visitors.js.map
-
-
-/***/ }),
-
-/***/ 3111:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = assertNode;
-var _isNode = __nccwpck_require__(8520);
-function assertNode(node) {
- if (!(0, _isNode.default)(node)) {
- var _node$type;
- const type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node);
- throw new TypeError(`Not a valid node of type "${type}"`);
- }
-}
-
-//# sourceMappingURL=assertNode.js.map
-
-
-/***/ }),
-
-/***/ 7084:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.assertAccessor = assertAccessor;
-exports.assertAnyTypeAnnotation = assertAnyTypeAnnotation;
-exports.assertArgumentPlaceholder = assertArgumentPlaceholder;
-exports.assertArrayExpression = assertArrayExpression;
-exports.assertArrayPattern = assertArrayPattern;
-exports.assertArrayTypeAnnotation = assertArrayTypeAnnotation;
-exports.assertArrowFunctionExpression = assertArrowFunctionExpression;
-exports.assertAssignmentExpression = assertAssignmentExpression;
-exports.assertAssignmentPattern = assertAssignmentPattern;
-exports.assertAwaitExpression = assertAwaitExpression;
-exports.assertBigIntLiteral = assertBigIntLiteral;
-exports.assertBinary = assertBinary;
-exports.assertBinaryExpression = assertBinaryExpression;
-exports.assertBindExpression = assertBindExpression;
-exports.assertBlock = assertBlock;
-exports.assertBlockParent = assertBlockParent;
-exports.assertBlockStatement = assertBlockStatement;
-exports.assertBooleanLiteral = assertBooleanLiteral;
-exports.assertBooleanLiteralTypeAnnotation = assertBooleanLiteralTypeAnnotation;
-exports.assertBooleanTypeAnnotation = assertBooleanTypeAnnotation;
-exports.assertBreakStatement = assertBreakStatement;
-exports.assertCallExpression = assertCallExpression;
-exports.assertCatchClause = assertCatchClause;
-exports.assertClass = assertClass;
-exports.assertClassAccessorProperty = assertClassAccessorProperty;
-exports.assertClassBody = assertClassBody;
-exports.assertClassDeclaration = assertClassDeclaration;
-exports.assertClassExpression = assertClassExpression;
-exports.assertClassImplements = assertClassImplements;
-exports.assertClassMethod = assertClassMethod;
-exports.assertClassPrivateMethod = assertClassPrivateMethod;
-exports.assertClassPrivateProperty = assertClassPrivateProperty;
-exports.assertClassProperty = assertClassProperty;
-exports.assertCompletionStatement = assertCompletionStatement;
-exports.assertConditional = assertConditional;
-exports.assertConditionalExpression = assertConditionalExpression;
-exports.assertContinueStatement = assertContinueStatement;
-exports.assertDebuggerStatement = assertDebuggerStatement;
-exports.assertDecimalLiteral = assertDecimalLiteral;
-exports.assertDeclaration = assertDeclaration;
-exports.assertDeclareClass = assertDeclareClass;
-exports.assertDeclareExportAllDeclaration = assertDeclareExportAllDeclaration;
-exports.assertDeclareExportDeclaration = assertDeclareExportDeclaration;
-exports.assertDeclareFunction = assertDeclareFunction;
-exports.assertDeclareInterface = assertDeclareInterface;
-exports.assertDeclareModule = assertDeclareModule;
-exports.assertDeclareModuleExports = assertDeclareModuleExports;
-exports.assertDeclareOpaqueType = assertDeclareOpaqueType;
-exports.assertDeclareTypeAlias = assertDeclareTypeAlias;
-exports.assertDeclareVariable = assertDeclareVariable;
-exports.assertDeclaredPredicate = assertDeclaredPredicate;
-exports.assertDecorator = assertDecorator;
-exports.assertDirective = assertDirective;
-exports.assertDirectiveLiteral = assertDirectiveLiteral;
-exports.assertDoExpression = assertDoExpression;
-exports.assertDoWhileStatement = assertDoWhileStatement;
-exports.assertEmptyStatement = assertEmptyStatement;
-exports.assertEmptyTypeAnnotation = assertEmptyTypeAnnotation;
-exports.assertEnumBody = assertEnumBody;
-exports.assertEnumBooleanBody = assertEnumBooleanBody;
-exports.assertEnumBooleanMember = assertEnumBooleanMember;
-exports.assertEnumDeclaration = assertEnumDeclaration;
-exports.assertEnumDefaultedMember = assertEnumDefaultedMember;
-exports.assertEnumMember = assertEnumMember;
-exports.assertEnumNumberBody = assertEnumNumberBody;
-exports.assertEnumNumberMember = assertEnumNumberMember;
-exports.assertEnumStringBody = assertEnumStringBody;
-exports.assertEnumStringMember = assertEnumStringMember;
-exports.assertEnumSymbolBody = assertEnumSymbolBody;
-exports.assertExistsTypeAnnotation = assertExistsTypeAnnotation;
-exports.assertExportAllDeclaration = assertExportAllDeclaration;
-exports.assertExportDeclaration = assertExportDeclaration;
-exports.assertExportDefaultDeclaration = assertExportDefaultDeclaration;
-exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier;
-exports.assertExportNamedDeclaration = assertExportNamedDeclaration;
-exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier;
-exports.assertExportSpecifier = assertExportSpecifier;
-exports.assertExpression = assertExpression;
-exports.assertExpressionStatement = assertExpressionStatement;
-exports.assertExpressionWrapper = assertExpressionWrapper;
-exports.assertFile = assertFile;
-exports.assertFlow = assertFlow;
-exports.assertFlowBaseAnnotation = assertFlowBaseAnnotation;
-exports.assertFlowDeclaration = assertFlowDeclaration;
-exports.assertFlowPredicate = assertFlowPredicate;
-exports.assertFlowType = assertFlowType;
-exports.assertFor = assertFor;
-exports.assertForInStatement = assertForInStatement;
-exports.assertForOfStatement = assertForOfStatement;
-exports.assertForStatement = assertForStatement;
-exports.assertForXStatement = assertForXStatement;
-exports.assertFunction = assertFunction;
-exports.assertFunctionDeclaration = assertFunctionDeclaration;
-exports.assertFunctionExpression = assertFunctionExpression;
-exports.assertFunctionParent = assertFunctionParent;
-exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation;
-exports.assertFunctionTypeParam = assertFunctionTypeParam;
-exports.assertGenericTypeAnnotation = assertGenericTypeAnnotation;
-exports.assertIdentifier = assertIdentifier;
-exports.assertIfStatement = assertIfStatement;
-exports.assertImmutable = assertImmutable;
-exports.assertImport = assertImport;
-exports.assertImportAttribute = assertImportAttribute;
-exports.assertImportDeclaration = assertImportDeclaration;
-exports.assertImportDefaultSpecifier = assertImportDefaultSpecifier;
-exports.assertImportExpression = assertImportExpression;
-exports.assertImportNamespaceSpecifier = assertImportNamespaceSpecifier;
-exports.assertImportOrExportDeclaration = assertImportOrExportDeclaration;
-exports.assertImportSpecifier = assertImportSpecifier;
-exports.assertIndexedAccessType = assertIndexedAccessType;
-exports.assertInferredPredicate = assertInferredPredicate;
-exports.assertInterfaceDeclaration = assertInterfaceDeclaration;
-exports.assertInterfaceExtends = assertInterfaceExtends;
-exports.assertInterfaceTypeAnnotation = assertInterfaceTypeAnnotation;
-exports.assertInterpreterDirective = assertInterpreterDirective;
-exports.assertIntersectionTypeAnnotation = assertIntersectionTypeAnnotation;
-exports.assertJSX = assertJSX;
-exports.assertJSXAttribute = assertJSXAttribute;
-exports.assertJSXClosingElement = assertJSXClosingElement;
-exports.assertJSXClosingFragment = assertJSXClosingFragment;
-exports.assertJSXElement = assertJSXElement;
-exports.assertJSXEmptyExpression = assertJSXEmptyExpression;
-exports.assertJSXExpressionContainer = assertJSXExpressionContainer;
-exports.assertJSXFragment = assertJSXFragment;
-exports.assertJSXIdentifier = assertJSXIdentifier;
-exports.assertJSXMemberExpression = assertJSXMemberExpression;
-exports.assertJSXNamespacedName = assertJSXNamespacedName;
-exports.assertJSXOpeningElement = assertJSXOpeningElement;
-exports.assertJSXOpeningFragment = assertJSXOpeningFragment;
-exports.assertJSXSpreadAttribute = assertJSXSpreadAttribute;
-exports.assertJSXSpreadChild = assertJSXSpreadChild;
-exports.assertJSXText = assertJSXText;
-exports.assertLVal = assertLVal;
-exports.assertLabeledStatement = assertLabeledStatement;
-exports.assertLiteral = assertLiteral;
-exports.assertLogicalExpression = assertLogicalExpression;
-exports.assertLoop = assertLoop;
-exports.assertMemberExpression = assertMemberExpression;
-exports.assertMetaProperty = assertMetaProperty;
-exports.assertMethod = assertMethod;
-exports.assertMiscellaneous = assertMiscellaneous;
-exports.assertMixedTypeAnnotation = assertMixedTypeAnnotation;
-exports.assertModuleDeclaration = assertModuleDeclaration;
-exports.assertModuleExpression = assertModuleExpression;
-exports.assertModuleSpecifier = assertModuleSpecifier;
-exports.assertNewExpression = assertNewExpression;
-exports.assertNoop = assertNoop;
-exports.assertNullLiteral = assertNullLiteral;
-exports.assertNullLiteralTypeAnnotation = assertNullLiteralTypeAnnotation;
-exports.assertNullableTypeAnnotation = assertNullableTypeAnnotation;
-exports.assertNumberLiteral = assertNumberLiteral;
-exports.assertNumberLiteralTypeAnnotation = assertNumberLiteralTypeAnnotation;
-exports.assertNumberTypeAnnotation = assertNumberTypeAnnotation;
-exports.assertNumericLiteral = assertNumericLiteral;
-exports.assertObjectExpression = assertObjectExpression;
-exports.assertObjectMember = assertObjectMember;
-exports.assertObjectMethod = assertObjectMethod;
-exports.assertObjectPattern = assertObjectPattern;
-exports.assertObjectProperty = assertObjectProperty;
-exports.assertObjectTypeAnnotation = assertObjectTypeAnnotation;
-exports.assertObjectTypeCallProperty = assertObjectTypeCallProperty;
-exports.assertObjectTypeIndexer = assertObjectTypeIndexer;
-exports.assertObjectTypeInternalSlot = assertObjectTypeInternalSlot;
-exports.assertObjectTypeProperty = assertObjectTypeProperty;
-exports.assertObjectTypeSpreadProperty = assertObjectTypeSpreadProperty;
-exports.assertOpaqueType = assertOpaqueType;
-exports.assertOptionalCallExpression = assertOptionalCallExpression;
-exports.assertOptionalIndexedAccessType = assertOptionalIndexedAccessType;
-exports.assertOptionalMemberExpression = assertOptionalMemberExpression;
-exports.assertParenthesizedExpression = assertParenthesizedExpression;
-exports.assertPattern = assertPattern;
-exports.assertPatternLike = assertPatternLike;
-exports.assertPipelineBareFunction = assertPipelineBareFunction;
-exports.assertPipelinePrimaryTopicReference = assertPipelinePrimaryTopicReference;
-exports.assertPipelineTopicExpression = assertPipelineTopicExpression;
-exports.assertPlaceholder = assertPlaceholder;
-exports.assertPrivate = assertPrivate;
-exports.assertPrivateName = assertPrivateName;
-exports.assertProgram = assertProgram;
-exports.assertProperty = assertProperty;
-exports.assertPureish = assertPureish;
-exports.assertQualifiedTypeIdentifier = assertQualifiedTypeIdentifier;
-exports.assertRecordExpression = assertRecordExpression;
-exports.assertRegExpLiteral = assertRegExpLiteral;
-exports.assertRegexLiteral = assertRegexLiteral;
-exports.assertRestElement = assertRestElement;
-exports.assertRestProperty = assertRestProperty;
-exports.assertReturnStatement = assertReturnStatement;
-exports.assertScopable = assertScopable;
-exports.assertSequenceExpression = assertSequenceExpression;
-exports.assertSpreadElement = assertSpreadElement;
-exports.assertSpreadProperty = assertSpreadProperty;
-exports.assertStandardized = assertStandardized;
-exports.assertStatement = assertStatement;
-exports.assertStaticBlock = assertStaticBlock;
-exports.assertStringLiteral = assertStringLiteral;
-exports.assertStringLiteralTypeAnnotation = assertStringLiteralTypeAnnotation;
-exports.assertStringTypeAnnotation = assertStringTypeAnnotation;
-exports.assertSuper = assertSuper;
-exports.assertSwitchCase = assertSwitchCase;
-exports.assertSwitchStatement = assertSwitchStatement;
-exports.assertSymbolTypeAnnotation = assertSymbolTypeAnnotation;
-exports.assertTSAnyKeyword = assertTSAnyKeyword;
-exports.assertTSArrayType = assertTSArrayType;
-exports.assertTSAsExpression = assertTSAsExpression;
-exports.assertTSBaseType = assertTSBaseType;
-exports.assertTSBigIntKeyword = assertTSBigIntKeyword;
-exports.assertTSBooleanKeyword = assertTSBooleanKeyword;
-exports.assertTSCallSignatureDeclaration = assertTSCallSignatureDeclaration;
-exports.assertTSConditionalType = assertTSConditionalType;
-exports.assertTSConstructSignatureDeclaration = assertTSConstructSignatureDeclaration;
-exports.assertTSConstructorType = assertTSConstructorType;
-exports.assertTSDeclareFunction = assertTSDeclareFunction;
-exports.assertTSDeclareMethod = assertTSDeclareMethod;
-exports.assertTSEntityName = assertTSEntityName;
-exports.assertTSEnumBody = assertTSEnumBody;
-exports.assertTSEnumDeclaration = assertTSEnumDeclaration;
-exports.assertTSEnumMember = assertTSEnumMember;
-exports.assertTSExportAssignment = assertTSExportAssignment;
-exports.assertTSExpressionWithTypeArguments = assertTSExpressionWithTypeArguments;
-exports.assertTSExternalModuleReference = assertTSExternalModuleReference;
-exports.assertTSFunctionType = assertTSFunctionType;
-exports.assertTSImportEqualsDeclaration = assertTSImportEqualsDeclaration;
-exports.assertTSImportType = assertTSImportType;
-exports.assertTSIndexSignature = assertTSIndexSignature;
-exports.assertTSIndexedAccessType = assertTSIndexedAccessType;
-exports.assertTSInferType = assertTSInferType;
-exports.assertTSInstantiationExpression = assertTSInstantiationExpression;
-exports.assertTSInterfaceBody = assertTSInterfaceBody;
-exports.assertTSInterfaceDeclaration = assertTSInterfaceDeclaration;
-exports.assertTSIntersectionType = assertTSIntersectionType;
-exports.assertTSIntrinsicKeyword = assertTSIntrinsicKeyword;
-exports.assertTSLiteralType = assertTSLiteralType;
-exports.assertTSMappedType = assertTSMappedType;
-exports.assertTSMethodSignature = assertTSMethodSignature;
-exports.assertTSModuleBlock = assertTSModuleBlock;
-exports.assertTSModuleDeclaration = assertTSModuleDeclaration;
-exports.assertTSNamedTupleMember = assertTSNamedTupleMember;
-exports.assertTSNamespaceExportDeclaration = assertTSNamespaceExportDeclaration;
-exports.assertTSNeverKeyword = assertTSNeverKeyword;
-exports.assertTSNonNullExpression = assertTSNonNullExpression;
-exports.assertTSNullKeyword = assertTSNullKeyword;
-exports.assertTSNumberKeyword = assertTSNumberKeyword;
-exports.assertTSObjectKeyword = assertTSObjectKeyword;
-exports.assertTSOptionalType = assertTSOptionalType;
-exports.assertTSParameterProperty = assertTSParameterProperty;
-exports.assertTSParenthesizedType = assertTSParenthesizedType;
-exports.assertTSPropertySignature = assertTSPropertySignature;
-exports.assertTSQualifiedName = assertTSQualifiedName;
-exports.assertTSRestType = assertTSRestType;
-exports.assertTSSatisfiesExpression = assertTSSatisfiesExpression;
-exports.assertTSStringKeyword = assertTSStringKeyword;
-exports.assertTSSymbolKeyword = assertTSSymbolKeyword;
-exports.assertTSTemplateLiteralType = assertTSTemplateLiteralType;
-exports.assertTSThisType = assertTSThisType;
-exports.assertTSTupleType = assertTSTupleType;
-exports.assertTSType = assertTSType;
-exports.assertTSTypeAliasDeclaration = assertTSTypeAliasDeclaration;
-exports.assertTSTypeAnnotation = assertTSTypeAnnotation;
-exports.assertTSTypeAssertion = assertTSTypeAssertion;
-exports.assertTSTypeElement = assertTSTypeElement;
-exports.assertTSTypeLiteral = assertTSTypeLiteral;
-exports.assertTSTypeOperator = assertTSTypeOperator;
-exports.assertTSTypeParameter = assertTSTypeParameter;
-exports.assertTSTypeParameterDeclaration = assertTSTypeParameterDeclaration;
-exports.assertTSTypeParameterInstantiation = assertTSTypeParameterInstantiation;
-exports.assertTSTypePredicate = assertTSTypePredicate;
-exports.assertTSTypeQuery = assertTSTypeQuery;
-exports.assertTSTypeReference = assertTSTypeReference;
-exports.assertTSUndefinedKeyword = assertTSUndefinedKeyword;
-exports.assertTSUnionType = assertTSUnionType;
-exports.assertTSUnknownKeyword = assertTSUnknownKeyword;
-exports.assertTSVoidKeyword = assertTSVoidKeyword;
-exports.assertTaggedTemplateExpression = assertTaggedTemplateExpression;
-exports.assertTemplateElement = assertTemplateElement;
-exports.assertTemplateLiteral = assertTemplateLiteral;
-exports.assertTerminatorless = assertTerminatorless;
-exports.assertThisExpression = assertThisExpression;
-exports.assertThisTypeAnnotation = assertThisTypeAnnotation;
-exports.assertThrowStatement = assertThrowStatement;
-exports.assertTopicReference = assertTopicReference;
-exports.assertTryStatement = assertTryStatement;
-exports.assertTupleExpression = assertTupleExpression;
-exports.assertTupleTypeAnnotation = assertTupleTypeAnnotation;
-exports.assertTypeAlias = assertTypeAlias;
-exports.assertTypeAnnotation = assertTypeAnnotation;
-exports.assertTypeCastExpression = assertTypeCastExpression;
-exports.assertTypeParameter = assertTypeParameter;
-exports.assertTypeParameterDeclaration = assertTypeParameterDeclaration;
-exports.assertTypeParameterInstantiation = assertTypeParameterInstantiation;
-exports.assertTypeScript = assertTypeScript;
-exports.assertTypeofTypeAnnotation = assertTypeofTypeAnnotation;
-exports.assertUnaryExpression = assertUnaryExpression;
-exports.assertUnaryLike = assertUnaryLike;
-exports.assertUnionTypeAnnotation = assertUnionTypeAnnotation;
-exports.assertUpdateExpression = assertUpdateExpression;
-exports.assertUserWhitespacable = assertUserWhitespacable;
-exports.assertV8IntrinsicIdentifier = assertV8IntrinsicIdentifier;
-exports.assertVariableDeclaration = assertVariableDeclaration;
-exports.assertVariableDeclarator = assertVariableDeclarator;
-exports.assertVariance = assertVariance;
-exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation;
-exports.assertWhile = assertWhile;
-exports.assertWhileStatement = assertWhileStatement;
-exports.assertWithStatement = assertWithStatement;
-exports.assertYieldExpression = assertYieldExpression;
-var _is = __nccwpck_require__(3860);
-var _deprecationWarning = __nccwpck_require__(496);
-function assert(type, node, opts) {
- if (!(0, _is.default)(type, node, opts)) {
- throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, ` + `but instead got "${node.type}".`);
- }
-}
-function assertArrayExpression(node, opts) {
- assert("ArrayExpression", node, opts);
-}
-function assertAssignmentExpression(node, opts) {
- assert("AssignmentExpression", node, opts);
-}
-function assertBinaryExpression(node, opts) {
- assert("BinaryExpression", node, opts);
-}
-function assertInterpreterDirective(node, opts) {
- assert("InterpreterDirective", node, opts);
-}
-function assertDirective(node, opts) {
- assert("Directive", node, opts);
-}
-function assertDirectiveLiteral(node, opts) {
- assert("DirectiveLiteral", node, opts);
-}
-function assertBlockStatement(node, opts) {
- assert("BlockStatement", node, opts);
-}
-function assertBreakStatement(node, opts) {
- assert("BreakStatement", node, opts);
-}
-function assertCallExpression(node, opts) {
- assert("CallExpression", node, opts);
-}
-function assertCatchClause(node, opts) {
- assert("CatchClause", node, opts);
-}
-function assertConditionalExpression(node, opts) {
- assert("ConditionalExpression", node, opts);
-}
-function assertContinueStatement(node, opts) {
- assert("ContinueStatement", node, opts);
-}
-function assertDebuggerStatement(node, opts) {
- assert("DebuggerStatement", node, opts);
-}
-function assertDoWhileStatement(node, opts) {
- assert("DoWhileStatement", node, opts);
-}
-function assertEmptyStatement(node, opts) {
- assert("EmptyStatement", node, opts);
-}
-function assertExpressionStatement(node, opts) {
- assert("ExpressionStatement", node, opts);
-}
-function assertFile(node, opts) {
- assert("File", node, opts);
-}
-function assertForInStatement(node, opts) {
- assert("ForInStatement", node, opts);
-}
-function assertForStatement(node, opts) {
- assert("ForStatement", node, opts);
-}
-function assertFunctionDeclaration(node, opts) {
- assert("FunctionDeclaration", node, opts);
-}
-function assertFunctionExpression(node, opts) {
- assert("FunctionExpression", node, opts);
-}
-function assertIdentifier(node, opts) {
- assert("Identifier", node, opts);
-}
-function assertIfStatement(node, opts) {
- assert("IfStatement", node, opts);
-}
-function assertLabeledStatement(node, opts) {
- assert("LabeledStatement", node, opts);
-}
-function assertStringLiteral(node, opts) {
- assert("StringLiteral", node, opts);
-}
-function assertNumericLiteral(node, opts) {
- assert("NumericLiteral", node, opts);
-}
-function assertNullLiteral(node, opts) {
- assert("NullLiteral", node, opts);
-}
-function assertBooleanLiteral(node, opts) {
- assert("BooleanLiteral", node, opts);
-}
-function assertRegExpLiteral(node, opts) {
- assert("RegExpLiteral", node, opts);
-}
-function assertLogicalExpression(node, opts) {
- assert("LogicalExpression", node, opts);
-}
-function assertMemberExpression(node, opts) {
- assert("MemberExpression", node, opts);
-}
-function assertNewExpression(node, opts) {
- assert("NewExpression", node, opts);
-}
-function assertProgram(node, opts) {
- assert("Program", node, opts);
-}
-function assertObjectExpression(node, opts) {
- assert("ObjectExpression", node, opts);
-}
-function assertObjectMethod(node, opts) {
- assert("ObjectMethod", node, opts);
-}
-function assertObjectProperty(node, opts) {
- assert("ObjectProperty", node, opts);
-}
-function assertRestElement(node, opts) {
- assert("RestElement", node, opts);
-}
-function assertReturnStatement(node, opts) {
- assert("ReturnStatement", node, opts);
-}
-function assertSequenceExpression(node, opts) {
- assert("SequenceExpression", node, opts);
-}
-function assertParenthesizedExpression(node, opts) {
- assert("ParenthesizedExpression", node, opts);
-}
-function assertSwitchCase(node, opts) {
- assert("SwitchCase", node, opts);
-}
-function assertSwitchStatement(node, opts) {
- assert("SwitchStatement", node, opts);
-}
-function assertThisExpression(node, opts) {
- assert("ThisExpression", node, opts);
-}
-function assertThrowStatement(node, opts) {
- assert("ThrowStatement", node, opts);
-}
-function assertTryStatement(node, opts) {
- assert("TryStatement", node, opts);
-}
-function assertUnaryExpression(node, opts) {
- assert("UnaryExpression", node, opts);
-}
-function assertUpdateExpression(node, opts) {
- assert("UpdateExpression", node, opts);
-}
-function assertVariableDeclaration(node, opts) {
- assert("VariableDeclaration", node, opts);
-}
-function assertVariableDeclarator(node, opts) {
- assert("VariableDeclarator", node, opts);
-}
-function assertWhileStatement(node, opts) {
- assert("WhileStatement", node, opts);
-}
-function assertWithStatement(node, opts) {
- assert("WithStatement", node, opts);
-}
-function assertAssignmentPattern(node, opts) {
- assert("AssignmentPattern", node, opts);
-}
-function assertArrayPattern(node, opts) {
- assert("ArrayPattern", node, opts);
-}
-function assertArrowFunctionExpression(node, opts) {
- assert("ArrowFunctionExpression", node, opts);
-}
-function assertClassBody(node, opts) {
- assert("ClassBody", node, opts);
-}
-function assertClassExpression(node, opts) {
- assert("ClassExpression", node, opts);
-}
-function assertClassDeclaration(node, opts) {
- assert("ClassDeclaration", node, opts);
-}
-function assertExportAllDeclaration(node, opts) {
- assert("ExportAllDeclaration", node, opts);
-}
-function assertExportDefaultDeclaration(node, opts) {
- assert("ExportDefaultDeclaration", node, opts);
-}
-function assertExportNamedDeclaration(node, opts) {
- assert("ExportNamedDeclaration", node, opts);
-}
-function assertExportSpecifier(node, opts) {
- assert("ExportSpecifier", node, opts);
-}
-function assertForOfStatement(node, opts) {
- assert("ForOfStatement", node, opts);
-}
-function assertImportDeclaration(node, opts) {
- assert("ImportDeclaration", node, opts);
-}
-function assertImportDefaultSpecifier(node, opts) {
- assert("ImportDefaultSpecifier", node, opts);
-}
-function assertImportNamespaceSpecifier(node, opts) {
- assert("ImportNamespaceSpecifier", node, opts);
-}
-function assertImportSpecifier(node, opts) {
- assert("ImportSpecifier", node, opts);
-}
-function assertImportExpression(node, opts) {
- assert("ImportExpression", node, opts);
-}
-function assertMetaProperty(node, opts) {
- assert("MetaProperty", node, opts);
-}
-function assertClassMethod(node, opts) {
- assert("ClassMethod", node, opts);
-}
-function assertObjectPattern(node, opts) {
- assert("ObjectPattern", node, opts);
-}
-function assertSpreadElement(node, opts) {
- assert("SpreadElement", node, opts);
-}
-function assertSuper(node, opts) {
- assert("Super", node, opts);
-}
-function assertTaggedTemplateExpression(node, opts) {
- assert("TaggedTemplateExpression", node, opts);
-}
-function assertTemplateElement(node, opts) {
- assert("TemplateElement", node, opts);
-}
-function assertTemplateLiteral(node, opts) {
- assert("TemplateLiteral", node, opts);
-}
-function assertYieldExpression(node, opts) {
- assert("YieldExpression", node, opts);
-}
-function assertAwaitExpression(node, opts) {
- assert("AwaitExpression", node, opts);
-}
-function assertImport(node, opts) {
- assert("Import", node, opts);
-}
-function assertBigIntLiteral(node, opts) {
- assert("BigIntLiteral", node, opts);
-}
-function assertExportNamespaceSpecifier(node, opts) {
- assert("ExportNamespaceSpecifier", node, opts);
-}
-function assertOptionalMemberExpression(node, opts) {
- assert("OptionalMemberExpression", node, opts);
-}
-function assertOptionalCallExpression(node, opts) {
- assert("OptionalCallExpression", node, opts);
-}
-function assertClassProperty(node, opts) {
- assert("ClassProperty", node, opts);
-}
-function assertClassAccessorProperty(node, opts) {
- assert("ClassAccessorProperty", node, opts);
-}
-function assertClassPrivateProperty(node, opts) {
- assert("ClassPrivateProperty", node, opts);
-}
-function assertClassPrivateMethod(node, opts) {
- assert("ClassPrivateMethod", node, opts);
-}
-function assertPrivateName(node, opts) {
- assert("PrivateName", node, opts);
-}
-function assertStaticBlock(node, opts) {
- assert("StaticBlock", node, opts);
-}
-function assertImportAttribute(node, opts) {
- assert("ImportAttribute", node, opts);
-}
-function assertAnyTypeAnnotation(node, opts) {
- assert("AnyTypeAnnotation", node, opts);
-}
-function assertArrayTypeAnnotation(node, opts) {
- assert("ArrayTypeAnnotation", node, opts);
-}
-function assertBooleanTypeAnnotation(node, opts) {
- assert("BooleanTypeAnnotation", node, opts);
-}
-function assertBooleanLiteralTypeAnnotation(node, opts) {
- assert("BooleanLiteralTypeAnnotation", node, opts);
-}
-function assertNullLiteralTypeAnnotation(node, opts) {
- assert("NullLiteralTypeAnnotation", node, opts);
-}
-function assertClassImplements(node, opts) {
- assert("ClassImplements", node, opts);
-}
-function assertDeclareClass(node, opts) {
- assert("DeclareClass", node, opts);
-}
-function assertDeclareFunction(node, opts) {
- assert("DeclareFunction", node, opts);
-}
-function assertDeclareInterface(node, opts) {
- assert("DeclareInterface", node, opts);
-}
-function assertDeclareModule(node, opts) {
- assert("DeclareModule", node, opts);
-}
-function assertDeclareModuleExports(node, opts) {
- assert("DeclareModuleExports", node, opts);
-}
-function assertDeclareTypeAlias(node, opts) {
- assert("DeclareTypeAlias", node, opts);
-}
-function assertDeclareOpaqueType(node, opts) {
- assert("DeclareOpaqueType", node, opts);
-}
-function assertDeclareVariable(node, opts) {
- assert("DeclareVariable", node, opts);
-}
-function assertDeclareExportDeclaration(node, opts) {
- assert("DeclareExportDeclaration", node, opts);
-}
-function assertDeclareExportAllDeclaration(node, opts) {
- assert("DeclareExportAllDeclaration", node, opts);
-}
-function assertDeclaredPredicate(node, opts) {
- assert("DeclaredPredicate", node, opts);
-}
-function assertExistsTypeAnnotation(node, opts) {
- assert("ExistsTypeAnnotation", node, opts);
-}
-function assertFunctionTypeAnnotation(node, opts) {
- assert("FunctionTypeAnnotation", node, opts);
-}
-function assertFunctionTypeParam(node, opts) {
- assert("FunctionTypeParam", node, opts);
-}
-function assertGenericTypeAnnotation(node, opts) {
- assert("GenericTypeAnnotation", node, opts);
-}
-function assertInferredPredicate(node, opts) {
- assert("InferredPredicate", node, opts);
-}
-function assertInterfaceExtends(node, opts) {
- assert("InterfaceExtends", node, opts);
-}
-function assertInterfaceDeclaration(node, opts) {
- assert("InterfaceDeclaration", node, opts);
-}
-function assertInterfaceTypeAnnotation(node, opts) {
- assert("InterfaceTypeAnnotation", node, opts);
-}
-function assertIntersectionTypeAnnotation(node, opts) {
- assert("IntersectionTypeAnnotation", node, opts);
-}
-function assertMixedTypeAnnotation(node, opts) {
- assert("MixedTypeAnnotation", node, opts);
-}
-function assertEmptyTypeAnnotation(node, opts) {
- assert("EmptyTypeAnnotation", node, opts);
-}
-function assertNullableTypeAnnotation(node, opts) {
- assert("NullableTypeAnnotation", node, opts);
-}
-function assertNumberLiteralTypeAnnotation(node, opts) {
- assert("NumberLiteralTypeAnnotation", node, opts);
-}
-function assertNumberTypeAnnotation(node, opts) {
- assert("NumberTypeAnnotation", node, opts);
-}
-function assertObjectTypeAnnotation(node, opts) {
- assert("ObjectTypeAnnotation", node, opts);
-}
-function assertObjectTypeInternalSlot(node, opts) {
- assert("ObjectTypeInternalSlot", node, opts);
-}
-function assertObjectTypeCallProperty(node, opts) {
- assert("ObjectTypeCallProperty", node, opts);
-}
-function assertObjectTypeIndexer(node, opts) {
- assert("ObjectTypeIndexer", node, opts);
-}
-function assertObjectTypeProperty(node, opts) {
- assert("ObjectTypeProperty", node, opts);
-}
-function assertObjectTypeSpreadProperty(node, opts) {
- assert("ObjectTypeSpreadProperty", node, opts);
-}
-function assertOpaqueType(node, opts) {
- assert("OpaqueType", node, opts);
-}
-function assertQualifiedTypeIdentifier(node, opts) {
- assert("QualifiedTypeIdentifier", node, opts);
-}
-function assertStringLiteralTypeAnnotation(node, opts) {
- assert("StringLiteralTypeAnnotation", node, opts);
-}
-function assertStringTypeAnnotation(node, opts) {
- assert("StringTypeAnnotation", node, opts);
-}
-function assertSymbolTypeAnnotation(node, opts) {
- assert("SymbolTypeAnnotation", node, opts);
-}
-function assertThisTypeAnnotation(node, opts) {
- assert("ThisTypeAnnotation", node, opts);
-}
-function assertTupleTypeAnnotation(node, opts) {
- assert("TupleTypeAnnotation", node, opts);
-}
-function assertTypeofTypeAnnotation(node, opts) {
- assert("TypeofTypeAnnotation", node, opts);
-}
-function assertTypeAlias(node, opts) {
- assert("TypeAlias", node, opts);
-}
-function assertTypeAnnotation(node, opts) {
- assert("TypeAnnotation", node, opts);
-}
-function assertTypeCastExpression(node, opts) {
- assert("TypeCastExpression", node, opts);
-}
-function assertTypeParameter(node, opts) {
- assert("TypeParameter", node, opts);
-}
-function assertTypeParameterDeclaration(node, opts) {
- assert("TypeParameterDeclaration", node, opts);
-}
-function assertTypeParameterInstantiation(node, opts) {
- assert("TypeParameterInstantiation", node, opts);
-}
-function assertUnionTypeAnnotation(node, opts) {
- assert("UnionTypeAnnotation", node, opts);
-}
-function assertVariance(node, opts) {
- assert("Variance", node, opts);
-}
-function assertVoidTypeAnnotation(node, opts) {
- assert("VoidTypeAnnotation", node, opts);
-}
-function assertEnumDeclaration(node, opts) {
- assert("EnumDeclaration", node, opts);
-}
-function assertEnumBooleanBody(node, opts) {
- assert("EnumBooleanBody", node, opts);
-}
-function assertEnumNumberBody(node, opts) {
- assert("EnumNumberBody", node, opts);
-}
-function assertEnumStringBody(node, opts) {
- assert("EnumStringBody", node, opts);
-}
-function assertEnumSymbolBody(node, opts) {
- assert("EnumSymbolBody", node, opts);
-}
-function assertEnumBooleanMember(node, opts) {
- assert("EnumBooleanMember", node, opts);
-}
-function assertEnumNumberMember(node, opts) {
- assert("EnumNumberMember", node, opts);
-}
-function assertEnumStringMember(node, opts) {
- assert("EnumStringMember", node, opts);
-}
-function assertEnumDefaultedMember(node, opts) {
- assert("EnumDefaultedMember", node, opts);
-}
-function assertIndexedAccessType(node, opts) {
- assert("IndexedAccessType", node, opts);
-}
-function assertOptionalIndexedAccessType(node, opts) {
- assert("OptionalIndexedAccessType", node, opts);
-}
-function assertJSXAttribute(node, opts) {
- assert("JSXAttribute", node, opts);
-}
-function assertJSXClosingElement(node, opts) {
- assert("JSXClosingElement", node, opts);
-}
-function assertJSXElement(node, opts) {
- assert("JSXElement", node, opts);
-}
-function assertJSXEmptyExpression(node, opts) {
- assert("JSXEmptyExpression", node, opts);
-}
-function assertJSXExpressionContainer(node, opts) {
- assert("JSXExpressionContainer", node, opts);
-}
-function assertJSXSpreadChild(node, opts) {
- assert("JSXSpreadChild", node, opts);
-}
-function assertJSXIdentifier(node, opts) {
- assert("JSXIdentifier", node, opts);
-}
-function assertJSXMemberExpression(node, opts) {
- assert("JSXMemberExpression", node, opts);
-}
-function assertJSXNamespacedName(node, opts) {
- assert("JSXNamespacedName", node, opts);
-}
-function assertJSXOpeningElement(node, opts) {
- assert("JSXOpeningElement", node, opts);
-}
-function assertJSXSpreadAttribute(node, opts) {
- assert("JSXSpreadAttribute", node, opts);
-}
-function assertJSXText(node, opts) {
- assert("JSXText", node, opts);
-}
-function assertJSXFragment(node, opts) {
- assert("JSXFragment", node, opts);
-}
-function assertJSXOpeningFragment(node, opts) {
- assert("JSXOpeningFragment", node, opts);
-}
-function assertJSXClosingFragment(node, opts) {
- assert("JSXClosingFragment", node, opts);
-}
-function assertNoop(node, opts) {
- assert("Noop", node, opts);
-}
-function assertPlaceholder(node, opts) {
- assert("Placeholder", node, opts);
-}
-function assertV8IntrinsicIdentifier(node, opts) {
- assert("V8IntrinsicIdentifier", node, opts);
-}
-function assertArgumentPlaceholder(node, opts) {
- assert("ArgumentPlaceholder", node, opts);
-}
-function assertBindExpression(node, opts) {
- assert("BindExpression", node, opts);
-}
-function assertDecorator(node, opts) {
- assert("Decorator", node, opts);
-}
-function assertDoExpression(node, opts) {
- assert("DoExpression", node, opts);
-}
-function assertExportDefaultSpecifier(node, opts) {
- assert("ExportDefaultSpecifier", node, opts);
-}
-function assertRecordExpression(node, opts) {
- assert("RecordExpression", node, opts);
-}
-function assertTupleExpression(node, opts) {
- assert("TupleExpression", node, opts);
-}
-function assertDecimalLiteral(node, opts) {
- assert("DecimalLiteral", node, opts);
-}
-function assertModuleExpression(node, opts) {
- assert("ModuleExpression", node, opts);
-}
-function assertTopicReference(node, opts) {
- assert("TopicReference", node, opts);
-}
-function assertPipelineTopicExpression(node, opts) {
- assert("PipelineTopicExpression", node, opts);
-}
-function assertPipelineBareFunction(node, opts) {
- assert("PipelineBareFunction", node, opts);
-}
-function assertPipelinePrimaryTopicReference(node, opts) {
- assert("PipelinePrimaryTopicReference", node, opts);
-}
-function assertTSParameterProperty(node, opts) {
- assert("TSParameterProperty", node, opts);
-}
-function assertTSDeclareFunction(node, opts) {
- assert("TSDeclareFunction", node, opts);
-}
-function assertTSDeclareMethod(node, opts) {
- assert("TSDeclareMethod", node, opts);
-}
-function assertTSQualifiedName(node, opts) {
- assert("TSQualifiedName", node, opts);
-}
-function assertTSCallSignatureDeclaration(node, opts) {
- assert("TSCallSignatureDeclaration", node, opts);
-}
-function assertTSConstructSignatureDeclaration(node, opts) {
- assert("TSConstructSignatureDeclaration", node, opts);
-}
-function assertTSPropertySignature(node, opts) {
- assert("TSPropertySignature", node, opts);
-}
-function assertTSMethodSignature(node, opts) {
- assert("TSMethodSignature", node, opts);
-}
-function assertTSIndexSignature(node, opts) {
- assert("TSIndexSignature", node, opts);
-}
-function assertTSAnyKeyword(node, opts) {
- assert("TSAnyKeyword", node, opts);
-}
-function assertTSBooleanKeyword(node, opts) {
- assert("TSBooleanKeyword", node, opts);
-}
-function assertTSBigIntKeyword(node, opts) {
- assert("TSBigIntKeyword", node, opts);
-}
-function assertTSIntrinsicKeyword(node, opts) {
- assert("TSIntrinsicKeyword", node, opts);
-}
-function assertTSNeverKeyword(node, opts) {
- assert("TSNeverKeyword", node, opts);
-}
-function assertTSNullKeyword(node, opts) {
- assert("TSNullKeyword", node, opts);
-}
-function assertTSNumberKeyword(node, opts) {
- assert("TSNumberKeyword", node, opts);
-}
-function assertTSObjectKeyword(node, opts) {
- assert("TSObjectKeyword", node, opts);
-}
-function assertTSStringKeyword(node, opts) {
- assert("TSStringKeyword", node, opts);
-}
-function assertTSSymbolKeyword(node, opts) {
- assert("TSSymbolKeyword", node, opts);
-}
-function assertTSUndefinedKeyword(node, opts) {
- assert("TSUndefinedKeyword", node, opts);
-}
-function assertTSUnknownKeyword(node, opts) {
- assert("TSUnknownKeyword", node, opts);
-}
-function assertTSVoidKeyword(node, opts) {
- assert("TSVoidKeyword", node, opts);
-}
-function assertTSThisType(node, opts) {
- assert("TSThisType", node, opts);
-}
-function assertTSFunctionType(node, opts) {
- assert("TSFunctionType", node, opts);
-}
-function assertTSConstructorType(node, opts) {
- assert("TSConstructorType", node, opts);
-}
-function assertTSTypeReference(node, opts) {
- assert("TSTypeReference", node, opts);
-}
-function assertTSTypePredicate(node, opts) {
- assert("TSTypePredicate", node, opts);
-}
-function assertTSTypeQuery(node, opts) {
- assert("TSTypeQuery", node, opts);
-}
-function assertTSTypeLiteral(node, opts) {
- assert("TSTypeLiteral", node, opts);
-}
-function assertTSArrayType(node, opts) {
- assert("TSArrayType", node, opts);
-}
-function assertTSTupleType(node, opts) {
- assert("TSTupleType", node, opts);
-}
-function assertTSOptionalType(node, opts) {
- assert("TSOptionalType", node, opts);
-}
-function assertTSRestType(node, opts) {
- assert("TSRestType", node, opts);
-}
-function assertTSNamedTupleMember(node, opts) {
- assert("TSNamedTupleMember", node, opts);
-}
-function assertTSUnionType(node, opts) {
- assert("TSUnionType", node, opts);
-}
-function assertTSIntersectionType(node, opts) {
- assert("TSIntersectionType", node, opts);
-}
-function assertTSConditionalType(node, opts) {
- assert("TSConditionalType", node, opts);
-}
-function assertTSInferType(node, opts) {
- assert("TSInferType", node, opts);
-}
-function assertTSParenthesizedType(node, opts) {
- assert("TSParenthesizedType", node, opts);
-}
-function assertTSTypeOperator(node, opts) {
- assert("TSTypeOperator", node, opts);
-}
-function assertTSIndexedAccessType(node, opts) {
- assert("TSIndexedAccessType", node, opts);
-}
-function assertTSMappedType(node, opts) {
- assert("TSMappedType", node, opts);
-}
-function assertTSTemplateLiteralType(node, opts) {
- assert("TSTemplateLiteralType", node, opts);
-}
-function assertTSLiteralType(node, opts) {
- assert("TSLiteralType", node, opts);
-}
-function assertTSExpressionWithTypeArguments(node, opts) {
- assert("TSExpressionWithTypeArguments", node, opts);
-}
-function assertTSInterfaceDeclaration(node, opts) {
- assert("TSInterfaceDeclaration", node, opts);
-}
-function assertTSInterfaceBody(node, opts) {
- assert("TSInterfaceBody", node, opts);
-}
-function assertTSTypeAliasDeclaration(node, opts) {
- assert("TSTypeAliasDeclaration", node, opts);
-}
-function assertTSInstantiationExpression(node, opts) {
- assert("TSInstantiationExpression", node, opts);
-}
-function assertTSAsExpression(node, opts) {
- assert("TSAsExpression", node, opts);
-}
-function assertTSSatisfiesExpression(node, opts) {
- assert("TSSatisfiesExpression", node, opts);
-}
-function assertTSTypeAssertion(node, opts) {
- assert("TSTypeAssertion", node, opts);
-}
-function assertTSEnumBody(node, opts) {
- assert("TSEnumBody", node, opts);
-}
-function assertTSEnumDeclaration(node, opts) {
- assert("TSEnumDeclaration", node, opts);
-}
-function assertTSEnumMember(node, opts) {
- assert("TSEnumMember", node, opts);
-}
-function assertTSModuleDeclaration(node, opts) {
- assert("TSModuleDeclaration", node, opts);
-}
-function assertTSModuleBlock(node, opts) {
- assert("TSModuleBlock", node, opts);
-}
-function assertTSImportType(node, opts) {
- assert("TSImportType", node, opts);
-}
-function assertTSImportEqualsDeclaration(node, opts) {
- assert("TSImportEqualsDeclaration", node, opts);
-}
-function assertTSExternalModuleReference(node, opts) {
- assert("TSExternalModuleReference", node, opts);
-}
-function assertTSNonNullExpression(node, opts) {
- assert("TSNonNullExpression", node, opts);
-}
-function assertTSExportAssignment(node, opts) {
- assert("TSExportAssignment", node, opts);
-}
-function assertTSNamespaceExportDeclaration(node, opts) {
- assert("TSNamespaceExportDeclaration", node, opts);
-}
-function assertTSTypeAnnotation(node, opts) {
- assert("TSTypeAnnotation", node, opts);
-}
-function assertTSTypeParameterInstantiation(node, opts) {
- assert("TSTypeParameterInstantiation", node, opts);
-}
-function assertTSTypeParameterDeclaration(node, opts) {
- assert("TSTypeParameterDeclaration", node, opts);
-}
-function assertTSTypeParameter(node, opts) {
- assert("TSTypeParameter", node, opts);
-}
-function assertStandardized(node, opts) {
- assert("Standardized", node, opts);
-}
-function assertExpression(node, opts) {
- assert("Expression", node, opts);
-}
-function assertBinary(node, opts) {
- assert("Binary", node, opts);
-}
-function assertScopable(node, opts) {
- assert("Scopable", node, opts);
-}
-function assertBlockParent(node, opts) {
- assert("BlockParent", node, opts);
-}
-function assertBlock(node, opts) {
- assert("Block", node, opts);
-}
-function assertStatement(node, opts) {
- assert("Statement", node, opts);
-}
-function assertTerminatorless(node, opts) {
- assert("Terminatorless", node, opts);
-}
-function assertCompletionStatement(node, opts) {
- assert("CompletionStatement", node, opts);
-}
-function assertConditional(node, opts) {
- assert("Conditional", node, opts);
-}
-function assertLoop(node, opts) {
- assert("Loop", node, opts);
-}
-function assertWhile(node, opts) {
- assert("While", node, opts);
-}
-function assertExpressionWrapper(node, opts) {
- assert("ExpressionWrapper", node, opts);
-}
-function assertFor(node, opts) {
- assert("For", node, opts);
-}
-function assertForXStatement(node, opts) {
- assert("ForXStatement", node, opts);
-}
-function assertFunction(node, opts) {
- assert("Function", node, opts);
-}
-function assertFunctionParent(node, opts) {
- assert("FunctionParent", node, opts);
-}
-function assertPureish(node, opts) {
- assert("Pureish", node, opts);
-}
-function assertDeclaration(node, opts) {
- assert("Declaration", node, opts);
-}
-function assertPatternLike(node, opts) {
- assert("PatternLike", node, opts);
-}
-function assertLVal(node, opts) {
- assert("LVal", node, opts);
-}
-function assertTSEntityName(node, opts) {
- assert("TSEntityName", node, opts);
-}
-function assertLiteral(node, opts) {
- assert("Literal", node, opts);
-}
-function assertImmutable(node, opts) {
- assert("Immutable", node, opts);
-}
-function assertUserWhitespacable(node, opts) {
- assert("UserWhitespacable", node, opts);
-}
-function assertMethod(node, opts) {
- assert("Method", node, opts);
-}
-function assertObjectMember(node, opts) {
- assert("ObjectMember", node, opts);
-}
-function assertProperty(node, opts) {
- assert("Property", node, opts);
-}
-function assertUnaryLike(node, opts) {
- assert("UnaryLike", node, opts);
-}
-function assertPattern(node, opts) {
- assert("Pattern", node, opts);
-}
-function assertClass(node, opts) {
- assert("Class", node, opts);
-}
-function assertImportOrExportDeclaration(node, opts) {
- assert("ImportOrExportDeclaration", node, opts);
-}
-function assertExportDeclaration(node, opts) {
- assert("ExportDeclaration", node, opts);
-}
-function assertModuleSpecifier(node, opts) {
- assert("ModuleSpecifier", node, opts);
-}
-function assertAccessor(node, opts) {
- assert("Accessor", node, opts);
-}
-function assertPrivate(node, opts) {
- assert("Private", node, opts);
-}
-function assertFlow(node, opts) {
- assert("Flow", node, opts);
-}
-function assertFlowType(node, opts) {
- assert("FlowType", node, opts);
-}
-function assertFlowBaseAnnotation(node, opts) {
- assert("FlowBaseAnnotation", node, opts);
-}
-function assertFlowDeclaration(node, opts) {
- assert("FlowDeclaration", node, opts);
-}
-function assertFlowPredicate(node, opts) {
- assert("FlowPredicate", node, opts);
-}
-function assertEnumBody(node, opts) {
- assert("EnumBody", node, opts);
-}
-function assertEnumMember(node, opts) {
- assert("EnumMember", node, opts);
-}
-function assertJSX(node, opts) {
- assert("JSX", node, opts);
-}
-function assertMiscellaneous(node, opts) {
- assert("Miscellaneous", node, opts);
-}
-function assertTypeScript(node, opts) {
- assert("TypeScript", node, opts);
-}
-function assertTSTypeElement(node, opts) {
- assert("TSTypeElement", node, opts);
-}
-function assertTSType(node, opts) {
- assert("TSType", node, opts);
-}
-function assertTSBaseType(node, opts) {
- assert("TSBaseType", node, opts);
-}
-function assertNumberLiteral(node, opts) {
- (0, _deprecationWarning.default)("assertNumberLiteral", "assertNumericLiteral");
- assert("NumberLiteral", node, opts);
-}
-function assertRegexLiteral(node, opts) {
- (0, _deprecationWarning.default)("assertRegexLiteral", "assertRegExpLiteral");
- assert("RegexLiteral", node, opts);
-}
-function assertRestProperty(node, opts) {
- (0, _deprecationWarning.default)("assertRestProperty", "assertRestElement");
- assert("RestProperty", node, opts);
-}
-function assertSpreadProperty(node, opts) {
- (0, _deprecationWarning.default)("assertSpreadProperty", "assertSpreadElement");
- assert("SpreadProperty", node, opts);
-}
-function assertModuleDeclaration(node, opts) {
- (0, _deprecationWarning.default)("assertModuleDeclaration", "assertImportOrExportDeclaration");
- assert("ModuleDeclaration", node, opts);
-}
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 5953:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = createFlowUnionType;
-var _index = __nccwpck_require__(9380);
-var _removeTypeDuplicates = __nccwpck_require__(1009);
-function createFlowUnionType(types) {
- const flattened = (0, _removeTypeDuplicates.default)(types);
- if (flattened.length === 1) {
- return flattened[0];
- } else {
- return (0, _index.unionTypeAnnotation)(flattened);
- }
-}
-
-//# sourceMappingURL=createFlowUnionType.js.map
-
-
-/***/ }),
-
-/***/ 9829:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports["default"] = void 0;
-var _index = __nccwpck_require__(9380);
-var _default = exports["default"] = createTypeAnnotationBasedOnTypeof;
-function createTypeAnnotationBasedOnTypeof(type) {
- switch (type) {
- case "string":
- return (0, _index.stringTypeAnnotation)();
- case "number":
- return (0, _index.numberTypeAnnotation)();
- case "undefined":
- return (0, _index.voidTypeAnnotation)();
- case "boolean":
- return (0, _index.booleanTypeAnnotation)();
- case "function":
- return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Function"));
- case "object":
- return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Object"));
- case "symbol":
- return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Symbol"));
- case "bigint":
- return (0, _index.anyTypeAnnotation)();
- }
- throw new Error("Invalid typeof value: " + type);
-}
-
-//# sourceMappingURL=createTypeAnnotationBasedOnTypeof.js.map
-
-
-/***/ }),
-
-/***/ 9380:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-var _lowercase = __nccwpck_require__(9130);
-Object.keys(_lowercase).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _lowercase[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _lowercase[key];
- }
- });
-});
-var _uppercase = __nccwpck_require__(8530);
-Object.keys(_uppercase).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _uppercase[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _uppercase[key];
- }
- });
-});
-
-//# sourceMappingURL=index.js.map
-
-
-/***/ }),
-
-/***/ 9130:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.anyTypeAnnotation = anyTypeAnnotation;
-exports.argumentPlaceholder = argumentPlaceholder;
-exports.arrayExpression = arrayExpression;
-exports.arrayPattern = arrayPattern;
-exports.arrayTypeAnnotation = arrayTypeAnnotation;
-exports.arrowFunctionExpression = arrowFunctionExpression;
-exports.assignmentExpression = assignmentExpression;
-exports.assignmentPattern = assignmentPattern;
-exports.awaitExpression = awaitExpression;
-exports.bigIntLiteral = bigIntLiteral;
-exports.binaryExpression = binaryExpression;
-exports.bindExpression = bindExpression;
-exports.blockStatement = blockStatement;
-exports.booleanLiteral = booleanLiteral;
-exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation;
-exports.booleanTypeAnnotation = booleanTypeAnnotation;
-exports.breakStatement = breakStatement;
-exports.callExpression = callExpression;
-exports.catchClause = catchClause;
-exports.classAccessorProperty = classAccessorProperty;
-exports.classBody = classBody;
-exports.classDeclaration = classDeclaration;
-exports.classExpression = classExpression;
-exports.classImplements = classImplements;
-exports.classMethod = classMethod;
-exports.classPrivateMethod = classPrivateMethod;
-exports.classPrivateProperty = classPrivateProperty;
-exports.classProperty = classProperty;
-exports.conditionalExpression = conditionalExpression;
-exports.continueStatement = continueStatement;
-exports.debuggerStatement = debuggerStatement;
-exports.decimalLiteral = decimalLiteral;
-exports.declareClass = declareClass;
-exports.declareExportAllDeclaration = declareExportAllDeclaration;
-exports.declareExportDeclaration = declareExportDeclaration;
-exports.declareFunction = declareFunction;
-exports.declareInterface = declareInterface;
-exports.declareModule = declareModule;
-exports.declareModuleExports = declareModuleExports;
-exports.declareOpaqueType = declareOpaqueType;
-exports.declareTypeAlias = declareTypeAlias;
-exports.declareVariable = declareVariable;
-exports.declaredPredicate = declaredPredicate;
-exports.decorator = decorator;
-exports.directive = directive;
-exports.directiveLiteral = directiveLiteral;
-exports.doExpression = doExpression;
-exports.doWhileStatement = doWhileStatement;
-exports.emptyStatement = emptyStatement;
-exports.emptyTypeAnnotation = emptyTypeAnnotation;
-exports.enumBooleanBody = enumBooleanBody;
-exports.enumBooleanMember = enumBooleanMember;
-exports.enumDeclaration = enumDeclaration;
-exports.enumDefaultedMember = enumDefaultedMember;
-exports.enumNumberBody = enumNumberBody;
-exports.enumNumberMember = enumNumberMember;
-exports.enumStringBody = enumStringBody;
-exports.enumStringMember = enumStringMember;
-exports.enumSymbolBody = enumSymbolBody;
-exports.existsTypeAnnotation = existsTypeAnnotation;
-exports.exportAllDeclaration = exportAllDeclaration;
-exports.exportDefaultDeclaration = exportDefaultDeclaration;
-exports.exportDefaultSpecifier = exportDefaultSpecifier;
-exports.exportNamedDeclaration = exportNamedDeclaration;
-exports.exportNamespaceSpecifier = exportNamespaceSpecifier;
-exports.exportSpecifier = exportSpecifier;
-exports.expressionStatement = expressionStatement;
-exports.file = file;
-exports.forInStatement = forInStatement;
-exports.forOfStatement = forOfStatement;
-exports.forStatement = forStatement;
-exports.functionDeclaration = functionDeclaration;
-exports.functionExpression = functionExpression;
-exports.functionTypeAnnotation = functionTypeAnnotation;
-exports.functionTypeParam = functionTypeParam;
-exports.genericTypeAnnotation = genericTypeAnnotation;
-exports.identifier = identifier;
-exports.ifStatement = ifStatement;
-exports["import"] = _import;
-exports.importAttribute = importAttribute;
-exports.importDeclaration = importDeclaration;
-exports.importDefaultSpecifier = importDefaultSpecifier;
-exports.importExpression = importExpression;
-exports.importNamespaceSpecifier = importNamespaceSpecifier;
-exports.importSpecifier = importSpecifier;
-exports.indexedAccessType = indexedAccessType;
-exports.inferredPredicate = inferredPredicate;
-exports.interfaceDeclaration = interfaceDeclaration;
-exports.interfaceExtends = interfaceExtends;
-exports.interfaceTypeAnnotation = interfaceTypeAnnotation;
-exports.interpreterDirective = interpreterDirective;
-exports.intersectionTypeAnnotation = intersectionTypeAnnotation;
-exports.jSXAttribute = exports.jsxAttribute = jsxAttribute;
-exports.jSXClosingElement = exports.jsxClosingElement = jsxClosingElement;
-exports.jSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment;
-exports.jSXElement = exports.jsxElement = jsxElement;
-exports.jSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression;
-exports.jSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer;
-exports.jSXFragment = exports.jsxFragment = jsxFragment;
-exports.jSXIdentifier = exports.jsxIdentifier = jsxIdentifier;
-exports.jSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression;
-exports.jSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName;
-exports.jSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement;
-exports.jSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment;
-exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute;
-exports.jSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild;
-exports.jSXText = exports.jsxText = jsxText;
-exports.labeledStatement = labeledStatement;
-exports.logicalExpression = logicalExpression;
-exports.memberExpression = memberExpression;
-exports.metaProperty = metaProperty;
-exports.mixedTypeAnnotation = mixedTypeAnnotation;
-exports.moduleExpression = moduleExpression;
-exports.newExpression = newExpression;
-exports.noop = noop;
-exports.nullLiteral = nullLiteral;
-exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation;
-exports.nullableTypeAnnotation = nullableTypeAnnotation;
-exports.numberLiteral = NumberLiteral;
-exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation;
-exports.numberTypeAnnotation = numberTypeAnnotation;
-exports.numericLiteral = numericLiteral;
-exports.objectExpression = objectExpression;
-exports.objectMethod = objectMethod;
-exports.objectPattern = objectPattern;
-exports.objectProperty = objectProperty;
-exports.objectTypeAnnotation = objectTypeAnnotation;
-exports.objectTypeCallProperty = objectTypeCallProperty;
-exports.objectTypeIndexer = objectTypeIndexer;
-exports.objectTypeInternalSlot = objectTypeInternalSlot;
-exports.objectTypeProperty = objectTypeProperty;
-exports.objectTypeSpreadProperty = objectTypeSpreadProperty;
-exports.opaqueType = opaqueType;
-exports.optionalCallExpression = optionalCallExpression;
-exports.optionalIndexedAccessType = optionalIndexedAccessType;
-exports.optionalMemberExpression = optionalMemberExpression;
-exports.parenthesizedExpression = parenthesizedExpression;
-exports.pipelineBareFunction = pipelineBareFunction;
-exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference;
-exports.pipelineTopicExpression = pipelineTopicExpression;
-exports.placeholder = placeholder;
-exports.privateName = privateName;
-exports.program = program;
-exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier;
-exports.recordExpression = recordExpression;
-exports.regExpLiteral = regExpLiteral;
-exports.regexLiteral = RegexLiteral;
-exports.restElement = restElement;
-exports.restProperty = RestProperty;
-exports.returnStatement = returnStatement;
-exports.sequenceExpression = sequenceExpression;
-exports.spreadElement = spreadElement;
-exports.spreadProperty = SpreadProperty;
-exports.staticBlock = staticBlock;
-exports.stringLiteral = stringLiteral;
-exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation;
-exports.stringTypeAnnotation = stringTypeAnnotation;
-exports["super"] = _super;
-exports.switchCase = switchCase;
-exports.switchStatement = switchStatement;
-exports.symbolTypeAnnotation = symbolTypeAnnotation;
-exports.taggedTemplateExpression = taggedTemplateExpression;
-exports.templateElement = templateElement;
-exports.templateLiteral = templateLiteral;
-exports.thisExpression = thisExpression;
-exports.thisTypeAnnotation = thisTypeAnnotation;
-exports.throwStatement = throwStatement;
-exports.topicReference = topicReference;
-exports.tryStatement = tryStatement;
-exports.tSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword;
-exports.tSArrayType = exports.tsArrayType = tsArrayType;
-exports.tSAsExpression = exports.tsAsExpression = tsAsExpression;
-exports.tSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword;
-exports.tSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword;
-exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration;
-exports.tSConditionalType = exports.tsConditionalType = tsConditionalType;
-exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration;
-exports.tSConstructorType = exports.tsConstructorType = tsConstructorType;
-exports.tSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction;
-exports.tSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod;
-exports.tSEnumBody = exports.tsEnumBody = tsEnumBody;
-exports.tSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration;
-exports.tSEnumMember = exports.tsEnumMember = tsEnumMember;
-exports.tSExportAssignment = exports.tsExportAssignment = tsExportAssignment;
-exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments;
-exports.tSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference;
-exports.tSFunctionType = exports.tsFunctionType = tsFunctionType;
-exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration;
-exports.tSImportType = exports.tsImportType = tsImportType;
-exports.tSIndexSignature = exports.tsIndexSignature = tsIndexSignature;
-exports.tSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType;
-exports.tSInferType = exports.tsInferType = tsInferType;
-exports.tSInstantiationExpression = exports.tsInstantiationExpression = tsInstantiationExpression;
-exports.tSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody;
-exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration;
-exports.tSIntersectionType = exports.tsIntersectionType = tsIntersectionType;
-exports.tSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword;
-exports.tSLiteralType = exports.tsLiteralType = tsLiteralType;
-exports.tSMappedType = exports.tsMappedType = tsMappedType;
-exports.tSMethodSignature = exports.tsMethodSignature = tsMethodSignature;
-exports.tSModuleBlock = exports.tsModuleBlock = tsModuleBlock;
-exports.tSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration;
-exports.tSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember;
-exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration;
-exports.tSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword;
-exports.tSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression;
-exports.tSNullKeyword = exports.tsNullKeyword = tsNullKeyword;
-exports.tSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword;
-exports.tSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword;
-exports.tSOptionalType = exports.tsOptionalType = tsOptionalType;
-exports.tSParameterProperty = exports.tsParameterProperty = tsParameterProperty;
-exports.tSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType;
-exports.tSPropertySignature = exports.tsPropertySignature = tsPropertySignature;
-exports.tSQualifiedName = exports.tsQualifiedName = tsQualifiedName;
-exports.tSRestType = exports.tsRestType = tsRestType;
-exports.tSSatisfiesExpression = exports.tsSatisfiesExpression = tsSatisfiesExpression;
-exports.tSStringKeyword = exports.tsStringKeyword = tsStringKeyword;
-exports.tSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword;
-exports.tSTemplateLiteralType = exports.tsTemplateLiteralType = tsTemplateLiteralType;
-exports.tSThisType = exports.tsThisType = tsThisType;
-exports.tSTupleType = exports.tsTupleType = tsTupleType;
-exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration;
-exports.tSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation;
-exports.tSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion;
-exports.tSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral;
-exports.tSTypeOperator = exports.tsTypeOperator = tsTypeOperator;
-exports.tSTypeParameter = exports.tsTypeParameter = tsTypeParameter;
-exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration;
-exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation;
-exports.tSTypePredicate = exports.tsTypePredicate = tsTypePredicate;
-exports.tSTypeQuery = exports.tsTypeQuery = tsTypeQuery;
-exports.tSTypeReference = exports.tsTypeReference = tsTypeReference;
-exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword;
-exports.tSUnionType = exports.tsUnionType = tsUnionType;
-exports.tSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword;
-exports.tSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword;
-exports.tupleExpression = tupleExpression;
-exports.tupleTypeAnnotation = tupleTypeAnnotation;
-exports.typeAlias = typeAlias;
-exports.typeAnnotation = typeAnnotation;
-exports.typeCastExpression = typeCastExpression;
-exports.typeParameter = typeParameter;
-exports.typeParameterDeclaration = typeParameterDeclaration;
-exports.typeParameterInstantiation = typeParameterInstantiation;
-exports.typeofTypeAnnotation = typeofTypeAnnotation;
-exports.unaryExpression = unaryExpression;
-exports.unionTypeAnnotation = unionTypeAnnotation;
-exports.updateExpression = updateExpression;
-exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier;
-exports.variableDeclaration = variableDeclaration;
-exports.variableDeclarator = variableDeclarator;
-exports.variance = variance;
-exports.voidTypeAnnotation = voidTypeAnnotation;
-exports.whileStatement = whileStatement;
-exports.withStatement = withStatement;
-exports.yieldExpression = yieldExpression;
-var _validate = __nccwpck_require__(8036);
-var _deprecationWarning = __nccwpck_require__(496);
-var utils = __nccwpck_require__(4106);
-const {
- validateInternal: validate
-} = _validate;
-const {
- NODE_FIELDS
-} = utils;
-function arrayExpression(elements = []) {
- const node = {
- type: "ArrayExpression",
- elements
- };
- const defs = NODE_FIELDS.ArrayExpression;
- validate(defs.elements, node, "elements", elements, 1);
- return node;
-}
-function assignmentExpression(operator, left, right) {
- const node = {
- type: "AssignmentExpression",
- operator,
- left,
- right
- };
- const defs = NODE_FIELDS.AssignmentExpression;
- validate(defs.operator, node, "operator", operator);
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function binaryExpression(operator, left, right) {
- const node = {
- type: "BinaryExpression",
- operator,
- left,
- right
- };
- const defs = NODE_FIELDS.BinaryExpression;
- validate(defs.operator, node, "operator", operator);
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function interpreterDirective(value) {
- const node = {
- type: "InterpreterDirective",
- value
- };
- const defs = NODE_FIELDS.InterpreterDirective;
- validate(defs.value, node, "value", value);
- return node;
-}
-function directive(value) {
- const node = {
- type: "Directive",
- value
- };
- const defs = NODE_FIELDS.Directive;
- validate(defs.value, node, "value", value, 1);
- return node;
-}
-function directiveLiteral(value) {
- const node = {
- type: "DirectiveLiteral",
- value
- };
- const defs = NODE_FIELDS.DirectiveLiteral;
- validate(defs.value, node, "value", value);
- return node;
-}
-function blockStatement(body, directives = []) {
- const node = {
- type: "BlockStatement",
- body,
- directives
- };
- const defs = NODE_FIELDS.BlockStatement;
- validate(defs.body, node, "body", body, 1);
- validate(defs.directives, node, "directives", directives, 1);
- return node;
-}
-function breakStatement(label = null) {
- const node = {
- type: "BreakStatement",
- label
- };
- const defs = NODE_FIELDS.BreakStatement;
- validate(defs.label, node, "label", label, 1);
- return node;
-}
-function callExpression(callee, _arguments) {
- const node = {
- type: "CallExpression",
- callee,
- arguments: _arguments
- };
- const defs = NODE_FIELDS.CallExpression;
- validate(defs.callee, node, "callee", callee, 1);
- validate(defs.arguments, node, "arguments", _arguments, 1);
- return node;
-}
-function catchClause(param = null, body) {
- const node = {
- type: "CatchClause",
- param,
- body
- };
- const defs = NODE_FIELDS.CatchClause;
- validate(defs.param, node, "param", param, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function conditionalExpression(test, consequent, alternate) {
- const node = {
- type: "ConditionalExpression",
- test,
- consequent,
- alternate
- };
- const defs = NODE_FIELDS.ConditionalExpression;
- validate(defs.test, node, "test", test, 1);
- validate(defs.consequent, node, "consequent", consequent, 1);
- validate(defs.alternate, node, "alternate", alternate, 1);
- return node;
-}
-function continueStatement(label = null) {
- const node = {
- type: "ContinueStatement",
- label
- };
- const defs = NODE_FIELDS.ContinueStatement;
- validate(defs.label, node, "label", label, 1);
- return node;
-}
-function debuggerStatement() {
- return {
- type: "DebuggerStatement"
- };
-}
-function doWhileStatement(test, body) {
- const node = {
- type: "DoWhileStatement",
- test,
- body
- };
- const defs = NODE_FIELDS.DoWhileStatement;
- validate(defs.test, node, "test", test, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function emptyStatement() {
- return {
- type: "EmptyStatement"
- };
-}
-function expressionStatement(expression) {
- const node = {
- type: "ExpressionStatement",
- expression
- };
- const defs = NODE_FIELDS.ExpressionStatement;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function file(program, comments = null, tokens = null) {
- const node = {
- type: "File",
- program,
- comments,
- tokens
- };
- const defs = NODE_FIELDS.File;
- validate(defs.program, node, "program", program, 1);
- validate(defs.comments, node, "comments", comments, 1);
- validate(defs.tokens, node, "tokens", tokens);
- return node;
-}
-function forInStatement(left, right, body) {
- const node = {
- type: "ForInStatement",
- left,
- right,
- body
- };
- const defs = NODE_FIELDS.ForInStatement;
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function forStatement(init = null, test = null, update = null, body) {
- const node = {
- type: "ForStatement",
- init,
- test,
- update,
- body
- };
- const defs = NODE_FIELDS.ForStatement;
- validate(defs.init, node, "init", init, 1);
- validate(defs.test, node, "test", test, 1);
- validate(defs.update, node, "update", update, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function functionDeclaration(id = null, params, body, generator = false, async = false) {
- const node = {
- type: "FunctionDeclaration",
- id,
- params,
- body,
- generator,
- async
- };
- const defs = NODE_FIELDS.FunctionDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.generator, node, "generator", generator);
- validate(defs.async, node, "async", async);
- return node;
-}
-function functionExpression(id = null, params, body, generator = false, async = false) {
- const node = {
- type: "FunctionExpression",
- id,
- params,
- body,
- generator,
- async
- };
- const defs = NODE_FIELDS.FunctionExpression;
- validate(defs.id, node, "id", id, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.generator, node, "generator", generator);
- validate(defs.async, node, "async", async);
- return node;
-}
-function identifier(name) {
- const node = {
- type: "Identifier",
- name
- };
- const defs = NODE_FIELDS.Identifier;
- validate(defs.name, node, "name", name);
- return node;
-}
-function ifStatement(test, consequent, alternate = null) {
- const node = {
- type: "IfStatement",
- test,
- consequent,
- alternate
- };
- const defs = NODE_FIELDS.IfStatement;
- validate(defs.test, node, "test", test, 1);
- validate(defs.consequent, node, "consequent", consequent, 1);
- validate(defs.alternate, node, "alternate", alternate, 1);
- return node;
-}
-function labeledStatement(label, body) {
- const node = {
- type: "LabeledStatement",
- label,
- body
- };
- const defs = NODE_FIELDS.LabeledStatement;
- validate(defs.label, node, "label", label, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function stringLiteral(value) {
- const node = {
- type: "StringLiteral",
- value
- };
- const defs = NODE_FIELDS.StringLiteral;
- validate(defs.value, node, "value", value);
- return node;
-}
-function numericLiteral(value) {
- const node = {
- type: "NumericLiteral",
- value
- };
- const defs = NODE_FIELDS.NumericLiteral;
- validate(defs.value, node, "value", value);
- return node;
-}
-function nullLiteral() {
- return {
- type: "NullLiteral"
- };
-}
-function booleanLiteral(value) {
- const node = {
- type: "BooleanLiteral",
- value
- };
- const defs = NODE_FIELDS.BooleanLiteral;
- validate(defs.value, node, "value", value);
- return node;
-}
-function regExpLiteral(pattern, flags = "") {
- const node = {
- type: "RegExpLiteral",
- pattern,
- flags
- };
- const defs = NODE_FIELDS.RegExpLiteral;
- validate(defs.pattern, node, "pattern", pattern);
- validate(defs.flags, node, "flags", flags);
- return node;
-}
-function logicalExpression(operator, left, right) {
- const node = {
- type: "LogicalExpression",
- operator,
- left,
- right
- };
- const defs = NODE_FIELDS.LogicalExpression;
- validate(defs.operator, node, "operator", operator);
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function memberExpression(object, property, computed = false, optional = null) {
- const node = {
- type: "MemberExpression",
- object,
- property,
- computed,
- optional
- };
- const defs = NODE_FIELDS.MemberExpression;
- validate(defs.object, node, "object", object, 1);
- validate(defs.property, node, "property", property, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.optional, node, "optional", optional);
- return node;
-}
-function newExpression(callee, _arguments) {
- const node = {
- type: "NewExpression",
- callee,
- arguments: _arguments
- };
- const defs = NODE_FIELDS.NewExpression;
- validate(defs.callee, node, "callee", callee, 1);
- validate(defs.arguments, node, "arguments", _arguments, 1);
- return node;
-}
-function program(body, directives = [], sourceType = "script", interpreter = null) {
- const node = {
- type: "Program",
- body,
- directives,
- sourceType,
- interpreter
- };
- const defs = NODE_FIELDS.Program;
- validate(defs.body, node, "body", body, 1);
- validate(defs.directives, node, "directives", directives, 1);
- validate(defs.sourceType, node, "sourceType", sourceType);
- validate(defs.interpreter, node, "interpreter", interpreter, 1);
- return node;
-}
-function objectExpression(properties) {
- const node = {
- type: "ObjectExpression",
- properties
- };
- const defs = NODE_FIELDS.ObjectExpression;
- validate(defs.properties, node, "properties", properties, 1);
- return node;
-}
-function objectMethod(kind = "method", key, params, body, computed = false, generator = false, async = false) {
- const node = {
- type: "ObjectMethod",
- kind,
- key,
- params,
- body,
- computed,
- generator,
- async
- };
- const defs = NODE_FIELDS.ObjectMethod;
- validate(defs.kind, node, "kind", kind);
- validate(defs.key, node, "key", key, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.generator, node, "generator", generator);
- validate(defs.async, node, "async", async);
- return node;
-}
-function objectProperty(key, value, computed = false, shorthand = false, decorators = null) {
- const node = {
- type: "ObjectProperty",
- key,
- value,
- computed,
- shorthand,
- decorators
- };
- const defs = NODE_FIELDS.ObjectProperty;
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.shorthand, node, "shorthand", shorthand);
- validate(defs.decorators, node, "decorators", decorators, 1);
- return node;
-}
-function restElement(argument) {
- const node = {
- type: "RestElement",
- argument
- };
- const defs = NODE_FIELDS.RestElement;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function returnStatement(argument = null) {
- const node = {
- type: "ReturnStatement",
- argument
- };
- const defs = NODE_FIELDS.ReturnStatement;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function sequenceExpression(expressions) {
- const node = {
- type: "SequenceExpression",
- expressions
- };
- const defs = NODE_FIELDS.SequenceExpression;
- validate(defs.expressions, node, "expressions", expressions, 1);
- return node;
-}
-function parenthesizedExpression(expression) {
- const node = {
- type: "ParenthesizedExpression",
- expression
- };
- const defs = NODE_FIELDS.ParenthesizedExpression;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function switchCase(test = null, consequent) {
- const node = {
- type: "SwitchCase",
- test,
- consequent
- };
- const defs = NODE_FIELDS.SwitchCase;
- validate(defs.test, node, "test", test, 1);
- validate(defs.consequent, node, "consequent", consequent, 1);
- return node;
-}
-function switchStatement(discriminant, cases) {
- const node = {
- type: "SwitchStatement",
- discriminant,
- cases
- };
- const defs = NODE_FIELDS.SwitchStatement;
- validate(defs.discriminant, node, "discriminant", discriminant, 1);
- validate(defs.cases, node, "cases", cases, 1);
- return node;
-}
-function thisExpression() {
- return {
- type: "ThisExpression"
- };
-}
-function throwStatement(argument) {
- const node = {
- type: "ThrowStatement",
- argument
- };
- const defs = NODE_FIELDS.ThrowStatement;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function tryStatement(block, handler = null, finalizer = null) {
- const node = {
- type: "TryStatement",
- block,
- handler,
- finalizer
- };
- const defs = NODE_FIELDS.TryStatement;
- validate(defs.block, node, "block", block, 1);
- validate(defs.handler, node, "handler", handler, 1);
- validate(defs.finalizer, node, "finalizer", finalizer, 1);
- return node;
-}
-function unaryExpression(operator, argument, prefix = true) {
- const node = {
- type: "UnaryExpression",
- operator,
- argument,
- prefix
- };
- const defs = NODE_FIELDS.UnaryExpression;
- validate(defs.operator, node, "operator", operator);
- validate(defs.argument, node, "argument", argument, 1);
- validate(defs.prefix, node, "prefix", prefix);
- return node;
-}
-function updateExpression(operator, argument, prefix = false) {
- const node = {
- type: "UpdateExpression",
- operator,
- argument,
- prefix
- };
- const defs = NODE_FIELDS.UpdateExpression;
- validate(defs.operator, node, "operator", operator);
- validate(defs.argument, node, "argument", argument, 1);
- validate(defs.prefix, node, "prefix", prefix);
- return node;
-}
-function variableDeclaration(kind, declarations) {
- const node = {
- type: "VariableDeclaration",
- kind,
- declarations
- };
- const defs = NODE_FIELDS.VariableDeclaration;
- validate(defs.kind, node, "kind", kind);
- validate(defs.declarations, node, "declarations", declarations, 1);
- return node;
-}
-function variableDeclarator(id, init = null) {
- const node = {
- type: "VariableDeclarator",
- id,
- init
- };
- const defs = NODE_FIELDS.VariableDeclarator;
- validate(defs.id, node, "id", id, 1);
- validate(defs.init, node, "init", init, 1);
- return node;
-}
-function whileStatement(test, body) {
- const node = {
- type: "WhileStatement",
- test,
- body
- };
- const defs = NODE_FIELDS.WhileStatement;
- validate(defs.test, node, "test", test, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function withStatement(object, body) {
- const node = {
- type: "WithStatement",
- object,
- body
- };
- const defs = NODE_FIELDS.WithStatement;
- validate(defs.object, node, "object", object, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function assignmentPattern(left, right) {
- const node = {
- type: "AssignmentPattern",
- left,
- right
- };
- const defs = NODE_FIELDS.AssignmentPattern;
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function arrayPattern(elements) {
- const node = {
- type: "ArrayPattern",
- elements
- };
- const defs = NODE_FIELDS.ArrayPattern;
- validate(defs.elements, node, "elements", elements, 1);
- return node;
-}
-function arrowFunctionExpression(params, body, async = false) {
- const node = {
- type: "ArrowFunctionExpression",
- params,
- body,
- async,
- expression: null
- };
- const defs = NODE_FIELDS.ArrowFunctionExpression;
- validate(defs.params, node, "params", params, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.async, node, "async", async);
- return node;
-}
-function classBody(body) {
- const node = {
- type: "ClassBody",
- body
- };
- const defs = NODE_FIELDS.ClassBody;
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function classExpression(id = null, superClass = null, body, decorators = null) {
- const node = {
- type: "ClassExpression",
- id,
- superClass,
- body,
- decorators
- };
- const defs = NODE_FIELDS.ClassExpression;
- validate(defs.id, node, "id", id, 1);
- validate(defs.superClass, node, "superClass", superClass, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.decorators, node, "decorators", decorators, 1);
- return node;
-}
-function classDeclaration(id = null, superClass = null, body, decorators = null) {
- const node = {
- type: "ClassDeclaration",
- id,
- superClass,
- body,
- decorators
- };
- const defs = NODE_FIELDS.ClassDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.superClass, node, "superClass", superClass, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.decorators, node, "decorators", decorators, 1);
- return node;
-}
-function exportAllDeclaration(source) {
- const node = {
- type: "ExportAllDeclaration",
- source
- };
- const defs = NODE_FIELDS.ExportAllDeclaration;
- validate(defs.source, node, "source", source, 1);
- return node;
-}
-function exportDefaultDeclaration(declaration) {
- const node = {
- type: "ExportDefaultDeclaration",
- declaration
- };
- const defs = NODE_FIELDS.ExportDefaultDeclaration;
- validate(defs.declaration, node, "declaration", declaration, 1);
- return node;
-}
-function exportNamedDeclaration(declaration = null, specifiers = [], source = null) {
- const node = {
- type: "ExportNamedDeclaration",
- declaration,
- specifiers,
- source
- };
- const defs = NODE_FIELDS.ExportNamedDeclaration;
- validate(defs.declaration, node, "declaration", declaration, 1);
- validate(defs.specifiers, node, "specifiers", specifiers, 1);
- validate(defs.source, node, "source", source, 1);
- return node;
-}
-function exportSpecifier(local, exported) {
- const node = {
- type: "ExportSpecifier",
- local,
- exported
- };
- const defs = NODE_FIELDS.ExportSpecifier;
- validate(defs.local, node, "local", local, 1);
- validate(defs.exported, node, "exported", exported, 1);
- return node;
-}
-function forOfStatement(left, right, body, _await = false) {
- const node = {
- type: "ForOfStatement",
- left,
- right,
- body,
- await: _await
- };
- const defs = NODE_FIELDS.ForOfStatement;
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.await, node, "await", _await);
- return node;
-}
-function importDeclaration(specifiers, source) {
- const node = {
- type: "ImportDeclaration",
- specifiers,
- source
- };
- const defs = NODE_FIELDS.ImportDeclaration;
- validate(defs.specifiers, node, "specifiers", specifiers, 1);
- validate(defs.source, node, "source", source, 1);
- return node;
-}
-function importDefaultSpecifier(local) {
- const node = {
- type: "ImportDefaultSpecifier",
- local
- };
- const defs = NODE_FIELDS.ImportDefaultSpecifier;
- validate(defs.local, node, "local", local, 1);
- return node;
-}
-function importNamespaceSpecifier(local) {
- const node = {
- type: "ImportNamespaceSpecifier",
- local
- };
- const defs = NODE_FIELDS.ImportNamespaceSpecifier;
- validate(defs.local, node, "local", local, 1);
- return node;
-}
-function importSpecifier(local, imported) {
- const node = {
- type: "ImportSpecifier",
- local,
- imported
- };
- const defs = NODE_FIELDS.ImportSpecifier;
- validate(defs.local, node, "local", local, 1);
- validate(defs.imported, node, "imported", imported, 1);
- return node;
-}
-function importExpression(source, options = null) {
- const node = {
- type: "ImportExpression",
- source,
- options
- };
- const defs = NODE_FIELDS.ImportExpression;
- validate(defs.source, node, "source", source, 1);
- validate(defs.options, node, "options", options, 1);
- return node;
-}
-function metaProperty(meta, property) {
- const node = {
- type: "MetaProperty",
- meta,
- property
- };
- const defs = NODE_FIELDS.MetaProperty;
- validate(defs.meta, node, "meta", meta, 1);
- validate(defs.property, node, "property", property, 1);
- return node;
-}
-function classMethod(kind = "method", key, params, body, computed = false, _static = false, generator = false, async = false) {
- const node = {
- type: "ClassMethod",
- kind,
- key,
- params,
- body,
- computed,
- static: _static,
- generator,
- async
- };
- const defs = NODE_FIELDS.ClassMethod;
- validate(defs.kind, node, "kind", kind);
- validate(defs.key, node, "key", key, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.static, node, "static", _static);
- validate(defs.generator, node, "generator", generator);
- validate(defs.async, node, "async", async);
- return node;
-}
-function objectPattern(properties) {
- const node = {
- type: "ObjectPattern",
- properties
- };
- const defs = NODE_FIELDS.ObjectPattern;
- validate(defs.properties, node, "properties", properties, 1);
- return node;
-}
-function spreadElement(argument) {
- const node = {
- type: "SpreadElement",
- argument
- };
- const defs = NODE_FIELDS.SpreadElement;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function _super() {
- return {
- type: "Super"
- };
-}
-function taggedTemplateExpression(tag, quasi) {
- const node = {
- type: "TaggedTemplateExpression",
- tag,
- quasi
- };
- const defs = NODE_FIELDS.TaggedTemplateExpression;
- validate(defs.tag, node, "tag", tag, 1);
- validate(defs.quasi, node, "quasi", quasi, 1);
- return node;
-}
-function templateElement(value, tail = false) {
- const node = {
- type: "TemplateElement",
- value,
- tail
- };
- const defs = NODE_FIELDS.TemplateElement;
- validate(defs.value, node, "value", value);
- validate(defs.tail, node, "tail", tail);
- return node;
-}
-function templateLiteral(quasis, expressions) {
- const node = {
- type: "TemplateLiteral",
- quasis,
- expressions
- };
- const defs = NODE_FIELDS.TemplateLiteral;
- validate(defs.quasis, node, "quasis", quasis, 1);
- validate(defs.expressions, node, "expressions", expressions, 1);
- return node;
-}
-function yieldExpression(argument = null, delegate = false) {
- const node = {
- type: "YieldExpression",
- argument,
- delegate
- };
- const defs = NODE_FIELDS.YieldExpression;
- validate(defs.argument, node, "argument", argument, 1);
- validate(defs.delegate, node, "delegate", delegate);
- return node;
-}
-function awaitExpression(argument) {
- const node = {
- type: "AwaitExpression",
- argument
- };
- const defs = NODE_FIELDS.AwaitExpression;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function _import() {
- return {
- type: "Import"
- };
-}
-function bigIntLiteral(value) {
- const node = {
- type: "BigIntLiteral",
- value
- };
- const defs = NODE_FIELDS.BigIntLiteral;
- validate(defs.value, node, "value", value);
- return node;
-}
-function exportNamespaceSpecifier(exported) {
- const node = {
- type: "ExportNamespaceSpecifier",
- exported
- };
- const defs = NODE_FIELDS.ExportNamespaceSpecifier;
- validate(defs.exported, node, "exported", exported, 1);
- return node;
-}
-function optionalMemberExpression(object, property, computed = false, optional) {
- const node = {
- type: "OptionalMemberExpression",
- object,
- property,
- computed,
- optional
- };
- const defs = NODE_FIELDS.OptionalMemberExpression;
- validate(defs.object, node, "object", object, 1);
- validate(defs.property, node, "property", property, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.optional, node, "optional", optional);
- return node;
-}
-function optionalCallExpression(callee, _arguments, optional) {
- const node = {
- type: "OptionalCallExpression",
- callee,
- arguments: _arguments,
- optional
- };
- const defs = NODE_FIELDS.OptionalCallExpression;
- validate(defs.callee, node, "callee", callee, 1);
- validate(defs.arguments, node, "arguments", _arguments, 1);
- validate(defs.optional, node, "optional", optional);
- return node;
-}
-function classProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) {
- const node = {
- type: "ClassProperty",
- key,
- value,
- typeAnnotation,
- decorators,
- computed,
- static: _static
- };
- const defs = NODE_FIELDS.ClassProperty;
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- validate(defs.decorators, node, "decorators", decorators, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.static, node, "static", _static);
- return node;
-}
-function classAccessorProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) {
- const node = {
- type: "ClassAccessorProperty",
- key,
- value,
- typeAnnotation,
- decorators,
- computed,
- static: _static
- };
- const defs = NODE_FIELDS.ClassAccessorProperty;
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- validate(defs.decorators, node, "decorators", decorators, 1);
- validate(defs.computed, node, "computed", computed);
- validate(defs.static, node, "static", _static);
- return node;
-}
-function classPrivateProperty(key, value = null, decorators = null, _static = false) {
- const node = {
- type: "ClassPrivateProperty",
- key,
- value,
- decorators,
- static: _static
- };
- const defs = NODE_FIELDS.ClassPrivateProperty;
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.decorators, node, "decorators", decorators, 1);
- validate(defs.static, node, "static", _static);
- return node;
-}
-function classPrivateMethod(kind = "method", key, params, body, _static = false) {
- const node = {
- type: "ClassPrivateMethod",
- kind,
- key,
- params,
- body,
- static: _static
- };
- const defs = NODE_FIELDS.ClassPrivateMethod;
- validate(defs.kind, node, "kind", kind);
- validate(defs.key, node, "key", key, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.static, node, "static", _static);
- return node;
-}
-function privateName(id) {
- const node = {
- type: "PrivateName",
- id
- };
- const defs = NODE_FIELDS.PrivateName;
- validate(defs.id, node, "id", id, 1);
- return node;
-}
-function staticBlock(body) {
- const node = {
- type: "StaticBlock",
- body
- };
- const defs = NODE_FIELDS.StaticBlock;
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function importAttribute(key, value) {
- const node = {
- type: "ImportAttribute",
- key,
- value
- };
- const defs = NODE_FIELDS.ImportAttribute;
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- return node;
-}
-function anyTypeAnnotation() {
- return {
- type: "AnyTypeAnnotation"
- };
-}
-function arrayTypeAnnotation(elementType) {
- const node = {
- type: "ArrayTypeAnnotation",
- elementType
- };
- const defs = NODE_FIELDS.ArrayTypeAnnotation;
- validate(defs.elementType, node, "elementType", elementType, 1);
- return node;
-}
-function booleanTypeAnnotation() {
- return {
- type: "BooleanTypeAnnotation"
- };
-}
-function booleanLiteralTypeAnnotation(value) {
- const node = {
- type: "BooleanLiteralTypeAnnotation",
- value
- };
- const defs = NODE_FIELDS.BooleanLiteralTypeAnnotation;
- validate(defs.value, node, "value", value);
- return node;
-}
-function nullLiteralTypeAnnotation() {
- return {
- type: "NullLiteralTypeAnnotation"
- };
-}
-function classImplements(id, typeParameters = null) {
- const node = {
- type: "ClassImplements",
- id,
- typeParameters
- };
- const defs = NODE_FIELDS.ClassImplements;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function declareClass(id, typeParameters = null, _extends = null, body) {
- const node = {
- type: "DeclareClass",
- id,
- typeParameters,
- extends: _extends,
- body
- };
- const defs = NODE_FIELDS.DeclareClass;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.extends, node, "extends", _extends, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function declareFunction(id) {
- const node = {
- type: "DeclareFunction",
- id
- };
- const defs = NODE_FIELDS.DeclareFunction;
- validate(defs.id, node, "id", id, 1);
- return node;
-}
-function declareInterface(id, typeParameters = null, _extends = null, body) {
- const node = {
- type: "DeclareInterface",
- id,
- typeParameters,
- extends: _extends,
- body
- };
- const defs = NODE_FIELDS.DeclareInterface;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.extends, node, "extends", _extends, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function declareModule(id, body, kind = null) {
- const node = {
- type: "DeclareModule",
- id,
- body,
- kind
- };
- const defs = NODE_FIELDS.DeclareModule;
- validate(defs.id, node, "id", id, 1);
- validate(defs.body, node, "body", body, 1);
- validate(defs.kind, node, "kind", kind);
- return node;
-}
-function declareModuleExports(typeAnnotation) {
- const node = {
- type: "DeclareModuleExports",
- typeAnnotation
- };
- const defs = NODE_FIELDS.DeclareModuleExports;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function declareTypeAlias(id, typeParameters = null, right) {
- const node = {
- type: "DeclareTypeAlias",
- id,
- typeParameters,
- right
- };
- const defs = NODE_FIELDS.DeclareTypeAlias;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function declareOpaqueType(id, typeParameters = null, supertype = null) {
- const node = {
- type: "DeclareOpaqueType",
- id,
- typeParameters,
- supertype
- };
- const defs = NODE_FIELDS.DeclareOpaqueType;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.supertype, node, "supertype", supertype, 1);
- return node;
-}
-function declareVariable(id) {
- const node = {
- type: "DeclareVariable",
- id
- };
- const defs = NODE_FIELDS.DeclareVariable;
- validate(defs.id, node, "id", id, 1);
- return node;
-}
-function declareExportDeclaration(declaration = null, specifiers = null, source = null, attributes = null) {
- const node = {
- type: "DeclareExportDeclaration",
- declaration,
- specifiers,
- source,
- attributes
- };
- const defs = NODE_FIELDS.DeclareExportDeclaration;
- validate(defs.declaration, node, "declaration", declaration, 1);
- validate(defs.specifiers, node, "specifiers", specifiers, 1);
- validate(defs.source, node, "source", source, 1);
- validate(defs.attributes, node, "attributes", attributes, 1);
- return node;
-}
-function declareExportAllDeclaration(source, attributes = null) {
- const node = {
- type: "DeclareExportAllDeclaration",
- source,
- attributes
- };
- const defs = NODE_FIELDS.DeclareExportAllDeclaration;
- validate(defs.source, node, "source", source, 1);
- validate(defs.attributes, node, "attributes", attributes, 1);
- return node;
-}
-function declaredPredicate(value) {
- const node = {
- type: "DeclaredPredicate",
- value
- };
- const defs = NODE_FIELDS.DeclaredPredicate;
- validate(defs.value, node, "value", value, 1);
- return node;
-}
-function existsTypeAnnotation() {
- return {
- type: "ExistsTypeAnnotation"
- };
-}
-function functionTypeAnnotation(typeParameters = null, params, rest = null, returnType) {
- const node = {
- type: "FunctionTypeAnnotation",
- typeParameters,
- params,
- rest,
- returnType
- };
- const defs = NODE_FIELDS.FunctionTypeAnnotation;
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.rest, node, "rest", rest, 1);
- validate(defs.returnType, node, "returnType", returnType, 1);
- return node;
-}
-function functionTypeParam(name = null, typeAnnotation) {
- const node = {
- type: "FunctionTypeParam",
- name,
- typeAnnotation
- };
- const defs = NODE_FIELDS.FunctionTypeParam;
- validate(defs.name, node, "name", name, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function genericTypeAnnotation(id, typeParameters = null) {
- const node = {
- type: "GenericTypeAnnotation",
- id,
- typeParameters
- };
- const defs = NODE_FIELDS.GenericTypeAnnotation;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function inferredPredicate() {
- return {
- type: "InferredPredicate"
- };
-}
-function interfaceExtends(id, typeParameters = null) {
- const node = {
- type: "InterfaceExtends",
- id,
- typeParameters
- };
- const defs = NODE_FIELDS.InterfaceExtends;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function interfaceDeclaration(id, typeParameters = null, _extends = null, body) {
- const node = {
- type: "InterfaceDeclaration",
- id,
- typeParameters,
- extends: _extends,
- body
- };
- const defs = NODE_FIELDS.InterfaceDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.extends, node, "extends", _extends, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function interfaceTypeAnnotation(_extends = null, body) {
- const node = {
- type: "InterfaceTypeAnnotation",
- extends: _extends,
- body
- };
- const defs = NODE_FIELDS.InterfaceTypeAnnotation;
- validate(defs.extends, node, "extends", _extends, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function intersectionTypeAnnotation(types) {
- const node = {
- type: "IntersectionTypeAnnotation",
- types
- };
- const defs = NODE_FIELDS.IntersectionTypeAnnotation;
- validate(defs.types, node, "types", types, 1);
- return node;
-}
-function mixedTypeAnnotation() {
- return {
- type: "MixedTypeAnnotation"
- };
-}
-function emptyTypeAnnotation() {
- return {
- type: "EmptyTypeAnnotation"
- };
-}
-function nullableTypeAnnotation(typeAnnotation) {
- const node = {
- type: "NullableTypeAnnotation",
- typeAnnotation
- };
- const defs = NODE_FIELDS.NullableTypeAnnotation;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function numberLiteralTypeAnnotation(value) {
- const node = {
- type: "NumberLiteralTypeAnnotation",
- value
- };
- const defs = NODE_FIELDS.NumberLiteralTypeAnnotation;
- validate(defs.value, node, "value", value);
- return node;
-}
-function numberTypeAnnotation() {
- return {
- type: "NumberTypeAnnotation"
- };
-}
-function objectTypeAnnotation(properties, indexers = [], callProperties = [], internalSlots = [], exact = false) {
- const node = {
- type: "ObjectTypeAnnotation",
- properties,
- indexers,
- callProperties,
- internalSlots,
- exact
- };
- const defs = NODE_FIELDS.ObjectTypeAnnotation;
- validate(defs.properties, node, "properties", properties, 1);
- validate(defs.indexers, node, "indexers", indexers, 1);
- validate(defs.callProperties, node, "callProperties", callProperties, 1);
- validate(defs.internalSlots, node, "internalSlots", internalSlots, 1);
- validate(defs.exact, node, "exact", exact);
- return node;
-}
-function objectTypeInternalSlot(id, value, optional, _static, method) {
- const node = {
- type: "ObjectTypeInternalSlot",
- id,
- value,
- optional,
- static: _static,
- method
- };
- const defs = NODE_FIELDS.ObjectTypeInternalSlot;
- validate(defs.id, node, "id", id, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.optional, node, "optional", optional);
- validate(defs.static, node, "static", _static);
- validate(defs.method, node, "method", method);
- return node;
-}
-function objectTypeCallProperty(value) {
- const node = {
- type: "ObjectTypeCallProperty",
- value,
- static: null
- };
- const defs = NODE_FIELDS.ObjectTypeCallProperty;
- validate(defs.value, node, "value", value, 1);
- return node;
-}
-function objectTypeIndexer(id = null, key, value, variance = null) {
- const node = {
- type: "ObjectTypeIndexer",
- id,
- key,
- value,
- variance,
- static: null
- };
- const defs = NODE_FIELDS.ObjectTypeIndexer;
- validate(defs.id, node, "id", id, 1);
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.variance, node, "variance", variance, 1);
- return node;
-}
-function objectTypeProperty(key, value, variance = null) {
- const node = {
- type: "ObjectTypeProperty",
- key,
- value,
- variance,
- kind: null,
- method: null,
- optional: null,
- proto: null,
- static: null
- };
- const defs = NODE_FIELDS.ObjectTypeProperty;
- validate(defs.key, node, "key", key, 1);
- validate(defs.value, node, "value", value, 1);
- validate(defs.variance, node, "variance", variance, 1);
- return node;
-}
-function objectTypeSpreadProperty(argument) {
- const node = {
- type: "ObjectTypeSpreadProperty",
- argument
- };
- const defs = NODE_FIELDS.ObjectTypeSpreadProperty;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function opaqueType(id, typeParameters = null, supertype = null, impltype) {
- const node = {
- type: "OpaqueType",
- id,
- typeParameters,
- supertype,
- impltype
- };
- const defs = NODE_FIELDS.OpaqueType;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.supertype, node, "supertype", supertype, 1);
- validate(defs.impltype, node, "impltype", impltype, 1);
- return node;
-}
-function qualifiedTypeIdentifier(id, qualification) {
- const node = {
- type: "QualifiedTypeIdentifier",
- id,
- qualification
- };
- const defs = NODE_FIELDS.QualifiedTypeIdentifier;
- validate(defs.id, node, "id", id, 1);
- validate(defs.qualification, node, "qualification", qualification, 1);
- return node;
-}
-function stringLiteralTypeAnnotation(value) {
- const node = {
- type: "StringLiteralTypeAnnotation",
- value
- };
- const defs = NODE_FIELDS.StringLiteralTypeAnnotation;
- validate(defs.value, node, "value", value);
- return node;
-}
-function stringTypeAnnotation() {
- return {
- type: "StringTypeAnnotation"
- };
-}
-function symbolTypeAnnotation() {
- return {
- type: "SymbolTypeAnnotation"
- };
-}
-function thisTypeAnnotation() {
- return {
- type: "ThisTypeAnnotation"
- };
-}
-function tupleTypeAnnotation(types) {
- const node = {
- type: "TupleTypeAnnotation",
- types
- };
- const defs = NODE_FIELDS.TupleTypeAnnotation;
- validate(defs.types, node, "types", types, 1);
- return node;
-}
-function typeofTypeAnnotation(argument) {
- const node = {
- type: "TypeofTypeAnnotation",
- argument
- };
- const defs = NODE_FIELDS.TypeofTypeAnnotation;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function typeAlias(id, typeParameters = null, right) {
- const node = {
- type: "TypeAlias",
- id,
- typeParameters,
- right
- };
- const defs = NODE_FIELDS.TypeAlias;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function typeAnnotation(typeAnnotation) {
- const node = {
- type: "TypeAnnotation",
- typeAnnotation
- };
- const defs = NODE_FIELDS.TypeAnnotation;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function typeCastExpression(expression, typeAnnotation) {
- const node = {
- type: "TypeCastExpression",
- expression,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TypeCastExpression;
- validate(defs.expression, node, "expression", expression, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function typeParameter(bound = null, _default = null, variance = null) {
- const node = {
- type: "TypeParameter",
- bound,
- default: _default,
- variance,
- name: null
- };
- const defs = NODE_FIELDS.TypeParameter;
- validate(defs.bound, node, "bound", bound, 1);
- validate(defs.default, node, "default", _default, 1);
- validate(defs.variance, node, "variance", variance, 1);
- return node;
-}
-function typeParameterDeclaration(params) {
- const node = {
- type: "TypeParameterDeclaration",
- params
- };
- const defs = NODE_FIELDS.TypeParameterDeclaration;
- validate(defs.params, node, "params", params, 1);
- return node;
-}
-function typeParameterInstantiation(params) {
- const node = {
- type: "TypeParameterInstantiation",
- params
- };
- const defs = NODE_FIELDS.TypeParameterInstantiation;
- validate(defs.params, node, "params", params, 1);
- return node;
-}
-function unionTypeAnnotation(types) {
- const node = {
- type: "UnionTypeAnnotation",
- types
- };
- const defs = NODE_FIELDS.UnionTypeAnnotation;
- validate(defs.types, node, "types", types, 1);
- return node;
-}
-function variance(kind) {
- const node = {
- type: "Variance",
- kind
- };
- const defs = NODE_FIELDS.Variance;
- validate(defs.kind, node, "kind", kind);
- return node;
-}
-function voidTypeAnnotation() {
- return {
- type: "VoidTypeAnnotation"
- };
-}
-function enumDeclaration(id, body) {
- const node = {
- type: "EnumDeclaration",
- id,
- body
- };
- const defs = NODE_FIELDS.EnumDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function enumBooleanBody(members) {
- const node = {
- type: "EnumBooleanBody",
- members,
- explicitType: null,
- hasUnknownMembers: null
- };
- const defs = NODE_FIELDS.EnumBooleanBody;
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function enumNumberBody(members) {
- const node = {
- type: "EnumNumberBody",
- members,
- explicitType: null,
- hasUnknownMembers: null
- };
- const defs = NODE_FIELDS.EnumNumberBody;
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function enumStringBody(members) {
- const node = {
- type: "EnumStringBody",
- members,
- explicitType: null,
- hasUnknownMembers: null
- };
- const defs = NODE_FIELDS.EnumStringBody;
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function enumSymbolBody(members) {
- const node = {
- type: "EnumSymbolBody",
- members,
- hasUnknownMembers: null
- };
- const defs = NODE_FIELDS.EnumSymbolBody;
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function enumBooleanMember(id) {
- const node = {
- type: "EnumBooleanMember",
- id,
- init: null
- };
- const defs = NODE_FIELDS.EnumBooleanMember;
- validate(defs.id, node, "id", id, 1);
- return node;
-}
-function enumNumberMember(id, init) {
- const node = {
- type: "EnumNumberMember",
- id,
- init
- };
- const defs = NODE_FIELDS.EnumNumberMember;
- validate(defs.id, node, "id", id, 1);
- validate(defs.init, node, "init", init, 1);
- return node;
-}
-function enumStringMember(id, init) {
- const node = {
- type: "EnumStringMember",
- id,
- init
- };
- const defs = NODE_FIELDS.EnumStringMember;
- validate(defs.id, node, "id", id, 1);
- validate(defs.init, node, "init", init, 1);
- return node;
-}
-function enumDefaultedMember(id) {
- const node = {
- type: "EnumDefaultedMember",
- id
- };
- const defs = NODE_FIELDS.EnumDefaultedMember;
- validate(defs.id, node, "id", id, 1);
- return node;
-}
-function indexedAccessType(objectType, indexType) {
- const node = {
- type: "IndexedAccessType",
- objectType,
- indexType
- };
- const defs = NODE_FIELDS.IndexedAccessType;
- validate(defs.objectType, node, "objectType", objectType, 1);
- validate(defs.indexType, node, "indexType", indexType, 1);
- return node;
-}
-function optionalIndexedAccessType(objectType, indexType) {
- const node = {
- type: "OptionalIndexedAccessType",
- objectType,
- indexType,
- optional: null
- };
- const defs = NODE_FIELDS.OptionalIndexedAccessType;
- validate(defs.objectType, node, "objectType", objectType, 1);
- validate(defs.indexType, node, "indexType", indexType, 1);
- return node;
-}
-function jsxAttribute(name, value = null) {
- const node = {
- type: "JSXAttribute",
- name,
- value
- };
- const defs = NODE_FIELDS.JSXAttribute;
- validate(defs.name, node, "name", name, 1);
- validate(defs.value, node, "value", value, 1);
- return node;
-}
-function jsxClosingElement(name) {
- const node = {
- type: "JSXClosingElement",
- name
- };
- const defs = NODE_FIELDS.JSXClosingElement;
- validate(defs.name, node, "name", name, 1);
- return node;
-}
-function jsxElement(openingElement, closingElement = null, children, selfClosing = null) {
- const node = {
- type: "JSXElement",
- openingElement,
- closingElement,
- children,
- selfClosing
- };
- const defs = NODE_FIELDS.JSXElement;
- validate(defs.openingElement, node, "openingElement", openingElement, 1);
- validate(defs.closingElement, node, "closingElement", closingElement, 1);
- validate(defs.children, node, "children", children, 1);
- validate(defs.selfClosing, node, "selfClosing", selfClosing);
- return node;
-}
-function jsxEmptyExpression() {
- return {
- type: "JSXEmptyExpression"
- };
-}
-function jsxExpressionContainer(expression) {
- const node = {
- type: "JSXExpressionContainer",
- expression
- };
- const defs = NODE_FIELDS.JSXExpressionContainer;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function jsxSpreadChild(expression) {
- const node = {
- type: "JSXSpreadChild",
- expression
- };
- const defs = NODE_FIELDS.JSXSpreadChild;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function jsxIdentifier(name) {
- const node = {
- type: "JSXIdentifier",
- name
- };
- const defs = NODE_FIELDS.JSXIdentifier;
- validate(defs.name, node, "name", name);
- return node;
-}
-function jsxMemberExpression(object, property) {
- const node = {
- type: "JSXMemberExpression",
- object,
- property
- };
- const defs = NODE_FIELDS.JSXMemberExpression;
- validate(defs.object, node, "object", object, 1);
- validate(defs.property, node, "property", property, 1);
- return node;
-}
-function jsxNamespacedName(namespace, name) {
- const node = {
- type: "JSXNamespacedName",
- namespace,
- name
- };
- const defs = NODE_FIELDS.JSXNamespacedName;
- validate(defs.namespace, node, "namespace", namespace, 1);
- validate(defs.name, node, "name", name, 1);
- return node;
-}
-function jsxOpeningElement(name, attributes, selfClosing = false) {
- const node = {
- type: "JSXOpeningElement",
- name,
- attributes,
- selfClosing
- };
- const defs = NODE_FIELDS.JSXOpeningElement;
- validate(defs.name, node, "name", name, 1);
- validate(defs.attributes, node, "attributes", attributes, 1);
- validate(defs.selfClosing, node, "selfClosing", selfClosing);
- return node;
-}
-function jsxSpreadAttribute(argument) {
- const node = {
- type: "JSXSpreadAttribute",
- argument
- };
- const defs = NODE_FIELDS.JSXSpreadAttribute;
- validate(defs.argument, node, "argument", argument, 1);
- return node;
-}
-function jsxText(value) {
- const node = {
- type: "JSXText",
- value
- };
- const defs = NODE_FIELDS.JSXText;
- validate(defs.value, node, "value", value);
- return node;
-}
-function jsxFragment(openingFragment, closingFragment, children) {
- const node = {
- type: "JSXFragment",
- openingFragment,
- closingFragment,
- children
- };
- const defs = NODE_FIELDS.JSXFragment;
- validate(defs.openingFragment, node, "openingFragment", openingFragment, 1);
- validate(defs.closingFragment, node, "closingFragment", closingFragment, 1);
- validate(defs.children, node, "children", children, 1);
- return node;
-}
-function jsxOpeningFragment() {
- return {
- type: "JSXOpeningFragment"
- };
-}
-function jsxClosingFragment() {
- return {
- type: "JSXClosingFragment"
- };
-}
-function noop() {
- return {
- type: "Noop"
- };
-}
-function placeholder(expectedNode, name) {
- const node = {
- type: "Placeholder",
- expectedNode,
- name
- };
- const defs = NODE_FIELDS.Placeholder;
- validate(defs.expectedNode, node, "expectedNode", expectedNode);
- validate(defs.name, node, "name", name, 1);
- return node;
-}
-function v8IntrinsicIdentifier(name) {
- const node = {
- type: "V8IntrinsicIdentifier",
- name
- };
- const defs = NODE_FIELDS.V8IntrinsicIdentifier;
- validate(defs.name, node, "name", name);
- return node;
-}
-function argumentPlaceholder() {
- return {
- type: "ArgumentPlaceholder"
- };
-}
-function bindExpression(object, callee) {
- const node = {
- type: "BindExpression",
- object,
- callee
- };
- const defs = NODE_FIELDS.BindExpression;
- validate(defs.object, node, "object", object, 1);
- validate(defs.callee, node, "callee", callee, 1);
- return node;
-}
-function decorator(expression) {
- const node = {
- type: "Decorator",
- expression
- };
- const defs = NODE_FIELDS.Decorator;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function doExpression(body, async = false) {
- const node = {
- type: "DoExpression",
- body,
- async
- };
- const defs = NODE_FIELDS.DoExpression;
- validate(defs.body, node, "body", body, 1);
- validate(defs.async, node, "async", async);
- return node;
-}
-function exportDefaultSpecifier(exported) {
- const node = {
- type: "ExportDefaultSpecifier",
- exported
- };
- const defs = NODE_FIELDS.ExportDefaultSpecifier;
- validate(defs.exported, node, "exported", exported, 1);
- return node;
-}
-function recordExpression(properties) {
- const node = {
- type: "RecordExpression",
- properties
- };
- const defs = NODE_FIELDS.RecordExpression;
- validate(defs.properties, node, "properties", properties, 1);
- return node;
-}
-function tupleExpression(elements = []) {
- const node = {
- type: "TupleExpression",
- elements
- };
- const defs = NODE_FIELDS.TupleExpression;
- validate(defs.elements, node, "elements", elements, 1);
- return node;
-}
-function decimalLiteral(value) {
- const node = {
- type: "DecimalLiteral",
- value
- };
- const defs = NODE_FIELDS.DecimalLiteral;
- validate(defs.value, node, "value", value);
- return node;
-}
-function moduleExpression(body) {
- const node = {
- type: "ModuleExpression",
- body
- };
- const defs = NODE_FIELDS.ModuleExpression;
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function topicReference() {
- return {
- type: "TopicReference"
- };
-}
-function pipelineTopicExpression(expression) {
- const node = {
- type: "PipelineTopicExpression",
- expression
- };
- const defs = NODE_FIELDS.PipelineTopicExpression;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function pipelineBareFunction(callee) {
- const node = {
- type: "PipelineBareFunction",
- callee
- };
- const defs = NODE_FIELDS.PipelineBareFunction;
- validate(defs.callee, node, "callee", callee, 1);
- return node;
-}
-function pipelinePrimaryTopicReference() {
- return {
- type: "PipelinePrimaryTopicReference"
- };
-}
-function tsParameterProperty(parameter) {
- const node = {
- type: "TSParameterProperty",
- parameter
- };
- const defs = NODE_FIELDS.TSParameterProperty;
- validate(defs.parameter, node, "parameter", parameter, 1);
- return node;
-}
-function tsDeclareFunction(id = null, typeParameters = null, params, returnType = null) {
- const node = {
- type: "TSDeclareFunction",
- id,
- typeParameters,
- params,
- returnType
- };
- const defs = NODE_FIELDS.TSDeclareFunction;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.returnType, node, "returnType", returnType, 1);
- return node;
-}
-function tsDeclareMethod(decorators = null, key, typeParameters = null, params, returnType = null) {
- const node = {
- type: "TSDeclareMethod",
- decorators,
- key,
- typeParameters,
- params,
- returnType
- };
- const defs = NODE_FIELDS.TSDeclareMethod;
- validate(defs.decorators, node, "decorators", decorators, 1);
- validate(defs.key, node, "key", key, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.params, node, "params", params, 1);
- validate(defs.returnType, node, "returnType", returnType, 1);
- return node;
-}
-function tsQualifiedName(left, right) {
- const node = {
- type: "TSQualifiedName",
- left,
- right
- };
- const defs = NODE_FIELDS.TSQualifiedName;
- validate(defs.left, node, "left", left, 1);
- validate(defs.right, node, "right", right, 1);
- return node;
-}
-function tsCallSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) {
- const node = {
- type: "TSCallSignatureDeclaration",
- typeParameters,
- parameters,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSCallSignatureDeclaration;
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.parameters, node, "parameters", parameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsConstructSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) {
- const node = {
- type: "TSConstructSignatureDeclaration",
- typeParameters,
- parameters,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSConstructSignatureDeclaration;
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.parameters, node, "parameters", parameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsPropertySignature(key, typeAnnotation = null) {
- const node = {
- type: "TSPropertySignature",
- key,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSPropertySignature;
- validate(defs.key, node, "key", key, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsMethodSignature(key, typeParameters = null, parameters, typeAnnotation = null) {
- const node = {
- type: "TSMethodSignature",
- key,
- typeParameters,
- parameters,
- typeAnnotation,
- kind: null
- };
- const defs = NODE_FIELDS.TSMethodSignature;
- validate(defs.key, node, "key", key, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.parameters, node, "parameters", parameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsIndexSignature(parameters, typeAnnotation = null) {
- const node = {
- type: "TSIndexSignature",
- parameters,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSIndexSignature;
- validate(defs.parameters, node, "parameters", parameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsAnyKeyword() {
- return {
- type: "TSAnyKeyword"
- };
-}
-function tsBooleanKeyword() {
- return {
- type: "TSBooleanKeyword"
- };
-}
-function tsBigIntKeyword() {
- return {
- type: "TSBigIntKeyword"
- };
-}
-function tsIntrinsicKeyword() {
- return {
- type: "TSIntrinsicKeyword"
- };
-}
-function tsNeverKeyword() {
- return {
- type: "TSNeverKeyword"
- };
-}
-function tsNullKeyword() {
- return {
- type: "TSNullKeyword"
- };
-}
-function tsNumberKeyword() {
- return {
- type: "TSNumberKeyword"
- };
-}
-function tsObjectKeyword() {
- return {
- type: "TSObjectKeyword"
- };
-}
-function tsStringKeyword() {
- return {
- type: "TSStringKeyword"
- };
-}
-function tsSymbolKeyword() {
- return {
- type: "TSSymbolKeyword"
- };
-}
-function tsUndefinedKeyword() {
- return {
- type: "TSUndefinedKeyword"
- };
-}
-function tsUnknownKeyword() {
- return {
- type: "TSUnknownKeyword"
- };
-}
-function tsVoidKeyword() {
- return {
- type: "TSVoidKeyword"
- };
-}
-function tsThisType() {
- return {
- type: "TSThisType"
- };
-}
-function tsFunctionType(typeParameters = null, parameters, typeAnnotation = null) {
- const node = {
- type: "TSFunctionType",
- typeParameters,
- parameters,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSFunctionType;
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.parameters, node, "parameters", parameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsConstructorType(typeParameters = null, parameters, typeAnnotation = null) {
- const node = {
- type: "TSConstructorType",
- typeParameters,
- parameters,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSConstructorType;
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.parameters, node, "parameters", parameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsTypeReference(typeName, typeParameters = null) {
- const node = {
- type: "TSTypeReference",
- typeName,
- typeParameters
- };
- const defs = NODE_FIELDS.TSTypeReference;
- validate(defs.typeName, node, "typeName", typeName, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function tsTypePredicate(parameterName, typeAnnotation = null, asserts = null) {
- const node = {
- type: "TSTypePredicate",
- parameterName,
- typeAnnotation,
- asserts
- };
- const defs = NODE_FIELDS.TSTypePredicate;
- validate(defs.parameterName, node, "parameterName", parameterName, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- validate(defs.asserts, node, "asserts", asserts);
- return node;
-}
-function tsTypeQuery(exprName, typeParameters = null) {
- const node = {
- type: "TSTypeQuery",
- exprName,
- typeParameters
- };
- const defs = NODE_FIELDS.TSTypeQuery;
- validate(defs.exprName, node, "exprName", exprName, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function tsTypeLiteral(members) {
- const node = {
- type: "TSTypeLiteral",
- members
- };
- const defs = NODE_FIELDS.TSTypeLiteral;
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function tsArrayType(elementType) {
- const node = {
- type: "TSArrayType",
- elementType
- };
- const defs = NODE_FIELDS.TSArrayType;
- validate(defs.elementType, node, "elementType", elementType, 1);
- return node;
-}
-function tsTupleType(elementTypes) {
- const node = {
- type: "TSTupleType",
- elementTypes
- };
- const defs = NODE_FIELDS.TSTupleType;
- validate(defs.elementTypes, node, "elementTypes", elementTypes, 1);
- return node;
-}
-function tsOptionalType(typeAnnotation) {
- const node = {
- type: "TSOptionalType",
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSOptionalType;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsRestType(typeAnnotation) {
- const node = {
- type: "TSRestType",
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSRestType;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsNamedTupleMember(label, elementType, optional = false) {
- const node = {
- type: "TSNamedTupleMember",
- label,
- elementType,
- optional
- };
- const defs = NODE_FIELDS.TSNamedTupleMember;
- validate(defs.label, node, "label", label, 1);
- validate(defs.elementType, node, "elementType", elementType, 1);
- validate(defs.optional, node, "optional", optional);
- return node;
-}
-function tsUnionType(types) {
- const node = {
- type: "TSUnionType",
- types
- };
- const defs = NODE_FIELDS.TSUnionType;
- validate(defs.types, node, "types", types, 1);
- return node;
-}
-function tsIntersectionType(types) {
- const node = {
- type: "TSIntersectionType",
- types
- };
- const defs = NODE_FIELDS.TSIntersectionType;
- validate(defs.types, node, "types", types, 1);
- return node;
-}
-function tsConditionalType(checkType, extendsType, trueType, falseType) {
- const node = {
- type: "TSConditionalType",
- checkType,
- extendsType,
- trueType,
- falseType
- };
- const defs = NODE_FIELDS.TSConditionalType;
- validate(defs.checkType, node, "checkType", checkType, 1);
- validate(defs.extendsType, node, "extendsType", extendsType, 1);
- validate(defs.trueType, node, "trueType", trueType, 1);
- validate(defs.falseType, node, "falseType", falseType, 1);
- return node;
-}
-function tsInferType(typeParameter) {
- const node = {
- type: "TSInferType",
- typeParameter
- };
- const defs = NODE_FIELDS.TSInferType;
- validate(defs.typeParameter, node, "typeParameter", typeParameter, 1);
- return node;
-}
-function tsParenthesizedType(typeAnnotation) {
- const node = {
- type: "TSParenthesizedType",
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSParenthesizedType;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsTypeOperator(typeAnnotation) {
- const node = {
- type: "TSTypeOperator",
- typeAnnotation,
- operator: null
- };
- const defs = NODE_FIELDS.TSTypeOperator;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsIndexedAccessType(objectType, indexType) {
- const node = {
- type: "TSIndexedAccessType",
- objectType,
- indexType
- };
- const defs = NODE_FIELDS.TSIndexedAccessType;
- validate(defs.objectType, node, "objectType", objectType, 1);
- validate(defs.indexType, node, "indexType", indexType, 1);
- return node;
-}
-function tsMappedType(typeParameter, typeAnnotation = null, nameType = null) {
- const node = {
- type: "TSMappedType",
- typeParameter,
- typeAnnotation,
- nameType
- };
- const defs = NODE_FIELDS.TSMappedType;
- validate(defs.typeParameter, node, "typeParameter", typeParameter, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- validate(defs.nameType, node, "nameType", nameType, 1);
- return node;
-}
-function tsTemplateLiteralType(quasis, types) {
- const node = {
- type: "TSTemplateLiteralType",
- quasis,
- types
- };
- const defs = NODE_FIELDS.TSTemplateLiteralType;
- validate(defs.quasis, node, "quasis", quasis, 1);
- validate(defs.types, node, "types", types, 1);
- return node;
-}
-function tsLiteralType(literal) {
- const node = {
- type: "TSLiteralType",
- literal
- };
- const defs = NODE_FIELDS.TSLiteralType;
- validate(defs.literal, node, "literal", literal, 1);
- return node;
-}
-function tsExpressionWithTypeArguments(expression, typeParameters = null) {
- const node = {
- type: "TSExpressionWithTypeArguments",
- expression,
- typeParameters
- };
- const defs = NODE_FIELDS.TSExpressionWithTypeArguments;
- validate(defs.expression, node, "expression", expression, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function tsInterfaceDeclaration(id, typeParameters = null, _extends = null, body) {
- const node = {
- type: "TSInterfaceDeclaration",
- id,
- typeParameters,
- extends: _extends,
- body
- };
- const defs = NODE_FIELDS.TSInterfaceDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.extends, node, "extends", _extends, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function tsInterfaceBody(body) {
- const node = {
- type: "TSInterfaceBody",
- body
- };
- const defs = NODE_FIELDS.TSInterfaceBody;
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function tsTypeAliasDeclaration(id, typeParameters = null, typeAnnotation) {
- const node = {
- type: "TSTypeAliasDeclaration",
- id,
- typeParameters,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSTypeAliasDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsInstantiationExpression(expression, typeParameters = null) {
- const node = {
- type: "TSInstantiationExpression",
- expression,
- typeParameters
- };
- const defs = NODE_FIELDS.TSInstantiationExpression;
- validate(defs.expression, node, "expression", expression, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function tsAsExpression(expression, typeAnnotation) {
- const node = {
- type: "TSAsExpression",
- expression,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSAsExpression;
- validate(defs.expression, node, "expression", expression, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsSatisfiesExpression(expression, typeAnnotation) {
- const node = {
- type: "TSSatisfiesExpression",
- expression,
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSSatisfiesExpression;
- validate(defs.expression, node, "expression", expression, 1);
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsTypeAssertion(typeAnnotation, expression) {
- const node = {
- type: "TSTypeAssertion",
- typeAnnotation,
- expression
- };
- const defs = NODE_FIELDS.TSTypeAssertion;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function tsEnumBody(members) {
- const node = {
- type: "TSEnumBody",
- members
- };
- const defs = NODE_FIELDS.TSEnumBody;
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function tsEnumDeclaration(id, members) {
- const node = {
- type: "TSEnumDeclaration",
- id,
- members
- };
- const defs = NODE_FIELDS.TSEnumDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.members, node, "members", members, 1);
- return node;
-}
-function tsEnumMember(id, initializer = null) {
- const node = {
- type: "TSEnumMember",
- id,
- initializer
- };
- const defs = NODE_FIELDS.TSEnumMember;
- validate(defs.id, node, "id", id, 1);
- validate(defs.initializer, node, "initializer", initializer, 1);
- return node;
-}
-function tsModuleDeclaration(id, body) {
- const node = {
- type: "TSModuleDeclaration",
- id,
- body,
- kind: null
- };
- const defs = NODE_FIELDS.TSModuleDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function tsModuleBlock(body) {
- const node = {
- type: "TSModuleBlock",
- body
- };
- const defs = NODE_FIELDS.TSModuleBlock;
- validate(defs.body, node, "body", body, 1);
- return node;
-}
-function tsImportType(argument, qualifier = null, typeParameters = null) {
- const node = {
- type: "TSImportType",
- argument,
- qualifier,
- typeParameters
- };
- const defs = NODE_FIELDS.TSImportType;
- validate(defs.argument, node, "argument", argument, 1);
- validate(defs.qualifier, node, "qualifier", qualifier, 1);
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
- return node;
-}
-function tsImportEqualsDeclaration(id, moduleReference) {
- const node = {
- type: "TSImportEqualsDeclaration",
- id,
- moduleReference,
- isExport: null
- };
- const defs = NODE_FIELDS.TSImportEqualsDeclaration;
- validate(defs.id, node, "id", id, 1);
- validate(defs.moduleReference, node, "moduleReference", moduleReference, 1);
- return node;
-}
-function tsExternalModuleReference(expression) {
- const node = {
- type: "TSExternalModuleReference",
- expression
- };
- const defs = NODE_FIELDS.TSExternalModuleReference;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function tsNonNullExpression(expression) {
- const node = {
- type: "TSNonNullExpression",
- expression
- };
- const defs = NODE_FIELDS.TSNonNullExpression;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function tsExportAssignment(expression) {
- const node = {
- type: "TSExportAssignment",
- expression
- };
- const defs = NODE_FIELDS.TSExportAssignment;
- validate(defs.expression, node, "expression", expression, 1);
- return node;
-}
-function tsNamespaceExportDeclaration(id) {
- const node = {
- type: "TSNamespaceExportDeclaration",
- id
- };
- const defs = NODE_FIELDS.TSNamespaceExportDeclaration;
- validate(defs.id, node, "id", id, 1);
- return node;
-}
-function tsTypeAnnotation(typeAnnotation) {
- const node = {
- type: "TSTypeAnnotation",
- typeAnnotation
- };
- const defs = NODE_FIELDS.TSTypeAnnotation;
- validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
- return node;
-}
-function tsTypeParameterInstantiation(params) {
- const node = {
- type: "TSTypeParameterInstantiation",
- params
- };
- const defs = NODE_FIELDS.TSTypeParameterInstantiation;
- validate(defs.params, node, "params", params, 1);
- return node;
-}
-function tsTypeParameterDeclaration(params) {
- const node = {
- type: "TSTypeParameterDeclaration",
- params
- };
- const defs = NODE_FIELDS.TSTypeParameterDeclaration;
- validate(defs.params, node, "params", params, 1);
- return node;
-}
-function tsTypeParameter(constraint = null, _default = null, name) {
- const node = {
- type: "TSTypeParameter",
- constraint,
- default: _default,
- name
- };
- const defs = NODE_FIELDS.TSTypeParameter;
- validate(defs.constraint, node, "constraint", constraint, 1);
- validate(defs.default, node, "default", _default, 1);
- validate(defs.name, node, "name", name);
- return node;
-}
-function NumberLiteral(value) {
- (0, _deprecationWarning.default)("NumberLiteral", "NumericLiteral", "The node type ");
- return numericLiteral(value);
-}
-function RegexLiteral(pattern, flags = "") {
- (0, _deprecationWarning.default)("RegexLiteral", "RegExpLiteral", "The node type ");
- return regExpLiteral(pattern, flags);
-}
-function RestProperty(argument) {
- (0, _deprecationWarning.default)("RestProperty", "RestElement", "The node type ");
- return restElement(argument);
-}
-function SpreadProperty(argument) {
- (0, _deprecationWarning.default)("SpreadProperty", "SpreadElement", "The node type ");
- return spreadElement(argument);
-}
-
-//# sourceMappingURL=lowercase.js.map
-
-
-/***/ }),
-
-/***/ 8530:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-Object.defineProperty(exports, "AnyTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.anyTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "ArgumentPlaceholder", ({
- enumerable: true,
- get: function () {
- return _lowercase.argumentPlaceholder;
- }
-}));
-Object.defineProperty(exports, "ArrayExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.arrayExpression;
- }
-}));
-Object.defineProperty(exports, "ArrayPattern", ({
- enumerable: true,
- get: function () {
- return _lowercase.arrayPattern;
- }
-}));
-Object.defineProperty(exports, "ArrayTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.arrayTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "ArrowFunctionExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.arrowFunctionExpression;
- }
-}));
-Object.defineProperty(exports, "AssignmentExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.assignmentExpression;
- }
-}));
-Object.defineProperty(exports, "AssignmentPattern", ({
- enumerable: true,
- get: function () {
- return _lowercase.assignmentPattern;
- }
-}));
-Object.defineProperty(exports, "AwaitExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.awaitExpression;
- }
-}));
-Object.defineProperty(exports, "BigIntLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.bigIntLiteral;
- }
-}));
-Object.defineProperty(exports, "BinaryExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.binaryExpression;
- }
-}));
-Object.defineProperty(exports, "BindExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.bindExpression;
- }
-}));
-Object.defineProperty(exports, "BlockStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.blockStatement;
- }
-}));
-Object.defineProperty(exports, "BooleanLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.booleanLiteral;
- }
-}));
-Object.defineProperty(exports, "BooleanLiteralTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.booleanLiteralTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "BooleanTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.booleanTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "BreakStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.breakStatement;
- }
-}));
-Object.defineProperty(exports, "CallExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.callExpression;
- }
-}));
-Object.defineProperty(exports, "CatchClause", ({
- enumerable: true,
- get: function () {
- return _lowercase.catchClause;
- }
-}));
-Object.defineProperty(exports, "ClassAccessorProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.classAccessorProperty;
- }
-}));
-Object.defineProperty(exports, "ClassBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.classBody;
- }
-}));
-Object.defineProperty(exports, "ClassDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.classDeclaration;
- }
-}));
-Object.defineProperty(exports, "ClassExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.classExpression;
- }
-}));
-Object.defineProperty(exports, "ClassImplements", ({
- enumerable: true,
- get: function () {
- return _lowercase.classImplements;
- }
-}));
-Object.defineProperty(exports, "ClassMethod", ({
- enumerable: true,
- get: function () {
- return _lowercase.classMethod;
- }
-}));
-Object.defineProperty(exports, "ClassPrivateMethod", ({
- enumerable: true,
- get: function () {
- return _lowercase.classPrivateMethod;
- }
-}));
-Object.defineProperty(exports, "ClassPrivateProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.classPrivateProperty;
- }
-}));
-Object.defineProperty(exports, "ClassProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.classProperty;
- }
-}));
-Object.defineProperty(exports, "ConditionalExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.conditionalExpression;
- }
-}));
-Object.defineProperty(exports, "ContinueStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.continueStatement;
- }
-}));
-Object.defineProperty(exports, "DebuggerStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.debuggerStatement;
- }
-}));
-Object.defineProperty(exports, "DecimalLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.decimalLiteral;
- }
-}));
-Object.defineProperty(exports, "DeclareClass", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareClass;
- }
-}));
-Object.defineProperty(exports, "DeclareExportAllDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareExportAllDeclaration;
- }
-}));
-Object.defineProperty(exports, "DeclareExportDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareExportDeclaration;
- }
-}));
-Object.defineProperty(exports, "DeclareFunction", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareFunction;
- }
-}));
-Object.defineProperty(exports, "DeclareInterface", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareInterface;
- }
-}));
-Object.defineProperty(exports, "DeclareModule", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareModule;
- }
-}));
-Object.defineProperty(exports, "DeclareModuleExports", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareModuleExports;
- }
-}));
-Object.defineProperty(exports, "DeclareOpaqueType", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareOpaqueType;
- }
-}));
-Object.defineProperty(exports, "DeclareTypeAlias", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareTypeAlias;
- }
-}));
-Object.defineProperty(exports, "DeclareVariable", ({
- enumerable: true,
- get: function () {
- return _lowercase.declareVariable;
- }
-}));
-Object.defineProperty(exports, "DeclaredPredicate", ({
- enumerable: true,
- get: function () {
- return _lowercase.declaredPredicate;
- }
-}));
-Object.defineProperty(exports, "Decorator", ({
- enumerable: true,
- get: function () {
- return _lowercase.decorator;
- }
-}));
-Object.defineProperty(exports, "Directive", ({
- enumerable: true,
- get: function () {
- return _lowercase.directive;
- }
-}));
-Object.defineProperty(exports, "DirectiveLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.directiveLiteral;
- }
-}));
-Object.defineProperty(exports, "DoExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.doExpression;
- }
-}));
-Object.defineProperty(exports, "DoWhileStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.doWhileStatement;
- }
-}));
-Object.defineProperty(exports, "EmptyStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.emptyStatement;
- }
-}));
-Object.defineProperty(exports, "EmptyTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.emptyTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "EnumBooleanBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumBooleanBody;
- }
-}));
-Object.defineProperty(exports, "EnumBooleanMember", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumBooleanMember;
- }
-}));
-Object.defineProperty(exports, "EnumDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumDeclaration;
- }
-}));
-Object.defineProperty(exports, "EnumDefaultedMember", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumDefaultedMember;
- }
-}));
-Object.defineProperty(exports, "EnumNumberBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumNumberBody;
- }
-}));
-Object.defineProperty(exports, "EnumNumberMember", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumNumberMember;
- }
-}));
-Object.defineProperty(exports, "EnumStringBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumStringBody;
- }
-}));
-Object.defineProperty(exports, "EnumStringMember", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumStringMember;
- }
-}));
-Object.defineProperty(exports, "EnumSymbolBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.enumSymbolBody;
- }
-}));
-Object.defineProperty(exports, "ExistsTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.existsTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "ExportAllDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.exportAllDeclaration;
- }
-}));
-Object.defineProperty(exports, "ExportDefaultDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.exportDefaultDeclaration;
- }
-}));
-Object.defineProperty(exports, "ExportDefaultSpecifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.exportDefaultSpecifier;
- }
-}));
-Object.defineProperty(exports, "ExportNamedDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.exportNamedDeclaration;
- }
-}));
-Object.defineProperty(exports, "ExportNamespaceSpecifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.exportNamespaceSpecifier;
- }
-}));
-Object.defineProperty(exports, "ExportSpecifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.exportSpecifier;
- }
-}));
-Object.defineProperty(exports, "ExpressionStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.expressionStatement;
- }
-}));
-Object.defineProperty(exports, "File", ({
- enumerable: true,
- get: function () {
- return _lowercase.file;
- }
-}));
-Object.defineProperty(exports, "ForInStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.forInStatement;
- }
-}));
-Object.defineProperty(exports, "ForOfStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.forOfStatement;
- }
-}));
-Object.defineProperty(exports, "ForStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.forStatement;
- }
-}));
-Object.defineProperty(exports, "FunctionDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.functionDeclaration;
- }
-}));
-Object.defineProperty(exports, "FunctionExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.functionExpression;
- }
-}));
-Object.defineProperty(exports, "FunctionTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.functionTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "FunctionTypeParam", ({
- enumerable: true,
- get: function () {
- return _lowercase.functionTypeParam;
- }
-}));
-Object.defineProperty(exports, "GenericTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.genericTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "Identifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.identifier;
- }
-}));
-Object.defineProperty(exports, "IfStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.ifStatement;
- }
-}));
-Object.defineProperty(exports, "Import", ({
- enumerable: true,
- get: function () {
- return _lowercase.import;
- }
-}));
-Object.defineProperty(exports, "ImportAttribute", ({
- enumerable: true,
- get: function () {
- return _lowercase.importAttribute;
- }
-}));
-Object.defineProperty(exports, "ImportDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.importDeclaration;
- }
-}));
-Object.defineProperty(exports, "ImportDefaultSpecifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.importDefaultSpecifier;
- }
-}));
-Object.defineProperty(exports, "ImportExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.importExpression;
- }
-}));
-Object.defineProperty(exports, "ImportNamespaceSpecifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.importNamespaceSpecifier;
- }
-}));
-Object.defineProperty(exports, "ImportSpecifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.importSpecifier;
- }
-}));
-Object.defineProperty(exports, "IndexedAccessType", ({
- enumerable: true,
- get: function () {
- return _lowercase.indexedAccessType;
- }
-}));
-Object.defineProperty(exports, "InferredPredicate", ({
- enumerable: true,
- get: function () {
- return _lowercase.inferredPredicate;
- }
-}));
-Object.defineProperty(exports, "InterfaceDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.interfaceDeclaration;
- }
-}));
-Object.defineProperty(exports, "InterfaceExtends", ({
- enumerable: true,
- get: function () {
- return _lowercase.interfaceExtends;
- }
-}));
-Object.defineProperty(exports, "InterfaceTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.interfaceTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "InterpreterDirective", ({
- enumerable: true,
- get: function () {
- return _lowercase.interpreterDirective;
- }
-}));
-Object.defineProperty(exports, "IntersectionTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.intersectionTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "JSXAttribute", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxAttribute;
- }
-}));
-Object.defineProperty(exports, "JSXClosingElement", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxClosingElement;
- }
-}));
-Object.defineProperty(exports, "JSXClosingFragment", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxClosingFragment;
- }
-}));
-Object.defineProperty(exports, "JSXElement", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxElement;
- }
-}));
-Object.defineProperty(exports, "JSXEmptyExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxEmptyExpression;
- }
-}));
-Object.defineProperty(exports, "JSXExpressionContainer", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxExpressionContainer;
- }
-}));
-Object.defineProperty(exports, "JSXFragment", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxFragment;
- }
-}));
-Object.defineProperty(exports, "JSXIdentifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxIdentifier;
- }
-}));
-Object.defineProperty(exports, "JSXMemberExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxMemberExpression;
- }
-}));
-Object.defineProperty(exports, "JSXNamespacedName", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxNamespacedName;
- }
-}));
-Object.defineProperty(exports, "JSXOpeningElement", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxOpeningElement;
- }
-}));
-Object.defineProperty(exports, "JSXOpeningFragment", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxOpeningFragment;
- }
-}));
-Object.defineProperty(exports, "JSXSpreadAttribute", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxSpreadAttribute;
- }
-}));
-Object.defineProperty(exports, "JSXSpreadChild", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxSpreadChild;
- }
-}));
-Object.defineProperty(exports, "JSXText", ({
- enumerable: true,
- get: function () {
- return _lowercase.jsxText;
- }
-}));
-Object.defineProperty(exports, "LabeledStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.labeledStatement;
- }
-}));
-Object.defineProperty(exports, "LogicalExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.logicalExpression;
- }
-}));
-Object.defineProperty(exports, "MemberExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.memberExpression;
- }
-}));
-Object.defineProperty(exports, "MetaProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.metaProperty;
- }
-}));
-Object.defineProperty(exports, "MixedTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.mixedTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "ModuleExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.moduleExpression;
- }
-}));
-Object.defineProperty(exports, "NewExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.newExpression;
- }
-}));
-Object.defineProperty(exports, "Noop", ({
- enumerable: true,
- get: function () {
- return _lowercase.noop;
- }
-}));
-Object.defineProperty(exports, "NullLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.nullLiteral;
- }
-}));
-Object.defineProperty(exports, "NullLiteralTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.nullLiteralTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "NullableTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.nullableTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "NumberLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.numberLiteral;
- }
-}));
-Object.defineProperty(exports, "NumberLiteralTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.numberLiteralTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "NumberTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.numberTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "NumericLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.numericLiteral;
- }
-}));
-Object.defineProperty(exports, "ObjectExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectExpression;
- }
-}));
-Object.defineProperty(exports, "ObjectMethod", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectMethod;
- }
-}));
-Object.defineProperty(exports, "ObjectPattern", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectPattern;
- }
-}));
-Object.defineProperty(exports, "ObjectProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectProperty;
- }
-}));
-Object.defineProperty(exports, "ObjectTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "ObjectTypeCallProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectTypeCallProperty;
- }
-}));
-Object.defineProperty(exports, "ObjectTypeIndexer", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectTypeIndexer;
- }
-}));
-Object.defineProperty(exports, "ObjectTypeInternalSlot", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectTypeInternalSlot;
- }
-}));
-Object.defineProperty(exports, "ObjectTypeProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectTypeProperty;
- }
-}));
-Object.defineProperty(exports, "ObjectTypeSpreadProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.objectTypeSpreadProperty;
- }
-}));
-Object.defineProperty(exports, "OpaqueType", ({
- enumerable: true,
- get: function () {
- return _lowercase.opaqueType;
- }
-}));
-Object.defineProperty(exports, "OptionalCallExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.optionalCallExpression;
- }
-}));
-Object.defineProperty(exports, "OptionalIndexedAccessType", ({
- enumerable: true,
- get: function () {
- return _lowercase.optionalIndexedAccessType;
- }
-}));
-Object.defineProperty(exports, "OptionalMemberExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.optionalMemberExpression;
- }
-}));
-Object.defineProperty(exports, "ParenthesizedExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.parenthesizedExpression;
- }
-}));
-Object.defineProperty(exports, "PipelineBareFunction", ({
- enumerable: true,
- get: function () {
- return _lowercase.pipelineBareFunction;
- }
-}));
-Object.defineProperty(exports, "PipelinePrimaryTopicReference", ({
- enumerable: true,
- get: function () {
- return _lowercase.pipelinePrimaryTopicReference;
- }
-}));
-Object.defineProperty(exports, "PipelineTopicExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.pipelineTopicExpression;
- }
-}));
-Object.defineProperty(exports, "Placeholder", ({
- enumerable: true,
- get: function () {
- return _lowercase.placeholder;
- }
-}));
-Object.defineProperty(exports, "PrivateName", ({
- enumerable: true,
- get: function () {
- return _lowercase.privateName;
- }
-}));
-Object.defineProperty(exports, "Program", ({
- enumerable: true,
- get: function () {
- return _lowercase.program;
- }
-}));
-Object.defineProperty(exports, "QualifiedTypeIdentifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.qualifiedTypeIdentifier;
- }
-}));
-Object.defineProperty(exports, "RecordExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.recordExpression;
- }
-}));
-Object.defineProperty(exports, "RegExpLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.regExpLiteral;
- }
-}));
-Object.defineProperty(exports, "RegexLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.regexLiteral;
- }
-}));
-Object.defineProperty(exports, "RestElement", ({
- enumerable: true,
- get: function () {
- return _lowercase.restElement;
- }
-}));
-Object.defineProperty(exports, "RestProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.restProperty;
- }
-}));
-Object.defineProperty(exports, "ReturnStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.returnStatement;
- }
-}));
-Object.defineProperty(exports, "SequenceExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.sequenceExpression;
- }
-}));
-Object.defineProperty(exports, "SpreadElement", ({
- enumerable: true,
- get: function () {
- return _lowercase.spreadElement;
- }
-}));
-Object.defineProperty(exports, "SpreadProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.spreadProperty;
- }
-}));
-Object.defineProperty(exports, "StaticBlock", ({
- enumerable: true,
- get: function () {
- return _lowercase.staticBlock;
- }
-}));
-Object.defineProperty(exports, "StringLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.stringLiteral;
- }
-}));
-Object.defineProperty(exports, "StringLiteralTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.stringLiteralTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "StringTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.stringTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "Super", ({
- enumerable: true,
- get: function () {
- return _lowercase.super;
- }
-}));
-Object.defineProperty(exports, "SwitchCase", ({
- enumerable: true,
- get: function () {
- return _lowercase.switchCase;
- }
-}));
-Object.defineProperty(exports, "SwitchStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.switchStatement;
- }
-}));
-Object.defineProperty(exports, "SymbolTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.symbolTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "TSAnyKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsAnyKeyword;
- }
-}));
-Object.defineProperty(exports, "TSArrayType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsArrayType;
- }
-}));
-Object.defineProperty(exports, "TSAsExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsAsExpression;
- }
-}));
-Object.defineProperty(exports, "TSBigIntKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsBigIntKeyword;
- }
-}));
-Object.defineProperty(exports, "TSBooleanKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsBooleanKeyword;
- }
-}));
-Object.defineProperty(exports, "TSCallSignatureDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsCallSignatureDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSConditionalType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsConditionalType;
- }
-}));
-Object.defineProperty(exports, "TSConstructSignatureDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsConstructSignatureDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSConstructorType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsConstructorType;
- }
-}));
-Object.defineProperty(exports, "TSDeclareFunction", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsDeclareFunction;
- }
-}));
-Object.defineProperty(exports, "TSDeclareMethod", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsDeclareMethod;
- }
-}));
-Object.defineProperty(exports, "TSEnumBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsEnumBody;
- }
-}));
-Object.defineProperty(exports, "TSEnumDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsEnumDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSEnumMember", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsEnumMember;
- }
-}));
-Object.defineProperty(exports, "TSExportAssignment", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsExportAssignment;
- }
-}));
-Object.defineProperty(exports, "TSExpressionWithTypeArguments", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsExpressionWithTypeArguments;
- }
-}));
-Object.defineProperty(exports, "TSExternalModuleReference", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsExternalModuleReference;
- }
-}));
-Object.defineProperty(exports, "TSFunctionType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsFunctionType;
- }
-}));
-Object.defineProperty(exports, "TSImportEqualsDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsImportEqualsDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSImportType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsImportType;
- }
-}));
-Object.defineProperty(exports, "TSIndexSignature", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsIndexSignature;
- }
-}));
-Object.defineProperty(exports, "TSIndexedAccessType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsIndexedAccessType;
- }
-}));
-Object.defineProperty(exports, "TSInferType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsInferType;
- }
-}));
-Object.defineProperty(exports, "TSInstantiationExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsInstantiationExpression;
- }
-}));
-Object.defineProperty(exports, "TSInterfaceBody", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsInterfaceBody;
- }
-}));
-Object.defineProperty(exports, "TSInterfaceDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsInterfaceDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSIntersectionType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsIntersectionType;
- }
-}));
-Object.defineProperty(exports, "TSIntrinsicKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsIntrinsicKeyword;
- }
-}));
-Object.defineProperty(exports, "TSLiteralType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsLiteralType;
- }
-}));
-Object.defineProperty(exports, "TSMappedType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsMappedType;
- }
-}));
-Object.defineProperty(exports, "TSMethodSignature", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsMethodSignature;
- }
-}));
-Object.defineProperty(exports, "TSModuleBlock", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsModuleBlock;
- }
-}));
-Object.defineProperty(exports, "TSModuleDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsModuleDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSNamedTupleMember", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsNamedTupleMember;
- }
-}));
-Object.defineProperty(exports, "TSNamespaceExportDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsNamespaceExportDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSNeverKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsNeverKeyword;
- }
-}));
-Object.defineProperty(exports, "TSNonNullExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsNonNullExpression;
- }
-}));
-Object.defineProperty(exports, "TSNullKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsNullKeyword;
- }
-}));
-Object.defineProperty(exports, "TSNumberKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsNumberKeyword;
- }
-}));
-Object.defineProperty(exports, "TSObjectKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsObjectKeyword;
- }
-}));
-Object.defineProperty(exports, "TSOptionalType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsOptionalType;
- }
-}));
-Object.defineProperty(exports, "TSParameterProperty", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsParameterProperty;
- }
-}));
-Object.defineProperty(exports, "TSParenthesizedType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsParenthesizedType;
- }
-}));
-Object.defineProperty(exports, "TSPropertySignature", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsPropertySignature;
- }
-}));
-Object.defineProperty(exports, "TSQualifiedName", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsQualifiedName;
- }
-}));
-Object.defineProperty(exports, "TSRestType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsRestType;
- }
-}));
-Object.defineProperty(exports, "TSSatisfiesExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsSatisfiesExpression;
- }
-}));
-Object.defineProperty(exports, "TSStringKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsStringKeyword;
- }
-}));
-Object.defineProperty(exports, "TSSymbolKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsSymbolKeyword;
- }
-}));
-Object.defineProperty(exports, "TSTemplateLiteralType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTemplateLiteralType;
- }
-}));
-Object.defineProperty(exports, "TSThisType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsThisType;
- }
-}));
-Object.defineProperty(exports, "TSTupleType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTupleType;
- }
-}));
-Object.defineProperty(exports, "TSTypeAliasDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeAliasDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "TSTypeAssertion", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeAssertion;
- }
-}));
-Object.defineProperty(exports, "TSTypeLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeLiteral;
- }
-}));
-Object.defineProperty(exports, "TSTypeOperator", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeOperator;
- }
-}));
-Object.defineProperty(exports, "TSTypeParameter", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeParameter;
- }
-}));
-Object.defineProperty(exports, "TSTypeParameterDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeParameterDeclaration;
- }
-}));
-Object.defineProperty(exports, "TSTypeParameterInstantiation", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeParameterInstantiation;
- }
-}));
-Object.defineProperty(exports, "TSTypePredicate", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypePredicate;
- }
-}));
-Object.defineProperty(exports, "TSTypeQuery", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeQuery;
- }
-}));
-Object.defineProperty(exports, "TSTypeReference", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsTypeReference;
- }
-}));
-Object.defineProperty(exports, "TSUndefinedKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsUndefinedKeyword;
- }
-}));
-Object.defineProperty(exports, "TSUnionType", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsUnionType;
- }
-}));
-Object.defineProperty(exports, "TSUnknownKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsUnknownKeyword;
- }
-}));
-Object.defineProperty(exports, "TSVoidKeyword", ({
- enumerable: true,
- get: function () {
- return _lowercase.tsVoidKeyword;
- }
-}));
-Object.defineProperty(exports, "TaggedTemplateExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.taggedTemplateExpression;
- }
-}));
-Object.defineProperty(exports, "TemplateElement", ({
- enumerable: true,
- get: function () {
- return _lowercase.templateElement;
- }
-}));
-Object.defineProperty(exports, "TemplateLiteral", ({
- enumerable: true,
- get: function () {
- return _lowercase.templateLiteral;
- }
-}));
-Object.defineProperty(exports, "ThisExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.thisExpression;
- }
-}));
-Object.defineProperty(exports, "ThisTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.thisTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "ThrowStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.throwStatement;
- }
-}));
-Object.defineProperty(exports, "TopicReference", ({
- enumerable: true,
- get: function () {
- return _lowercase.topicReference;
- }
-}));
-Object.defineProperty(exports, "TryStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.tryStatement;
- }
-}));
-Object.defineProperty(exports, "TupleExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.tupleExpression;
- }
-}));
-Object.defineProperty(exports, "TupleTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.tupleTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "TypeAlias", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeAlias;
- }
-}));
-Object.defineProperty(exports, "TypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeAnnotation;
- }
-}));
-Object.defineProperty(exports, "TypeCastExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeCastExpression;
- }
-}));
-Object.defineProperty(exports, "TypeParameter", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeParameter;
- }
-}));
-Object.defineProperty(exports, "TypeParameterDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeParameterDeclaration;
- }
-}));
-Object.defineProperty(exports, "TypeParameterInstantiation", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeParameterInstantiation;
- }
-}));
-Object.defineProperty(exports, "TypeofTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.typeofTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "UnaryExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.unaryExpression;
- }
-}));
-Object.defineProperty(exports, "UnionTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.unionTypeAnnotation;
- }
-}));
-Object.defineProperty(exports, "UpdateExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.updateExpression;
- }
-}));
-Object.defineProperty(exports, "V8IntrinsicIdentifier", ({
- enumerable: true,
- get: function () {
- return _lowercase.v8IntrinsicIdentifier;
- }
-}));
-Object.defineProperty(exports, "VariableDeclaration", ({
- enumerable: true,
- get: function () {
- return _lowercase.variableDeclaration;
- }
-}));
-Object.defineProperty(exports, "VariableDeclarator", ({
- enumerable: true,
- get: function () {
- return _lowercase.variableDeclarator;
- }
-}));
-Object.defineProperty(exports, "Variance", ({
- enumerable: true,
- get: function () {
- return _lowercase.variance;
+exports.assertAccessor = assertAccessor;
+exports.assertAnyTypeAnnotation = assertAnyTypeAnnotation;
+exports.assertArgumentPlaceholder = assertArgumentPlaceholder;
+exports.assertArrayExpression = assertArrayExpression;
+exports.assertArrayPattern = assertArrayPattern;
+exports.assertArrayTypeAnnotation = assertArrayTypeAnnotation;
+exports.assertArrowFunctionExpression = assertArrowFunctionExpression;
+exports.assertAssignmentExpression = assertAssignmentExpression;
+exports.assertAssignmentPattern = assertAssignmentPattern;
+exports.assertAwaitExpression = assertAwaitExpression;
+exports.assertBigIntLiteral = assertBigIntLiteral;
+exports.assertBinary = assertBinary;
+exports.assertBinaryExpression = assertBinaryExpression;
+exports.assertBindExpression = assertBindExpression;
+exports.assertBlock = assertBlock;
+exports.assertBlockParent = assertBlockParent;
+exports.assertBlockStatement = assertBlockStatement;
+exports.assertBooleanLiteral = assertBooleanLiteral;
+exports.assertBooleanLiteralTypeAnnotation = assertBooleanLiteralTypeAnnotation;
+exports.assertBooleanTypeAnnotation = assertBooleanTypeAnnotation;
+exports.assertBreakStatement = assertBreakStatement;
+exports.assertCallExpression = assertCallExpression;
+exports.assertCatchClause = assertCatchClause;
+exports.assertClass = assertClass;
+exports.assertClassAccessorProperty = assertClassAccessorProperty;
+exports.assertClassBody = assertClassBody;
+exports.assertClassDeclaration = assertClassDeclaration;
+exports.assertClassExpression = assertClassExpression;
+exports.assertClassImplements = assertClassImplements;
+exports.assertClassMethod = assertClassMethod;
+exports.assertClassPrivateMethod = assertClassPrivateMethod;
+exports.assertClassPrivateProperty = assertClassPrivateProperty;
+exports.assertClassProperty = assertClassProperty;
+exports.assertCompletionStatement = assertCompletionStatement;
+exports.assertConditional = assertConditional;
+exports.assertConditionalExpression = assertConditionalExpression;
+exports.assertContinueStatement = assertContinueStatement;
+exports.assertDebuggerStatement = assertDebuggerStatement;
+exports.assertDecimalLiteral = assertDecimalLiteral;
+exports.assertDeclaration = assertDeclaration;
+exports.assertDeclareClass = assertDeclareClass;
+exports.assertDeclareExportAllDeclaration = assertDeclareExportAllDeclaration;
+exports.assertDeclareExportDeclaration = assertDeclareExportDeclaration;
+exports.assertDeclareFunction = assertDeclareFunction;
+exports.assertDeclareInterface = assertDeclareInterface;
+exports.assertDeclareModule = assertDeclareModule;
+exports.assertDeclareModuleExports = assertDeclareModuleExports;
+exports.assertDeclareOpaqueType = assertDeclareOpaqueType;
+exports.assertDeclareTypeAlias = assertDeclareTypeAlias;
+exports.assertDeclareVariable = assertDeclareVariable;
+exports.assertDeclaredPredicate = assertDeclaredPredicate;
+exports.assertDecorator = assertDecorator;
+exports.assertDirective = assertDirective;
+exports.assertDirectiveLiteral = assertDirectiveLiteral;
+exports.assertDoExpression = assertDoExpression;
+exports.assertDoWhileStatement = assertDoWhileStatement;
+exports.assertEmptyStatement = assertEmptyStatement;
+exports.assertEmptyTypeAnnotation = assertEmptyTypeAnnotation;
+exports.assertEnumBody = assertEnumBody;
+exports.assertEnumBooleanBody = assertEnumBooleanBody;
+exports.assertEnumBooleanMember = assertEnumBooleanMember;
+exports.assertEnumDeclaration = assertEnumDeclaration;
+exports.assertEnumDefaultedMember = assertEnumDefaultedMember;
+exports.assertEnumMember = assertEnumMember;
+exports.assertEnumNumberBody = assertEnumNumberBody;
+exports.assertEnumNumberMember = assertEnumNumberMember;
+exports.assertEnumStringBody = assertEnumStringBody;
+exports.assertEnumStringMember = assertEnumStringMember;
+exports.assertEnumSymbolBody = assertEnumSymbolBody;
+exports.assertExistsTypeAnnotation = assertExistsTypeAnnotation;
+exports.assertExportAllDeclaration = assertExportAllDeclaration;
+exports.assertExportDeclaration = assertExportDeclaration;
+exports.assertExportDefaultDeclaration = assertExportDefaultDeclaration;
+exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier;
+exports.assertExportNamedDeclaration = assertExportNamedDeclaration;
+exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier;
+exports.assertExportSpecifier = assertExportSpecifier;
+exports.assertExpression = assertExpression;
+exports.assertExpressionStatement = assertExpressionStatement;
+exports.assertExpressionWrapper = assertExpressionWrapper;
+exports.assertFile = assertFile;
+exports.assertFlow = assertFlow;
+exports.assertFlowBaseAnnotation = assertFlowBaseAnnotation;
+exports.assertFlowDeclaration = assertFlowDeclaration;
+exports.assertFlowPredicate = assertFlowPredicate;
+exports.assertFlowType = assertFlowType;
+exports.assertFor = assertFor;
+exports.assertForInStatement = assertForInStatement;
+exports.assertForOfStatement = assertForOfStatement;
+exports.assertForStatement = assertForStatement;
+exports.assertForXStatement = assertForXStatement;
+exports.assertFunction = assertFunction;
+exports.assertFunctionDeclaration = assertFunctionDeclaration;
+exports.assertFunctionExpression = assertFunctionExpression;
+exports.assertFunctionParent = assertFunctionParent;
+exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation;
+exports.assertFunctionTypeParam = assertFunctionTypeParam;
+exports.assertGenericTypeAnnotation = assertGenericTypeAnnotation;
+exports.assertIdentifier = assertIdentifier;
+exports.assertIfStatement = assertIfStatement;
+exports.assertImmutable = assertImmutable;
+exports.assertImport = assertImport;
+exports.assertImportAttribute = assertImportAttribute;
+exports.assertImportDeclaration = assertImportDeclaration;
+exports.assertImportDefaultSpecifier = assertImportDefaultSpecifier;
+exports.assertImportExpression = assertImportExpression;
+exports.assertImportNamespaceSpecifier = assertImportNamespaceSpecifier;
+exports.assertImportOrExportDeclaration = assertImportOrExportDeclaration;
+exports.assertImportSpecifier = assertImportSpecifier;
+exports.assertIndexedAccessType = assertIndexedAccessType;
+exports.assertInferredPredicate = assertInferredPredicate;
+exports.assertInterfaceDeclaration = assertInterfaceDeclaration;
+exports.assertInterfaceExtends = assertInterfaceExtends;
+exports.assertInterfaceTypeAnnotation = assertInterfaceTypeAnnotation;
+exports.assertInterpreterDirective = assertInterpreterDirective;
+exports.assertIntersectionTypeAnnotation = assertIntersectionTypeAnnotation;
+exports.assertJSX = assertJSX;
+exports.assertJSXAttribute = assertJSXAttribute;
+exports.assertJSXClosingElement = assertJSXClosingElement;
+exports.assertJSXClosingFragment = assertJSXClosingFragment;
+exports.assertJSXElement = assertJSXElement;
+exports.assertJSXEmptyExpression = assertJSXEmptyExpression;
+exports.assertJSXExpressionContainer = assertJSXExpressionContainer;
+exports.assertJSXFragment = assertJSXFragment;
+exports.assertJSXIdentifier = assertJSXIdentifier;
+exports.assertJSXMemberExpression = assertJSXMemberExpression;
+exports.assertJSXNamespacedName = assertJSXNamespacedName;
+exports.assertJSXOpeningElement = assertJSXOpeningElement;
+exports.assertJSXOpeningFragment = assertJSXOpeningFragment;
+exports.assertJSXSpreadAttribute = assertJSXSpreadAttribute;
+exports.assertJSXSpreadChild = assertJSXSpreadChild;
+exports.assertJSXText = assertJSXText;
+exports.assertLVal = assertLVal;
+exports.assertLabeledStatement = assertLabeledStatement;
+exports.assertLiteral = assertLiteral;
+exports.assertLogicalExpression = assertLogicalExpression;
+exports.assertLoop = assertLoop;
+exports.assertMemberExpression = assertMemberExpression;
+exports.assertMetaProperty = assertMetaProperty;
+exports.assertMethod = assertMethod;
+exports.assertMiscellaneous = assertMiscellaneous;
+exports.assertMixedTypeAnnotation = assertMixedTypeAnnotation;
+exports.assertModuleDeclaration = assertModuleDeclaration;
+exports.assertModuleExpression = assertModuleExpression;
+exports.assertModuleSpecifier = assertModuleSpecifier;
+exports.assertNewExpression = assertNewExpression;
+exports.assertNoop = assertNoop;
+exports.assertNullLiteral = assertNullLiteral;
+exports.assertNullLiteralTypeAnnotation = assertNullLiteralTypeAnnotation;
+exports.assertNullableTypeAnnotation = assertNullableTypeAnnotation;
+exports.assertNumberLiteral = assertNumberLiteral;
+exports.assertNumberLiteralTypeAnnotation = assertNumberLiteralTypeAnnotation;
+exports.assertNumberTypeAnnotation = assertNumberTypeAnnotation;
+exports.assertNumericLiteral = assertNumericLiteral;
+exports.assertObjectExpression = assertObjectExpression;
+exports.assertObjectMember = assertObjectMember;
+exports.assertObjectMethod = assertObjectMethod;
+exports.assertObjectPattern = assertObjectPattern;
+exports.assertObjectProperty = assertObjectProperty;
+exports.assertObjectTypeAnnotation = assertObjectTypeAnnotation;
+exports.assertObjectTypeCallProperty = assertObjectTypeCallProperty;
+exports.assertObjectTypeIndexer = assertObjectTypeIndexer;
+exports.assertObjectTypeInternalSlot = assertObjectTypeInternalSlot;
+exports.assertObjectTypeProperty = assertObjectTypeProperty;
+exports.assertObjectTypeSpreadProperty = assertObjectTypeSpreadProperty;
+exports.assertOpaqueType = assertOpaqueType;
+exports.assertOptionalCallExpression = assertOptionalCallExpression;
+exports.assertOptionalIndexedAccessType = assertOptionalIndexedAccessType;
+exports.assertOptionalMemberExpression = assertOptionalMemberExpression;
+exports.assertParenthesizedExpression = assertParenthesizedExpression;
+exports.assertPattern = assertPattern;
+exports.assertPatternLike = assertPatternLike;
+exports.assertPipelineBareFunction = assertPipelineBareFunction;
+exports.assertPipelinePrimaryTopicReference = assertPipelinePrimaryTopicReference;
+exports.assertPipelineTopicExpression = assertPipelineTopicExpression;
+exports.assertPlaceholder = assertPlaceholder;
+exports.assertPrivate = assertPrivate;
+exports.assertPrivateName = assertPrivateName;
+exports.assertProgram = assertProgram;
+exports.assertProperty = assertProperty;
+exports.assertPureish = assertPureish;
+exports.assertQualifiedTypeIdentifier = assertQualifiedTypeIdentifier;
+exports.assertRecordExpression = assertRecordExpression;
+exports.assertRegExpLiteral = assertRegExpLiteral;
+exports.assertRegexLiteral = assertRegexLiteral;
+exports.assertRestElement = assertRestElement;
+exports.assertRestProperty = assertRestProperty;
+exports.assertReturnStatement = assertReturnStatement;
+exports.assertScopable = assertScopable;
+exports.assertSequenceExpression = assertSequenceExpression;
+exports.assertSpreadElement = assertSpreadElement;
+exports.assertSpreadProperty = assertSpreadProperty;
+exports.assertStandardized = assertStandardized;
+exports.assertStatement = assertStatement;
+exports.assertStaticBlock = assertStaticBlock;
+exports.assertStringLiteral = assertStringLiteral;
+exports.assertStringLiteralTypeAnnotation = assertStringLiteralTypeAnnotation;
+exports.assertStringTypeAnnotation = assertStringTypeAnnotation;
+exports.assertSuper = assertSuper;
+exports.assertSwitchCase = assertSwitchCase;
+exports.assertSwitchStatement = assertSwitchStatement;
+exports.assertSymbolTypeAnnotation = assertSymbolTypeAnnotation;
+exports.assertTSAnyKeyword = assertTSAnyKeyword;
+exports.assertTSArrayType = assertTSArrayType;
+exports.assertTSAsExpression = assertTSAsExpression;
+exports.assertTSBaseType = assertTSBaseType;
+exports.assertTSBigIntKeyword = assertTSBigIntKeyword;
+exports.assertTSBooleanKeyword = assertTSBooleanKeyword;
+exports.assertTSCallSignatureDeclaration = assertTSCallSignatureDeclaration;
+exports.assertTSConditionalType = assertTSConditionalType;
+exports.assertTSConstructSignatureDeclaration = assertTSConstructSignatureDeclaration;
+exports.assertTSConstructorType = assertTSConstructorType;
+exports.assertTSDeclareFunction = assertTSDeclareFunction;
+exports.assertTSDeclareMethod = assertTSDeclareMethod;
+exports.assertTSEntityName = assertTSEntityName;
+exports.assertTSEnumBody = assertTSEnumBody;
+exports.assertTSEnumDeclaration = assertTSEnumDeclaration;
+exports.assertTSEnumMember = assertTSEnumMember;
+exports.assertTSExportAssignment = assertTSExportAssignment;
+exports.assertTSExpressionWithTypeArguments = assertTSExpressionWithTypeArguments;
+exports.assertTSExternalModuleReference = assertTSExternalModuleReference;
+exports.assertTSFunctionType = assertTSFunctionType;
+exports.assertTSImportEqualsDeclaration = assertTSImportEqualsDeclaration;
+exports.assertTSImportType = assertTSImportType;
+exports.assertTSIndexSignature = assertTSIndexSignature;
+exports.assertTSIndexedAccessType = assertTSIndexedAccessType;
+exports.assertTSInferType = assertTSInferType;
+exports.assertTSInstantiationExpression = assertTSInstantiationExpression;
+exports.assertTSInterfaceBody = assertTSInterfaceBody;
+exports.assertTSInterfaceDeclaration = assertTSInterfaceDeclaration;
+exports.assertTSIntersectionType = assertTSIntersectionType;
+exports.assertTSIntrinsicKeyword = assertTSIntrinsicKeyword;
+exports.assertTSLiteralType = assertTSLiteralType;
+exports.assertTSMappedType = assertTSMappedType;
+exports.assertTSMethodSignature = assertTSMethodSignature;
+exports.assertTSModuleBlock = assertTSModuleBlock;
+exports.assertTSModuleDeclaration = assertTSModuleDeclaration;
+exports.assertTSNamedTupleMember = assertTSNamedTupleMember;
+exports.assertTSNamespaceExportDeclaration = assertTSNamespaceExportDeclaration;
+exports.assertTSNeverKeyword = assertTSNeverKeyword;
+exports.assertTSNonNullExpression = assertTSNonNullExpression;
+exports.assertTSNullKeyword = assertTSNullKeyword;
+exports.assertTSNumberKeyword = assertTSNumberKeyword;
+exports.assertTSObjectKeyword = assertTSObjectKeyword;
+exports.assertTSOptionalType = assertTSOptionalType;
+exports.assertTSParameterProperty = assertTSParameterProperty;
+exports.assertTSParenthesizedType = assertTSParenthesizedType;
+exports.assertTSPropertySignature = assertTSPropertySignature;
+exports.assertTSQualifiedName = assertTSQualifiedName;
+exports.assertTSRestType = assertTSRestType;
+exports.assertTSSatisfiesExpression = assertTSSatisfiesExpression;
+exports.assertTSStringKeyword = assertTSStringKeyword;
+exports.assertTSSymbolKeyword = assertTSSymbolKeyword;
+exports.assertTSTemplateLiteralType = assertTSTemplateLiteralType;
+exports.assertTSThisType = assertTSThisType;
+exports.assertTSTupleType = assertTSTupleType;
+exports.assertTSType = assertTSType;
+exports.assertTSTypeAliasDeclaration = assertTSTypeAliasDeclaration;
+exports.assertTSTypeAnnotation = assertTSTypeAnnotation;
+exports.assertTSTypeAssertion = assertTSTypeAssertion;
+exports.assertTSTypeElement = assertTSTypeElement;
+exports.assertTSTypeLiteral = assertTSTypeLiteral;
+exports.assertTSTypeOperator = assertTSTypeOperator;
+exports.assertTSTypeParameter = assertTSTypeParameter;
+exports.assertTSTypeParameterDeclaration = assertTSTypeParameterDeclaration;
+exports.assertTSTypeParameterInstantiation = assertTSTypeParameterInstantiation;
+exports.assertTSTypePredicate = assertTSTypePredicate;
+exports.assertTSTypeQuery = assertTSTypeQuery;
+exports.assertTSTypeReference = assertTSTypeReference;
+exports.assertTSUndefinedKeyword = assertTSUndefinedKeyword;
+exports.assertTSUnionType = assertTSUnionType;
+exports.assertTSUnknownKeyword = assertTSUnknownKeyword;
+exports.assertTSVoidKeyword = assertTSVoidKeyword;
+exports.assertTaggedTemplateExpression = assertTaggedTemplateExpression;
+exports.assertTemplateElement = assertTemplateElement;
+exports.assertTemplateLiteral = assertTemplateLiteral;
+exports.assertTerminatorless = assertTerminatorless;
+exports.assertThisExpression = assertThisExpression;
+exports.assertThisTypeAnnotation = assertThisTypeAnnotation;
+exports.assertThrowStatement = assertThrowStatement;
+exports.assertTopicReference = assertTopicReference;
+exports.assertTryStatement = assertTryStatement;
+exports.assertTupleExpression = assertTupleExpression;
+exports.assertTupleTypeAnnotation = assertTupleTypeAnnotation;
+exports.assertTypeAlias = assertTypeAlias;
+exports.assertTypeAnnotation = assertTypeAnnotation;
+exports.assertTypeCastExpression = assertTypeCastExpression;
+exports.assertTypeParameter = assertTypeParameter;
+exports.assertTypeParameterDeclaration = assertTypeParameterDeclaration;
+exports.assertTypeParameterInstantiation = assertTypeParameterInstantiation;
+exports.assertTypeScript = assertTypeScript;
+exports.assertTypeofTypeAnnotation = assertTypeofTypeAnnotation;
+exports.assertUnaryExpression = assertUnaryExpression;
+exports.assertUnaryLike = assertUnaryLike;
+exports.assertUnionTypeAnnotation = assertUnionTypeAnnotation;
+exports.assertUpdateExpression = assertUpdateExpression;
+exports.assertUserWhitespacable = assertUserWhitespacable;
+exports.assertV8IntrinsicIdentifier = assertV8IntrinsicIdentifier;
+exports.assertVariableDeclaration = assertVariableDeclaration;
+exports.assertVariableDeclarator = assertVariableDeclarator;
+exports.assertVariance = assertVariance;
+exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation;
+exports.assertWhile = assertWhile;
+exports.assertWhileStatement = assertWhileStatement;
+exports.assertWithStatement = assertWithStatement;
+exports.assertYieldExpression = assertYieldExpression;
+var _is = __nccwpck_require__(3860);
+var _deprecationWarning = __nccwpck_require__(496);
+function assert(type, node, opts) {
+ if (!(0, _is.default)(type, node, opts)) {
+ throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, ` + `but instead got "${node.type}".`);
}
+}
+function assertArrayExpression(node, opts) {
+ assert("ArrayExpression", node, opts);
+}
+function assertAssignmentExpression(node, opts) {
+ assert("AssignmentExpression", node, opts);
+}
+function assertBinaryExpression(node, opts) {
+ assert("BinaryExpression", node, opts);
+}
+function assertInterpreterDirective(node, opts) {
+ assert("InterpreterDirective", node, opts);
+}
+function assertDirective(node, opts) {
+ assert("Directive", node, opts);
+}
+function assertDirectiveLiteral(node, opts) {
+ assert("DirectiveLiteral", node, opts);
+}
+function assertBlockStatement(node, opts) {
+ assert("BlockStatement", node, opts);
+}
+function assertBreakStatement(node, opts) {
+ assert("BreakStatement", node, opts);
+}
+function assertCallExpression(node, opts) {
+ assert("CallExpression", node, opts);
+}
+function assertCatchClause(node, opts) {
+ assert("CatchClause", node, opts);
+}
+function assertConditionalExpression(node, opts) {
+ assert("ConditionalExpression", node, opts);
+}
+function assertContinueStatement(node, opts) {
+ assert("ContinueStatement", node, opts);
+}
+function assertDebuggerStatement(node, opts) {
+ assert("DebuggerStatement", node, opts);
+}
+function assertDoWhileStatement(node, opts) {
+ assert("DoWhileStatement", node, opts);
+}
+function assertEmptyStatement(node, opts) {
+ assert("EmptyStatement", node, opts);
+}
+function assertExpressionStatement(node, opts) {
+ assert("ExpressionStatement", node, opts);
+}
+function assertFile(node, opts) {
+ assert("File", node, opts);
+}
+function assertForInStatement(node, opts) {
+ assert("ForInStatement", node, opts);
+}
+function assertForStatement(node, opts) {
+ assert("ForStatement", node, opts);
+}
+function assertFunctionDeclaration(node, opts) {
+ assert("FunctionDeclaration", node, opts);
+}
+function assertFunctionExpression(node, opts) {
+ assert("FunctionExpression", node, opts);
+}
+function assertIdentifier(node, opts) {
+ assert("Identifier", node, opts);
+}
+function assertIfStatement(node, opts) {
+ assert("IfStatement", node, opts);
+}
+function assertLabeledStatement(node, opts) {
+ assert("LabeledStatement", node, opts);
+}
+function assertStringLiteral(node, opts) {
+ assert("StringLiteral", node, opts);
+}
+function assertNumericLiteral(node, opts) {
+ assert("NumericLiteral", node, opts);
+}
+function assertNullLiteral(node, opts) {
+ assert("NullLiteral", node, opts);
+}
+function assertBooleanLiteral(node, opts) {
+ assert("BooleanLiteral", node, opts);
+}
+function assertRegExpLiteral(node, opts) {
+ assert("RegExpLiteral", node, opts);
+}
+function assertLogicalExpression(node, opts) {
+ assert("LogicalExpression", node, opts);
+}
+function assertMemberExpression(node, opts) {
+ assert("MemberExpression", node, opts);
+}
+function assertNewExpression(node, opts) {
+ assert("NewExpression", node, opts);
+}
+function assertProgram(node, opts) {
+ assert("Program", node, opts);
+}
+function assertObjectExpression(node, opts) {
+ assert("ObjectExpression", node, opts);
+}
+function assertObjectMethod(node, opts) {
+ assert("ObjectMethod", node, opts);
+}
+function assertObjectProperty(node, opts) {
+ assert("ObjectProperty", node, opts);
+}
+function assertRestElement(node, opts) {
+ assert("RestElement", node, opts);
+}
+function assertReturnStatement(node, opts) {
+ assert("ReturnStatement", node, opts);
+}
+function assertSequenceExpression(node, opts) {
+ assert("SequenceExpression", node, opts);
+}
+function assertParenthesizedExpression(node, opts) {
+ assert("ParenthesizedExpression", node, opts);
+}
+function assertSwitchCase(node, opts) {
+ assert("SwitchCase", node, opts);
+}
+function assertSwitchStatement(node, opts) {
+ assert("SwitchStatement", node, opts);
+}
+function assertThisExpression(node, opts) {
+ assert("ThisExpression", node, opts);
+}
+function assertThrowStatement(node, opts) {
+ assert("ThrowStatement", node, opts);
+}
+function assertTryStatement(node, opts) {
+ assert("TryStatement", node, opts);
+}
+function assertUnaryExpression(node, opts) {
+ assert("UnaryExpression", node, opts);
+}
+function assertUpdateExpression(node, opts) {
+ assert("UpdateExpression", node, opts);
+}
+function assertVariableDeclaration(node, opts) {
+ assert("VariableDeclaration", node, opts);
+}
+function assertVariableDeclarator(node, opts) {
+ assert("VariableDeclarator", node, opts);
+}
+function assertWhileStatement(node, opts) {
+ assert("WhileStatement", node, opts);
+}
+function assertWithStatement(node, opts) {
+ assert("WithStatement", node, opts);
+}
+function assertAssignmentPattern(node, opts) {
+ assert("AssignmentPattern", node, opts);
+}
+function assertArrayPattern(node, opts) {
+ assert("ArrayPattern", node, opts);
+}
+function assertArrowFunctionExpression(node, opts) {
+ assert("ArrowFunctionExpression", node, opts);
+}
+function assertClassBody(node, opts) {
+ assert("ClassBody", node, opts);
+}
+function assertClassExpression(node, opts) {
+ assert("ClassExpression", node, opts);
+}
+function assertClassDeclaration(node, opts) {
+ assert("ClassDeclaration", node, opts);
+}
+function assertExportAllDeclaration(node, opts) {
+ assert("ExportAllDeclaration", node, opts);
+}
+function assertExportDefaultDeclaration(node, opts) {
+ assert("ExportDefaultDeclaration", node, opts);
+}
+function assertExportNamedDeclaration(node, opts) {
+ assert("ExportNamedDeclaration", node, opts);
+}
+function assertExportSpecifier(node, opts) {
+ assert("ExportSpecifier", node, opts);
+}
+function assertForOfStatement(node, opts) {
+ assert("ForOfStatement", node, opts);
+}
+function assertImportDeclaration(node, opts) {
+ assert("ImportDeclaration", node, opts);
+}
+function assertImportDefaultSpecifier(node, opts) {
+ assert("ImportDefaultSpecifier", node, opts);
+}
+function assertImportNamespaceSpecifier(node, opts) {
+ assert("ImportNamespaceSpecifier", node, opts);
+}
+function assertImportSpecifier(node, opts) {
+ assert("ImportSpecifier", node, opts);
+}
+function assertImportExpression(node, opts) {
+ assert("ImportExpression", node, opts);
+}
+function assertMetaProperty(node, opts) {
+ assert("MetaProperty", node, opts);
+}
+function assertClassMethod(node, opts) {
+ assert("ClassMethod", node, opts);
+}
+function assertObjectPattern(node, opts) {
+ assert("ObjectPattern", node, opts);
+}
+function assertSpreadElement(node, opts) {
+ assert("SpreadElement", node, opts);
+}
+function assertSuper(node, opts) {
+ assert("Super", node, opts);
+}
+function assertTaggedTemplateExpression(node, opts) {
+ assert("TaggedTemplateExpression", node, opts);
+}
+function assertTemplateElement(node, opts) {
+ assert("TemplateElement", node, opts);
+}
+function assertTemplateLiteral(node, opts) {
+ assert("TemplateLiteral", node, opts);
+}
+function assertYieldExpression(node, opts) {
+ assert("YieldExpression", node, opts);
+}
+function assertAwaitExpression(node, opts) {
+ assert("AwaitExpression", node, opts);
+}
+function assertImport(node, opts) {
+ assert("Import", node, opts);
+}
+function assertBigIntLiteral(node, opts) {
+ assert("BigIntLiteral", node, opts);
+}
+function assertExportNamespaceSpecifier(node, opts) {
+ assert("ExportNamespaceSpecifier", node, opts);
+}
+function assertOptionalMemberExpression(node, opts) {
+ assert("OptionalMemberExpression", node, opts);
+}
+function assertOptionalCallExpression(node, opts) {
+ assert("OptionalCallExpression", node, opts);
+}
+function assertClassProperty(node, opts) {
+ assert("ClassProperty", node, opts);
+}
+function assertClassAccessorProperty(node, opts) {
+ assert("ClassAccessorProperty", node, opts);
+}
+function assertClassPrivateProperty(node, opts) {
+ assert("ClassPrivateProperty", node, opts);
+}
+function assertClassPrivateMethod(node, opts) {
+ assert("ClassPrivateMethod", node, opts);
+}
+function assertPrivateName(node, opts) {
+ assert("PrivateName", node, opts);
+}
+function assertStaticBlock(node, opts) {
+ assert("StaticBlock", node, opts);
+}
+function assertImportAttribute(node, opts) {
+ assert("ImportAttribute", node, opts);
+}
+function assertAnyTypeAnnotation(node, opts) {
+ assert("AnyTypeAnnotation", node, opts);
+}
+function assertArrayTypeAnnotation(node, opts) {
+ assert("ArrayTypeAnnotation", node, opts);
+}
+function assertBooleanTypeAnnotation(node, opts) {
+ assert("BooleanTypeAnnotation", node, opts);
+}
+function assertBooleanLiteralTypeAnnotation(node, opts) {
+ assert("BooleanLiteralTypeAnnotation", node, opts);
+}
+function assertNullLiteralTypeAnnotation(node, opts) {
+ assert("NullLiteralTypeAnnotation", node, opts);
+}
+function assertClassImplements(node, opts) {
+ assert("ClassImplements", node, opts);
+}
+function assertDeclareClass(node, opts) {
+ assert("DeclareClass", node, opts);
+}
+function assertDeclareFunction(node, opts) {
+ assert("DeclareFunction", node, opts);
+}
+function assertDeclareInterface(node, opts) {
+ assert("DeclareInterface", node, opts);
+}
+function assertDeclareModule(node, opts) {
+ assert("DeclareModule", node, opts);
+}
+function assertDeclareModuleExports(node, opts) {
+ assert("DeclareModuleExports", node, opts);
+}
+function assertDeclareTypeAlias(node, opts) {
+ assert("DeclareTypeAlias", node, opts);
+}
+function assertDeclareOpaqueType(node, opts) {
+ assert("DeclareOpaqueType", node, opts);
+}
+function assertDeclareVariable(node, opts) {
+ assert("DeclareVariable", node, opts);
+}
+function assertDeclareExportDeclaration(node, opts) {
+ assert("DeclareExportDeclaration", node, opts);
+}
+function assertDeclareExportAllDeclaration(node, opts) {
+ assert("DeclareExportAllDeclaration", node, opts);
+}
+function assertDeclaredPredicate(node, opts) {
+ assert("DeclaredPredicate", node, opts);
+}
+function assertExistsTypeAnnotation(node, opts) {
+ assert("ExistsTypeAnnotation", node, opts);
+}
+function assertFunctionTypeAnnotation(node, opts) {
+ assert("FunctionTypeAnnotation", node, opts);
+}
+function assertFunctionTypeParam(node, opts) {
+ assert("FunctionTypeParam", node, opts);
+}
+function assertGenericTypeAnnotation(node, opts) {
+ assert("GenericTypeAnnotation", node, opts);
+}
+function assertInferredPredicate(node, opts) {
+ assert("InferredPredicate", node, opts);
+}
+function assertInterfaceExtends(node, opts) {
+ assert("InterfaceExtends", node, opts);
+}
+function assertInterfaceDeclaration(node, opts) {
+ assert("InterfaceDeclaration", node, opts);
+}
+function assertInterfaceTypeAnnotation(node, opts) {
+ assert("InterfaceTypeAnnotation", node, opts);
+}
+function assertIntersectionTypeAnnotation(node, opts) {
+ assert("IntersectionTypeAnnotation", node, opts);
+}
+function assertMixedTypeAnnotation(node, opts) {
+ assert("MixedTypeAnnotation", node, opts);
+}
+function assertEmptyTypeAnnotation(node, opts) {
+ assert("EmptyTypeAnnotation", node, opts);
+}
+function assertNullableTypeAnnotation(node, opts) {
+ assert("NullableTypeAnnotation", node, opts);
+}
+function assertNumberLiteralTypeAnnotation(node, opts) {
+ assert("NumberLiteralTypeAnnotation", node, opts);
+}
+function assertNumberTypeAnnotation(node, opts) {
+ assert("NumberTypeAnnotation", node, opts);
+}
+function assertObjectTypeAnnotation(node, opts) {
+ assert("ObjectTypeAnnotation", node, opts);
+}
+function assertObjectTypeInternalSlot(node, opts) {
+ assert("ObjectTypeInternalSlot", node, opts);
+}
+function assertObjectTypeCallProperty(node, opts) {
+ assert("ObjectTypeCallProperty", node, opts);
+}
+function assertObjectTypeIndexer(node, opts) {
+ assert("ObjectTypeIndexer", node, opts);
+}
+function assertObjectTypeProperty(node, opts) {
+ assert("ObjectTypeProperty", node, opts);
+}
+function assertObjectTypeSpreadProperty(node, opts) {
+ assert("ObjectTypeSpreadProperty", node, opts);
+}
+function assertOpaqueType(node, opts) {
+ assert("OpaqueType", node, opts);
+}
+function assertQualifiedTypeIdentifier(node, opts) {
+ assert("QualifiedTypeIdentifier", node, opts);
+}
+function assertStringLiteralTypeAnnotation(node, opts) {
+ assert("StringLiteralTypeAnnotation", node, opts);
+}
+function assertStringTypeAnnotation(node, opts) {
+ assert("StringTypeAnnotation", node, opts);
+}
+function assertSymbolTypeAnnotation(node, opts) {
+ assert("SymbolTypeAnnotation", node, opts);
+}
+function assertThisTypeAnnotation(node, opts) {
+ assert("ThisTypeAnnotation", node, opts);
+}
+function assertTupleTypeAnnotation(node, opts) {
+ assert("TupleTypeAnnotation", node, opts);
+}
+function assertTypeofTypeAnnotation(node, opts) {
+ assert("TypeofTypeAnnotation", node, opts);
+}
+function assertTypeAlias(node, opts) {
+ assert("TypeAlias", node, opts);
+}
+function assertTypeAnnotation(node, opts) {
+ assert("TypeAnnotation", node, opts);
+}
+function assertTypeCastExpression(node, opts) {
+ assert("TypeCastExpression", node, opts);
+}
+function assertTypeParameter(node, opts) {
+ assert("TypeParameter", node, opts);
+}
+function assertTypeParameterDeclaration(node, opts) {
+ assert("TypeParameterDeclaration", node, opts);
+}
+function assertTypeParameterInstantiation(node, opts) {
+ assert("TypeParameterInstantiation", node, opts);
+}
+function assertUnionTypeAnnotation(node, opts) {
+ assert("UnionTypeAnnotation", node, opts);
+}
+function assertVariance(node, opts) {
+ assert("Variance", node, opts);
+}
+function assertVoidTypeAnnotation(node, opts) {
+ assert("VoidTypeAnnotation", node, opts);
+}
+function assertEnumDeclaration(node, opts) {
+ assert("EnumDeclaration", node, opts);
+}
+function assertEnumBooleanBody(node, opts) {
+ assert("EnumBooleanBody", node, opts);
+}
+function assertEnumNumberBody(node, opts) {
+ assert("EnumNumberBody", node, opts);
+}
+function assertEnumStringBody(node, opts) {
+ assert("EnumStringBody", node, opts);
+}
+function assertEnumSymbolBody(node, opts) {
+ assert("EnumSymbolBody", node, opts);
+}
+function assertEnumBooleanMember(node, opts) {
+ assert("EnumBooleanMember", node, opts);
+}
+function assertEnumNumberMember(node, opts) {
+ assert("EnumNumberMember", node, opts);
+}
+function assertEnumStringMember(node, opts) {
+ assert("EnumStringMember", node, opts);
+}
+function assertEnumDefaultedMember(node, opts) {
+ assert("EnumDefaultedMember", node, opts);
+}
+function assertIndexedAccessType(node, opts) {
+ assert("IndexedAccessType", node, opts);
+}
+function assertOptionalIndexedAccessType(node, opts) {
+ assert("OptionalIndexedAccessType", node, opts);
+}
+function assertJSXAttribute(node, opts) {
+ assert("JSXAttribute", node, opts);
+}
+function assertJSXClosingElement(node, opts) {
+ assert("JSXClosingElement", node, opts);
+}
+function assertJSXElement(node, opts) {
+ assert("JSXElement", node, opts);
+}
+function assertJSXEmptyExpression(node, opts) {
+ assert("JSXEmptyExpression", node, opts);
+}
+function assertJSXExpressionContainer(node, opts) {
+ assert("JSXExpressionContainer", node, opts);
+}
+function assertJSXSpreadChild(node, opts) {
+ assert("JSXSpreadChild", node, opts);
+}
+function assertJSXIdentifier(node, opts) {
+ assert("JSXIdentifier", node, opts);
+}
+function assertJSXMemberExpression(node, opts) {
+ assert("JSXMemberExpression", node, opts);
+}
+function assertJSXNamespacedName(node, opts) {
+ assert("JSXNamespacedName", node, opts);
+}
+function assertJSXOpeningElement(node, opts) {
+ assert("JSXOpeningElement", node, opts);
+}
+function assertJSXSpreadAttribute(node, opts) {
+ assert("JSXSpreadAttribute", node, opts);
+}
+function assertJSXText(node, opts) {
+ assert("JSXText", node, opts);
+}
+function assertJSXFragment(node, opts) {
+ assert("JSXFragment", node, opts);
+}
+function assertJSXOpeningFragment(node, opts) {
+ assert("JSXOpeningFragment", node, opts);
+}
+function assertJSXClosingFragment(node, opts) {
+ assert("JSXClosingFragment", node, opts);
+}
+function assertNoop(node, opts) {
+ assert("Noop", node, opts);
+}
+function assertPlaceholder(node, opts) {
+ assert("Placeholder", node, opts);
+}
+function assertV8IntrinsicIdentifier(node, opts) {
+ assert("V8IntrinsicIdentifier", node, opts);
+}
+function assertArgumentPlaceholder(node, opts) {
+ assert("ArgumentPlaceholder", node, opts);
+}
+function assertBindExpression(node, opts) {
+ assert("BindExpression", node, opts);
+}
+function assertDecorator(node, opts) {
+ assert("Decorator", node, opts);
+}
+function assertDoExpression(node, opts) {
+ assert("DoExpression", node, opts);
+}
+function assertExportDefaultSpecifier(node, opts) {
+ assert("ExportDefaultSpecifier", node, opts);
+}
+function assertRecordExpression(node, opts) {
+ assert("RecordExpression", node, opts);
+}
+function assertTupleExpression(node, opts) {
+ assert("TupleExpression", node, opts);
+}
+function assertDecimalLiteral(node, opts) {
+ assert("DecimalLiteral", node, opts);
+}
+function assertModuleExpression(node, opts) {
+ assert("ModuleExpression", node, opts);
+}
+function assertTopicReference(node, opts) {
+ assert("TopicReference", node, opts);
+}
+function assertPipelineTopicExpression(node, opts) {
+ assert("PipelineTopicExpression", node, opts);
+}
+function assertPipelineBareFunction(node, opts) {
+ assert("PipelineBareFunction", node, opts);
+}
+function assertPipelinePrimaryTopicReference(node, opts) {
+ assert("PipelinePrimaryTopicReference", node, opts);
+}
+function assertTSParameterProperty(node, opts) {
+ assert("TSParameterProperty", node, opts);
+}
+function assertTSDeclareFunction(node, opts) {
+ assert("TSDeclareFunction", node, opts);
+}
+function assertTSDeclareMethod(node, opts) {
+ assert("TSDeclareMethod", node, opts);
+}
+function assertTSQualifiedName(node, opts) {
+ assert("TSQualifiedName", node, opts);
+}
+function assertTSCallSignatureDeclaration(node, opts) {
+ assert("TSCallSignatureDeclaration", node, opts);
+}
+function assertTSConstructSignatureDeclaration(node, opts) {
+ assert("TSConstructSignatureDeclaration", node, opts);
+}
+function assertTSPropertySignature(node, opts) {
+ assert("TSPropertySignature", node, opts);
+}
+function assertTSMethodSignature(node, opts) {
+ assert("TSMethodSignature", node, opts);
+}
+function assertTSIndexSignature(node, opts) {
+ assert("TSIndexSignature", node, opts);
+}
+function assertTSAnyKeyword(node, opts) {
+ assert("TSAnyKeyword", node, opts);
+}
+function assertTSBooleanKeyword(node, opts) {
+ assert("TSBooleanKeyword", node, opts);
+}
+function assertTSBigIntKeyword(node, opts) {
+ assert("TSBigIntKeyword", node, opts);
+}
+function assertTSIntrinsicKeyword(node, opts) {
+ assert("TSIntrinsicKeyword", node, opts);
+}
+function assertTSNeverKeyword(node, opts) {
+ assert("TSNeverKeyword", node, opts);
+}
+function assertTSNullKeyword(node, opts) {
+ assert("TSNullKeyword", node, opts);
+}
+function assertTSNumberKeyword(node, opts) {
+ assert("TSNumberKeyword", node, opts);
+}
+function assertTSObjectKeyword(node, opts) {
+ assert("TSObjectKeyword", node, opts);
+}
+function assertTSStringKeyword(node, opts) {
+ assert("TSStringKeyword", node, opts);
+}
+function assertTSSymbolKeyword(node, opts) {
+ assert("TSSymbolKeyword", node, opts);
+}
+function assertTSUndefinedKeyword(node, opts) {
+ assert("TSUndefinedKeyword", node, opts);
+}
+function assertTSUnknownKeyword(node, opts) {
+ assert("TSUnknownKeyword", node, opts);
+}
+function assertTSVoidKeyword(node, opts) {
+ assert("TSVoidKeyword", node, opts);
+}
+function assertTSThisType(node, opts) {
+ assert("TSThisType", node, opts);
+}
+function assertTSFunctionType(node, opts) {
+ assert("TSFunctionType", node, opts);
+}
+function assertTSConstructorType(node, opts) {
+ assert("TSConstructorType", node, opts);
+}
+function assertTSTypeReference(node, opts) {
+ assert("TSTypeReference", node, opts);
+}
+function assertTSTypePredicate(node, opts) {
+ assert("TSTypePredicate", node, opts);
+}
+function assertTSTypeQuery(node, opts) {
+ assert("TSTypeQuery", node, opts);
+}
+function assertTSTypeLiteral(node, opts) {
+ assert("TSTypeLiteral", node, opts);
+}
+function assertTSArrayType(node, opts) {
+ assert("TSArrayType", node, opts);
+}
+function assertTSTupleType(node, opts) {
+ assert("TSTupleType", node, opts);
+}
+function assertTSOptionalType(node, opts) {
+ assert("TSOptionalType", node, opts);
+}
+function assertTSRestType(node, opts) {
+ assert("TSRestType", node, opts);
+}
+function assertTSNamedTupleMember(node, opts) {
+ assert("TSNamedTupleMember", node, opts);
+}
+function assertTSUnionType(node, opts) {
+ assert("TSUnionType", node, opts);
+}
+function assertTSIntersectionType(node, opts) {
+ assert("TSIntersectionType", node, opts);
+}
+function assertTSConditionalType(node, opts) {
+ assert("TSConditionalType", node, opts);
+}
+function assertTSInferType(node, opts) {
+ assert("TSInferType", node, opts);
+}
+function assertTSParenthesizedType(node, opts) {
+ assert("TSParenthesizedType", node, opts);
+}
+function assertTSTypeOperator(node, opts) {
+ assert("TSTypeOperator", node, opts);
+}
+function assertTSIndexedAccessType(node, opts) {
+ assert("TSIndexedAccessType", node, opts);
+}
+function assertTSMappedType(node, opts) {
+ assert("TSMappedType", node, opts);
+}
+function assertTSTemplateLiteralType(node, opts) {
+ assert("TSTemplateLiteralType", node, opts);
+}
+function assertTSLiteralType(node, opts) {
+ assert("TSLiteralType", node, opts);
+}
+function assertTSExpressionWithTypeArguments(node, opts) {
+ assert("TSExpressionWithTypeArguments", node, opts);
+}
+function assertTSInterfaceDeclaration(node, opts) {
+ assert("TSInterfaceDeclaration", node, opts);
+}
+function assertTSInterfaceBody(node, opts) {
+ assert("TSInterfaceBody", node, opts);
+}
+function assertTSTypeAliasDeclaration(node, opts) {
+ assert("TSTypeAliasDeclaration", node, opts);
+}
+function assertTSInstantiationExpression(node, opts) {
+ assert("TSInstantiationExpression", node, opts);
+}
+function assertTSAsExpression(node, opts) {
+ assert("TSAsExpression", node, opts);
+}
+function assertTSSatisfiesExpression(node, opts) {
+ assert("TSSatisfiesExpression", node, opts);
+}
+function assertTSTypeAssertion(node, opts) {
+ assert("TSTypeAssertion", node, opts);
+}
+function assertTSEnumBody(node, opts) {
+ assert("TSEnumBody", node, opts);
+}
+function assertTSEnumDeclaration(node, opts) {
+ assert("TSEnumDeclaration", node, opts);
+}
+function assertTSEnumMember(node, opts) {
+ assert("TSEnumMember", node, opts);
+}
+function assertTSModuleDeclaration(node, opts) {
+ assert("TSModuleDeclaration", node, opts);
+}
+function assertTSModuleBlock(node, opts) {
+ assert("TSModuleBlock", node, opts);
+}
+function assertTSImportType(node, opts) {
+ assert("TSImportType", node, opts);
+}
+function assertTSImportEqualsDeclaration(node, opts) {
+ assert("TSImportEqualsDeclaration", node, opts);
+}
+function assertTSExternalModuleReference(node, opts) {
+ assert("TSExternalModuleReference", node, opts);
+}
+function assertTSNonNullExpression(node, opts) {
+ assert("TSNonNullExpression", node, opts);
+}
+function assertTSExportAssignment(node, opts) {
+ assert("TSExportAssignment", node, opts);
+}
+function assertTSNamespaceExportDeclaration(node, opts) {
+ assert("TSNamespaceExportDeclaration", node, opts);
+}
+function assertTSTypeAnnotation(node, opts) {
+ assert("TSTypeAnnotation", node, opts);
+}
+function assertTSTypeParameterInstantiation(node, opts) {
+ assert("TSTypeParameterInstantiation", node, opts);
+}
+function assertTSTypeParameterDeclaration(node, opts) {
+ assert("TSTypeParameterDeclaration", node, opts);
+}
+function assertTSTypeParameter(node, opts) {
+ assert("TSTypeParameter", node, opts);
+}
+function assertStandardized(node, opts) {
+ assert("Standardized", node, opts);
+}
+function assertExpression(node, opts) {
+ assert("Expression", node, opts);
+}
+function assertBinary(node, opts) {
+ assert("Binary", node, opts);
+}
+function assertScopable(node, opts) {
+ assert("Scopable", node, opts);
+}
+function assertBlockParent(node, opts) {
+ assert("BlockParent", node, opts);
+}
+function assertBlock(node, opts) {
+ assert("Block", node, opts);
+}
+function assertStatement(node, opts) {
+ assert("Statement", node, opts);
+}
+function assertTerminatorless(node, opts) {
+ assert("Terminatorless", node, opts);
+}
+function assertCompletionStatement(node, opts) {
+ assert("CompletionStatement", node, opts);
+}
+function assertConditional(node, opts) {
+ assert("Conditional", node, opts);
+}
+function assertLoop(node, opts) {
+ assert("Loop", node, opts);
+}
+function assertWhile(node, opts) {
+ assert("While", node, opts);
+}
+function assertExpressionWrapper(node, opts) {
+ assert("ExpressionWrapper", node, opts);
+}
+function assertFor(node, opts) {
+ assert("For", node, opts);
+}
+function assertForXStatement(node, opts) {
+ assert("ForXStatement", node, opts);
+}
+function assertFunction(node, opts) {
+ assert("Function", node, opts);
+}
+function assertFunctionParent(node, opts) {
+ assert("FunctionParent", node, opts);
+}
+function assertPureish(node, opts) {
+ assert("Pureish", node, opts);
+}
+function assertDeclaration(node, opts) {
+ assert("Declaration", node, opts);
+}
+function assertPatternLike(node, opts) {
+ assert("PatternLike", node, opts);
+}
+function assertLVal(node, opts) {
+ assert("LVal", node, opts);
+}
+function assertTSEntityName(node, opts) {
+ assert("TSEntityName", node, opts);
+}
+function assertLiteral(node, opts) {
+ assert("Literal", node, opts);
+}
+function assertImmutable(node, opts) {
+ assert("Immutable", node, opts);
+}
+function assertUserWhitespacable(node, opts) {
+ assert("UserWhitespacable", node, opts);
+}
+function assertMethod(node, opts) {
+ assert("Method", node, opts);
+}
+function assertObjectMember(node, opts) {
+ assert("ObjectMember", node, opts);
+}
+function assertProperty(node, opts) {
+ assert("Property", node, opts);
+}
+function assertUnaryLike(node, opts) {
+ assert("UnaryLike", node, opts);
+}
+function assertPattern(node, opts) {
+ assert("Pattern", node, opts);
+}
+function assertClass(node, opts) {
+ assert("Class", node, opts);
+}
+function assertImportOrExportDeclaration(node, opts) {
+ assert("ImportOrExportDeclaration", node, opts);
+}
+function assertExportDeclaration(node, opts) {
+ assert("ExportDeclaration", node, opts);
+}
+function assertModuleSpecifier(node, opts) {
+ assert("ModuleSpecifier", node, opts);
+}
+function assertAccessor(node, opts) {
+ assert("Accessor", node, opts);
+}
+function assertPrivate(node, opts) {
+ assert("Private", node, opts);
+}
+function assertFlow(node, opts) {
+ assert("Flow", node, opts);
+}
+function assertFlowType(node, opts) {
+ assert("FlowType", node, opts);
+}
+function assertFlowBaseAnnotation(node, opts) {
+ assert("FlowBaseAnnotation", node, opts);
+}
+function assertFlowDeclaration(node, opts) {
+ assert("FlowDeclaration", node, opts);
+}
+function assertFlowPredicate(node, opts) {
+ assert("FlowPredicate", node, opts);
+}
+function assertEnumBody(node, opts) {
+ assert("EnumBody", node, opts);
+}
+function assertEnumMember(node, opts) {
+ assert("EnumMember", node, opts);
+}
+function assertJSX(node, opts) {
+ assert("JSX", node, opts);
+}
+function assertMiscellaneous(node, opts) {
+ assert("Miscellaneous", node, opts);
+}
+function assertTypeScript(node, opts) {
+ assert("TypeScript", node, opts);
+}
+function assertTSTypeElement(node, opts) {
+ assert("TSTypeElement", node, opts);
+}
+function assertTSType(node, opts) {
+ assert("TSType", node, opts);
+}
+function assertTSBaseType(node, opts) {
+ assert("TSBaseType", node, opts);
+}
+function assertNumberLiteral(node, opts) {
+ (0, _deprecationWarning.default)("assertNumberLiteral", "assertNumericLiteral");
+ assert("NumberLiteral", node, opts);
+}
+function assertRegexLiteral(node, opts) {
+ (0, _deprecationWarning.default)("assertRegexLiteral", "assertRegExpLiteral");
+ assert("RegexLiteral", node, opts);
+}
+function assertRestProperty(node, opts) {
+ (0, _deprecationWarning.default)("assertRestProperty", "assertRestElement");
+ assert("RestProperty", node, opts);
+}
+function assertSpreadProperty(node, opts) {
+ (0, _deprecationWarning.default)("assertSpreadProperty", "assertSpreadElement");
+ assert("SpreadProperty", node, opts);
+}
+function assertModuleDeclaration(node, opts) {
+ (0, _deprecationWarning.default)("assertModuleDeclaration", "assertImportOrExportDeclaration");
+ assert("ModuleDeclaration", node, opts);
+}
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 5953:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
}));
-Object.defineProperty(exports, "VoidTypeAnnotation", ({
- enumerable: true,
- get: function () {
- return _lowercase.voidTypeAnnotation;
+exports["default"] = createFlowUnionType;
+var _index = __nccwpck_require__(9380);
+var _removeTypeDuplicates = __nccwpck_require__(1009);
+function createFlowUnionType(types) {
+ const flattened = (0, _removeTypeDuplicates.default)(types);
+ if (flattened.length === 1) {
+ return flattened[0];
+ } else {
+ return (0, _index.unionTypeAnnotation)(flattened);
}
+}
+
+//# sourceMappingURL=createFlowUnionType.js.map
+
+
+/***/ }),
+
+/***/ 9829:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
}));
-Object.defineProperty(exports, "WhileStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.whileStatement;
+exports["default"] = void 0;
+var _index = __nccwpck_require__(9380);
+var _default = exports["default"] = createTypeAnnotationBasedOnTypeof;
+function createTypeAnnotationBasedOnTypeof(type) {
+ switch (type) {
+ case "string":
+ return (0, _index.stringTypeAnnotation)();
+ case "number":
+ return (0, _index.numberTypeAnnotation)();
+ case "undefined":
+ return (0, _index.voidTypeAnnotation)();
+ case "boolean":
+ return (0, _index.booleanTypeAnnotation)();
+ case "function":
+ return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Function"));
+ case "object":
+ return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Object"));
+ case "symbol":
+ return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Symbol"));
+ case "bigint":
+ return (0, _index.anyTypeAnnotation)();
}
+ throw new Error("Invalid typeof value: " + type);
+}
+
+//# sourceMappingURL=createTypeAnnotationBasedOnTypeof.js.map
+
+
+/***/ }),
+
+/***/ 9380:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
}));
-Object.defineProperty(exports, "WithStatement", ({
- enumerable: true,
- get: function () {
- return _lowercase.withStatement;
- }
+var _lowercase = __nccwpck_require__(9130);
+Object.keys(_lowercase).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (key in exports && exports[key] === _lowercase[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _lowercase[key];
+ }
+ });
+});
+var _uppercase = __nccwpck_require__(8530);
+Object.keys(_uppercase).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (key in exports && exports[key] === _uppercase[key]) return;
+ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: function () {
+ return _uppercase[key];
+ }
+ });
+});
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
+
+/***/ 9130:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
}));
-Object.defineProperty(exports, "YieldExpression", ({
- enumerable: true,
- get: function () {
- return _lowercase.yieldExpression;
- }
+exports.anyTypeAnnotation = anyTypeAnnotation;
+exports.argumentPlaceholder = argumentPlaceholder;
+exports.arrayExpression = arrayExpression;
+exports.arrayPattern = arrayPattern;
+exports.arrayTypeAnnotation = arrayTypeAnnotation;
+exports.arrowFunctionExpression = arrowFunctionExpression;
+exports.assignmentExpression = assignmentExpression;
+exports.assignmentPattern = assignmentPattern;
+exports.awaitExpression = awaitExpression;
+exports.bigIntLiteral = bigIntLiteral;
+exports.binaryExpression = binaryExpression;
+exports.bindExpression = bindExpression;
+exports.blockStatement = blockStatement;
+exports.booleanLiteral = booleanLiteral;
+exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation;
+exports.booleanTypeAnnotation = booleanTypeAnnotation;
+exports.breakStatement = breakStatement;
+exports.callExpression = callExpression;
+exports.catchClause = catchClause;
+exports.classAccessorProperty = classAccessorProperty;
+exports.classBody = classBody;
+exports.classDeclaration = classDeclaration;
+exports.classExpression = classExpression;
+exports.classImplements = classImplements;
+exports.classMethod = classMethod;
+exports.classPrivateMethod = classPrivateMethod;
+exports.classPrivateProperty = classPrivateProperty;
+exports.classProperty = classProperty;
+exports.conditionalExpression = conditionalExpression;
+exports.continueStatement = continueStatement;
+exports.debuggerStatement = debuggerStatement;
+exports.decimalLiteral = decimalLiteral;
+exports.declareClass = declareClass;
+exports.declareExportAllDeclaration = declareExportAllDeclaration;
+exports.declareExportDeclaration = declareExportDeclaration;
+exports.declareFunction = declareFunction;
+exports.declareInterface = declareInterface;
+exports.declareModule = declareModule;
+exports.declareModuleExports = declareModuleExports;
+exports.declareOpaqueType = declareOpaqueType;
+exports.declareTypeAlias = declareTypeAlias;
+exports.declareVariable = declareVariable;
+exports.declaredPredicate = declaredPredicate;
+exports.decorator = decorator;
+exports.directive = directive;
+exports.directiveLiteral = directiveLiteral;
+exports.doExpression = doExpression;
+exports.doWhileStatement = doWhileStatement;
+exports.emptyStatement = emptyStatement;
+exports.emptyTypeAnnotation = emptyTypeAnnotation;
+exports.enumBooleanBody = enumBooleanBody;
+exports.enumBooleanMember = enumBooleanMember;
+exports.enumDeclaration = enumDeclaration;
+exports.enumDefaultedMember = enumDefaultedMember;
+exports.enumNumberBody = enumNumberBody;
+exports.enumNumberMember = enumNumberMember;
+exports.enumStringBody = enumStringBody;
+exports.enumStringMember = enumStringMember;
+exports.enumSymbolBody = enumSymbolBody;
+exports.existsTypeAnnotation = existsTypeAnnotation;
+exports.exportAllDeclaration = exportAllDeclaration;
+exports.exportDefaultDeclaration = exportDefaultDeclaration;
+exports.exportDefaultSpecifier = exportDefaultSpecifier;
+exports.exportNamedDeclaration = exportNamedDeclaration;
+exports.exportNamespaceSpecifier = exportNamespaceSpecifier;
+exports.exportSpecifier = exportSpecifier;
+exports.expressionStatement = expressionStatement;
+exports.file = file;
+exports.forInStatement = forInStatement;
+exports.forOfStatement = forOfStatement;
+exports.forStatement = forStatement;
+exports.functionDeclaration = functionDeclaration;
+exports.functionExpression = functionExpression;
+exports.functionTypeAnnotation = functionTypeAnnotation;
+exports.functionTypeParam = functionTypeParam;
+exports.genericTypeAnnotation = genericTypeAnnotation;
+exports.identifier = identifier;
+exports.ifStatement = ifStatement;
+exports["import"] = _import;
+exports.importAttribute = importAttribute;
+exports.importDeclaration = importDeclaration;
+exports.importDefaultSpecifier = importDefaultSpecifier;
+exports.importExpression = importExpression;
+exports.importNamespaceSpecifier = importNamespaceSpecifier;
+exports.importSpecifier = importSpecifier;
+exports.indexedAccessType = indexedAccessType;
+exports.inferredPredicate = inferredPredicate;
+exports.interfaceDeclaration = interfaceDeclaration;
+exports.interfaceExtends = interfaceExtends;
+exports.interfaceTypeAnnotation = interfaceTypeAnnotation;
+exports.interpreterDirective = interpreterDirective;
+exports.intersectionTypeAnnotation = intersectionTypeAnnotation;
+exports.jSXAttribute = exports.jsxAttribute = jsxAttribute;
+exports.jSXClosingElement = exports.jsxClosingElement = jsxClosingElement;
+exports.jSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment;
+exports.jSXElement = exports.jsxElement = jsxElement;
+exports.jSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression;
+exports.jSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer;
+exports.jSXFragment = exports.jsxFragment = jsxFragment;
+exports.jSXIdentifier = exports.jsxIdentifier = jsxIdentifier;
+exports.jSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression;
+exports.jSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName;
+exports.jSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement;
+exports.jSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment;
+exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute;
+exports.jSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild;
+exports.jSXText = exports.jsxText = jsxText;
+exports.labeledStatement = labeledStatement;
+exports.logicalExpression = logicalExpression;
+exports.memberExpression = memberExpression;
+exports.metaProperty = metaProperty;
+exports.mixedTypeAnnotation = mixedTypeAnnotation;
+exports.moduleExpression = moduleExpression;
+exports.newExpression = newExpression;
+exports.noop = noop;
+exports.nullLiteral = nullLiteral;
+exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation;
+exports.nullableTypeAnnotation = nullableTypeAnnotation;
+exports.numberLiteral = NumberLiteral;
+exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation;
+exports.numberTypeAnnotation = numberTypeAnnotation;
+exports.numericLiteral = numericLiteral;
+exports.objectExpression = objectExpression;
+exports.objectMethod = objectMethod;
+exports.objectPattern = objectPattern;
+exports.objectProperty = objectProperty;
+exports.objectTypeAnnotation = objectTypeAnnotation;
+exports.objectTypeCallProperty = objectTypeCallProperty;
+exports.objectTypeIndexer = objectTypeIndexer;
+exports.objectTypeInternalSlot = objectTypeInternalSlot;
+exports.objectTypeProperty = objectTypeProperty;
+exports.objectTypeSpreadProperty = objectTypeSpreadProperty;
+exports.opaqueType = opaqueType;
+exports.optionalCallExpression = optionalCallExpression;
+exports.optionalIndexedAccessType = optionalIndexedAccessType;
+exports.optionalMemberExpression = optionalMemberExpression;
+exports.parenthesizedExpression = parenthesizedExpression;
+exports.pipelineBareFunction = pipelineBareFunction;
+exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference;
+exports.pipelineTopicExpression = pipelineTopicExpression;
+exports.placeholder = placeholder;
+exports.privateName = privateName;
+exports.program = program;
+exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier;
+exports.recordExpression = recordExpression;
+exports.regExpLiteral = regExpLiteral;
+exports.regexLiteral = RegexLiteral;
+exports.restElement = restElement;
+exports.restProperty = RestProperty;
+exports.returnStatement = returnStatement;
+exports.sequenceExpression = sequenceExpression;
+exports.spreadElement = spreadElement;
+exports.spreadProperty = SpreadProperty;
+exports.staticBlock = staticBlock;
+exports.stringLiteral = stringLiteral;
+exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation;
+exports.stringTypeAnnotation = stringTypeAnnotation;
+exports["super"] = _super;
+exports.switchCase = switchCase;
+exports.switchStatement = switchStatement;
+exports.symbolTypeAnnotation = symbolTypeAnnotation;
+exports.taggedTemplateExpression = taggedTemplateExpression;
+exports.templateElement = templateElement;
+exports.templateLiteral = templateLiteral;
+exports.thisExpression = thisExpression;
+exports.thisTypeAnnotation = thisTypeAnnotation;
+exports.throwStatement = throwStatement;
+exports.topicReference = topicReference;
+exports.tryStatement = tryStatement;
+exports.tSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword;
+exports.tSArrayType = exports.tsArrayType = tsArrayType;
+exports.tSAsExpression = exports.tsAsExpression = tsAsExpression;
+exports.tSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword;
+exports.tSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword;
+exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration;
+exports.tSConditionalType = exports.tsConditionalType = tsConditionalType;
+exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration;
+exports.tSConstructorType = exports.tsConstructorType = tsConstructorType;
+exports.tSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction;
+exports.tSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod;
+exports.tSEnumBody = exports.tsEnumBody = tsEnumBody;
+exports.tSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration;
+exports.tSEnumMember = exports.tsEnumMember = tsEnumMember;
+exports.tSExportAssignment = exports.tsExportAssignment = tsExportAssignment;
+exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments;
+exports.tSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference;
+exports.tSFunctionType = exports.tsFunctionType = tsFunctionType;
+exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration;
+exports.tSImportType = exports.tsImportType = tsImportType;
+exports.tSIndexSignature = exports.tsIndexSignature = tsIndexSignature;
+exports.tSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType;
+exports.tSInferType = exports.tsInferType = tsInferType;
+exports.tSInstantiationExpression = exports.tsInstantiationExpression = tsInstantiationExpression;
+exports.tSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody;
+exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration;
+exports.tSIntersectionType = exports.tsIntersectionType = tsIntersectionType;
+exports.tSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword;
+exports.tSLiteralType = exports.tsLiteralType = tsLiteralType;
+exports.tSMappedType = exports.tsMappedType = tsMappedType;
+exports.tSMethodSignature = exports.tsMethodSignature = tsMethodSignature;
+exports.tSModuleBlock = exports.tsModuleBlock = tsModuleBlock;
+exports.tSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration;
+exports.tSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember;
+exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration;
+exports.tSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword;
+exports.tSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression;
+exports.tSNullKeyword = exports.tsNullKeyword = tsNullKeyword;
+exports.tSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword;
+exports.tSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword;
+exports.tSOptionalType = exports.tsOptionalType = tsOptionalType;
+exports.tSParameterProperty = exports.tsParameterProperty = tsParameterProperty;
+exports.tSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType;
+exports.tSPropertySignature = exports.tsPropertySignature = tsPropertySignature;
+exports.tSQualifiedName = exports.tsQualifiedName = tsQualifiedName;
+exports.tSRestType = exports.tsRestType = tsRestType;
+exports.tSSatisfiesExpression = exports.tsSatisfiesExpression = tsSatisfiesExpression;
+exports.tSStringKeyword = exports.tsStringKeyword = tsStringKeyword;
+exports.tSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword;
+exports.tSTemplateLiteralType = exports.tsTemplateLiteralType = tsTemplateLiteralType;
+exports.tSThisType = exports.tsThisType = tsThisType;
+exports.tSTupleType = exports.tsTupleType = tsTupleType;
+exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration;
+exports.tSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation;
+exports.tSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion;
+exports.tSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral;
+exports.tSTypeOperator = exports.tsTypeOperator = tsTypeOperator;
+exports.tSTypeParameter = exports.tsTypeParameter = tsTypeParameter;
+exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration;
+exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation;
+exports.tSTypePredicate = exports.tsTypePredicate = tsTypePredicate;
+exports.tSTypeQuery = exports.tsTypeQuery = tsTypeQuery;
+exports.tSTypeReference = exports.tsTypeReference = tsTypeReference;
+exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword;
+exports.tSUnionType = exports.tsUnionType = tsUnionType;
+exports.tSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword;
+exports.tSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword;
+exports.tupleExpression = tupleExpression;
+exports.tupleTypeAnnotation = tupleTypeAnnotation;
+exports.typeAlias = typeAlias;
+exports.typeAnnotation = typeAnnotation;
+exports.typeCastExpression = typeCastExpression;
+exports.typeParameter = typeParameter;
+exports.typeParameterDeclaration = typeParameterDeclaration;
+exports.typeParameterInstantiation = typeParameterInstantiation;
+exports.typeofTypeAnnotation = typeofTypeAnnotation;
+exports.unaryExpression = unaryExpression;
+exports.unionTypeAnnotation = unionTypeAnnotation;
+exports.updateExpression = updateExpression;
+exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier;
+exports.variableDeclaration = variableDeclaration;
+exports.variableDeclarator = variableDeclarator;
+exports.variance = variance;
+exports.voidTypeAnnotation = voidTypeAnnotation;
+exports.whileStatement = whileStatement;
+exports.withStatement = withStatement;
+exports.yieldExpression = yieldExpression;
+var _validate = __nccwpck_require__(8036);
+var _deprecationWarning = __nccwpck_require__(496);
+var utils = __nccwpck_require__(4106);
+const {
+ validateInternal: validate
+} = _validate;
+const {
+ NODE_FIELDS
+} = utils;
+function arrayExpression(elements = []) {
+ const node = {
+ type: "ArrayExpression",
+ elements
+ };
+ const defs = NODE_FIELDS.ArrayExpression;
+ validate(defs.elements, node, "elements", elements, 1);
+ return node;
+}
+function assignmentExpression(operator, left, right) {
+ const node = {
+ type: "AssignmentExpression",
+ operator,
+ left,
+ right
+ };
+ const defs = NODE_FIELDS.AssignmentExpression;
+ validate(defs.operator, node, "operator", operator);
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function binaryExpression(operator, left, right) {
+ const node = {
+ type: "BinaryExpression",
+ operator,
+ left,
+ right
+ };
+ const defs = NODE_FIELDS.BinaryExpression;
+ validate(defs.operator, node, "operator", operator);
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function interpreterDirective(value) {
+ const node = {
+ type: "InterpreterDirective",
+ value
+ };
+ const defs = NODE_FIELDS.InterpreterDirective;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function directive(value) {
+ const node = {
+ type: "Directive",
+ value
+ };
+ const defs = NODE_FIELDS.Directive;
+ validate(defs.value, node, "value", value, 1);
+ return node;
+}
+function directiveLiteral(value) {
+ const node = {
+ type: "DirectiveLiteral",
+ value
+ };
+ const defs = NODE_FIELDS.DirectiveLiteral;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function blockStatement(body, directives = []) {
+ const node = {
+ type: "BlockStatement",
+ body,
+ directives
+ };
+ const defs = NODE_FIELDS.BlockStatement;
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.directives, node, "directives", directives, 1);
+ return node;
+}
+function breakStatement(label = null) {
+ const node = {
+ type: "BreakStatement",
+ label
+ };
+ const defs = NODE_FIELDS.BreakStatement;
+ validate(defs.label, node, "label", label, 1);
+ return node;
+}
+function callExpression(callee, _arguments) {
+ const node = {
+ type: "CallExpression",
+ callee,
+ arguments: _arguments
+ };
+ const defs = NODE_FIELDS.CallExpression;
+ validate(defs.callee, node, "callee", callee, 1);
+ validate(defs.arguments, node, "arguments", _arguments, 1);
+ return node;
+}
+function catchClause(param = null, body) {
+ const node = {
+ type: "CatchClause",
+ param,
+ body
+ };
+ const defs = NODE_FIELDS.CatchClause;
+ validate(defs.param, node, "param", param, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function conditionalExpression(test, consequent, alternate) {
+ const node = {
+ type: "ConditionalExpression",
+ test,
+ consequent,
+ alternate
+ };
+ const defs = NODE_FIELDS.ConditionalExpression;
+ validate(defs.test, node, "test", test, 1);
+ validate(defs.consequent, node, "consequent", consequent, 1);
+ validate(defs.alternate, node, "alternate", alternate, 1);
+ return node;
+}
+function continueStatement(label = null) {
+ const node = {
+ type: "ContinueStatement",
+ label
+ };
+ const defs = NODE_FIELDS.ContinueStatement;
+ validate(defs.label, node, "label", label, 1);
+ return node;
+}
+function debuggerStatement() {
+ return {
+ type: "DebuggerStatement"
+ };
+}
+function doWhileStatement(test, body) {
+ const node = {
+ type: "DoWhileStatement",
+ test,
+ body
+ };
+ const defs = NODE_FIELDS.DoWhileStatement;
+ validate(defs.test, node, "test", test, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function emptyStatement() {
+ return {
+ type: "EmptyStatement"
+ };
+}
+function expressionStatement(expression) {
+ const node = {
+ type: "ExpressionStatement",
+ expression
+ };
+ const defs = NODE_FIELDS.ExpressionStatement;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function file(program, comments = null, tokens = null) {
+ const node = {
+ type: "File",
+ program,
+ comments,
+ tokens
+ };
+ const defs = NODE_FIELDS.File;
+ validate(defs.program, node, "program", program, 1);
+ validate(defs.comments, node, "comments", comments, 1);
+ validate(defs.tokens, node, "tokens", tokens);
+ return node;
+}
+function forInStatement(left, right, body) {
+ const node = {
+ type: "ForInStatement",
+ left,
+ right,
+ body
+ };
+ const defs = NODE_FIELDS.ForInStatement;
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function forStatement(init = null, test = null, update = null, body) {
+ const node = {
+ type: "ForStatement",
+ init,
+ test,
+ update,
+ body
+ };
+ const defs = NODE_FIELDS.ForStatement;
+ validate(defs.init, node, "init", init, 1);
+ validate(defs.test, node, "test", test, 1);
+ validate(defs.update, node, "update", update, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function functionDeclaration(id = null, params, body, generator = false, async = false) {
+ const node = {
+ type: "FunctionDeclaration",
+ id,
+ params,
+ body,
+ generator,
+ async
+ };
+ const defs = NODE_FIELDS.FunctionDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.generator, node, "generator", generator);
+ validate(defs.async, node, "async", async);
+ return node;
+}
+function functionExpression(id = null, params, body, generator = false, async = false) {
+ const node = {
+ type: "FunctionExpression",
+ id,
+ params,
+ body,
+ generator,
+ async
+ };
+ const defs = NODE_FIELDS.FunctionExpression;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.generator, node, "generator", generator);
+ validate(defs.async, node, "async", async);
+ return node;
+}
+function identifier(name) {
+ const node = {
+ type: "Identifier",
+ name
+ };
+ const defs = NODE_FIELDS.Identifier;
+ validate(defs.name, node, "name", name);
+ return node;
+}
+function ifStatement(test, consequent, alternate = null) {
+ const node = {
+ type: "IfStatement",
+ test,
+ consequent,
+ alternate
+ };
+ const defs = NODE_FIELDS.IfStatement;
+ validate(defs.test, node, "test", test, 1);
+ validate(defs.consequent, node, "consequent", consequent, 1);
+ validate(defs.alternate, node, "alternate", alternate, 1);
+ return node;
+}
+function labeledStatement(label, body) {
+ const node = {
+ type: "LabeledStatement",
+ label,
+ body
+ };
+ const defs = NODE_FIELDS.LabeledStatement;
+ validate(defs.label, node, "label", label, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function stringLiteral(value) {
+ const node = {
+ type: "StringLiteral",
+ value
+ };
+ const defs = NODE_FIELDS.StringLiteral;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function numericLiteral(value) {
+ const node = {
+ type: "NumericLiteral",
+ value
+ };
+ const defs = NODE_FIELDS.NumericLiteral;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function nullLiteral() {
+ return {
+ type: "NullLiteral"
+ };
+}
+function booleanLiteral(value) {
+ const node = {
+ type: "BooleanLiteral",
+ value
+ };
+ const defs = NODE_FIELDS.BooleanLiteral;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function regExpLiteral(pattern, flags = "") {
+ const node = {
+ type: "RegExpLiteral",
+ pattern,
+ flags
+ };
+ const defs = NODE_FIELDS.RegExpLiteral;
+ validate(defs.pattern, node, "pattern", pattern);
+ validate(defs.flags, node, "flags", flags);
+ return node;
+}
+function logicalExpression(operator, left, right) {
+ const node = {
+ type: "LogicalExpression",
+ operator,
+ left,
+ right
+ };
+ const defs = NODE_FIELDS.LogicalExpression;
+ validate(defs.operator, node, "operator", operator);
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function memberExpression(object, property, computed = false, optional = null) {
+ const node = {
+ type: "MemberExpression",
+ object,
+ property,
+ computed,
+ optional
+ };
+ const defs = NODE_FIELDS.MemberExpression;
+ validate(defs.object, node, "object", object, 1);
+ validate(defs.property, node, "property", property, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.optional, node, "optional", optional);
+ return node;
+}
+function newExpression(callee, _arguments) {
+ const node = {
+ type: "NewExpression",
+ callee,
+ arguments: _arguments
+ };
+ const defs = NODE_FIELDS.NewExpression;
+ validate(defs.callee, node, "callee", callee, 1);
+ validate(defs.arguments, node, "arguments", _arguments, 1);
+ return node;
+}
+function program(body, directives = [], sourceType = "script", interpreter = null) {
+ const node = {
+ type: "Program",
+ body,
+ directives,
+ sourceType,
+ interpreter
+ };
+ const defs = NODE_FIELDS.Program;
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.directives, node, "directives", directives, 1);
+ validate(defs.sourceType, node, "sourceType", sourceType);
+ validate(defs.interpreter, node, "interpreter", interpreter, 1);
+ return node;
+}
+function objectExpression(properties) {
+ const node = {
+ type: "ObjectExpression",
+ properties
+ };
+ const defs = NODE_FIELDS.ObjectExpression;
+ validate(defs.properties, node, "properties", properties, 1);
+ return node;
+}
+function objectMethod(kind = "method", key, params, body, computed = false, generator = false, async = false) {
+ const node = {
+ type: "ObjectMethod",
+ kind,
+ key,
+ params,
+ body,
+ computed,
+ generator,
+ async
+ };
+ const defs = NODE_FIELDS.ObjectMethod;
+ validate(defs.kind, node, "kind", kind);
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.generator, node, "generator", generator);
+ validate(defs.async, node, "async", async);
+ return node;
+}
+function objectProperty(key, value, computed = false, shorthand = false, decorators = null) {
+ const node = {
+ type: "ObjectProperty",
+ key,
+ value,
+ computed,
+ shorthand,
+ decorators
+ };
+ const defs = NODE_FIELDS.ObjectProperty;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.shorthand, node, "shorthand", shorthand);
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ return node;
+}
+function restElement(argument) {
+ const node = {
+ type: "RestElement",
+ argument
+ };
+ const defs = NODE_FIELDS.RestElement;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function returnStatement(argument = null) {
+ const node = {
+ type: "ReturnStatement",
+ argument
+ };
+ const defs = NODE_FIELDS.ReturnStatement;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function sequenceExpression(expressions) {
+ const node = {
+ type: "SequenceExpression",
+ expressions
+ };
+ const defs = NODE_FIELDS.SequenceExpression;
+ validate(defs.expressions, node, "expressions", expressions, 1);
+ return node;
+}
+function parenthesizedExpression(expression) {
+ const node = {
+ type: "ParenthesizedExpression",
+ expression
+ };
+ const defs = NODE_FIELDS.ParenthesizedExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function switchCase(test = null, consequent) {
+ const node = {
+ type: "SwitchCase",
+ test,
+ consequent
+ };
+ const defs = NODE_FIELDS.SwitchCase;
+ validate(defs.test, node, "test", test, 1);
+ validate(defs.consequent, node, "consequent", consequent, 1);
+ return node;
+}
+function switchStatement(discriminant, cases) {
+ const node = {
+ type: "SwitchStatement",
+ discriminant,
+ cases
+ };
+ const defs = NODE_FIELDS.SwitchStatement;
+ validate(defs.discriminant, node, "discriminant", discriminant, 1);
+ validate(defs.cases, node, "cases", cases, 1);
+ return node;
+}
+function thisExpression() {
+ return {
+ type: "ThisExpression"
+ };
+}
+function throwStatement(argument) {
+ const node = {
+ type: "ThrowStatement",
+ argument
+ };
+ const defs = NODE_FIELDS.ThrowStatement;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function tryStatement(block, handler = null, finalizer = null) {
+ const node = {
+ type: "TryStatement",
+ block,
+ handler,
+ finalizer
+ };
+ const defs = NODE_FIELDS.TryStatement;
+ validate(defs.block, node, "block", block, 1);
+ validate(defs.handler, node, "handler", handler, 1);
+ validate(defs.finalizer, node, "finalizer", finalizer, 1);
+ return node;
+}
+function unaryExpression(operator, argument, prefix = true) {
+ const node = {
+ type: "UnaryExpression",
+ operator,
+ argument,
+ prefix
+ };
+ const defs = NODE_FIELDS.UnaryExpression;
+ validate(defs.operator, node, "operator", operator);
+ validate(defs.argument, node, "argument", argument, 1);
+ validate(defs.prefix, node, "prefix", prefix);
+ return node;
+}
+function updateExpression(operator, argument, prefix = false) {
+ const node = {
+ type: "UpdateExpression",
+ operator,
+ argument,
+ prefix
+ };
+ const defs = NODE_FIELDS.UpdateExpression;
+ validate(defs.operator, node, "operator", operator);
+ validate(defs.argument, node, "argument", argument, 1);
+ validate(defs.prefix, node, "prefix", prefix);
+ return node;
+}
+function variableDeclaration(kind, declarations) {
+ const node = {
+ type: "VariableDeclaration",
+ kind,
+ declarations
+ };
+ const defs = NODE_FIELDS.VariableDeclaration;
+ validate(defs.kind, node, "kind", kind);
+ validate(defs.declarations, node, "declarations", declarations, 1);
+ return node;
+}
+function variableDeclarator(id, init = null) {
+ const node = {
+ type: "VariableDeclarator",
+ id,
+ init
+ };
+ const defs = NODE_FIELDS.VariableDeclarator;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.init, node, "init", init, 1);
+ return node;
+}
+function whileStatement(test, body) {
+ const node = {
+ type: "WhileStatement",
+ test,
+ body
+ };
+ const defs = NODE_FIELDS.WhileStatement;
+ validate(defs.test, node, "test", test, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function withStatement(object, body) {
+ const node = {
+ type: "WithStatement",
+ object,
+ body
+ };
+ const defs = NODE_FIELDS.WithStatement;
+ validate(defs.object, node, "object", object, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function assignmentPattern(left, right) {
+ const node = {
+ type: "AssignmentPattern",
+ left,
+ right
+ };
+ const defs = NODE_FIELDS.AssignmentPattern;
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function arrayPattern(elements) {
+ const node = {
+ type: "ArrayPattern",
+ elements
+ };
+ const defs = NODE_FIELDS.ArrayPattern;
+ validate(defs.elements, node, "elements", elements, 1);
+ return node;
+}
+function arrowFunctionExpression(params, body, async = false) {
+ const node = {
+ type: "ArrowFunctionExpression",
+ params,
+ body,
+ async,
+ expression: null
+ };
+ const defs = NODE_FIELDS.ArrowFunctionExpression;
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.async, node, "async", async);
+ return node;
+}
+function classBody(body) {
+ const node = {
+ type: "ClassBody",
+ body
+ };
+ const defs = NODE_FIELDS.ClassBody;
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function classExpression(id = null, superClass = null, body, decorators = null) {
+ const node = {
+ type: "ClassExpression",
+ id,
+ superClass,
+ body,
+ decorators
+ };
+ const defs = NODE_FIELDS.ClassExpression;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.superClass, node, "superClass", superClass, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ return node;
+}
+function classDeclaration(id = null, superClass = null, body, decorators = null) {
+ const node = {
+ type: "ClassDeclaration",
+ id,
+ superClass,
+ body,
+ decorators
+ };
+ const defs = NODE_FIELDS.ClassDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.superClass, node, "superClass", superClass, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ return node;
+}
+function exportAllDeclaration(source) {
+ const node = {
+ type: "ExportAllDeclaration",
+ source
+ };
+ const defs = NODE_FIELDS.ExportAllDeclaration;
+ validate(defs.source, node, "source", source, 1);
+ return node;
+}
+function exportDefaultDeclaration(declaration) {
+ const node = {
+ type: "ExportDefaultDeclaration",
+ declaration
+ };
+ const defs = NODE_FIELDS.ExportDefaultDeclaration;
+ validate(defs.declaration, node, "declaration", declaration, 1);
+ return node;
+}
+function exportNamedDeclaration(declaration = null, specifiers = [], source = null) {
+ const node = {
+ type: "ExportNamedDeclaration",
+ declaration,
+ specifiers,
+ source
+ };
+ const defs = NODE_FIELDS.ExportNamedDeclaration;
+ validate(defs.declaration, node, "declaration", declaration, 1);
+ validate(defs.specifiers, node, "specifiers", specifiers, 1);
+ validate(defs.source, node, "source", source, 1);
+ return node;
+}
+function exportSpecifier(local, exported) {
+ const node = {
+ type: "ExportSpecifier",
+ local,
+ exported
+ };
+ const defs = NODE_FIELDS.ExportSpecifier;
+ validate(defs.local, node, "local", local, 1);
+ validate(defs.exported, node, "exported", exported, 1);
+ return node;
+}
+function forOfStatement(left, right, body, _await = false) {
+ const node = {
+ type: "ForOfStatement",
+ left,
+ right,
+ body,
+ await: _await
+ };
+ const defs = NODE_FIELDS.ForOfStatement;
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.await, node, "await", _await);
+ return node;
+}
+function importDeclaration(specifiers, source) {
+ const node = {
+ type: "ImportDeclaration",
+ specifiers,
+ source
+ };
+ const defs = NODE_FIELDS.ImportDeclaration;
+ validate(defs.specifiers, node, "specifiers", specifiers, 1);
+ validate(defs.source, node, "source", source, 1);
+ return node;
+}
+function importDefaultSpecifier(local) {
+ const node = {
+ type: "ImportDefaultSpecifier",
+ local
+ };
+ const defs = NODE_FIELDS.ImportDefaultSpecifier;
+ validate(defs.local, node, "local", local, 1);
+ return node;
+}
+function importNamespaceSpecifier(local) {
+ const node = {
+ type: "ImportNamespaceSpecifier",
+ local
+ };
+ const defs = NODE_FIELDS.ImportNamespaceSpecifier;
+ validate(defs.local, node, "local", local, 1);
+ return node;
+}
+function importSpecifier(local, imported) {
+ const node = {
+ type: "ImportSpecifier",
+ local,
+ imported
+ };
+ const defs = NODE_FIELDS.ImportSpecifier;
+ validate(defs.local, node, "local", local, 1);
+ validate(defs.imported, node, "imported", imported, 1);
+ return node;
+}
+function importExpression(source, options = null) {
+ const node = {
+ type: "ImportExpression",
+ source,
+ options
+ };
+ const defs = NODE_FIELDS.ImportExpression;
+ validate(defs.source, node, "source", source, 1);
+ validate(defs.options, node, "options", options, 1);
+ return node;
+}
+function metaProperty(meta, property) {
+ const node = {
+ type: "MetaProperty",
+ meta,
+ property
+ };
+ const defs = NODE_FIELDS.MetaProperty;
+ validate(defs.meta, node, "meta", meta, 1);
+ validate(defs.property, node, "property", property, 1);
+ return node;
+}
+function classMethod(kind = "method", key, params, body, computed = false, _static = false, generator = false, async = false) {
+ const node = {
+ type: "ClassMethod",
+ kind,
+ key,
+ params,
+ body,
+ computed,
+ static: _static,
+ generator,
+ async
+ };
+ const defs = NODE_FIELDS.ClassMethod;
+ validate(defs.kind, node, "kind", kind);
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.static, node, "static", _static);
+ validate(defs.generator, node, "generator", generator);
+ validate(defs.async, node, "async", async);
+ return node;
+}
+function objectPattern(properties) {
+ const node = {
+ type: "ObjectPattern",
+ properties
+ };
+ const defs = NODE_FIELDS.ObjectPattern;
+ validate(defs.properties, node, "properties", properties, 1);
+ return node;
+}
+function spreadElement(argument) {
+ const node = {
+ type: "SpreadElement",
+ argument
+ };
+ const defs = NODE_FIELDS.SpreadElement;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function _super() {
+ return {
+ type: "Super"
+ };
+}
+function taggedTemplateExpression(tag, quasi) {
+ const node = {
+ type: "TaggedTemplateExpression",
+ tag,
+ quasi
+ };
+ const defs = NODE_FIELDS.TaggedTemplateExpression;
+ validate(defs.tag, node, "tag", tag, 1);
+ validate(defs.quasi, node, "quasi", quasi, 1);
+ return node;
+}
+function templateElement(value, tail = false) {
+ const node = {
+ type: "TemplateElement",
+ value,
+ tail
+ };
+ const defs = NODE_FIELDS.TemplateElement;
+ validate(defs.value, node, "value", value);
+ validate(defs.tail, node, "tail", tail);
+ return node;
+}
+function templateLiteral(quasis, expressions) {
+ const node = {
+ type: "TemplateLiteral",
+ quasis,
+ expressions
+ };
+ const defs = NODE_FIELDS.TemplateLiteral;
+ validate(defs.quasis, node, "quasis", quasis, 1);
+ validate(defs.expressions, node, "expressions", expressions, 1);
+ return node;
+}
+function yieldExpression(argument = null, delegate = false) {
+ const node = {
+ type: "YieldExpression",
+ argument,
+ delegate
+ };
+ const defs = NODE_FIELDS.YieldExpression;
+ validate(defs.argument, node, "argument", argument, 1);
+ validate(defs.delegate, node, "delegate", delegate);
+ return node;
+}
+function awaitExpression(argument) {
+ const node = {
+ type: "AwaitExpression",
+ argument
+ };
+ const defs = NODE_FIELDS.AwaitExpression;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function _import() {
+ return {
+ type: "Import"
+ };
+}
+function bigIntLiteral(value) {
+ const node = {
+ type: "BigIntLiteral",
+ value
+ };
+ const defs = NODE_FIELDS.BigIntLiteral;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function exportNamespaceSpecifier(exported) {
+ const node = {
+ type: "ExportNamespaceSpecifier",
+ exported
+ };
+ const defs = NODE_FIELDS.ExportNamespaceSpecifier;
+ validate(defs.exported, node, "exported", exported, 1);
+ return node;
+}
+function optionalMemberExpression(object, property, computed = false, optional) {
+ const node = {
+ type: "OptionalMemberExpression",
+ object,
+ property,
+ computed,
+ optional
+ };
+ const defs = NODE_FIELDS.OptionalMemberExpression;
+ validate(defs.object, node, "object", object, 1);
+ validate(defs.property, node, "property", property, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.optional, node, "optional", optional);
+ return node;
+}
+function optionalCallExpression(callee, _arguments, optional) {
+ const node = {
+ type: "OptionalCallExpression",
+ callee,
+ arguments: _arguments,
+ optional
+ };
+ const defs = NODE_FIELDS.OptionalCallExpression;
+ validate(defs.callee, node, "callee", callee, 1);
+ validate(defs.arguments, node, "arguments", _arguments, 1);
+ validate(defs.optional, node, "optional", optional);
+ return node;
+}
+function classProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) {
+ const node = {
+ type: "ClassProperty",
+ key,
+ value,
+ typeAnnotation,
+ decorators,
+ computed,
+ static: _static
+ };
+ const defs = NODE_FIELDS.ClassProperty;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.static, node, "static", _static);
+ return node;
+}
+function classAccessorProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) {
+ const node = {
+ type: "ClassAccessorProperty",
+ key,
+ value,
+ typeAnnotation,
+ decorators,
+ computed,
+ static: _static
+ };
+ const defs = NODE_FIELDS.ClassAccessorProperty;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ validate(defs.computed, node, "computed", computed);
+ validate(defs.static, node, "static", _static);
+ return node;
+}
+function classPrivateProperty(key, value = null, decorators = null, _static = false) {
+ const node = {
+ type: "ClassPrivateProperty",
+ key,
+ value,
+ decorators,
+ static: _static
+ };
+ const defs = NODE_FIELDS.ClassPrivateProperty;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ validate(defs.static, node, "static", _static);
+ return node;
+}
+function classPrivateMethod(kind = "method", key, params, body, _static = false) {
+ const node = {
+ type: "ClassPrivateMethod",
+ kind,
+ key,
+ params,
+ body,
+ static: _static
+ };
+ const defs = NODE_FIELDS.ClassPrivateMethod;
+ validate(defs.kind, node, "kind", kind);
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.static, node, "static", _static);
+ return node;
+}
+function privateName(id) {
+ const node = {
+ type: "PrivateName",
+ id
+ };
+ const defs = NODE_FIELDS.PrivateName;
+ validate(defs.id, node, "id", id, 1);
+ return node;
+}
+function staticBlock(body) {
+ const node = {
+ type: "StaticBlock",
+ body
+ };
+ const defs = NODE_FIELDS.StaticBlock;
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function importAttribute(key, value) {
+ const node = {
+ type: "ImportAttribute",
+ key,
+ value
+ };
+ const defs = NODE_FIELDS.ImportAttribute;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ return node;
+}
+function anyTypeAnnotation() {
+ return {
+ type: "AnyTypeAnnotation"
+ };
+}
+function arrayTypeAnnotation(elementType) {
+ const node = {
+ type: "ArrayTypeAnnotation",
+ elementType
+ };
+ const defs = NODE_FIELDS.ArrayTypeAnnotation;
+ validate(defs.elementType, node, "elementType", elementType, 1);
+ return node;
+}
+function booleanTypeAnnotation() {
+ return {
+ type: "BooleanTypeAnnotation"
+ };
+}
+function booleanLiteralTypeAnnotation(value) {
+ const node = {
+ type: "BooleanLiteralTypeAnnotation",
+ value
+ };
+ const defs = NODE_FIELDS.BooleanLiteralTypeAnnotation;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function nullLiteralTypeAnnotation() {
+ return {
+ type: "NullLiteralTypeAnnotation"
+ };
+}
+function classImplements(id, typeParameters = null) {
+ const node = {
+ type: "ClassImplements",
+ id,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.ClassImplements;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function declareClass(id, typeParameters = null, _extends = null, body) {
+ const node = {
+ type: "DeclareClass",
+ id,
+ typeParameters,
+ extends: _extends,
+ body
+ };
+ const defs = NODE_FIELDS.DeclareClass;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.extends, node, "extends", _extends, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function declareFunction(id) {
+ const node = {
+ type: "DeclareFunction",
+ id
+ };
+ const defs = NODE_FIELDS.DeclareFunction;
+ validate(defs.id, node, "id", id, 1);
+ return node;
+}
+function declareInterface(id, typeParameters = null, _extends = null, body) {
+ const node = {
+ type: "DeclareInterface",
+ id,
+ typeParameters,
+ extends: _extends,
+ body
+ };
+ const defs = NODE_FIELDS.DeclareInterface;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.extends, node, "extends", _extends, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function declareModule(id, body, kind = null) {
+ const node = {
+ type: "DeclareModule",
+ id,
+ body,
+ kind
+ };
+ const defs = NODE_FIELDS.DeclareModule;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.kind, node, "kind", kind);
+ return node;
+}
+function declareModuleExports(typeAnnotation) {
+ const node = {
+ type: "DeclareModuleExports",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.DeclareModuleExports;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function declareTypeAlias(id, typeParameters = null, right) {
+ const node = {
+ type: "DeclareTypeAlias",
+ id,
+ typeParameters,
+ right
+ };
+ const defs = NODE_FIELDS.DeclareTypeAlias;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function declareOpaqueType(id, typeParameters = null, supertype = null) {
+ const node = {
+ type: "DeclareOpaqueType",
+ id,
+ typeParameters,
+ supertype
+ };
+ const defs = NODE_FIELDS.DeclareOpaqueType;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.supertype, node, "supertype", supertype, 1);
+ return node;
+}
+function declareVariable(id) {
+ const node = {
+ type: "DeclareVariable",
+ id
+ };
+ const defs = NODE_FIELDS.DeclareVariable;
+ validate(defs.id, node, "id", id, 1);
+ return node;
+}
+function declareExportDeclaration(declaration = null, specifiers = null, source = null, attributes = null) {
+ const node = {
+ type: "DeclareExportDeclaration",
+ declaration,
+ specifiers,
+ source,
+ attributes
+ };
+ const defs = NODE_FIELDS.DeclareExportDeclaration;
+ validate(defs.declaration, node, "declaration", declaration, 1);
+ validate(defs.specifiers, node, "specifiers", specifiers, 1);
+ validate(defs.source, node, "source", source, 1);
+ validate(defs.attributes, node, "attributes", attributes, 1);
+ return node;
+}
+function declareExportAllDeclaration(source, attributes = null) {
+ const node = {
+ type: "DeclareExportAllDeclaration",
+ source,
+ attributes
+ };
+ const defs = NODE_FIELDS.DeclareExportAllDeclaration;
+ validate(defs.source, node, "source", source, 1);
+ validate(defs.attributes, node, "attributes", attributes, 1);
+ return node;
+}
+function declaredPredicate(value) {
+ const node = {
+ type: "DeclaredPredicate",
+ value
+ };
+ const defs = NODE_FIELDS.DeclaredPredicate;
+ validate(defs.value, node, "value", value, 1);
+ return node;
+}
+function existsTypeAnnotation() {
+ return {
+ type: "ExistsTypeAnnotation"
+ };
+}
+function functionTypeAnnotation(typeParameters = null, params, rest = null, returnType) {
+ const node = {
+ type: "FunctionTypeAnnotation",
+ typeParameters,
+ params,
+ rest,
+ returnType
+ };
+ const defs = NODE_FIELDS.FunctionTypeAnnotation;
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.rest, node, "rest", rest, 1);
+ validate(defs.returnType, node, "returnType", returnType, 1);
+ return node;
+}
+function functionTypeParam(name = null, typeAnnotation) {
+ const node = {
+ type: "FunctionTypeParam",
+ name,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.FunctionTypeParam;
+ validate(defs.name, node, "name", name, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function genericTypeAnnotation(id, typeParameters = null) {
+ const node = {
+ type: "GenericTypeAnnotation",
+ id,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.GenericTypeAnnotation;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function inferredPredicate() {
+ return {
+ type: "InferredPredicate"
+ };
+}
+function interfaceExtends(id, typeParameters = null) {
+ const node = {
+ type: "InterfaceExtends",
+ id,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.InterfaceExtends;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function interfaceDeclaration(id, typeParameters = null, _extends = null, body) {
+ const node = {
+ type: "InterfaceDeclaration",
+ id,
+ typeParameters,
+ extends: _extends,
+ body
+ };
+ const defs = NODE_FIELDS.InterfaceDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.extends, node, "extends", _extends, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function interfaceTypeAnnotation(_extends = null, body) {
+ const node = {
+ type: "InterfaceTypeAnnotation",
+ extends: _extends,
+ body
+ };
+ const defs = NODE_FIELDS.InterfaceTypeAnnotation;
+ validate(defs.extends, node, "extends", _extends, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function intersectionTypeAnnotation(types) {
+ const node = {
+ type: "IntersectionTypeAnnotation",
+ types
+ };
+ const defs = NODE_FIELDS.IntersectionTypeAnnotation;
+ validate(defs.types, node, "types", types, 1);
+ return node;
+}
+function mixedTypeAnnotation() {
+ return {
+ type: "MixedTypeAnnotation"
+ };
+}
+function emptyTypeAnnotation() {
+ return {
+ type: "EmptyTypeAnnotation"
+ };
+}
+function nullableTypeAnnotation(typeAnnotation) {
+ const node = {
+ type: "NullableTypeAnnotation",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.NullableTypeAnnotation;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function numberLiteralTypeAnnotation(value) {
+ const node = {
+ type: "NumberLiteralTypeAnnotation",
+ value
+ };
+ const defs = NODE_FIELDS.NumberLiteralTypeAnnotation;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function numberTypeAnnotation() {
+ return {
+ type: "NumberTypeAnnotation"
+ };
+}
+function objectTypeAnnotation(properties, indexers = [], callProperties = [], internalSlots = [], exact = false) {
+ const node = {
+ type: "ObjectTypeAnnotation",
+ properties,
+ indexers,
+ callProperties,
+ internalSlots,
+ exact
+ };
+ const defs = NODE_FIELDS.ObjectTypeAnnotation;
+ validate(defs.properties, node, "properties", properties, 1);
+ validate(defs.indexers, node, "indexers", indexers, 1);
+ validate(defs.callProperties, node, "callProperties", callProperties, 1);
+ validate(defs.internalSlots, node, "internalSlots", internalSlots, 1);
+ validate(defs.exact, node, "exact", exact);
+ return node;
+}
+function objectTypeInternalSlot(id, value, optional, _static, method) {
+ const node = {
+ type: "ObjectTypeInternalSlot",
+ id,
+ value,
+ optional,
+ static: _static,
+ method
+ };
+ const defs = NODE_FIELDS.ObjectTypeInternalSlot;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.optional, node, "optional", optional);
+ validate(defs.static, node, "static", _static);
+ validate(defs.method, node, "method", method);
+ return node;
+}
+function objectTypeCallProperty(value) {
+ const node = {
+ type: "ObjectTypeCallProperty",
+ value,
+ static: null
+ };
+ const defs = NODE_FIELDS.ObjectTypeCallProperty;
+ validate(defs.value, node, "value", value, 1);
+ return node;
+}
+function objectTypeIndexer(id = null, key, value, variance = null) {
+ const node = {
+ type: "ObjectTypeIndexer",
+ id,
+ key,
+ value,
+ variance,
+ static: null
+ };
+ const defs = NODE_FIELDS.ObjectTypeIndexer;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.variance, node, "variance", variance, 1);
+ return node;
+}
+function objectTypeProperty(key, value, variance = null) {
+ const node = {
+ type: "ObjectTypeProperty",
+ key,
+ value,
+ variance,
+ kind: null,
+ method: null,
+ optional: null,
+ proto: null,
+ static: null
+ };
+ const defs = NODE_FIELDS.ObjectTypeProperty;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.value, node, "value", value, 1);
+ validate(defs.variance, node, "variance", variance, 1);
+ return node;
+}
+function objectTypeSpreadProperty(argument) {
+ const node = {
+ type: "ObjectTypeSpreadProperty",
+ argument
+ };
+ const defs = NODE_FIELDS.ObjectTypeSpreadProperty;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function opaqueType(id, typeParameters = null, supertype = null, impltype) {
+ const node = {
+ type: "OpaqueType",
+ id,
+ typeParameters,
+ supertype,
+ impltype
+ };
+ const defs = NODE_FIELDS.OpaqueType;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.supertype, node, "supertype", supertype, 1);
+ validate(defs.impltype, node, "impltype", impltype, 1);
+ return node;
+}
+function qualifiedTypeIdentifier(id, qualification) {
+ const node = {
+ type: "QualifiedTypeIdentifier",
+ id,
+ qualification
+ };
+ const defs = NODE_FIELDS.QualifiedTypeIdentifier;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.qualification, node, "qualification", qualification, 1);
+ return node;
+}
+function stringLiteralTypeAnnotation(value) {
+ const node = {
+ type: "StringLiteralTypeAnnotation",
+ value
+ };
+ const defs = NODE_FIELDS.StringLiteralTypeAnnotation;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function stringTypeAnnotation() {
+ return {
+ type: "StringTypeAnnotation"
+ };
+}
+function symbolTypeAnnotation() {
+ return {
+ type: "SymbolTypeAnnotation"
+ };
+}
+function thisTypeAnnotation() {
+ return {
+ type: "ThisTypeAnnotation"
+ };
+}
+function tupleTypeAnnotation(types) {
+ const node = {
+ type: "TupleTypeAnnotation",
+ types
+ };
+ const defs = NODE_FIELDS.TupleTypeAnnotation;
+ validate(defs.types, node, "types", types, 1);
+ return node;
+}
+function typeofTypeAnnotation(argument) {
+ const node = {
+ type: "TypeofTypeAnnotation",
+ argument
+ };
+ const defs = NODE_FIELDS.TypeofTypeAnnotation;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function typeAlias(id, typeParameters = null, right) {
+ const node = {
+ type: "TypeAlias",
+ id,
+ typeParameters,
+ right
+ };
+ const defs = NODE_FIELDS.TypeAlias;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function typeAnnotation(typeAnnotation) {
+ const node = {
+ type: "TypeAnnotation",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TypeAnnotation;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function typeCastExpression(expression, typeAnnotation) {
+ const node = {
+ type: "TypeCastExpression",
+ expression,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TypeCastExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function typeParameter(bound = null, _default = null, variance = null) {
+ const node = {
+ type: "TypeParameter",
+ bound,
+ default: _default,
+ variance,
+ name: null
+ };
+ const defs = NODE_FIELDS.TypeParameter;
+ validate(defs.bound, node, "bound", bound, 1);
+ validate(defs.default, node, "default", _default, 1);
+ validate(defs.variance, node, "variance", variance, 1);
+ return node;
+}
+function typeParameterDeclaration(params) {
+ const node = {
+ type: "TypeParameterDeclaration",
+ params
+ };
+ const defs = NODE_FIELDS.TypeParameterDeclaration;
+ validate(defs.params, node, "params", params, 1);
+ return node;
+}
+function typeParameterInstantiation(params) {
+ const node = {
+ type: "TypeParameterInstantiation",
+ params
+ };
+ const defs = NODE_FIELDS.TypeParameterInstantiation;
+ validate(defs.params, node, "params", params, 1);
+ return node;
+}
+function unionTypeAnnotation(types) {
+ const node = {
+ type: "UnionTypeAnnotation",
+ types
+ };
+ const defs = NODE_FIELDS.UnionTypeAnnotation;
+ validate(defs.types, node, "types", types, 1);
+ return node;
+}
+function variance(kind) {
+ const node = {
+ type: "Variance",
+ kind
+ };
+ const defs = NODE_FIELDS.Variance;
+ validate(defs.kind, node, "kind", kind);
+ return node;
+}
+function voidTypeAnnotation() {
+ return {
+ type: "VoidTypeAnnotation"
+ };
+}
+function enumDeclaration(id, body) {
+ const node = {
+ type: "EnumDeclaration",
+ id,
+ body
+ };
+ const defs = NODE_FIELDS.EnumDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function enumBooleanBody(members) {
+ const node = {
+ type: "EnumBooleanBody",
+ members,
+ explicitType: null,
+ hasUnknownMembers: null
+ };
+ const defs = NODE_FIELDS.EnumBooleanBody;
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function enumNumberBody(members) {
+ const node = {
+ type: "EnumNumberBody",
+ members,
+ explicitType: null,
+ hasUnknownMembers: null
+ };
+ const defs = NODE_FIELDS.EnumNumberBody;
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function enumStringBody(members) {
+ const node = {
+ type: "EnumStringBody",
+ members,
+ explicitType: null,
+ hasUnknownMembers: null
+ };
+ const defs = NODE_FIELDS.EnumStringBody;
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function enumSymbolBody(members) {
+ const node = {
+ type: "EnumSymbolBody",
+ members,
+ hasUnknownMembers: null
+ };
+ const defs = NODE_FIELDS.EnumSymbolBody;
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function enumBooleanMember(id) {
+ const node = {
+ type: "EnumBooleanMember",
+ id,
+ init: null
+ };
+ const defs = NODE_FIELDS.EnumBooleanMember;
+ validate(defs.id, node, "id", id, 1);
+ return node;
+}
+function enumNumberMember(id, init) {
+ const node = {
+ type: "EnumNumberMember",
+ id,
+ init
+ };
+ const defs = NODE_FIELDS.EnumNumberMember;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.init, node, "init", init, 1);
+ return node;
+}
+function enumStringMember(id, init) {
+ const node = {
+ type: "EnumStringMember",
+ id,
+ init
+ };
+ const defs = NODE_FIELDS.EnumStringMember;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.init, node, "init", init, 1);
+ return node;
+}
+function enumDefaultedMember(id) {
+ const node = {
+ type: "EnumDefaultedMember",
+ id
+ };
+ const defs = NODE_FIELDS.EnumDefaultedMember;
+ validate(defs.id, node, "id", id, 1);
+ return node;
+}
+function indexedAccessType(objectType, indexType) {
+ const node = {
+ type: "IndexedAccessType",
+ objectType,
+ indexType
+ };
+ const defs = NODE_FIELDS.IndexedAccessType;
+ validate(defs.objectType, node, "objectType", objectType, 1);
+ validate(defs.indexType, node, "indexType", indexType, 1);
+ return node;
+}
+function optionalIndexedAccessType(objectType, indexType) {
+ const node = {
+ type: "OptionalIndexedAccessType",
+ objectType,
+ indexType,
+ optional: null
+ };
+ const defs = NODE_FIELDS.OptionalIndexedAccessType;
+ validate(defs.objectType, node, "objectType", objectType, 1);
+ validate(defs.indexType, node, "indexType", indexType, 1);
+ return node;
+}
+function jsxAttribute(name, value = null) {
+ const node = {
+ type: "JSXAttribute",
+ name,
+ value
+ };
+ const defs = NODE_FIELDS.JSXAttribute;
+ validate(defs.name, node, "name", name, 1);
+ validate(defs.value, node, "value", value, 1);
+ return node;
+}
+function jsxClosingElement(name) {
+ const node = {
+ type: "JSXClosingElement",
+ name
+ };
+ const defs = NODE_FIELDS.JSXClosingElement;
+ validate(defs.name, node, "name", name, 1);
+ return node;
+}
+function jsxElement(openingElement, closingElement = null, children, selfClosing = null) {
+ const node = {
+ type: "JSXElement",
+ openingElement,
+ closingElement,
+ children,
+ selfClosing
+ };
+ const defs = NODE_FIELDS.JSXElement;
+ validate(defs.openingElement, node, "openingElement", openingElement, 1);
+ validate(defs.closingElement, node, "closingElement", closingElement, 1);
+ validate(defs.children, node, "children", children, 1);
+ validate(defs.selfClosing, node, "selfClosing", selfClosing);
+ return node;
+}
+function jsxEmptyExpression() {
+ return {
+ type: "JSXEmptyExpression"
+ };
+}
+function jsxExpressionContainer(expression) {
+ const node = {
+ type: "JSXExpressionContainer",
+ expression
+ };
+ const defs = NODE_FIELDS.JSXExpressionContainer;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function jsxSpreadChild(expression) {
+ const node = {
+ type: "JSXSpreadChild",
+ expression
+ };
+ const defs = NODE_FIELDS.JSXSpreadChild;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function jsxIdentifier(name) {
+ const node = {
+ type: "JSXIdentifier",
+ name
+ };
+ const defs = NODE_FIELDS.JSXIdentifier;
+ validate(defs.name, node, "name", name);
+ return node;
+}
+function jsxMemberExpression(object, property) {
+ const node = {
+ type: "JSXMemberExpression",
+ object,
+ property
+ };
+ const defs = NODE_FIELDS.JSXMemberExpression;
+ validate(defs.object, node, "object", object, 1);
+ validate(defs.property, node, "property", property, 1);
+ return node;
+}
+function jsxNamespacedName(namespace, name) {
+ const node = {
+ type: "JSXNamespacedName",
+ namespace,
+ name
+ };
+ const defs = NODE_FIELDS.JSXNamespacedName;
+ validate(defs.namespace, node, "namespace", namespace, 1);
+ validate(defs.name, node, "name", name, 1);
+ return node;
+}
+function jsxOpeningElement(name, attributes, selfClosing = false) {
+ const node = {
+ type: "JSXOpeningElement",
+ name,
+ attributes,
+ selfClosing
+ };
+ const defs = NODE_FIELDS.JSXOpeningElement;
+ validate(defs.name, node, "name", name, 1);
+ validate(defs.attributes, node, "attributes", attributes, 1);
+ validate(defs.selfClosing, node, "selfClosing", selfClosing);
+ return node;
+}
+function jsxSpreadAttribute(argument) {
+ const node = {
+ type: "JSXSpreadAttribute",
+ argument
+ };
+ const defs = NODE_FIELDS.JSXSpreadAttribute;
+ validate(defs.argument, node, "argument", argument, 1);
+ return node;
+}
+function jsxText(value) {
+ const node = {
+ type: "JSXText",
+ value
+ };
+ const defs = NODE_FIELDS.JSXText;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function jsxFragment(openingFragment, closingFragment, children) {
+ const node = {
+ type: "JSXFragment",
+ openingFragment,
+ closingFragment,
+ children
+ };
+ const defs = NODE_FIELDS.JSXFragment;
+ validate(defs.openingFragment, node, "openingFragment", openingFragment, 1);
+ validate(defs.closingFragment, node, "closingFragment", closingFragment, 1);
+ validate(defs.children, node, "children", children, 1);
+ return node;
+}
+function jsxOpeningFragment() {
+ return {
+ type: "JSXOpeningFragment"
+ };
+}
+function jsxClosingFragment() {
+ return {
+ type: "JSXClosingFragment"
+ };
+}
+function noop() {
+ return {
+ type: "Noop"
+ };
+}
+function placeholder(expectedNode, name) {
+ const node = {
+ type: "Placeholder",
+ expectedNode,
+ name
+ };
+ const defs = NODE_FIELDS.Placeholder;
+ validate(defs.expectedNode, node, "expectedNode", expectedNode);
+ validate(defs.name, node, "name", name, 1);
+ return node;
+}
+function v8IntrinsicIdentifier(name) {
+ const node = {
+ type: "V8IntrinsicIdentifier",
+ name
+ };
+ const defs = NODE_FIELDS.V8IntrinsicIdentifier;
+ validate(defs.name, node, "name", name);
+ return node;
+}
+function argumentPlaceholder() {
+ return {
+ type: "ArgumentPlaceholder"
+ };
+}
+function bindExpression(object, callee) {
+ const node = {
+ type: "BindExpression",
+ object,
+ callee
+ };
+ const defs = NODE_FIELDS.BindExpression;
+ validate(defs.object, node, "object", object, 1);
+ validate(defs.callee, node, "callee", callee, 1);
+ return node;
+}
+function decorator(expression) {
+ const node = {
+ type: "Decorator",
+ expression
+ };
+ const defs = NODE_FIELDS.Decorator;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function doExpression(body, async = false) {
+ const node = {
+ type: "DoExpression",
+ body,
+ async
+ };
+ const defs = NODE_FIELDS.DoExpression;
+ validate(defs.body, node, "body", body, 1);
+ validate(defs.async, node, "async", async);
+ return node;
+}
+function exportDefaultSpecifier(exported) {
+ const node = {
+ type: "ExportDefaultSpecifier",
+ exported
+ };
+ const defs = NODE_FIELDS.ExportDefaultSpecifier;
+ validate(defs.exported, node, "exported", exported, 1);
+ return node;
+}
+function recordExpression(properties) {
+ const node = {
+ type: "RecordExpression",
+ properties
+ };
+ const defs = NODE_FIELDS.RecordExpression;
+ validate(defs.properties, node, "properties", properties, 1);
+ return node;
+}
+function tupleExpression(elements = []) {
+ const node = {
+ type: "TupleExpression",
+ elements
+ };
+ const defs = NODE_FIELDS.TupleExpression;
+ validate(defs.elements, node, "elements", elements, 1);
+ return node;
+}
+function decimalLiteral(value) {
+ const node = {
+ type: "DecimalLiteral",
+ value
+ };
+ const defs = NODE_FIELDS.DecimalLiteral;
+ validate(defs.value, node, "value", value);
+ return node;
+}
+function moduleExpression(body) {
+ const node = {
+ type: "ModuleExpression",
+ body
+ };
+ const defs = NODE_FIELDS.ModuleExpression;
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function topicReference() {
+ return {
+ type: "TopicReference"
+ };
+}
+function pipelineTopicExpression(expression) {
+ const node = {
+ type: "PipelineTopicExpression",
+ expression
+ };
+ const defs = NODE_FIELDS.PipelineTopicExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function pipelineBareFunction(callee) {
+ const node = {
+ type: "PipelineBareFunction",
+ callee
+ };
+ const defs = NODE_FIELDS.PipelineBareFunction;
+ validate(defs.callee, node, "callee", callee, 1);
+ return node;
+}
+function pipelinePrimaryTopicReference() {
+ return {
+ type: "PipelinePrimaryTopicReference"
+ };
+}
+function tsParameterProperty(parameter) {
+ const node = {
+ type: "TSParameterProperty",
+ parameter
+ };
+ const defs = NODE_FIELDS.TSParameterProperty;
+ validate(defs.parameter, node, "parameter", parameter, 1);
+ return node;
+}
+function tsDeclareFunction(id = null, typeParameters = null, params, returnType = null) {
+ const node = {
+ type: "TSDeclareFunction",
+ id,
+ typeParameters,
+ params,
+ returnType
+ };
+ const defs = NODE_FIELDS.TSDeclareFunction;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.returnType, node, "returnType", returnType, 1);
+ return node;
+}
+function tsDeclareMethod(decorators = null, key, typeParameters = null, params, returnType = null) {
+ const node = {
+ type: "TSDeclareMethod",
+ decorators,
+ key,
+ typeParameters,
+ params,
+ returnType
+ };
+ const defs = NODE_FIELDS.TSDeclareMethod;
+ validate(defs.decorators, node, "decorators", decorators, 1);
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.params, node, "params", params, 1);
+ validate(defs.returnType, node, "returnType", returnType, 1);
+ return node;
+}
+function tsQualifiedName(left, right) {
+ const node = {
+ type: "TSQualifiedName",
+ left,
+ right
+ };
+ const defs = NODE_FIELDS.TSQualifiedName;
+ validate(defs.left, node, "left", left, 1);
+ validate(defs.right, node, "right", right, 1);
+ return node;
+}
+function tsCallSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) {
+ const node = {
+ type: "TSCallSignatureDeclaration",
+ typeParameters,
+ parameters,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSCallSignatureDeclaration;
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.parameters, node, "parameters", parameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsConstructSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) {
+ const node = {
+ type: "TSConstructSignatureDeclaration",
+ typeParameters,
+ parameters,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSConstructSignatureDeclaration;
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.parameters, node, "parameters", parameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsPropertySignature(key, typeAnnotation = null) {
+ const node = {
+ type: "TSPropertySignature",
+ key,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSPropertySignature;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsMethodSignature(key, typeParameters = null, parameters, typeAnnotation = null) {
+ const node = {
+ type: "TSMethodSignature",
+ key,
+ typeParameters,
+ parameters,
+ typeAnnotation,
+ kind: null
+ };
+ const defs = NODE_FIELDS.TSMethodSignature;
+ validate(defs.key, node, "key", key, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.parameters, node, "parameters", parameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsIndexSignature(parameters, typeAnnotation = null) {
+ const node = {
+ type: "TSIndexSignature",
+ parameters,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSIndexSignature;
+ validate(defs.parameters, node, "parameters", parameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsAnyKeyword() {
+ return {
+ type: "TSAnyKeyword"
+ };
+}
+function tsBooleanKeyword() {
+ return {
+ type: "TSBooleanKeyword"
+ };
+}
+function tsBigIntKeyword() {
+ return {
+ type: "TSBigIntKeyword"
+ };
+}
+function tsIntrinsicKeyword() {
+ return {
+ type: "TSIntrinsicKeyword"
+ };
+}
+function tsNeverKeyword() {
+ return {
+ type: "TSNeverKeyword"
+ };
+}
+function tsNullKeyword() {
+ return {
+ type: "TSNullKeyword"
+ };
+}
+function tsNumberKeyword() {
+ return {
+ type: "TSNumberKeyword"
+ };
+}
+function tsObjectKeyword() {
+ return {
+ type: "TSObjectKeyword"
+ };
+}
+function tsStringKeyword() {
+ return {
+ type: "TSStringKeyword"
+ };
+}
+function tsSymbolKeyword() {
+ return {
+ type: "TSSymbolKeyword"
+ };
+}
+function tsUndefinedKeyword() {
+ return {
+ type: "TSUndefinedKeyword"
+ };
+}
+function tsUnknownKeyword() {
+ return {
+ type: "TSUnknownKeyword"
+ };
+}
+function tsVoidKeyword() {
+ return {
+ type: "TSVoidKeyword"
+ };
+}
+function tsThisType() {
+ return {
+ type: "TSThisType"
+ };
+}
+function tsFunctionType(typeParameters = null, parameters, typeAnnotation = null) {
+ const node = {
+ type: "TSFunctionType",
+ typeParameters,
+ parameters,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSFunctionType;
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.parameters, node, "parameters", parameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsConstructorType(typeParameters = null, parameters, typeAnnotation = null) {
+ const node = {
+ type: "TSConstructorType",
+ typeParameters,
+ parameters,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSConstructorType;
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.parameters, node, "parameters", parameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsTypeReference(typeName, typeParameters = null) {
+ const node = {
+ type: "TSTypeReference",
+ typeName,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.TSTypeReference;
+ validate(defs.typeName, node, "typeName", typeName, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function tsTypePredicate(parameterName, typeAnnotation = null, asserts = null) {
+ const node = {
+ type: "TSTypePredicate",
+ parameterName,
+ typeAnnotation,
+ asserts
+ };
+ const defs = NODE_FIELDS.TSTypePredicate;
+ validate(defs.parameterName, node, "parameterName", parameterName, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ validate(defs.asserts, node, "asserts", asserts);
+ return node;
+}
+function tsTypeQuery(exprName, typeParameters = null) {
+ const node = {
+ type: "TSTypeQuery",
+ exprName,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.TSTypeQuery;
+ validate(defs.exprName, node, "exprName", exprName, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function tsTypeLiteral(members) {
+ const node = {
+ type: "TSTypeLiteral",
+ members
+ };
+ const defs = NODE_FIELDS.TSTypeLiteral;
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function tsArrayType(elementType) {
+ const node = {
+ type: "TSArrayType",
+ elementType
+ };
+ const defs = NODE_FIELDS.TSArrayType;
+ validate(defs.elementType, node, "elementType", elementType, 1);
+ return node;
+}
+function tsTupleType(elementTypes) {
+ const node = {
+ type: "TSTupleType",
+ elementTypes
+ };
+ const defs = NODE_FIELDS.TSTupleType;
+ validate(defs.elementTypes, node, "elementTypes", elementTypes, 1);
+ return node;
+}
+function tsOptionalType(typeAnnotation) {
+ const node = {
+ type: "TSOptionalType",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSOptionalType;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsRestType(typeAnnotation) {
+ const node = {
+ type: "TSRestType",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSRestType;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsNamedTupleMember(label, elementType, optional = false) {
+ const node = {
+ type: "TSNamedTupleMember",
+ label,
+ elementType,
+ optional
+ };
+ const defs = NODE_FIELDS.TSNamedTupleMember;
+ validate(defs.label, node, "label", label, 1);
+ validate(defs.elementType, node, "elementType", elementType, 1);
+ validate(defs.optional, node, "optional", optional);
+ return node;
+}
+function tsUnionType(types) {
+ const node = {
+ type: "TSUnionType",
+ types
+ };
+ const defs = NODE_FIELDS.TSUnionType;
+ validate(defs.types, node, "types", types, 1);
+ return node;
+}
+function tsIntersectionType(types) {
+ const node = {
+ type: "TSIntersectionType",
+ types
+ };
+ const defs = NODE_FIELDS.TSIntersectionType;
+ validate(defs.types, node, "types", types, 1);
+ return node;
+}
+function tsConditionalType(checkType, extendsType, trueType, falseType) {
+ const node = {
+ type: "TSConditionalType",
+ checkType,
+ extendsType,
+ trueType,
+ falseType
+ };
+ const defs = NODE_FIELDS.TSConditionalType;
+ validate(defs.checkType, node, "checkType", checkType, 1);
+ validate(defs.extendsType, node, "extendsType", extendsType, 1);
+ validate(defs.trueType, node, "trueType", trueType, 1);
+ validate(defs.falseType, node, "falseType", falseType, 1);
+ return node;
+}
+function tsInferType(typeParameter) {
+ const node = {
+ type: "TSInferType",
+ typeParameter
+ };
+ const defs = NODE_FIELDS.TSInferType;
+ validate(defs.typeParameter, node, "typeParameter", typeParameter, 1);
+ return node;
+}
+function tsParenthesizedType(typeAnnotation) {
+ const node = {
+ type: "TSParenthesizedType",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSParenthesizedType;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsTypeOperator(typeAnnotation) {
+ const node = {
+ type: "TSTypeOperator",
+ typeAnnotation,
+ operator: null
+ };
+ const defs = NODE_FIELDS.TSTypeOperator;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsIndexedAccessType(objectType, indexType) {
+ const node = {
+ type: "TSIndexedAccessType",
+ objectType,
+ indexType
+ };
+ const defs = NODE_FIELDS.TSIndexedAccessType;
+ validate(defs.objectType, node, "objectType", objectType, 1);
+ validate(defs.indexType, node, "indexType", indexType, 1);
+ return node;
+}
+function tsMappedType(typeParameter, typeAnnotation = null, nameType = null) {
+ const node = {
+ type: "TSMappedType",
+ typeParameter,
+ typeAnnotation,
+ nameType
+ };
+ const defs = NODE_FIELDS.TSMappedType;
+ validate(defs.typeParameter, node, "typeParameter", typeParameter, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ validate(defs.nameType, node, "nameType", nameType, 1);
+ return node;
+}
+function tsTemplateLiteralType(quasis, types) {
+ const node = {
+ type: "TSTemplateLiteralType",
+ quasis,
+ types
+ };
+ const defs = NODE_FIELDS.TSTemplateLiteralType;
+ validate(defs.quasis, node, "quasis", quasis, 1);
+ validate(defs.types, node, "types", types, 1);
+ return node;
+}
+function tsLiteralType(literal) {
+ const node = {
+ type: "TSLiteralType",
+ literal
+ };
+ const defs = NODE_FIELDS.TSLiteralType;
+ validate(defs.literal, node, "literal", literal, 1);
+ return node;
+}
+function tsExpressionWithTypeArguments(expression, typeParameters = null) {
+ const node = {
+ type: "TSExpressionWithTypeArguments",
+ expression,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.TSExpressionWithTypeArguments;
+ validate(defs.expression, node, "expression", expression, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function tsInterfaceDeclaration(id, typeParameters = null, _extends = null, body) {
+ const node = {
+ type: "TSInterfaceDeclaration",
+ id,
+ typeParameters,
+ extends: _extends,
+ body
+ };
+ const defs = NODE_FIELDS.TSInterfaceDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.extends, node, "extends", _extends, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function tsInterfaceBody(body) {
+ const node = {
+ type: "TSInterfaceBody",
+ body
+ };
+ const defs = NODE_FIELDS.TSInterfaceBody;
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function tsTypeAliasDeclaration(id, typeParameters = null, typeAnnotation) {
+ const node = {
+ type: "TSTypeAliasDeclaration",
+ id,
+ typeParameters,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSTypeAliasDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsInstantiationExpression(expression, typeParameters = null) {
+ const node = {
+ type: "TSInstantiationExpression",
+ expression,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.TSInstantiationExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function tsAsExpression(expression, typeAnnotation) {
+ const node = {
+ type: "TSAsExpression",
+ expression,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSAsExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsSatisfiesExpression(expression, typeAnnotation) {
+ const node = {
+ type: "TSSatisfiesExpression",
+ expression,
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSSatisfiesExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsTypeAssertion(typeAnnotation, expression) {
+ const node = {
+ type: "TSTypeAssertion",
+ typeAnnotation,
+ expression
+ };
+ const defs = NODE_FIELDS.TSTypeAssertion;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function tsEnumBody(members) {
+ const node = {
+ type: "TSEnumBody",
+ members
+ };
+ const defs = NODE_FIELDS.TSEnumBody;
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function tsEnumDeclaration(id, members) {
+ const node = {
+ type: "TSEnumDeclaration",
+ id,
+ members
+ };
+ const defs = NODE_FIELDS.TSEnumDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.members, node, "members", members, 1);
+ return node;
+}
+function tsEnumMember(id, initializer = null) {
+ const node = {
+ type: "TSEnumMember",
+ id,
+ initializer
+ };
+ const defs = NODE_FIELDS.TSEnumMember;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.initializer, node, "initializer", initializer, 1);
+ return node;
+}
+function tsModuleDeclaration(id, body) {
+ const node = {
+ type: "TSModuleDeclaration",
+ id,
+ body,
+ kind: null
+ };
+ const defs = NODE_FIELDS.TSModuleDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function tsModuleBlock(body) {
+ const node = {
+ type: "TSModuleBlock",
+ body
+ };
+ const defs = NODE_FIELDS.TSModuleBlock;
+ validate(defs.body, node, "body", body, 1);
+ return node;
+}
+function tsImportType(argument, qualifier = null, typeParameters = null) {
+ const node = {
+ type: "TSImportType",
+ argument,
+ qualifier,
+ typeParameters
+ };
+ const defs = NODE_FIELDS.TSImportType;
+ validate(defs.argument, node, "argument", argument, 1);
+ validate(defs.qualifier, node, "qualifier", qualifier, 1);
+ validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
+ return node;
+}
+function tsImportEqualsDeclaration(id, moduleReference) {
+ const node = {
+ type: "TSImportEqualsDeclaration",
+ id,
+ moduleReference,
+ isExport: null
+ };
+ const defs = NODE_FIELDS.TSImportEqualsDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ validate(defs.moduleReference, node, "moduleReference", moduleReference, 1);
+ return node;
+}
+function tsExternalModuleReference(expression) {
+ const node = {
+ type: "TSExternalModuleReference",
+ expression
+ };
+ const defs = NODE_FIELDS.TSExternalModuleReference;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function tsNonNullExpression(expression) {
+ const node = {
+ type: "TSNonNullExpression",
+ expression
+ };
+ const defs = NODE_FIELDS.TSNonNullExpression;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function tsExportAssignment(expression) {
+ const node = {
+ type: "TSExportAssignment",
+ expression
+ };
+ const defs = NODE_FIELDS.TSExportAssignment;
+ validate(defs.expression, node, "expression", expression, 1);
+ return node;
+}
+function tsNamespaceExportDeclaration(id) {
+ const node = {
+ type: "TSNamespaceExportDeclaration",
+ id
+ };
+ const defs = NODE_FIELDS.TSNamespaceExportDeclaration;
+ validate(defs.id, node, "id", id, 1);
+ return node;
+}
+function tsTypeAnnotation(typeAnnotation) {
+ const node = {
+ type: "TSTypeAnnotation",
+ typeAnnotation
+ };
+ const defs = NODE_FIELDS.TSTypeAnnotation;
+ validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
+ return node;
+}
+function tsTypeParameterInstantiation(params) {
+ const node = {
+ type: "TSTypeParameterInstantiation",
+ params
+ };
+ const defs = NODE_FIELDS.TSTypeParameterInstantiation;
+ validate(defs.params, node, "params", params, 1);
+ return node;
+}
+function tsTypeParameterDeclaration(params) {
+ const node = {
+ type: "TSTypeParameterDeclaration",
+ params
+ };
+ const defs = NODE_FIELDS.TSTypeParameterDeclaration;
+ validate(defs.params, node, "params", params, 1);
+ return node;
+}
+function tsTypeParameter(constraint = null, _default = null, name) {
+ const node = {
+ type: "TSTypeParameter",
+ constraint,
+ default: _default,
+ name
+ };
+ const defs = NODE_FIELDS.TSTypeParameter;
+ validate(defs.constraint, node, "constraint", constraint, 1);
+ validate(defs.default, node, "default", _default, 1);
+ validate(defs.name, node, "name", name);
+ return node;
+}
+function NumberLiteral(value) {
+ (0, _deprecationWarning.default)("NumberLiteral", "NumericLiteral", "The node type ");
+ return numericLiteral(value);
+}
+function RegexLiteral(pattern, flags = "") {
+ (0, _deprecationWarning.default)("RegexLiteral", "RegExpLiteral", "The node type ");
+ return regExpLiteral(pattern, flags);
+}
+function RestProperty(argument) {
+ (0, _deprecationWarning.default)("RestProperty", "RestElement", "The node type ");
+ return restElement(argument);
+}
+function SpreadProperty(argument) {
+ (0, _deprecationWarning.default)("SpreadProperty", "SpreadElement", "The node type ");
+ return spreadElement(argument);
+}
+
+//# sourceMappingURL=lowercase.js.map
+
+
+/***/ }),
+
+/***/ 8530:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
}));
-var _lowercase = __nccwpck_require__(9130);
+exports.JSXIdentifier = exports.JSXFragment = exports.JSXExpressionContainer = exports.JSXEmptyExpression = exports.JSXElement = exports.JSXClosingFragment = exports.JSXClosingElement = exports.JSXAttribute = exports.IntersectionTypeAnnotation = exports.InterpreterDirective = exports.InterfaceTypeAnnotation = exports.InterfaceExtends = exports.InterfaceDeclaration = exports.InferredPredicate = exports.IndexedAccessType = exports.ImportSpecifier = exports.ImportNamespaceSpecifier = exports.ImportExpression = exports.ImportDefaultSpecifier = exports.ImportDeclaration = exports.ImportAttribute = exports.Import = exports.IfStatement = exports.Identifier = exports.GenericTypeAnnotation = exports.FunctionTypeParam = exports.FunctionTypeAnnotation = exports.FunctionExpression = exports.FunctionDeclaration = exports.ForStatement = exports.ForOfStatement = exports.ForInStatement = exports.File = exports.ExpressionStatement = exports.ExportSpecifier = exports.ExportNamespaceSpecifier = exports.ExportNamedDeclaration = exports.ExportDefaultSpecifier = exports.ExportDefaultDeclaration = exports.ExportAllDeclaration = exports.ExistsTypeAnnotation = exports.EnumSymbolBody = exports.EnumStringMember = exports.EnumStringBody = exports.EnumNumberMember = exports.EnumNumberBody = exports.EnumDefaultedMember = exports.EnumDeclaration = exports.EnumBooleanMember = exports.EnumBooleanBody = exports.EmptyTypeAnnotation = exports.EmptyStatement = exports.DoWhileStatement = exports.DoExpression = exports.DirectiveLiteral = exports.Directive = exports.Decorator = exports.DeclaredPredicate = exports.DeclareVariable = exports.DeclareTypeAlias = exports.DeclareOpaqueType = exports.DeclareModuleExports = exports.DeclareModule = exports.DeclareInterface = exports.DeclareFunction = exports.DeclareExportDeclaration = exports.DeclareExportAllDeclaration = exports.DeclareClass = exports.DecimalLiteral = exports.DebuggerStatement = exports.ContinueStatement = exports.ConditionalExpression = exports.ClassProperty = exports.ClassPrivateProperty = exports.ClassPrivateMethod = exports.ClassMethod = exports.ClassImplements = exports.ClassExpression = exports.ClassDeclaration = exports.ClassBody = exports.ClassAccessorProperty = exports.CatchClause = exports.CallExpression = exports.BreakStatement = exports.BooleanTypeAnnotation = exports.BooleanLiteralTypeAnnotation = exports.BooleanLiteral = exports.BlockStatement = exports.BindExpression = exports.BinaryExpression = exports.BigIntLiteral = exports.AwaitExpression = exports.AssignmentPattern = exports.AssignmentExpression = exports.ArrowFunctionExpression = exports.ArrayTypeAnnotation = exports.ArrayPattern = exports.ArrayExpression = exports.ArgumentPlaceholder = exports.AnyTypeAnnotation = void 0;
+exports.TSNumberKeyword = exports.TSNullKeyword = exports.TSNonNullExpression = exports.TSNeverKeyword = exports.TSNamespaceExportDeclaration = exports.TSNamedTupleMember = exports.TSModuleDeclaration = exports.TSModuleBlock = exports.TSMethodSignature = exports.TSMappedType = exports.TSLiteralType = exports.TSIntrinsicKeyword = exports.TSIntersectionType = exports.TSInterfaceDeclaration = exports.TSInterfaceBody = exports.TSInstantiationExpression = exports.TSInferType = exports.TSIndexedAccessType = exports.TSIndexSignature = exports.TSImportType = exports.TSImportEqualsDeclaration = exports.TSFunctionType = exports.TSExternalModuleReference = exports.TSExpressionWithTypeArguments = exports.TSExportAssignment = exports.TSEnumMember = exports.TSEnumDeclaration = exports.TSEnumBody = exports.TSDeclareMethod = exports.TSDeclareFunction = exports.TSConstructorType = exports.TSConstructSignatureDeclaration = exports.TSConditionalType = exports.TSCallSignatureDeclaration = exports.TSBooleanKeyword = exports.TSBigIntKeyword = exports.TSAsExpression = exports.TSArrayType = exports.TSAnyKeyword = exports.SymbolTypeAnnotation = exports.SwitchStatement = exports.SwitchCase = exports.Super = exports.StringTypeAnnotation = exports.StringLiteralTypeAnnotation = exports.StringLiteral = exports.StaticBlock = exports.SpreadProperty = exports.SpreadElement = exports.SequenceExpression = exports.ReturnStatement = exports.RestProperty = exports.RestElement = exports.RegexLiteral = exports.RegExpLiteral = exports.RecordExpression = exports.QualifiedTypeIdentifier = exports.Program = exports.PrivateName = exports.Placeholder = exports.PipelineTopicExpression = exports.PipelinePrimaryTopicReference = exports.PipelineBareFunction = exports.ParenthesizedExpression = exports.OptionalMemberExpression = exports.OptionalIndexedAccessType = exports.OptionalCallExpression = exports.OpaqueType = exports.ObjectTypeSpreadProperty = exports.ObjectTypeProperty = exports.ObjectTypeInternalSlot = exports.ObjectTypeIndexer = exports.ObjectTypeCallProperty = exports.ObjectTypeAnnotation = exports.ObjectProperty = exports.ObjectPattern = exports.ObjectMethod = exports.ObjectExpression = exports.NumericLiteral = exports.NumberTypeAnnotation = exports.NumberLiteralTypeAnnotation = exports.NumberLiteral = exports.NullableTypeAnnotation = exports.NullLiteralTypeAnnotation = exports.NullLiteral = exports.Noop = exports.NewExpression = exports.ModuleExpression = exports.MixedTypeAnnotation = exports.MetaProperty = exports.MemberExpression = exports.LogicalExpression = exports.LabeledStatement = exports.JSXText = exports.JSXSpreadChild = exports.JSXSpreadAttribute = exports.JSXOpeningFragment = exports.JSXOpeningElement = exports.JSXNamespacedName = exports.JSXMemberExpression = void 0;
+exports.YieldExpression = exports.WithStatement = exports.WhileStatement = exports.VoidTypeAnnotation = exports.Variance = exports.VariableDeclarator = exports.VariableDeclaration = exports.V8IntrinsicIdentifier = exports.UpdateExpression = exports.UnionTypeAnnotation = exports.UnaryExpression = exports.TypeofTypeAnnotation = exports.TypeParameterInstantiation = exports.TypeParameterDeclaration = exports.TypeParameter = exports.TypeCastExpression = exports.TypeAnnotation = exports.TypeAlias = exports.TupleTypeAnnotation = exports.TupleExpression = exports.TryStatement = exports.TopicReference = exports.ThrowStatement = exports.ThisTypeAnnotation = exports.ThisExpression = exports.TemplateLiteral = exports.TemplateElement = exports.TaggedTemplateExpression = exports.TSVoidKeyword = exports.TSUnknownKeyword = exports.TSUnionType = exports.TSUndefinedKeyword = exports.TSTypeReference = exports.TSTypeQuery = exports.TSTypePredicate = exports.TSTypeParameterInstantiation = exports.TSTypeParameterDeclaration = exports.TSTypeParameter = exports.TSTypeOperator = exports.TSTypeLiteral = exports.TSTypeAssertion = exports.TSTypeAnnotation = exports.TSTypeAliasDeclaration = exports.TSTupleType = exports.TSThisType = exports.TSTemplateLiteralType = exports.TSSymbolKeyword = exports.TSStringKeyword = exports.TSSatisfiesExpression = exports.TSRestType = exports.TSQualifiedName = exports.TSPropertySignature = exports.TSParenthesizedType = exports.TSParameterProperty = exports.TSOptionalType = exports.TSObjectKeyword = void 0;
+var b = __nccwpck_require__(9130);
+var _deprecationWarning = __nccwpck_require__(496);
+function alias(lowercase) {
+ {
+ return b[lowercase];
+ }
+}
+const ArrayExpression = exports.ArrayExpression = alias("arrayExpression"),
+ AssignmentExpression = exports.AssignmentExpression = alias("assignmentExpression"),
+ BinaryExpression = exports.BinaryExpression = alias("binaryExpression"),
+ InterpreterDirective = exports.InterpreterDirective = alias("interpreterDirective"),
+ Directive = exports.Directive = alias("directive"),
+ DirectiveLiteral = exports.DirectiveLiteral = alias("directiveLiteral"),
+ BlockStatement = exports.BlockStatement = alias("blockStatement"),
+ BreakStatement = exports.BreakStatement = alias("breakStatement"),
+ CallExpression = exports.CallExpression = alias("callExpression"),
+ CatchClause = exports.CatchClause = alias("catchClause"),
+ ConditionalExpression = exports.ConditionalExpression = alias("conditionalExpression"),
+ ContinueStatement = exports.ContinueStatement = alias("continueStatement"),
+ DebuggerStatement = exports.DebuggerStatement = alias("debuggerStatement"),
+ DoWhileStatement = exports.DoWhileStatement = alias("doWhileStatement"),
+ EmptyStatement = exports.EmptyStatement = alias("emptyStatement"),
+ ExpressionStatement = exports.ExpressionStatement = alias("expressionStatement"),
+ File = exports.File = alias("file"),
+ ForInStatement = exports.ForInStatement = alias("forInStatement"),
+ ForStatement = exports.ForStatement = alias("forStatement"),
+ FunctionDeclaration = exports.FunctionDeclaration = alias("functionDeclaration"),
+ FunctionExpression = exports.FunctionExpression = alias("functionExpression"),
+ Identifier = exports.Identifier = alias("identifier"),
+ IfStatement = exports.IfStatement = alias("ifStatement"),
+ LabeledStatement = exports.LabeledStatement = alias("labeledStatement"),
+ StringLiteral = exports.StringLiteral = alias("stringLiteral"),
+ NumericLiteral = exports.NumericLiteral = alias("numericLiteral"),
+ NullLiteral = exports.NullLiteral = alias("nullLiteral"),
+ BooleanLiteral = exports.BooleanLiteral = alias("booleanLiteral"),
+ RegExpLiteral = exports.RegExpLiteral = alias("regExpLiteral"),
+ LogicalExpression = exports.LogicalExpression = alias("logicalExpression"),
+ MemberExpression = exports.MemberExpression = alias("memberExpression"),
+ NewExpression = exports.NewExpression = alias("newExpression"),
+ Program = exports.Program = alias("program"),
+ ObjectExpression = exports.ObjectExpression = alias("objectExpression"),
+ ObjectMethod = exports.ObjectMethod = alias("objectMethod"),
+ ObjectProperty = exports.ObjectProperty = alias("objectProperty"),
+ RestElement = exports.RestElement = alias("restElement"),
+ ReturnStatement = exports.ReturnStatement = alias("returnStatement"),
+ SequenceExpression = exports.SequenceExpression = alias("sequenceExpression"),
+ ParenthesizedExpression = exports.ParenthesizedExpression = alias("parenthesizedExpression"),
+ SwitchCase = exports.SwitchCase = alias("switchCase"),
+ SwitchStatement = exports.SwitchStatement = alias("switchStatement"),
+ ThisExpression = exports.ThisExpression = alias("thisExpression"),
+ ThrowStatement = exports.ThrowStatement = alias("throwStatement"),
+ TryStatement = exports.TryStatement = alias("tryStatement"),
+ UnaryExpression = exports.UnaryExpression = alias("unaryExpression"),
+ UpdateExpression = exports.UpdateExpression = alias("updateExpression"),
+ VariableDeclaration = exports.VariableDeclaration = alias("variableDeclaration"),
+ VariableDeclarator = exports.VariableDeclarator = alias("variableDeclarator"),
+ WhileStatement = exports.WhileStatement = alias("whileStatement"),
+ WithStatement = exports.WithStatement = alias("withStatement"),
+ AssignmentPattern = exports.AssignmentPattern = alias("assignmentPattern"),
+ ArrayPattern = exports.ArrayPattern = alias("arrayPattern"),
+ ArrowFunctionExpression = exports.ArrowFunctionExpression = alias("arrowFunctionExpression"),
+ ClassBody = exports.ClassBody = alias("classBody"),
+ ClassExpression = exports.ClassExpression = alias("classExpression"),
+ ClassDeclaration = exports.ClassDeclaration = alias("classDeclaration"),
+ ExportAllDeclaration = exports.ExportAllDeclaration = alias("exportAllDeclaration"),
+ ExportDefaultDeclaration = exports.ExportDefaultDeclaration = alias("exportDefaultDeclaration"),
+ ExportNamedDeclaration = exports.ExportNamedDeclaration = alias("exportNamedDeclaration"),
+ ExportSpecifier = exports.ExportSpecifier = alias("exportSpecifier"),
+ ForOfStatement = exports.ForOfStatement = alias("forOfStatement"),
+ ImportDeclaration = exports.ImportDeclaration = alias("importDeclaration"),
+ ImportDefaultSpecifier = exports.ImportDefaultSpecifier = alias("importDefaultSpecifier"),
+ ImportNamespaceSpecifier = exports.ImportNamespaceSpecifier = alias("importNamespaceSpecifier"),
+ ImportSpecifier = exports.ImportSpecifier = alias("importSpecifier"),
+ ImportExpression = exports.ImportExpression = alias("importExpression"),
+ MetaProperty = exports.MetaProperty = alias("metaProperty"),
+ ClassMethod = exports.ClassMethod = alias("classMethod"),
+ ObjectPattern = exports.ObjectPattern = alias("objectPattern"),
+ SpreadElement = exports.SpreadElement = alias("spreadElement"),
+ Super = exports.Super = alias("super"),
+ TaggedTemplateExpression = exports.TaggedTemplateExpression = alias("taggedTemplateExpression"),
+ TemplateElement = exports.TemplateElement = alias("templateElement"),
+ TemplateLiteral = exports.TemplateLiteral = alias("templateLiteral"),
+ YieldExpression = exports.YieldExpression = alias("yieldExpression"),
+ AwaitExpression = exports.AwaitExpression = alias("awaitExpression"),
+ Import = exports.Import = alias("import"),
+ BigIntLiteral = exports.BigIntLiteral = alias("bigIntLiteral"),
+ ExportNamespaceSpecifier = exports.ExportNamespaceSpecifier = alias("exportNamespaceSpecifier"),
+ OptionalMemberExpression = exports.OptionalMemberExpression = alias("optionalMemberExpression"),
+ OptionalCallExpression = exports.OptionalCallExpression = alias("optionalCallExpression"),
+ ClassProperty = exports.ClassProperty = alias("classProperty"),
+ ClassAccessorProperty = exports.ClassAccessorProperty = alias("classAccessorProperty"),
+ ClassPrivateProperty = exports.ClassPrivateProperty = alias("classPrivateProperty"),
+ ClassPrivateMethod = exports.ClassPrivateMethod = alias("classPrivateMethod"),
+ PrivateName = exports.PrivateName = alias("privateName"),
+ StaticBlock = exports.StaticBlock = alias("staticBlock"),
+ ImportAttribute = exports.ImportAttribute = alias("importAttribute"),
+ AnyTypeAnnotation = exports.AnyTypeAnnotation = alias("anyTypeAnnotation"),
+ ArrayTypeAnnotation = exports.ArrayTypeAnnotation = alias("arrayTypeAnnotation"),
+ BooleanTypeAnnotation = exports.BooleanTypeAnnotation = alias("booleanTypeAnnotation"),
+ BooleanLiteralTypeAnnotation = exports.BooleanLiteralTypeAnnotation = alias("booleanLiteralTypeAnnotation"),
+ NullLiteralTypeAnnotation = exports.NullLiteralTypeAnnotation = alias("nullLiteralTypeAnnotation"),
+ ClassImplements = exports.ClassImplements = alias("classImplements"),
+ DeclareClass = exports.DeclareClass = alias("declareClass"),
+ DeclareFunction = exports.DeclareFunction = alias("declareFunction"),
+ DeclareInterface = exports.DeclareInterface = alias("declareInterface"),
+ DeclareModule = exports.DeclareModule = alias("declareModule"),
+ DeclareModuleExports = exports.DeclareModuleExports = alias("declareModuleExports"),
+ DeclareTypeAlias = exports.DeclareTypeAlias = alias("declareTypeAlias"),
+ DeclareOpaqueType = exports.DeclareOpaqueType = alias("declareOpaqueType"),
+ DeclareVariable = exports.DeclareVariable = alias("declareVariable"),
+ DeclareExportDeclaration = exports.DeclareExportDeclaration = alias("declareExportDeclaration"),
+ DeclareExportAllDeclaration = exports.DeclareExportAllDeclaration = alias("declareExportAllDeclaration"),
+ DeclaredPredicate = exports.DeclaredPredicate = alias("declaredPredicate"),
+ ExistsTypeAnnotation = exports.ExistsTypeAnnotation = alias("existsTypeAnnotation"),
+ FunctionTypeAnnotation = exports.FunctionTypeAnnotation = alias("functionTypeAnnotation"),
+ FunctionTypeParam = exports.FunctionTypeParam = alias("functionTypeParam"),
+ GenericTypeAnnotation = exports.GenericTypeAnnotation = alias("genericTypeAnnotation"),
+ InferredPredicate = exports.InferredPredicate = alias("inferredPredicate"),
+ InterfaceExtends = exports.InterfaceExtends = alias("interfaceExtends"),
+ InterfaceDeclaration = exports.InterfaceDeclaration = alias("interfaceDeclaration"),
+ InterfaceTypeAnnotation = exports.InterfaceTypeAnnotation = alias("interfaceTypeAnnotation"),
+ IntersectionTypeAnnotation = exports.IntersectionTypeAnnotation = alias("intersectionTypeAnnotation"),
+ MixedTypeAnnotation = exports.MixedTypeAnnotation = alias("mixedTypeAnnotation"),
+ EmptyTypeAnnotation = exports.EmptyTypeAnnotation = alias("emptyTypeAnnotation"),
+ NullableTypeAnnotation = exports.NullableTypeAnnotation = alias("nullableTypeAnnotation"),
+ NumberLiteralTypeAnnotation = exports.NumberLiteralTypeAnnotation = alias("numberLiteralTypeAnnotation"),
+ NumberTypeAnnotation = exports.NumberTypeAnnotation = alias("numberTypeAnnotation"),
+ ObjectTypeAnnotation = exports.ObjectTypeAnnotation = alias("objectTypeAnnotation"),
+ ObjectTypeInternalSlot = exports.ObjectTypeInternalSlot = alias("objectTypeInternalSlot"),
+ ObjectTypeCallProperty = exports.ObjectTypeCallProperty = alias("objectTypeCallProperty"),
+ ObjectTypeIndexer = exports.ObjectTypeIndexer = alias("objectTypeIndexer"),
+ ObjectTypeProperty = exports.ObjectTypeProperty = alias("objectTypeProperty"),
+ ObjectTypeSpreadProperty = exports.ObjectTypeSpreadProperty = alias("objectTypeSpreadProperty"),
+ OpaqueType = exports.OpaqueType = alias("opaqueType"),
+ QualifiedTypeIdentifier = exports.QualifiedTypeIdentifier = alias("qualifiedTypeIdentifier"),
+ StringLiteralTypeAnnotation = exports.StringLiteralTypeAnnotation = alias("stringLiteralTypeAnnotation"),
+ StringTypeAnnotation = exports.StringTypeAnnotation = alias("stringTypeAnnotation"),
+ SymbolTypeAnnotation = exports.SymbolTypeAnnotation = alias("symbolTypeAnnotation"),
+ ThisTypeAnnotation = exports.ThisTypeAnnotation = alias("thisTypeAnnotation"),
+ TupleTypeAnnotation = exports.TupleTypeAnnotation = alias("tupleTypeAnnotation"),
+ TypeofTypeAnnotation = exports.TypeofTypeAnnotation = alias("typeofTypeAnnotation"),
+ TypeAlias = exports.TypeAlias = alias("typeAlias"),
+ TypeAnnotation = exports.TypeAnnotation = alias("typeAnnotation"),
+ TypeCastExpression = exports.TypeCastExpression = alias("typeCastExpression"),
+ TypeParameter = exports.TypeParameter = alias("typeParameter"),
+ TypeParameterDeclaration = exports.TypeParameterDeclaration = alias("typeParameterDeclaration"),
+ TypeParameterInstantiation = exports.TypeParameterInstantiation = alias("typeParameterInstantiation"),
+ UnionTypeAnnotation = exports.UnionTypeAnnotation = alias("unionTypeAnnotation"),
+ Variance = exports.Variance = alias("variance"),
+ VoidTypeAnnotation = exports.VoidTypeAnnotation = alias("voidTypeAnnotation"),
+ EnumDeclaration = exports.EnumDeclaration = alias("enumDeclaration"),
+ EnumBooleanBody = exports.EnumBooleanBody = alias("enumBooleanBody"),
+ EnumNumberBody = exports.EnumNumberBody = alias("enumNumberBody"),
+ EnumStringBody = exports.EnumStringBody = alias("enumStringBody"),
+ EnumSymbolBody = exports.EnumSymbolBody = alias("enumSymbolBody"),
+ EnumBooleanMember = exports.EnumBooleanMember = alias("enumBooleanMember"),
+ EnumNumberMember = exports.EnumNumberMember = alias("enumNumberMember"),
+ EnumStringMember = exports.EnumStringMember = alias("enumStringMember"),
+ EnumDefaultedMember = exports.EnumDefaultedMember = alias("enumDefaultedMember"),
+ IndexedAccessType = exports.IndexedAccessType = alias("indexedAccessType"),
+ OptionalIndexedAccessType = exports.OptionalIndexedAccessType = alias("optionalIndexedAccessType"),
+ JSXAttribute = exports.JSXAttribute = alias("jsxAttribute"),
+ JSXClosingElement = exports.JSXClosingElement = alias("jsxClosingElement"),
+ JSXElement = exports.JSXElement = alias("jsxElement"),
+ JSXEmptyExpression = exports.JSXEmptyExpression = alias("jsxEmptyExpression"),
+ JSXExpressionContainer = exports.JSXExpressionContainer = alias("jsxExpressionContainer"),
+ JSXSpreadChild = exports.JSXSpreadChild = alias("jsxSpreadChild"),
+ JSXIdentifier = exports.JSXIdentifier = alias("jsxIdentifier"),
+ JSXMemberExpression = exports.JSXMemberExpression = alias("jsxMemberExpression"),
+ JSXNamespacedName = exports.JSXNamespacedName = alias("jsxNamespacedName"),
+ JSXOpeningElement = exports.JSXOpeningElement = alias("jsxOpeningElement"),
+ JSXSpreadAttribute = exports.JSXSpreadAttribute = alias("jsxSpreadAttribute"),
+ JSXText = exports.JSXText = alias("jsxText"),
+ JSXFragment = exports.JSXFragment = alias("jsxFragment"),
+ JSXOpeningFragment = exports.JSXOpeningFragment = alias("jsxOpeningFragment"),
+ JSXClosingFragment = exports.JSXClosingFragment = alias("jsxClosingFragment"),
+ Noop = exports.Noop = alias("noop"),
+ Placeholder = exports.Placeholder = alias("placeholder"),
+ V8IntrinsicIdentifier = exports.V8IntrinsicIdentifier = alias("v8IntrinsicIdentifier"),
+ ArgumentPlaceholder = exports.ArgumentPlaceholder = alias("argumentPlaceholder"),
+ BindExpression = exports.BindExpression = alias("bindExpression"),
+ Decorator = exports.Decorator = alias("decorator"),
+ DoExpression = exports.DoExpression = alias("doExpression"),
+ ExportDefaultSpecifier = exports.ExportDefaultSpecifier = alias("exportDefaultSpecifier"),
+ RecordExpression = exports.RecordExpression = alias("recordExpression"),
+ TupleExpression = exports.TupleExpression = alias("tupleExpression"),
+ DecimalLiteral = exports.DecimalLiteral = alias("decimalLiteral"),
+ ModuleExpression = exports.ModuleExpression = alias("moduleExpression"),
+ TopicReference = exports.TopicReference = alias("topicReference"),
+ PipelineTopicExpression = exports.PipelineTopicExpression = alias("pipelineTopicExpression"),
+ PipelineBareFunction = exports.PipelineBareFunction = alias("pipelineBareFunction"),
+ PipelinePrimaryTopicReference = exports.PipelinePrimaryTopicReference = alias("pipelinePrimaryTopicReference"),
+ TSParameterProperty = exports.TSParameterProperty = alias("tsParameterProperty"),
+ TSDeclareFunction = exports.TSDeclareFunction = alias("tsDeclareFunction"),
+ TSDeclareMethod = exports.TSDeclareMethod = alias("tsDeclareMethod"),
+ TSQualifiedName = exports.TSQualifiedName = alias("tsQualifiedName"),
+ TSCallSignatureDeclaration = exports.TSCallSignatureDeclaration = alias("tsCallSignatureDeclaration"),
+ TSConstructSignatureDeclaration = exports.TSConstructSignatureDeclaration = alias("tsConstructSignatureDeclaration"),
+ TSPropertySignature = exports.TSPropertySignature = alias("tsPropertySignature"),
+ TSMethodSignature = exports.TSMethodSignature = alias("tsMethodSignature"),
+ TSIndexSignature = exports.TSIndexSignature = alias("tsIndexSignature"),
+ TSAnyKeyword = exports.TSAnyKeyword = alias("tsAnyKeyword"),
+ TSBooleanKeyword = exports.TSBooleanKeyword = alias("tsBooleanKeyword"),
+ TSBigIntKeyword = exports.TSBigIntKeyword = alias("tsBigIntKeyword"),
+ TSIntrinsicKeyword = exports.TSIntrinsicKeyword = alias("tsIntrinsicKeyword"),
+ TSNeverKeyword = exports.TSNeverKeyword = alias("tsNeverKeyword"),
+ TSNullKeyword = exports.TSNullKeyword = alias("tsNullKeyword"),
+ TSNumberKeyword = exports.TSNumberKeyword = alias("tsNumberKeyword"),
+ TSObjectKeyword = exports.TSObjectKeyword = alias("tsObjectKeyword"),
+ TSStringKeyword = exports.TSStringKeyword = alias("tsStringKeyword"),
+ TSSymbolKeyword = exports.TSSymbolKeyword = alias("tsSymbolKeyword"),
+ TSUndefinedKeyword = exports.TSUndefinedKeyword = alias("tsUndefinedKeyword"),
+ TSUnknownKeyword = exports.TSUnknownKeyword = alias("tsUnknownKeyword"),
+ TSVoidKeyword = exports.TSVoidKeyword = alias("tsVoidKeyword"),
+ TSThisType = exports.TSThisType = alias("tsThisType"),
+ TSFunctionType = exports.TSFunctionType = alias("tsFunctionType"),
+ TSConstructorType = exports.TSConstructorType = alias("tsConstructorType"),
+ TSTypeReference = exports.TSTypeReference = alias("tsTypeReference"),
+ TSTypePredicate = exports.TSTypePredicate = alias("tsTypePredicate"),
+ TSTypeQuery = exports.TSTypeQuery = alias("tsTypeQuery"),
+ TSTypeLiteral = exports.TSTypeLiteral = alias("tsTypeLiteral"),
+ TSArrayType = exports.TSArrayType = alias("tsArrayType"),
+ TSTupleType = exports.TSTupleType = alias("tsTupleType"),
+ TSOptionalType = exports.TSOptionalType = alias("tsOptionalType"),
+ TSRestType = exports.TSRestType = alias("tsRestType"),
+ TSNamedTupleMember = exports.TSNamedTupleMember = alias("tsNamedTupleMember"),
+ TSUnionType = exports.TSUnionType = alias("tsUnionType"),
+ TSIntersectionType = exports.TSIntersectionType = alias("tsIntersectionType"),
+ TSConditionalType = exports.TSConditionalType = alias("tsConditionalType"),
+ TSInferType = exports.TSInferType = alias("tsInferType"),
+ TSParenthesizedType = exports.TSParenthesizedType = alias("tsParenthesizedType"),
+ TSTypeOperator = exports.TSTypeOperator = alias("tsTypeOperator"),
+ TSIndexedAccessType = exports.TSIndexedAccessType = alias("tsIndexedAccessType"),
+ TSMappedType = exports.TSMappedType = alias("tsMappedType"),
+ TSTemplateLiteralType = exports.TSTemplateLiteralType = alias("tsTemplateLiteralType"),
+ TSLiteralType = exports.TSLiteralType = alias("tsLiteralType"),
+ TSExpressionWithTypeArguments = exports.TSExpressionWithTypeArguments = alias("tsExpressionWithTypeArguments"),
+ TSInterfaceDeclaration = exports.TSInterfaceDeclaration = alias("tsInterfaceDeclaration"),
+ TSInterfaceBody = exports.TSInterfaceBody = alias("tsInterfaceBody"),
+ TSTypeAliasDeclaration = exports.TSTypeAliasDeclaration = alias("tsTypeAliasDeclaration"),
+ TSInstantiationExpression = exports.TSInstantiationExpression = alias("tsInstantiationExpression"),
+ TSAsExpression = exports.TSAsExpression = alias("tsAsExpression"),
+ TSSatisfiesExpression = exports.TSSatisfiesExpression = alias("tsSatisfiesExpression"),
+ TSTypeAssertion = exports.TSTypeAssertion = alias("tsTypeAssertion"),
+ TSEnumBody = exports.TSEnumBody = alias("tsEnumBody"),
+ TSEnumDeclaration = exports.TSEnumDeclaration = alias("tsEnumDeclaration"),
+ TSEnumMember = exports.TSEnumMember = alias("tsEnumMember"),
+ TSModuleDeclaration = exports.TSModuleDeclaration = alias("tsModuleDeclaration"),
+ TSModuleBlock = exports.TSModuleBlock = alias("tsModuleBlock"),
+ TSImportType = exports.TSImportType = alias("tsImportType"),
+ TSImportEqualsDeclaration = exports.TSImportEqualsDeclaration = alias("tsImportEqualsDeclaration"),
+ TSExternalModuleReference = exports.TSExternalModuleReference = alias("tsExternalModuleReference"),
+ TSNonNullExpression = exports.TSNonNullExpression = alias("tsNonNullExpression"),
+ TSExportAssignment = exports.TSExportAssignment = alias("tsExportAssignment"),
+ TSNamespaceExportDeclaration = exports.TSNamespaceExportDeclaration = alias("tsNamespaceExportDeclaration"),
+ TSTypeAnnotation = exports.TSTypeAnnotation = alias("tsTypeAnnotation"),
+ TSTypeParameterInstantiation = exports.TSTypeParameterInstantiation = alias("tsTypeParameterInstantiation"),
+ TSTypeParameterDeclaration = exports.TSTypeParameterDeclaration = alias("tsTypeParameterDeclaration"),
+ TSTypeParameter = exports.TSTypeParameter = alias("tsTypeParameter");
+const NumberLiteral = exports.NumberLiteral = b.numberLiteral,
+ RegexLiteral = exports.RegexLiteral = b.regexLiteral,
+ RestProperty = exports.RestProperty = b.restProperty,
+ SpreadProperty = exports.SpreadProperty = b.spreadProperty;
//# sourceMappingURL=uppercase.js.map
@@ -50797,18 +35286,32 @@ defineType("VariableDeclaration", {
declarations: (0, _utils.validateArrayOfType)("VariableDeclarator")
},
validate: process.env.BABEL_TYPES_8_BREAKING ? (() => {
- const withoutInit = (0, _utils.assertNodeType)("Identifier");
+ const withoutInit = (0, _utils.assertNodeType)("Identifier", "Placeholder");
+ const constOrLetOrVar = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "Placeholder");
+ const usingOrAwaitUsing = withoutInit;
return function (parent, key, node) {
- if ((0, _is.default)("ForXStatement", parent, {
+ const {
+ kind,
+ declarations
+ } = node;
+ const parentIsForX = (0, _is.default)("ForXStatement", parent, {
left: node
- })) {
- if (node.declarations.length !== 1) {
+ });
+ if (parentIsForX) {
+ if (declarations.length !== 1) {
throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`);
}
- } else {
- node.declarations.forEach(decl => {
- if (!decl.init) withoutInit(decl, "id", decl.id);
- });
+ }
+ for (const decl of declarations) {
+ if (kind === "const" || kind === "let" || kind === "var") {
+ if (!parentIsForX && !decl.init) {
+ withoutInit(decl, "id", decl.id);
+ } else {
+ constOrLetOrVar(decl, "id", decl.id);
+ }
+ } else {
+ usingOrAwaitUsing(decl, "id", decl.id);
+ }
}
};
})() : undefined
@@ -53083,7 +37586,7 @@ defineType("TSImportType", {
qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
["typeParameters"]: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation"),
options: {
- validate: (0, _utils.assertNodeType)("Expression"),
+ validate: (0, _utils.assertNodeType)("ObjectExpression"),
optional: true
}
}
@@ -54736,9 +39239,9 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports["default"] = deprecationWarning;
const warnings = new Set();
-function deprecationWarning(oldName, newName, prefix = "") {
- if (warnings.has(oldName)) return;
- warnings.add(oldName);
+function deprecationWarning(oldName, newName, prefix = "", cacheKey = oldName) {
+ if (warnings.has(cacheKey)) return;
+ warnings.add(cacheKey);
const {
internal,
trace
diff --git a/package-lock.json b/package-lock.json
index 50a972a84164..f3cec811253c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -170,10 +170,10 @@
"@react-native/babel-preset": "0.77.1",
"@react-native/metro-config": "0.77.1",
"@react-navigation/devtools": "^6.0.10",
- "@rnef/cli": "^0.7.1",
- "@rnef/platform-android": "^0.7.1",
- "@rnef/platform-ios": "^0.7.1",
- "@rnef/plugin-metro": "^0.7.1",
+ "@rnef/cli": "^0.7.6",
+ "@rnef/platform-android": "^0.7.6",
+ "@rnef/platform-ios": "^0.7.6",
+ "@rnef/plugin-metro": "^0.7.6",
"@storybook/addon-a11y": "^8.6.9",
"@storybook/addon-essentials": "^8.6.9",
"@storybook/addon-webpack5-compiler-babel": "^3.0.5",
@@ -440,14 +440,14 @@
}
},
"node_modules/@babel/code-frame": {
- "version": "7.26.2",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz",
- "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
+ "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
"license": "MIT",
"dependencies": {
- "@babel/helper-validator-identifier": "^7.25.9",
+ "@babel/helper-validator-identifier": "^7.27.1",
"js-tokens": "^4.0.0",
- "picocolors": "^1.0.0"
+ "picocolors": "^1.1.1"
},
"engines": {
"node": ">=6.9.0"
@@ -544,13 +544,13 @@
}
},
"node_modules/@babel/generator": {
- "version": "7.27.0",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz",
- "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.1.tgz",
+ "integrity": "sha512-UnJfnIpc/+JO0/+KRVQNGU+y5taA5vCbwN8+azkX6beii/ZF+enZJSOKo11ZSzGJjlNfJHfQtmQT8H+9TXPG2w==",
"license": "MIT",
"dependencies": {
- "@babel/parser": "^7.27.0",
- "@babel/types": "^7.27.0",
+ "@babel/parser": "^7.27.1",
+ "@babel/types": "^7.27.1",
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25",
"jsesc": "^3.0.2"
@@ -1056,17 +1056,19 @@
}
},
"node_modules/@babel/helper-string-parser": {
- "version": "7.25.9",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
- "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
- "version": "7.25.9",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
- "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
+ "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
@@ -1137,12 +1139,12 @@
}
},
"node_modules/@babel/parser": {
- "version": "7.27.0",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz",
- "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.1.tgz",
+ "integrity": "sha512-I0dZ3ZpCrJ1c04OqlNsQcKiZlsrXf/kkE4FXzID9rIOYICsAbA8mMDzhW/luRNAHdCNt7os/u8wenklZDlUVUQ==",
"license": "MIT",
"dependencies": {
- "@babel/types": "^7.27.0"
+ "@babel/types": "^7.27.1"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -2823,14 +2825,14 @@
"license": "MIT"
},
"node_modules/@babel/template": {
- "version": "7.27.0",
- "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz",
- "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.1.tgz",
+ "integrity": "sha512-Fyo3ghWMqkHHpHQCoBs2VnYjR4iWFFjguTDEqA5WgZDOrFesVjMhMM2FSqTKSoUSDO1VQtavj8NFpdRBEvJTtg==",
"license": "MIT",
"dependencies": {
- "@babel/code-frame": "^7.26.2",
- "@babel/parser": "^7.27.0",
- "@babel/types": "^7.27.0"
+ "@babel/code-frame": "^7.27.1",
+ "@babel/parser": "^7.27.1",
+ "@babel/types": "^7.27.1"
},
"engines": {
"node": ">=6.9.0"
@@ -2875,13 +2877,13 @@
}
},
"node_modules/@babel/types": {
- "version": "7.27.0",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz",
- "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==",
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.1.tgz",
+ "integrity": "sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==",
"license": "MIT",
"dependencies": {
- "@babel/helper-string-parser": "^7.25.9",
- "@babel/helper-validator-identifier": "^7.25.9"
+ "@babel/helper-string-parser": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.27.1"
},
"engines": {
"node": ">=6.9.0"
@@ -10622,14 +10624,14 @@
}
},
"node_modules/@rnef/cli": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/cli/-/cli-0.7.1.tgz",
- "integrity": "sha512-MBiC2Yd9bS9mM0Oqv5JVqW05w2/Oni5IWD6DG2WKrJJFURc+TpzbiNYgioFXXS4xUkNnlf2+3pLsZIGqzF6CaA==",
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/cli/-/cli-0.7.6.tgz",
+ "integrity": "sha512-mGpano3xcJoX14JaGmWKaC4qxHEQE89HrYGqLXbiOvBS/KqtvsJcsoKH2fyh7z+Ps+9HbZtfmesRLsKLJ5utrg==",
"dev": true,
"dependencies": {
"@react-native-community/cli-config": "^18.0.0",
- "@rnef/config": "^0.7.1",
- "@rnef/tools": "^0.7.1",
+ "@rnef/config": "^0.7.6",
+ "@rnef/tools": "^0.7.6",
"commander": "^12.1.0",
"tslib": "^2.3.0"
},
@@ -10795,43 +10797,42 @@
}
},
"node_modules/@rnef/config": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/config/-/config-0.7.1.tgz",
- "integrity": "sha512-ANWMHtDvgat2Pfqbz1nZe9PBFFchOFzV68ypJeul4EWvjmTOk/G0c2DuiM0wsFR6z0e0YI4lHG3FW53dxOZQTg==",
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/config/-/config-0.7.6.tgz",
+ "integrity": "sha512-vtdJk4EPyh6ODcjKtMJ4UYSnUpJMIWprGKLycsnK3Q8LDkCwSBYWpQd/bqun0O14G0Bxf9CERccO3r0jvPovZA==",
"dev": true,
"dependencies": {
"@babel/code-frame": "^7.26.2",
- "@rnef/tools": "^0.7.1",
+ "@rnef/tools": "^0.7.6",
"joi": "^17.13.3",
"tslib": "^2.3.0"
}
},
"node_modules/@rnef/platform-android": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/platform-android/-/platform-android-0.7.1.tgz",
- "integrity": "sha512-q++RasUefgMUw2yEuPQ7gszhGQVDzwXsFyZnYZ2/d+MMG0ihE0+u5tnEYPY2tcLCTpmPR6kmma+ucmb/t4KrSg==",
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/platform-android/-/platform-android-0.7.6.tgz",
+ "integrity": "sha512-9L3M6PNmvuUL5zKeZR7X0gF7ifzIIrV8tSOsGQ+HY7jYWakM7GoiBSpiIifRWaUPAcz7486cwg/K/QwBp0BlxA==",
"dev": true,
"dependencies": {
"@react-native-community/cli-config-android": "^18.0.0",
- "@rnef/tools": "^0.7.1",
+ "@rnef/tools": "^0.7.6",
"adm-zip": "^0.5.16",
"tslib": "^2.3.0"
}
},
"node_modules/@rnef/platform-apple-helpers": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/platform-apple-helpers/-/platform-apple-helpers-0.7.1.tgz",
- "integrity": "sha512-Bg8wt5BOBwmmWLt2rfJGtip4U4THnVWWvIl2suYZKX+6chhEOtykAe0pXcNeVBhxeUuF1M8qOl0QQymV+su0dA==",
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/platform-apple-helpers/-/platform-apple-helpers-0.7.6.tgz",
+ "integrity": "sha512-vty7+9O/7aC3yGvns4b+EvYpbcyQAx0hHOkHJk9BKN3K+qHlMr+RDQ9sHIiI+xDbmaLNdGUArnid6NI9zZHKBg==",
"dev": true,
"dependencies": {
"@react-native-community/cli-config": "^18.0.0",
"@react-native-community/cli-config-apple": "^18.0.0",
- "@rnef/tools": "^0.7.1",
+ "@rnef/tools": "^0.7.6",
"@types/adm-zip": "^0.5.7",
"adm-zip": "^0.5.16",
"fast-glob": "^3.3.2",
"fast-xml-parser": "^4.5.0",
- "tar": "^7.4.3",
"tslib": "^2.3.0"
}
},
@@ -10922,16 +10923,6 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
- "node_modules/@rnef/platform-apple-helpers/node_modules/chownr": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
- "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/@rnef/platform-apple-helpers/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -11002,45 +10993,6 @@
"js-yaml": "bin/js-yaml.js"
}
},
- "node_modules/@rnef/platform-apple-helpers/node_modules/minipass": {
- "version": "7.1.2",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
- "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
- "dev": true,
- "license": "ISC",
- "engines": {
- "node": ">=16 || 14 >=14.17"
- }
- },
- "node_modules/@rnef/platform-apple-helpers/node_modules/minizlib": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.2.tgz",
- "integrity": "sha512-oG62iEk+CYt5Xj2YqI5Xi9xWUeZhDI8jjQmC5oThVH5JGCTgIjr7ciJDzC7MBzYd//WvR1OTmP5Q38Q8ShQtVA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "minipass": "^7.1.2"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@rnef/platform-apple-helpers/node_modules/mkdirp": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
- "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
- "dev": true,
- "license": "MIT",
- "bin": {
- "mkdirp": "dist/cjs/src/bin.js"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/@rnef/platform-apple-helpers/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -11054,44 +11006,16 @@
"node": ">=8"
}
},
- "node_modules/@rnef/platform-apple-helpers/node_modules/tar": {
- "version": "7.4.3",
- "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
- "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
- "dev": true,
- "license": "ISC",
- "dependencies": {
- "@isaacs/fs-minipass": "^4.0.0",
- "chownr": "^3.0.0",
- "minipass": "^7.1.2",
- "minizlib": "^3.0.1",
- "mkdirp": "^3.0.1",
- "yallist": "^5.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@rnef/platform-apple-helpers/node_modules/yallist": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
- "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/@rnef/platform-ios": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/platform-ios/-/platform-ios-0.7.1.tgz",
- "integrity": "sha512-avFVAXF8PNeLRFBVrm31SDXau/gxl99/oNyoYrzUFPmU5BuTe7ZgVzm9ndl0eQBwvs1tI2F0ME0RgjmKazAMZA==",
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/platform-ios/-/platform-ios-0.7.6.tgz",
+ "integrity": "sha512-Tr9QMbN5YvNIdhgg1DVRRrs319Lh6yaje9LfP2wR/0wVeSXe1xTHuOdgr8XkH2HtYVk3w/gEFnhbDnqKbkkv+Q==",
"dev": true,
"dependencies": {
"@react-native-community/cli-config-apple": "^18.0.0",
"@react-native-community/cli-types": "^18.0.0",
- "@rnef/platform-apple-helpers": "^0.7.1",
- "@rnef/tools": "^0.7.1",
+ "@rnef/platform-apple-helpers": "^0.7.6",
+ "@rnef/tools": "^0.7.6",
"tslib": "^2.3.0"
}
},
@@ -11214,19 +11138,68 @@
}
},
"node_modules/@rnef/plugin-metro": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/plugin-metro/-/plugin-metro-0.7.1.tgz",
- "integrity": "sha512-6BGPfe87VXAv/ww4uWwh6WqoYk3QV1g2576+NOkld1x/+fFoa0AoD2badyErViRy6a+mDzunKM6JxVvBmPeICg==",
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/plugin-metro/-/plugin-metro-0.7.6.tgz",
+ "integrity": "sha512-I3QizWazBHzFbEUgv5YrDhz/QBnXa4GxSnWHz50j44vAM1ncXfw09Zh0nkcViascufVDQ28QRH77j5hBLnA44Q==",
"dev": true,
"dependencies": {
"@react-native-community/cli-server-api": "^18.0.0",
- "@rnef/tools": "^0.7.1",
+ "@react-native/dev-middleware": "^0.79.1",
+ "@rnef/tools": "^0.7.6",
+ "metro": "^0.82.1",
+ "metro-config": "^0.82.1",
+ "metro-core": "^0.82.1",
+ "metro-resolver": "^0.82.1",
"tslib": "^2.3.0"
},
"peerDependencies": {
"@react-native/community-cli-plugin": "*"
}
},
+ "node_modules/@rnef/plugin-metro/node_modules/@babel/traverse": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.1.tgz",
+ "integrity": "sha512-ZCYtZciz1IWJB4U61UPu4KEaqyfj+r5T1Q5mqPo+IBpcG9kHv30Z0aD8LXPgC1trYa6rK0orRyAhqUgk4MjmEg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.27.1",
+ "@babel/generator": "^7.27.1",
+ "@babel/parser": "^7.27.1",
+ "@babel/template": "^7.27.1",
+ "@babel/types": "^7.27.1",
+ "debug": "^4.3.1",
+ "globals": "^11.1.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/@babel/traverse/node_modules/debug": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
+ "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/@babel/traverse/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@rnef/plugin-metro/node_modules/@jest/types": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz",
@@ -11282,6 +11255,69 @@
"semver": "^7.5.2"
}
},
+ "node_modules/@rnef/plugin-metro/node_modules/@react-native/debugger-frontend": {
+ "version": "0.79.2",
+ "resolved": "https://registry.npmjs.org/@react-native/debugger-frontend/-/debugger-frontend-0.79.2.tgz",
+ "integrity": "sha512-cGmC7X6kju76DopSBNc+PRAEetbd7TWF9J9o84hOp/xL3ahxR2kuxJy0oJX8Eg8oehhGGEXTuMKHzNa3rDBeSg==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/@react-native/dev-middleware": {
+ "version": "0.79.2",
+ "resolved": "https://registry.npmjs.org/@react-native/dev-middleware/-/dev-middleware-0.79.2.tgz",
+ "integrity": "sha512-9q4CpkklsAs1L0Bw8XYCoqqyBSrfRALGEw4/r0EkR38Y/6fVfNfdsjSns0pTLO6h0VpxswK34L/hm4uK3MoLHw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@isaacs/ttlcache": "^1.4.1",
+ "@react-native/debugger-frontend": "0.79.2",
+ "chrome-launcher": "^0.15.2",
+ "chromium-edge-launcher": "^0.2.0",
+ "connect": "^3.6.5",
+ "debug": "^2.2.0",
+ "invariant": "^2.2.4",
+ "nullthrows": "^1.1.1",
+ "open": "^7.0.3",
+ "serve-static": "^1.16.2",
+ "ws": "^6.2.3"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/@react-native/dev-middleware/node_modules/is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-docker": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/@react-native/dev-middleware/node_modules/open": {
+ "version": "7.4.2",
+ "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz",
+ "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-docker": "^2.0.0",
+ "is-wsl": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/@rnef/plugin-metro/node_modules/@types/yargs": {
"version": "15.0.19",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.19.tgz",
@@ -11292,6 +11328,16 @@
"@types/yargs-parser": "*"
}
},
+ "node_modules/@rnef/plugin-metro/node_modules/agent-base": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
+ "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/@rnef/plugin-metro/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -11335,6 +11381,13 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/@rnef/plugin-metro/node_modules/ci-info": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
+ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@rnef/plugin-metro/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -11355,79 +11408,630 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@rnef/plugin-metro/node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/@rnef/plugin-metro/node_modules/cosmiconfig": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz",
+ "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==",
"dev": true,
"license": "MIT",
+ "dependencies": {
+ "import-fresh": "^2.0.0",
+ "is-directory": "^0.3.1",
+ "js-yaml": "^3.13.1",
+ "parse-json": "^4.0.0"
+ },
"engines": {
- "node": ">=8"
+ "node": ">=4"
}
},
- "node_modules/@rnef/plugin-metro/node_modules/is-wsl": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
- "integrity": "sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw==",
+ "node_modules/@rnef/plugin-metro/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"license": "MIT",
- "engines": {
- "node": ">=4"
+ "dependencies": {
+ "ms": "2.0.0"
}
},
- "node_modules/@rnef/plugin-metro/node_modules/open": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz",
- "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==",
+ "node_modules/@rnef/plugin-metro/node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"dev": true,
"license": "MIT",
- "dependencies": {
- "is-wsl": "^1.1.0"
- },
"engines": {
- "node": ">=8"
+ "node": ">= 0.8"
}
},
- "node_modules/@rnef/plugin-metro/node_modules/pretty-format": {
- "version": "26.6.2",
- "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz",
- "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==",
+ "node_modules/@rnef/plugin-metro/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"license": "MIT",
- "dependencies": {
- "@jest/types": "^26.6.2",
- "ansi-regex": "^5.0.0",
- "ansi-styles": "^4.0.0",
- "react-is": "^17.0.1"
- },
"engines": {
- "node": ">= 10"
+ "node": ">=8"
}
},
- "node_modules/@rnef/plugin-metro/node_modules/react-is": {
- "version": "17.0.2",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
- "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
+ "node_modules/@rnef/plugin-metro/node_modules/hermes-estree": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.28.1.tgz",
+ "integrity": "sha512-w3nxl/RGM7LBae0v8LH2o36+8VqwOZGv9rX1wyoWT6YaKZLqpJZ0YQ5P0LVr3tuRpf7vCx0iIG4i/VmBJejxTQ==",
"dev": true,
"license": "MIT"
},
- "node_modules/@rnef/plugin-metro/node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "node_modules/@rnef/plugin-metro/node_modules/hermes-parser": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.28.1.tgz",
+ "integrity": "sha512-nf8o+hE8g7UJWParnccljHumE9Vlq8F7MqIdeahl+4x0tvCUJYRrT0L7h0MMg/X9YJmkNwsfbaNNrzPtFXOscg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
+ "hermes-estree": "0.28.1"
}
},
- "node_modules/@rnef/tools": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@rnef/tools/-/tools-0.7.1.tgz",
- "integrity": "sha512-mSj1PCE4XmbzRGfOvXDGdOunBgj5qZSsGmGo1ce0kc6vgDnOoDe78yrbfqsoYbS9HuiNXkgo2Lotb+/sll439Q==",
+ "node_modules/@rnef/plugin-metro/node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/https-proxy-agent/node_modules/debug": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
+ "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/https-proxy-agent/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/import-fresh": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz",
+ "integrity": "sha512-eZ5H8rcgYazHbKC3PG4ClHNykCSxtAhxSSEM+2mb+7evD2CKF5V7c0dNum7AdpDh0ZdICwZY9sRSn8f+KH96sg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "caller-path": "^2.0.0",
+ "resolve-from": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/is-wsl": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
+ "integrity": "sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/jest-worker": {
+ "version": "29.7.0",
+ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz",
+ "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*",
+ "jest-util": "^29.7.0",
+ "merge-stream": "^2.0.0",
+ "supports-color": "^8.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/jest-worker/node_modules/supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro/-/metro-0.82.2.tgz",
+ "integrity": "sha512-hOBd4O4Cn/tLf3jz7IjSgD/A66MqMzgZuyF1I/pmNwYcY3q3j2vbh7Fa09KIbvUq5Yz7BewU356XboaEtEXPgA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.24.7",
+ "@babel/core": "^7.25.2",
+ "@babel/generator": "^7.25.0",
+ "@babel/parser": "^7.25.3",
+ "@babel/template": "^7.25.0",
+ "@babel/traverse": "^7.25.3",
+ "@babel/types": "^7.25.2",
+ "accepts": "^1.3.7",
+ "chalk": "^4.0.0",
+ "ci-info": "^2.0.0",
+ "connect": "^3.6.5",
+ "debug": "^4.4.0",
+ "error-stack-parser": "^2.0.6",
+ "flow-enums-runtime": "^0.0.6",
+ "graceful-fs": "^4.2.4",
+ "hermes-parser": "0.28.1",
+ "image-size": "^1.0.2",
+ "invariant": "^2.2.4",
+ "jest-worker": "^29.7.0",
+ "jsc-safe-url": "^0.2.2",
+ "lodash.throttle": "^4.1.1",
+ "metro-babel-transformer": "0.82.2",
+ "metro-cache": "0.82.2",
+ "metro-cache-key": "0.82.2",
+ "metro-config": "0.82.2",
+ "metro-core": "0.82.2",
+ "metro-file-map": "0.82.2",
+ "metro-resolver": "0.82.2",
+ "metro-runtime": "0.82.2",
+ "metro-source-map": "0.82.2",
+ "metro-symbolicate": "0.82.2",
+ "metro-transform-plugins": "0.82.2",
+ "metro-transform-worker": "0.82.2",
+ "mime-types": "^2.1.27",
+ "nullthrows": "^1.1.1",
+ "serialize-error": "^2.1.0",
+ "source-map": "^0.5.6",
+ "throat": "^5.0.0",
+ "ws": "^7.5.10",
+ "yargs": "^17.6.2"
+ },
+ "bin": {
+ "metro": "src/cli.js"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-babel-transformer": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-babel-transformer/-/metro-babel-transformer-0.82.2.tgz",
+ "integrity": "sha512-c2gesA7/B4dovPmmYC2HziNXb4XFG3YkQ9FjEzwRnR6KH2hT7nJn6mkcri1h85r3sMttpnmoBuZ8WDz980Zhlw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.25.2",
+ "flow-enums-runtime": "^0.0.6",
+ "hermes-parser": "0.28.1",
+ "nullthrows": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-cache": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-cache/-/metro-cache-0.82.2.tgz",
+ "integrity": "sha512-MxY4xvPKuE68NYpKJjH8YvVVugDL2QcuTracHsV5/30ZIaRr0v1QuAX5vt45OCQDQQWeh1rDv3E4JB6AbIvnZQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "exponential-backoff": "^3.1.1",
+ "flow-enums-runtime": "^0.0.6",
+ "https-proxy-agent": "^7.0.5",
+ "metro-core": "0.82.2"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-cache-key": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-cache-key/-/metro-cache-key-0.82.2.tgz",
+ "integrity": "sha512-lfjC9zzSri+rS7lkoCh04LniFga8JQVUqSuscD9KraIm9zRzwIwvaMx8V6Oogiezs+FAJUOSnVNhHcHc9l8H2Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flow-enums-runtime": "^0.0.6"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-config": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-config/-/metro-config-0.82.2.tgz",
+ "integrity": "sha512-0dG3qCFLoE3ddNexAxSLJ7FbGjEbwUjDNOgYeCLoPSkKB01k5itvvr2HFfl2HisOCfLcpjpVzF5NtB/O71lxfA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "connect": "^3.6.5",
+ "cosmiconfig": "^5.0.5",
+ "flow-enums-runtime": "^0.0.6",
+ "jest-validate": "^29.7.0",
+ "metro": "0.82.2",
+ "metro-cache": "0.82.2",
+ "metro-core": "0.82.2",
+ "metro-runtime": "0.82.2"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-core": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-core/-/metro-core-0.82.2.tgz",
+ "integrity": "sha512-d2XMkWbRh6PdPV1OZ8OyUyDWrtEbQ1m5ASpKtemLPbujfoE4RlwFZdl4ljfBNVVZ1s0z7tgsSFwKMyTeXgjtSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flow-enums-runtime": "^0.0.6",
+ "lodash.throttle": "^4.1.1",
+ "metro-resolver": "0.82.2"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-file-map": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-file-map/-/metro-file-map-0.82.2.tgz",
+ "integrity": "sha512-pax0WA80eRH096YO0kwox+ZD5im3V0Vswr2x1YqdMcZVWlr6uwXgQdo9q+mpcvJ1k77J+hmY5HIg71bqrUptVg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "fb-watchman": "^2.0.0",
+ "flow-enums-runtime": "^0.0.6",
+ "graceful-fs": "^4.2.4",
+ "invariant": "^2.2.4",
+ "jest-worker": "^29.7.0",
+ "micromatch": "^4.0.4",
+ "nullthrows": "^1.1.1",
+ "walker": "^1.0.7"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-file-map/node_modules/debug": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
+ "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-file-map/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-minify-terser": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-minify-terser/-/metro-minify-terser-0.82.2.tgz",
+ "integrity": "sha512-+nveaEdQUvsoi0OSr4Cp+btevZsg2DKsu8kUJsvyLIcRRFPUw9CwzF3V2cA5b55DY5LcIJyAcZf4D9ARKfoilQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flow-enums-runtime": "^0.0.6",
+ "terser": "^5.15.0"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-resolver": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-resolver/-/metro-resolver-0.82.2.tgz",
+ "integrity": "sha512-Who2hGzq2aCGSsBaQBU0L3SADiy/kj/gv0coujNWziRY4SKq7ECKzWqtVk1JlEF7IGXDDRDxEgFuLmPV6mZGVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flow-enums-runtime": "^0.0.6"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-runtime": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-runtime/-/metro-runtime-0.82.2.tgz",
+ "integrity": "sha512-gEcb2AfDs3GRs2SFjtEmG0k61B/cZEVCbh6cSmkjJpyHr+VRjw77MnDpX9AUcJYa4bCT63E7IEySOMM0Z8p87g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.25.0",
+ "flow-enums-runtime": "^0.0.6"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-source-map": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-source-map/-/metro-source-map-0.82.2.tgz",
+ "integrity": "sha512-S26xPdz1/EeAY0HqaPXfny8CeiY0Dvl4sBLQiXGXhoES4gUDAuMhA1tioKrv5F+x68Sod8cp8Js6EGqbMXeqMA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.25.3",
+ "@babel/traverse--for-generate-function-map": "npm:@babel/traverse@^7.25.3",
+ "@babel/types": "^7.25.2",
+ "flow-enums-runtime": "^0.0.6",
+ "invariant": "^2.2.4",
+ "metro-symbolicate": "0.82.2",
+ "nullthrows": "^1.1.1",
+ "ob1": "0.82.2",
+ "source-map": "^0.5.6",
+ "vlq": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-symbolicate": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-symbolicate/-/metro-symbolicate-0.82.2.tgz",
+ "integrity": "sha512-iheanMnOMned6gjt6sKSfU5AoNyV6pJyQAWydwuHcjhGpa/kiAM0kKmw23qHejELK89Yw8HDZ3Fd/5l1jxpFVA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flow-enums-runtime": "^0.0.6",
+ "invariant": "^2.2.4",
+ "metro-source-map": "0.82.2",
+ "nullthrows": "^1.1.1",
+ "source-map": "^0.5.6",
+ "vlq": "^1.0.0"
+ },
+ "bin": {
+ "metro-symbolicate": "src/index.js"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-transform-plugins": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-transform-plugins/-/metro-transform-plugins-0.82.2.tgz",
+ "integrity": "sha512-kEveuEVxghTEXkDiyY0MT5QRqei092KJG46nduo0VghFgI6QFodbAjFit1ULyWsn2VOTGSUDJ3VgHBMy7MaccA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.25.2",
+ "@babel/generator": "^7.25.0",
+ "@babel/template": "^7.25.0",
+ "@babel/traverse": "^7.25.3",
+ "flow-enums-runtime": "^0.0.6",
+ "nullthrows": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro-transform-worker": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/metro-transform-worker/-/metro-transform-worker-0.82.2.tgz",
+ "integrity": "sha512-MJQNz6cGjqewCRqFmPrsHu6Oe93v2B6zgHkrNxQ6XdPMJz5VHD33m8q+8UsNJOH8wUMoRu5JmYtuUTIVIFxh2A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.25.2",
+ "@babel/generator": "^7.25.0",
+ "@babel/parser": "^7.25.3",
+ "@babel/types": "^7.25.2",
+ "flow-enums-runtime": "^0.0.6",
+ "metro": "0.82.2",
+ "metro-babel-transformer": "0.82.2",
+ "metro-cache": "0.82.2",
+ "metro-cache-key": "0.82.2",
+ "metro-minify-terser": "0.82.2",
+ "metro-source-map": "0.82.2",
+ "metro-transform-plugins": "0.82.2",
+ "nullthrows": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro/node_modules/debug": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
+ "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/metro/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/ob1": {
+ "version": "0.82.2",
+ "resolved": "https://registry.npmjs.org/ob1/-/ob1-0.82.2.tgz",
+ "integrity": "sha512-sfUaYpjkAdHgu8cXLAyWXO98jW1EUOStTDNslfC9eb3tBLExe67PRqh09J0xdD6AlFKHFGTvXPbuHGvlrZNJNA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flow-enums-runtime": "^0.0.6"
+ },
+ "engines": {
+ "node": ">=18.18"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/open": {
+ "version": "6.4.0",
+ "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz",
+ "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-wsl": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/pretty-format": {
+ "version": "26.6.2",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz",
+ "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^26.6.2",
+ "ansi-regex": "^5.0.0",
+ "ansi-styles": "^4.0.0",
+ "react-is": "^17.0.1"
+ },
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/react-is": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/resolve-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
+ "integrity": "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/serialize-error": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz",
+ "integrity": "sha512-ghgmKt5o4Tly5yEG/UJp8qTd0AN7Xalw4XBtDEKP655B699qMEtra1WlXeE6WIvdEG481JvRxULKsInq/iNysw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/serve-static": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "0.19.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/@rnef/plugin-metro/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@rnef/tools": {
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/@rnef/tools/-/tools-0.7.6.tgz",
+ "integrity": "sha512-K7xzc7U1ShDWnj0eOcZmVHNCmRVh5ztIcPsCst5NaLM2U24ScwGjOxnx779c5RIs6X8TK6Rt89evOAbMAqCkcQ==",
"dev": true,
"dependencies": {
"@clack/prompts": "^0.10.0",
@@ -11440,10 +12044,21 @@
"nano-spawn": "^0.2.0",
"picocolors": "^1.1.1",
"string-argv": "^0.3.2",
+ "tar": "^7.4.3",
"ts-regex-builder": "^1.8.2",
"tslib": "^2.3.0"
}
},
+ "node_modules/@rnef/tools/node_modules/chownr": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
+ "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@rnef/tools/node_modules/is-unicode-supported": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz",
@@ -11457,6 +12072,73 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/@rnef/tools/node_modules/minipass": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/@rnef/tools/node_modules/minizlib": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.2.tgz",
+ "integrity": "sha512-oG62iEk+CYt5Xj2YqI5Xi9xWUeZhDI8jjQmC5oThVH5JGCTgIjr7ciJDzC7MBzYd//WvR1OTmP5Q38Q8ShQtVA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "minipass": "^7.1.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@rnef/tools/node_modules/mkdirp": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
+ "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "mkdirp": "dist/cjs/src/bin.js"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/@rnef/tools/node_modules/tar": {
+ "version": "7.4.3",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
+ "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "@isaacs/fs-minipass": "^4.0.0",
+ "chownr": "^3.0.0",
+ "minipass": "^7.1.2",
+ "minizlib": "^3.0.1",
+ "mkdirp": "^3.0.1",
+ "yallist": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@rnef/tools/node_modules/yallist": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
+ "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@rnmapbox/maps": {
"version": "10.1.33",
"resolved": "https://registry.npmjs.org/@rnmapbox/maps/-/maps-10.1.33.tgz",
diff --git a/package.json b/package.json
index 963ec3add7ff..5f7065c1c519 100644
--- a/package.json
+++ b/package.json
@@ -237,10 +237,10 @@
"@react-native/babel-preset": "0.77.1",
"@react-native/metro-config": "0.77.1",
"@react-navigation/devtools": "^6.0.10",
- "@rnef/cli": "^0.7.1",
- "@rnef/platform-android": "^0.7.1",
- "@rnef/platform-ios": "^0.7.1",
- "@rnef/plugin-metro": "^0.7.1",
+ "@rnef/cli": "^0.7.6",
+ "@rnef/platform-android": "^0.7.6",
+ "@rnef/platform-ios": "^0.7.6",
+ "@rnef/plugin-metro": "^0.7.6",
"@storybook/addon-a11y": "^8.6.9",
"@storybook/addon-essentials": "^8.6.9",
"@storybook/addon-webpack5-compiler-babel": "^3.0.5",