@kurtinatlanta/prettier 3.3.0-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4873 -0
- package/README.md +111 -0
- package/bin/prettier.cjs +68 -0
- package/doc.d.ts +243 -0
- package/doc.js +1320 -0
- package/doc.mjs +1292 -0
- package/index.cjs +648 -0
- package/index.d.ts +942 -0
- package/index.mjs +24278 -0
- package/internal/cli.mjs +7123 -0
- package/package.json +201 -0
- package/plugins/acorn.d.ts +6 -0
- package/plugins/acorn.js +13 -0
- package/plugins/acorn.mjs +13 -0
- package/plugins/angular.d.ts +8 -0
- package/plugins/angular.js +1 -0
- package/plugins/angular.mjs +1 -0
- package/plugins/babel.d.ts +18 -0
- package/plugins/babel.js +16 -0
- package/plugins/babel.mjs +16 -0
- package/plugins/estree.d.ts +1 -0
- package/plugins/estree.js +36 -0
- package/plugins/estree.mjs +36 -0
- package/plugins/flow.d.ts +5 -0
- package/plugins/flow.js +20 -0
- package/plugins/flow.mjs +20 -0
- package/plugins/glimmer.d.ts +5 -0
- package/plugins/glimmer.js +30 -0
- package/plugins/glimmer.mjs +30 -0
- package/plugins/graphql.d.ts +5 -0
- package/plugins/graphql.js +29 -0
- package/plugins/graphql.mjs +29 -0
- package/plugins/html.d.ts +8 -0
- package/plugins/html.js +19 -0
- package/plugins/html.mjs +19 -0
- package/plugins/markdown.d.ts +7 -0
- package/plugins/markdown.js +59 -0
- package/plugins/markdown.mjs +59 -0
- package/plugins/meriyah.d.ts +5 -0
- package/plugins/meriyah.js +5 -0
- package/plugins/meriyah.mjs +5 -0
- package/plugins/postcss.d.ts +7 -0
- package/plugins/postcss.js +49 -0
- package/plugins/postcss.mjs +49 -0
- package/plugins/typescript.d.ts +5 -0
- package/plugins/typescript.js +25 -0
- package/plugins/typescript.mjs +25 -0
- package/plugins/yaml.d.ts +5 -0
- package/plugins/yaml.js +161 -0
- package/plugins/yaml.mjs +161 -0
- package/standalone.d.ts +33 -0
- package/standalone.js +34 -0
- package/standalone.mjs +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var as=Object.defineProperty;var gt=(i,e)=>{for(var t in e)as(i,t,{get:e[t],enumerable:!0})};var Ye=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var k=(i,e,t)=>(Ye(i,e,"read from private field"),t?t.call(i):e.get(i)),w=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},J=(i,e,t,s)=>(Ye(i,e,"write to private field"),s?s.call(i,t):e.set(i,t),t);var c=(i,e,t)=>(Ye(i,e,"access private method"),t);var vt={};gt(vt,{parsers:()=>ft});var ft={};gt(ft,{__ng_action:()=>rr,__ng_binding:()=>ir,__ng_directive:()=>ar,__ng_interpolation:()=>nr});var X=class{constructor(e,t,s,r){this.input=t,this.errLocation=s,this.ctxLocation=r,this.message=`Parser Error: ${e} ${s} [${t}] in ${r}`}},B=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new P(e+this.start,e+this.end)}},m=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},ee=class extends m{constructor(e,t,s){super(e,t),this.nameSpan=s}},C=class extends m{visit(e,t=null){}},T=class extends m{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Ke=class extends T{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},te=class extends m{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},se=class extends m{constructor(e,t,s,r,n){super(e,t),this.condition=s,this.trueExp=r,this.falseExp=n}visit(e,t=null){return e.visitConditional(this,t)}},_=class extends ee{constructor(e,t,s,r,n){super(e,t,s),this.receiver=r,this.name=n}visit(e,t=null){return e.visitPropertyRead(this,t)}},re=class extends ee{constructor(e,t,s,r,n,a){super(e,t,s),this.receiver=r,this.name=n,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},U=class extends ee{constructor(e,t,s,r,n){super(e,t,s),this.receiver=r,this.name=n}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},ie=class extends m{constructor(e,t,s,r){super(e,t),this.receiver=s,this.key=r}visit(e,t=null){return e.visitKeyedRead(this,t)}},F=class extends m{constructor(e,t,s,r){super(e,t),this.receiver=s,this.key=r}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},ne=class extends m{constructor(e,t,s,r,n){super(e,t),this.receiver=s,this.key=r,this.value=n}visit(e,t=null){return e.visitKeyedWrite(this,t)}},ae=class extends ee{constructor(e,t,s,r,n,a){super(e,t,a),this.exp=s,this.name=r,this.args=n}visit(e,t=null){return e.visitPipe(this,t)}},A=class extends m{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},oe=class extends m{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},ce=class extends m{constructor(e,t,s,r){super(e,t),this.keys=s,this.values=r}visit(e,t=null){return e.visitLiteralMap(this,t)}},he=class extends m{constructor(e,t,s,r){super(e,t),this.strings=s,this.expressions=r}visit(e,t=null){return e.visitInterpolation(this,t)}},I=class extends m{constructor(e,t,s,r,n){super(e,t),this.operation=s,this.left=r,this.right=n}visit(e,t=null){return e.visitBinary(this,t)}},D=class i extends I{static createMinus(e,t,s){return new i(e,t,"-",s,"-",new A(e,t,0),s)}static createPlus(e,t,s){return new i(e,t,"+",s,"-",s,new A(e,t,0))}constructor(e,t,s,r,n,a,o){super(e,t,n,a,o),this.operator=s,this.expr=r,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},pe=class extends m{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},ue=class extends m{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},le=class extends m{constructor(e,t,s,r,n){super(e,t),this.receiver=s,this.args=r,this.argumentSpan=n}visit(e,t=null){return e.visitCall(this,t)}},G=class extends m{constructor(e,t,s,r,n){super(e,t),this.receiver=s,this.args=r,this.argumentSpan=n}visit(e,t=null){return e.visitSafeCall(this,t)}},P=class{constructor(e,t){this.start=e,this.end=t}},b=class extends m{constructor(e,t,s,r,n){super(new B(0,t===null?0:t.length),new P(r,t===null?r:r+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=n}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},W=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},xe=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},Me=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};var mt;(function(i){i[i.DEFAULT=0]="DEFAULT",i[i.LITERAL_ATTR=1]="LITERAL_ATTR",i[i.ANIMATION=2]="ANIMATION",i[i.TWO_WAY=3]="TWO_WAY"})(mt||(mt={}));function St(i){return i>=9&&i<=32||i==160}function K(i){return 48<=i&&i<=57}function wt(i){return i>=97&&i<=122||i>=65&&i<=90}function Ze(i){return i===39||i===34||i===96}var u;(function(i){i[i.Character=0]="Character",i[i.Identifier=1]="Identifier",i[i.PrivateIdentifier=2]="PrivateIdentifier",i[i.Keyword=3]="Keyword",i[i.String=4]="String",i[i.Operator=5]="Operator",i[i.Number=6]="Number",i[i.Error=7]="Error"})(u||(u={}));var Ks=["var","let","as","null","undefined","true","false","if","else","this"],Ee=class{tokenize(e){let t=new et(e),s=[],r=t.scanToken();for(;r!=null;)s.push(r),r=t.scanToken();return s}},N=class{constructor(e,t,s,r,n){this.index=e,this.end=t,this.type=s,this.numValue=r,this.strValue=n}isCharacter(e){return this.type==u.Character&&this.numValue==e}isNumber(){return this.type==u.Number}isString(){return this.type==u.String}isOperator(e){return this.type==u.Operator&&this.strValue==e}isIdentifier(){return this.type==u.Identifier}isPrivateIdentifier(){return this.type==u.PrivateIdentifier}isKeyword(){return this.type==u.Keyword}isKeywordLet(){return this.type==u.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==u.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==u.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==u.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==u.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==u.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==u.Keyword&&this.strValue=="this"}isError(){return this.type==u.Error}toNumber(){return this.type==u.Number?this.numValue:-1}toString(){switch(this.type){case u.Character:case u.Identifier:case u.Keyword:case u.Operator:case u.PrivateIdentifier:case u.String:case u.Error:return this.strValue;case u.Number:return this.numValue.toString();default:return null}}};function At(i,e,t){return new N(i,e,u.Character,t,String.fromCharCode(t))}function Ms(i,e,t){return new N(i,e,u.Identifier,0,t)}function _s(i,e,t){return new N(i,e,u.PrivateIdentifier,0,t)}function Us(i,e,t){return new N(i,e,u.Keyword,0,t)}function Xe(i,e,t){return new N(i,e,u.Operator,0,t)}function Fs(i,e,t){return new N(i,e,u.String,0,t)}function Ds(i,e,t){return new N(i,e,u.Number,t,"")}function Gs(i,e,t){return new N(i,e,u.Error,0,t)}var De=new N(-1,-1,u.Character,0,""),et=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,r=this.index;for(;s<=32;)if(++r>=t){s=0;break}else s=e.charCodeAt(r);if(this.peek=s,this.index=r,r>=t)return null;if(Ot(s))return this.scanIdentifier();if(K(s))return this.scanNumber(r);let n=r;switch(s){case 46:return this.advance(),K(this.peek)?this.scanNumber(n):At(n,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(n,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(n,String.fromCharCode(s));case 63:return this.scanQuestion(n);case 60:case 62:return this.scanComplexOperator(n,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(n,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(n,"&",38,"&");case 124:return this.scanComplexOperator(n,"|",124,"|");case 160:for(;St(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),At(e,this.index,t)}scanOperator(e,t){return this.advance(),Xe(e,this.index,t)}scanComplexOperator(e,t,s,r,n,a){this.advance();let o=t;return this.peek==s&&(this.advance(),o+=r),n!=null&&this.peek==n&&(this.advance(),o+=a),Xe(e,this.index,o)}scanIdentifier(){let e=this.index;for(this.advance();It(this.peek);)this.advance();let t=this.input.substring(e,this.index);return Ks.indexOf(t)>-1?Us(e,this.index,t):Ms(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!Ot(this.peek))return this.error("Invalid character [#]",-1);for(;It(this.peek);)this.advance();let t=this.input.substring(e,this.index);return _s(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!K(this.peek))if(this.peek===95){if(!K(this.input.charCodeAt(this.index-1))||!K(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(Ws(this.peek)){if(this.advance(),Vs(this.peek)&&this.advance(),!K(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let r=this.input.substring(e,this.index);s&&(r=r.replace(/_/g,""));let n=t?zs(r):parseFloat(r);return Ds(e,this.index,n)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",r=this.index,n=this.input;for(;this.peek!=t;)if(this.peek==92){s+=n.substring(r,this.index);let o;if(this.advance(),this.peek==117){let h=n.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(h))o=parseInt(h,16);else return this.error(`Invalid unicode escape [\\u${h}]`,0);for(let p=0;p<5;p++)this.advance()}else o=Qs(this.peek),this.advance();s+=String.fromCharCode(o),r=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=n.substring(r,this.index);return this.advance(),Fs(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),Xe(e,this.index,t)}error(e,t){let s=this.index+t;return Gs(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}};function Ot(i){return 97<=i&&i<=122||65<=i&&i<=90||i==95||i==36}function It(i){return wt(i)||K(i)||i==95||i==36}function Ws(i){return i==101||i==69}function Vs(i){return i==45||i==43}function Qs(i){switch(i){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return i}}function zs(i){let e=parseInt(i);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+i);return e}var qs=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function Rt(i,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${i}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];qs.forEach(r=>{if(r.test(t)||r.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var st=class i{static fromArray(e){return e?(Rt("interpolation",e),new i(e[0],e[1])):z}constructor(e,t){this.start=e,this.end=t}},z=new st("{{","}}");var rt=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},it=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},we=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,r=z){this._checkNoInterpolation(e,t,r);let n=this._stripComments(e),a=this._lexer.tokenize(n),o=new q(e,t,s,a,1,this.errors,0).parseChain();return new b(o,e,t,s,this.errors)}parseBinding(e,t,s,r=z){let n=this._parseBindingAst(e,t,s,r);return new b(n,e,t,s,this.errors)}checkSimpleExpression(e){let t=new nt;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,r=z){let n=this._parseBindingAst(e,t,s,r),a=this.checkSimpleExpression(n);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new b(n,e,t,s,this.errors)}_reportError(e,t,s,r){this.errors.push(new X(e,t,s,r))}_parseBindingAst(e,t,s,r){this._checkNoInterpolation(e,t,r);let n=this._stripComments(e),a=this._lexer.tokenize(n);return new q(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,r,n){let a=this._lexer.tokenize(t);return new q(t,s,n,a,0,this.errors,0).parseTemplateBindings({source:e,span:new P(r,r+e.length)})}parseInterpolation(e,t,s,r,n=z){let{strings:a,expressions:o,offsets:h}=this.splitInterpolation(e,t,r,n);if(o.length===0)return null;let p=[];for(let l=0;l<o.length;++l){let S=o[l].text,g=this._stripComments(S),$=this._lexer.tokenize(g),y=new q(e,t,s,$,0,this.errors,h[l]).parseChain();p.push(y)}return this.createInterpolationAst(a.map(l=>l.text),p,e,t,s)}parseInterpolationExpression(e,t,s){let r=this._stripComments(e),n=this._lexer.tokenize(r),a=new q(e,t,s,n,0,this.errors,0).parseChain(),o=["",""];return this.createInterpolationAst(o,[a],e,t,s)}createInterpolationAst(e,t,s,r,n){let a=new B(0,s.length),o=new he(a,a.toAbsolute(n),e,t);return new b(o,s,r,n,this.errors)}splitInterpolation(e,t,s,r=z){let n=[],a=[],o=[],h=s?Hs(s):null,p=0,l=!1,S=!1,{start:g,end:$}=r;for(;p<e.length;)if(l){let y=p,Y=y+g.length,Z=this._getInterpolationEndIndex(e,$,Y);if(Z===-1){l=!1,S=!0;break}let M=Z+$.length,Te=e.substring(Y,Z);Te.trim().length===0&&this._reportError("Blank expressions are not allowed in interpolated strings",e,`at column ${p} in`,t),a.push({text:Te,start:y,end:M});let ns=((h==null?void 0:h.get(y))??y)+g.length;o.push(ns),p=M,l=!1}else{let y=p;p=e.indexOf(g,p),p===-1&&(p=e.length);let Y=e.substring(y,p);n.push({text:Y,start:y,end:p}),l=!0}if(!l)if(S){let y=n[n.length-1];y.text+=e.substring(p),y.end=e.length}else n.push({text:e.substring(p),start:p,end:e.length});return new rt(n,a,o)}wrapLiteralPrimitive(e,t,s){let r=new B(0,e==null?0:e.length);return new b(new A(r,r.toAbsolute(s),e),e,t,s,this.errors)}_stripComments(e){let t=this._commentStart(e);return t!=null?e.substring(0,t):e}_commentStart(e){let t=null;for(let s=0;s<e.length-1;s++){let r=e.charCodeAt(s),n=e.charCodeAt(s+1);if(r===47&&n==47&&t==null)return s;t===r?t=null:t==null&&Ze(r)&&(t=r)}return null}_checkNoInterpolation(e,t,{start:s,end:r}){let n=-1,a=-1;for(let o of this._forEachUnquotedChar(e,0))if(n===-1)e.startsWith(s)&&(n=o);else if(a=this._getInterpolationEndIndex(e,r,o),a>-1)break;n>-1&&a>-1&&this._reportError(`Got interpolation (${s}${r}) where expression was expected`,e,`at column ${n} in`,t)}_getInterpolationEndIndex(e,t,s){for(let r of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,r))return r;if(e.startsWith("//",r))return e.indexOf(t,r)}return-1}*_forEachUnquotedChar(e,t){let s=null,r=0;for(let n=t;n<e.length;n++){let a=e[n];Ze(e.charCodeAt(n))&&(s===null||s===a)&&r%2===0?s=s===null?a:null:s===null&&(yield n),r=a==="\\"?r+1:0}}},Se;(function(i){i[i.None=0]="None",i[i.Writable=1]="Writable"})(Se||(Se={}));var q=class{constructor(e,t,s,r,n,a,o){this.input=e,this.location=t,this.absoluteOffset=s,this.tokens=r,this.parseFlags=n,this.errors=a,this.offset=o,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=Se.None,this.sourceSpanCache=new Map,this.index=0}peek(e){let t=this.index+e;return t<this.tokens.length?this.tokens[t]:De}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let r=s;s=e,e=r}return new B(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===De?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index<this.tokens.length;){let s=this.parsePipe();if(e.push(s),this.consumeOptionalCharacter(59))for(this.parseFlags&1||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else if(this.index<this.tokens.length){let r=this.index;if(this.error(`Unexpected token '${this.next}'`),this.index===r)break}}if(e.length===0){let s=this.offset,r=this.offset+this.input.length;return new C(this.span(s,r),this.sourceSpan(s,r))}return e.length==1?e[0]:new te(this.span(t),this.sourceSpan(t),e)}parsePipe(){let e=this.inputIndex,t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseFlags&1&&this.error("Cannot have a pipe in an action expression");do{let s=this.inputIndex,r=this.expectIdentifierOrKeyword(),n,a;r!==null?n=this.sourceSpan(s):(r="",a=this.next.index!==-1?this.next.index:this.input.length+this.offset,n=new B(a,a).toAbsolute(this.absoluteOffset));let o=[];for(;this.consumeOptionalCharacter(58);)o.push(this.parseExpression());t=new ae(this.span(e),this.sourceSpan(e,a),t,r,o,n)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){let e=this.inputIndex,t=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){let s=this.parsePipe(),r;if(this.consumeOptionalCharacter(58))r=this.parsePipe();else{let n=this.inputIndex,a=this.input.substring(e,n);this.error(`Conditional expression ${a} requires all 3 expressions`),r=new C(this.span(e),this.sourceSpan(e))}return new se(this.span(e),this.sourceSpan(e),t,s,r)}else return t}parseLogicalOr(){let e=this.inputIndex,t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){let s=this.parseLogicalAnd();t=new I(this.span(e),this.sourceSpan(e),"||",t,s)}return t}parseLogicalAnd(){let e=this.inputIndex,t=this.parseNullishCoalescing();for(;this.consumeOptionalOperator("&&");){let s=this.parseNullishCoalescing();t=new I(this.span(e),this.sourceSpan(e),"&&",t,s)}return t}parseNullishCoalescing(){let e=this.inputIndex,t=this.parseEquality();for(;this.consumeOptionalOperator("??");){let s=this.parseEquality();t=new I(this.span(e),this.sourceSpan(e),"??",t,s)}return t}parseEquality(){let e=this.inputIndex,t=this.parseRelational();for(;this.next.type==u.Operator;){let s=this.next.strValue;switch(s){case"==":case"===":case"!=":case"!==":this.advance();let r=this.parseRelational();t=new I(this.span(e),this.sourceSpan(e),s,t,r);continue}break}return t}parseRelational(){let e=this.inputIndex,t=this.parseAdditive();for(;this.next.type==u.Operator;){let s=this.next.strValue;switch(s){case"<":case">":case"<=":case">=":this.advance();let r=this.parseAdditive();t=new I(this.span(e),this.sourceSpan(e),s,t,r);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==u.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let r=this.parseMultiplicative();t=new I(this.span(e),this.sourceSpan(e),s,t,r);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==u.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let r=this.parsePrefix();t=new I(this.span(e),this.sourceSpan(e),s,t,r);continue}break}return t}parsePrefix(){if(this.next.type==u.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),D.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),D.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new pe(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new ue(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new A(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new A(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new A(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new A(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Ke(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new oe(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new T(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new C(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new C(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new C(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let r=this.inputIndex,n=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:n}),n)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let o=this.span(r),h=this.sourceSpan(r);t.push(new _(o,h,h,new T(o,h),a))}}while(this.consumeOptionalCharacter(44)&&!this.next.isCharacter(125));this.rbracesExpected--,this.expectCharacter(125)}return new ce(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let r=this.inputIndex,n=this.withContext(Se.Writable,()=>{let h=this.expectIdentifierOrKeyword()??"";return h.length===0&&this.error("Expected identifier for property access",e.span.end),h}),a=this.sourceSpan(r),o;if(s)this.consumeOptionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),o=new C(this.span(t),this.sourceSpan(t))):o=new U(this.span(t),this.sourceSpan(t),a,e,n);else if(this.consumeOptionalOperator("=")){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new C(this.span(t),this.sourceSpan(t));let h=this.parseConditional();o=new re(this.span(t),this.sourceSpan(t),a,e,n,h)}else o=new _(this.span(t),this.sourceSpan(t),a,e,n);return o}parseCall(e,t,s){let r=this.inputIndex;this.rparensExpected++;let n=this.parseCallArguments(),a=this.span(r,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let o=this.span(t),h=this.sourceSpan(t);return s?new G(o,h,e,n,a):new le(o,h,e,n,a)}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new P(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index<this.tokens.length;){let s=this.parseLetBinding();if(s)t.push(s);else{let r=this.expectTemplateBindingKey(),n=this.parseAsBinding(r);n?t.push(n):(r.source=e.source+r.source.charAt(0).toUpperCase()+r.source.substring(1),t.push(...this.parseDirectiveKeywordBindings(r)))}this.consumeStatementTerminator()}return new it(t,[],this.errors)}parseKeyedReadOrWrite(e,t,s){return this.withContext(Se.Writable,()=>{this.rbracketsExpected++;let r=this.parsePipe();if(r instanceof C&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let n=this.parseConditional();return new ne(this.span(t),this.sourceSpan(t),e,r,n)}else return s?new F(this.span(t),this.sourceSpan(t),e,r):new ie(this.span(t),this.sourceSpan(t),e,r);return new C(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),r=this.currentAbsoluteOffset,n=this.parseAsBinding(e);n||(this.consumeStatementTerminator(),r=this.currentAbsoluteOffset);let a=new P(e.span.start,r);return t.push(new xe(a,e,s)),n&&t.push(n),t}getDirectiveBoundTarget(){if(this.next===De||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,r=this.input.substring(t,s);return new b(e,r,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new P(e.span.start,this.currentAbsoluteOffset);return new W(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let r=new P(e,this.currentAbsoluteOffset);return new W(r,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new X(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e<this.tokens.length?`at column ${this.tokens[e].index+1} in`:"at the end of the expression"}_reportErrorForPrivateIdentifier(e,t){let s=`Private identifiers are not supported. Unexpected private identifier: ${e}`;t!==null&&(s+=`, ${t}`),this.error(s)}skip(){let e=this.next;for(;this.index<this.tokens.length&&!e.isCharacter(59)&&!e.isOperator("|")&&(this.rparensExpected<=0||!e.isCharacter(41))&&(this.rbracesExpected<=0||!e.isCharacter(125))&&(this.rbracketsExpected<=0||!e.isCharacter(93))&&(!(this.context&Se.Writable)||!e.isOperator("="));)this.next.isError()&&this.errors.push(new X(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),e=this.next}},nt=class extends Me{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}};function Hs(i){let e=new Map,t=0,s=0,r=0;for(;r<i.length;){let n=i[r];if(n.type===9){let[a,o]=n.parts;t+=o.length,s+=a.length}else{let a=n.parts.reduce((o,h)=>o+h.length,0);s+=a,t+=a}e.set(s,t),r++}return e}function Pt({start:i,end:e},t){let s=i,r=e;for(;r!==s&&/\s/.test(t[r-1]);)r--;for(;s!==r&&/\s/.test(t[s]);)s++;return{start:s,end:r}}function Ys({start:i,end:e},t){let s=i,r=e;for(;r!==t.length&&/\s/.test(t[r]);)r++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:r}}function Zs(i,e){return e[i.start-1]==="("&&e[i.end]===")"?{start:i.start-1,end:i.end+1}:i}function bt(i,e,t){let s=0,r={start:i.start,end:i.end};for(;;){let n=Ys(r,e),a=Zs(n,e);if(n.start===a.start&&n.end===a.end)break;r.start=a.start,r.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:Pt(t?{start:r.start+1,end:r.end-1}:r,e),innerSpan:Pt(i,e)}}function Bt(i){return typeof i=="string"?e=>e===i:e=>i.test(e)}function Tt(i,e,t){let s=Bt(e);for(let r=t;r>=0;r--){let n=i[r];if(s(n))return r}throw new Error(`Cannot find front char ${e} from index ${t} in ${JSON.stringify(i)}`)}function Kt(i,e,t){let s=Bt(e);for(let r=t;r<i.length;r++){let n=i[r];if(s(n))return r}throw new Error(`Cannot find character ${e} from index ${t} in ${JSON.stringify(i)}`)}function Mt(i){return i.slice(0,1).toLowerCase()+i.slice(1)}function Oe(i){let{start:e,end:t}=i;return{start:e,end:t,range:[e,t]}}var Js=i=>we.prototype._commentStart(i);function Xs(i,e){let t=e?Js(i):null;if(t===null)return{text:i,comments:[]};let s={type:"CommentLine",value:i.slice(t+2),...Oe({start:t,end:i.length})};return{text:i.slice(0,t),comments:[s]}}function Ie(i,e=!0){return t=>{let s=new Ee,r=new we(s),{text:n,comments:a}=Xs(t,e),o=i(n,r);if(o.errors.length!==0){let[{message:h}]=o.errors;throw new SyntaxError(h.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}return{result:o,comments:a,text:n}}}var _t=Ie((i,e)=>e.parseBinding(i,"",0)),er=Ie((i,e)=>e.parseSimpleBinding(i,"",0)),Ut=Ie((i,e)=>e.parseAction(i,"",0)),Ft=Ie((i,e)=>e.parseInterpolationExpression(i,"",0)),Dt=Ie((i,e)=>e.parseTemplateBindings("",i,"",0,0),!1);var sr=(i,e,t)=>{if(!(i&&e==null))return Array.isArray(e)||typeof e=="string"?e[t<0?e.length+t:t]:e.at(t)},Ge=sr;var at=class{text;constructor(e){this.text=e}getCharacterIndex(e,t){return Kt(this.text,e,t)}getCharacterLastIndex(e,t){return Tt(this.text,e,t)}transformSpan(e,{stripSpaces:t=!1,hasParentParens:s=!1}={}){if(!t)return Oe(e);let{outerSpan:r,innerSpan:n,hasParens:a}=bt(e,this.text,s),o=Oe(n);return a&&(o.extra={parenthesized:!0,parenStart:r.start,parenEnd:r.end}),o}createNode(e,{stripSpaces:t=!0,hasParentParens:s=!1}={}){let{type:r,start:n,end:a}=e,o={...e,...this.transformSpan({start:n,end:a},{stripSpaces:t,hasParentParens:s})};switch(r){case"NumericLiteral":case"StringLiteral":{let h=this.text.slice(o.start,o.end),{value:p}=o;o.extra={...o.extra,raw:h,rawValue:p};break}case"ObjectProperty":{let{shorthand:h}=o;h&&(o.extra={...o.extra,shorthand:h});break}}return o}},Gt=at;function ct(i){var e;return!!((e=i.extra)!=null&&e.parenthesized)}function L(i){return ct(i)?i.extra.parenStart:i.start}function R(i){return ct(i)?i.extra.parenEnd:i.end}function Wt(i){return(i.type==="OptionalCallExpression"||i.type==="OptionalMemberExpression")&&!ct(i)}function Vt(i,e){let{start:t,end:s}=i.sourceSpan;return t>=s||/^\s+$/.test(e.slice(t,s))}var Le,ye,x,d,H,ke,f,v,Re,ot,Ne=class extends Gt{constructor(t,s){super(s);w(this,x);w(this,H);w(this,f);w(this,Re);w(this,Le,void 0);w(this,ye,void 0);J(this,Le,t),J(this,ye,s)}get node(){return c(this,f,v).call(this,k(this,Le))}transformNode(t){return c(this,Re,ot).call(this,t)}};Le=new WeakMap,ye=new WeakMap,x=new WeakSet,d=function(t,{stripSpaces:s=!0,hasParentParens:r=!1}={}){return this.createNode(t,{stripSpaces:s,hasParentParens:r})},H=new WeakSet,ke=function(t,s,{computed:r,optional:n,end:a=R(s),hasParentParens:o=!1}){if(Vt(t,k(this,ye))||t.sourceSpan.start===s.start)return s;let h=c(this,f,v).call(this,t),p=Wt(h);return c(this,x,d).call(this,{type:n||p?"OptionalMemberExpression":"MemberExpression",object:h,property:s,computed:r,...n?{optional:!0}:p?{optional:!1}:void 0,start:L(h),end:a},{hasParentParens:o})},f=new WeakSet,v=function(t,s=!1){return c(this,Re,ot).call(this,t,s)},Re=new WeakSet,ot=function(t,s=!1){if(t instanceof he){let{expressions:r}=t;if(r.length!==1)throw new Error("Unexpected 'Interpolation'");return c(this,f,v).call(this,r[0])}if(t instanceof D)return c(this,x,d).call(this,{type:"UnaryExpression",prefix:!0,argument:c(this,f,v).call(this,t.expr),operator:t.operator,...t.sourceSpan},{hasParentParens:s});if(t instanceof I){let{left:r,operation:n,right:a}=t,o=c(this,f,v).call(this,r),h=c(this,f,v).call(this,a),p=L(o),l=R(h),S={left:o,right:h,start:p,end:l};return n==="&&"||n==="||"||n==="??"?c(this,x,d).call(this,{...S,type:"LogicalExpression",operator:n},{hasParentParens:s}):c(this,x,d).call(this,{...S,type:"BinaryExpression",operator:n},{hasParentParens:s})}if(t instanceof ae){let{exp:r,name:n,args:a}=t,o=c(this,f,v).call(this,r),h=L(o),p=R(o),l=this.getCharacterIndex(/\S/,this.getCharacterIndex("|",p)+1),S=c(this,x,d).call(this,{type:"Identifier",name:n,start:l,end:l+n.length}),g=a.map($=>c(this,f,v).call(this,$));return c(this,x,d).call(this,{type:"NGPipeExpression",left:o,right:S,arguments:g,start:h,end:R(g.length===0?S:Ge(!1,g,-1))},{hasParentParens:s})}if(t instanceof te)return c(this,x,d).call(this,{type:"NGChainedExpression",expressions:t.expressions.map(r=>c(this,f,v).call(this,r)),...t.sourceSpan},{hasParentParens:s});if(t instanceof se){let{condition:r,trueExp:n,falseExp:a}=t,o=c(this,f,v).call(this,r),h=c(this,f,v).call(this,n),p=c(this,f,v).call(this,a);return c(this,x,d).call(this,{type:"ConditionalExpression",test:o,consequent:h,alternate:p,start:L(o),end:R(p)},{hasParentParens:s})}if(t instanceof C)return c(this,x,d).call(this,{type:"NGEmptyExpression",...t.sourceSpan},{hasParentParens:s});if(t instanceof T)return c(this,x,d).call(this,{type:"ThisExpression",...t.sourceSpan},{hasParentParens:s});if(t instanceof ie||t instanceof F)return c(this,H,ke).call(this,t.receiver,c(this,f,v).call(this,t.key),{computed:!0,optional:t instanceof F,end:t.sourceSpan.end,hasParentParens:s});if(t instanceof oe)return c(this,x,d).call(this,{type:"ArrayExpression",elements:t.expressions.map(r=>c(this,f,v).call(this,r)),...t.sourceSpan},{hasParentParens:s});if(t instanceof ce){let{keys:r,values:n}=t,a=n.map(h=>c(this,f,v).call(this,h)),o=r.map(({key:h,quoted:p},l)=>{let S=a[l],g=L(S),$=R(S),y=this.getCharacterIndex(/\S/,l===0?t.sourceSpan.start+1:this.getCharacterIndex(",",R(a[l-1]))+1),Y=g===y?$:this.getCharacterLastIndex(/\S/,this.getCharacterLastIndex(":",g-1)-1)+1,Z={start:y,end:Y},M=p?c(this,x,d).call(this,{type:"StringLiteral",value:h,...Z}):c(this,x,d).call(this,{type:"Identifier",name:h,...Z}),Te=M.end<M.start||y===g;return c(this,x,d).call(this,{type:"ObjectProperty",key:M,value:S,shorthand:Te,computed:!1,start:L(M),end:$})});return c(this,x,d).call(this,{type:"ObjectExpression",properties:o,...t.sourceSpan},{hasParentParens:s})}if(t instanceof A){let{value:r}=t;switch(typeof r){case"boolean":return c(this,x,d).call(this,{type:"BooleanLiteral",value:r,...t.sourceSpan},{hasParentParens:s});case"number":return c(this,x,d).call(this,{type:"NumericLiteral",value:r,...t.sourceSpan},{hasParentParens:s});case"object":return c(this,x,d).call(this,{type:"NullLiteral",...t.sourceSpan},{hasParentParens:s});case"string":return c(this,x,d).call(this,{type:"StringLiteral",value:r,...t.sourceSpan},{hasParentParens:s});case"undefined":return c(this,x,d).call(this,{type:"Identifier",name:"undefined",...t.sourceSpan},{hasParentParens:s});default:throw new Error(`Unexpected LiteralPrimitive value type ${typeof r}`)}}if(t instanceof le||t instanceof G){let r=t instanceof G,{receiver:n,args:a}=t,o=a.length===1?[c(this,f,v).call(this,a[0],!0)]:a.map(S=>c(this,f,v).call(this,S)),h=c(this,f,v).call(this,n),p=Wt(h),l=r||p?"OptionalCallExpression":"CallExpression";return c(this,x,d).call(this,{type:l,callee:h,arguments:o,optional:l==="OptionalCallExpression"?r:void 0,start:L(h),end:t.sourceSpan.end},{hasParentParens:s})}if(t instanceof ue){let r=c(this,f,v).call(this,t.expression);return c(this,x,d).call(this,{type:"TSNonNullExpression",expression:r,start:L(r),end:t.sourceSpan.end},{hasParentParens:s})}if(t instanceof pe){let r=c(this,f,v).call(this,t.expression);return c(this,x,d).call(this,{type:"UnaryExpression",prefix:!0,operator:"!",argument:r,start:t.sourceSpan.start,end:R(r)},{hasParentParens:s})}if(t instanceof _||t instanceof U){let{receiver:r,name:n}=t,a=this.getCharacterLastIndex(/\S/,t.sourceSpan.end-1)+1,o=c(this,x,d).call(this,{type:"Identifier",name:n,start:a-n.length,end:a},Vt(r,k(this,ye))?{hasParentParens:s}:{});return c(this,H,ke).call(this,r,o,{computed:!1,optional:t instanceof U,hasParentParens:s})}if(t instanceof ne){let r=c(this,f,v).call(this,t.key),n=c(this,f,v).call(this,t.value),a=c(this,H,ke).call(this,t.receiver,r,{computed:!0,optional:!1,end:this.getCharacterIndex("]",R(r))+1});return c(this,x,d).call(this,{type:"AssignmentExpression",left:a,operator:"=",right:n,start:L(a),end:R(n)},{hasParentParens:s})}if(t instanceof re){let{receiver:r,name:n,value:a}=t,o=c(this,f,v).call(this,a),h=this.getCharacterLastIndex(/\S/,this.getCharacterLastIndex("=",L(o)-1)-1)+1,p=c(this,x,d).call(this,{type:"Identifier",name:n,start:h-n.length,end:h}),l=c(this,H,ke).call(this,r,p,{computed:!1,optional:!1});return c(this,x,d).call(this,{type:"AssignmentExpression",left:l,operator:"=",right:o,start:L(l),end:R(o)},{hasParentParens:s})}throw Object.assign(new Error("Unexpected node"),{node:t})};function Qt(i,e){return new Ne(i,e).node}function zt(i){return i instanceof xe}function qt(i){return i instanceof W}var $e,j,We,Ht,E,O,Pe,pt,be,ut,Be,lt,Ve,jt,Qe,Yt,ze,Zt,qe,Jt,ht=class extends Ne{constructor(t,s){super(void 0,s);w(this,We);w(this,E);w(this,Pe);w(this,be);w(this,Be);w(this,Ve);w(this,Qe);w(this,ze);w(this,qe);w(this,$e,void 0);w(this,j,void 0);J(this,$e,t),J(this,j,s);for(let r of t)c(this,Ve,jt).call(this,r)}get expressions(){return c(this,ze,Zt).call(this)}};$e=new WeakMap,j=new WeakMap,We=new WeakSet,Ht=function(){return k(this,$e)[0].key},E=new WeakSet,O=function(t,{stripSpaces:s=!0}={}){return this.createNode(t,{stripSpaces:s})},Pe=new WeakSet,pt=function(t){return this.transformNode(t)},be=new WeakSet,ut=function(t){return Mt(t.slice(k(this,We,Ht).source.length))},Be=new WeakSet,lt=function(t){let s=k(this,j);if(s[t.start]!=='"'&&s[t.start]!=="'")return;let r=s[t.start],n=!1;for(let a=t.start+1;a<s.length;a++)switch(s[a]){case r:if(!n){t.end=a+1;return}default:n=!1;break;case"\\":n=!n;break}},Ve=new WeakSet,jt=function(t){c(this,Be,lt).call(this,t.key.span),qt(t)&&t.value&&c(this,Be,lt).call(this,t.value.span)},Qe=new WeakSet,Yt=function(t){if(!t.value||t.value.source)return t.value;let s=this.getCharacterIndex(/\S/,t.sourceSpan.start);return{source:"$implicit",span:{start:s,end:s}}},ze=new WeakSet,Zt=function(){let t=k(this,$e),[s]=t,r=k(this,j).slice(s.sourceSpan.start,s.sourceSpan.end).trim().length===0?t.slice(1):t,n=[],a=null;for(let[o,h]of r.entries()){if(a&&zt(a)&&qt(h)&&h.value&&h.value.source===a.key.source){let p=c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:h.key.source,...h.key.span}),l=($,y)=>({...$,...this.transformSpan({start:$.start,end:y})}),S=$=>({...l($,p.end),alias:p}),g=n.pop();if(g.type==="NGMicrosyntaxExpression")n.push(S(g));else if(g.type==="NGMicrosyntaxKeyedExpression"){let $=S(g.expression);n.push(l({...g,expression:$},$.end))}else throw new Error(`Unexpected type ${g.type}`)}else n.push(c(this,qe,Jt).call(this,h,o));a=h}return c(this,E,O).call(this,{type:"NGMicrosyntax",body:n,...n.length===0?t[0].sourceSpan:{start:n[0].start,end:Ge(!1,n,-1).end}})},qe=new WeakSet,Jt=function(t,s){if(zt(t)){let{key:r,value:n}=t;return n?s===0?c(this,E,O).call(this,{type:"NGMicrosyntaxExpression",expression:c(this,Pe,pt).call(this,n.ast),alias:null,...n.sourceSpan}):c(this,E,O).call(this,{type:"NGMicrosyntaxKeyedExpression",key:c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:c(this,be,ut).call(this,r.source),...r.span}),expression:c(this,E,O).call(this,{type:"NGMicrosyntaxExpression",expression:c(this,Pe,pt).call(this,n.ast),alias:null,...n.sourceSpan}),start:r.span.start,end:n.sourceSpan.end}):c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:c(this,be,ut).call(this,r.source),...r.span})}else{let{key:r,sourceSpan:n}=t;if(/^let\s$/.test(k(this,j).slice(n.start,n.start+4))){let{value:o}=t;return c(this,E,O).call(this,{type:"NGMicrosyntaxLet",key:c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:r.source,...r.span}),value:o?c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:o.source,...o.span}):null,start:n.start,end:o?o.span.end:r.span.end})}else{let o=c(this,Qe,Yt).call(this,t);return c(this,E,O).call(this,{type:"NGMicrosyntaxAs",key:c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:o.source,...o.span}),alias:c(this,E,O).call(this,{type:"NGMicrosyntaxKey",name:r.source,...r.span}),start:o.span.start,end:r.span.end})}}};function Xt(i,e){return new ht(i,e).expressions}function He({result:{ast:i},text:e,comments:t}){return Object.assign(Qt(i,e),{comments:t})}function es({result:{templateBindings:i},text:e}){return Xt(i,e)}var ts=i=>He(_t(i));var ss=i=>He(Ft(i)),xt=i=>He(Ut(i)),rs=i=>es(Dt(i));function dt(i){var s,r,n;let e=((s=i.range)==null?void 0:s[0])??i.start,t=(n=((r=i.declaration)==null?void 0:r.decorators)??i.decorators)==null?void 0:n[0];return t?Math.min(dt(t),e):e}function is(i){var e;return((e=i.range)==null?void 0:e[1])??i.end}function je(i){return{astFormat:"estree",parse(e){let t=i(e);return{type:"NGRoot",node:i===xt&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:dt,locEnd:is}}var rr=je(xt),ir=je(ts),nr=je(ss),ar=je(rs);var qr=vt;export{qr as default,ft as parsers};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Parser } from "../index.js";
|
|
2
|
+
|
|
3
|
+
export declare const parsers: {
|
|
4
|
+
babel: Parser;
|
|
5
|
+
"babel-flow": Parser;
|
|
6
|
+
"babel-ts": Parser;
|
|
7
|
+
__js_expression: Parser;
|
|
8
|
+
__ts_expression: Parser;
|
|
9
|
+
__vue_expression: Parser;
|
|
10
|
+
__vue_ts_expression: Parser;
|
|
11
|
+
__vue_event_binding: Parser;
|
|
12
|
+
__vue_ts_event_binding: Parser;
|
|
13
|
+
__babel_estree: Parser;
|
|
14
|
+
json: Parser;
|
|
15
|
+
json5: Parser;
|
|
16
|
+
jsonc: Parser;
|
|
17
|
+
"json-stringify": Parser;
|
|
18
|
+
};
|