4 lines
126 KiB
JavaScript
4 lines
126 KiB
JavaScript
|
|
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.meriyah=e()}})(function(){"use strict";var K2=Object.defineProperty;var Jn=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var jn=Object.prototype.hasOwnProperty;var Ce=(e,n)=>{for(var t in n)K2(e,t,{get:n[t],enumerable:!0})},Xn=(e,n,t,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of _n(n))!jn.call(e,o)&&o!==t&&K2(e,o,{get:()=>n[o],enumerable:!(u=Jn(n,o))||u.enumerable});return e};var Hn=e=>Xn(K2({},"__esModule",{value:!0}),e);var u1={};Ce(u1,{parsers:()=>De});var De={};Ce(De,{meriyah:()=>t1});var zn=(e,n,t,u)=>{if(!(e&&n==null))return n.replaceAll?n.replaceAll(t,u):t.global?n.replace(t,u):n.split(t).join(u)},G=zn;var Kn={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/
|
||
|
|
`);return n.length>1&&n.every(t=>t.trimStart()[0]==="*")}var he=new WeakMap;function Mu(e){return he.has(e)||he.set(e,Vu(e)),he.get(e)}var ye=Mu;function Uu(e){if(e.length<2)return;let n;for(let t=e.length-1;t>=0;t--){let u=e[t];if(n&&O(u)===M(n)&&ye(u)&&ye(n)&&(e.splice(t+1,1),u.value+="*//*"+n.value,u.range=[M(u),O(n)]),!me(u)&&!f2(u))throw new TypeError(`Unknown comment type: "${u.type}".`);n=u}}var An=Uu;var r2=null;function w2(e){if(r2!==null&&typeof r2.property){let n=r2;return r2=w2.prototype=null,n}return r2=w2.prototype=e??Object.create(null),new w2}var Ju=10;for(let e=0;e<=Ju;e++)w2();function Ae(e){return w2(e)}function _u(e,n="type"){Ae(e);function t(u){let o=u[n],i=e[o];if(!Array.isArray(i))throw Object.assign(new Error(`Missing visitor keys for '${o}'.`),{node:u});return i}return t}var Tn=_u;var bn={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","typeParameters","typeArguments","arguments"],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","predicate","returnType","body"],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","typeParameters","typeArguments","arguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["decorators","key","typeParameters","params","returnType","body"],ObjectProperty:["decorators","key","value"],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","predicate","returnType","body"],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:["decorators","properties","typeAnnotation"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","typeParameters","quasi","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","prope
|
||
|
|
`;e=G(!1,e.replace(zu,"").replace(Hu,""),Yu,"$1");let t="";for(;t!==e;)t=e,e=G(!1,e,Wu,`${n}$1 $2${n}`);e=e.replace(Bn,"").trimEnd();let u=Object.create(null),o=G(!1,e,Sn,"").replace(Bn,"").trimEnd(),i;for(;i=Sn.exec(e);){let l=G(!1,i[2],$u,"");if(typeof u[i[1]]=="string"||Array.isArray(u[i[1]])){let c=u[i[1]];u[i[1]]=[...Qu,...Array.isArray(c)?c:[c],l]}else u[i[1]]=l}return{comments:o,pragmas:u}}var Ln=["noformat","noprettier"],In=["format","prettier"];function Zu(e){if(!e.startsWith("#!"))return"";let n=e.indexOf(`
|
||
|
|
`);return n===-1?e:e.slice(0,n)}var qn=Zu;function Pn(e){let n=qn(e);n&&(e=e.slice(n.length+1));let t=Fn(e),{pragmas:u,comments:o}=Nn(t);return{shebang:n,text:e,pragmas:u,comments:o}}function vn(e){let{pragmas:n}=Pn(e);return In.some(t=>Object.prototype.hasOwnProperty.call(n,t))}function On(e){let{pragmas:n}=Pn(e);return Ln.some(t=>Object.prototype.hasOwnProperty.call(n,t))}function Gu(e){return e=typeof e=="function"?{parse:e}:e,{astFormat:"estree",hasPragma:vn,hasIgnorePragma:On,locStart:M,locEnd:O,...e}}var Rn=Gu;var z2="module",Vn="script",Mn=[z2,Vn];function Un(e){if(typeof e=="string"){if(e=e.toLowerCase(),/\.(?:mjs|mts)$/iu.test(e))return z2;if(/\.(?:cjs|cts)$/iu.test(e))return Vn}}var xu={next:!0,ranges:!0,webcompat:!0,loc:!1,raw:!0,directives:!0,globalReturn:!0,impliedStrict:!1,preserveParens:!0,lexical:!1,jsx:!0,uniqueKeyInPattern:!1};function pu(e,n){let t=[],u=an(e,{...xu,module:n===z2,onComment:t});return u.comments=t,u}function e1(e){let{description:n,loc:t}=e;return t?sn(n,{loc:{start:{line:t.start.line,column:t.start.column+1},end:{line:t.end.line,column:t.end.column+1}},cause:e}):e}function n1(e,n){let t=Un(n==null?void 0:n.filepath),u=(t?[t]:Mn).map(i=>()=>pu(e,i)),o;try{o=gn(u)}catch({errors:[i]}){throw e1(i)}return wn(o,{parser:"meriyah",text:e})}var t1=Rn(n1);return Hn(u1);});
|