5 lines
128 KiB
JavaScript
Raw Normal View History

var Ne=Object.defineProperty;var In=(n,e)=>{for(var u in e)Ne(n,u,{get:e[u],enumerable:!0})};var Bn={};In(Bn,{parsers:()=>wn});var wn={};In(wn,{meriyah:()=>K1});var Ve=(n,e,u,t)=>{if(!(n&&e==null))return e.replaceAll?e.replaceAll(u,t):u.global?e.replace(u,t):e.split(u).join(t)},i2=Ve;var Oe={0:"Unexpected token",30:"Unexpected token: '%0'",1:"Octal escape sequences are not allowed in strict mode",2:"Octal escape sequences are not allowed in template strings",3:"\\8 and \\9 are not allowed in template strings",4:"Private identifier #%0 is not defined",5:"Illegal Unicode escape sequence",6:"Invalid code point %0",7:"Invalid hexadecimal escape sequence",9:"Octal literals are not allowed in strict mode",8:"Decimal integer literals with a leading zero are forbidden in strict mode",10:"Expected number in radix %0",151:"Invalid left-hand side assignment to a destructible right-hand side",11:"Non-number found after exponent indicator",12:"Invalid BigIntLiteral",13:"No identifiers allowed directly after numeric literal",14:"Escapes \\8 or \\9 are not syntactically valid escapes",15:"Escapes \\8 or \\9 are not allowed in strict mode",16:"Unterminated string literal",17:"Unterminated template literal",18:"Multiline comment was not closed properly",19:"The identifier contained dynamic unicode escape that was not closed",20:"Illegal character '%0'",21:"Missing hexadecimal digits",22:"Invalid implicit octal",23:"Invalid line break in string literal",24:"Only unicode escapes are legal in identifier names",25:"Expected '%0'",26:"Invalid left-hand side in assignment",27:"Invalid left-hand side in async arrow",28:'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',29:"Member access on super must be in a method",31:"Await expression not allowed in formal parameter",32:"Yield expression not allowed in formal parameter",95:"Unexpected token: 'escaped keyword'",33:"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses",123:"Async functions can only be declared at the top level or inside a block",34:"Unterminated regular expression",35:"Unexpected regular expression flag",36:"Duplicate regular expression flag '%0'",37:"%0 functions must have exactly %1 argument%2",38:"Setter function argument must not be a rest parameter",39:"%0 declaration must have a name in this context",40:"Function name may not contain any reserved words or be eval or arguments in strict mode",41:"The rest operator is missing an argument",42:"A getter cannot be a generator",43:"A setter cannot be a generator",44:"A computed property name must be followed by a colon or paren",134:"Object literal keys that are strings or numbers must be a method or have a colon",46:"Found `* async x(){}` but this should be `async * x(){}`",45:"Getters and setters can not be generators",47:"'%0' can not be generator method",48:"No line break is allowed after '=>'",49:"The left-hand side of the arrow can only be destructed through assignment",50:"The binding declaration is not destructible",51:"Async arrow can not be followed by new expression",52:"Classes may not have a static property named 'prototype'",53:"Class constructor may not be a %0",54:"Duplicate constructor method in class",55:"Invalid increment/decrement operand",56:"Invalid use of `new` keyword on an increment/decrement expression",57:"`=>` is an invalid assignment target",58:"Rest element may not have a trailing comma",59:"Missing initializer in %0 declaration",60:"'for-%0' loop head declarations can not have an initializer",61:"Invalid left-hand side in for-%0 loop: Must have a single binding",62:"Invalid shorthand property initializer",63:"Property name __proto__ appears more than once in object literal",64:"Let is disallowed as a lexically bound name",65:"Invalid use of '%0' inside new expression",66:"Illegal 'use strict' directive in function with non-simple parameter list",67:'Identifier "let" disallowed as left-hand side expression in strict mode',68:"Illegal continue statement",69:"Illegal break state
`);return e.length>1&&e.every(u=>u.trimStart()[0]==="*")}var Dn=E1;function w1(n){return q2(n)&&n.value[0]==="*"&&/@(?:type|satisfies)\b/u.test(n.value)}var be=w1;var S2=null;function P2(n){if(S2!==null&&typeof S2.property){let e=S2;return S2=P2.prototype=null,e}return S2=P2.prototype=n??Object.create(null),new P2}var B1=10;for(let n=0;n<=B1;n++)P2();function Tn(n){return P2(n)}function I1(n,e="type"){Tn(n);function u(t){let o=t[e],i=n[o];if(!Array.isArray(i))throw Object.assign(new Error(`Missing visitor keys for '${o}'.`),{node:t});return i}return u}var De=I1;var Te={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","arguments","typeParameters","typeArguments"],CatchClause:["param","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body","predicate"],FunctionExpression:["id","typeParameters","params","returnType","body"],Identifier:["typeAnnotation","decorators"],IfStatement:["test","consequent","alternate"],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],NewExpression:["callee","arguments","typeParameters","typeArguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["decorators","key","typeParameters","params","returnType","body"],ObjectProperty:["key","value","decorators"],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ParenthesizedExpression:["expression"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["typeParameters","params","returnType","body","predicate"],ClassBody:["body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","mixins","implements","body","superTypeArguments"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","mixins","implements","body","superTypeArguments"],ExportAllDeclaration:["source","attributes","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ForOfStatement:["left","right","body"],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],ImportExpression:["source","options"],MetaProperty:["meta","property"],ClassMethod:["decorators","key","typeParameters","params","returnType","body"],ObjectPattern:["properties","typeAnnotation","decorators"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","typeParameters","quasi","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","property"],OptionalCallExpression:["callee","arguments","typeParameters","typeArguments"],ClassProperty:["decorators","key","typeAnnotation","value","variance"],ClassAccessorProperty:["decorators","key","typeAnnotation","value"],ClassPrivateProperty:["de
`;n=i2(!1,n.replace(S1,"").replace(q1,""),V1,"$1");let u="";for(;u!==n;)u=n,n=i2(!1,n,N1,`${e}$1 $2${e}`);n=n.replace(Be,"").trimEnd();let t=Object.create(null),o=i2(!1,n,Ie,"").replace(Be,"").trimEnd(),i;for(;i=Ie.exec(n);){let l=i2(!1,i[2],v1,"");if(typeof t[i[1]]=="string"||Array.isArray(t[i[1]])){let f=t[i[1]];t[i[1]]=[...O1,...Array.isArray(f)?f:[f],l]}else t[i[1]]=l}return{comments:o,pragmas:t}}function R1(n){if(!n.startsWith("#!"))return"";let e=n.indexOf(`
`);return e===-1?n:n.slice(0,e)}var qe=R1;function U1(n){let e=qe(n);e&&(n=n.slice(e.length+1));let u=Le(n),{pragmas:t,comments:o}=Fe(u);return{shebang:e,text:n,pragmas:t,comments:o}}function Se(n){let{pragmas:e}=U1(n);return Object.prototype.hasOwnProperty.call(e,"prettier")||Object.prototype.hasOwnProperty.call(e,"format")}function M1(n){return n=typeof n=="function"?{parse:n}:n,{astFormat:"estree",hasPragma:Se,locStart:G,locEnd:u2,...n}}var Pe=M1;function J1(n){let{filepath:e}=n;if(e){if(e=e.toLowerCase(),e.endsWith(".cjs")||e.endsWith(".cts"))return"script";if(e.endsWith(".mjs")||e.endsWith(".mts"))return"module"}}var ve=J1;var j1={next:!0,ranges:!0,webcompat:!0,loc:!0,raw:!0,directives:!0,globalReturn:!0,impliedStrict:!1,preserveParens:!1,lexical:!1,jsx:!0,uniqueKeyInPattern:!1};function X1(n,e){let u=[],t=[],o=ae(n,{...j1,module:e==="module",onComment:u,onToken:t});return o.comments=u,o.tokens=t,o}function H1(n){let{message:e,loc:u}=n;if(!u)return n;let t=`[${[u.start,u.end].map(({line:o,column:i})=>[o,i].join(":")).join("-")}]: `;return e.startsWith(t)&&(e=e.slice(t.length)),ye(e,{loc:{start:{line:u.start.line,column:u.start.column+1},end:{line:u.end.line,column:u.end.column+1}},cause:n})}function z1(n,e={}){let u=ve(e),t=(u?[u]:["module","script"]).map(i=>()=>X1(n,i)),o;try{o=se(t)}catch({errors:[i]}){throw H1(i)}return we(o,{parser:"meriyah",text:n})}var K1=Pe(z1);var $0=Bn;export{$0 as default,wn as parsers};