@visulima/fs 1.11.1 → 2.0.0

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 CHANGED
@@ -1,3 +1,16 @@
1
+ ## @visulima/fs [2.0.0](https://github.com/visulima/visulima/compare/@visulima/fs@1.11.1...@visulima/fs@2.0.0) (2024-03-23)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * **fs:** moved node:path to pathe and changed NotFoundError message
7
+
8
+ Signed-off-by: prisis <d.bannert@anolilab.de>
9
+
10
+ ### Features
11
+
12
+ * **fs:** moved node:path to pathe, changed NotFoundError message ([0557a18](https://github.com/visulima/visulima/commit/0557a18d97af6061ba9cb1581c420c2bc72965ef))
13
+
1
14
  ## @visulima/fs [1.11.1](https://github.com/visulima/visulima/compare/@visulima/fs@1.11.0...@visulima/fs@1.11.1) (2024-03-22)
2
15
 
3
16
 
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var e=class extends Error{root;constructor(r,o){super(`${r instanceof Error?r.message:r} for path "${o}"`),this.cause=r,this.root=o;}get name(){return "WalkError"}set name(r){throw new Error("Cannot overwrite name of WalkError")}},s=e;var t=class extends Error{constructor(r){super(`EPERM: Operation not permitted, ${r}`);}get code(){return "EPERM"}set code(r){throw new Error("Cannot overwrite code EPERM")}get name(){return "PermissionError"}set name(r){throw new Error("Cannot overwrite name of PermissionError")}},u=t;
4
+
5
+ exports.a = s;
6
+ exports.b = u;
7
+ //# sourceMappingURL=out.js.map
8
+ //# sourceMappingURL=chunk-JSJNX53G.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/error/walk-error.ts","../src/error/permission-error.ts"],"names":["WalkError","cause","root","_name","walk_error_default","PermissionError","message","permission_error_default"],"mappings":"AAMA,IAAMA,EAAN,cAAwB,KAAM,CAEnB,KAGA,YAAYC,EAAgBC,EAAc,CAE7C,MAAM,GAAGD,aAAiB,MAAQA,EAAM,QAAUA,CAAK,cAAcC,CAAI,GAAG,EAE5E,KAAK,MAAQD,EACb,KAAK,KAAOC,CAChB,CAGA,IAAoB,MAAe,CAC/B,MAAO,WACX,CAGA,IAAoB,KAAKC,EAAO,CAC5B,MAAM,IAAI,MAAM,oCAAoC,CACxD,CACJ,EAEOC,EAAQJ,EC3Bf,IAAMK,EAAN,cAA8B,KAAM,CAKzB,YAAYC,EAAiB,CAChC,MAAM,mCAAmCA,CAAO,EAAE,CACtD,CAGA,IAAW,MAAe,CACtB,MAAO,OACX,CAGA,IAAW,KAAKH,EAAO,CACnB,MAAM,IAAI,MAAM,6BAA6B,CACjD,CAGA,IAAoB,MAAe,CAC/B,MAAO,iBACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEOI,EAAQF","sourcesContent":["// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.\n// Documentation and interface for walk were adapted from Go\n// https://golang.org/pkg/path/filepath/#Walk\n// Copyright 2009 The Go Authors. All rights reserved. BSD license.\n\n/** Error thrown in {@linkcode walk} or {@linkcode walkSync} during iteration. */\nclass WalkError extends Error {\n /** File path of the root that's being walked. */\n public root: string;\n\n /** Constructs a new instance. */\n public constructor(cause: unknown, root: string) {\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n super(`${cause instanceof Error ? cause.message : cause} for path \"${root}\"`);\n\n this.cause = cause;\n this.root = root;\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"WalkError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of WalkError\");\n }\n}\n\nexport default WalkError;\n","/**\n * Error thrown when an operation is not permitted.\n */\nclass PermissionError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EPERM: Operation not permitted, ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"EPERM\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code EPERM\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"PermissionError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of PermissionError\");\n }\n}\n\nexport default PermissionError;\n"]}
@@ -0,0 +1,13 @@
1
+ import { a } from './chunk-UPN3Y5W3.js';
2
+ import { fileURLToPath } from 'node:url';
3
+
4
+ var R=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},Q=R;var N=e=>e instanceof URL?fileURLToPath(e):e,ee=N;var P=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
5
+ `),U=P,j=globalThis.process||Object.create(null),T={versions:{}},B=new Proxy(j,{get(e,t){if(t in e)return e[t];if(t in T)return T[t]}}),$=B,M=(e,t,o,n)=>{let r={column:0,line:-1,...e.start},s={...r,...e.end},a=r.line,l=r.column,f=s.line,p=s.column,c=Math.max(a-(o+1),0),d=Math.min(t.length,f+n);a===-1&&(c=0),f===-1&&(d=t.length);let y=f-a,m={};if(y)for(let i=0;i<=y;i++){let u=i+a;if(!l)m[u]=!0;else if(i===0){let g=t[u-1]?.length;m[u]=[l,(g??0)-l+1];}else if(i===y)m[u]=[0,p];else {let g=t[u-i]?.length;m[u]=[0,g];}}else l===p?m[a]=l?[l,0]:!0:m[a]=[l,(p??0)-(l??0)];return {end:d,markerLines:m,start:c}},W=M,v=$.platform==="win32"&&!$.env?.WT_SESSION?">":"\u276F",C=(e,t,o)=>{let n={linesAbove:2,linesBelow:3,showGutter:!0,showLineNumbers:!0,tabWidth:4,...o,color:{gutter:i=>i,marker:i=>i,message:i=>i,...o?.color}},r=t.start&&typeof t.start.column=="number",s=U(e).split(`
6
+ `);typeof n?.tabWidth=="number"&&(s=s.map(i=>i.replaceAll(" "," ".repeat(n.tabWidth))));let{end:a,markerLines:l,start:f}=W(t,s,n.linesAbove,n.linesBelow),p=String(a).length,{gutter:c,marker:d,message:y}=n.color,m=s.slice(f,a).map((i,u)=>{let g=f+1+u,x=l[g],J=` ${g}`.slice(-p),k=!l[g+1],F=` ${J}${n.showGutter?" |":""}`;if(x){let A="";if(Array.isArray(x)){let S=i.replaceAll(/[^\t]/g," ").slice(0,Math.max(x[0]-1,0)),O=x[1]||1;A=[`
7
+ `,c(F.replaceAll(/\d/g," "))," ",S,d("^").repeat(O)].join(""),k&&n.message&&(A+=` ${y(n.message)}`);}return [d(v),c(F),i.length>0?` ${i}`:"",A].join("")}return ` ${c(F)}${i.length>0?` ${i}`:""}`}).join(`
8
+ `);return n.message&&!r&&(m=`${" ".repeat(p+1)}${n.message}
9
+ ${m}`),m};var L=(e,t)=>{let o=0,n=t.length-2;for(;o<n;){let r=o+(n-o>>1);if(e<t[r])n=r-1;else if(e>=t[r+1])o=r+1;else {o=r;break}}return o},_=e=>e.split(/\n|\r(?!\n)/).reduce((t,o)=>(t.push(t.at(-1)+o.length+1),t),[0]),q=(e,t,o)=>{let n=o?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return {column:0,line:0};if(!n&&(typeof t!="number"||typeof e=="string"&&t>=e.length||Array.isArray(e)&&t+1>=e.at(-1)))return {column:0,line:0};if(typeof e=="string"){let s=_(e),a=L(t,s);return {column:t-s[a]+1,line:a+1}}let r=L(t,e);return {column:t-e[r]+1,line:r+1}},E=q;var G=e=>`\\u{${e.codePointAt(0).toString(16)}}`,I=(e,t,o)=>C(e,{start:t},{tabWidth:!1,...o}),z=(e,t)=>{let o=/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(t);if(!o)return;let{column:n,index:r,line:s}=o.groups;return s&&n?{column:Number(n),line:Number(s)}:(r=Number(r),r===e.length&&(r=e.length-1),E(e,r))},D=e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,o,n)=>`"${n}"(${G(n)})`);function H(e,t,o,n){typeof t=="string"&&(typeof o=="object"&&(n=o),o=t,t=void 0);let r;try{return JSON.parse(e,t)}catch(l){r=l.message;}let s;e?(s=z(e,r),r=D(r)):r+=" while parsing empty string";let a$1=new a(r);throw a$1.fileName=o,s&&(a$1.codeFrame=I(e,s,n)),a$1}var ue=H;var K=e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},pe=K;
10
+
11
+ export { Q as a, ee as b, ue as c, pe as d };
12
+ //# sourceMappingURL=out.js.map
13
+ //# sourceMappingURL=chunk-LMCWM2WT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/assert-valid-file-or-directory-path.ts","../src/utils/to-path.ts","../../error/src/util/normalize-lf.ts","../../error/src/util/process.ts","../../error/src/code-frame/get-marker-lines.ts","../../error/src/code-frame/index.ts","../src/utils/parse-json.ts","../src/utils/assert-valid-file-contents.ts"],"names":["assertValidFileOrDirectoryPath","fileOrDirectoryPath","assert_valid_file_or_directory_path_default","fileURLToPath","toPath","urlOrPath","to_path_default","normalizeLF","code","normalize_lf_default","_process","processShims","process","target","property","process_default","getMarkerLines","loc","source","linesAbove","linesBelow","startLoc","endLoc","startLine","startColumn","endLine","endColumn","start","end","lineDiff","markerLines","index","lineNumber","sourceLength","a","u","e","m","o","n","i","f","get_marker_lines_default","$","S","W","M","options","L","config","t","value","hasColumns","g","r","x","s","lines","ln","numberMaxWidth","colorizeGutter","colorizeMarker","colorizeMessage","frame","line","number","hasMarker","paddedNumber","lastMarkerLine","gutter","markerLine","markerSpacing","numberOfMarkers","CODE_FRAME_POINTER","h","k","d","getCodePoint","character","generateCodeFrame","location","q","getErrorLocation","message","match","column","F","addCodePointToUnexpectedToken","_","_quote","token","parseJson","string","reviver","fileName","error","jsonError","json_error_default","parse_json_default","assertValidFileContents","contents","assert_valid_file_contents_default"],"mappings":"wCACA,IAAMA,EAAkCC,GAAmC,CACvE,GAAI,CAACA,GAAwB,EAAEA,aAA+B,MAAQ,OAAOA,GAAwB,SACjG,MAAM,IAAI,UAAU,yCAAyC,CAErE,EAEOC,EAAQF,ECPf,OAAS,iBAAAG,MAAqB,WAE9B,IAAMC,EAAUC,GAAqCA,aAAqB,IAAMF,EAAcE,CAAS,EAAIA,EAEpGC,GAAQF,ECJf,IAAMG,EAAeC,GAAyBA,EAAK,WAAW,qBAAsB;CAAI,EAEjFC,EAAQF,ECGTG,EAAY,WAAW,SAAW,OAAO,OAAO,IAAI,EAEpDC,EAAiC,CACnC,SAAU,CAAC,CACf,EAEMC,EAAU,IAAI,MAAeF,EAAU,CACzC,IAAIG,EAAQC,EAAyB,CACjC,GAAIA,KAAYD,EAEZ,OAAOA,EAAOC,CAAQ,EAG1B,GAAIA,KAAYH,EAEZ,OAAOA,EAAaG,CAAQ,CAIpC,CACJ,CAAC,EAEMC,EAAQH,ECVTI,EAAiB,CACnBC,EACAC,EACAC,EACAC,IAMC,CACD,IAAMC,EAA8B,CAChC,OAAQ,EAER,KAAM,GACN,GAAGJ,EAAI,KACX,EACMK,EAA4B,CAC9B,GAAGD,EACH,GAAGJ,EAAI,GACX,EACMM,EAAYF,EAAS,KACrBG,EAAcH,EAAS,OACvBI,EAAUH,EAAO,KACjBI,EAAYJ,EAAO,OAErBK,EAAQ,KAAK,IAAIJ,GAAaJ,EAAa,GAAI,CAAC,EAChDS,EAAM,KAAK,IAAIV,EAAO,OAAQO,EAAUL,CAAU,EAElDG,IAAc,KACdI,EAAQ,GAGRF,IAAY,KACZG,EAAMV,EAAO,QAGjB,IAAMW,EAAWJ,EAAUF,EACrBO,EAA2B,CAAC,EAElC,GAA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AAU,SAAWF,EAEjBd,IAEAgB,EAAU,UAAYjB,EAAkBa,EAAQZ,EAAUjC,CAAO,GAG/DiD,CACV,CAEA,IAAOE,GAAQP,EC5Gf,IAAMQ,EAA2BC,GAAwB,CACrD,GAAI,OAAOA,GAAa,UAAY,EAAEA,aAAoB,cAAgB,CAAC,YAAY,OAAOA,CAAQ,EAClG,MAAM,IAAI,UAAU,mEAAmE,CAE/F,EAEOC,GAAQF","sourcesContent":["// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileOrDirectoryPath = (fileOrDirectoryPath: any): void => {\n if (!fileOrDirectoryPath || (!(fileOrDirectoryPath instanceof URL) && typeof fileOrDirectoryPath !== \"string\")) {\n throw new TypeError(\"Path must be a non-empty string or URL.\");\n }\n};\n\nexport default assertValidFileOrDirectoryPath;\n","import { fileURLToPath } from \"node:url\";\n\nconst toPath = (urlOrPath: URL | string): string => (urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath);\n\nexport default toPath;\n","const normalizeLF = (code: string): string => code.replaceAll(/\\r\\n|\\r(?!\\n)|\\n/gu, \"\\n\");\n\nexport default normalizeLF;\n","interface Process extends Partial<Omit<typeof globalThis.process, \"versions\">> {\n versions: Record<string, string>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-unnecessary-condition,no-underscore-dangle\nconst _process = (globalThis.process || Object.create(null)) as unknown as Process;\n\nconst processShims: Partial<Process> = {\n versions: {},\n};\n\nconst process = new Proxy<Process>(_process, {\n get(target, property: keyof Process) {\n if (property in target) {\n // eslint-disable-next-line security/detect-object-injection\n return target[property];\n }\n\n if (property in processShims) {\n // eslint-disable-next-line security/detect-object-injection\n return processShims[property];\n }\n\n return undefined;\n },\n});\n\nexport default process;\n","// eslint-disable-next-line no-secrets/no-secrets\n/**\n * This is a copy of the codeFrame function from Babel\n * @see https://github.com/babel/babel/blob/85e649203b61b7c908eb04c05511a0d35f893e8e/packages/babel-code-frame/src/index.ts#L68-L143\n *\n * MIT License\n *\n * Copyright (c) 2014-present Sebastian McKenzie and other contributors\n */\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nimport type { CodeFrameLocation, CodeFrameNodeLocation } from \"./types\";\n\ntype MarkerLines = Record<number, true | [number | undefined, number | undefined]>;\n\nconst getMarkerLines = (\n loc: CodeFrameNodeLocation,\n source: string[],\n linesAbove: number,\n linesBelow: number,\n): {\n end: number;\n markerLines: MarkerLines;\n start: number;\n // eslint-disable-next-line sonarjs/cognitive-complexity\n} => {\n const startLoc: CodeFrameLocation = {\n column: 0,\n // @ts-expect-error Can be overwritten\n line: -1,\n ...loc.start,\n };\n const endLoc: CodeFrameLocation = {\n ...startLoc,\n ...loc.end,\n };\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines: MarkerLines = {};\n\n if (lineDiff) {\n // eslint-disable-next-line no-plusplus,no-loops/no-loops\n for (let index = 0; index <= lineDiff; index++) {\n const lineNumber = index + startLine;\n\n if (!startColumn) {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = true;\n } else if (index === 0) {\n const sourceLength = source[lineNumber - 1]?.length;\n\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = [startColumn, (sourceLength ?? 0) - startColumn + 1];\n } else if (index === lineDiff) {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - index]?.length;\n\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[startLine] = [startColumn, (endColumn ?? 0) - (startColumn ?? 0)];\n }\n\n return { end, markerLines, start };\n};\n\nexport default getMarkerLines;\n","// eslint-disable-next-line no-secrets/no-secrets\n/**\n * This is a modified copy of the codeFrameColumns function from Babel\n * @see https://github.com/babel/babel/blob/85e649203b61b7c908eb04c05511a0d35f893e8e/packages/babel-code-frame/src/index.ts#L145-L217\n *\n * MIT License\n *\n * Copyright (c) 2014-present Sebastian McKenzie and other contributors\n */\n\nimport normalizeLF from \"../util/normalize-lf\";\nimport process from \"../util/process\";\nimport getMarkerLines from \"./get-marker-lines\";\nimport type { CodeFrameNodeLocation, CodeFrameOptions } from \"./types\";\n\nexport const CODE_FRAME_POINTER = process.platform === \"win32\" && !process.env?.[\"WT_SESSION\"] ? \">\" : \"❯\";\n\n/** Generate a code frame from string and an error location */\nexport const codeFrame = (\n source: string,\n loc: CodeFrameNodeLocation,\n options?: CodeFrameOptions,\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): string => {\n // grab 2 lines before, and 3 lines after focused line\n const config = {\n linesAbove: 2,\n linesBelow: 3,\n showGutter: true,\n showLineNumbers: true,\n tabWidth: 4,\n ...options,\n color: {\n gutter: (value: string) => value,\n marker: (value: string) => value,\n message: (value: string) => value,\n ...options?.color,\n },\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const hasColumns = loc.start && typeof loc.start.column === \"number\";\n\n let lines = normalizeLF(source).split(\"\\n\");\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof config?.tabWidth === \"number\") {\n lines = lines.map((ln) => ln.replaceAll(\"\\t\", \" \".repeat(config.tabWidth as number)));\n }\n\n const { end, markerLines, start } = getMarkerLines(loc, lines, config.linesAbove, config.linesBelow);\n\n const numberMaxWidth = String(end).length;\n const { gutter: colorizeGutter, marker: colorizeMarker, message: colorizeMessage } = config.color;\n\n let frame = lines\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n // eslint-disable-next-line security/detect-object-injection\n const hasMarker = markerLines[number];\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const lastMarkerLine = !markerLines[number + 1];\n\n const gutter = ` ${paddedNumber}${config.showGutter ? ` |` : \"\"}`;\n\n if (hasMarker) {\n let markerLine = \"\";\n\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line.replaceAll(/[^\\t]/g, \" \").slice(0, Math.max((hasMarker[0] as number) - 1, 0));\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\"\\n \", colorizeGutter(gutter.replaceAll(/\\d/g, \" \")), \" \", markerSpacing, colorizeMarker(\"^\").repeat(numberOfMarkers)].join(\n \"\",\n );\n\n if (lastMarkerLine && config.message) {\n markerLine += ` ${colorizeMessage(config.message)}`;\n }\n }\n\n return [colorizeMarker(CODE_FRAME_POINTER), colorizeGutter(gutter), line.length > 0 ? ` ${line}` : \"\", markerLine].join(\"\");\n }\n\n return ` ${colorizeGutter(gutter)}${line.length > 0 ? ` ${line}` : \"\"}`;\n })\n .join(\"\\n\");\n\n if (config.message && !hasColumns) {\n frame = `${\" \".repeat(numberMaxWidth + 1)}${config.message}\\n${frame}`;\n }\n\n return frame;\n};\n\nexport type { CodeFrameLocation, CodeFrameNodeLocation, CodeFrameOptions, ColorizeMethod } from \"./types\";\n","/**\n * A modified version of `parse-json` from `https://github.com/sindresorhus/parse-json/blob/main/index.js`\n *\n * MIT License\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { codeFrame, indexToLineColumn } from \"@visulima/error\";\nimport type { JsonValue } from \"type-fest\";\n\nimport JsonError from \"../error/json-error\";\nimport type { CodeFrameLocation, CodeFrameOptions, JsonReviver } from \"../types\";\n\nconst getCodePoint = (character: string): string => `\\\\u{${(character.codePointAt(0) as number).toString(16)}}`;\n\nconst generateCodeFrame = (source: string, location: CodeFrameLocation, options?: CodeFrameOptions) =>\n \n codeFrame(\n source,\n { start: location },\n {\n tabWidth: false,\n ...options,\n },\n );\n\nconst getErrorLocation = (source: string, message: string): CodeFrameLocation | undefined => {\n // eslint-disable-next-line security/detect-unsafe-regex\n const match = /in JSON at position (?<index>\\d+)(?: \\(line (?<line>\\d+) column (?<column>\\d+)\\))?$/.exec(message);\n\n if (!match) {\n return undefined;\n }\n\n // eslint-disable-next-line prefer-const\n let { column, index, line } = match.groups as { column?: string; index: number | string; line?: string };\n\n if (line && column) {\n return { column: Number(column), line: Number(line) };\n }\n\n index = Number(index);\n\n // The error location can be out of bounds.\n if (index === source.length) {\n index = source.length - 1;\n }\n\n \n return indexToLineColumn(source, index);\n};\n\nconst addCodePointToUnexpectedToken = (message: string): string =>\n message.replace(\n // TODO[engine:node@>=20]: The token always quoted after Node.js 20\n // eslint-disable-next-line regexp/no-potentially-useless-backreference\n /(?<=^Unexpected token )(?<quote>')?(.)\\k<quote>/,\n \n (_, _quote, token) => `\"${token}\"(${getCodePoint(token)})`,\n );\n\nfunction parseJson<T = JsonValue>(string: string, filename?: string, options?: CodeFrameOptions): T;\nfunction parseJson<T = JsonValue>(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): T;\n// eslint-disable-next-line func-style\nfunction parseJson<T = JsonValue>(string: string, reviver?: JsonReviver | string, fileName?: CodeFrameOptions | string, options?: CodeFrameOptions): T {\n if (typeof reviver === \"string\") {\n if (typeof fileName === \"object\") {\n // eslint-disable-next-line no-param-reassign\n options = fileName;\n }\n\n // eslint-disable-next-line no-param-reassign\n fileName = reviver;\n // eslint-disable-next-line no-param-reassign\n reviver = undefined;\n }\n\n let message: string;\n\n try {\n \n return JSON.parse(string, reviver);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n message = error.message;\n }\n\n let location: CodeFrameLocation | undefined;\n\n if (string) {\n location = getErrorLocation(string, message);\n message = addCodePointToUnexpectedToken(message);\n } else {\n message += \" while parsing empty string\";\n }\n\n const jsonError = new JsonError(message);\n\n jsonError.fileName = fileName as string;\n\n if (location) {\n \n jsonError.codeFrame = generateCodeFrame(string, location, options);\n }\n\n throw jsonError;\n}\n\nexport default parseJson;\n","// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileContents = (contents: any): void => {\n if (typeof contents !== \"string\" && !(contents instanceof ArrayBuffer) && !ArrayBuffer.isView(contents)) {\n throw new TypeError(\"File contents must be a string, ArrayBuffer, or ArrayBuffer view.\");\n }\n};\n\nexport default assertValidFileContents;\n"]}
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var chunkN5NZURYL_cjs = require('./chunk-N5NZURYL.cjs');
4
+ var url = require('url');
5
+
6
+ var O=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},K=O;var V=e=>e instanceof URL?url.fileURLToPath(e):e,Z=V;var N=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
7
+ `),P=N,U=globalThis.process||Object.create(null),w={versions:{}},j=new Proxy(U,{get(e,t){if(t in e)return e[t];if(t in w)return w[t]}}),T=j,B=(e,t,o,n)=>{let r={column:0,line:-1,...e.start},s={...r,...e.end},a=r.line,l=r.column,f=s.line,p=s.column,c=Math.max(a-(o+1),0),d=Math.min(t.length,f+n);a===-1&&(c=0),f===-1&&(d=t.length);let y=f-a,m={};if(y)for(let i=0;i<=y;i++){let u=i+a;if(!l)m[u]=!0;else if(i===0){let g=t[u-1]?.length;m[u]=[l,(g??0)-l+1];}else if(i===y)m[u]=[0,p];else {let g=t[u-i]?.length;m[u]=[0,g];}}else l===p?m[a]=l?[l,0]:!0:m[a]=[l,(p??0)-(l??0)];return {end:d,markerLines:m,start:c}},M=B,$=T.platform==="win32"&&!T.env?.WT_SESSION?">":"\u276F",A=(e,t,o)=>{let n={linesAbove:2,linesBelow:3,showGutter:!0,showLineNumbers:!0,tabWidth:4,...o,color:{gutter:i=>i,marker:i=>i,message:i=>i,...o?.color}},r=t.start&&typeof t.start.column=="number",s=P(e).split(`
8
+ `);typeof n?.tabWidth=="number"&&(s=s.map(i=>i.replaceAll(" "," ".repeat(n.tabWidth))));let{end:a,markerLines:l,start:f}=M(t,s,n.linesAbove,n.linesBelow),p=String(a).length,{gutter:c,marker:d,message:y}=n.color,m=s.slice(f,a).map((i,u)=>{let g=f+1+u,b=l[g],E=` ${g}`.slice(-p),J=!l[g+1],x=` ${E}${n.showGutter?" |":""}`;if(b){let F="";if(Array.isArray(b)){let k=i.replaceAll(/[^\t]/g," ").slice(0,Math.max(b[0]-1,0)),S=b[1]||1;F=[`
9
+ `,c(x.replaceAll(/\d/g," "))," ",k,d("^").repeat(S)].join(""),J&&n.message&&(F+=` ${y(n.message)}`);}return [d($),c(x),i.length>0?` ${i}`:"",F].join("")}return ` ${c(x)}${i.length>0?` ${i}`:""}`}).join(`
10
+ `);return n.message&&!r&&(m=`${" ".repeat(p+1)}${n.message}
11
+ ${m}`),m};var v=(e,t)=>{let o=0,n=t.length-2;for(;o<n;){let r=o+(n-o>>1);if(e<t[r])n=r-1;else if(e>=t[r+1])o=r+1;else {o=r;break}}return o},W=e=>e.split(/\n|\r(?!\n)/).reduce((t,o)=>(t.push(t.at(-1)+o.length+1),t),[0]),_=(e,t,o)=>{let n=o?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return {column:0,line:0};if(!n&&(typeof t!="number"||typeof e=="string"&&t>=e.length||Array.isArray(e)&&t+1>=e.at(-1)))return {column:0,line:0};if(typeof e=="string"){let s=W(e),a=v(t,s);return {column:t-s[a]+1,line:a+1}}let r=v(t,e);return {column:t-e[r]+1,line:r+1}},L=_;var q=e=>`\\u{${e.codePointAt(0).toString(16)}}`,G=(e,t,o)=>A(e,{start:t},{tabWidth:!1,...o}),I=(e,t)=>{let o=/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(t);if(!o)return;let{column:n,index:r,line:s}=o.groups;return s&&n?{column:Number(n),line:Number(s)}:(r=Number(r),r===e.length&&(r=e.length-1),L(e,r))},z=e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,o,n)=>`"${n}"(${q(n)})`);function D(e,t,o,n){typeof t=="string"&&(typeof o=="object"&&(n=o),o=t,t=void 0);let r;try{return JSON.parse(e,t)}catch(l){r=l.message;}let s;e?(s=I(e,r),r=z(r)):r+=" while parsing empty string";let a=new chunkN5NZURYL_cjs.a(r);throw a.fileName=o,s&&(a.codeFrame=G(e,s,n)),a}var me=D;var H=e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},fe=H;
12
+
13
+ exports.a = K;
14
+ exports.b = Z;
15
+ exports.c = me;
16
+ exports.d = fe;
17
+ //# sourceMappingURL=out.js.map
18
+ //# sourceMappingURL=chunk-QXIA5SOY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/assert-valid-file-or-directory-path.ts","../src/utils/to-path.ts","../../error/src/util/normalize-lf.ts","../../error/src/util/process.ts","../../error/src/code-frame/get-marker-lines.ts","../../error/src/code-frame/index.ts","../src/utils/parse-json.ts","../src/utils/assert-valid-file-contents.ts"],"names":["assertValidFileOrDirectoryPath","fileOrDirectoryPath","assert_valid_file_or_directory_path_default","fileURLToPath","toPath","urlOrPath","to_path_default","normalizeLF","code","normalize_lf_default","_process","processShims","process","target","property","process_default","getMarkerLines","loc","source","linesAbove","linesBelow","startLoc","endLoc","startLine","startColumn","endLine","endColumn","start","end","lineDiff","markerLines","index","lineNumber","sourceLength","a","u","e","m","o","n","i","f","get_marker_lines_default","$","S","W","M","options","L","config","t","value","hasColumns","g","r","x","s","lines","ln","numberMaxWidth","colorizeGutter","colorizeMarker","colorizeMessage","frame","line","number","hasMarker","paddedNumber","lastMarkerLine","gutter","markerLine","markerSpacing","numberOfMarkers","CODE_FRAME_POINTER","h","k","d","getCodePoint","character","generateCodeFrame","location","q","getErrorLocation","message","match","column","F","addCodePointToUnexpectedToken","_","_quote","token","parseJson","string","reviver","fileName","error","jsonError","json_error_default","parse_json_default","assertValidFileContents","contents","assert_valid_file_contents_default"],"mappings":"yCACA,IAAMA,EAAkCC,GAAmC,CACvE,GAAI,CAACA,GAAwB,EAAEA,aAA+B,MAAQ,OAAOA,GAAwB,SACjG,MAAM,IAAI,UAAU,yCAAyC,CAErE,EAEOC,EAAQF,ECPf,OAAS,iBAAAG,MAAqB,MAE9B,IAAMC,EAAUC,GAAqCA,aAAqB,IAAMF,EAAcE,CAAS,EAAIA,EAEpGC,EAAQF,ECJf,IAAMG,EAAeC,GAAyBA,EAAK,WAAW,qBAAsB;CAAI,EAEjFC,EAAQF,ECGTG,EAAY,WAAW,SAAW,OAAO,OAAO,IAAI,EAEpDC,EAAiC,CACnC,SAAU,CAAC,CACf,EAEMC,EAAU,IAAI,MAAeF,EAAU,CACzC,IAAIG,EAAQC,EAAyB,CACjC,GAAIA,KAAYD,EAEZ,OAAOA,EAAOC,CAAQ,EAG1B,GAAIA,KAAYH,EAEZ,OAAOA,EAAaG,CAAQ,CAIpC,CACJ,CAAC,EAEMC,EAAQH,ECVTI,EAAiB,CACnBC,EACAC,EACAC,EACAC,IAMC,CACD,IAAMC,EAA8B,CAChC,OAAQ,EAER,KAAM,GACN,GAAGJ,EAAI,KACX,EACMK,EAA4B,CAC9B,GAAGD,EACH,GAAGJ,EAAI,GACX,EACMM,EAAYF,EAAS,KACrBG,EAAcH,EAAS,OACvBI,EAAUH,EAAO,KACjBI,EAAYJ,EAAO,OAErBK,EAAQ,KAAK,IAAIJ,GAAaJ,EAAa,GAAI,CAAC,EAChDS,EAAM,KAAK,IAAIV,EAAO,OAAQO,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,EAAWE,EAAiBU,EAAQT,CAAO,EAC3CA,EAAUI,EAA8BJ,CAAO,GAE/CA,GAAW,8BAGf,IAAMa,EAAY,IAAIC,EAAUd,CAAO,EAEvC,MAAAa,EAAU,SAAWF,EAEjBd,IAEAgB,EAAU,UAAYjB,EAAkBa,EAAQZ,EAAUjC,CAAO,GAG/DiD,CACV,CAEA,IAAOE,GAAQP,EC5Gf,IAAMQ,EAA2BC,GAAwB,CACrD,GAAI,OAAOA,GAAa,UAAY,EAAEA,aAAoB,cAAgB,CAAC,YAAY,OAAOA,CAAQ,EAClG,MAAM,IAAI,UAAU,mEAAmE,CAE/F,EAEOC,GAAQF","sourcesContent":["// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileOrDirectoryPath = (fileOrDirectoryPath: any): void => {\n if (!fileOrDirectoryPath || (!(fileOrDirectoryPath instanceof URL) && typeof fileOrDirectoryPath !== \"string\")) {\n throw new TypeError(\"Path must be a non-empty string or URL.\");\n }\n};\n\nexport default assertValidFileOrDirectoryPath;\n","import { fileURLToPath } from \"node:url\";\n\nconst toPath = (urlOrPath: URL | string): string => (urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath);\n\nexport default toPath;\n","const normalizeLF = (code: string): string => code.replaceAll(/\\r\\n|\\r(?!\\n)|\\n/gu, \"\\n\");\n\nexport default normalizeLF;\n","interface Process extends Partial<Omit<typeof globalThis.process, \"versions\">> {\n versions: Record<string, string>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-unnecessary-condition,no-underscore-dangle\nconst _process = (globalThis.process || Object.create(null)) as unknown as Process;\n\nconst processShims: Partial<Process> = {\n versions: {},\n};\n\nconst process = new Proxy<Process>(_process, {\n get(target, property: keyof Process) {\n if (property in target) {\n // eslint-disable-next-line security/detect-object-injection\n return target[property];\n }\n\n if (property in processShims) {\n // eslint-disable-next-line security/detect-object-injection\n return processShims[property];\n }\n\n return undefined;\n },\n});\n\nexport default process;\n","// eslint-disable-next-line no-secrets/no-secrets\n/**\n * This is a copy of the codeFrame function from Babel\n * @see https://github.com/babel/babel/blob/85e649203b61b7c908eb04c05511a0d35f893e8e/packages/babel-code-frame/src/index.ts#L68-L143\n *\n * MIT License\n *\n * Copyright (c) 2014-present Sebastian McKenzie and other contributors\n */\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nimport type { CodeFrameLocation, CodeFrameNodeLocation } from \"./types\";\n\ntype MarkerLines = Record<number, true | [number | undefined, number | undefined]>;\n\nconst getMarkerLines = (\n loc: CodeFrameNodeLocation,\n source: string[],\n linesAbove: number,\n linesBelow: number,\n): {\n end: number;\n markerLines: MarkerLines;\n start: number;\n // eslint-disable-next-line sonarjs/cognitive-complexity\n} => {\n const startLoc: CodeFrameLocation = {\n column: 0,\n // @ts-expect-error Can be overwritten\n line: -1,\n ...loc.start,\n };\n const endLoc: CodeFrameLocation = {\n ...startLoc,\n ...loc.end,\n };\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines: MarkerLines = {};\n\n if (lineDiff) {\n // eslint-disable-next-line no-plusplus,no-loops/no-loops\n for (let index = 0; index <= lineDiff; index++) {\n const lineNumber = index + startLine;\n\n if (!startColumn) {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = true;\n } else if (index === 0) {\n const sourceLength = source[lineNumber - 1]?.length;\n\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = [startColumn, (sourceLength ?? 0) - startColumn + 1];\n } else if (index === lineDiff) {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - index]?.length;\n\n // eslint-disable-next-line security/detect-object-injection\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n // eslint-disable-next-line security/detect-object-injection\n markerLines[startLine] = [startColumn, (endColumn ?? 0) - (startColumn ?? 0)];\n }\n\n return { end, markerLines, start };\n};\n\nexport default getMarkerLines;\n","// eslint-disable-next-line no-secrets/no-secrets\n/**\n * This is a modified copy of the codeFrameColumns function from Babel\n * @see https://github.com/babel/babel/blob/85e649203b61b7c908eb04c05511a0d35f893e8e/packages/babel-code-frame/src/index.ts#L145-L217\n *\n * MIT License\n *\n * Copyright (c) 2014-present Sebastian McKenzie and other contributors\n */\n\nimport normalizeLF from \"../util/normalize-lf\";\nimport process from \"../util/process\";\nimport getMarkerLines from \"./get-marker-lines\";\nimport type { CodeFrameNodeLocation, CodeFrameOptions } from \"./types\";\n\nexport const CODE_FRAME_POINTER = process.platform === \"win32\" && !process.env?.[\"WT_SESSION\"] ? \">\" : \"❯\";\n\n/** Generate a code frame from string and an error location */\nexport const codeFrame = (\n source: string,\n loc: CodeFrameNodeLocation,\n options?: CodeFrameOptions,\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): string => {\n // grab 2 lines before, and 3 lines after focused line\n const config = {\n linesAbove: 2,\n linesBelow: 3,\n showGutter: true,\n showLineNumbers: true,\n tabWidth: 4,\n ...options,\n color: {\n gutter: (value: string) => value,\n marker: (value: string) => value,\n message: (value: string) => value,\n ...options?.color,\n },\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const hasColumns = loc.start && typeof loc.start.column === \"number\";\n\n let lines = normalizeLF(source).split(\"\\n\");\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof config?.tabWidth === \"number\") {\n lines = lines.map((ln) => ln.replaceAll(\"\\t\", \" \".repeat(config.tabWidth as number)));\n }\n\n const { end, markerLines, start } = getMarkerLines(loc, lines, config.linesAbove, config.linesBelow);\n\n const numberMaxWidth = String(end).length;\n const { gutter: colorizeGutter, marker: colorizeMarker, message: colorizeMessage } = config.color;\n\n let frame = lines\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n // eslint-disable-next-line security/detect-object-injection\n const hasMarker = markerLines[number];\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const lastMarkerLine = !markerLines[number + 1];\n\n const gutter = ` ${paddedNumber}${config.showGutter ? ` |` : \"\"}`;\n\n if (hasMarker) {\n let markerLine = \"\";\n\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line.replaceAll(/[^\\t]/g, \" \").slice(0, Math.max((hasMarker[0] as number) - 1, 0));\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\"\\n \", colorizeGutter(gutter.replaceAll(/\\d/g, \" \")), \" \", markerSpacing, colorizeMarker(\"^\").repeat(numberOfMarkers)].join(\n \"\",\n );\n\n if (lastMarkerLine && config.message) {\n markerLine += ` ${colorizeMessage(config.message)}`;\n }\n }\n\n return [colorizeMarker(CODE_FRAME_POINTER), colorizeGutter(gutter), line.length > 0 ? ` ${line}` : \"\", markerLine].join(\"\");\n }\n\n return ` ${colorizeGutter(gutter)}${line.length > 0 ? ` ${line}` : \"\"}`;\n })\n .join(\"\\n\");\n\n if (config.message && !hasColumns) {\n frame = `${\" \".repeat(numberMaxWidth + 1)}${config.message}\\n${frame}`;\n }\n\n return frame;\n};\n\nexport type { CodeFrameLocation, CodeFrameNodeLocation, CodeFrameOptions, ColorizeMethod } from \"./types\";\n","/**\n * A modified version of `parse-json` from `https://github.com/sindresorhus/parse-json/blob/main/index.js`\n *\n * MIT License\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { codeFrame, indexToLineColumn } from \"@visulima/error\";\nimport type { JsonValue } from \"type-fest\";\n\nimport JsonError from \"../error/json-error\";\nimport type { CodeFrameLocation, CodeFrameOptions, JsonReviver } from \"../types\";\n\nconst getCodePoint = (character: string): string => `\\\\u{${(character.codePointAt(0) as number).toString(16)}}`;\n\nconst generateCodeFrame = (source: string, location: CodeFrameLocation, options?: CodeFrameOptions) =>\n \n codeFrame(\n source,\n { start: location },\n {\n tabWidth: false,\n ...options,\n },\n );\n\nconst getErrorLocation = (source: string, message: string): CodeFrameLocation | undefined => {\n // eslint-disable-next-line security/detect-unsafe-regex\n const match = /in JSON at position (?<index>\\d+)(?: \\(line (?<line>\\d+) column (?<column>\\d+)\\))?$/.exec(message);\n\n if (!match) {\n return undefined;\n }\n\n // eslint-disable-next-line prefer-const\n let { column, index, line } = match.groups as { column?: string; index: number | string; line?: string };\n\n if (line && column) {\n return { column: Number(column), line: Number(line) };\n }\n\n index = Number(index);\n\n // The error location can be out of bounds.\n if (index === source.length) {\n index = source.length - 1;\n }\n\n \n return indexToLineColumn(source, index);\n};\n\nconst addCodePointToUnexpectedToken = (message: string): string =>\n message.replace(\n // TODO[engine:node@>=20]: The token always quoted after Node.js 20\n // eslint-disable-next-line regexp/no-potentially-useless-backreference\n /(?<=^Unexpected token )(?<quote>')?(.)\\k<quote>/,\n \n (_, _quote, token) => `\"${token}\"(${getCodePoint(token)})`,\n );\n\nfunction parseJson<T = JsonValue>(string: string, filename?: string, options?: CodeFrameOptions): T;\nfunction parseJson<T = JsonValue>(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): T;\n// eslint-disable-next-line func-style\nfunction parseJson<T = JsonValue>(string: string, reviver?: JsonReviver | string, fileName?: CodeFrameOptions | string, options?: CodeFrameOptions): T {\n if (typeof reviver === \"string\") {\n if (typeof fileName === \"object\") {\n // eslint-disable-next-line no-param-reassign\n options = fileName;\n }\n\n // eslint-disable-next-line no-param-reassign\n fileName = reviver;\n // eslint-disable-next-line no-param-reassign\n reviver = undefined;\n }\n\n let message: string;\n\n try {\n \n return JSON.parse(string, reviver);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n message = error.message;\n }\n\n let location: CodeFrameLocation | undefined;\n\n if (string) {\n location = getErrorLocation(string, message);\n message = addCodePointToUnexpectedToken(message);\n } else {\n message += \" while parsing empty string\";\n }\n\n const jsonError = new JsonError(message);\n\n jsonError.fileName = fileName as string;\n\n if (location) {\n \n jsonError.codeFrame = generateCodeFrame(string, location, options);\n }\n\n throw jsonError;\n}\n\nexport default parseJson;\n","// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileContents = (contents: any): void => {\n if (typeof contents !== \"string\" && !(contents instanceof ArrayBuffer) && !ArrayBuffer.isView(contents)) {\n throw new TypeError(\"File contents must be a string, ArrayBuffer, or ArrayBuffer view.\");\n }\n};\n\nexport default assertValidFileContents;\n"]}
@@ -0,0 +1,5 @@
1
+ var e=class extends Error{root;constructor(r,o){super(`${r instanceof Error?r.message:r} for path "${o}"`),this.cause=r,this.root=o;}get name(){return "WalkError"}set name(r){throw new Error("Cannot overwrite name of WalkError")}},a=e;var t=class extends Error{constructor(r){super(`EPERM: Operation not permitted, ${r}`);}get code(){return "EPERM"}set code(r){throw new Error("Cannot overwrite code EPERM")}get name(){return "PermissionError"}set name(r){throw new Error("Cannot overwrite name of PermissionError")}},p=t;
2
+
3
+ export { a, p as b };
4
+ //# sourceMappingURL=out.js.map
5
+ //# sourceMappingURL=chunk-X5PFFPHW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/error/walk-error.ts","../src/error/permission-error.ts"],"names":["WalkError","cause","root","_name","walk_error_default","PermissionError","message","permission_error_default"],"mappings":"AAMA,IAAMA,EAAN,cAAwB,KAAM,CAEnB,KAGA,YAAYC,EAAgBC,EAAc,CAE7C,MAAM,GAAGD,aAAiB,MAAQA,EAAM,QAAUA,CAAK,cAAcC,CAAI,GAAG,EAE5E,KAAK,MAAQD,EACb,KAAK,KAAOC,CAChB,CAGA,IAAoB,MAAe,CAC/B,MAAO,WACX,CAGA,IAAoB,KAAKC,EAAO,CAC5B,MAAM,IAAI,MAAM,oCAAoC,CACxD,CACJ,EAEOC,EAAQJ,EC3Bf,IAAMK,EAAN,cAA8B,KAAM,CAKzB,YAAYC,EAAiB,CAChC,MAAM,mCAAmCA,CAAO,EAAE,CACtD,CAGA,IAAW,MAAe,CACtB,MAAO,OACX,CAGA,IAAW,KAAKH,EAAO,CACnB,MAAM,IAAI,MAAM,6BAA6B,CACjD,CAGA,IAAoB,MAAe,CAC/B,MAAO,iBACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEOI,EAAQF","sourcesContent":["// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.\n// Documentation and interface for walk were adapted from Go\n// https://golang.org/pkg/path/filepath/#Walk\n// Copyright 2009 The Go Authors. All rights reserved. BSD license.\n\n/** Error thrown in {@linkcode walk} or {@linkcode walkSync} during iteration. */\nclass WalkError extends Error {\n /** File path of the root that's being walked. */\n public root: string;\n\n /** Constructs a new instance. */\n public constructor(cause: unknown, root: string) {\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n super(`${cause instanceof Error ? cause.message : cause} for path \"${root}\"`);\n\n this.cause = cause;\n this.root = root;\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"WalkError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of WalkError\");\n }\n}\n\nexport default WalkError;\n","/**\n * Error thrown when an operation is not permitted.\n */\nclass PermissionError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EPERM: Operation not permitted, ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"EPERM\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code EPERM\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"PermissionError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of PermissionError\");\n }\n}\n\nexport default PermissionError;\n"]}
package/dist/error.cjs CHANGED
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var chunkKXYI7M76_cjs = require('./chunk-KXYI7M76.cjs');
3
+ var chunkJSJNX53G_cjs = require('./chunk-JSJNX53G.cjs');
4
4
  var chunkN5NZURYL_cjs = require('./chunk-N5NZURYL.cjs');
5
5
 
6
- var t=class extends Error{name="AlreadyExistsError";code="EEXIST";constructor(r){super(`EEXIST: ${r}`);}},E=t;var s=class extends Error{name="DirectoryError";code="EISDIR";constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`);}},p=s;var a=class extends Error{code="ENOTEMPTY";name="NotEmptyError";constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`);}},i=a;var l=class extends Error{name="NotFoundError";code="ENOENT";constructor(r){super(`ENOENT: No such file or directory, ${r}`);}},n=l;
6
+ var t=class extends Error{constructor(r){super(`EEXIST: ${r}`);}get code(){return "EEXIST"}set code(r){throw new Error("Cannot overwrite code EEXIST")}get name(){return "AlreadyExistsError"}set name(r){throw new Error("Cannot overwrite name of AlreadyExistsError")}},E=t;var n=class extends Error{constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`);}get code(){return "EISDIR"}set code(r){throw new Error("Cannot overwrite code EISDIR")}get name(){return "DirectoryError"}set name(r){throw new Error("Cannot overwrite name of DirectoryError")}},l=n;var i=class extends Error{constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`);}get code(){return "ENOTEMPTY"}set code(r){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return "NotEmptyError"}set name(r){throw new Error("Cannot overwrite name of NotEmptyError")}},d=i;var a=class extends Error{constructor(r){super(`ENOENT: ${r}`);}get code(){return "ENOENT"}set code(r){throw new Error("Cannot overwrite code ENOENT")}get name(){return "NotFoundError"}set name(r){throw new Error("Cannot overwrite name of NotFoundError")}},p=a;
7
7
 
8
8
  Object.defineProperty(exports, 'PermissionError', {
9
9
  enumerable: true,
10
- get: function () { return chunkKXYI7M76_cjs.b; }
10
+ get: function () { return chunkJSJNX53G_cjs.b; }
11
11
  });
12
12
  Object.defineProperty(exports, 'WalkError', {
13
13
  enumerable: true,
14
- get: function () { return chunkKXYI7M76_cjs.a; }
14
+ get: function () { return chunkJSJNX53G_cjs.a; }
15
15
  });
16
16
  Object.defineProperty(exports, 'JSONError', {
17
17
  enumerable: true,
18
18
  get: function () { return chunkN5NZURYL_cjs.a; }
19
19
  });
20
20
  exports.AlreadyExistsError = E;
21
- exports.DirectoryError = p;
22
- exports.NotEmptyError = i;
23
- exports.NotFoundError = n;
21
+ exports.DirectoryError = l;
22
+ exports.NotEmptyError = d;
23
+ exports.NotFoundError = p;
24
24
  //# sourceMappingURL=out.js.map
25
25
  //# sourceMappingURL=error.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/error/already-exists-error.ts","../src/error/directory-error.ts","../src/error/not-empty-error.ts","../src/error/not-found-error.ts"],"names":["AlreadyExistsError","message","already_exists_error_default","DirectoryError","directory_error_default","NotEmptyError","not_empty_error_default","NotFoundError","not_found_error_default"],"mappings":"yFAGA,IAAMA,EAAN,cAAiC,KAAM,CAMjB,KAAO,qBAMlB,KAAO,SAMP,YAAYC,EAAiB,CAChC,MAAM,WAAWA,CAAO,EAAE,CAC9B,CACJ,EAEOC,EAAQF,ECvBf,IAAMG,EAAN,cAA6B,KAAM,CAMb,KAAO,iBAMlB,KAAO,SAMP,YAAYF,EAAiB,CAChC,MAAM,6CAA6CA,CAAO,EAAE,CAChE,CACJ,EAEOG,EAAQD,ECvBf,IAAME,EAAN,cAA4B,KAAM,CAKvB,KAAO,YAOI,KAAO,gBAMlB,YAAYJ,EAAiB,CAChC,MAAM,mCAAmCA,CAAO,EAAE,CACtD,CACJ,EAEOK,EAAQD,ECvBf,IAAME,EAAN,cAA4B,KAAM,CAMZ,KAAO,gBAMlB,KAAO,SAMP,YAAYN,EAAiB,CAChC,MAAM,sCAAsCA,CAAO,EAAE,CACzD,CACJ,EAEOO,EAAQD","sourcesContent":["/**\n * Error thrown when file already exists.\n */\nclass AlreadyExistsError extends Error {\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"AlreadyExistsError\";\n\n /**\n * Error code.\n * @type {string}\n */\n public code = \"EEXIST\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EEXIST: ${message}`);\n }\n}\n\nexport default AlreadyExistsError;\n","/**\n * Error thrown when an operation is not allowed on a directory.\n */\nclass DirectoryError extends Error {\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"DirectoryError\";\n\n /**\n * Error code.\n * @type {string}\n */\n public code = \"EISDIR\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EISDIR: Illegal operation on a directory, ${message}`);\n }\n}\n\nexport default DirectoryError;\n","/**\n * Error thrown when a directory is not empty.\n */\nclass NotEmptyError extends Error {\n /**\n * Error code.\n * @type {string}\n */\n public code = \"ENOTEMPTY\";\n\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"NotEmptyError\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOTEMPTY: Directory not empty, ${message}`);\n }\n}\n\nexport default NotEmptyError;\n","/**\n * Error thrown when a file or directory is not found.\n */\nclass NotFoundError extends Error {\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"NotFoundError\";\n\n /**\n * Error code.\n * @type {string}\n */\n public code = \"ENOENT\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOENT: No such file or directory, ${message}`);\n }\n}\n\nexport default NotFoundError;\n"]}
1
+ {"version":3,"sources":["../src/error/already-exists-error.ts","../src/error/directory-error.ts","../src/error/not-empty-error.ts","../src/error/not-found-error.ts"],"names":["AlreadyExistsError","message","_name","already_exists_error_default","DirectoryError","directory_error_default","NotEmptyError","not_empty_error_default","NotFoundError","not_found_error_default"],"mappings":"yFAGA,IAAMA,EAAN,cAAiC,KAAM,CAK5B,YAAYC,EAAiB,CAChC,MAAM,WAAWA,CAAO,EAAE,CAC9B,CAGA,IAAW,MAAe,CACtB,MAAO,QACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,8BAA8B,CAClD,CAGA,IAAoB,MAAe,CAC/B,MAAO,oBACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,6CAA6C,CACjE,CACJ,EAEOC,EAAQH,EC9Bf,IAAMI,EAAN,cAA6B,KAAM,CAKxB,YAAYH,EAAiB,CAChC,MAAM,6CAA6CA,CAAO,EAAE,CAChE,CAGA,IAAW,MAAe,CACtB,MAAO,QACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,8BAA8B,CAClD,CAGA,IAAoB,MAAe,CAC/B,MAAO,gBACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,yCAAyC,CAC7D,CACJ,EAEOG,EAAQD,EC9Bf,IAAME,EAAN,cAA4B,KAAM,CAKvB,YAAYL,EAAiB,CAChC,MAAM,mCAAmCA,CAAO,EAAE,CACtD,CAGA,IAAW,MAAe,CACtB,MAAO,WACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,iCAAiC,CACrD,CAGA,IAAoB,MAAe,CAC/B,MAAO,eACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAC5D,CACJ,EAEOK,EAAQD,EC9Bf,IAAME,EAAN,cAA4B,KAAM,CAKvB,YAAYP,EAAiB,CAChC,MAAM,WAAWA,CAAO,EAAE,CAC9B,CAGA,IAAW,MAAe,CACtB,MAAO,QACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,8BAA8B,CAClD,CAGA,IAAoB,MAAe,CAC/B,MAAO,eACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAC5D,CACJ,EAEOO,EAAQD","sourcesContent":["/**\n * Error thrown when file already exists.\n */\nclass AlreadyExistsError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EEXIST: ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"EEXIST\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code EEXIST\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"AlreadyExistsError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of AlreadyExistsError\");\n }\n}\n\nexport default AlreadyExistsError;\n","/**\n * Error thrown when an operation is not allowed on a directory.\n */\nclass DirectoryError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EISDIR: Illegal operation on a directory, ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"EISDIR\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code EISDIR\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"DirectoryError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of DirectoryError\");\n }\n}\n\nexport default DirectoryError;\n","/**\n * Error thrown when a directory is not empty.\n */\nclass NotEmptyError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOTEMPTY: Directory not empty, ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"ENOTEMPTY\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code ENOTEMPTY\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"NotEmptyError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of NotEmptyError\");\n }\n}\n\nexport default NotEmptyError;\n","/**\n * Error thrown when a file or directory is not found.\n */\nclass NotFoundError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOENT: ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"ENOENT\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code ENOENT\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"NotFoundError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of NotFoundError\");\n }\n}\n\nexport default NotFoundError;\n"]}
package/dist/error.d.cts CHANGED
@@ -1,38 +1,50 @@
1
1
  export { J as JSONError } from './json-error-UVjLdb7z.cjs';
2
2
 
3
3
  declare class AlreadyExistsError extends Error {
4
- readonly name = "AlreadyExistsError";
5
- code: string;
6
4
  constructor(message: string);
5
+ get code(): string;
6
+ set code(_name: string);
7
+ get name(): string;
8
+ set name(_name: string);
7
9
  }
8
10
 
9
11
  declare class DirectoryError extends Error {
10
- readonly name = "DirectoryError";
11
- code: string;
12
12
  constructor(message: string);
13
+ get code(): string;
14
+ set code(_name: string);
15
+ get name(): string;
16
+ set name(_name: string);
13
17
  }
14
18
 
15
19
  declare class NotEmptyError extends Error {
16
- code: string;
17
- readonly name = "NotEmptyError";
18
20
  constructor(message: string);
21
+ get code(): string;
22
+ set code(_name: string);
23
+ get name(): string;
24
+ set name(_name: string);
19
25
  }
20
26
 
21
27
  declare class NotFoundError extends Error {
22
- readonly name = "NotFoundError";
23
- code: string;
24
28
  constructor(message: string);
29
+ get code(): string;
30
+ set code(_name: string);
31
+ get name(): string;
32
+ set name(_name: string);
25
33
  }
26
34
 
27
35
  declare class PermissionError extends Error {
28
- readonly name = "PermissionError";
29
- code: string;
30
36
  constructor(message: string);
37
+ get code(): string;
38
+ set code(_name: string);
39
+ get name(): string;
40
+ set name(_name: string);
31
41
  }
32
42
 
33
43
  declare class WalkError extends Error {
34
44
  root: string;
35
45
  constructor(cause: unknown, root: string);
46
+ get name(): string;
47
+ set name(_name: string);
36
48
  }
37
49
 
38
50
  export { AlreadyExistsError, DirectoryError, NotEmptyError, NotFoundError, PermissionError, WalkError };
package/dist/error.d.ts CHANGED
@@ -1,38 +1,50 @@
1
1
  export { J as JSONError } from './json-error-UVjLdb7z.js';
2
2
 
3
3
  declare class AlreadyExistsError extends Error {
4
- readonly name = "AlreadyExistsError";
5
- code: string;
6
4
  constructor(message: string);
5
+ get code(): string;
6
+ set code(_name: string);
7
+ get name(): string;
8
+ set name(_name: string);
7
9
  }
8
10
 
9
11
  declare class DirectoryError extends Error {
10
- readonly name = "DirectoryError";
11
- code: string;
12
12
  constructor(message: string);
13
+ get code(): string;
14
+ set code(_name: string);
15
+ get name(): string;
16
+ set name(_name: string);
13
17
  }
14
18
 
15
19
  declare class NotEmptyError extends Error {
16
- code: string;
17
- readonly name = "NotEmptyError";
18
20
  constructor(message: string);
21
+ get code(): string;
22
+ set code(_name: string);
23
+ get name(): string;
24
+ set name(_name: string);
19
25
  }
20
26
 
21
27
  declare class NotFoundError extends Error {
22
- readonly name = "NotFoundError";
23
- code: string;
24
28
  constructor(message: string);
29
+ get code(): string;
30
+ set code(_name: string);
31
+ get name(): string;
32
+ set name(_name: string);
25
33
  }
26
34
 
27
35
  declare class PermissionError extends Error {
28
- readonly name = "PermissionError";
29
- code: string;
30
36
  constructor(message: string);
37
+ get code(): string;
38
+ set code(_name: string);
39
+ get name(): string;
40
+ set name(_name: string);
31
41
  }
32
42
 
33
43
  declare class WalkError extends Error {
34
44
  root: string;
35
45
  constructor(cause: unknown, root: string);
46
+ get name(): string;
47
+ set name(_name: string);
36
48
  }
37
49
 
38
50
  export { AlreadyExistsError, DirectoryError, NotEmptyError, NotFoundError, PermissionError, WalkError };
package/dist/error.js CHANGED
@@ -1,8 +1,8 @@
1
- export { b as PermissionError, a as WalkError } from './chunk-3EHZOWRU.js';
1
+ export { b as PermissionError, a as WalkError } from './chunk-X5PFFPHW.js';
2
2
  export { a as JSONError } from './chunk-UPN3Y5W3.js';
3
3
 
4
- var s=class extends Error{name="AlreadyExistsError";code="EEXIST";constructor(r){super(`EEXIST: ${r}`);}},p=s;var a=class extends Error{name="DirectoryError";code="EISDIR";constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`);}},i=a;var l=class extends Error{code="ENOTEMPTY";name="NotEmptyError";constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`);}},n=l;var d=class extends Error{name="NotFoundError";code="ENOENT";constructor(r){super(`ENOENT: No such file or directory, ${r}`);}},f=d;
4
+ var n=class extends Error{constructor(r){super(`EEXIST: ${r}`);}get code(){return "EEXIST"}set code(r){throw new Error("Cannot overwrite code EEXIST")}get name(){return "AlreadyExistsError"}set name(r){throw new Error("Cannot overwrite name of AlreadyExistsError")}},l=n;var i=class extends Error{constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`);}get code(){return "EISDIR"}set code(r){throw new Error("Cannot overwrite code EISDIR")}get name(){return "DirectoryError"}set name(r){throw new Error("Cannot overwrite name of DirectoryError")}},d=i;var a=class extends Error{constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`);}get code(){return "ENOTEMPTY"}set code(r){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return "NotEmptyError"}set name(r){throw new Error("Cannot overwrite name of NotEmptyError")}},p=a;var s=class extends Error{constructor(r){super(`ENOENT: ${r}`);}get code(){return "ENOENT"}set code(r){throw new Error("Cannot overwrite code ENOENT")}get name(){return "NotFoundError"}set name(r){throw new Error("Cannot overwrite name of NotFoundError")}},m=s;
5
5
 
6
- export { p as AlreadyExistsError, i as DirectoryError, n as NotEmptyError, f as NotFoundError };
6
+ export { l as AlreadyExistsError, d as DirectoryError, p as NotEmptyError, m as NotFoundError };
7
7
  //# sourceMappingURL=out.js.map
8
8
  //# sourceMappingURL=error.js.map
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/error/already-exists-error.ts","../src/error/directory-error.ts","../src/error/not-empty-error.ts","../src/error/not-found-error.ts"],"names":["AlreadyExistsError","message","already_exists_error_default","DirectoryError","directory_error_default","NotEmptyError","not_empty_error_default","NotFoundError","not_found_error_default"],"mappings":"uFAGA,IAAMA,EAAN,cAAiC,KAAM,CAMjB,KAAO,qBAMlB,KAAO,SAMP,YAAYC,EAAiB,CAChC,MAAM,WAAWA,CAAO,EAAE,CAC9B,CACJ,EAEOC,EAAQF,ECvBf,IAAMG,EAAN,cAA6B,KAAM,CAMb,KAAO,iBAMlB,KAAO,SAMP,YAAYF,EAAiB,CAChC,MAAM,6CAA6CA,CAAO,EAAE,CAChE,CACJ,EAEOG,EAAQD,ECvBf,IAAME,EAAN,cAA4B,KAAM,CAKvB,KAAO,YAOI,KAAO,gBAMlB,YAAYJ,EAAiB,CAChC,MAAM,mCAAmCA,CAAO,EAAE,CACtD,CACJ,EAEOK,EAAQD,ECvBf,IAAME,EAAN,cAA4B,KAAM,CAMZ,KAAO,gBAMlB,KAAO,SAMP,YAAYN,EAAiB,CAChC,MAAM,sCAAsCA,CAAO,EAAE,CACzD,CACJ,EAEOO,EAAQD","sourcesContent":["/**\n * Error thrown when file already exists.\n */\nclass AlreadyExistsError extends Error {\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"AlreadyExistsError\";\n\n /**\n * Error code.\n * @type {string}\n */\n public code = \"EEXIST\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EEXIST: ${message}`);\n }\n}\n\nexport default AlreadyExistsError;\n","/**\n * Error thrown when an operation is not allowed on a directory.\n */\nclass DirectoryError extends Error {\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"DirectoryError\";\n\n /**\n * Error code.\n * @type {string}\n */\n public code = \"EISDIR\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EISDIR: Illegal operation on a directory, ${message}`);\n }\n}\n\nexport default DirectoryError;\n","/**\n * Error thrown when a directory is not empty.\n */\nclass NotEmptyError extends Error {\n /**\n * Error code.\n * @type {string}\n */\n public code = \"ENOTEMPTY\";\n\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"NotEmptyError\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOTEMPTY: Directory not empty, ${message}`);\n }\n}\n\nexport default NotEmptyError;\n","/**\n * Error thrown when a file or directory is not found.\n */\nclass NotFoundError extends Error {\n /**\n * Name of the error class.\n * @type {string}\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n override readonly name = \"NotFoundError\";\n\n /**\n * Error code.\n * @type {string}\n */\n public code = \"ENOENT\";\n\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOENT: No such file or directory, ${message}`);\n }\n}\n\nexport default NotFoundError;\n"]}
1
+ {"version":3,"sources":["../src/error/already-exists-error.ts","../src/error/directory-error.ts","../src/error/not-empty-error.ts","../src/error/not-found-error.ts"],"names":["AlreadyExistsError","message","_name","already_exists_error_default","DirectoryError","directory_error_default","NotEmptyError","not_empty_error_default","NotFoundError","not_found_error_default"],"mappings":"uFAGA,IAAMA,EAAN,cAAiC,KAAM,CAK5B,YAAYC,EAAiB,CAChC,MAAM,WAAWA,CAAO,EAAE,CAC9B,CAGA,IAAW,MAAe,CACtB,MAAO,QACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,8BAA8B,CAClD,CAGA,IAAoB,MAAe,CAC/B,MAAO,oBACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,6CAA6C,CACjE,CACJ,EAEOC,EAAQH,EC9Bf,IAAMI,EAAN,cAA6B,KAAM,CAKxB,YAAYH,EAAiB,CAChC,MAAM,6CAA6CA,CAAO,EAAE,CAChE,CAGA,IAAW,MAAe,CACtB,MAAO,QACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,8BAA8B,CAClD,CAGA,IAAoB,MAAe,CAC/B,MAAO,gBACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,yCAAyC,CAC7D,CACJ,EAEOG,EAAQD,EC9Bf,IAAME,EAAN,cAA4B,KAAM,CAKvB,YAAYL,EAAiB,CAChC,MAAM,mCAAmCA,CAAO,EAAE,CACtD,CAGA,IAAW,MAAe,CACtB,MAAO,WACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,iCAAiC,CACrD,CAGA,IAAoB,MAAe,CAC/B,MAAO,eACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAC5D,CACJ,EAEOK,EAAQD,EC9Bf,IAAME,EAAN,cAA4B,KAAM,CAKvB,YAAYP,EAAiB,CAChC,MAAM,WAAWA,CAAO,EAAE,CAC9B,CAGA,IAAW,MAAe,CACtB,MAAO,QACX,CAGA,IAAW,KAAKC,EAAO,CACnB,MAAM,IAAI,MAAM,8BAA8B,CAClD,CAGA,IAAoB,MAAe,CAC/B,MAAO,eACX,CAGA,IAAoB,KAAKA,EAAO,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAC5D,CACJ,EAEOO,EAAQD","sourcesContent":["/**\n * Error thrown when file already exists.\n */\nclass AlreadyExistsError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EEXIST: ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"EEXIST\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code EEXIST\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"AlreadyExistsError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of AlreadyExistsError\");\n }\n}\n\nexport default AlreadyExistsError;\n","/**\n * Error thrown when an operation is not allowed on a directory.\n */\nclass DirectoryError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`EISDIR: Illegal operation on a directory, ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"EISDIR\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code EISDIR\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"DirectoryError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of DirectoryError\");\n }\n}\n\nexport default DirectoryError;\n","/**\n * Error thrown when a directory is not empty.\n */\nclass NotEmptyError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOTEMPTY: Directory not empty, ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"ENOTEMPTY\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code ENOTEMPTY\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"NotEmptyError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of NotEmptyError\");\n }\n}\n\nexport default NotEmptyError;\n","/**\n * Error thrown when a file or directory is not found.\n */\nclass NotFoundError extends Error {\n /**\n * Creates a new instance.\n * @param {string} message The error message.\n */\n public constructor(message: string) {\n super(`ENOENT: ${message}`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"ENOENT\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code ENOENT\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"NotFoundError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of NotFoundError\");\n }\n}\n\nexport default NotFoundError;\n"]}