@visulima/cerebro 3.0.3 → 3.0.5
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/CHANGELOG.md +17 -0
- package/LICENSE.md +346 -0
- package/dist/commands/completion-command.d.ts +3 -3
- package/dist/commands/completion-command.js +1 -1
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.js +1 -1
- package/dist/commands/readme-command.d.ts +3 -3
- package/dist/commands/readme-command.js +17 -17
- package/dist/commands/version-command.d.ts +1 -1
- package/dist/index.d.ts +403 -433
- package/dist/index.js +1 -1
- package/dist/logger/create-pail-logger.d.ts +533 -555
- package/dist/logger/create-pail-logger.js +1 -1
- package/dist/packem_chunks/has-new-version.js +1 -1
- package/dist/packem_shared/Cerebro-58LHN3_T.js +4 -0
- package/dist/packem_shared/VisulimaError-k1qGkvab.js +76 -0
- package/dist/packem_shared/cerebro-error-DWpjBY_M.js +1 -0
- package/dist/packem_shared/command.d-B_G9vIYJ.d.ts +633 -0
- package/dist/packem_shared/{index-DvVGK4kr.js → index-Dpm7gUHe.js} +12 -12
- package/dist/packem_shared/index.d-CnnVYgSZ.d.ts +117 -0
- package/dist/packem_shared/renderError-BISXNU8L-B47ZikMV.js +27 -0
- package/dist/packem_shared/runtime-process-BEw54Ar-.js +1 -0
- package/dist/packem_shared/split-by-case-BZ6XOTIf.js +1 -0
- package/dist/plugins/error-handler-plugin.d.ts +18 -7
- package/dist/plugins/error-handler-plugin.js +1 -1
- package/dist/plugins/runtime-version-check-plugin.d.ts +5 -5
- package/dist/plugins/runtime-version-check-plugin.js +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +11 -10
- package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
- package/dist/util/general/compile-cache.d.ts +37 -37
- package/dist/util/general/heap-tuning.d.ts +11 -11
- package/dist/util/general/heap-tuning.js +1 -1
- package/package.json +6 -6
- package/dist/packem_shared/Cerebro-Czc4t-75.js +0 -4
- package/dist/packem_shared/VisulimaError-C90oeIMu.js +0 -76
- package/dist/packem_shared/cerebro-error-BjBcYVRO.js +0 -1
- package/dist/packem_shared/command.d-DbhtfXF4.d.ts +0 -639
- package/dist/packem_shared/index.d-BL4NtVR3.d.ts +0 -127
- package/dist/packem_shared/renderError-B3ePOoBG-BmZlyMcr.js +0 -25
- package/dist/packem_shared/runtime-process-Dmz0vCJy.js +0 -1
- package/dist/packem_shared/split-by-case-Dbpgd7rf.js +0 -1
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
type ColorizeMethod = (value: string) => string;
|
|
2
|
-
type CodeFrameOptions = {
|
|
3
|
-
color?: {
|
|
4
|
-
gutter?: ColorizeMethod;
|
|
5
|
-
marker?: ColorizeMethod;
|
|
6
|
-
message?: ColorizeMethod;
|
|
7
|
-
};
|
|
8
|
-
linesAbove?: number;
|
|
9
|
-
linesBelow?: number;
|
|
10
|
-
message?: string;
|
|
11
|
-
prefix?: string;
|
|
12
|
-
showGutter?: boolean;
|
|
13
|
-
showLineNumbers?: boolean;
|
|
14
|
-
tabWidth?: number | false;
|
|
15
|
-
};
|
|
16
|
-
interface ErrorProperties {
|
|
17
|
-
cause?: unknown;
|
|
18
|
-
hint?: ErrorHint;
|
|
19
|
-
location?: ErrorLocation;
|
|
20
|
-
message?: string;
|
|
21
|
-
name: string;
|
|
22
|
-
stack?: string;
|
|
23
|
-
title?: string;
|
|
24
|
-
}
|
|
25
|
-
interface ErrorLocation {
|
|
26
|
-
column?: number;
|
|
27
|
-
file?: string;
|
|
28
|
-
line?: number;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* A message that explains to the user how they can fix the error.
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* const error = new VisulimaError({
|
|
35
|
-
* hint: "Try running `npm install` to install missing dependencies.",
|
|
36
|
-
* location: {
|
|
37
|
-
* file: "src/index.ts",
|
|
38
|
-
* line: 1,
|
|
39
|
-
* column: 1,
|
|
40
|
-
* },
|
|
41
|
-
* message: "Cannot find module 'react'",
|
|
42
|
-
* name: "ModuleNotFoundError",
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* For more complex hints, you can pass an array of strings or a single string in markdown format.
|
|
47
|
-
*/
|
|
48
|
-
type ErrorHint = string[] | string;
|
|
49
|
-
declare class VisulimaError extends Error {
|
|
50
|
-
loc: ErrorLocation | undefined;
|
|
51
|
-
title: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* A message that explains to the user how they can fix the error.
|
|
54
|
-
*/
|
|
55
|
-
hint: ErrorHint | undefined;
|
|
56
|
-
type: string;
|
|
57
|
-
constructor({
|
|
58
|
-
cause,
|
|
59
|
-
hint,
|
|
60
|
-
location,
|
|
61
|
-
message,
|
|
62
|
-
name,
|
|
63
|
-
stack,
|
|
64
|
-
title
|
|
65
|
-
}: ErrorProperties);
|
|
66
|
-
setLocation(location: ErrorLocation): void;
|
|
67
|
-
setName(name: string): void;
|
|
68
|
-
setMessage(message: string): void;
|
|
69
|
-
setHint(hint: ErrorHint): void;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Will return an array of all causes in the error in the order they occurred.
|
|
73
|
-
*/
|
|
74
|
-
/**
|
|
75
|
-
* The compiled position of a stack frame handed to a {@link SourceMapResolver}.
|
|
76
|
-
*/
|
|
77
|
-
interface SourceMapLocation {
|
|
78
|
-
column?: number;
|
|
79
|
-
file: string;
|
|
80
|
-
line: number;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* The resolved original position returned by a {@link SourceMapResolver}. Any omitted field falls
|
|
84
|
-
* back to the compiled value. `source`, when provided, is used directly as the code-frame content
|
|
85
|
-
* (e.g. from an inlined `sourcesContent`) instead of reading the resolved file from disk.
|
|
86
|
-
*/
|
|
87
|
-
interface ResolvedSourceLocation {
|
|
88
|
-
column?: number;
|
|
89
|
-
file?: string;
|
|
90
|
-
line?: number;
|
|
91
|
-
source?: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Pluggable hook that maps a compiled `*.js:line:col` position back to its original source position
|
|
95
|
-
* (e.g. TS/JSX). Return `undefined` (or throw) to leave the frame untouched. Synchronous so it can
|
|
96
|
-
* be used by the synchronous `renderError`; resolve/inline your maps ahead of time.
|
|
97
|
-
*/
|
|
98
|
-
type SourceMapResolver = (location: SourceMapLocation) => ResolvedSourceLocation | undefined;
|
|
99
|
-
type Options$1 = {
|
|
100
|
-
/**
|
|
101
|
-
* Read source files for code frames from anywhere on disk, including absolute paths outside
|
|
102
|
-
* `cwd`. Defaults to `false`, in which case only files resolving inside `cwd` are read — this
|
|
103
|
-
* prevents local file disclosure when rendering errors whose stack came from untrusted input
|
|
104
|
-
* (e.g. a deserialized error). Enable only for trusted, locally-thrown errors.
|
|
105
|
-
* @default false
|
|
106
|
-
*/
|
|
107
|
-
allowAllFilePaths: boolean;
|
|
108
|
-
color: CodeFrameOptions["color"] & {
|
|
109
|
-
fileLine: ColorizeMethod;
|
|
110
|
-
hint: ColorizeMethod;
|
|
111
|
-
method: ColorizeMethod;
|
|
112
|
-
title: ColorizeMethod;
|
|
113
|
-
};
|
|
114
|
-
cwd: string;
|
|
115
|
-
displayShortPath: boolean;
|
|
116
|
-
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
117
|
-
framesMaxLimit: number;
|
|
118
|
-
hideErrorCauseCodeView: boolean;
|
|
119
|
-
hideErrorCodeView: boolean;
|
|
120
|
-
hideErrorErrorsCodeView: boolean;
|
|
121
|
-
hideErrorTitle: boolean;
|
|
122
|
-
hideMessage: boolean;
|
|
123
|
-
indentation: number | " ";
|
|
124
|
-
prefix: string; /** Optional source-map resolver to map compiled frame positions back to original source. */
|
|
125
|
-
sourceMap?: SourceMapResolver;
|
|
126
|
-
} & Omit<CodeFrameOptions, "message | prefix">;
|
|
127
|
-
export { Options$1 as O, VisulimaError as V };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";const Q=K(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[r,t]=b.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return b.getBuiltinModule(e)}return Q(e)},{createRequire:_}=X("node:module"),Z=globalThis.process??Object.create(null),L={versions:{}},A=new Proxy(Z,{get(e,r){if(r in e)return e[r];if(r in L)return L[r]}}),ee=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
-
`),re=(e,r,t,n)=>{const s={column:0,line:-1,...e.start},i={...s,...e.end},o=s.line,d=s.column,l=i.line,c=i.column;let a=Math.max(o-(t+1),0),m=Math.min(r.length,l+n);o===-1&&(a=0),l===-1&&(m=r.length);const p=l-o,f={};if(p)for(let u=0;u<=p;u++){const h=u+o;if(!d)f[h]=!0;else if(u===0){const v=r[h-1]?.length;f[h]=[d,(v??0)-d+1]}else if(u===p)f[h]=[0,c];else{const v=r[h-u]?.length;f[h]=[0,v]}}else d===c?f[o]=d?[d,0]:!0:f[o]=[d,(c??0)-(d??0)];return{end:m,markerLines:f,start:a}},te=A.platform==="win32"&&!A.env?.WT_SESSION?">":"❯",ne=(e,r,t)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:u=>u,marker:u=>u,message:u=>u,...t?.color}},s=typeof r.start.column=="number";let i=(e.includes("\r")?ee(e):e).split(`
|
|
3
|
-
`);typeof n.tabWidth=="number"&&e.includes(" ")&&(i=i.map(u=>u.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:d,start:l}=re(r,i,n.linesAbove,n.linesBelow),c=String(o).length,{gutter:a,marker:m,message:p}=n.color;let f=i.slice(l,o).map((u,h)=>{const v=l+1+h,E=d[v],z=String(v).padStart(c),D=!d[v+1],N=` ${z}${n.showGutter?" |":""}`;if(E){let k="";if(Array.isArray(E)){const Y=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(E[0]-1,0)),H=E[1]||1;k=[`
|
|
4
|
-
`,n.prefix+a(N.replaceAll(/\d/g," "))," ",Y,m("^").repeat(H)].join(""),D&&n.message&&(k+=` ${p(n.message)}`)}return[n.prefix+m(te),a(N),u.length>0?` ${u}`:"",k].join("")}return`${n.prefix} ${a(N)}${u.length>0?` ${u}`:""}`}).join(`
|
|
5
|
-
`);return n.message&&!s&&(f=`${n.prefix+" ".repeat(c+1)+n.message}
|
|
6
|
-
${f}`),f},S=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&S.set("AggregateError",AggregateError);const ze=(e,r)=>{let t;try{t=new e}catch(s){throw new Error(`The error constructor "${e.name}" is not compatible`,{cause:s})}const n=r??t.name;if(S.has(n))throw new Error(`The error constructor "${n}" is already known.`);S.set(n,e)},ie=e=>S.get(e),De=e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(ie(e.name)!==void 0||e.name==="Error"),oe=_(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,se=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[r,t]=x.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return x.getBuiltinModule(e)}return oe(e)},{inspect:le}=se("node:util"),Ye=e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${le(e)}`);break}if(t.push(n),r.add(n),typeof n!="object"||!("cause"in n))break;n=n.cause}return t},ae=()=>A.env?.DEBUG==="true",$=(e,...r)=>{if(ae()){const t=r.map(n=>typeof n=="function"?n():n);console.debug(`error:parse-stacktrace: ${e}`,...t)}},g="<unknown>",ce=/^(?:node:internal\/|node:|internal\/)/,de=e=>e!==void 0&&ce.test(e),ue=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fe=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,me=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,pe=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,he=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,ve=/in\s(.*)\s\(at\s(.+)\)\sat/,$e=/^(?:.*@)?(.*):(\d+):(\d+)$/,ge=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ye=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,we=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,j=/\(error: ([^)]*)\)/,be=/at\s/,xe=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Ee=/Error: |AggregateError:/,C=/^Anonymous function$/,Se=/^\s*in\s.*/,Ne=/^.*?\s*at\s.*/,ke=/^.*?\s*@.*|\[native code\]/,R=(e,r)=>{const t=e.includes("safari-extension"),n=e.includes("safari-web-extension");return t||n?[e.includes("@")?e.split("@")[0]:g,t?`safari-extension:${r}`:`safari-web-extension:${r}`]:[e,r]},B=(e,r)=>{const t=me.exec(r);t&&(e.file=t[1],e.line=+t[2],e.column=+t[3])},Ae=e=>{const r=ve.exec(e);if(r){$(`parse nested node error stack line: "${e}"`,()=>`found: ${JSON.stringify(r)}`);const n=r[2].split(":");return{column:n[2]?+n[2]:void 0,file:n[0],line:n[1]?+n[1]:void 0,methodName:r[1]??g,raw:e,type:void 0}}const t=he.exec(e);if(t){$(`parse node error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const n={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(be,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]??g,raw:e,type:e.startsWith("internal")?"internal":void 0};return B(n,`${t[2]}:${t[3]}:${t[4]}`),n}},Me=e=>{const r=ue.exec(e);if(r){$(`parse chrome error stack line: "${e}"`,()=>`found: ${JSON.stringify(r)}`);const t=r[2]?.startsWith("native"),n=r[2]?.startsWith("eval")||r[1]?.startsWith("eval");let s,i;if(n){const c=fe.exec(e);if(c){const a=xe.exec(c[1]);a?(r[2]=a[4]??a[1],r[3]=a[5]??a[2],r[4]=a[3]):c[2]&&(r[2]=c[1]),c[2]&&(s={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const a=pe.exec(e);a&&(i={column:a[4]?+a[4]:void 0,file:a[2],line:a[3]?+a[3]:void 0},s={column:a[6]?+a[6]:void 0,file:a[1],line:a[5]?+a[5]:void 0,methodName:"eval",raw:a[0],type:"eval"})}}const[o,d]=R(r[1]?r[1].replace(C,"<anonymous>"):g,r[2]),l={column:r[4]?+r[4]:void 0,evalOrigin:s,file:d,line:r[3]?+r[3]:void 0,methodName:o,raw:e,type:n?"eval":t?"native":de(d)?"internal":void 0};return i?(l.column=i.column,l.file=i.file,l.line=i.line):B(l,`${d}:${r[3]}:${r[4]}`),l}},Te=(e,r)=>{const t=ge.exec(e);if(t){$(`parse gecko error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const n=t[3]?.includes(" > eval"),s=n&&t[3]&&ye.exec(t[3]);let i;n&&s&&(t[3]=s[1],i={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:e,type:"eval"},t[4]=s[2]);const[o,d]=R(t[1]?t[1].replace(C,"<anonymous>"):g,t[3]);let l;(r?.type==="safari"||!n&&r?.type==="firefox")&&r.column?l=r.column:!n&&t[5]&&(l=+t[5]);let c;return(r?.type==="safari"||!n&&r?.type==="firefox")&&r.line?c=r.line:t[4]&&(c=+t[4]),{column:l,evalOrigin:i,file:d,line:c,methodName:o,raw:e,type:n?"eval":d.includes("[native code]")?"native":void 0}}},Le=(e,r)=>{const t=we.exec(e);if(!(t&&t[2].includes(" > eval"))&&t)return $(`parse firefox error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:r?.column??void 0,file:t[2],line:t[3]?+t[3]:r?.line??void 0,methodName:t[1]||g,raw:e,type:void 0}},je=e=>{const r=$e.exec(e);if(r)return $(`parse react android native error stack line: "${e}"`,()=>`found: ${JSON.stringify(r)}`),{column:r[3]?+r[3]:void 0,file:r[1],line:r[2]?+r[2]:void 0,methodName:g,raw:e,type:void 0}},We=/(?:^|[(@\s])(?:node:internal\/|node:|internal\/)/,_e=/node_modules[/\\]/,He={internals:e=>!We.test(e),nodeModules:e=>!_e.test(e)},Ke=(...e)=>r=>e.every(t=>t(r)),O=(e,{filter:r,frameLimit:t=50}={})=>{const n=e;let s=(typeof n.stacktrace=="string"?n.stacktrace:e.stack??"").split(`
|
|
7
|
-
`).map(i=>(j.test(i)?i.replace(j,"$1"):i).trim()).filter(i=>!Ee.test(i)&&i!=="eval code");return r&&(s=s.filter(i=>r(i))),s=s.slice(0,t),s.reduce((i,o,d)=>{if(!o||o.length>1024)return i;let l;if(Se.test(o))l=Ae(o);else if(Ne.test(o))l=Me(o);else if(ke.test(o)){let c;if(d===0){const a=e,m=a.columnNumber,p=a.lineNumber,f=a.line,u=a.column;m||p?c={column:m,line:p,type:"firefox"}:(f||u)&&(c={column:u,line:f,type:"safari"})}l=Le(o,c)??Te(o,c)}else l=je(o);return l?i.push(l):$(`parse error stack line: "${o}"`,"not parser found"),i},[])},Ce=_(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,t]=w.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return w.getBuiltinModule(e)}return Ce(e)},{existsSync:Re,readFileSync:Be}=M("node:fs"),{relative:Oe,resolve:W,sep:Ie}=M("node:path"),{cwd:Pe}=w,{fileURLToPath:Ve}=M("node:url"),y=(e,r,t)=>t===0?e:r===" "?e+" ".repeat(t):e+" ".repeat(r*t),I=e=>e.replaceAll("\\","/"),Ge=(e,r)=>{const t=e.replace("async file:","file:");return I(Oe(r,t.startsWith("file:")?Ve(t):t))},Je=(e,r,t)=>{if(r)return t.title(e.message);const n=e.message?`: ${e.message}`:"";return t.title(e.name+n)},P=(e,{color:r,hideErrorTitle:t,indentation:n,prefix:s},i)=>`${y(s,n,i)}${Je(e,t,r)}
|
|
8
|
-
`,V=(e,{color:r,indentation:t,prefix:n},s)=>{if(e.hint===void 0)return;const i=y(n,t,s);let o="";if(Array.isArray(e.hint))for(const d of e.hint)o+=`${i+d}
|
|
9
|
-
`;else o+=i+e.hint;return r.hint(o)},G=(e,r)=>{if(!r||e.file===void 0||e.line===void 0)return{trace:e};try{const t=r({column:e.column,file:e.file,line:e.line});return t?{source:t.source,trace:{...e,column:t.column??e.column,file:t.file??e.file,line:t.line??e.line}}:{trace:e}}catch{return{trace:e}}},T=(e,r,t=0)=>{const{color:n,cwd:s,displayShortPath:i,indentation:o,prefix:d}=r,{trace:l}=G(e,r.sourceMap),c=i?Ge(l.file,s):I(l.file),{fileLine:a,method:m}=n;return`${y(d,o,t)}at ${l.methodName?`${m(l.methodName)} `:""}${a(c)}:${a(l.line?.toString()??"")}`},qe=(e,r)=>{if(r.allowAllFilePaths)return!0;const t=W(r.cwd),n=W(t,e);return n===t||n.startsWith(t+Ie)},J=(e,r,t)=>{const{color:n,indentation:s,linesAbove:i,linesBelow:o,prefix:d,showGutter:l,showLineNumbers:c,tabWidth:a}=r,{source:m,trace:p}=G(e,r.sourceMap);if(p.file===void 0)return;let f;if(m===void 0){const u=p.file.replace("file://","");if(!qe(u,r)||!Re(u))return;f=Be(u,"utf8")}else f=m;return ne(f,{start:{column:p.column,line:p.line}},{color:n,linesAbove:i,linesBelow:o,prefix:y(d,s,t),showGutter:l,showLineNumbers:c,tabWidth:a})},q=(e,r,t)=>{if(e.errors.length===0)return;let n=`${y(r.prefix,r.indentation,t)}Errors:
|
|
10
|
-
|
|
11
|
-
`,s=!0;for(const i of e.errors)s?s=!1:n+=`
|
|
12
|
-
|
|
13
|
-
`,n+=U(i,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},t+1);return`
|
|
14
|
-
${n}`},F=(e,r,t,n=new Set)=>{n.add(e);let s=`${y(r.prefix,r.indentation,t)}Caused by:
|
|
15
|
-
|
|
16
|
-
`;const i=e.cause;s+=P(i,r,t);const o=O(i).shift(),d=V(i,r,t);if(d&&(s+=`${d}
|
|
17
|
-
`),o&&(s+=T(o,r,t),!r.hideErrorCauseCodeView)){const l=J(o,r,t);l!==void 0&&(s+=`
|
|
18
|
-
${l}`)}if(i instanceof AggregateError){const l=q(i,r,t);l!==void 0&&(s+=`
|
|
19
|
-
${l}`)}return i.cause&&(s+=n.has(i)?`
|
|
20
|
-
${y(r.prefix,r.indentation,t+1)}Caused by: [Circular]`:`
|
|
21
|
-
${F(i,r,t+1,n)}`),`
|
|
22
|
-
${s}`},Fe=(e,r)=>(e.length>0?`
|
|
23
|
-
`:"")+e.map(t=>T(t,r)).join(`
|
|
24
|
-
`),U=(e,r,t)=>{const n={allowAllFilePaths:!1,cwd:Pe(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...r,color:{fileLine:o=>o,gutter:o=>o,hint:o=>o,marker:o=>o,message:o=>o,method:o=>o,title:o=>o,...r.color}},s=O(e,{filter:r.filterStacktrace,frameLimit:n.framesMaxLimit}),i=s.shift();return[r.hideMessage?void 0:P(e,n,t),V(e,n,t),i?T(i,n,t):void 0,i&&!n.hideErrorCodeView?J(i,n,t):void 0,e instanceof AggregateError?q(e,n,t):void 0,e.cause===void 0?void 0:F(e,n,t),s.length>0?Fe(s,n):void 0].filter(Boolean).join(`
|
|
25
|
-
`)},Qe=(e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return U(e,r,0)};export{He as R,te as S,Qe as U,ne as W,Ke as X,O as Y,Ye as c,De as g,ie as n,ze as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const n=s=>"Deno"in s,l=s=>"Bun"in s,i=()=>{if(n(globalThis)){const s=globalThis.Deno,e=s.execPath();let o=e;try{const{importMeta:r}=globalThis;r?.url&&(o=r.url)}catch{}return[e,o,...s.args]}return l(globalThis)?globalThis.Bun.process.argv:process.argv},t=()=>n(globalThis)?globalThis.Deno.cwd():l(globalThis)?globalThis.Bun.process.cwd():process.cwd(),a=()=>{if(n(globalThis)){const s=globalThis.Deno;return new Proxy(s.env.toObject(),{get:(e,o)=>typeof o=="string"?s.env.get(o):e[o],has:(e,o)=>typeof o=="string"?s.env.has(o):o in e,set:(e,o,r)=>typeof o=="string"?(r===void 0||s.env.set(o,r),!0):!1})}return l(globalThis)?globalThis.Bun.process.env:process.env},c=()=>n(globalThis)?[]:l(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,g=()=>n(globalThis)?globalThis.Deno.execPath():l(globalThis)?globalThis.Bun.process.execPath:process.execPath,h=()=>{if(n(globalThis)){const s=globalThis.Deno.build?.os??"unknown";return s==="windows"?"win32":s}return l(globalThis)?globalThis.Bun.platform??"unknown":process.platform},b=()=>{if(n(globalThis)){const s=globalThis.Deno.build?.arch??"unknown";return s==="x86_64"?"x64":s==="aarch64"?"arm64":s}return l(globalThis)?globalThis.Bun.process.arch:process.arch},T=()=>{if(n(globalThis)){const s=globalThis.Deno,e={};return s.version?.deno&&(e.deno=s.version.deno),s.version?.v8&&(e.v8=s.version.v8),s.version?.typescript&&(e.typescript=s.version.typescript),e}if(l(globalThis)){const s=globalThis.Bun,e={...s.process.versions};return s.version&&(e.bun=s.version),e}return process.versions},u=(s=0)=>{if(n(globalThis))throw globalThis.Deno.exit(s),new Error("Deno exit failed");if(l(globalThis))throw globalThis.Bun.process.exit(s),new Error("Bun exit failed");process.exit(s)},p=(s,e)=>{if(n(globalThis))return()=>{};if(l(globalThis)){try{const r=globalThis.Bun;if(r.process?.on)return r.process.on(s,e),()=>{r.process?.removeListener&&r.process.removeListener(s,e)}}catch{}return()=>{}}const o=process;return o.on(s,e),()=>{o.removeListener(s,e)}};export{h as a,b,a as c,i as d,u as e,t as f,T as g,g as h,c as i,p as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as J}from"node:module";const Q=J(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[t,a]=W.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return W.getBuiltinModule(e)}return Q(e)},{createRequire:Y}=X("node:module"),H=String.raw,T=H`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ee=()=>new RegExp(H`\p{RI}{2}|(?)${T}(?:\u200D${T})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Be=/^[ \t]*(?:\r\n|\r|\n)/,_e=/(?:\r\n|\r|\n)[ \t]*$/,ve=/^(?:[\r\n]|$)/,Te=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,Fe=/^[ \t]*[\r\n][ \t\r\n]*$/,ze=/\r\n|\n|\r/g,Me=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Ie=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,m=ee(),te=/[-_./\s]+/g,$=/(\u001B\[[0-9;]*[a-z])/i,F=new RegExp("\\p{Script=Arabic}","u"),se=new RegExp("\\p{Script=Bengali}","u"),b=new RegExp("\\p{Script=Cyrillic}","u"),ne=new RegExp("\\p{Script=Devanagari}","u"),re=new RegExp("\\p{Script=Ethiopic}","u"),j=new RegExp("\\p{Script=Greek}","u"),z=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ie=new RegExp("\\p{Script=Gujarati}","u"),le=new RegExp("\\p{Script=Gurmukhi}","u"),M=new RegExp("\\p{Script=Hangul}","u"),I=new RegExp("\\p{Script=Hebrew}","u"),oe=new RegExp("\\p{Script=Hiragana}","u"),O=new RegExp("\\p{Script=Han}","u"),ce=new RegExp("\\p{Script=Kannada}","u"),ae=new RegExp("\\p{Script=Katakana}","u"),pe=new RegExp("\\p{Script=Khmer}","u"),ue=new RegExp("\\p{Script=Lao}","u"),S=new RegExp("\\p{Script=Latin}","u"),he=new RegExp("\\p{Script=Malayalam}","u"),fe=new RegExp("\\p{Script=Myanmar}","u"),ge=new RegExp("\\p{Script=Oriya}","u"),de=new RegExp("\\p{Script=Sinhala}","u"),xe=new RegExp("\\p{Script=Tamil}","u"),we=new RegExp("\\p{Script=Telugu}","u"),Ee=new RegExp("\\p{Script=Thai}","u"),ke=new RegExp("\\p{Script=Tibetan}","u"),q=/[\u02BB\u02BC\u0027]/u,Se=e=>e.replace(m,"");class Re{capacity;cache;constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const a=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,a),a}has(t){return this.cache.has(t)}set(t,a){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const f=this.cache.keys().next().value;f!==void 0&&this.cache.delete(f)}this.cache.set(t,a)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}}const Ce=Y(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,a]=y.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return y.getBuiltinModule(e)}return Ce(e)},{stripVTControlCharacters:Ue}=Le("node:util"),A=new Re(1e3),me=/[.*+?^${}()|[\]\\]/g,be=e=>{const t=e.join("");if(A.has(t)){const d=A.get(t);return d.lastIndex=0,d}const a=e.map(d=>d.replaceAll(me,String.raw`\$&`)).join("|"),f=new RegExp(a,"g");return A.set(t,f),f},We=e=>{const t=[];let a=0,f;for(m.lastIndex=0;(f=m.exec(e))!==null;)f.index>a&&t.push(e.slice(a,f.index)),t.push(f[0]),a=m.lastIndex;return a<e.length&&t.push(e.slice(a)),t.filter(Boolean)},ye=/[ČŠŽĐ]/i,P=new Uint8Array(128),D=new Uint8Array(128),K=new Uint8Array(128);for(let e=0;e<128;e++)P[e]=e>=65&&e<=90?1:0,D[e]=e>=97&&e<=122?1:0,K[e]=e>=48&&e<=57?1:0;const B=e=>P[e],G=e=>D[e],_=e=>K[e],U=(e,t,a,f,d)=>{if(e.length===0)return[];let h=!1;const k=Object.values(t);for(const i of k)if(i(e[0])){h=!0;break}if(!h&&!a)return[e];const g=[...e],w=[];let n=g[0],l="other";const p=Object.entries(t);for(const i of p){const[r,c]=i;if(c(g[0])){l=r;break}}let s=a&&f?g[0]===g[0].toLocaleUpperCase(f):!1;for(let i=1;i<g.length;i++){const r=g[i];let c="other";for(const x of p){const[E,R]=x;if(R(r)){c=E;break}}const u=a&&f?r===r.toLocaleUpperCase(f):!1;let o=!1;d?o=d(l,c,s,u,r,i,g):(l!==c&&l!=="other"&&c!=="other"&&(o=!0),a&&c!=="other"&&!s&&u&&(o=!0)),o?(w.push(n),n=r):n+=r,l=c,a&&(s=u)}return n&&n.length>0&&w.push(n),w.length>0?w:[e]},$e=(e,t,a,f)=>{if(a.size===0)return t;for(const d of a)if(e.startsWith(d,t))return f.push(d),t+d.length;return t},N=(e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let a=0;const f=[],d=e.length;for(let h=1;h<d;h++){const k=$e(e,a,t,f);if(k!==a){a=k,h=a-1;continue}const g=e.codePointAt(h-1),w=e.codePointAt(h),n=g&&g<128&&B(g),l=w&&w<128&&B(w),p=g&&g<128&&G(g),s=g&&g<128&&_(g),i=w&&w<128&&_(w);if(p&&l){f.push(e.slice(a,h)),a=h;continue}if(s&&!i||!s&&i){f.push(e.slice(a,h)),a=h;continue}if(i&&!s){let r=!1,c=!1;if(h+1<d){const u=e.codePointAt(h+1);r=u&&u<128&&B(u),c=u&&u<128&&_(u)}if(!c&&r){f.push(e.slice(a,h),e.slice(h,h+1)),a=h+1;continue}}if(h+1<d){const r=e.codePointAt(h+1),c=r&&r<128&&G(r);if(n&&l&&c){const u=e.slice(a,h+1);t.has(u)||(f.push(e.slice(a,h)),a=h)}}}return a<d&&f.push(e.slice(a)),f.filter(h=>h!=="")},V=(e,t,a)=>{if(e.length===0)return[];const f=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!f&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t),r=i,c=i?0:-1;for(let u=1;u<l;u++){const o=n[u],x=o===o.toLocaleUpperCase(t);if(x===i)s+=o;else if(x)s&&s.length>0&&(p.push(s),s=o),r=!0,c=u;else{if(r&&u-c>1){const E=n[u-1],R=s.slice(0,-1);R&&R.length>0&&p.push(R),s=E+o}else s+=o;r=!1,c=-1}i=x}return s&&s.length>0&&p.push(s),p}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!b.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,p=[];let s=n[0];const i=n[0];let r;b.test(i)?r=1:S.test(i)?r=2:r=0;let c=i===i.toLocaleUpperCase(t);for(let o=1;o<l;o++){const x=n[o];let E;b.test(x)?E=1:S.test(x)?E=2:E=0;const R=x===x.toLocaleUpperCase(t);r!==E&&(r===1||r===2)&&(E===1||E===2)||E===r&&!c&&R?(p.push(s),s=x):s+=x,r=E,c=R}s&&s.length>0&&p.push(s);const u=[];for(let o=0;o<p.length;o++)o<p.length-1&&p[o].length===1&&S.test(p[o])&&b.test(p[o+1][0])?(u.push(p[o]+p[o+1]),o+=1):u.push(p[o]);return u}if(t.startsWith("el")){if(!j.test(e)&&!S.test(e))return[e];const n=[];z.lastIndex=0;let l;for(;(l=z.exec(e))!==null;)n.push(l[0]);n.length===0&&n.push(e);const p=[];if(n.length===1){const s=n[0];if(!s||!j.test(s[0])||s.length===1)return[s??e]}for(const s of n){if(!s)continue;if(!j.test(s[0])||s.length===1){p.push(s);continue}const i=s.length;let r=s[0],c=s[0]===s[0].toLocaleUpperCase(t);for(let u=1;u<i;u++){const o=s[u],x=o===o.toLocaleUpperCase(t);!c&&x?(p.push(r),r=o):r+=o,c=x}r&&p.push(r)}return p}if(t.startsWith("ja")||t.startsWith("ko")){const n=t.startsWith("ja"),l=n?{hiragana:s=>oe.test(s),kanji:s=>O.test(s),katakana:s=>ae.test(s),latin:s=>S.test(s)}:{hangul:s=>M.test(s),latin:s=>S.test(s)},p=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(n){const s=U(e,l,!1,t,(r,c)=>r==="hiragana"&&c==="katakana"||r==="katakana"&&c==="hiragana"||r==="hiragana"&&c==="latin"||r==="katakana"&&c==="latin"||r==="kanji"&&c==="latin"||r==="latin"&&(c==="hiragana"||c==="katakana"||c==="kanji")),i=[];for(const r of s){const c=r;c.length===1&&p.has(c)&&i.length>0?i[i.length-1]=i.at(-1)+c:i.push(c)}return i.length>0?i:[e]}return U(e,l,!1,t,(s,i)=>s==="hangul"&&i==="latin"||s==="latin"&&i==="hangul")}if(t.startsWith("sl")){const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t);for(let r=1;r<l;r++){const c=n[r],u=c===c.toLocaleUpperCase(t),o=ye.test(c),x=r<l-1&&n[r+1]===n[r+1].toLocaleUpperCase(t);!i&&u||o&&x?(p.push(s),s=c,o&&x&&(p.push(s),s="")):s+=c,i=u}return s&&s.length>0&&p.push(s),p}if(t.startsWith("zh"))return U(e,{han:n=>O.test(n),latin:n=>S.test(n)},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const n=l=>I.test(l)||F.test(l);return U(e,{latin:l=>S.test(l),rtl:l=>n(l)},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const n=l=>ne.test(l)||se.test(l)||ie.test(l)||le.test(l)||ce.test(l)||xe.test(l)||we.test(l)||he.test(l)||de.test(l)||Ee.test(l)||ue.test(l)||ke.test(l)||fe.test(l)||re.test(l)||pe.test(l)||ge.test(l);return U(e,{indic:l=>n(l),latin:l=>S.test(l)},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return U(e,{cyrillic:n=>b.test(n),latin:n=>S.test(n)},!0,t);if(["ar","fa","he"].includes(t))return U(e,{latin:n=>S.test(n),rtl:n=>I.test(n)||F.test(n)},!1,t);if(t.startsWith("ko"))return U(e,{hangul:n=>M.test(n),latin:n=>S.test(n)},!1,t);if(t.startsWith("uz")){if(!b.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t);for(let r=1;r<l;r++){const c=n[r],u=c===c.toLocaleUpperCase(t);if(q.test(c)||q.test(n[r-1])){s+=c;continue}!i&&u?(p.push(s),s=c):s+=c,i=u}return s&&s.length>0&&p.push(s),p}const d=[...e],h=d.length,k=[];let g=d[0],w=d[0]===d[0].toLocaleUpperCase(t);for(const n of a)if(e.startsWith(n)){k.push(n),g=d[n.length],w=g===g.toLocaleUpperCase(t);break}for(let n=1;n<h;n++){const l=d[n],p=l===l.toLocaleUpperCase(t);let s=0;for(const i of a)if(e.startsWith(i,n)){k.push(g,i),s=i.length,g="";const r=i.at(-1);r&&(w=r===r.toLocaleUpperCase(t));break}if(s>0){n+=s-1;continue}!w&&p?(k.push(g),g=l):g+=l,w=p}return g&&k.push(g),k},je=(e,t,a)=>{const f=[],d=$.test(e)?e.split($).filter(Boolean):[e];for(const h of d){const k=h;if($.test(k))f.push(k);else{m.lastIndex=0;const g=m.test(k)?We(k).filter(Boolean):[k];for(const w of g)if(m.lastIndex=0,m.test(w))f.push(w);else if(t){const n=t.toLowerCase().split("-")[0];f.push(...V(w,n,a))}else f.push(...N(w,a))}}return f},Oe=(e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:a=!1,handleEmoji:f=!1,knownAcronyms:d=[],locale:h,normalize:k=!1,separators:g,stripAnsi:w=!1,stripEmoji:n=!1}=t,l=new Set([...d].toSorted((o,x)=>x.length-o.length));let p=e;w&&(p=Ue(p)),n&&(p=Se(p));let s;Array.isArray(g)?s=be(g):g instanceof RegExp?s=g:s=te;const i=[];let r=p;const c=s.flags.includes("g")?s:new RegExp(s.source,`${s.flags}g`);for(;r.length>0;){const o=c.exec(r);if(!o){r===".."?i.push(".."):r==="."?i.push("."):r.length>0&&i.push(r);break}const x=o.index,E=o[0],R=E.length,v=r.slice(0,x),Z=r.slice(x+R);if(E.startsWith("../"))i.push(".."),r=r.slice(x+3);else if(E.startsWith("./"))i.push("."),r=r.slice(x+2);else if(x===0&&E==="..")i.push(".."),r=r.slice(2);else if(x===0&&E===".")i.push("."),r=r.slice(1);else{v.length>0&&i.push(v);let C=0;for(;(C=E.indexOf("../",C))!==-1;)i.push(".."),C+=3;for(C=0;(C=E.indexOf("./",C))!==-1;)(C===0||E[C-1]!==".")&&i.push("."),C+=2;let L=Z;for(;L.startsWith("../");)i.push(".."),L=L.slice(3);for(;L.startsWith("./");)i.push("."),L=L.slice(2);if(L===".."){i.push("..");break}else if(L==="."){i.push(".");break}else r=L}c.lastIndex=0}if(i.length===0){const o=p.split(s).filter(Boolean);i.push(...o)}let u=[];for(const o of i)a||f?u.push(...je(o,h,l)):h?u.push(...V(o,h,l)):u.push(...N(o,l));return k&&(u=u.map(o=>l.has(o)?o:h&&o===o.toLocaleUpperCase(h)?o[0]+o.slice(1).toLocaleLowerCase(h):o.toUpperCase()===o&&!l.has(o)?o.slice(0,1)+o.slice(1).toLowerCase():o)),u};export{Oe as A,ve as B,Te as F,_e as R,Me as d,$ as k,Fe as l,ze as m,m as n,Be as x,Ie as y};
|