@visulima/fs 6.0.0 → 6.0.1
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 +2 -0
- package/LICENSE.md +130 -1
- package/dist/eol.js +3 -3
- package/dist/glob-parent.js +1 -1
- package/dist/glob.d.ts +54 -2
- package/dist/glob.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/ini.d.ts +2 -2
- package/dist/ini.js +1 -1
- package/dist/is-glob.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/match.js +1 -1
- package/dist/packem_shared/FIND_UP_STOP-pQqZdUPw.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-CAHgg-jK.js +1 -0
- package/dist/packem_shared/build-rm-options-_U1T9rOz.js +1 -0
- package/dist/packem_shared/collect-DXVMgRiZ.js +1 -0
- package/dist/packem_shared/collectSync-jjcJdHox.js +1 -0
- package/dist/packem_shared/copy-Cv8Vvdrc.js +1 -0
- package/dist/packem_shared/copySync-JIxmcGrd.js +1 -0
- package/dist/packem_shared/emptyDir-DQ1LfO2i.js +1 -0
- package/dist/packem_shared/emptyDirSync-BXDqirP1.js +1 -0
- package/dist/packem_shared/ensureDir-qy_X-WeG.js +1 -0
- package/dist/packem_shared/{ensureDirSync-B0w9WMwE.js → ensureDirSync-ONFJBCbg.js} +1 -1
- package/dist/packem_shared/{ensureFile-waD4hDO8.js → ensureFile-q1ozF6q5.js} +1 -1
- package/dist/packem_shared/ensureFileSync-B6eR38N_.js +1 -0
- package/dist/packem_shared/ensureLink-BpsTVGAm.js +1 -0
- package/dist/packem_shared/ensureLinkSync-B5moWvh3.js +1 -0
- package/dist/packem_shared/ensureSymlink-BF0BwVPy.js +1 -0
- package/dist/packem_shared/ensureSymlinkSync-D-JzDuD7.js +1 -0
- package/dist/packem_shared/findUp-BlQ1EUhu.js +1 -0
- package/dist/packem_shared/findUpSync-CF1OXVQw.js +1 -0
- package/dist/packem_shared/glob-Cyk1H9ZL.js +1 -0
- package/dist/packem_shared/globSync-Cm0u7eCn.js +1 -0
- package/dist/packem_shared/index-CBWLeiRp.js +1 -0
- package/dist/packem_shared/index-DDkv7LRn.js +1 -0
- package/dist/packem_shared/index-DGueExxA.js +1 -0
- package/dist/packem_shared/index-ovH_d7Hf.js +11 -0
- package/dist/packem_shared/indexToLineColumn-BHKDfaPx-DS9KxkE-.js +6 -0
- package/dist/packem_shared/ini-preserve-D3Z1KcgN.js +4 -0
- package/dist/packem_shared/is-stats-identical-DOh8_0KH.js +1 -0
- package/dist/packem_shared/isAccessible-CqNOFdZu.js +1 -0
- package/dist/packem_shared/isAccessibleSync-DYKTrrvc.js +1 -0
- package/dist/packem_shared/json-value.d-DZqAihX4.d.ts +29 -0
- package/dist/packem_shared/jsonc-merge-BGm21l00.js +2 -0
- package/dist/packem_shared/map-read-error-8dAe6Qhr.js +1 -0
- package/dist/packem_shared/move-DG3P4i6Y.js +1 -0
- package/dist/packem_shared/parseJson-gfl5PTTo.js +1 -0
- package/dist/packem_shared/readFile-DbKGLwIK.js +1 -0
- package/dist/packem_shared/readFileSync-CTTHkZ_p.js +1 -0
- package/dist/packem_shared/readIni-C9VUitQm.js +1 -0
- package/dist/packem_shared/readIniSync-DhMbhDPx.js +1 -0
- package/dist/packem_shared/readJson-CClJlGok.js +1 -0
- package/dist/packem_shared/readJson5-D33tgtEU.js +1 -0
- package/dist/packem_shared/readJson5Sync-DEd-ejtp.js +1 -0
- package/dist/packem_shared/readJsonSync-CbryXYxN.js +1 -0
- package/dist/packem_shared/readJsonc-Cp1KzmVx.js +1 -0
- package/dist/packem_shared/readJsoncSync-sE30rJ5W.js +1 -0
- package/dist/packem_shared/readToml-jD08lZRN.js +1 -0
- package/dist/packem_shared/readTomlSync-0J8gIalg.js +1 -0
- package/dist/packem_shared/readYaml-C63_W9Qg.js +1 -0
- package/dist/packem_shared/readYamlSync-CuyDW6xR.js +1 -0
- package/dist/packem_shared/remove-4ofpEuH1.js +1 -0
- package/dist/packem_shared/removeSync-g1D5kONg.js +1 -0
- package/dist/packem_shared/resolve-symlink-target-D4Pb9Fjw.js +1 -0
- package/dist/packem_shared/sanitize-B1LHjdjC.js +1 -0
- package/dist/packem_shared/stripJsonComments-Do7s7No5.js +1 -0
- package/dist/packem_shared/to-uint-8-array-DlTu4L-l.js +1 -0
- package/dist/packem_shared/{types.d-CgCO6qUp.d.ts → types.d-B-T1rDxl.d.ts} +1 -1
- package/dist/packem_shared/walk-Brue5N30.js +1 -0
- package/dist/packem_shared/walk-include-aizKyl9e.js +1 -0
- package/dist/packem_shared/walkSync-BWGgTwUy.js +1 -0
- package/dist/packem_shared/writeFile-BIBP7wbK.js +1 -0
- package/dist/packem_shared/writeFileSync-DJoHk3Ks.js +1 -0
- package/dist/packem_shared/writeIni--gog68qN.js +4 -0
- package/dist/packem_shared/writeIniSync-BL_z8aMQ.js +4 -0
- package/dist/packem_shared/writeJson-DmN1UqZc.js +4 -0
- package/dist/packem_shared/writeJson5-CPRmF2K7.js +4 -0
- package/dist/packem_shared/writeJson5Sync-BiUfm-cZ.js +4 -0
- package/dist/packem_shared/writeJsonSync-BiFyXQ5h.js +4 -0
- package/dist/packem_shared/writeJsonc-B4ahk9a2.js +4 -0
- package/dist/packem_shared/writeJsoncSync-lBv1IFDo.js +4 -0
- package/dist/packem_shared/writeToml-Frvwh0Kn.js +1 -0
- package/dist/packem_shared/writeTomlSync-BvKdlKvE.js +1 -0
- package/dist/packem_shared/writeYaml-C4IGXTOo.js +1 -0
- package/dist/packem_shared/writeYamlSync-BAbWtkvq.js +1 -0
- package/dist/size.js +1 -1
- package/dist/toml.d.ts +1 -1
- package/dist/toml.js +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +1 -1
- package/package.json +2 -2
- package/dist/packem_shared/FIND_UP_STOP-CAwY1qU7.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-CWAkuNXM.js +0 -1
- package/dist/packem_shared/assertValidFileOrDirectoryPath-BTlt945W.js +0 -1
- package/dist/packem_shared/build-rm-options-avnusYx-.js +0 -1
- package/dist/packem_shared/collect-Dbo3K4iq.js +0 -1
- package/dist/packem_shared/collectSync-BLLtRqQ4.js +0 -1
- package/dist/packem_shared/copy-DiR5_5iA.js +0 -1
- package/dist/packem_shared/copySync-DffsYlhb.js +0 -1
- package/dist/packem_shared/emptyDir-BlBeczk0.js +0 -1
- package/dist/packem_shared/emptyDirSync-DfUZ9Ejz.js +0 -1
- package/dist/packem_shared/ensureDir-BEiomfxz.js +0 -1
- package/dist/packem_shared/ensureFileSync-CG07zjV7.js +0 -1
- package/dist/packem_shared/ensureLink-Dz-PDWa5.js +0 -1
- package/dist/packem_shared/ensureLinkSync-BZH7TaSQ.js +0 -1
- package/dist/packem_shared/ensureSymlink-Byi6ajoE.js +0 -1
- package/dist/packem_shared/ensureSymlinkSync-D7OCsAd8.js +0 -1
- package/dist/packem_shared/findUp-BHCEMf5y.js +0 -1
- package/dist/packem_shared/findUpSync-BKJsHMQN.js +0 -1
- package/dist/packem_shared/glob-BUjyjdE8.js +0 -1
- package/dist/packem_shared/glob-sync.d-SlQXhcIG.d.ts +0 -54
- package/dist/packem_shared/globSync-Bk9TUV7x.js +0 -1
- package/dist/packem_shared/index-B2MhYg3r.js +0 -1
- package/dist/packem_shared/index-BHy3Kcr7.js +0 -11
- package/dist/packem_shared/index-CPZbuHkp.js +0 -1
- package/dist/packem_shared/index-LUKYN3u3.js +0 -1
- package/dist/packem_shared/indexToLineColumn-BfkIsWHQ-DQJmePiQ.js +0 -6
- package/dist/packem_shared/ini-preserve-D1DopDLd.js +0 -4
- package/dist/packem_shared/is-stats-identical-l1GRN4Qu.js +0 -1
- package/dist/packem_shared/isAccessible-B7guOm3k.js +0 -1
- package/dist/packem_shared/isAccessibleSync-XH4YleJW.js +0 -1
- package/dist/packem_shared/jsonc-merge-Bkw73TLW.js +0 -2
- package/dist/packem_shared/map-read-error-CR3rQUxx.js +0 -1
- package/dist/packem_shared/move-KhPRvsRd.js +0 -1
- package/dist/packem_shared/parseJson-lm3MUNdf.js +0 -1
- package/dist/packem_shared/readFile-VgxUDrNH.js +0 -1
- package/dist/packem_shared/readFileSync-CloFeQw8.js +0 -1
- package/dist/packem_shared/readIni-CEXHWn92.js +0 -1
- package/dist/packem_shared/readIniSync-DsxVHypc.js +0 -1
- package/dist/packem_shared/readJson-DV2KxaEJ.js +0 -1
- package/dist/packem_shared/readJson5-S68aVros.js +0 -1
- package/dist/packem_shared/readJson5Sync-Bi9Rv46R.js +0 -1
- package/dist/packem_shared/readJsonSync-DweZd5ZA.js +0 -1
- package/dist/packem_shared/readJsonc-Dqh-elUt.js +0 -1
- package/dist/packem_shared/readJsoncSync-Dy2PZG5g.js +0 -1
- package/dist/packem_shared/readToml-CN_xnICv.js +0 -1
- package/dist/packem_shared/readTomlSync-B9TVGzen.js +0 -1
- package/dist/packem_shared/readYaml-BT3HBFQv.js +0 -1
- package/dist/packem_shared/readYamlSync-Cx-zy2cS.js +0 -1
- package/dist/packem_shared/remove-D_CUIlBL.js +0 -1
- package/dist/packem_shared/removeSync-F4nKiwrU.js +0 -1
- package/dist/packem_shared/resolve-symlink-target-CWrn0v4P.js +0 -1
- package/dist/packem_shared/sanitize-aEqeyx4d.js +0 -1
- package/dist/packem_shared/stripJsonComments-Bfcn2PKv.js +0 -1
- package/dist/packem_shared/to-uint-8-array-7sXMoZwU.js +0 -1
- package/dist/packem_shared/walk-B211aFS7.js +0 -1
- package/dist/packem_shared/walk-include-2NQzWTCI.js +0 -1
- package/dist/packem_shared/walkSync-VeMvHYLk.js +0 -1
- package/dist/packem_shared/writeFile-Dnba9aVe.js +0 -1
- package/dist/packem_shared/writeFileSync-pW8o2DG1.js +0 -1
- package/dist/packem_shared/writeIni-DgZ-0EUD.js +0 -4
- package/dist/packem_shared/writeIniSync-Buz4Cove.js +0 -4
- package/dist/packem_shared/writeJson-vexC7dw2.js +0 -4
- package/dist/packem_shared/writeJson5-DeW_smOs.js +0 -4
- package/dist/packem_shared/writeJson5Sync-Cz5pwaPh.js +0 -4
- package/dist/packem_shared/writeJsonSync-DJLfN5iT.js +0 -4
- package/dist/packem_shared/writeJsonc-BqJQS0Mk.js +0 -4
- package/dist/packem_shared/writeJsoncSync-CchlR2KW.js +0 -4
- package/dist/packem_shared/writeToml-Bn-wQdaM.js +0 -1
- package/dist/packem_shared/writeTomlSync-CTv4RXkJ.js +0 -1
- package/dist/packem_shared/writeYaml-CpWDXOUF.js +0 -1
- package/dist/packem_shared/writeYamlSync-9MG5_lNI.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const v=globalThis.process??Object.create(null),d={versions:{}},x=new Proxy(v,{get(e,t){if(t in e)return e[t];if(t in d)return d[t]}}),L=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),M=(e,t,s,n)=>{const l={column:0,line:-1,...e.start},c={...l,...e.end},a=l.line,o=l.column,f=c.line,p=c.column;let m=Math.max(a-(s+1),0),h=Math.min(t.length,f+n);a===-1&&(m=0),f===-1&&(h=t.length);const y=f-a,i={};if(y)for(let r=0;r<=y;r++){const u=r+a;if(!o)i[u]=!0;else if(r===0){const g=t[u-1]?.length;i[u]=[o,(g??0)-o+1]}else if(r===y)i[u]=[0,p];else{const g=t[u-r]?.length;i[u]=[0,g]}}else o===p?i[a]=o?[o,0]:!0:i[a]=[o,(p??0)-(o??0)];return{end:h,markerLines:i,start:m}},B=x.platform==="win32"&&!x.env?.WT_SESSION?">":"❯",T=(e,t,s)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...s,color:{gutter:r=>r,marker:r=>r,message:r=>r,...s?.color}},l=typeof t.start.column=="number";let c=(e.includes("\r")?L(e):e).split(`
|
|
3
|
+
`);typeof n.tabWidth=="number"&&e.includes(" ")&&(c=c.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:a,markerLines:o,start:f}=M(t,c,n.linesAbove,n.linesBelow),p=String(a).length,{gutter:m,marker:h,message:y}=n.color;let i=c.slice(f,a).map((r,u)=>{const g=f+1+u,A=o[g],S=String(g).padStart(p),k=!o[g+1],$=` ${S}${n.showGutter?" |":""}`;if(A){let b="";if(Array.isArray(A)){const W=r.replaceAll(/[^\t]/g," ").slice(0,Math.max(A[0]-1,0)),j=A[1]||1;b=[`
|
|
4
|
+
`,n.prefix+m($.replaceAll(/\d/g," "))," ",W,h("^").repeat(j)].join(""),k&&n.message&&(b+=` ${y(n.message)}`)}return[n.prefix+h(B),m($),r.length>0?` ${r}`:"",b].join("")}return`${n.prefix} ${m($)}${r.length>0?` ${r}`:""}`}).join(`
|
|
5
|
+
`);return n.message&&!l&&(i=`${n.prefix+" ".repeat(p+1)+n.message}
|
|
6
|
+
${i}`),i},w=(e,t)=>{let s=0,n=t.length-2;for(;s<n;){const l=s+(n-s>>1);if(e<t[l])n=l-1;else if(e>=t[l+1])s=l+1;else{s=l;break}}return s},G=/\n|\r(?!\n)/,O=e=>e.split(G).reduce((t,s)=>(t.push(t.at(-1)+s.length+1),t),[0]),C=(e,t,s)=>{if(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0)return{column:0,line:0};if(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"){const l=O(e),c=w(t,l);return{column:t-l[c]+1,line:c+1}}const n=w(t,e);return{column:t-e[n]+1,line:n+1}};export{T as C,C as h};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const w=/^\s*(?:[;#].*)?$/,m=/^\s*\[([^\]]+)\]\s*$/,y=/\r?\n/,v=/\r?\n$/,O=/^[^=]+=/,A=t=>t===" "||t===" ",b=t=>{let e=0;for(;e<t.length&&A(t[e]);)e+=1;return{indent:t.slice(0,e),rest:t.slice(e)}},x=t=>{let e=t.length;for(;e>0&&A(t[e-1]);)e-=1;return{rest:t.slice(0,e),trailing:t.slice(e)}},E=t=>{const e=t.indexOf("=");if(e===-1)return;const n=t.slice(0,e),s=t.slice(e+1),{indent:i,rest:o}=b(n),{rest:c,trailing:r}=x(o);if(c===""||c.startsWith(";")||c.startsWith("#")||c.startsWith("["))return;const{indent:d,rest:f}=b(s),{rest:k,trailing:g}=x(f);return{after:d,before:r,indent:i,key:c,trailing:g,value:k}},$=t=>{let e=0,n=0;for(const s of t.split(y)){if(w.test(s)||m.test(s))continue;const i=E(s);i&&(i.before===" "&&i.after===" "?e+=1:i.before===""&&i.after===""&&(n+=1))}return{spaced:e,unspaced:n}},h=(t,e)=>{if(!t)return;if(e===void 0)return t;let n=t;for(const s of e.split("."))if(n&&typeof n=="object"&&!Array.isArray(n))n=n[s];else return;return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0},_=(t,e)=>{for(const n of t.split(y)){if(!n||n.startsWith("["))continue;const s=O.exec(n);if(!s)continue;const i=n.slice(0,s[0].length-1).trim();if(i===e||i===`${e}[]`)return n.slice(s[0].length).trimStart()}return""},I=(t,e)=>{if(t.trim()==="")return{line:{kind:"blank",raw:t,section:e},nextSection:e};const n=t.trimStart();if(n.startsWith(";")||n.startsWith("#"))return{line:{kind:"comment",raw:t,section:e},nextSection:e};const s=m.exec(t);if(s){const o=s[1];return{line:{kind:"header",raw:t,section:o},nextSection:o}}const i=E(t);return i?{line:{key:i.key,kind:"key",raw:t,section:e},nextSection:e}:{line:{kind:"unknown",raw:t,section:e},nextSection:e}},N=t=>{const n=t.replace(v,"").split(y),s=[];let i;for(const o of n){const{line:c,nextSection:r}=I(o,i);s.push(c),i=r}return s},R=(t,e,n)=>{const s=E(t.raw);if(!s||!t.key)return t.raw;const i=n({[t.key]:e}),o=_(i,t.key);return`${s.indent}${s.key}${s.before}=${s.after}${o}${s.trailing}`},L=(t,e=[])=>{const n=[];for(const[s,i]of Object.entries(t))if(i&&typeof i=="object"&&!Array.isArray(i)){const o=[...e,s];n.push(o.join("."),...L(i,o))}return n},W=(t,e)=>{const n={};for(const[s,i]of Object.entries(t))e.has(s)||i&&typeof i=="object"&&!Array.isArray(i)||(n[s]=i);return n},j=(t,e)=>{const n=[];for(const s of e.split(y))s!==""&&n.push(s);n.length>0&&t.push(...n)},T=t=>{const{line:e,markWritten:n,nextData:s,oldData:i,renderValue:o}=t;if(!e.key)return e.raw;const c=h(s,e.section);if(!c||!(e.key in c))return;n(e.section,e.key);const d=h(i,e.section)?.[e.key],f=c[e.key];return JSON.stringify(d)===JSON.stringify(f)?e.raw:o(e,f)},G=(t,e,n,s,i)=>{const o=h(s,e);if(!o)return;const c=n.get(e)??new Set,r=W(o,c);Object.keys(r).length!==0&&j(t,i(r))},M=(t,e,n,s)=>{const i=new Set(e.filter(o=>o.kind==="header"&&o.section).map(o=>o.section));for(const o of L(n)){if(i.has(o))continue;const c=h(n,o);if(!c||Object.keys(c).length===0)continue;const r=W(c,new Set);Object.keys(r).length!==0&&j(t,s(r,o))}},V=t=>{const e=t.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,{spaced:n,unspaced:s}=$(t);return{eol:e,whitespace:n>0&&n>=s}},K=(t,e,n,s,i)=>{const{eol:o}=i,c=v.test(t),r=N(t),d=new Map,f=new Map;for(const[l,a]of r.entries())a.kind!=="blank"&&f.set(a.section,l);const k=(l,a)=>{let u=d.get(l);u||(u=new Set,d.set(l,u)),u.add(a)},g=(l,a)=>R(l,a,s),p=[];for(const[l,a]of r.entries()){if(a.kind==="key"){const u=T({line:a,markWritten:k,nextData:n,oldData:e,renderValue:g});u!==void 0&&p.push(u);continue}p.push(a.raw),f.get(a.section)===l&&G(p,a.section,d,n,s)}M(p,r,n,s);const S=p.join(o);return c&&!S.endsWith(o)?`${S}${o}`:S};export{V as d,K as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const d=(c,v)=>!!v.ino&&!!v.dev&&v.ino===c.ino&&v.dev===c.dev;export{d as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import{toPath as a}from"@visulima/path/utils";import{F_OK as l}from"./FIND_UP_STOP-pQqZdUPw.js";import f from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";let i;const n=e=>(i??=t(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,o]=s.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return s.getBuiltinModule(e)}return n(e)},{access:u}=c("node:fs/promises");async function g(e,r=l){f(e),e=a(e);try{return await u(e,r),!0}catch{return!1}}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import{toPath as l}from"@visulima/path/utils";import{F_OK as a}from"./FIND_UP_STOP-pQqZdUPw.js";import f from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";let i;const n=e=>(i??=t(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,o]=s.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return s.getBuiltinModule(e)}return n(e)},{accessSync:u}=c("node:fs");function y(e,r=a){f(e),e=l(e);try{return u(e,r),!0}catch{return!1}}export{y as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Matches a JSON object.
|
|
3
|
+
|
|
4
|
+
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
|
5
|
+
|
|
6
|
+
@category JSON
|
|
7
|
+
*/
|
|
8
|
+
type JsonObject = { [Key in string]: JsonValue; };
|
|
9
|
+
/**
|
|
10
|
+
Matches a JSON array.
|
|
11
|
+
|
|
12
|
+
@category JSON
|
|
13
|
+
*/
|
|
14
|
+
type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
15
|
+
/**
|
|
16
|
+
Matches any valid JSON primitive value.
|
|
17
|
+
|
|
18
|
+
@category JSON
|
|
19
|
+
*/
|
|
20
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
21
|
+
/**
|
|
22
|
+
Matches any valid JSON value.
|
|
23
|
+
|
|
24
|
+
@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
|
|
25
|
+
|
|
26
|
+
@category JSON
|
|
27
|
+
*/
|
|
28
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
29
|
+
export { JsonValue as J };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{parse as g,modify as b,applyEdits as S}from"jsonc-parser";const p=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),y=(t,s,r)=>{const i=b(t.text,s,r,{formattingOptions:t.formattingOptions});t.text=S(t.text,i)},O=(t,s,r,i,e)=>{const f=new Set([...Object.keys(s),...Object.keys(r)]);for(const o of f){const n=[...i,o];o in r?o in s?e(t,s[o],r[o],n):y(t,n,r[o]):y(t,n,void 0)}},m=(t,s,r,i)=>{if(s!==r){if(p(s)&&p(r)){O(t,s,r,i,m);return}if(Array.isArray(s)&&Array.isArray(r)&&s.length===r.length){for(const[e,f]of s.entries())m(t,f,r[e],[...i,e]);return}JSON.stringify(s)!==JSON.stringify(r)&&y(t,i,r)}},k=(t,s,r)=>{const i=g(t,[],{allowTrailingComma:!0}),e={formattingOptions:r,text:t};return m(e,i,s,[]),e.text},A=t=>typeof t=="number"?{insertSpaces:!0,tabSize:t}:typeof t=="string"?t===" "||t.includes(" ")?{insertSpaces:!1,tabSize:t.length||1}:{insertSpaces:!0,tabSize:t.length||2}:{insertSpaces:!0,tabSize:2},j=(t,s,r,i,e,f,o)=>{if(r&&t!==void 0){const n={...A(i),...f};let c=k(t,s,n);return e&&!c.endsWith(`
|
|
2
|
+
`)&&(c+=e),c}return`${JSON.stringify(s,o,i)}${e}`};export{j as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"./NotFoundError-CnRY6lVp.js";import t from"./PermissionError-DJ_2VWEj.js";const d=(o,e)=>{const r=o?.code;return r==="ENOENT"?new n(`no such file or directory, open '${e}'`):r==="EACCES"||r==="EPERM"?new t(`unable to read the non-readable file: ${e}`):o};export{d as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as u}from"node:module";import{toPath as m}from"@visulima/path/utils";import{dirname as n,resolve as s}from"@visulima/path";import g from"./isAccessible-CqNOFdZu.js";import q from"./isAccessibleSync-DYKTrrvc.js";let v;const _=r=>(v??=u(import.meta.url))(r),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=r=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,o]=i.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return i.getBuiltinModule(r)}return _(r)},{cwd:l}=i,{mkdir:S,rename:E,copyFile:D,unlink:b}=y("node:fs/promises"),{mkdirSync:j,renameSync:$,copyFileSync:T,unlinkSync:k}=y("node:fs");class x extends Error{constructor(e,o){super(`Source directory "${n(e)}" does not match destination directory "${n(o)}"`),this.name="SameDirectoryError"}}const a=(r,e)=>{if(!r||!e)throw new Error("Source and destination paths must not be empty");if(n(r)!==n(e))throw new x(r,e)},d=async(r,e,{cwd:o,directoryMode:c,overwrite:w,validateDirectory:f})=>{if(o&&(r=s(o,r),e=s(o,e)),f&&a(r,e),!w&&await g(e))throw new Error(`The destination file exists: ${e}`);await S(n(e),{mode:c,recursive:!0});try{await E(r,e)}catch(t){if(t.code==="EXDEV")await D(r,e),await b(r);else throw t}},p=(r,e,{cwd:o,directoryMode:c,overwrite:w,validateDirectory:f})=>{if(o&&(r=s(o,r),e=s(o,e)),f&&a(r,e),!w&&q(e))throw new Error(`The destination file exists: ${e}`);j(n(e),{mode:c,recursive:!0});try{$(r,e)}catch(t){if(t.code==="EXDEV")T(r,e),k(r);else throw t}},B=async(r,e,o={})=>{const c={overwrite:!0,validateDirectory:!1,...o,cwd:o.cwd?m(o.cwd):l()};await d(r,e,c)},V=(r,e,o)=>{const c={overwrite:!0,validateDirectory:!1,...o};c.cwd=c.cwd?m(c.cwd):l(),p(r,e,c)},X=async(r,e,o)=>{const c={overwrite:!0,...o,validateDirectory:!0};c.cwd=c.cwd?m(c.cwd):l(),await d(r,e,c)},N=(r,e,o)=>{const c={overwrite:!0,...o,validateDirectory:!0};c.cwd=c.cwd?m(c.cwd):l(),p(r,e,c)};export{B as move,V as moveSync,X as rename,N as renameSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as s,C as d}from"./indexToLineColumn-BHKDfaPx-DS9KxkE-.js";import l from"./JSONError-Cvp9ycba.js";const m=t=>String.raw`\u{${t.codePointAt(0).toString(16)}}`,u=(t,o,e)=>d(t,{start:o},{tabWidth:!1,...e}),f=/in JSON at position (\d+)(?: \(line (\d+) column (\d+)\))?$/,g=(t,o)=>{const e=f.exec(o);if(!e)return;const[,r,n,c]=e;if(n&&c)return{column:Number(c),line:Number(n)};let i=Number(r);return i===t.length&&(i=t.length-1),s(t,i)},p=/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,E=t=>t.replace(p,(o,e,r)=>`"${r}"(${m(r)})`);function N(t,o,e,r){typeof o=="string"&&(typeof e=="object"&&(r=e),e=o,o=void 0);let n;try{return JSON.parse(t,o)}catch(a){n=a.message}let c;t?(c=g(t,n),n=E(n)):n+=" while parsing empty string";const i=new l(n);throw i.fileName=e,c&&(i.codeFrame=u(t,c,r)),i}export{N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as f}from"node:module";import{toPath as y}from"@visulima/path/utils";import h from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{m as q}from"./map-read-error-8dAe6Qhr.js";let p;const _=e=>(p??=f(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return _(e)},{readFile:g}=l("node:fs/promises"),{unzip:b,brotliDecompress:j}=l("node:zlib"),w={brotli:j,gzip:b,none:(e,o)=>{o(null,e)}},z=async(e,o)=>{h(e),e=y(e);const{buffer:s,compression:d,encoding:m,flag:i}=o??{};let n;try{n=await g(e,i?{flag:i}:{})}catch(t){throw q(t,e)}return await new Promise((t,u)=>{w[d??"none"](n,(c,a)=>{c?u(c):t(s?a:a.toString(m??"utf8"))})})};export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as u}from"node:module";import{toPath as b}from"@visulima/path/utils";import j from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{m as S}from"./map-read-error-8dAe6Qhr.js";let f;const p=e=>(f??=u(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return p(e)},{readFileSync:_}=c("node:fs"),{unzipSync:g,brotliDecompressSync:y}=c("node:zlib"),h={brotli:y,gzip:g,none:e=>e},z=(e,o)=>{j(e),e=b(e);const{buffer:s,compression:d,encoding:l,flag:n}=o??{};let t;try{t=_(e,n?{flag:n}:{})}catch(m){throw S(m,e)}const a=h[d??"none"],i=a(t);return s?i:i.toString(l??"utf8")};export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as o}from"ini";import c from"./readFile-DbKGLwIK.js";const d=async(r,t)=>{const{bracketedArray:e=!0,...a}=t??{},n=await c(r,{encoding:"utf8",...a});return o(n,{bracketedArray:e})};export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as a}from"ini";import c from"./readFileSync-CTTHkZ_p.js";const s=(r,t)=>{const{bracketedArray:e=!0,...n}=t??{},o=c(r,{encoding:"utf8",...n});return a(o,{bracketedArray:e})};export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPath as c}from"@visulima/path/utils";import d from"./parseJson-gfl5PTTo.js";import i from"./readFile-DbKGLwIK.js";async function p(e,o,n){typeof o=="object"&&(n=o,o=void 0);const r=await i(e,{buffer:!0,encoding:void 0});let t=new TextDecoder().decode(r);const{beforeParse:f,color:a}=n??{};return typeof f=="function"&&(t=f(t)),d(t,o,c(e),{color:a})}export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import i from"json5";import r from"./readFile-DbKGLwIK.js";async function b(a,o,t){o&&typeof o=="object"&&(t=o,o=void 0);const{beforeParse:n,buffer:c,compression:e,encoding:s="utf8",flag:p}=t??{},f=await r(a,{buffer:c,compression:e,encoding:s,flag:p}),u=typeof n=="function"?n(f):f;return i.parse(u,o)}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"json5";import d from"./readFileSync-CTTHkZ_p.js";function y(c,o,n){o&&typeof o=="object"&&(n=o,o=void 0);const{beforeParse:t,buffer:e,compression:s,encoding:a="utf8",flag:p}=n??{},f=d(c,{buffer:e,compression:s,encoding:a,flag:p}),u=typeof t=="function"?t(f):f;return r.parse(u,o)}export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPath as d}from"@visulima/path/utils";import a from"./parseJson-gfl5PTTo.js";import i from"./readFileSync-CTTHkZ_p.js";function p(e,o,n){typeof o=="object"&&(n=o,o=void 0);const c=i(e,{buffer:!0,encoding:void 0});let t=new TextDecoder().decode(c);const{beforeParse:f,color:r}=n??{};return typeof f=="function"&&(t=f(t)),a(t,o,d(e),{color:r})}export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as w,C as h}from"./indexToLineColumn-BHKDfaPx-DS9KxkE-.js";import{toPath as C}from"@visulima/path/utils";import{parse as E,printParseErrorCode as g}from"jsonc-parser";import b from"./JSONError-Cvp9ycba.js";import y from"./readFile-DbKGLwIK.js";const J=(r,e,n,s)=>{if(r.length===0)return;const o=r[0],f=w(e,o.offset),t=new b(`${g(o.error)} at offset ${o.offset}`);throw t.fileName=n,t.codeFrame=h(e,{start:f},{tabWidth:!1,...s}),t},x=async(r,e)=>{const{allowEmptyContent:n,allowTrailingComma:s=!0,beforeParse:o,buffer:f,color:t,compression:m,disallowComments:l,encoding:p="utf8",flag:d}=e??{},a=await y(r,{buffer:f,compression:m,encoding:p,flag:d}),c=typeof o=="function"?o(a):a,i=[],u=E(c,i,{allowEmptyContent:n,allowTrailingComma:s,disallowComments:l});return J(i,c,C(r),{color:t}),u};export{x as default,J as throwIfJsoncErrors};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPath as w}from"@visulima/path/utils";import{parse as y}from"jsonc-parser";import g from"./readFileSync-CTTHkZ_p.js";import{throwIfJsoncErrors as C}from"./readJsonc-Cp1KzmVx.js";const S=(o,s)=>{const{allowEmptyContent:c,allowTrailingComma:m=!0,beforeParse:r,buffer:f,color:a,compression:i,disallowComments:l,encoding:p="utf8",flag:u}=s??{},t=g(o,{buffer:f,compression:i,encoding:p,flag:u}),n=typeof r=="function"?r(t):t,e=[],d=y(n,e,{allowEmptyContent:c,allowTrailingComma:m,disallowComments:l});return C(e,n,w(o),{color:a}),d};export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as e}from"smol-toml";import a from"./readFile-DbKGLwIK.js";const i=async(t,o)=>{const r=await a(t,{encoding:"utf8",...o});return e(r)};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as e}from"smol-toml";import n from"./readFileSync-CTTHkZ_p.js";const m=(o,r)=>{const t=n(o,{encoding:"utf8",...r});return e(t)};export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as a}from"@visulima/yaml";import u from"./readFile-DbKGLwIK.js";async function l(s,o,t){const c=(typeof o=="function"?t:o??t)??{},{buffer:e,compression:p,encoding:r="utf8",flag:i,...n}=c,f=await u(s,{buffer:e,compression:p,encoding:r,flag:i});return typeof o=="function"?a(f,o,n):a(f,n)}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as c}from"@visulima/yaml";import i from"./readFileSync-CTTHkZ_p.js";function l(e,n,o){const s=(typeof n=="function"?o:n??o)??{},{buffer:p,compression:a,encoding:r="utf8",flag:u,...t}=s,f=i(e,{buffer:p,compression:a,encoding:r,flag:u});return typeof n=="function"?c(f,n,t):c(f,t)}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as i}from"node:module";import u from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{b as l}from"./build-rm-options-_U1T9rOz.js";let t;const n=e=>(t??=i(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,o]=s.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return s.getBuiltinModule(e)}return n(e)},{rm:a}=c("node:fs/promises"),p=async(e,r={})=>{u(e),await a(e,l(r))};export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import l from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{b as a}from"./build-rm-options-_U1T9rOz.js";let i;const n=e=>(i??=t(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,s]=o.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return o.getBuiltinModule(e)}return n(e)},{rmSync:u}=c("node:fs"),f=(e,r={})=>{l(e),u(e,a(r))};export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as o,dirname as s}from"@visulima/path";const i=(r,n)=>typeof r!="string"?r:r.startsWith("./")?o(r):typeof n=="string"?o(s(n),r):new URL(r,n);export{i as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as O}from"node:module";const h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:g}=h,c="unnamed",_=128,u={'"':"ˮ","*":"⁎","/":"⁄",":":"꞉","<":"‹",">":"›","?":"ʔ","\\":"∖","|":"ǀ"},E=/[\u0000-\u001F\u0080-\u009F]/g,x=/^(?:\.+[/\\]+)+|^\.+$/g,f=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i,R=/[<>:"/\\|?*]/g,I=/\//g,l=new Set([" "," ","."]),a=(t,s)=>s>0&&s<t.length-1,A=(t,s)=>{const n=t.lastIndexOf(".");if(!a(t,n))return t.slice(0,s);const e=t.slice(0,n),i=t.slice(n),r=s-i.length;return r>0?`${e.slice(0,r)}${i}`:t.slice(0,s)},d=t=>{let s=0,n=t.length;for(;s<n;){const e=t[s];if(e===void 0||!l.has(e))break;s+=1}for(;n>s;){const e=t[n-1];if(e===void 0||!l.has(e))break;n-=1}return t.slice(s,n)},N=t=>{const s=t.lastIndexOf(".");if(a(t,s)){const e=t.slice(0,s),i=t.slice(s);let r=e;for(;r.length>0;){const o=r.at(-1);if(o===void 0||!l.has(o))break;r=r.slice(0,-1)}return r.length===0?i.slice(1):`${r}${i}`}let n=t;for(;n.length>0;){const e=n.at(-1);if(e===void 0||!l.has(e))break;n=n.slice(0,-1)}return n},p=t=>{const s=t.lastIndexOf(".");if(a(t,s))return!1;if(f.test(t))return!0;let n=t;for(;n.length>0;){const e=n.at(-1);if(e===void 0||!l.has(e))break;n=n.slice(0,-1)}return!!(n.length>0&&f.test(n))},w=t=>{const s=t.lastIndexOf(".");if(a(t,s)){const i=t.slice(0,s),r=t.slice(s),o=d(i);return o.length===0?void 0:`${o}${r}`}const n=t.trim();if(n.length>0&&n[0]==="."&&n.length<=5&&n.indexOf(".",1)===-1)return;const e=d(t);if(e.length!==0)return e},S=t=>{const s=t?.filesystem??"auto";return s==="auto"?g==="win32"?"win32":"unix":s==="darwin"?"unix":s},T=(t,s)=>{if(typeof t!="string"||t.length===0)return c;const n=S(s);let e=t;if(e=e.replace(E,""),e.length===0||(e=e.replace(x,""),e.length===0))return c;if(n==="win32"||n==="fat32"){const r=e.lastIndexOf(".");if(!a(e,r)&&f.test(e))return c}if(e=n==="win32"||n==="fat32"?e.replaceAll(R,r=>u[r]??""):e.replaceAll(I,u["/"]),e=e.trim(),(n==="win32"||n==="fat32")&&(p(e)||n==="win32"&&(e=N(e),e.length===0)))return c;if(n==="fat32"){const r=w(e);if(r===void 0)return c;e=r}if(e.length===0)return c;const i=s?.maxLength??_;return e.length>i&&(e=A(e,i),e.length===0)?c:e};export{T as sanitize};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{INTERNAL_STRIP_JSON_REGEX as s}from"./FIND_UP_STOP-pQqZdUPw.js";const o=(e,{whitespace:t=!0}={})=>e.replace(s,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):"");export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as o}from"node:module";let s;const n=e=>(s??=o(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[r,i]=t.versions.node.split(".").map(Number);if(r>22||r===22&&i>=3||r===20&&i>=16)return t.getBuiltinModule(e)}return n(e)},{randomBytes:a}=f("node:crypto"),p=e=>`${e}.${process.pid.toString(36)}.${a(6).toString("hex")}.tmp`,u=new TextEncoder,y=e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return u.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){const r=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(r)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")};export{y as a,p as t};
|
|
@@ -955,4 +955,4 @@ type WriteIniExtras = {
|
|
|
955
955
|
* whitespace and inline `;` / `#` comments) for unchanged values.
|
|
956
956
|
*/
|
|
957
957
|
type WriteIniOptions = IniEncodeOptions & WriteFileOptions & WriteIniExtras;
|
|
958
|
-
export { CodeFrameLocation as A, FIND_UP_STOP as B, CompressionType as C, F_OK as D, FindUpNameFnResult as E, FindUpName as F,
|
|
958
|
+
export { CodeFrameLocation as A, FIND_UP_STOP as B, CompressionType as C, F_OK as D, FindUpNameFnResult as E, FindUpName as F, FindUpNameSyncFnResult as G, GlobOptions as H, IniEncodeOptions as I, Json5Reviver as J, R_OK as K, ReadFileEncoding as L, W_OK as M, ReadIniOptions as R, WriteIniOptions as W, X_OK as X, YamlReviver as Y, IniLineEnding as a, ReadJson5Options as b, WriteJson5Options as c, Json5Replacer as d, ReadJsoncOptions as e, WriteJsoncOptions as f, JsoncFormattingOptions as g, JsoncParseOptions as h, ReadTomlOptions as i, WriteTomlOptions as j, CodeFrameOptions as k, JsonReviver as l, ReadYamlOptions as m, WriteYamlOptions as n, JsonReplacer as o, YamlReplacer as p, WalkOptions as q, FindUpOptions as r, FindUpNameSync as s, WalkEntry as t, ReadFileOptions as u, ContentType as v, ReadJsonOptions as w, RetryOptions as x, WriteFileOptions as y, WriteJsonOptions as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as x}from"node:module";import{resolve as W,join as z,normalize as P,basename as S}from"@visulima/path";import{toPath as B}from"@visulima/path/utils";import F from"./WalkError-B8qTd-v-.js";import O from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{g as T,w as m,c as h}from"./walk-include-aizKyl9e.js";let E;const q=e=>(E??=x(import.meta.url))(e),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,s]=l.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return l.getBuiltinModule(e)}return q(e)},{readdir:R,realpath:M,stat:I}=N("node:fs/promises"),V=async e=>{const t=P(e),s=S(t),n=await I(t);return h(n,s,t)};async function*L(e,t={}){const{extensions:s,followSymlinks:n=!1,includeDirs:y=!0,includeFiles:_=!0,includeSymlinks:w=!0,match:v,maxDepth:u=Number.POSITIVE_INFINITY,skip:g}=t;if(O(e),u<0)return;const d=t.visited??new Set,c=v?v.map(i=>typeof i=="string"?T(i):i):void 0,a=g?g.map(i=>typeof i=="string"?T(i):i):void 0;if(e=W(B(e)),y&&m(e,s,c,a)&&(yield await V(e)),!(u<1||!m(e,void 0,void 0,a)))try{const i=await R(e,{withFileTypes:!0});for(const o of i){let r=z(e,o.name),k=o,{name:D}=o,b=o.isDirectory(),j=o.isFile();if(o.isSymbolicLink())if(n){const f=P(await M(r));if(d.has(f))continue;r=f;const p=await I(f);b=p.isDirectory(),j=p.isFile(),k=p,D=S(f)}else if(w&&m(r,s,c,a)){yield h(o,o.name,r);continue}else continue;b?(n&&d.add(r),yield*L(r,{extensions:s,followSymlinks:n,includeDirs:y,includeFiles:_,includeSymlinks:w,match:c,maxDepth:u-1,skip:a,visited:d})):j&&_&&m(r,s,c,a)&&(yield h(k,D,r))}}catch(i){throw i instanceof F?i:new F(i,e)}}export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=e=>{const t=[],r=new Set;let s=0;for(const a of e){if(a==="{")t.push(s);else if(a==="}"){const l=t.pop();l!==void 0&&(r.add(l),r.add(s))}s+=1}let i=0,c=0,n="";for(const a of e)a==="{"?r.has(c)?(n+="(",i+=1):n+=String.raw`\{`:a==="}"?r.has(c)?(n+=")",i-=1):n+=String.raw`\}`:a===","&&i>0?n+="|":n+=a,c+=1;return n},g=e=>{const t=e.replace(/[$()+\\^]/g,String.raw`\$&`).replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`),r=o(t).replace(/\[!(.*?)\]/g,"[^$1]");try{return new RegExp(`^${r}$`)}catch(s){throw new Error(`Invalid glob pattern: ${e}`,{cause:s})}};class p{name;path;#e;constructor(t,r,s){this.#e=t,this.name=r,this.path=s}isDirectory(){return this.#e.isDirectory()}isFile(){return this.#e.isFile()}isSymbolicLink(){return this.#e.isSymbolicLink()}}const h=(e,t,r)=>new p(e,t,r),f=(e,t,r,s)=>{if(Array.isArray(t)&&t.length>0&&!t.some(c=>e.endsWith(c)))return!1;const i=e.includes("\\")?e.replaceAll("\\","/"):e;return r&&!r.some(c=>c.test(i))?!1:!s?.some(c=>c.test(i))};export{h as c,g,f as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as x}from"node:module";import{resolve as W,join as z,normalize as m,basename as P}from"@visulima/path";import{toPath as B}from"@visulima/path/utils";import F from"./WalkError-B8qTd-v-.js";import O from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{g as T,w as f,c as y}from"./walk-include-aizKyl9e.js";let E;const q=e=>(E??=x(import.meta.url))(e),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,s]=l.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return l.getBuiltinModule(e)}return q(e)},{readdirSync:R,realpathSync:M,statSync:I}=N("node:fs"),V=e=>{const t=m(e),s=I(t);return y(s,P(t),t)};function*L(e,t={}){const{extensions:s,followSymlinks:u=!1,includeDirs:_=!0,includeFiles:v=!0,includeSymlinks:g=!0,match:k,maxDepth:d=Number.POSITIVE_INFINITY,skip:D}=t;if(O(e),d<0)return;const p=t.visited??new Set,c=k?k.map(i=>typeof i=="string"?T(i):i):void 0,r=D?D.map(i=>typeof i=="string"?T(i):i):void 0;if(e=W(B(e)),_&&f(e,s,c,r)&&(yield V(e)),!(d<1||!f(e,void 0,void 0,r)))try{const i=R(e,{withFileTypes:!0});for(const o of i){let n=z(e,o.name),S=o,{name:w}=o,b=o.isDirectory(),j=o.isFile();if(o.isSymbolicLink())if(u){const a=m(M(n));if(p.has(a))continue;n=a;const h=I(a);b=h.isDirectory(),j=h.isFile(),S=h,w=P(a)}else if(g&&f(n,s,c,r)){yield y(o,o.name,m(n));continue}else continue;b?(u&&p.add(n),yield*L(n,{extensions:s,followSymlinks:u,includeDirs:_,includeFiles:v,includeSymlinks:g,match:c,maxDepth:d-1,skip:r,visited:p})):j&&v&&f(n,s,c,r)&&(yield y(S,w,m(n)))}}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 k}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import{F_OK as q}from"./FIND_UP_STOP-pQqZdUPw.js";import B from"./AlreadyExistsError-DEb3UWja.js";import n from"./isAccessible-CqNOFdZu.js";import E from"./assertValidFileContents-CbIN7sy7.js";import P from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{t as A,a as R}from"./to-uint-8-array-DlTu4L-l.js";let g;const _=e=>(g??=w(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[i,r]=s.versions.node.split(".").map(Number);if(i>22||i===22&&r>=3||i===20&&r>=16)return s.getBuiltinModule(e)}return _(e)},{mkdir:v,readFile:b,writeFile:F,stat:x,rename:d,chown:h,chmod:j,unlink:$}=y("node:fs/promises"),z=async(e,i,r)=>{r={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},P(e),E(i),e=p(e);const o=await n(e,q),f=r.flag??"w",m=f.includes("a"),u=f.includes("x");if(o&&(!r.overwrite||u))throw new B(`file already exists, open '${e}'`);const a=A(e);try{!o&&r.recursive&&await v(k(e),{recursive:!0});let t,c=typeof i=="string"?Buffer.from(i,r.encoding??"utf8"):R(i);if(m&&o&&(c=Buffer.concat([await b(e),c])),await F(a,c,{flag:"wx"}),o&&r.backup&&(t=await x(e),r.chown??={gid:t.gid,uid:t.uid},await d(e,`${e}.bak`)),r.chown)try{await h(a,r.chown.uid,r.chown.gid)}catch{}const l=t&&r.mode===void 0?t.mode:r.mode;l!==void 0&&await j(a,l),await d(a,e)}catch(t){throw new Error(`Failed to write file at: ${e} - ${t.message}`,{cause:t})}finally{await n(a)&&await $(a)}};export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as y}from"node:module";import{dirname as k}from"@visulima/path";import{toPath as $}from"@visulima/path/utils";import{F_OK as p}from"./FIND_UP_STOP-pQqZdUPw.js";import q from"./AlreadyExistsError-DEb3UWja.js";import d from"./isAccessibleSync-DYKTrrvc.js";import B from"./assertValidFileContents-CbIN7sy7.js";import E from"./assertValidFileOrDirectoryPath-CAHgg-jK.js";import{t as P,a as A}from"./to-uint-8-array-DlTu4L-l.js";let w;const g=e=>(w??=y(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[i,r]=o.versions.node.split(".").map(Number);if(i>22||i===22&&r>=3||i===20&&r>=16)return o.getBuiltinModule(e)}return g(e)},{mkdirSync:v,readFileSync:S,writeFileSync:b,statSync:F,renameSync:l,chownSync:x,chmodSync:h,unlinkSync:j}=_("node:fs"),U=(e,i,r)=>{r={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},E(e),B(i),e=$(e);const s=d(e,p),a=r.flag??"w",u=a.includes("a"),m=a.includes("x");if(s&&(!r.overwrite||m))throw new q(`file already exists, open '${e}'`);const t=P(e);try{!s&&r.recursive&&v(k(e),{recursive:!0});let c,n=typeof i=="string"?Buffer.from(i,r.encoding??"utf8"):A(i);if(u&&s&&(n=Buffer.concat([S(e),n])),b(t,n,{flag:"wx"}),s&&r.backup&&(c=F(e),r.chown??={gid:c.gid,uid:c.uid},l(e,`${e}.bak`)),r.chown)try{x(t,r.chown.uid,r.chown.gid)}catch{}const f=c&&r.mode===void 0?c.mode:r.mode;f!==void 0&&h(t,f),l(t,e)}catch(c){throw new Error(`Failed to write file at: ${e} - ${c.message}`,{cause:c})}finally{d(t)&&j(t)}};export{U as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as q}from"node:module";import{parse as E,stringify as I}from"ini";import{R_OK as S}from"./FIND_UP_STOP-pQqZdUPw.js";import k from"./isAccessible-CqNOFdZu.js";import{d as B,m as F}from"./ini-preserve-D3Z1KcgN.js";import M from"./writeFile-BIBP7wbK.js";let A;const O=e=>(A??=q(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,n]=o.versions.node.split(".").map(Number);if(r>22||r===22&&n>=3||r===20&&n>=16)return o.getBuiltinModule(e)}return O(e)},{readFile:x}=R("node:fs/promises"),C=async(e,r,n={})=>{const{eol:_,preserveStyle:g=!0,whitespace:w,...y}=n,{align:b,bracketedArray:a,newline:h,platform:v,section:f,sort:j,...T}=y;let c=_,p=w,s,l;if(g?await k(e,S):!1)try{s=await x(e,"utf8"),l=E(s,{bracketedArray:a??!0});const t=B(s);c??=t.eol,p??=t.whitespace}catch(t){if(t.code!=="ENOENT")throw t}const d={align:b,bracketedArray:a,newline:h,platform:v,section:f,sort:j,whitespace:p},u=(t,m)=>I(t,m===void 0?d:{...d,section:m});let i;s!==void 0&&l?i=F(s,l,r,u,{eol:c??`
|
|
2
|
+
`}):(i=u(r,f),c===`\r
|
|
3
|
+
`&&(i=i.replaceAll(/\r?\n/g,`\r
|
|
4
|
+
`))),await M(e,i,T)};export{C as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as T}from"node:module";import{parse as x,stringify as E}from"ini";import{R_OK as I}from"./FIND_UP_STOP-pQqZdUPw.js";import k from"./isAccessibleSync-DYKTrrvc.js";import{d as B,m as F}from"./ini-preserve-D3Z1KcgN.js";import M from"./writeFileSync-DJoHk3Ks.js";let q;const A=e=>(q??=T(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[t,n]=s.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return s.getBuiltinModule(e)}return A(e)},{readFileSync:R}=O("node:fs"),z=(e,t,n={})=>{const{eol:_,preserveStyle:y=!0,whitespace:g,...h}=n,{align:v,bracketedArray:a,newline:w,platform:b,section:d,sort:S,...j}=h;let c=_,f=g,o,l;if(y&&k(e,I))try{o=R(e,"utf8"),l=x(o,{bracketedArray:a??!0});const r=B(o);c??=r.eol,f??=r.whitespace}catch(r){if(r.code!=="ENOENT")throw r}const p={align:v,bracketedArray:a,newline:w,platform:b,section:d,sort:S,whitespace:f},u=(r,m)=>E(r,m===void 0?p:{...p,section:m});let i;o!==void 0&&l?i=F(o,l,t,u,{eol:c??`
|
|
2
|
+
`}):(i=u(t,d),c===`\r
|
|
3
|
+
`&&(i=i.replaceAll(/\r?\n/g,`\r
|
|
4
|
+
`))),M(e,i,j)};export{z as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";import{d as y}from"./index-CBWLeiRp.js";import{R_OK as b}from"./FIND_UP_STOP-pQqZdUPw.js";import h from"./isAccessible-CqNOFdZu.js";import N from"./writeFile-BIBP7wbK.js";let _;const g=e=>(_??=m(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,r]=i.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return i.getBuiltinModule(e)}return g(e)},{readFile:j}=w("node:fs/promises"),v=async(e,t,r={})=>{const{detectIndent:c,indent:d,replacer:a,stringify:f=JSON.stringify,...l}={indent:" ",...r};let o=d,s=`
|
|
2
|
+
`;if(await h(e,b))try{const n=await j(e,"utf8");if(c){const{indent:u}=y(n);o=u}s=n.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(n){if(n.code!=="ENOENT")throw n}const p=f(t,a,o);await N(e,`${p}${s}`,l)};export{v as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";import{d as y}from"./index-CBWLeiRp.js";import b from"json5";import{R_OK as h}from"./FIND_UP_STOP-pQqZdUPw.js";import q from"./isAccessible-CqNOFdZu.js";import N from"./writeFile-BIBP7wbK.js";let _;const g=e=>(_??=m(import.meta.url))(e),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,o]=n.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return n.getBuiltinModule(e)}return g(e)},{readFile:j}=w("node:fs/promises"),B=async(e,t,o={})=>{const{detectIndent:d,indent:a,quote:f,replacer:l,...p}={indent:" ",...o};let r=a,s=`
|
|
2
|
+
`;if(await q(e,h))try{const i=await j(e,"utf8");if(d){const{indent:c}=y(i);c&&(r=c)}s=i.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(i){if(i.code!=="ENOENT")throw i}const u=b.stringify(t,{quote:f,replacer:l,space:r});await N(e,`${u}${s}`,p)};export{B as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{d as b}from"./index-CBWLeiRp.js";import h from"json5";import{R_OK as q}from"./FIND_UP_STOP-pQqZdUPw.js";import w from"./isAccessibleSync-DYKTrrvc.js";import N from"./writeFileSync-DJoHk3Ks.js";let _;const y=e=>(_??=a(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,o]=i.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return i.getBuiltinModule(e)}return y(e)},{readFileSync:j}=g("node:fs"),$=(e,t,o={})=>{const{detectIndent:d,indent:f,quote:l,replacer:u,...p}={indent:" ",...o};let r=f,s=`
|
|
2
|
+
`;if(w(e,q))try{const n=j(e,"utf8");if(d){const{indent:c}=b(n);c&&(r=c)}s=n.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(n){if(n.code!=="ENOENT")throw n}const m=h.stringify(t,{quote:l,replacer:u,space:r});N(e,`${m}${s}`,p)};export{$ as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{d as b}from"./index-CBWLeiRp.js";import{R_OK as h}from"./FIND_UP_STOP-pQqZdUPw.js";import w from"./isAccessibleSync-DYKTrrvc.js";import N from"./writeFileSync-DJoHk3Ks.js";let m;const y=e=>(m??=a(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[n,r]=i.versions.node.split(".").map(Number);if(n>22||n===22&&r>=3||n===20&&r>=16)return i.getBuiltinModule(e)}return y(e)},{readFileSync:j}=g("node:fs"),T=(e,n,r={})=>{const{detectIndent:c,indent:d,replacer:f,stringify:l=JSON.stringify,...u}={indent:" ",...r};let o=d,s=`
|
|
2
|
+
`;if(w(e,h))try{const t=j(e,"utf8");if(c){const{indent:_}=b(t);o=_}s=t.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(t){if(t.code!=="ENOENT")throw t}const p=l(n,f,o);N(e,`${p}${s}`,u)};export{T as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";import{d as j}from"./index-CBWLeiRp.js";import{R_OK as x}from"./FIND_UP_STOP-pQqZdUPw.js";import y from"./isAccessible-CqNOFdZu.js";import{b as O}from"./jsonc-merge-BGm21l00.js";import T from"./writeFile-BIBP7wbK.js";let _;const g=e=>(_??=m(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[t,n]=c.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return c.getBuiltinModule(e)}return g(e)},{readFile:b}=w("node:fs/promises"),h=async(e,t,n)=>{let r,s=n,o=`
|
|
2
|
+
`;if(!await y(e,x))return{indent:s,trailingNewline:o};try{if(r=await b(e,"utf8"),t){const{indent:i}=j(r);i&&(s=i)}o=r.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(i){if(i.code!=="ENOENT")throw i}return{existingText:r,indent:s,trailingNewline:o}},B=async(e,t,n={})=>{const{detectIndent:r,formattingOptions:s,indent:o,preserveComments:a=!0,replacer:i,...d}={indent:" ",...n},{existingText:l,indent:u,trailingNewline:f}=await h(e,r,o),p=O(l,t,a,u,f,s,i);await T(e,p,d)};export{B as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{d as j}from"./index-CBWLeiRp.js";import{R_OK as w}from"./FIND_UP_STOP-pQqZdUPw.js";import x from"./isAccessibleSync-DYKTrrvc.js";import{b as O}from"./jsonc-merge-BGm21l00.js";import T from"./writeFileSync-DJoHk3Ks.js";let _;const g=e=>(_??=a(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=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:b}=y("node:fs"),h=(e,t,i)=>{let r,o=i,s=`
|
|
2
|
+
`;if(!x(e,w))return{indent:o,trailingNewline:s};try{if(r=b(e,"utf8"),t){const{indent:n}=j(r);n&&(o=n)}s=r.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(n){if(n.code!=="ENOENT")throw n}return{existingText:r,indent:o,trailingNewline:s}},I=(e,t,i={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:n=!0,replacer:d,...l}={indent:" ",...i},{existingText:u,indent:f,trailingNewline:p}=h(e,r,s),m=O(u,t,n,f,p,o,d);T(e,m,l)};export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as o}from"smol-toml";import a from"./writeFile-BIBP7wbK.js";const f=async(t,i,r)=>{await a(t,o(i),r)};export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as o}from"smol-toml";import e from"./writeFileSync-DJoHk3Ks.js";const n=(r,t,i)=>{e(r,o(t),i)};export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as a}from"@visulima/yaml";import c from"./writeFile-BIBP7wbK.js";async function p(n,s,t,o){let e,i,f;typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t!="function"?(e=t,i=e.replacer,f=e.space):typeof o=="object"?(e=o,i=t,f=e.space):(i=t,f=o);const y=a(s,i,f??e);await c(n,y,e)}export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as c}from"@visulima/yaml";import l from"./writeFileSync-DJoHk3Ks.js";function p(o,s,t,n){let e,f,i;typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t!="function"?(e=t,f=e.replacer,i=e.space):typeof n=="object"?(e=n,f=t,i=e.space):(f=t,i=n);const y=c(s,f,i??e);l(o,y,e)}export{p as default};
|
package/dist/size.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as b}from"node:module";import{toPath as l}from"@visulima/path/utils";let z;const _=e=>(z??=b(import.meta.url))(e),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[r,t]=n.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return n.getBuiltinModule(e)}return _(e)},{readFileSync:h,statSync:P,createReadStream:w,existsSync:u}=c("node:fs"),{isAbsolute:B,resolve:p}=c("node:path"),{Readable:R}=c("node:stream"),{URL:i}=c("node:url"),{brotliCompressSync:f,gzipSync:a,createGzip:j,createBrotliCompress:q}=c("node:zlib"),g=e=>{if(B(e))return u(e);try{return u(p(e))}catch{return!1}},v=async e=>{let r=0;for await(const t of e)r+=Buffer.from(t).length;return r},S=async(e,r)=>{let t=0;const s=r();return await new Promise((o,m)=>{s.on("data",d=>{t+=d.length}),s.on("end",()=>{o(t)}),s.on("error",m),e.on("error",m),e.pipe(s)})},y=async(e,r,t)=>{if(e instanceof i||typeof e=="string"){const s=l(e);if(g(s)){const o=w(s);return await t(o)}if(typeof e=="string")return r(Buffer.from(e))}return e instanceof R?await t(e):r(e)},C=async(e,r)=>await y(e,o=>a(o,r).length,async o=>await S(o,()=>j(r))),T=async(e,r)=>await y(e,o=>f(o,r).length,async o=>await S(o,()=>q(r))),M=async e=>await y(e,s=>s.length,async s=>await v(s)),k=(e,r)=>{if(e instanceof i||typeof e=="string"){const t=l(e);if(g(t))return a(h(t),r).length;if(typeof e=="string")return a(Buffer.from(e),r).length}return a(e,r).length},A=(e,r)=>{if(e instanceof i||typeof e=="string"){const t=l(e);if(g(t))return f(h(t),r).length;if(typeof e=="string")return f(Buffer.from(e),r).length}return f(e,r).length},F=e=>{if(e instanceof i||typeof e=="string"){const r=l(e);if(g(r))return P(r).size;if(typeof e=="string")return Buffer.from(e).length}return e.length};export{T as brotliSize,A as brotliSizeSync,C as gzipSize,k as gzipSizeSync,M as rawSize,F as rawSizeSync};
|
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-B-T1rDxl.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-
|
|
1
|
+
import{default as r}from"./packem_shared/readToml-jD08lZRN.js";import{default as t}from"./packem_shared/readTomlSync-0J8gIalg.js";import{default as l}from"./packem_shared/writeToml-Frvwh0Kn.js";import{default as d}from"./packem_shared/writeTomlSync-BvKdlKvE.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
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { k as CodeFrameOptions, l as JsonReviver } from "./packem_shared/types.d-B-T1rDxl.js";
|
|
3
|
+
import { J as JsonValue } from "./packem_shared/json-value.d-DZqAihX4.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-
|
|
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-CAHgg-jK.js";import{default as m}from"./packem_shared/parseJson-gfl5PTTo.js";import{default as d}from"./packem_shared/stripJsonComments-Do7s7No5.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-B-T1rDxl.js";
|
|
2
|
+
export type { p as YamlReplacer } from "./packem_shared/types.d-B-T1rDxl.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-C63_W9Qg.js";import{default as f}from"./packem_shared/readYamlSync-CuyDW6xR.js";import{default as m}from"./packem_shared/writeYaml-C4IGXTOo.js";import{default as d}from"./packem_shared/writeYamlSync-BAbWtkvq.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": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Human friendly file system utilities for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"ini": "^7.0.0",
|
|
157
157
|
"json5": "^2.2.3",
|
|
158
158
|
"jsonc-parser": "^3.3.1",
|
|
159
|
-
"smol-toml": "^1.7.
|
|
159
|
+
"smol-toml": "^1.7.1"
|
|
160
160
|
},
|
|
161
161
|
"peerDependenciesMeta": {
|
|
162
162
|
"@visulima/yaml": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const _=0,O=4,S=2,o=1,K=Symbol("findUpStop"),N=/"(?:[^"\\]|\\.)*"|\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g;export{K as FIND_UP_STOP,_ as F_OK,N as INTERNAL_STRIP_JSON_REGEX,O as R_OK,S as W_OK,o as X_OK};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}export{o as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=n=>{if(!n||!(n instanceof URL)&&typeof n!="string")throw new TypeError("Path must be a non-empty string or URL.")};export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=r=>{const e={force:!0,recursive:!0};return r?.maxRetries!==void 0&&(e.maxRetries=r.maxRetries),r?.retryDelay!==void 0&&(e.retryDelay=r.retryDelay),e};export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from"./walk-B211aFS7.js";const e=async(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for await(const t of n(r,s))o.push(t.path);return o};export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"./walkSync-VeMvHYLk.js";const a=(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for(const n of t(r,s))o.push(n.path);return o};export{a as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import j from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";let y;const h=e=>(y??=v(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,t]=s.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return s.getBuiltinModule(e)}return h(e)},{cp:g}=b("node:fs/promises"),w=async(e,r,t={})=>{c(e),c(r);const{dereference:a=!1,errorOnExist:f=!0,filter:m,overwrite:l=!0,preserveTimestamps:p=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(e),o=n(r);try{await g(_,o,{dereference:a,errorOnExist:f,filter:m,force:l,preserveTimestamps:p,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new j(`destination already exists, copy '${o}'`):i}};export{w as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import j from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";let y;const h=e=>(y??=v(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,t]=s.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return s.getBuiltinModule(e)}return h(e)},{cpSync:g}=b("node:fs"),q=(e,r,t={})=>{c(e),c(r);const{dereference:a=!1,errorOnExist:f=!0,filter:l,overwrite:m=!0,preserveTimestamps:p=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(e),o=n(r);try{g(_,o,{dereference:a,errorOnExist:f,filter:l,force:m,preserveTimestamps:p,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new j(`destination already exists, copy '${o}'`):i}};export{q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as c}from"node:module";import{join as _}from"@visulima/path";import{toPath as l}from"@visulima/path/utils";import j from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as g}from"./build-rm-options-avnusYx-.js";let a;const u=e=>(a??=c(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return u(e)},{existsSync:f}=i("node:fs"),{mkdir:m,readdir:d,rm:p}=i("node:fs/promises"),w=async(e,o)=>{if(j(e),!f(e)){await m(e,{recursive:!0});return}const s=await d(e),t=g(o);for(const n of s)await p(_(l(e),n),t)};export{w as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as t}from"node:module";import{join as p}from"@visulima/path";import{toPath as _}from"@visulima/path/utils";import l from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as j}from"./build-rm-options-avnusYx-.js";let n;const c=e=>(n??=t(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,s]=o.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return o.getBuiltinModule(e)}return c(e)},{existsSync:f,mkdirSync:m,readdirSync:a,rmSync:d}=u("node:fs"),v=(e,r)=>{if(l(e),!f(e)){m(e,{recursive:!0});return}const s=j(r);for(const i of a(e))d(p(_(e),i),s)};export{v as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as n}from"node:module";import p from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as i}from"./get-file-info-type-DzWpohDB.js";let c;const a=r=>(c??=n(import.meta.url))(r),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return a(r)},{lstat:s,mkdir:d}=u("node:fs/promises"),m=async r=>{p(r);try{const e=await s(r);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await d(r,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const t=await s(r);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(t))}'`,{cause:e})}};export{m as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as i}from"node:module";import{dirname as a}from"@visulima/path";import{toPath as l}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import u from"./ensureDirSync-B0w9WMwE.js";import{g as d}from"./get-file-info-type-DzWpohDB.js";let s;const n=e=>(s??=i(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,t]=o.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return o.getBuiltinModule(e)}return n(e)},{lstatSync:f,writeFileSync:p}=c("node:fs"),T=e=>{m(e);try{const r=f(e);if(!r.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(d(r))}'`)}catch(r){if(r.code==="ENOENT"){u(a(l(e))),p(e,new Uint8Array);return}throw r}};export{T as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as p}from"node:module";import{toNamespacedPath as n,dirname as h}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import g from"./ensureDir-BEiomfxz.js";import{d as j}from"./is-stats-identical-l1GRN4Qu.js";let u;const f=e=>(u??=p(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[t,o]=s.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return s.getBuiltinModule(e)}return f(e)},{lstat:a,link:_}=d("node:fs/promises"),R=async(e,t)=>{m(e),m(t),e=n(c(e)),t=n(c(t));let o;try{o=await a(t)}catch{}let i;try{i=await a(e)}catch(l){const r=l;throw r.message=r.message.replace("lstat","ensureLink"),r}o&&j(i,o)||(await g(h(t)),await _(e,t))};export{R as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as p}from"node:module";import{toNamespacedPath as c,dirname as h}from"@visulima/path";import{toPath as a}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import g from"./ensureDirSync-B0w9WMwE.js";import{d as y}from"./is-stats-identical-l1GRN4Qu.js";let u;const f=e=>(u??=p(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,t]=s.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return s.getBuiltinModule(e)}return f(e)},{lstatSync:i,linkSync:_}=d("node:fs"),T=(e,o)=>{m(e),m(o),e=c(a(e)),o=c(a(o));let t;try{t=i(o)}catch{}let n;try{n=i(e)}catch(l){const r=l;throw r.message=r.message.replace("lstat","ensureLink"),r}t&&y(n,t)||(g(h(o)),_(e,o))};export{T as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as g}from"node:module";import{toNamespacedPath as m,dirname as P,resolve as S}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import q from"./ensureDir-BEiomfxz.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";import{d as x}from"./is-stats-identical-l1GRN4Qu.js";import{t as E}from"./resolve-symlink-target-CWrn0v4P.js";import h from"./AlreadyExistsError-DEb3UWja.js";let j;const b=i=>(j??=g(import.meta.url))(i),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=i=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,o]=t.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return t.getBuiltinModule(i)}return b(i)},{lstat:c,stat:f,symlink:k,readlink:v}=T("node:fs/promises"),R=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Y=async(i,e,o)=>{d(i),d(e);const r=E(i,e);e=m(p(e));try{if((await c(e)).isSymbolicLink()){const[s,n]=await Promise.all([f(r),f(e)]);if(x(s,n))return}}catch{}const w=await c(r),y=u(w);await q(P(e));let a=o??"file";o||(R?a="junction":a=y==="dir"?"dir":"file");try{await k(m(p(r)),e,a)}catch(s){if(s.code!=="EEXIST")throw s;const n=await c(e);if(!n.isSymbolicLink())throw new h(`A ${String(u(n))} already exists at the path: ${e}`);const _=await v(e),l=m(S(_));if(l!==r)throw new h(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}};export{Y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{toNamespacedPath as l,dirname as q,resolve as x}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import P from"./ensureDirSync-B0w9WMwE.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";import{d as y}from"./is-stats-identical-l1GRN4Qu.js";import{t as E}from"./resolve-symlink-target-CWrn0v4P.js";import _ from"./AlreadyExistsError-DEb3UWja.js";let w;const b=o=>(w??=j(import.meta.url))(o),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=o=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,r]=i.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return i.getBuiltinModule(o)}return b(o)},{lstatSync:m,statSync:c,symlinkSync:k,readlinkSync:v}=T("node:fs"),R=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Y=(o,e,r)=>{d(o),d(e);const t=E(o,e);e=l(p(e));try{if(m(e).isSymbolicLink()&&y(c(t),c(e))){const s=c(t),n=c(e);if(y(s,n))return}}catch{}const h=m(t),g=u(h);P(q(e));let a=r??"file";r||(R?a="junction":a=g==="dir"?"dir":"file");try{k(l(p(t)),e,a)}catch(s){if(s.code!=="EEXIST")throw s;const n=m(e);if(!n.isSymbolicLink())throw new _(`A ${String(u(n))} already exists at the path: ${e}`);const S=v(e),f=l(x(S));if(f!==t)throw new _(`A symlink targeting to an undesired path already exists: ${e} -> ${f}`)}};export{Y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as g}from"node:module";import{resolve as c,parse as T,isAbsolute as v,dirname as q}from"@visulima/path";import{toPath as f}from"@visulima/path/utils";import{FIND_UP_STOP as B}from"./FIND_UP_STOP-CAwY1qU7.js";let w;const h=t=>(w??=g(import.meta.url))(t),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,i]=s.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return s.getBuiltinModule(t)}return h(t)},{stat:A,lstat:j}=b("node:fs/promises"),D=async(t,o={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const i=o.cwd?f(o.cwd):process.cwd();let r=c(i);const{root:a}=T(r),y=f(o.stopAt??a),m=c(r,y),u=o.type??"file",d=async function(n){return typeof t=="function"?[await t(n)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};o.allowSymlinks??=!0;const _=o.allowSymlinks?A:j;for(;r;){const n=await d(r);for(let e of n){if(e===B)return;if(e===void 0)continue;Buffer.isBuffer(e)?e=e.toString():e instanceof URL&&(e=f(e));const l=v(e)?e:c(r,e);try{const p=await _(l);if(u==="file"&&p.isFile()||u==="directory"&&p.isDirectory())return l}catch{}}if(r===m||r===a)break;r=q(r)}};export{D as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as _}from"node:module";import{resolve as i,parse as A,isAbsolute as S,dirname as T}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import{FIND_UP_STOP as v}from"./FIND_UP_STOP-CAwY1qU7.js";let g;const h=e=>(g??=_(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,n]=s.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return s.getBuiltinModule(e)}return h(e)},{statSync:w,lstatSync:j}=b("node:fs"),k=(e,o={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const n=o.cwd?c(o.cwd):process.cwd();let r=i(n);const{root:f}=A(r),p=c(o.stopAt??f),y=i(r,p),u=o.type??"file",d=function(t){return typeof e=="function"?[e(t)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]};o.allowSymlinks??=!0;const m=o.allowSymlinks?w:j;for(;r;){for(let t of d(r)){if(t===v)return;if(t===void 0)continue;Buffer.isBuffer(t)?t=t.toString():t instanceof URL&&(t=c(t));const a=S(t)?t:i(r,t);try{const l=m(a);if(u==="file"&&l.isFile()||u==="directory"&&l.isDirectory())return a}catch{}}if(r===y||r===f)break;r=T(r)}};export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as o}from"./index-CPZbuHkp.js";const i=async(a,t)=>await o(a,t);export{i as default};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { G as GlobOptions } from "./types.d-CgCO6qUp.js";
|
|
2
|
-
/**
|
|
3
|
-
* Asynchronously matches files on disk using one or more glob patterns.
|
|
4
|
-
*
|
|
5
|
-
* Powered by [`tinyglobby`](https://github.com/SuperchupuDev/tinyglobby); `tinyglobby` is bundled into the
|
|
6
|
-
* built output so it does not appear as a runtime dependency of `@visulima/fs`.
|
|
7
|
-
*
|
|
8
|
-
* Pattern forms:
|
|
9
|
-
*
|
|
10
|
-
* - Plain glob — `src/**\/*.ts`
|
|
11
|
-
* - Negated pattern — `!src/**\/*.spec.ts` inside `patterns` adds to the internal ignore list (same as passing it via `ignore`).
|
|
12
|
-
* - Negated ignore — a leading `!` inside {@link GlobOptions.ignore} _un-ignores_ entries that an earlier ignore pattern would drop, e.g. `ignore: ["dist/**", "!dist/index.d.ts"]`.
|
|
13
|
-
* @param patterns A single glob pattern or an array of glob patterns.
|
|
14
|
-
* @param options Optional glob options. See {@link GlobOptions}.
|
|
15
|
-
* @returns A promise resolving to the array of matched paths. Paths are relative to {@link GlobOptions.cwd} unless {@link GlobOptions.absolute} is `true`.
|
|
16
|
-
* @example
|
|
17
|
-
* ```javascript
|
|
18
|
-
* import { glob } from "@visulima/fs";
|
|
19
|
-
*
|
|
20
|
-
* const jsFiles = await glob("src/**\/*.{js,ts}", { cwd: process.cwd(), ignore: ["**\/node_modules/**"] });
|
|
21
|
-
* console.log(jsFiles);
|
|
22
|
-
*
|
|
23
|
-
* // Negated ignore: drop everything under `ignored/` except `ignored/keep.ts`.
|
|
24
|
-
* const keep = await glob("**\/*.ts", { ignore: ["ignored/**", "!ignored/keep.ts"] });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
declare const glob: (patterns: string | ReadonlyArray<string>, options?: GlobOptions) => Promise<string[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Synchronously matches files on disk using one or more glob patterns.
|
|
30
|
-
*
|
|
31
|
-
* Synchronous counterpart of `glob`. Powered by [`tinyglobby`](https://github.com/SuperchupuDev/tinyglobby);
|
|
32
|
-
* bundled into the built output so it does not appear as a runtime dependency of `@visulima/fs`.
|
|
33
|
-
*
|
|
34
|
-
* Pattern forms:
|
|
35
|
-
*
|
|
36
|
-
* - Plain glob — `src/**\/*.ts`
|
|
37
|
-
* - Negated pattern — `!src/**\/*.spec.ts` inside `patterns` adds to the internal ignore list.
|
|
38
|
-
* - Negated ignore — a leading `!` inside {@link GlobOptions.ignore} _un-ignores_ entries that an earlier ignore pattern would drop, e.g. `ignore: ["dist/**", "!dist/index.d.ts"]`.
|
|
39
|
-
* @param patterns A single glob pattern or an array of glob patterns.
|
|
40
|
-
* @param options Optional glob options. See {@link GlobOptions}.
|
|
41
|
-
* @returns The array of matched paths. Paths are relative to {@link GlobOptions.cwd} unless {@link GlobOptions.absolute} is `true`.
|
|
42
|
-
* @example
|
|
43
|
-
* ```javascript
|
|
44
|
-
* import { globSync } from "@visulima/fs";
|
|
45
|
-
*
|
|
46
|
-
* const jsFiles = globSync(["src/**\/*.ts", "!**\/*.spec.ts"]);
|
|
47
|
-
* console.log(jsFiles);
|
|
48
|
-
*
|
|
49
|
-
* // Negated ignore: drop everything under `ignored/` except `ignored/keep.ts`.
|
|
50
|
-
* const keep = globSync("**\/*.ts", { ignore: ["ignored/**", "!ignored/keep.ts"] });
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
declare const globSync: (patterns: string | ReadonlyArray<string>, options?: GlobOptions) => string[];
|
|
54
|
-
export { globSync as a, glob as g };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as r}from"./index-CPZbuHkp.js";const s=(t,o)=>r(t,o);export{s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const b=/^(?:( )+|\t+)/,u="space";function d(n,t,e){return n&&t===u&&e===1}function h(n,t){const e=new Map;let o=0,r,c;for(const i of n.split(/\n/g)){if(!i)continue;const f=i.match(b);if(f===null)o=0,r="";else{const a=f[0].length,s=f[1]?u:"tab";if(d(t,s,a))continue;s!==r&&(o=0),r=s;let p=1,g=0;const m=a-o;if(o=a,m===0)p=0,g=1;else{const y=Math.abs(m);if(d(t,s,y))continue;c=w(s,y)}const l=e.get(c);e.set(c,l===void 0?[1,0]:[l[0]+p,l[1]+g])}}return e}function w(n,t){return(n===u?"s":"t")+String(t)}function E(n){const t=n[0]==="s"?u:"tab",e=Number(n.slice(1));return{type:t,amount:e}}function v(n){let t,e=0,o=0;for(const[r,[c,i]]of n)(c>e||c===e&&i>o)&&(e=c,o=i,t=r);return t}function x(n,t){return(n===u?" ":" ").repeat(t)}function M(n){if(typeof n!="string")throw new TypeError("Expected a string");let t=h(n,!0);t.size===0&&(t=h(n,!1));const e=v(t);let o,r=0,c="";return e!==void 0&&({type:o,amount:r}=E(e),c=x(o,r)),{amount:r,type:o,indent:c}}export{M as k};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var o,c;function b(){if(c)return o;c=1;/*!
|
|
2
|
-
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/return o=function(s){if(typeof s!="string"||s==="")return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(s);){if(e[2])return!0;s=s.slice(e.index+e[0].length)}return!1},o}var x,O;function q(){if(O)return x;O=1;/*!
|
|
7
|
-
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
10
|
-
* Released under the MIT License.
|
|
11
|
-
*/var s=b(),e={"{":"}","(":")","[":"]"},g=function(t){if(t[0]==="!")return!0;for(var r=0,u=-2,f=-2,a=-2,l=-2,n=-2;r<t.length;){if(t[r]==="*"||t[r+1]==="?"&&/[\].+)]/.test(t[r])||f!==-1&&t[r]==="["&&t[r+1]!=="]"&&(f<r&&(f=t.indexOf("]",r)),f>r&&(n===-1||n>f||(n=t.indexOf("\\",r),n===-1||n>f)))||a!==-1&&t[r]==="{"&&t[r+1]!=="}"&&(a=t.indexOf("}",r),a>r&&(n=t.indexOf("\\",r),n===-1||n>a))||l!==-1&&t[r]==="("&&t[r+1]==="?"&&/[:!=]/.test(t[r+2])&&t[r+3]!==")"&&(l=t.indexOf(")",r),l>r&&(n=t.indexOf("\\",r),n===-1||n>l))||u!==-1&&t[r]==="("&&t[r+1]!=="|"&&(u<r&&(u=t.indexOf("|",r)),u!==-1&&t[u+1]!==")"&&(l=t.indexOf(")",u),l>u&&(n=t.indexOf("\\",u),n===-1||n>l))))return!0;if(t[r]==="\\"){var h=t[r+1];r+=2;var v=e[h];if(v){var d=t.indexOf(v,r);d!==-1&&(r=d+1)}if(t[r]==="!")return!0}else r++}return!1},i=function(t){if(t[0]==="!")return!0;for(var r=0;r<t.length;){if(/[*?{}()[\]]/.test(t[r]))return!0;if(t[r]==="\\"){var u=t[r+1];r+=2;var f=e[u];if(f){var a=t.indexOf(f,r);a!==-1&&(r=a+1)}if(t[r]==="!")return!0}else r++}return!1};return x=function(t,r){if(typeof t!="string"||t==="")return!1;if(s(t))return!0;var u=g;return r&&r.strict===!1&&(u=i),u(t)},x}export{q as r};
|