2020-03-31 20:40:00 +08:00
|
|
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t=t||self).prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.glimmer={}))}(this,(function(t){"use strict";var e=function(t,e){const r=new SyntaxError(t+" ("+e.start.line+":"+e.start.column+")");return r.loc=e,r};Object.freeze([]);const r=(...t)=>t,{keys:i}=Object;function a(t){for(let e=1;e<arguments.length;e++){let r=arguments[e];if(null===r||"object"!=typeof r)continue;let a=i(r);for(let e=0;e<a.length;e++){let i=a[e];t[i]=r[i]}}return t}function n(t,e,r,i){return{type:"ElementModifierStatement",path:h(t),params:e||[],hash:r||d([]),loc:v(i||null)}}function s(t){return Array.isArray(t)&&2===t.length&&"loc"===t[0]}function o(t){if("string"==typeof t)return n(t);let e,r,i=function(t){return"string"==typeof t?h(t):h(t[1],t[2]&&t[2][1])}(t[0]),a=null,o=t.slice(1),l=o.shift();var c;return c=l,Array.isArray(c)&&!s(c)&&(e=l,l=o.shift(),function(t){return!("object"!=typeof t||!t||Array.isArray(t))}(l)&&(r=function(t,e){let r=[];return Object.keys(t).forEach(e=>{r.push(f(e,t[e]))}),d(r,e)}(l))),s(l)&&(a=l[1]),{type:"ElementModifierStatement",path:i,params:e||[],hash:r||d([]),loc:v(a||null)}}function l(t){let e,r=t[0];return e="string"==typeof t[1]?u(t[1]):t[1],c(r,e,t[2]?t[2][1]:void 0)}function c(t,e,r){return{type:"AttrNode",name:t,value:e,loc:v(r||null)}}function u(t,e){return{type:"TextNode",chars:t||"",loc:v(e||null)}}function h(t,e){if("string"!=typeof t)return t;let r=t.split("."),i=!1;return"this"===r[0]&&(i=!0,r=r.slice(1)),{type:"PathExpression",original:t,this:i,parts:r,data:!1,loc:v(e||null)}}function p(t,e,r){return{type:t,value:e,original:e,loc:v(r||null)}}function d(t,e){return{type:"Hash",pairs:t||[],loc:v(e||null)}}function f(t,e,r){return{type:"HashPair",key:t,value:e,loc:v(r||null)}}function m(t){return t||null}function g(t,e){return{line:t,column:e}}const b={source:"(synthetic)",start:{line:1,column:0},end:{line:1,column:0}};function v(...t){if(1===t.length){let e=t[0];return e&&"object"==typeof e?{source:m(e.source),start:g(e.start.line,e.start.column),end:g(e.end.line,e.end.column)}:b}{let[e,r,i,a,n]=t;return{source:m(n),start:g(e,r),end:g(i,a)}}}var y={mustache:function(t,e,r,i,a,n){return"string"==typeof t&&(t=h(t)),{type:"MustacheStatement",path:t,params:e||[],hash:r||d([]),escaped:!i,loc:v(a||null),strip:n||{open:!1,close:!1}}},block:function(t,e,r,i,n,s,o,l,c){let u,p;return u="Template"===i.type?a({},i,{type:"Block"}):i,p=null!=n&&"Template"===n.type?a({},n,{type:"Block"}):n,{type:"BlockStatement",path:h(t),params:e||[],hash:r||d([]),program:u||null,inverse:p||null,loc:v(s||null),openStrip:o||{open:!1,close:!1},inverseStrip:l||{open:!1,close:!1},closeStrip:c||{open:!1,close:!1}}},partial:function(t,e,r,i,a){return{type:"PartialStatement",name:t,params:e||[],hash:r||d([]),indent:i||"",strip:{open:!1,close:!1},loc:v(a||null)}},comment:function(t,e){return{type:"CommentStatement",value:t,loc:v(e||null)}},mustacheComment:function(t,e){return{type:"MustacheCommentStatement",value:t,loc:v(e||null)}},element:function(t,e,...r){let i;i=Array.isArray(e)?function(...t){let e={};for(let r of t)switch(r[0]){case"attrs":{let[,...t]=r;e.attrs=t.map(l);break}case"modifiers":{let[,...t]=r;e.modifiers=t.map(o);break}case"body":{let[,...t]=r;e.children=t;break}case"comments":{let[,...t]=r;e.comments=t;break}case"as":{let[,...t]=r;e.blockParams=t;break}case"loc":{let[,t]=r;e.loc=t;break}}return e}(e,...r):e||{};let{attrs:a,blockParams:n,modifiers:s,comments:c,children:u,loc:h}=i,p=!1;return"object"==typeof t?(p=t.selfClosing,t=t.name):"/"===t.slice(-1)&&(t=t.slice(0,-1),p=!0),{type:"ElementNode",tag:t||"",selfClosing:p,attributes:a||[],blockParams:n||[],modifiers:s||[],comments:c||[],children:u||[],loc:v(h||null)}},elementModifier:n,attr:c,text:u,sexpr:function(t,e,r,i){return{type:"SubExpression",path:h(t),params:e||[],hash:r||d([]),loc:v(i||null)}},path:h,concat:function(t,e){return{type:"ConcatStatement",parts:t||[],loc:v(e||null)}},hash:d,pair:f,literal:p,program:funct
|