webhook/node_modules/prettier/parser-glimmer.js

2 lines
164 KiB
JavaScript
Raw Normal View History

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