@anoki/fse-ui
Version:
FSE UI components library
9 lines (7 loc) • 1.77 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./index.cjs704.js"),q=require("./index.cjs705.js");var d,S;function v(){if(S)return d;S=1;let g=_.__require(),m=q;class h extends Error{constructor(t,n,i,r,l,a){super(t),this.name="CssSyntaxError",this.reason=t,l&&(this.file=l),r&&(this.source=r),a&&(this.plugin=a),typeof n<"u"&&typeof i<"u"&&(typeof n=="number"?(this.line=n,this.column=i):(this.line=n.line,this.column=n.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,h)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=g.isColorSupported);let i=e=>e,r=e=>e,l=e=>e;if(t){let{bold:e,gray:c,red:o}=g.createColors(!0);r=s=>e(o(s)),i=s=>c(s),m&&(l=s=>m(s))}let a=n.split(/\r?\n/),f=Math.max(this.line-3,0),p=Math.min(this.line+2,a.length),y=String(p).length;return a.slice(f,p).map((e,c)=>{let o=f+1+c,s=" "+(" "+o).slice(-y)+" | ";if(o===this.line){if(e.length>160){let u=20,b=Math.max(0,this.column-u),C=Math.max(this.column+u,this.endColumn+u),E=e.slice(b,C),M=i(s.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,u-1)).replace(/[^\t]/g," ");return r(">")+i(s)+l(E)+`
`+M+r("^")}let x=i(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return r(">")+i(s)+l(e)+`
`+x+r("^")}return" "+i(s)+l(e)}).join(`
`)}toString(){let t=this.showSourceCode();return t&&(t=`
`+t+`
`),this.name+": "+this.message+t}}return d=h,h.default=h,d}exports.__require=v;
//# sourceMappingURL=index.cjs688.js.map