@visulima/fs 5.0.11 → 6.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 +16 -0
- package/LICENSE.md +33 -22
- package/README.md +6 -6
- package/dist/glob.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/ini.d.ts +2 -2
- package/dist/ini.js +1 -1
- package/dist/json5.d.ts +2 -2
- package/dist/json5.js +1 -1
- package/dist/jsonc.d.ts +2 -2
- package/dist/jsonc.js +1 -1
- package/dist/packem_shared/{collect-B0S0bJoE.js → collect-Dbo3K4iq.js} +1 -1
- package/dist/packem_shared/{collectSync-0M1eoilI.js → collectSync-BLLtRqQ4.js} +1 -1
- package/dist/packem_shared/{findUp-Ylerv_a2.js → findUp-BHCEMf5y.js} +1 -1
- package/dist/packem_shared/{findUpSync-BWBPRzEq.js → findUpSync-BKJsHMQN.js} +1 -1
- package/dist/packem_shared/{glob-sync.d-DaAZHTsv.d.ts → glob-sync.d-SlQXhcIG.d.ts} +1 -1
- package/dist/packem_shared/indexToLineColumn-BfkIsWHQ-DQJmePiQ.js +6 -0
- package/dist/packem_shared/parseJson-lm3MUNdf.js +1 -0
- package/dist/packem_shared/{readJson-Q3T3RlSy.js → readJson-DV2KxaEJ.js} +1 -1
- package/dist/packem_shared/{readJsonSync-BnWiH5-R.js → readJsonSync-DweZd5ZA.js} +1 -1
- package/dist/packem_shared/readJsonc-Dqh-elUt.js +1 -0
- package/dist/packem_shared/{readJsoncSync-CLtlvFKV.js → readJsoncSync-Dy2PZG5g.js} +1 -1
- package/dist/packem_shared/readYaml-BT3HBFQv.js +1 -0
- package/dist/packem_shared/readYamlSync-Cx-zy2cS.js +1 -0
- package/dist/packem_shared/types.d-CgCO6qUp.d.ts +958 -0
- package/dist/packem_shared/walk-B211aFS7.js +1 -0
- package/dist/packem_shared/walk-include-2NQzWTCI.js +1 -0
- package/dist/packem_shared/walkSync-VeMvHYLk.js +1 -0
- package/dist/packem_shared/writeFile-Dnba9aVe.js +1 -0
- package/dist/packem_shared/writeFileSync-pW8o2DG1.js +1 -0
- package/dist/packem_shared/{writeIni-CKinbquM.js → writeIni-DgZ-0EUD.js} +1 -1
- package/dist/packem_shared/{writeIniSync-BISRFyg0.js → writeIniSync-Buz4Cove.js} +2 -2
- package/dist/packem_shared/{writeJson-DlCrFMXb.js → writeJson-vexC7dw2.js} +2 -2
- package/dist/packem_shared/{writeJson5-rSp3QAKP.js → writeJson5-DeW_smOs.js} +2 -2
- package/dist/packem_shared/{writeJson5Sync-tSBBKnaP.js → writeJson5Sync-Cz5pwaPh.js} +2 -2
- package/dist/packem_shared/{writeJsonSync-CKqVRz_9.js → writeJsonSync-DJLfN5iT.js} +2 -2
- package/dist/packem_shared/{writeJsonc-bxz1jdeU.js → writeJsonc-BqJQS0Mk.js} +2 -2
- package/dist/packem_shared/{writeJsoncSync-C-W0H9qP.js → writeJsoncSync-CchlR2KW.js} +2 -2
- package/dist/packem_shared/{writeToml-CrpfWNyK.js → writeToml-Bn-wQdaM.js} +1 -1
- package/dist/packem_shared/{writeTomlSync-DveRchLG.js → writeTomlSync-CTv4RXkJ.js} +1 -1
- package/dist/packem_shared/writeYaml-CpWDXOUF.js +1 -0
- package/dist/packem_shared/writeYamlSync-9MG5_lNI.js +1 -0
- package/dist/toml.d.ts +1 -1
- package/dist/toml.js +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +1 -1
- package/package.json +28 -28
- package/dist/packem_shared/parseJson-_OfIPruP.js +0 -1
- package/dist/packem_shared/readJsonc-DSoFyuDk.js +0 -1
- package/dist/packem_shared/readYaml-DcpUq11D.js +0 -1
- package/dist/packem_shared/readYamlSync-D5RVZwco.js +0 -1
- package/dist/packem_shared/renderError-DjesnVYT-pWsLqw-_.js +0 -6
- package/dist/packem_shared/types.d-D3Jo_iA-.d.ts +0 -1751
- package/dist/packem_shared/walk-BReeHTKb.js +0 -1
- package/dist/packem_shared/walk-include-BXhGSn6t.js +0 -1
- package/dist/packem_shared/walkSync-yHJUIJb9.js +0 -1
- package/dist/packem_shared/writeFile-srDcYaRC.js +0 -1
- package/dist/packem_shared/writeFileSync-Ddl_u4my.js +0 -1
- package/dist/packem_shared/writeYaml-DvSQ_Jbn.js +0 -1
- package/dist/packem_shared/writeYamlSync-CEf0PUGQ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as q}from"node:module";import{resolve as E,join as M,normalize as x,basename as I}from"@visulima/path";import{toPath as V}from"@visulima/path/utils";import D from"./WalkError-B8qTd-v-.js";import z from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as F,s as d,l as y}from"./walk-include-2NQzWTCI.js";let N;const P=e=>(N??=q(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[s,o]=c.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return c.getBuiltinModule(e)}return P(e)},{readdir:$,realpath:B,stat:T}=R("node:fs/promises"),L=async e=>{const s=x(e),o=I(s),r=await T(s);return y(r,o,s)};async function*O(e,s={}){const{extensions:o,followSymlinks:r=!1,includeDirs:_=!0,includeFiles:h=!0,includeSymlinks:w=!0,match:g,maxDepth:u=Number.POSITIVE_INFINITY,skip:v}=s;if(z(e),u<0)return;const f=s.visited??new Set,l=g?g.map(i=>typeof i=="string"?F(i):i):void 0,a=v?v.map(i=>typeof i=="string"?F(i):i):void 0;if(e=E(V(e)),_&&d(e,o,l,a)&&(yield await L(e)),!(u<1||!d(e,void 0,void 0,a)))try{const i=await $(e,{withFileTypes:!0});for(const n of i){let t=M(e,n.name),b=n,{name:k}=n,S=n.isDirectory(),j=n.isFile();if(n.isSymbolicLink())if(r){const m=x(await B(t));if(f.has(m))continue;t=m;const p=await T(m);S=p.isDirectory(),j=p.isFile(),b=p,k=I(m)}else if(w&&d(t,o,l,a)){yield y(n,n.name,t);continue}else continue;S?(r&&f.add(t),yield*O(t,{extensions:o,followSymlinks:r,includeDirs:_,includeFiles:h,includeSymlinks:w,match:l,maxDepth:u-1,skip:a,visited:f})):j&&h&&d(t,o,l,a)&&(yield y(b,k,t))}}catch(i){throw i instanceof D?i:new D(i,e)}}export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l=e=>{const r=[],t=new Set;let s=0;for(const a of e){if(a==="{")r.push(s);else if(a==="}"){const o=r.pop();o!==void 0&&(t.add(o),t.add(s))}s+=1}let c=0,n=0,i="";for(const a of e)a==="{"?t.has(n)?(i+="(",c+=1):i+=String.raw`\{`:a==="}"?t.has(n)?(i+=")",c-=1):i+=String.raw`\}`:a===","&&c>0?i+="|":i+=a,n+=1;return i},g=e=>{const r=e.replace(/[$()+\\^]/g,String.raw`\$&`).replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`),t=l(r).replace(/\[!(.*?)\]/g,"[^$1]");try{return new RegExp(`^${t}$`)}catch(s){throw new Error(`Invalid glob pattern: ${e}`,{cause:s})}};class p{name;path;#e;constructor(r,t,s){this.#e=r,this.name=t,this.path=s}isDirectory(){return this.#e.isDirectory()}isFile(){return this.#e.isFile()}isSymbolicLink(){return this.#e.isSymbolicLink()}}const h=(e,r,t)=>new p(e,r,t),u=(e,r,t,s)=>{if(Array.isArray(r)&&r.length>0&&!r.some(n=>e.endsWith(n)))return!1;const c=e.includes("\\")?e.replaceAll("\\","/"):e;return t&&!t.some(n=>n.test(c))?!1:!s?.some(n=>n.test(c))};export{g,h as l,u as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as q}from"node:module";import{resolve as E,join as M,normalize as u,basename as x}from"@visulima/path";import{toPath as O}from"@visulima/path/utils";import F from"./WalkError-B8qTd-v-.js";import V from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as I,s as m,l as _}from"./walk-include-2NQzWTCI.js";let N;const $=e=>(N??=q(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[o,s]=c.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return c.getBuiltinModule(e)}return $(e)},{readdirSync:R,realpathSync:B,statSync:T}=P("node:fs"),z=e=>{const o=u(e),s=T(o);return _(s,x(o),o)};function*L(e,o={}){const{extensions:s,followSymlinks:d=!1,includeDirs:h=!0,includeFiles:S=!0,includeSymlinks:g=!0,match:v,maxDepth:f=Number.POSITIVE_INFINITY,skip:k}=o;if(V(e),f<0)return;const p=o.visited??new Set,l=v?v.map(i=>typeof i=="string"?I(i):i):void 0,r=k?k.map(i=>typeof i=="string"?I(i):i):void 0;if(e=E(O(e)),h&&m(e,s,l,r)&&(yield z(e)),!(f<1||!m(e,void 0,void 0,r)))try{const i=R(e,{withFileTypes:!0});for(const n of i){let t=M(e,n.name),b=n,{name:j}=n,w=n.isDirectory(),D=n.isFile();if(n.isSymbolicLink())if(d){const a=u(B(t));if(p.has(a))continue;t=a;const y=T(a);w=y.isDirectory(),D=y.isFile(),b=y,j=x(a)}else if(g&&m(t,s,l,r)){yield _(n,n.name,u(t));continue}else continue;w?(d&&p.add(t),yield*L(t,{extensions:s,followSymlinks:d,includeDirs:h,includeFiles:S,includeSymlinks:g,match:l,maxDepth:f-1,skip:r,visited:p})):D&&S&&m(t,s,l,r)&&(yield _(b,j,u(t)))}}catch(i){throw i instanceof F?i:new F(i,e)}}export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as w}from"node:module";import{dirname as x}from"@visulima/path";import{toPath as B}from"@visulima/path/utils";import{F_OK as F}from"./FIND_UP_STOP-CAwY1qU7.js";import R from"./AlreadyExistsError-DEb3UWja.js";import d from"./isAccessible-B7guOm3k.js";import T from"./assertValidFileContents-CbIN7sy7.js";import M from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{o as P,i as E}from"./to-uint-8-array-7sXMoZwU.js";let p;const g=e=>(p??=w(import.meta.url))(e),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[o,i]=a.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return a.getBuiltinModule(e)}return g(e)},{mkdir:h,readFile:v,writeFile:y,stat:b,rename:u,chown:j,chmod:k,unlink:q}=_("node:fs/promises"),I=async(e,o,i)=>{i={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...i},M(e),T(o),e=B(e);const n=await d(e,F),c=i.flag??"w",m=c.includes("a"),l=c.includes("x");if(n&&(!i.overwrite||l))throw new R(`file already exists, open '${e}'`);const r=P(e);try{!n&&i.recursive&&await h(x(e),{recursive:!0});let t,s=typeof o=="string"?Buffer.from(o,i.encoding??"utf8"):E(o);if(m&&n&&(s=Buffer.concat([await v(e),s])),await y(r,s,{flag:"wx"}),n&&i.backup&&(t=await b(e),i.chown??={gid:t.gid,uid:t.uid},await u(e,`${e}.bak`)),i.chown)try{await j(r,i.chown.uid,i.chown.gid)}catch{}const f=t&&i.mode===void 0?t.mode:i.mode;f!==void 0&&await k(r,f),await u(r,e)}catch(t){throw new Error(`Failed to write file at: ${e} - ${t.message}`,{cause:t})}finally{await d(r)&&await q(r)}};export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as p}from"node:module";import{dirname as q}from"@visulima/path";import{toPath as x}from"@visulima/path/utils";import{F_OK as B}from"./FIND_UP_STOP-CAwY1qU7.js";import F from"./AlreadyExistsError-DEb3UWja.js";import f from"./isAccessibleSync-XH4YleJW.js";import R from"./assertValidFileContents-CbIN7sy7.js";import T from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{o as M,i as P}from"./to-uint-8-array-7sXMoZwU.js";let g;const w=e=>(g??=p(import.meta.url))(e),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[i,o]=n.versions.node.split(".").map(Number);if(i>22||i===22&&o>=3||i===20&&o>=16)return n.getBuiltinModule(e)}return w(e)},{mkdirSync:_,readFileSync:h,writeFileSync:v,statSync:S,renameSync:d,chownSync:b,chmodSync:j,unlinkSync:k}=y("node:fs"),H=(e,i,o)=>{o={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...o},T(e),R(i),e=x(e);const c=f(e,B),a=o.flag??"w",m=a.includes("a"),l=a.includes("x");if(c&&(!o.overwrite||l))throw new F(`file already exists, open '${e}'`);const r=M(e);try{!c&&o.recursive&&_(q(e),{recursive:!0});let t,s=typeof i=="string"?Buffer.from(i,o.encoding??"utf8"):P(i);if(m&&c&&(s=Buffer.concat([h(e),s])),v(r,s,{flag:"wx"}),c&&o.backup&&(t=S(e),o.chown??={gid:t.gid,uid:t.uid},d(e,`${e}.bak`)),o.chown)try{b(r,o.chown.uid,o.chown.gid)}catch{}const u=t&&o.mode===void 0?t.mode:o.mode;u!==void 0&&j(r,u),d(r,e)}catch(t){throw new Error(`Failed to write file at: ${e} - ${t.message}`,{cause:t})}finally{f(r)&&k(r)}};export{H as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as q}from"node:module";import{parse as I,stringify as N}from"ini";import{R_OK as O}from"./FIND_UP_STOP-CAwY1qU7.js";import B from"./isAccessible-B7guOm3k.js";import{d as L,m as M}from"./ini-preserve-D1DopDLd.js";import P from"./writeFile-
|
|
1
|
+
import{createRequire as q}from"node:module";import{parse as I,stringify as N}from"ini";import{R_OK as O}from"./FIND_UP_STOP-CAwY1qU7.js";import B from"./isAccessible-B7guOm3k.js";import{d as L,m as M}from"./ini-preserve-D1DopDLd.js";import P from"./writeFile-Dnba9aVe.js";let A;const R=e=>(A??=q(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,n]=i.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return i.getBuiltinModule(e)}return R(e)},{readFile:E}=T("node:fs/promises"),D=async(e,t,n={})=>{const{eol:_,preserveStyle:g=!0,whitespace:y,...h}=n,{align:w,bracketedArray:l,newline:b,platform:v,section:p,sort:j,...k}=h;let a=_,d=y,o,c;if(g&&await B(e,O))try{o=await E(e,"utf8"),c=I(o,{bracketedArray:l??!0});const r=L(o);a??=r.eol,d??=r.whitespace}catch(r){if(r.code!=="ENOENT")throw r}const f={align:w,bracketedArray:l,newline:b,platform:v,section:p,sort:j,whitespace:d},m=(r,u)=>N(r,u===void 0?f:{...f,section:u});let s;o!==void 0&&c?s=M(o,c,t,m,{eol:a??`
|
|
2
2
|
`}):(s=m(t,p),a===`\r
|
|
3
3
|
`&&(s=s.replaceAll(/\r?\n/g,`\r
|
|
4
4
|
`))),await P(e,s,k)};export{D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as A}from"node:module";import{parse as E,stringify as I}from"ini";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import O from"./isAccessibleSync-XH4YleJW.js";import{d as B,m as L}from"./ini-preserve-D1DopDLd.js";import M from"./writeFileSync-pW8o2DG1.js";let R;const S=e=>(R??=A(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,n]=i.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return i.getBuiltinModule(e)}return S(e)},{readFileSync:k}=T("node:fs"),D=(e,t,n={})=>{const{eol:_,preserveStyle:g=!0,whitespace:y,...h}=n,{align:b,bracketedArray:a,newline:v,platform:w,section:p,sort:j,...q}=h;let c=_,f=y,o,l;if(g&&O(e,N))try{o=k(e,"utf8"),l=E(o,{bracketedArray:a??!0});const r=B(o);c??=r.eol,f??=r.whitespace}catch(r){if(r.code!=="ENOENT")throw r}const d={align:b,bracketedArray:a,newline:v,platform:w,section:p,sort:j,whitespace:f},m=(r,u)=>I(r,u===void 0?d:{...d,section:u});let s;o!==void 0&&l?s=L(o,l,t,m,{eol:c??`
|
|
2
2
|
`}):(s=m(t,p),c===`\r
|
|
3
3
|
`&&(s=s.replaceAll(/\r?\n/g,`\r
|
|
4
|
-
`))),M(e,s,
|
|
4
|
+
`))),M(e,s,q)};export{D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";import{k as j}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./isAccessible-B7guOm3k.js";import q from"./writeFile-
|
|
1
|
+
import{createRequire as l}from"node:module";import{k as j}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./isAccessible-B7guOm3k.js";import q from"./writeFile-Dnba9aVe.js";let _;const g=e=>(_??=l(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return g(e)},{readFile:y}=h("node:fs/promises"),B=async(e,t,r={})=>{const{detectIndent:c,indent:a,replacer:f,stringify:d=JSON.stringify,...p}={indent:" ",...r};let s=a,n=`
|
|
2
2
|
`;if(await b(e,N))try{const i=await y(e,"utf8");if(c){const{indent:u}=j(i);s=u}n=i.endsWith(`
|
|
3
3
|
`)?`
|
|
4
|
-
`:""}catch(i){if(i.code!=="ENOENT")throw i}const m=d(t,f,s);await q(e,`${m}${n}`,p)};export{
|
|
4
|
+
`:""}catch(i){if(i.code!=="ENOENT")throw i}const m=d(t,f,s);await q(e,`${m}${n}`,p)};export{B as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";import{k as q}from"./index-B2MhYg3r.js";import y from"json5";import{R_OK as b}from"./FIND_UP_STOP-CAwY1qU7.js";import w from"./isAccessible-B7guOm3k.js";import N from"./writeFile-
|
|
1
|
+
import{createRequire as l}from"node:module";import{k as q}from"./index-B2MhYg3r.js";import y from"json5";import{R_OK as b}from"./FIND_UP_STOP-CAwY1qU7.js";import w from"./isAccessible-B7guOm3k.js";import N from"./writeFile-Dnba9aVe.js";let _;const g=e=>(_??=l(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[t,i]=r.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return r.getBuiltinModule(e)}return g(e)},{readFile:j}=h("node:fs/promises"),O=async(e,t,i={})=>{const{detectIndent:a,indent:f,quote:p,replacer:d,...u}={indent:" ",...i};let s=f,n=`
|
|
2
2
|
`;if(await w(e,b))try{const o=await j(e,"utf8");if(a){const{indent:c}=q(o);c&&(s=c)}n=o.endsWith(`
|
|
3
3
|
`)?`
|
|
4
|
-
`:""}catch(o){if(o.code!=="ENOENT")throw o}const m=y.stringify(t,{quote:
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const m=y.stringify(t,{quote:p,replacer:d,space:s});await N(e,`${m}${n}`,u)};export{O as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as a}from"node:module";import{k as q}from"./index-B2MhYg3r.js";import y from"json5";import{R_OK as b}from"./FIND_UP_STOP-CAwY1qU7.js";import R from"./isAccessibleSync-XH4YleJW.js";import T from"./writeFileSync-
|
|
1
|
+
import{createRequire as a}from"node:module";import{k as q}from"./index-B2MhYg3r.js";import y from"json5";import{R_OK as b}from"./FIND_UP_STOP-CAwY1qU7.js";import R from"./isAccessibleSync-XH4YleJW.js";import T from"./writeFileSync-pW8o2DG1.js";let _;const g=e=>(_??=a(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[t,s]=r.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return r.getBuiltinModule(e)}return g(e)},{readFileSync:j}=h("node:fs"),O=(e,t,s={})=>{const{detectIndent:f,indent:d,quote:p,replacer:u,...l}={indent:" ",...s};let i=d,n=`
|
|
2
2
|
`;if(R(e,b))try{const o=j(e,"utf8");if(f){const{indent:c}=q(o);c&&(i=c)}n=o.endsWith(`
|
|
3
3
|
`)?`
|
|
4
|
-
`:""}catch(o){if(o.code!=="ENOENT")throw o}const m=y.stringify(t,{quote:p,replacer:u,space:i});T(e,`${m}${n}`,l)};export{
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const m=y.stringify(t,{quote:p,replacer:u,space:i});T(e,`${m}${n}`,l)};export{O as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as _}from"node:module";import{k as j}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./isAccessibleSync-XH4YleJW.js";import q from"./writeFileSync-
|
|
1
|
+
import{createRequire as _}from"node:module";import{k as j}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./isAccessibleSync-XH4YleJW.js";import q from"./writeFileSync-pW8o2DG1.js";let a;const g=e=>(a??=_(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[t,n]=r.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return r.getBuiltinModule(e)}return g(e)},{readFileSync:y}=h("node:fs"),B=(e,t,n={})=>{const{detectIndent:c,indent:f,replacer:d,stringify:p=JSON.stringify,...l}={indent:" ",...n};let i=f,s=`
|
|
2
2
|
`;if(b(e,N))try{const o=y(e,"utf8");if(c){const{indent:m}=j(o);i=m}s=o.endsWith(`
|
|
3
3
|
`)?`
|
|
4
|
-
`:""}catch(o){if(o.code!=="ENOENT")throw o}const u=
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const u=p(t,d,i);q(e,`${u}${s}`,l)};export{B as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as f}from"node:module";import{k as h}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import j from"./isAccessible-B7guOm3k.js";import{b as y}from"./jsonc-merge-Bkw73TLW.js";import T from"./writeFile-
|
|
1
|
+
import{createRequire as f}from"node:module";import{k as h}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import j from"./isAccessible-B7guOm3k.js";import{b as y}from"./jsonc-merge-Bkw73TLW.js";import T from"./writeFile-Dnba9aVe.js";let _;const g=e=>(_??=f(import.meta.url))(e),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[t,n]=a.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return a.getBuiltinModule(e)}return g(e)},{readFile:b}=w("node:fs/promises"),x=async(e,t,n)=>{let r,o=n,s=`
|
|
2
2
|
`;if(!await j(e,N))return{indent:o,trailingNewline:s};try{if(r=await b(e,"utf8"),t){const{indent:i}=h(r);i&&(o=i)}s=r.endsWith(`
|
|
3
3
|
`)?`
|
|
4
|
-
`:""}catch(i){if(i.code!=="ENOENT")throw i}return{existingText:r,indent:o,trailingNewline:s}},M=async(e,t,n={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:i=!0,replacer:c,...d}={indent:" ",...n},{existingText:l,indent:
|
|
4
|
+
`:""}catch(i){if(i.code!=="ENOENT")throw i}return{existingText:r,indent:o,trailingNewline:s}},M=async(e,t,n={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:i=!0,replacer:c,...d}={indent:" ",...n},{existingText:l,indent:p,trailingNewline:u}=await x(e,r,s),m=y(l,t,i,p,u,o,c);await T(e,m,d)};export{M as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as a}from"node:module";import{k as b}from"./index-B2MhYg3r.js";import{R_OK as j}from"./FIND_UP_STOP-CAwY1qU7.js";import T from"./isAccessibleSync-XH4YleJW.js";import{b as x}from"./jsonc-merge-Bkw73TLW.js";import y from"./writeFileSync-
|
|
1
|
+
import{createRequire as a}from"node:module";import{k as b}from"./index-B2MhYg3r.js";import{R_OK as j}from"./FIND_UP_STOP-CAwY1qU7.js";import T from"./isAccessibleSync-XH4YleJW.js";import{b as x}from"./jsonc-merge-Bkw73TLW.js";import y from"./writeFileSync-pW8o2DG1.js";let _;const g=e=>(_??=a(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[t,i]=c.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return c.getBuiltinModule(e)}return g(e)},{readFileSync:N}=h("node:fs"),O=(e,t,i)=>{let r,o=i,s=`
|
|
2
2
|
`;if(!T(e,j))return{indent:o,trailingNewline:s};try{if(r=N(e,"utf8"),t){const{indent:n}=b(r);n&&(o=n)}s=r.endsWith(`
|
|
3
3
|
`)?`
|
|
4
|
-
`:""}catch(n){if(n.code!=="ENOENT")throw n}return{existingText:r,indent:o,trailingNewline:s}},M=(e,t,i={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:n=!0,replacer:d,...l}={indent:" ",...i},{existingText:u,indent:f,trailingNewline:
|
|
4
|
+
`:""}catch(n){if(n.code!=="ENOENT")throw n}return{existingText:r,indent:o,trailingNewline:s}},M=(e,t,i={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:n=!0,replacer:d,...l}={indent:" ",...i},{existingText:u,indent:f,trailingNewline:p}=O(e,r,s),m=x(u,t,n,f,p,o,d);y(e,m,l)};export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stringify as a}from"smol-toml";import i from"./writeFile-
|
|
1
|
+
import{stringify as a}from"smol-toml";import i from"./writeFile-Dnba9aVe.js";const p=async(t,o,r)=>{await i(t,a(o),r)};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stringify as f}from"smol-toml";import i from"./writeFileSync-
|
|
1
|
+
import{stringify as f}from"smol-toml";import i from"./writeFileSync-pW8o2DG1.js";const e=(o,r,t)=>{i(o,f(r),t)};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as n}from"@visulima/yaml";import t from"./writeFile-Dnba9aVe.js";async function l(p,c,e,f){let r,a,o;typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e!="function"?(r=e,a=r.replacer,o=r.space):typeof f=="object"?(r=f,a=e,o=r.space):(a=e,o=f);const i=n(c,a,o??r);await t(p,i,r)}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as n}from"@visulima/yaml";import t from"./writeFileSync-pW8o2DG1.js";function y(a,c,e,f){let r,o,p;typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e!="function"?(r=e,o=r.replacer,p=r.space):typeof f=="object"?(r=f,o=e,p=r.space):(o=e,p=f);const i=n(c,o,p??r);t(a,i,r)}export{y as default};
|
package/dist/toml.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CompressionType, i as ReadTomlOptions, j as WriteTomlOptions } from "./packem_shared/types.d-
|
|
1
|
+
import { C as CompressionType, i as ReadTomlOptions, j as WriteTomlOptions } from "./packem_shared/types.d-CgCO6qUp.js";
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'fdir';
|
|
4
4
|
/**
|
package/dist/toml.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./packem_shared/readToml-CN_xnICv.js";import{default as t}from"./packem_shared/readTomlSync-B9TVGzen.js";import{default as l}from"./packem_shared/writeToml-
|
|
1
|
+
import{default as r}from"./packem_shared/readToml-CN_xnICv.js";import{default as t}from"./packem_shared/readTomlSync-B9TVGzen.js";import{default as l}from"./packem_shared/writeToml-Bn-wQdaM.js";import{default as d}from"./packem_shared/writeTomlSync-CTv4RXkJ.js";export{r as readToml,t as readTomlSync,l as writeToml,d as writeTomlSync};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { J as JSONError } from "./packem_shared/json-error.d-COL8oxF_.js";
|
|
2
2
|
import { JsonValue } from 'type-fest';
|
|
3
|
-
import { k as CodeFrameOptions, l as JsonReviver } from "./packem_shared/types.d-
|
|
3
|
+
import { k as CodeFrameOptions, l as JsonReviver } from "./packem_shared/types.d-CgCO6qUp.js";
|
|
4
4
|
export { toPath } from '@visulima/path/utils';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'fdir';
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"./packem_shared/JSONError-Cvp9ycba.js";import{default as a}from"./packem_shared/assertValidFileContents-CbIN7sy7.js";import{default as f}from"./packem_shared/assertValidFileOrDirectoryPath-BTlt945W.js";import{default as m}from"./packem_shared/parseJson-
|
|
1
|
+
import{default as e}from"./packem_shared/JSONError-Cvp9ycba.js";import{default as a}from"./packem_shared/assertValidFileContents-CbIN7sy7.js";import{default as f}from"./packem_shared/assertValidFileOrDirectoryPath-BTlt945W.js";import{default as m}from"./packem_shared/parseJson-lm3MUNdf.js";import{default as d}from"./packem_shared/stripJsonComments-Bfcn2PKv.js";import{toPath as x}from"@visulima/path/utils";export{e as JSONError,a as assertValidFileContents,f as assertValidFileOrDirectoryPath,m as parseJson,d as stripJsonComments,x as toPath};
|
package/dist/yaml.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CompressionType, m as ReadYamlOptions, Y as YamlReviver, n as WriteYamlOptions, o as JsonReplacer } from "./packem_shared/types.d-
|
|
2
|
-
export type { p as YamlReplacer } from "./packem_shared/types.d-
|
|
1
|
+
import { C as CompressionType, m as ReadYamlOptions, Y as YamlReviver, n as WriteYamlOptions, o as JsonReplacer } from "./packem_shared/types.d-CgCO6qUp.js";
|
|
2
|
+
export type { p as YamlReplacer } from "./packem_shared/types.d-CgCO6qUp.js";
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'fdir';
|
|
5
5
|
declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<CompressionType>): Promise<R>;
|
package/dist/yaml.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./packem_shared/readYaml-
|
|
1
|
+
import{default as r}from"./packem_shared/readYaml-BT3HBFQv.js";import{default as f}from"./packem_shared/readYamlSync-Cx-zy2cS.js";import{default as m}from"./packem_shared/writeYaml-CpWDXOUF.js";import{default as d}from"./packem_shared/writeYamlSync-9MG5_lNI.js";export{r as readYaml,f as readYamlSync,m as writeYaml,d as writeYamlSync};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/fs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Human friendly file system utilities for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -61,11 +61,6 @@
|
|
|
61
61
|
],
|
|
62
62
|
"homepage": "https://visulima.com/packages/fs/",
|
|
63
63
|
"bugs": "https://github.com/visulima/visulima/issues",
|
|
64
|
-
"license": "MIT",
|
|
65
|
-
"author": {
|
|
66
|
-
"name": "Daniel Bannert",
|
|
67
|
-
"email": "d.bannert@anolilab.de"
|
|
68
|
-
},
|
|
69
64
|
"repository": {
|
|
70
65
|
"type": "git",
|
|
71
66
|
"url": "git+https://github.com/visulima/visulima.git",
|
|
@@ -81,19 +76,13 @@
|
|
|
81
76
|
"url": "https://anolilab.com/support"
|
|
82
77
|
}
|
|
83
78
|
],
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
],
|
|
90
|
-
"os": [
|
|
91
|
-
"darwin",
|
|
92
|
-
"linux",
|
|
93
|
-
"win32"
|
|
94
|
-
],
|
|
95
|
-
"type": "module",
|
|
79
|
+
"license": "MIT",
|
|
80
|
+
"author": {
|
|
81
|
+
"name": "Daniel Bannert",
|
|
82
|
+
"email": "d.bannert@anolilab.de"
|
|
83
|
+
},
|
|
96
84
|
"sideEffects": false,
|
|
85
|
+
"type": "module",
|
|
97
86
|
"exports": {
|
|
98
87
|
".": {
|
|
99
88
|
"types": "./dist/index.d.ts",
|
|
@@ -153,21 +142,26 @@
|
|
|
153
142
|
},
|
|
154
143
|
"./package.json": "./package.json"
|
|
155
144
|
},
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
|
|
145
|
+
"files": [
|
|
146
|
+
"dist/**",
|
|
147
|
+
"README.md",
|
|
148
|
+
"CHANGELOG.md",
|
|
149
|
+
"LICENSE.md"
|
|
150
|
+
],
|
|
160
151
|
"dependencies": {
|
|
161
|
-
"@visulima/path": "
|
|
152
|
+
"@visulima/path": "4.0.0"
|
|
162
153
|
},
|
|
163
154
|
"peerDependencies": {
|
|
155
|
+
"@visulima/yaml": "1.0.0",
|
|
164
156
|
"ini": "^7.0.0",
|
|
165
157
|
"json5": "^2.2.3",
|
|
166
158
|
"jsonc-parser": "^3.3.1",
|
|
167
|
-
"smol-toml": "^1.7.0"
|
|
168
|
-
"yaml": ">=2.9.0"
|
|
159
|
+
"smol-toml": "^1.7.0"
|
|
169
160
|
},
|
|
170
161
|
"peerDependenciesMeta": {
|
|
162
|
+
"@visulima/yaml": {
|
|
163
|
+
"optional": true
|
|
164
|
+
},
|
|
171
165
|
"ini": {
|
|
172
166
|
"optional": true
|
|
173
167
|
},
|
|
@@ -179,12 +173,18 @@
|
|
|
179
173
|
},
|
|
180
174
|
"smol-toml": {
|
|
181
175
|
"optional": true
|
|
182
|
-
},
|
|
183
|
-
"yaml": {
|
|
184
|
-
"optional": true
|
|
185
176
|
}
|
|
186
177
|
},
|
|
187
178
|
"engines": {
|
|
188
179
|
"node": "^22.14.0 || >=24.10.0"
|
|
180
|
+
},
|
|
181
|
+
"os": [
|
|
182
|
+
"darwin",
|
|
183
|
+
"linux",
|
|
184
|
+
"win32"
|
|
185
|
+
],
|
|
186
|
+
"publishConfig": {
|
|
187
|
+
"access": "public",
|
|
188
|
+
"provenance": true
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as s,W as l}from"./renderError-DjesnVYT-pWsLqw-_.js";import u from"./JSONError-Cvp9ycba.js";const m=t=>String.raw`\u{${t.codePointAt(0).toString(16)}}`,p=(t,o,e)=>l(t,{start:o},{tabWidth:!1,...e}),f=/in JSON at position (\d+)(?: \(line (\d+) column (\d+)\))?$/,d=(t,o)=>{const e=f.exec(o);if(!e)return;const[,n,r,a]=e;if(r&&a)return{column:Number(a),line:Number(r)};let i=Number(n);return i===t.length&&(i=t.length-1),s(t,i)},g=/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,h=t=>t.replace(g,(o,e,n)=>`"${n}"(${m(n)})`);function w(t,o,e,n){typeof o=="string"&&(typeof e=="object"&&(n=e),e=o,o=void 0);let r;try{return JSON.parse(t,o)}catch(c){r=c.message}let a;t?(a=d(t,r),r=h(r)):r+=" while parsing empty string";const i=new u(r);throw i.fileName=e,a&&(i.codeFrame=p(t,a,n)),i}export{w as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u,W as C}from"./renderError-DjesnVYT-pWsLqw-_.js";import{toPath as g}from"@visulima/path/utils";import{parse as h,printParseErrorCode as b}from"jsonc-parser";import y from"./JSONError-Cvp9ycba.js";import E from"./readFile-VgxUDrNH.js";const P=(r,e,a,f)=>{if(r.length===0)return;const o=r[0],n=u(e,o.offset),t=new y(`${b(o.error)} at offset ${o.offset}`);throw t.fileName=a,t.codeFrame=C(e,{start:n},{tabWidth:!1,...f}),t},J=async(r,e)=>{const{allowEmptyContent:a,allowTrailingComma:f=!0,beforeParse:o,buffer:n,color:t,compression:l,disallowComments:c,encoding:p="utf8",flag:w}=e??{},m=await E(r,{buffer:n,compression:l,encoding:p,flag:w}),s=typeof o=="function"?o(m):m,i=[],d=h(s,i,{allowEmptyContent:a,allowTrailingComma:f,disallowComments:c});return P(i,s,g(r),{color:t}),d};export{J as default,P as throwIfJsoncErrors};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{parse as n}from"yaml";import s from"./readFile-VgxUDrNH.js";async function g(r,o,t){const{buffer:a,compression:c,encoding:i="utf8",flag:p,...f}=t??{},e=await s(r,{buffer:a,compression:c,encoding:i,flag:p});return typeof o=="function"?n(e,o,f):n(e,f)}export{g as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{parse as r}from"yaml";import m from"./readFileSync-CloFeQw8.js";function g(n,o,t){const{buffer:c,compression:i,encoding:p="utf8",flag:s,...f}=t??{},e=m(n,{buffer:c,compression:i,encoding:p,flag:s});return typeof o=="function"?r(e,o,f):r(e,f)}export{g as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{createRequire as B}from"node:module";let q;const W=e=>(q??=B(import.meta.url))(e),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[r,t]=y.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return y.getBuiltinModule(e)}return W(e)},{createRequire:R}=N("node:module"),I=globalThis.process??Object.create(null),T={versions:{}},x=new Proxy(I,{get(e,r){if(r in e)return e[r];if(r in T)return T[r]}}),P=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
-
`),G=(e,r,t,n)=>{const s={column:0,line:-1,...e.start},a={...s,...e.end},u=s.line,l=s.column,g=a.line,f=a.column;let m=Math.max(u-(t+1),0),h=Math.min(r.length,g+n);u===-1&&(m=0),g===-1&&(h=r.length);const d=g-u,i={};if(d)for(let o=0;o<=d;o++){const c=o+u;if(!l)i[c]=!0;else if(o===0){const p=r[c-1]?.length;i[c]=[l,(p??0)-l+1]}else if(o===d)i[c]=[0,f];else{const p=r[c-o]?.length;i[c]=[0,p]}}else l===f?i[u]=l?[l,0]:!0:i[u]=[l,(f??0)-(l??0)];return{end:h,markerLines:i,start:m}},L=x.platform==="win32"&&!x.env?.WT_SESSION?">":"❯",K=(e,r,t)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:o=>o,marker:o=>o,message:o=>o,...t?.color}},s=typeof r.start.column=="number";let a=(e.includes("\r")?P(e):e).split(`
|
|
3
|
-
`);typeof n.tabWidth=="number"&&e.includes(" ")&&(a=a.map(o=>o.replaceAll(" "," ".repeat(n.tabWidth))));const{end:u,markerLines:l,start:g}=G(r,a,n.linesAbove,n.linesBelow),f=String(u).length,{gutter:m,marker:h,message:d}=n.color;let i=a.slice(g,u).map((o,c)=>{const p=g+1+c,A=l[p],w=String(p).padStart(f),M=!l[p+1],_=` ${w}${n.showGutter?" |":""}`;if(A){let $="";if(Array.isArray(A)){const S=o.replaceAll(/[^\t]/g," ").slice(0,Math.max(A[0]-1,0)),k=A[1]||1;$=[`
|
|
4
|
-
`,n.prefix+m(_.replaceAll(/\d/g," "))," ",S,h("^").repeat(k)].join(""),M&&n.message&&($+=` ${d(n.message)}`)}return[n.prefix+h(L),m(_),o.length>0?` ${o}`:"",$].join("")}return`${n.prefix} ${m(_)}${o.length>0?` ${o}`:""}`}).join(`
|
|
5
|
-
`);return n.message&&!s&&(i=`${n.prefix+" ".repeat(f+1)+n.message}
|
|
6
|
-
${i}`),i},j=(e,r)=>{let t=0,n=r.length-2;for(;t<n;){const s=t+(n-t>>1);if(e<r[s])n=s-1;else if(e>=r[s+1])t=s+1;else{t=s;break}}return t},O=/\n|\r(?!\n)/,U=e=>e.split(O).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),Q=(e,r,t)=>{if(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0)return{column:0,line:0};if(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1))return{column:0,line:0};if(typeof e=="string"){const s=U(e),a=j(r,s);return{column:r-s[a]+1,line:a+1}}const n=j(r,e);return{column:r-e[n]+1,line:n+1}},V=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&V.set("AggregateError",AggregateError);let z;const C=e=>(z??=R(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=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 C(e)};D("node:util");let F;const H=e=>(F??=R(import.meta.url))(e),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[r,t]=E.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return E.getBuiltinModule(e)}return H(e)};v("node:fs");v("node:path");v("node:url");export{K as W,Q as a};
|