@visulima/fs 5.0.0-alpha.30 → 5.0.0-alpha.32
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 +32 -0
- package/LICENSE.md +29 -0
- package/README.md +65 -0
- package/dist/eol.js +2 -2
- package/dist/error.js +1 -1
- package/dist/glob-parent.js +1 -1
- package/dist/glob.d.ts +3 -3
- package/dist/glob.js +1 -1
- package/dist/index.d.ts +98 -25
- package/dist/index.js +1 -1
- package/dist/ini.d.ts +3 -3
- package/dist/ini.js +1 -1
- package/dist/is-glob.js +1 -1
- package/dist/json5.d.ts +3 -3
- package/dist/json5.js +1 -1
- package/dist/jsonc.d.ts +3 -3
- package/dist/jsonc.js +1 -1
- package/dist/match.js +1 -1
- package/dist/packem_shared/AlreadyExistsError-DEb3UWja.js +1 -0
- package/dist/packem_shared/DirectoryError-BtwSTLmT.js +1 -0
- package/dist/packem_shared/JSONError-Cvp9ycba.js +4 -0
- package/dist/packem_shared/NotEmptyError-DZ1Ix089.js +1 -0
- package/dist/packem_shared/NotFoundError-CnRY6lVp.js +1 -0
- package/dist/packem_shared/PermissionError-DJ_2VWEj.js +1 -0
- package/dist/packem_shared/WalkError-B8qTd-v-.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-CWAkuNXM.js +1 -0
- package/dist/packem_shared/assertValidFileContents-CbIN7sy7.js +1 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-BTlt945W.js +1 -0
- package/dist/packem_shared/build-rm-options-avnusYx-.js +1 -0
- package/dist/packem_shared/collect-CIKDOMiD.js +1 -0
- package/dist/packem_shared/collectSync-D0FRLLqg.js +1 -0
- package/dist/packem_shared/copy-Beb64BYG.js +1 -0
- package/dist/packem_shared/copySync-CagcIEBi.js +1 -0
- package/dist/packem_shared/emptyDir-C7lyd1lW.js +1 -0
- package/dist/packem_shared/emptyDirSync-B8EYpmO9.js +1 -0
- package/dist/packem_shared/ensureDir-DGarVZw8.js +1 -0
- package/dist/packem_shared/ensureDirSync-CsgPrsDH.js +1 -0
- package/dist/packem_shared/ensureFile-CMugWljp.js +1 -0
- package/dist/packem_shared/ensureFileSync-CJYTEx2r.js +1 -0
- package/dist/packem_shared/ensureLink-ChShf3lf.js +1 -0
- package/dist/packem_shared/ensureLinkSync-DPpq0I2Z.js +1 -0
- package/dist/packem_shared/ensureSymlink-y4FZjfxA.js +1 -0
- package/dist/packem_shared/ensureSymlinkSync-TcHssCH7.js +1 -0
- package/dist/packem_shared/findUp-Cii5ATt5.js +1 -0
- package/dist/packem_shared/findUpSync-C9Lkh7-v.js +1 -0
- package/dist/packem_shared/get-file-info-type-DzWpohDB.js +1 -0
- package/dist/packem_shared/glob-fqg4KepW.js +1 -0
- package/dist/packem_shared/{glob-sync.d-BgJM6l8W.d.ts → glob-sync.d-hXe38TnZ.d.ts} +1 -1
- package/dist/packem_shared/globSync-B8_ne93E.js +1 -0
- package/dist/packem_shared/index-B2MhYg3r.js +1 -0
- package/dist/packem_shared/index-BHy3Kcr7.js +11 -0
- package/dist/packem_shared/index-BLg3XWiD.js +1 -0
- package/dist/packem_shared/index-D8MDd0tv.js +1 -0
- package/dist/packem_shared/ini-preserve-D1DopDLd.js +4 -0
- package/dist/packem_shared/is-stats-identical-l1GRN4Qu.js +1 -0
- package/dist/packem_shared/isAccessible-PmWJhV6I.js +1 -0
- package/dist/packem_shared/isAccessibleSync-BrbOtwdr.js +1 -0
- package/dist/packem_shared/jsonc-merge-Bkw73TLW.js +2 -0
- package/dist/packem_shared/map-read-error-CR3rQUxx.js +1 -0
- package/dist/packem_shared/move-DopmzT-2.js +1 -0
- package/dist/packem_shared/parseJson-kxKotn69.js +1 -0
- package/dist/packem_shared/readFile-BswaBgM0.js +1 -0
- package/dist/packem_shared/readFileSync-_fDF6Oj1.js +1 -0
- package/dist/packem_shared/readIni-BsXudu2r.js +1 -0
- package/dist/packem_shared/readIniSync-DKwRbbs9.js +1 -0
- package/dist/packem_shared/readJson-BCdoReQ-.js +1 -0
- package/dist/packem_shared/readJson5-CM1TIiHd.js +1 -0
- package/dist/packem_shared/readJson5Sync-Bc26c3Fy.js +1 -0
- package/dist/packem_shared/readJsonSync-CvkZyKmL.js +1 -0
- package/dist/packem_shared/readJsonc-BabpyMMh.js +1 -0
- package/dist/packem_shared/readJsoncSync-CCvRcAP-.js +1 -0
- package/dist/packem_shared/readToml-D4jpe9q_.js +1 -0
- package/dist/packem_shared/readTomlSync-B5PIYT9z.js +1 -0
- package/dist/packem_shared/readYaml-DvPxndW_.js +1 -0
- package/dist/packem_shared/readYamlSync-DZ-0hSbZ.js +1 -0
- package/dist/packem_shared/remove-CSbrd0dl.js +1 -0
- package/dist/packem_shared/removeSync-BoLAzRQE.js +1 -0
- package/dist/packem_shared/renderError-Dqej8k13-Bi9WKMjv.js +6 -0
- package/dist/packem_shared/resolve-symlink-target-CWrn0v4P.js +1 -0
- package/dist/packem_shared/sanitize-DGZ3w-_w.js +1 -0
- package/dist/packem_shared/stripJsonComments-Bfcn2PKv.js +1 -0
- package/dist/packem_shared/to-uint-8-array-BImOQNXm.js +1 -0
- package/dist/packem_shared/{types.d-C1ygRkw1.d.ts → types.d-BMdL_ygj.d.ts} +139 -26
- package/dist/packem_shared/walk-OX4-6oCP.js +1 -0
- package/dist/packem_shared/walk-include-BXhGSn6t.js +1 -0
- package/dist/packem_shared/walkSync-BPs6czIM.js +1 -0
- package/dist/packem_shared/writeFile-BrMtsJY7.js +1 -0
- package/dist/packem_shared/writeFileSync-W7Mf4BNy.js +1 -0
- package/dist/packem_shared/writeIni-BWX3cP1K.js +4 -0
- package/dist/packem_shared/writeIniSync-fOdgPFfL.js +4 -0
- package/dist/packem_shared/writeJson-bEVi25gX.js +4 -0
- package/dist/packem_shared/writeJson5-Ch8TpNPI.js +4 -0
- package/dist/packem_shared/writeJson5Sync-BrctV_Mk.js +4 -0
- package/dist/packem_shared/writeJsonSync-DkGnd416.js +4 -0
- package/dist/packem_shared/writeJsonc-CefrwsOc.js +4 -0
- package/dist/packem_shared/writeJsoncSync-BskDjn8o.js +4 -0
- package/dist/packem_shared/writeToml-IuMO-yDu.js +1 -0
- package/dist/packem_shared/writeTomlSync-DhL7hHzB.js +1 -0
- package/dist/packem_shared/writeYaml-ClQgvQID.js +1 -0
- package/dist/packem_shared/writeYamlSync-DrXtHQQq.js +1 -0
- package/dist/size.js +1 -1
- package/dist/toml.d.ts +2 -2
- package/dist/toml.js +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +3 -3
- package/dist/yaml.js +1 -1
- package/package.json +2 -2
- package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +0 -1
- package/dist/packem_shared/DirectoryError-ddlbUV8C.js +0 -1
- package/dist/packem_shared/JSONError-D7h6PNWc.js +0 -4
- package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +0 -1
- package/dist/packem_shared/NotFoundError-BPiW0icm.js +0 -1
- package/dist/packem_shared/PermissionError-B1Emi5a9.js +0 -1
- package/dist/packem_shared/WalkError-Olmh4908.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
- package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +0 -1
- package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +0 -1
- package/dist/packem_shared/build-rm-options-C1R4reBu.js +0 -1
- package/dist/packem_shared/collect-BuI4N8Cb.js +0 -1
- package/dist/packem_shared/collectSync-xeb7vY2J.js +0 -1
- package/dist/packem_shared/emptyDir-8utO028L.js +0 -1
- package/dist/packem_shared/emptyDirSync-Bk5fUX73.js +0 -1
- package/dist/packem_shared/ensureDir-CZ4oUFuo.js +0 -1
- package/dist/packem_shared/ensureDirSync-CoPWhbjM.js +0 -1
- package/dist/packem_shared/ensureFile-CF1cAAyh.js +0 -1
- package/dist/packem_shared/ensureFileSync-C3qR6naU.js +0 -1
- package/dist/packem_shared/ensureLink-LLLxlGHn.js +0 -1
- package/dist/packem_shared/ensureLinkSync-Dh_GtT8F.js +0 -1
- package/dist/packem_shared/ensureSymlink-bcGk7tvJ.js +0 -1
- package/dist/packem_shared/ensureSymlinkSync-BbVDPvI4.js +0 -1
- package/dist/packem_shared/findUp-CZow0UvS.js +0 -1
- package/dist/packem_shared/findUpSync-BOMeyfWY.js +0 -1
- package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +0 -1
- package/dist/packem_shared/glob-MHJQjR39.js +0 -1
- package/dist/packem_shared/globSync-CwzlELgS.js +0 -1
- package/dist/packem_shared/index-CYIVJA0W.js +0 -1
- package/dist/packem_shared/index-DrapuBsB.js +0 -1
- package/dist/packem_shared/index-K-NNTkpb.js +0 -11
- package/dist/packem_shared/index-yGx8uzZs.js +0 -1
- package/dist/packem_shared/indexToLineColumn-BRSZFC6I-zN_sCTx7.js +0 -6
- package/dist/packem_shared/ini-preserve-CXc_xkpG.js +0 -4
- package/dist/packem_shared/is-stats-identical-CohsLtWy.js +0 -1
- package/dist/packem_shared/isAccessible-CDFxsAAo.js +0 -1
- package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +0 -1
- package/dist/packem_shared/isFsCaseSensitive-CMZVY1A2.js +0 -1
- package/dist/packem_shared/jsonc-merge-CQMjx3Vw.js +0 -2
- package/dist/packem_shared/move-LmP6P9sn.js +0 -1
- package/dist/packem_shared/parseJson-DTdEDJwS.js +0 -1
- package/dist/packem_shared/readFile-BkNfutxp.js +0 -1
- package/dist/packem_shared/readFileSync-4c_c6Qey.js +0 -1
- package/dist/packem_shared/readIni-DlyyIBHq.js +0 -1
- package/dist/packem_shared/readIniSync-DwomjPMj.js +0 -1
- package/dist/packem_shared/readJson-BiskeuNZ.js +0 -1
- package/dist/packem_shared/readJson5-ffmra5zp.js +0 -1
- package/dist/packem_shared/readJson5Sync-oAo0gBuU.js +0 -1
- package/dist/packem_shared/readJsonSync-cmV1NjAI.js +0 -1
- package/dist/packem_shared/readJsonc-Bd6QH-bH.js +0 -1
- package/dist/packem_shared/readJsoncSync-rcXoQB_7.js +0 -1
- package/dist/packem_shared/readToml-4S8Io3SQ.js +0 -1
- package/dist/packem_shared/readTomlSync-CcZKONFn.js +0 -1
- package/dist/packem_shared/readYaml-D71jaFaB.js +0 -1
- package/dist/packem_shared/readYamlSync-B0UyP0rk.js +0 -1
- package/dist/packem_shared/remove-DH41Ov_c.js +0 -1
- package/dist/packem_shared/removeSync-50OEdnHd.js +0 -1
- package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +0 -1
- package/dist/packem_shared/sanitize-CU1xmyrg.js +0 -1
- package/dist/packem_shared/stripJsonComments-CzNR77MF.js +0 -1
- package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +0 -1
- package/dist/packem_shared/walk-CFHn3Kig.js +0 -1
- package/dist/packem_shared/walk-include-D2widdUw.js +0 -1
- package/dist/packem_shared/walkSync-D9PxD1XJ.js +0 -1
- package/dist/packem_shared/writeFile-DUmg8P4m.js +0 -1
- package/dist/packem_shared/writeFileSync-Cboe5Z4V.js +0 -1
- package/dist/packem_shared/writeIni-DioeLq2k.js +0 -4
- package/dist/packem_shared/writeIniSync-yk0js2T2.js +0 -4
- package/dist/packem_shared/writeJson-D5-N8O0Q.js +0 -4
- package/dist/packem_shared/writeJson5-RIZyw1vX.js +0 -4
- package/dist/packem_shared/writeJson5Sync-Cnxh1THk.js +0 -4
- package/dist/packem_shared/writeJsonSync-BrXiOras.js +0 -4
- package/dist/packem_shared/writeJsonc-lGAmFl9u.js +0 -4
- package/dist/packem_shared/writeJsoncSync-BFuqkLDq.js +0 -4
- package/dist/packem_shared/writeToml-CaXpILHA.js +0 -1
- package/dist/packem_shared/writeTomlSync-CQ2mzKjs.js +0 -1
- package/dist/packem_shared/writeYaml-DKBXiztZ.js +0 -1
- package/dist/packem_shared/writeYamlSync-DVKnrXBl.js +0 -1
- /package/dist/packem_shared/{F_OK-CAwY1qU7.js → FIND_UP_STOP-CAwY1qU7.js} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as it}from"node:module";import{a as $}from"./index-D8MDd0tv.js";const ut=it(import.meta.url),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=t=>{if(typeof P<"u"&&P.versions&&P.versions.node){const[e,s]=P.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return P.getBuiltinModule(t)}return ut(t)},R=D("fs"),lt={...R,default:R},{statSync:ct,stat:at,realpathSync:ht,realpath:pt,readdirSync:ft,readdir:gt}=D("fs"),{sep:G,basename:dt,dirname:A,resolve:N,normalize:yt,relative:mt,posix:S,isAbsolute:bt}=D("path"),{fileURLToPath:vt}=D("url"),{createRequire:wt}=D("module");var C=wt(import.meta.url);function St(t){let e=yt(t);return e.length>1&&e[e.length-1]===G&&(e=e.substring(0,e.length-1)),e}const $t=/[\\/]/g;function U(t,e){return t.replace($t,e)}const kt=/^[a-z]:[\\/]$/i;function Pt(t){return t==="/"||kt.test(t)}function j(t,e){const{resolvePaths:s,normalizePath:r,pathSeparator:n}=e,i=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=N(t)),(r||i)&&(t=St(t)),t===".")return"";const o=t[t.length-1]!==n;return U(o?t+n:t,n)}function Q(t,e){return e+t}function xt(t,e){return function(s,r){return r.startsWith(t)?r.slice(t.length)+s:U(mt(t,r),e.pathSeparator)+e.pathSeparator+s}}function Dt(t){return t}function Ft(t,e,s){return e+t+s}function _t(t,e){const{relativePaths:s,includeBasePath:r}=e;return s&&t?xt(t,e):r?Q:Dt}function Et(t){return function(e,s){s.push(e.substring(t.length)||".")}}function qt(t){return function(e,s,r){const n=e.substring(t.length)||".";r.every(i=>i(n,!0))&&s.push(n)}}const jt=(t,e)=>{e.push(t||".")},Ot=(t,e,s)=>{const r=t||".";s.every(n=>n(r,!0))&&e.push(r)},At=()=>{};function Wt(t,e){const{includeDirs:s,filters:r,relativePaths:n}=e;return s?n?r&&r.length?qt(t):Et(t):r&&r.length?Ot:jt:At}const Bt=(t,e,s,r)=>{r.every(n=>n(t,!1))&&s.files++},Rt=(t,e,s,r)=>{r.every(n=>n(t,!1))&&e.push(t)},Ct=(t,e,s,r)=>{s.files++},Mt=(t,e)=>{e.push(t)},Lt=()=>{};function It(t){const{excludeFiles:e,filters:s,onlyCounts:r}=t;return e?Lt:s&&s.length?r?Bt:Rt:r?Ct:Mt}const Tt=t=>t,zt=()=>[""].slice(0,0);function Gt(t){return t.group?zt:Tt}const Nt=(t,e,s)=>{t.push({directory:e,files:s,dir:e})},Ut=()=>{};function Qt(t){return t.group?Nt:Ut}const Yt=function(t,e,s){const{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue(),n.realpath(t,(o,u)=>{if(o)return r.dequeue(i?null:o,e);n.stat(u,(g,f)=>{if(g)return r.dequeue(i?null:g,e);if(f.isDirectory()&&Y(t,u,e))return r.dequeue(null,e);s(f,u),r.dequeue(null,e)})})},Zt=function(t,e,s){const{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue();try{const o=n.realpathSync(t),u=n.statSync(o);if(u.isDirectory()&&Y(t,o,e))return;s(u,o)}catch(o){if(!i)throw o}};function Ht(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Zt:Yt}function Y(t,e,s){if(s.options.useRealPaths)return Jt(e,s);let r=A(t),n=1;for(;r!==s.root&&n<2;){const i=s.symlinks.get(r);i&&(i===e||i.startsWith(e)||e.startsWith(i))?n++:r=A(r)}return s.symlinks.set(t,e),n>1}function Jt(t,e){return e.visited.includes(t+e.options.pathSeparator)}const Kt=t=>t.counts,Vt=t=>t.groups,Xt=t=>t.paths,te=t=>t.paths.slice(0,t.options.maxFiles),ee=(t,e,s)=>(F(e,s,t.counts,t.options.suppressErrors),null),se=(t,e,s)=>(F(e,s,t.paths,t.options.suppressErrors),null),re=(t,e,s)=>(F(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),ne=(t,e,s)=>(F(e,s,t.groups,t.options.suppressErrors),null);function F(t,e,s,r){e(t&&!r?t:null,s)}function oe(t,e){const{onlyCounts:s,group:r,maxFiles:n}=t;return s?e?Kt:ee:r?e?Vt:ne:n?e?te:re:e?Xt:se}const Z={withFileTypes:!0},ie=(t,e,s,r,n)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);const{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",Z,(o,u=[])=>{n(u,s,r),t.queue.dequeue(t.options.suppressErrors?null:o,t)})},ue=(t,e,s,r,n)=>{const{fs:i}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let o=[];try{o=i.readdirSync(e||".",Z)}catch(u){if(!t.options.suppressErrors)throw u}n(o,s,r)};function le(t){return t?ue:ie}var ce=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},ae=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},he=class{aborted=!1;abort(){this.aborted=!0}},H=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,s){this.isSynchronous=!s,this.callbackInvoker=oe(e,this.isSynchronous),this.root=j(t,e),this.state={root:Pt(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ae,options:e,queue:new ce((r,n)=>this.callbackInvoker(n,r,s)),symlinks:new Map,visited:[""].slice(0,0),controller:new he,fs:e.fs||lt},this.joinPath=_t(this.root,e),this.pushDirectory=Wt(this.root,e),this.pushFile=It(e),this.getArray=Gt(e),this.groupFiles=Qt(e),this.resolveSymlink=Ht(e,this.isSynchronous),this.walkDirectory=le(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,s)=>{const{paths:r,options:{filters:n,resolveSymlinks:i,excludeSymlinks:o,exclude:u,maxFiles:g,signal:f,useRealPaths:y,pathSeparator:h},controller:m}=this.state;if(m.aborted||f&&f.aborted||g&&r.length>g)return;const l=this.getArray(this.state.paths);for(let p=0;p<t.length;++p){const a=t[p];if(a.isFile()||a.isSymbolicLink()&&!i&&!o){const c=this.joinPath(a.name,e);this.pushFile(c,l,this.state.counts,n)}else if(a.isDirectory()){let c=Ft(a.name,e,this.state.options.pathSeparator);if(u&&u(a.name,c))continue;this.pushDirectory(c,r,n),this.walkDirectory(this.state,c,c,s-1,this.walk)}else if(this.resolveSymlink&&a.isSymbolicLink()){let c=Q(a.name,e);this.resolveSymlink(c,this.state,(_,d)=>{if(_.isDirectory()){if(d=j(d,this.state.options),u&&u(a.name,y?d:c+h))return;this.walkDirectory(this.state,d,y?d:c+h,s-1,this.walk)}else{d=y?d:c;const k=dt(d),E=j(A(d),this.state.options);d=this.joinPath(k,E),this.pushFile(d,l,this.state.counts,n)}})}}this.groupFiles(this.state.groups,e,l)}};function pe(t,e){return new Promise((s,r)=>{J(t,e,(n,i)=>{if(n)return r(n);s(i)})})}function J(t,e,s){new H(t,e,s).start()}function fe(t,e){return new H(t,e).start()}var M=class{constructor(e,s){this.root=e,this.options=s}withPromise(){return pe(this.root,this.options)}withCallback(e){J(this.root,this.options,e)}sync(){return fe(this.root,this.options)}};let K=null;try{C.resolve("picomatch"),K=C("picomatch")}catch{}var ge=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:G,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new M(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new M(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){const s=this.globFunction||K;if(!s)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=s(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(n=>r(n)),this}};const de=Array.isArray,V=/\\/g,ye=/^[A-Za-z]:$/,X=process.platform==="win32",me=/^(\/?\.\.)+$/;function L(t,e={}){const s=t.length,r=Array(s),n=Array(s);let i,o;for(i=0;i<s;i++){const u=tt(t[i]);r[i]=u;const g=u.length,f=Array(g);for(o=0;o<g;o++)f[o]=$(u[o],e);n[i]=f}return u=>{const g=u.split("/");if(g[0]===".."&&me.test(u))return!0;for(i=0;i<s;i++){const f=r[i],y=n[i],h=g.length,m=Math.min(h,f.length);for(o=0;o<m;){const l=f[o];if(l.includes("/"))return!0;if(!y[o](g[o]))break;if(!e.noglobstar&&l==="**")return!0;o++}if(o===h)return!0}return!1}}const be=/^[A-Z]:\/$/i,ve=X?t=>be.test(t):t=>t==="/";function I(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){const n=t.length+ +!ve(t);return(i,o)=>i.slice(n,o?-1:void 0)||"."}const r=e.slice(t.length+1);return r?(n,i)=>{if(n===".")return r;const o=`${r}/${n}`;return i?o.slice(0,-1):o}:(n,i)=>i&&n!=="."?n.slice(0,-1):n}return s?r=>S.relative(t,r)||".":r=>S.relative(t,`${e}/${r}`)||"."}function we(t,e){if(e.startsWith(`${t}/`)){const s=e.slice(t.length+1);return r=>`${s}/${r}`}return s=>{const r=S.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function T(t){return t.replace(ye,e=>`${e}/`)}const Se={parts:!0};function tt(t){var e;const s=$.scan(t,Se);return!((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}const $e=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ke=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Pe=t=>t.replace($e,"\\$&"),xe=t=>t.replace(ke,"\\$&"),De=X?xe:Pe;function Fe(t,e){const s=$.scan(t);return s.isGlob||s.negated}function x(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function et(t){return typeof t=="string"?[t]:t??[]}const _e=/^(\/?\.\.)+/,Ee=/\\(?=[()[\]{}!*+?@|])/g;function O(t,e,s,r){var n;const i=e.cwd;let o=t;t[t.length-1]==="/"&&(o=t.slice(0,-1));const u=o.lastIndexOf("/"),g=(u===-1?o:o.slice(u+1)).startsWith("!(");o[o.length-1]!=="*"&&!g&&e.expandDirectories&&(o+="/**");const f=De(i);o=bt(o.replace(Ee,""))?S.relative(f,o):S.normalize(o);const y=(n=_e.exec(o))===null||n===void 0?void 0:n[0],h=tt(o);if(y){const l=(y.length+1)/3;let p=0;const a=f.split("/");for(;p<l&&h[p+l]===a[a.length+p-l];)o=o.slice(0,(l-p-1)*3)+o.slice((l-p)*3+h[p+l].length+1)||".",p++;const c=S.join(i,y.slice(p*3));c[0]!=="."&&s.root.length>c.length&&(s.root=T(c),s.depthOffset=-l+p)}if(!r&&s.depthOffset>=0){var m;(m=s.commonPath)!==null&&m!==void 0||(s.commonPath=h);const l=[],p=Math.min(s.commonPath.length,h.length);for(let a=0;a<p;a++){const c=h[a];if(c==="**"&&!h[a+1]){l.pop();break}if(a===h.length-1||c!==s.commonPath[a]||Fe(c))break;l.push(c)}s.depthOffset=l.length,s.commonPath=l,s.root=T(l.length>0?S.join(i,...l):i)}return o}function qe(t,e,s){const r=[],n=[],i=[];for(const o of t.ignore)o&&(o[0]!=="!"||o[1]==="("?n.push(O(o,t,s,!0)):i.push(o.slice(1)));for(const o of e)o&&(o[0]!=="!"||o[1]==="("?r.push(O(o,t,s,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(O(o.slice(1),t,s,!0)));return{match:r,ignore:n,unignore:i}}function je(t,e){const s=t.cwd,r={root:s,depthOffset:0},n=qe(t,e,r);t.debug&&x("internal processing patterns:",n);const{absolute:i,caseSensitiveMatch:o,debug:u,dot:g,followSymbolicLinks:f,onlyDirectories:y}=t,h=r.root.replace(V,""),m={dot:g,nobrace:t.braceExpansion===!1,nocase:!o,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},l=n.unignore.length>0,p=l?$(n.unignore,m):void 0,a=l?L(n.unignore,m):void 0,c=$(n.match,{...m,ignore:n.ignore,onIgnore:p?v=>p(v.output)&&$.constants.UNIGNORE:void 0}),_=$(n.ignore,m),d=L(n.match,m),k=I(s,h,i),E=i?k:I(s,h,!0),nt=n.match.length>0&&n.match.every(v=>v==="**"||v==="**/*"),q=n.ignore.length>0||l||!nt?(v,w)=>{const b=E(w,!0);return b==="."||a&&a(b)?!1:!d(b)||_(b)}:void 0;let W;t.deep!==void 0&&(W=Math.round(t.deep-r.depthOffset));const ot=new ge({filters:[u?(v,w)=>{const b=k(v,w),B=c(b);return B&&x(`matched ${b}`),B}:(v,w)=>{const b=k(v,w);return c(b)}],exclude:u&&q?(v,w)=>{const b=q(v,w);return x(`${b?"skipped":"crawling"} ${w}`),b}:q,fs:t.fs,pathSeparator:"/",relativePaths:!i,resolvePaths:i,includeBasePath:i,resolveSymlinks:f,excludeSymlinks:!f,excludeFiles:y,includeDirs:y||!t.onlyFiles,maxDepth:W,signal:t.signal}).crawl(h);return t.debug&&x("internal properties:",{...r,root:h}),[ot,s!==h&&!i&&we(s,h)]}function st(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}const z={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Oe(t){const e=Object.assign({},t);for(const s in z)e[s]===void 0&&Object.assign(e,{[s]:z[s]});return e.cwd=(e.cwd instanceof URL?vt(e.cwd):N(e.cwd||process.cwd())).replace(V,"/"),e.ignore=et(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||gt,readdirSync:e.fs.readdirSync||ft,realpath:e.fs.realpath||pt,realpathSync:e.fs.realpathSync||ht,stat:e.fs.stat||at,statSync:e.fs.statSync||ct}),e.debug&&x("globbing with options:",e),e}function rt(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");const r=de(t)||typeof t=="string",n=et((s=r?t:t.patterns)!==null&&s!==void 0?s:"**/*"),i=Oe(r?e:t);return n.length>0?je(i,n):[]}async function Re(t,e){const[s,r]=rt(t,e);return s?st(await s.withPromise(),r):[]}function Ce(t,e){const[s,r]=rt(t,e);return s?st(s.sync(),r):[]}export{Ce as E,Re as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as mt}from"./_commonjsHelpers-CWAkuNXM.js";var Et={},bt,$t;function ht(){if($t)return bt;$t=1;const C="[^\\\\/]",x=Symbol("unignore"),v="\\.",U="\\+",K="\\?",s="\\/",a="(?=.)",c="[^/]",f=`(?:${s}|$)`,m=`(?:^|${s})`,y=`${v}{1,2}${f}`,X=`(?!${v})`,B=`(?!${m}${y})`,T=`(?!${v}{0,1}${f})`,G=`(?!${y})`,ot=`[^.${s}]`,j=`${c}*?`,q="/",p={DOT_LITERAL:v,PLUS_LITERAL:U,QMARK_LITERAL:K,SLASH_LITERAL:s,ONE_CHAR:a,QMARK:c,END_ANCHOR:f,DOTS_SLASH:y,NO_DOT:X,NO_DOTS:B,NO_DOT_SLASH:T,NO_DOTS_SLASH:G,QMARK_NO_DOT:ot,STAR:j,START_ANCHOR:m,SEP:q},i={...p,SLASH_LITERAL:"[\\\\/]",QMARK:C,STAR:`${C}*?`,DOTS_SLASH:`${v}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${v})`,NO_DOTS:`(?!(?:^|[\\\\/])${v}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${v}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${v}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},u={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return bt={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:u,UNIGNORE:x,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(l){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${l.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(l){return l===!0?i:p}},bt}var dt;function gt(){return dt||(dt=1,(function(C){const{REGEX_BACKSLASH:x,REGEX_REMOVE_BACKSLASH:v,REGEX_SPECIAL_CHARS:U,REGEX_SPECIAL_CHARS_GLOBAL:K}=ht();C.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),C.hasRegexChars=s=>U.test(s),C.isRegexChar=s=>s.length===1&&C.hasRegexChars(s),C.escapeRegex=s=>s.replace(K,"\\$1"),C.toPosixSlashes=s=>s.replace(x,"/"),C.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return process.platform?process.platform==="win32":!1},C.removeBackslashes=s=>s.replace(v,a=>a==="\\"?"":a),C.escapeLast=(s,a,c)=>{const f=s.lastIndexOf(a,c);return f===-1?s:s[f-1]==="\\"?C.escapeLast(s,a,f-1):`${s.slice(0,f)}\\${s.slice(f)}`},C.removePrefix=(s,a={})=>{let c=s;return c.startsWith("./")&&(c=c.slice(2),a.prefix="./"),c},C.wrapOutput=(s,a={},c={})=>{const f=c.contains?"":"^",m=c.contains?"":"$";let y=`${f}(?:${s})${m}`;return a.negated===!0&&(y=`(?:^(?!${y}).*$)`),y},C.basename=(s,{windows:a}={})=>{const c=s.split(a?/[\\/]/:"/"),f=c[c.length-1];return f===""?c[c.length-2]:f}})(Et)),Et}var yt,vt;function kt(){if(vt)return yt;vt=1;const C=gt(),{CHAR_ASTERISK:x,CHAR_AT:v,CHAR_BACKWARD_SLASH:U,CHAR_COMMA:K,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:f,CHAR_LEFT_PARENTHESES:m,CHAR_LEFT_SQUARE_BRACKET:y,CHAR_PLUS:X,CHAR_QUESTION_MARK:B,CHAR_RIGHT_CURLY_BRACE:T,CHAR_RIGHT_PARENTHESES:G,CHAR_RIGHT_SQUARE_BRACKET:ot}=ht(),j=i=>i===c||i===U,q=i=>{i.isPrefix!==!0&&(i.depth=i.isGlobstar?1/0:1)};return yt=(i,u)=>{const l=u||{},E=i.length-1,R=l.parts===!0||l.scanToEnd===!0,h=[],_=[],at=[];let F=i,P=-1,D=0,Q=0,V=!1,Y=!1,I=!1,st=!1,pt=!1,$=!1,z=!1,lt=!1,ft=!1,H=!1,Z=0,rt,A,t={value:"",depth:0,isGlob:!1};const M=()=>P>=E,et=()=>F.charCodeAt(P+1),W=()=>(rt=A,F.charCodeAt(++P));for(;P<E;){A=W();let N;if(A===U){z=t.backslashes=!0,A=W(),A===f&&($=!0);continue}if($===!0||A===f){for(Z++;M()!==!0&&(A=W());){if(A===U){z=t.backslashes=!0,W();continue}if(A===f){Z++;continue}if($!==!0&&A===s&&(A=W())===s){if(V=t.isBrace=!0,I=t.isGlob=!0,H=!0,R===!0)continue;break}if($!==!0&&A===K){if(V=t.isBrace=!0,I=t.isGlob=!0,H=!0,R===!0)continue;break}if(A===T&&(Z--,Z===0)){$=!1,V=t.isBrace=!0,H=!0;break}}if(R===!0)continue;break}if(A===c){if(h.push(P),_.push(t),t={value:"",depth:0,isGlob:!1},H===!0)continue;if(rt===s&&P===D+1){D+=2;continue}Q=P+1;continue}if(l.noext!==!0&&(A===X||A===v||A===x||A===B||A===a)&&et()===m){if(I=t.isGlob=!0,st=t.isExtglob=!0,H=!0,A===a&&P===D&&(ft=!0),R===!0){for(;M()!==!0&&(A=W());){if(A===U){z=t.backslashes=!0,A=W();continue}if(A===G){I=t.isGlob=!0,H=!0;break}}continue}break}if(A===x){if(rt===x&&(pt=t.isGlobstar=!0),I=t.isGlob=!0,H=!0,R===!0)continue;break}if(A===B){if(I=t.isGlob=!0,H=!0,R===!0)continue;break}if(A===y){for(;M()!==!0&&(N=W());){if(N===U){z=t.backslashes=!0,W();continue}if(N===ot){Y=t.isBracket=!0,I=t.isGlob=!0,H=!0;break}}if(R===!0)continue;break}if(l.nonegate!==!0&&A===a&&P===D){lt=t.negated=!0,D++;continue}if(l.noparen!==!0&&A===m){if(I=t.isGlob=!0,R===!0){for(;M()!==!0&&(A=W());){if(A===m){z=t.backslashes=!0,A=W();continue}if(A===G){H=!0;break}}continue}break}if(I===!0){if(H=!0,R===!0)continue;break}}l.noext===!0&&(st=!1,I=!1);let e=F,n="",tt="";D>0&&(n=F.slice(0,D),F=F.slice(D),Q-=D),e&&I===!0&&Q>0?(e=F.slice(0,Q),tt=F.slice(Q)):I===!0?(e="",tt=F):e=F,e&&e!==""&&e!=="/"&&e!==F&&j(e.charCodeAt(e.length-1))&&(e=e.slice(0,-1)),l.unescape===!0&&(tt&&(tt=C.removeBackslashes(tt)),e&&z===!0&&(e=C.removeBackslashes(e)));const d={prefix:n,input:i,start:D,base:e,glob:tt,isBrace:V,isBracket:Y,isGlob:I,isExtglob:st,isGlobstar:pt,negated:lt,negatedExtglob:ft};if(l.tokens===!0&&(d.maxDepth=0,j(A)||_.push(t),d.tokens=_),l.parts===!0||l.tokens===!0){let N;for(let k=0;k<h.length;k++){const J=N?N+1:D,ct=h[k],Rt=i.slice(J,ct);l.tokens&&(k===0&&D!==0?(_[k].isPrefix=!0,_[k].value=n):_[k].value=Rt,q(_[k]),d.maxDepth+=_[k].depth),(k!==0||Rt!=="")&&at.push(Rt),N=ct}if(N&&N+1<i.length){const k=i.slice(N+1);at.push(k),l.tokens&&(_[_.length-1].value=k,q(_[_.length-1]),d.maxDepth+=_[_.length-1].depth)}d.slashes=h,d.parts=at}return d},yt}var Ct,Ht;function Nt(){if(Ht)return Ct;Ht=1;const C=ht(),x=gt(),{MAX_LENGTH:v,POSIX_REGEX_SOURCE:U,REGEX_NON_SPECIAL_CHARS:K,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=C,c=(p,i)=>typeof i.expandRange=="function"?i.expandRange(...p,i):(p.sort(),`[${p.join("-")}]`),f=(p,i)=>`Missing ${p}: "${i}" - use "\\\\${i}" to match literal characters`,m=p=>{const i=[];let u=0,l=0,E=0,R="",h=!1;for(const _ of p){if(h===!0){R+=_,h=!1;continue}if(_==="\\"){R+=_,h=!0;continue}if(_==='"'){E=E===1?0:1,R+=_;continue}if(E===0){if(_==="[")u++;else if(_==="]"&&u>0)u--;else if(u===0){if(_==="(")l++;else if(_===")"&&l>0)l--;else if(_==="|"&&l===0){i.push(R),R="";continue}}}R+=_}return i.push(R),i},y=p=>{let i=!1;for(const u of p){if(i===!0){i=!1;continue}if(u==="\\"){i=!0;continue}if(/[?*+@!()[\]{}]/.test(u))return!1}return!0},X=p=>{let i=p.trim(),u=!0;for(;u===!0;)u=!1,/^@\([^\\()[\]{}|]+\)$/.test(i)&&(i=i.slice(2,-1),u=!0);if(y(i))return i.replace(/\\(.)/g,"$1")},B=p=>{const i=p.map(X).filter(Boolean);for(let u=0;u<i.length;u++)for(let l=u+1;l<i.length;l++){const E=i[u],R=i[l],h=E[0];if(!(!h||E!==h.repeat(E.length)||R!==h.repeat(R.length))&&(E===R||E.startsWith(R)||R.startsWith(E)))return!0}return!1},T=(p,i=!0)=>{if(p[0]!=="+"&&p[0]!=="*"||p[1]!=="(")return;let u=0,l=0,E=0,R=!1;for(let h=1;h<p.length;h++){const _=p[h];if(R===!0){R=!1;continue}if(_==="\\"){R=!0;continue}if(_==='"'){E=E===1?0:1;continue}if(E!==1){if(_==="["){u++;continue}if(_==="]"&&u>0){u--;continue}if(!(u>0)){if(_==="("){l++;continue}if(_===")"&&(l--,l===0))return i===!0&&h!==p.length-1?void 0:{type:p[0],body:p.slice(2,h),end:h}}}}},G=p=>{let i=0;const u=[];for(;i<p.length;){const l=T(p.slice(i),!1);if(!l||l.type!=="*")return;const E=m(l.body).map(h=>h.trim());if(E.length!==1)return;const R=X(E[0]);if(!R||R.length!==1)return;u.push(R),i+=l.end+1}return u.length<1?void 0:`${u.length===1?x.escapeRegex(u[0]):`[${u.map(l=>x.escapeRegex(l)).join("")}]`}*`},ot=p=>{let i=0,u=p.trim(),l=T(u);for(;l;)i++,u=l.body.trim(),l=T(u);return i},j=(p,i)=>{if(i.maxExtglobRecursion===!1)return{risky:!1};const u=typeof i.maxExtglobRecursion=="number"?i.maxExtglobRecursion:C.DEFAULT_MAX_EXTGLOB_RECURSION,l=m(p).map(E=>E.trim());if(l.length>1&&(l.some(E=>E==="")||l.some(E=>/^[*?]+$/.test(E))||B(l)))return{risky:!0};for(const E of l){const R=G(E);if(R)return{risky:!0,safeOutput:R};if(ot(E)>u)return{risky:!0}}return{risky:!1}},q=(p,i)=>{if(typeof p!="string")throw new TypeError("Expected a string");p=a[p]||p;const u={...i},l=typeof u.maxLength=="number"?Math.min(v,u.maxLength):v;let E=p.length;if(E>l)throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${l}`);const R={type:"bos",value:"",output:u.prepend||""},h=[R],_=u.capture?"":"?:",at=C.globChars(u.windows),F=C.extglobChars(at),{DOT_LITERAL:P,PLUS_LITERAL:D,SLASH_LITERAL:Q,ONE_CHAR:V,DOTS_SLASH:Y,NO_DOT:I,NO_DOT_SLASH:st,NO_DOTS_SLASH:pt,QMARK:$,QMARK_NO_DOT:z,STAR:lt,START_ANCHOR:ft}=at,H=o=>`(${_}(?:(?!${ft}${o.dot?Y:P}).)*?)`,Z=u.dot?"":I,rt=u.dot?$:z;let A=u.bash===!0?H(u):lt;u.capture&&(A=`(${A})`),typeof u.noext=="boolean"&&(u.noextglob=u.noext);const t={input:p,index:-1,start:0,dot:u.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};p=x.removePrefix(p,t),E=p.length;const M=[],et=[],W=[];let e=R,n;const tt=()=>t.index===E-1,d=t.peek=(o=1)=>p[t.index+o],N=t.advance=()=>p[++t.index]||"",k=()=>p.slice(t.index+1),J=(o="",O=0)=>{t.consumed+=o,t.index+=O},ct=o=>{t.output+=o.output!=null?o.output:o.value,J(o.value)},Rt=()=>{let o=1;for(;d()==="!"&&(d(2)!=="("||d(3)==="?");)N(),t.start++,o++;return o%2===0?!1:(t.negated=!0,t.start++,!0)},At=o=>{t[o]++,W.push(o)},it=o=>{t[o]--,W.pop()},g=o=>{if(e.type==="globstar"){const O=t.braces>0&&(o.type==="comma"||o.type==="brace"),r=o.extglob===!0||M.length&&(o.type==="pipe"||o.type==="paren");o.type!=="slash"&&o.type!=="paren"&&!O&&!r&&(t.output=t.output.slice(0,-e.output.length),e.type="star",e.value="*",e.output=A,t.output+=e.output)}if(M.length&&o.type!=="paren"&&(M[M.length-1].inner+=o.value),(o.value||o.output)&&ct(o),e&&e.type==="text"&&o.type==="text"){e.output=(e.output||e.value)+o.value,e.value+=o.value;return}o.prev=e,h.push(o),e=o},_t=(o,O)=>{const r={...F[O],conditions:1,inner:""};r.prev=e,r.parens=t.parens,r.output=t.output,r.startIndex=t.index,r.tokensIndex=h.length;const b=(u.capture?"(":"")+r.open;At("parens"),g({type:o,value:O,output:t.output?"":V}),g({type:"paren",extglob:!0,value:N(),output:b}),M.push(r)},Lt=o=>{const O=p.slice(o.startIndex,t.index+1),r=p.slice(o.startIndex+2,t.index),b=j(r,u);if((o.type==="plus"||o.type==="star")&&b.risky){const S=b.safeOutput?(o.output?"":V)+(u.capture?`(${b.safeOutput})`:b.safeOutput):void 0,ut=h[o.tokensIndex];ut.type="text",ut.value=O,ut.output=S||x.escapeRegex(O);for(let nt=o.tokensIndex+1;nt<h.length;nt++)h[nt].value="",h[nt].output="",delete h[nt].suffix;t.output=o.output+ut.output,t.backtrack=!0,g({type:"paren",extglob:!0,value:n,output:""}),it("parens");return}let L=o.close+(u.capture?")":""),w;if(o.type==="negate"){let S=A;if(o.inner&&o.inner.length>1&&o.inner.includes("/")&&(S=H(u)),(S!==A||tt()||/^\)+$/.test(k()))&&(L=o.close=`)$))${S}`),o.inner.includes("*")&&(w=k())&&/^\.[^\\/.]+$/.test(w)){const ut=q(w,{...i,fastpaths:!1}).output;L=o.close=`)${ut})${S})`}o.prev.type==="bos"&&(t.negatedExtglob=!0)}g({type:"paren",extglob:!0,value:n,output:L}),it("parens")};if(u.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(p)){let o=!1,O=p.replace(s,(r,b,L,w,S,ut)=>w==="\\"?(o=!0,r):w==="?"?b?b+w+(S?$.repeat(S.length):""):ut===0?rt+(S?$.repeat(S.length):""):$.repeat(L.length):w==="."?P.repeat(L.length):w==="*"?b?b+w+(S?A:""):A:b?r:`\\${r}`);return o===!0&&(u.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,r=>r.length%2===0?"\\\\":r?"\\":"")),O===p&&u.contains===!0?(t.output=p,t):(t.output=x.wrapOutput(O,t,i),t)}for(;!tt();){if(n=N(),n==="\0")continue;if(n==="\\"){const r=d();if(r==="/"&&u.bash!==!0||r==="."||r===";")continue;if(!r){n+="\\",g({type:"text",value:n});continue}const b=/^\\+/.exec(k());let L=0;if(b&&b[0].length>2&&(L=b[0].length,t.index+=L,L%2!==0&&(n+="\\")),u.unescape===!0?n=N():n+=N(),t.brackets===0){g({type:"text",value:n});continue}}if(t.brackets>0&&(n!=="]"||e.value==="["||e.value==="[^")){if(u.posix!==!1&&n===":"){const r=e.value.slice(1);if(r.includes("[")&&(e.posix=!0,r.includes(":"))){const b=e.value.lastIndexOf("["),L=e.value.slice(0,b),w=e.value.slice(b+2),S=U[w];if(S){e.value=L+S,t.backtrack=!0,N(),!R.output&&h.indexOf(e)===1&&(R.output=V);continue}}}(n==="["&&d()!==":"||n==="-"&&d()==="]")&&(n=`\\${n}`),n==="]"&&(e.value==="["||e.value==="[^")&&(n=`\\${n}`),u.posix===!0&&n==="!"&&e.value==="["&&(n="^"),e.value+=n,ct({value:n});continue}if(t.quotes===1&&n!=='"'){n=x.escapeRegex(n),e.value+=n,ct({value:n});continue}if(n==='"'){t.quotes=t.quotes===1?0:1,u.keepQuotes===!0&&g({type:"text",value:n});continue}if(n==="("){At("parens"),g({type:"paren",value:n});continue}if(n===")"){if(t.parens===0&&u.strictBrackets===!0)throw new SyntaxError(f("opening","("));const r=M[M.length-1];if(r&&t.parens===r.parens+1){Lt(M.pop());continue}g({type:"paren",value:n,output:t.parens?")":"\\)"}),it("parens");continue}if(n==="["){if(u.nobracket===!0||!k().includes("]")){if(u.nobracket!==!0&&u.strictBrackets===!0)throw new SyntaxError(f("closing","]"));n=`\\${n}`}else At("brackets");g({type:"bracket",value:n});continue}if(n==="]"){if(u.nobracket===!0||e&&e.type==="bracket"&&e.value.length===1){g({type:"text",value:n,output:`\\${n}`});continue}if(t.brackets===0){if(u.strictBrackets===!0)throw new SyntaxError(f("opening","["));g({type:"text",value:n,output:`\\${n}`});continue}it("brackets");const r=e.value.slice(1);if(e.posix!==!0&&r[0]==="^"&&!r.includes("/")&&(n=`/${n}`),e.value+=n,ct({value:n}),u.literalBrackets===!1||x.hasRegexChars(r))continue;const b=x.escapeRegex(e.value);if(t.output=t.output.slice(0,-e.value.length),u.literalBrackets===!0){t.output+=b,e.value=b;continue}e.value=`(${_}${b}|${e.value})`,t.output+=e.value;continue}if(n==="{"&&u.nobrace!==!0){At("braces");const r={type:"brace",value:n,output:"(",outputIndex:t.output.length,tokensIndex:t.tokens.length};et.push(r),g(r);continue}if(n==="}"){const r=et[et.length-1];if(u.nobrace===!0||!r){g({type:"text",value:n,output:n});continue}let b=")";if(r.dots===!0){const L=h.slice(),w=[];for(let S=L.length-1;S>=0&&(h.pop(),L[S].type!=="brace");S--)L[S].type!=="dots"&&w.unshift(L[S].value);b=c(w,u),t.backtrack=!0}if(r.comma!==!0&&r.dots!==!0){const L=t.output.slice(0,r.outputIndex),w=t.tokens.slice(r.tokensIndex);r.value=r.output="\\{",n=b="\\}",t.output=L;for(const S of w)t.output+=S.output||S.value}g({type:"brace",value:n,output:b}),it("braces"),et.pop();continue}if(n==="|"){M.length>0&&M[M.length-1].conditions++,g({type:"text",value:n});continue}if(n===","){let r=n;const b=et[et.length-1];b&&W[W.length-1]==="braces"&&(b.comma=!0,r="|"),g({type:"comma",value:n,output:r});continue}if(n==="/"){if(e.type==="dot"&&t.index===t.start+1){t.start=t.index+1,t.consumed="",t.output="",h.pop(),e=R;continue}g({type:"slash",value:n,output:Q});continue}if(n==="."){if(t.braces>0&&e.type==="dot"){e.value==="."&&(e.output=P);const r=et[et.length-1];e.type="dots",e.output+=n,e.value+=n,r.dots=!0;continue}if(t.braces+t.parens===0&&e.type!=="bos"&&e.type!=="slash"){g({type:"text",value:n,output:P});continue}g({type:"dot",value:n,output:P});continue}if(n==="?"){if(!(e&&e.value==="(")&&u.noextglob!==!0&&d()==="("&&d(2)!=="?"){_t("qmark",n);continue}if(e&&e.type==="paren"){const r=d();let b=n;(e.value==="("&&!/[!=<:]/.test(r)||r==="<"&&!/<([!=]|\w+>)/.test(k()))&&(b=`\\${n}`),g({type:"text",value:n,output:b});continue}if(u.dot!==!0&&(e.type==="slash"||e.type==="bos")){g({type:"qmark",value:n,output:z});continue}g({type:"qmark",value:n,output:$});continue}if(n==="!"){if(u.noextglob!==!0&&d()==="("&&(d(2)!=="?"||!/[!=<:]/.test(d(3)))){_t("negate",n);continue}if(u.nonegate!==!0&&t.index===0){Rt();continue}}if(n==="+"){if(u.noextglob!==!0&&d()==="("&&d(2)!=="?"){_t("plus",n);continue}if(e&&e.value==="("||u.regex===!1){g({type:"plus",value:n,output:D});continue}if(e&&(e.type==="bracket"||e.type==="paren"||e.type==="brace")||t.parens>0){g({type:"plus",value:n});continue}g({type:"plus",value:D});continue}if(n==="@"){if(u.noextglob!==!0&&d()==="("&&d(2)!=="?"){g({type:"at",extglob:!0,value:n,output:""});continue}g({type:"text",value:n});continue}if(n!=="*"){(n==="$"||n==="^")&&(n=`\\${n}`);const r=K.exec(k());r&&(n+=r[0],t.index+=r[0].length),g({type:"text",value:n});continue}if(e&&(e.type==="globstar"||e.star===!0)){e.type="star",e.star=!0,e.value+=n,e.output=A,t.backtrack=!0,t.globstar=!0,J(n);continue}let o=k();if(u.noextglob!==!0&&/^\([^?]/.test(o)){_t("star",n);continue}if(e.type==="star"){if(u.noglobstar===!0){J(n);continue}const r=e.prev,b=r.prev,L=r.type==="slash"||r.type==="bos",w=b&&(b.type==="star"||b.type==="globstar");if(u.bash===!0&&(!L||o[0]&&o[0]!=="/")){g({type:"star",value:n,output:""});continue}const S=t.braces>0&&(r.type==="comma"||r.type==="brace"),ut=M.length&&(r.type==="pipe"||r.type==="paren");if(!L&&r.type!=="paren"&&!S&&!ut){g({type:"star",value:n,output:""});continue}for(;o.slice(0,3)==="/**";){const nt=p[t.index+4];if(nt&&nt!=="/")break;o=o.slice(3),J("/**",3)}if(r.type==="bos"&&tt()){e.type="globstar",e.value+=n,e.output=H(u),t.output=e.output,t.globstar=!0,J(n);continue}if(r.type==="slash"&&r.prev.type!=="bos"&&!w&&tt()){t.output=t.output.slice(0,-(r.output+e.output).length),r.output=`(?:${r.output}`,e.type="globstar",e.output=H(u)+(u.strictSlashes?")":"|$)"),e.value+=n,t.globstar=!0,t.output+=r.output+e.output,J(n);continue}if(r.type==="slash"&&r.prev.type!=="bos"&&o[0]==="/"){const nt=o[1]!==void 0?"|$":"";t.output=t.output.slice(0,-(r.output+e.output).length),r.output=`(?:${r.output}`,e.type="globstar",e.output=`${H(u)}${Q}|${Q}${nt})`,e.value+=n,t.output+=r.output+e.output,t.globstar=!0,J(n+N()),g({type:"slash",value:"/",output:""});continue}if(r.type==="bos"&&o[0]==="/"){e.type="globstar",e.value+=n,e.output=`(?:^|${Q}|${H(u)}${Q})`,t.output=e.output,t.globstar=!0,J(n+N()),g({type:"slash",value:"/",output:""});continue}if(S&&o[0]==="/"){e.type="globstar",e.value+=n,e.output=`(?:^|${Q}|${H(u)}${Q})`,t.output+=e.output,t.globstar=!0,J(n+N()),g({type:"slash",value:"/",output:""});continue}t.output=t.output.slice(0,-e.output.length),e.type="globstar",e.output=H(u),e.value+=n,t.output+=e.output,t.globstar=!0,J(n);continue}const O={type:"star",value:n,output:A};if(u.bash===!0){O.output=".*?",(e.type==="bos"||e.type==="slash")&&(O.output=Z+O.output),g(O);continue}if(e&&(e.type==="bracket"||e.type==="paren")&&u.regex===!0){O.output=n,g(O);continue}(t.index===t.start||e.type==="slash"||e.type==="dot")&&(e.type==="dot"?(t.output+=st,e.output+=st):u.dot===!0?(t.output+=pt,e.output+=pt):(t.output+=Z,e.output+=Z),d()!=="*"&&(t.output+=V,e.output+=V)),g(O)}for(;t.brackets>0;){if(u.strictBrackets===!0)throw new SyntaxError(f("closing","]"));t.output=x.escapeLast(t.output,"["),it("brackets")}for(;t.parens>0;){if(u.strictBrackets===!0)throw new SyntaxError(f("closing",")"));t.output=x.escapeLast(t.output,"("),it("parens")}for(;t.braces>0;){if(u.strictBrackets===!0)throw new SyntaxError(f("closing","}"));t.output=x.escapeLast(t.output,"{"),it("braces")}if(u.strictSlashes!==!0&&(e.type==="star"||e.type==="bracket")&&g({type:"maybe_slash",value:"",output:`${Q}?`}),t.backtrack===!0){t.output="";for(const o of t.tokens)t.output+=o.output!=null?o.output:o.value,o.suffix&&(t.output+=o.suffix)}return t};return q.fastpaths=(p,i)=>{const u={...i},l=typeof u.maxLength=="number"?Math.min(v,u.maxLength):v,E=p.length;if(E>l)throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${l}`);p=a[p]||p;const{DOT_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:_,DOTS_SLASH:at,NO_DOT:F,NO_DOTS:P,NO_DOTS_SLASH:D,STAR:Q,START_ANCHOR:V}=C.globChars(u.windows),Y=u.dot?P:F,I=u.dot?D:F,st=u.capture?"":"?:",pt={negated:!1,prefix:""};let $=u.bash===!0?".*?":Q;u.capture&&($=`(${$})`);const z=Z=>Z.noglobstar===!0?$:`(${st}(?:(?!${V}${Z.dot?at:R}).)*?)`,lt=Z=>{switch(Z){case"*":return`${Y}${_}${$}`;case".*":return`${R}${_}${$}`;case"*.*":return`${Y}${$}${R}${_}${$}`;case"*/*":return`${Y}${$}${h}${_}${I}${$}`;case"**":return Y+z(u);case"**/*":return`(?:${Y}${z(u)}${h})?${I}${_}${$}`;case"**/*.*":return`(?:${Y}${z(u)}${h})?${I}${$}${R}${_}${$}`;case"**/.*":return`(?:${Y}${z(u)}${h})?${R}${_}${$}`;default:{const rt=/^(.*?)\.(\w+)$/.exec(Z);if(!rt)return;const A=lt(rt[1]);return A?A+R+rt[2]:void 0}}},ft=x.removePrefix(p,pt);let H=lt(ft);return H&&u.strictSlashes!==!0&&(H+=`${h}?`),H},Ct=q,Ct}var St,Ot;function It(){if(Ot)return St;Ot=1;const C=kt(),x=Nt(),v=gt(),U=ht(),K=a=>a&&typeof a=="object"&&!Array.isArray(a),s=(a,c,f=!1)=>{if(Array.isArray(a)){const j=a.map(q=>s(q,c,f));return q=>{for(const p of j){const i=p(q);if(i)return i}return!1}}const m=K(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!m)throw new TypeError("Expected pattern to be a non-empty string");const y=c||{},X=y.windows,B=m?s.compileRe(a,c):s.makeRe(a,c,!1,!0),T=B.state;delete B.state;let G=()=>!1;if(y.ignore){const j={...c,ignore:null,onMatch:null,onResult:null};G=s(y.ignore,j,f)}const ot=(j,q=!1)=>{const{isMatch:p,match:i,output:u}=s.test(j,B,c,{glob:a,posix:X}),l={glob:a,state:T,regex:B,posix:X,input:j,output:u,match:i,isMatch:p};if(typeof y.onResult=="function"&&y.onResult(l),p===!1)return l.isMatch=!1,q?l:!1;t:if(G(j)){if(typeof y.onIgnore=="function"&&y.onIgnore(l)===U.UNIGNORE){l.isMatch=!0;break t}return l.isMatch=!1,q?l:!1}return typeof y.onMatch=="function"&&y.onMatch(l),q?l:!0};return f&&(ot.state=T),ot};return s.test=(a,c,f,{glob:m,posix:y}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const X=f||{},B=X.format||(y?v.toPosixSlashes:null);let T=a===m,G=T&&B?B(a):a;return T===!1&&(G=B?B(a):a,T=G===m),(T===!1||X.capture===!0)&&(X.matchBase===!0||X.basename===!0?T=s.matchBase(a,c,f,y):T=c.exec(G)),{isMatch:!!T,match:T,output:G}},s.matchBase=(a,c,f)=>(c instanceof RegExp?c:s.makeRe(c,f)).test(v.basename(a)),s.isMatch=(a,c,f)=>s(c,f)(a),s.parse=(a,c)=>Array.isArray(a)?a.map(f=>s.parse(f,c)):x(a,{...c,fastpaths:!1}),s.scan=(a,c)=>C(a,c),s.compileRe=(a,c,f=!1,m=!1)=>{if(f===!0)return a.output;const y=c||{},X=y.contains?"":"^",B=y.contains?"":"$";let T=`${X}(?:${a.output})${B}`;a&&a.negated===!0&&(T=`^(?!${T}).*$`);const G=s.toRegex(T,c);return m===!0&&(G.state=a),G},s.makeRe=(a,c={},f=!1,m=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let y={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(y.output=x.fastpaths(a,c)),y.output||(y=x(a,c)),s.compileRe(y,c,f,m)},s.toRegex=(a,c)=>{try{const f=c||{};return new RegExp(a,f.flags||(f.nocase?"i":""))}catch(f){if(c&&c.debug===!0)throw f;return/$^/}},s.constants=U,St=s,St}var xt,Tt;function wt(){if(Tt)return xt;Tt=1;const C=It(),x=gt();function v(U,K,s=!1){return K&&(K.windows===null||K.windows===void 0)&&(K={...K,windows:x.isWindows()}),C(U,K,s)}return Object.assign(v,C),xt=v,xt}var Bt=wt();const Pt=mt(Bt);export{Pt as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const v=/^\s*(?:[;#].*)?$/,$=/^\s*\[([^\]]+)\]\s*$/,h=/\r?\n/,j=/\r?\n$/,D=/^[^=]+=/,m=e=>e===" "||e===" ",S=e=>{let t=0;for(;t<e.length&&m(e[t]);)t+=1;return{indent:e.slice(0,t),rest:e.slice(t)}},x=e=>{let t=e.length;for(;t>0&&m(e[t-1]);)t-=1;return{rest:e.slice(0,t),trailing:e.slice(t)}},b=e=>{const t=e.indexOf("=");if(t===-1)return;const n=e.slice(0,t),r=e.slice(t+1),{indent:i,rest:s}=S(n),{rest:o,trailing:c}=x(s);if(o===""||o.startsWith(";")||o.startsWith("#")||o.startsWith("["))return;const{indent:f,rest:y}=S(r),{rest:p,trailing:g}=x(y);return{after:f,before:c,indent:i,key:o,trailing:g,value:p}},I=e=>{let t=0,n=0;for(const r of e.split(h)){if(v.test(r)||$.test(r))continue;const i=b(r);i&&(i.before===" "&&i.after===" "?t+=1:i.before===""&&i.after===""&&(n+=1))}return{spaced:t,unspaced:n}},k=(e,t)=>{if(!e)return;if(t===void 0)return e;let n=e;for(const r of t.split("."))if(n&&typeof n=="object"&&!Array.isArray(n))n=n[r];else return;return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0},N=(e,t)=>{for(const n of e.split(h)){if(!n||n.startsWith("["))continue;const r=D.exec(n);if(!r)continue;const i=n.slice(0,r[0].length-1).trim();if(i===t||i===`${t}[]`)return n.slice(r[0].length).trimStart()}return""},J=(e,t)=>{if(e.trim()==="")return{line:{kind:"blank",raw:e,section:t},nextSection:t};const n=e.trimStart();if(n.startsWith(";")||n.startsWith("#"))return{line:{kind:"comment",raw:e,section:t},nextSection:t};const r=$.exec(e);if(r){const s=r[1];return{line:{kind:"header",raw:e,section:s},nextSection:s}}const i=b(e);return i?{line:{key:i.key,kind:"key",raw:e,section:t},nextSection:t}:{line:{kind:"unknown",raw:e,section:t},nextSection:t}},L=e=>{const t=e.replace(j,"").split(h),n=[];let r;for(const i of t){const{line:s,nextSection:o}=J(i,r);n.push(s),r=o}return n},M=(e,t,n)=>{const r=b(e.raw);if(!r||!e.key)return e.raw;const i=n({[e.key]:t}),s=N(i,e.key);return`${r.indent}${r.key}${r.before}=${r.after}${s}${r.trailing}`},W=(e,t=[])=>{const n=[];for(const[r,i]of Object.entries(e))if(i&&typeof i=="object"&&!Array.isArray(i)){const s=[...t,r];n.push(s.join("."),...W(i,s))}return n},A=(e,t)=>{const n={};for(const[r,i]of Object.entries(e))t.has(r)||i&&typeof i=="object"&&!Array.isArray(i)||(n[r]=i);return n},O=(e,t)=>{const n=[];for(const r of t.split(h))r!==""&&n.push(r);n.length>0&&e.push(...n)},P=e=>{const{line:t,markWritten:n,nextData:r,oldData:i,renderValue:s}=e;if(!t.key)return t.raw;const o=k(r,t.section);if(!o||!(t.key in o))return;n(t.section,t.key);const c=k(i,t.section)?.[t.key],f=o[t.key];return JSON.stringify(c)===JSON.stringify(f)?t.raw:s(t,f)},V=(e,t,n,r,i)=>{const s=k(r,t);if(!s)return;const o=n.get(t)??new Set,c=A(s,o);Object.keys(c).length!==0&&O(e,i(c))},E=(e,t,n,r)=>{const i=new Set(t.filter(s=>s.kind==="header"&&s.section).map(s=>s.section));for(const s of W(n)){if(i.has(s))continue;const o=k(n,s);if(!o||Object.keys(o).length===0)continue;const c=A(o,new Set);Object.keys(c).length!==0&&O(e,r(c,s))}},K=e=>{const t=e.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,{spaced:n,unspaced:r}=I(e);return{eol:t,whitespace:n>0&&n>=r}},R=(e,t,n,r,i)=>{const{eol:s}=i,o=j.test(e),c=L(e),f=new Map,y=new Map;for(const[l,a]of c.entries())a.kind!=="blank"&&y.set(a.section,l);const p=(l,a)=>{let u=f.get(l);u||(u=new Set,f.set(l,u)),u.add(a)},g=(l,a)=>M(l,a,r),d=[];for(const[l,a]of c.entries()){if(a.kind==="key"){const u=P({line:a,markWritten:p,nextData:n,oldData:t,renderValue:g});u!==void 0&&d.push(u);continue}d.push(a.raw),y.get(a.section)===l&&V(d,a.section,f,n,r)}E(d,c,n,r);const w=d.join(s);return o&&!w.endsWith(s)?`${w}${s}`:w};export{K as d,R as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(n,d)=>!!d.ino&&!!d.dev&&d.ino===n.ino&&d.dev===n.dev;export{e as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import{toPath as a}from"@visulima/path/utils";import{F_OK as u}from"./FIND_UP_STOP-CAwY1qU7.js";import f from"./assertValidFileOrDirectoryPath-BTlt945W.js";const n=t(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,r]=s.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return s.getBuiltinModule(e)}return n(e)},{access:c}=i("node:fs/promises");async function d(e,o=u){f(e),e=a(e);try{return await c(e,o),!0}catch{return!1}}export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as s}from"node:module";import{toPath as u}from"@visulima/path/utils";import{F_OK as f}from"./FIND_UP_STOP-CAwY1qU7.js";import a from"./assertValidFileOrDirectoryPath-BTlt945W.js";const n=s(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,t]=r.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return r.getBuiltinModule(e)}return n(e)},{accessSync:c}=i("node:fs");function d(e,o=f){a(e),e=u(e);try{return c(e,o),!0}catch{return!1}}export{d as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{parse as u,modify as g,applyEdits as l}from"jsonc-parser";const y=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),c=(t,i,e)=>{const r=g(t.text,i,e,{formattingOptions:t.formattingOptions});t.text=l(t.text,r)},m=(t,i,e,r,s)=>{const o=new Set([...Object.keys(i),...Object.keys(e)]);for(const n of o){const a=[...r,n];n in e?n in i?s(t,i[n],e[n],a):c(t,a,e[n]):c(t,a,void 0)}},p=(t,i,e,r)=>{if(i!==e){if(y(i)&&y(e)){m(t,i,e,r,p);return}if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){for(const[s,o]of i.entries())p(t,o,e[s],[...r,s]);return}JSON.stringify(i)!==JSON.stringify(e)&&c(t,r,e)}},S=(t,i,e)=>{const r=u(t,[],{allowTrailingComma:!0}),s={formattingOptions:e,text:t};return p(s,r,i,[]),s.text},b=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},d=(t,i,e,r,s,o,n)=>{if(e&&t!==void 0){const a={...b(r),...o};let f=S(t,i,a);return s&&!f.endsWith(`
|
|
2
|
+
`)&&(f+=s),f}return`${JSON.stringify(i,n,r)}${s}`};export{d as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"./NotFoundError-CnRY6lVp.js";import t from"./PermissionError-DJ_2VWEj.js";const c=(o,r)=>{const e=o?.code;return e==="ENOENT"?new n(`no such file or directory, open '${r}'`):e==="EACCES"||e==="EPERM"?new t(`unable to read the non-readable file: ${r}`):o};export{c as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as p}from"node:module";import{toPath as d}from"@visulima/path/utils";import{dirname as c,resolve as s}from"@visulima/path";import E from"./isAccessible-PmWJhV6I.js";import k from"./isAccessibleSync-BrbOtwdr.js";const v=p(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=t=>{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(t)}return v(t)},{cwd:a}=i,{mkdir:h,rename:_,copyFile:S,unlink:D}=u("node:fs/promises"),{mkdirSync:$,renameSync:g,copyFileSync:b,unlinkSync:j}=u("node:fs");class T extends Error{constructor(e,r){super(`Source directory "${c(e)}" does not match destination directory "${c(r)}"`),this.name="SameDirectoryError"}}const l=(t,e)=>{if(!t||!e)throw new Error("Source and destination paths must not be empty");if(c(t)!==c(e))throw new T(t,e)},y=async(t,e,{cwd:r,directoryMode:o,overwrite:w,validateDirectory:m})=>{if(r&&(t=s(r,t),e=s(r,e)),m&&l(t,e),!w&&await E(e))throw new Error(`The destination file exists: ${e}`);await h(c(e),{mode:o,recursive:!0});try{await _(t,e)}catch(n){if(n.code==="EXDEV")await S(t,e),await D(t);else throw n}},f=(t,e,{cwd:r,directoryMode:o,overwrite:w,validateDirectory:m})=>{if(r&&(t=s(r,t),e=s(r,e)),m&&l(t,e),!w&&k(e))throw new Error(`The destination file exists: ${e}`);$(c(e),{mode:o,recursive:!0});try{g(t,e)}catch(n){if(n.code==="EXDEV")b(t,e),j(t);else throw n}},P=async(t,e,r={})=>{const o={overwrite:!0,validateDirectory:!1,...r,cwd:r.cwd?d(r.cwd):a()};await y(t,e,o)},R=(t,e,r)=>{const o={overwrite:!0,validateDirectory:!1,...r};o.cwd=o.cwd?d(o.cwd):a(),f(t,e,o)},V=async(t,e,r)=>{const o={overwrite:!0,...r,validateDirectory:!0};o.cwd=o.cwd?d(o.cwd):a(),await y(t,e,o)},X=(t,e,r)=>{const o={overwrite:!0,...r,validateDirectory:!0};o.cwd=o.cwd?d(o.cwd):a(),f(t,e,o)};export{P as move,R as moveSync,V as rename,X as renameSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s,W as l}from"./renderError-Dqej8k13-Bi9WKMjv.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";import{toPath as h}from"@visulima/path/utils";import j from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{i as y}from"./map-read-error-CR3rQUxx.js";const d=m(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=o=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,t]=r.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return r.getBuiltinModule(o)}return d(o)},{readFile:g}=l("node:fs/promises"),{unzip:_,brotliDecompress:b}=l("node:zlib"),w={brotli:b,gzip:_,none:(o,e)=>{e(null,o)}},T=async(o,e)=>{j(o),o=h(o);const{buffer:t,compression:f,encoding:p,flag:s}=e??{};let i;try{i=await g(o,s?{flag:s}:{})}catch(n){throw y(n,o)}return await new Promise((n,u)=>{w[f??"none"](i,(c,a)=>{c?u(c):n(t?a:a.toString(p??"utf8"))})})};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{toPath as b}from"@visulima/path/utils";import y from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{i as h}from"./map-read-error-CR3rQUxx.js";const d=a(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=o=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,t]=r.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return r.getBuiltinModule(o)}return d(o)},{readFileSync:m}=c("node:fs"),{unzipSync:g,brotliDecompressSync:_}=c("node:zlib"),j={brotli:_,gzip:g,none:o=>o},T=(o,e)=>{y(o),o=b(o);const{buffer:t,compression:f,encoding:l,flag:n}=e??{};let s;try{s=m(o,n?{flag:n}:{})}catch(u){throw h(u,o)}const p=j[f??"none"],i=p(s);return t?i:i.toString(l??"utf8")};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as n}from"ini";import c from"./readFile-BswaBgM0.js";const d=async(r,t)=>{const{bracketedArray:a=!0,...e}=t??{},o=await c(r,{encoding:"utf8",...e});return n(o,{bracketedArray:a})};export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as c}from"ini";import n from"./readFileSync-_fDF6Oj1.js";const f=(r,t)=>{const{bracketedArray:e=!0,...o}=t??{},a=n(r,{encoding:"utf8",...o});return c(a,{bracketedArray:e})};export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPath as n}from"@visulima/path/utils";import a from"./parseJson-kxKotn69.js";import d from"./readFile-BswaBgM0.js";async function u(r,o,e){typeof o=="object"&&(e=o,o=void 0);const f=await d(r,{buffer:!0,encoding:void 0});let t=new TextDecoder().decode(f);const{beforeParse:c,color:i}=e??{};return typeof c=="function"&&(t=c(t)),a(t,o,n(r),{color:i})}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"json5";import u from"./readFile-BswaBgM0.js";async function d(t,o,e){o&&typeof o=="object"&&(e=o,o=void 0);const{beforeParse:f,buffer:i,compression:a,encoding:c="utf8",flag:s}=e??{},r=await u(t,{buffer:i,compression:a,encoding:c,flag:s}),n=typeof f=="function"?f(r):r;return p.parse(n,o)}export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"json5";import a from"./readFileSync-_fDF6Oj1.js";function d(t,o,e){o&&typeof o=="object"&&(e=o,o=void 0);const{beforeParse:f,buffer:i,compression:p,encoding:s="utf8",flag:u}=e??{},r=a(t,{buffer:i,compression:p,encoding:s,flag:u}),c=typeof f=="function"?f(r):r;return n.parse(c,o)}export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPath as i}from"@visulima/path/utils";import d from"./parseJson-kxKotn69.js";import p from"./readFileSync-_fDF6Oj1.js";function a(r,o,t){typeof o=="object"&&(t=o,o=void 0);const n=p(r,{buffer:!0,encoding:void 0});let e=new TextDecoder().decode(n);const{beforeParse:f,color:c}=t??{};return typeof f=="function"&&(e=f(e)),d(e,o,i(r),{color:c})}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,W as C}from"./renderError-Dqej8k13-Bi9WKMjv.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-BswaBgM0.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPath as g}from"@visulima/path/utils";import{parse as C}from"jsonc-parser";import d from"./readFileSync-_fDF6Oj1.js";import{throwIfJsoncErrors as y}from"./readJsonc-BabpyMMh.js";const T=(o,e)=>{const{allowEmptyContent:l,allowTrailingComma:a=!0,beforeParse:r,buffer:f,color:i,compression:s,disallowComments:p,encoding:c="utf8",flag:u}=e??{},t=d(o,{buffer:f,compression:s,encoding:c,flag:u}),m=typeof r=="function"?r(t):t,n=[],w=C(m,n,{allowEmptyContent:l,allowTrailingComma:a,disallowComments:p});return y(n,m,g(o),{color:i}),w};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as a}from"smol-toml";import n from"./readFile-BswaBgM0.js";const c=async(r,t)=>{const o=await n(r,{encoding:"utf8",...t});return a(o)};export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as n}from"smol-toml";import e from"./readFileSync-_fDF6Oj1.js";const m=(o,r)=>{const t=e(o,{encoding:"utf8",...r});return n(t)};export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as n}from"yaml";import s from"./readFile-BswaBgM0.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as r}from"yaml";import m from"./readFileSync-_fDF6Oj1.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import a from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as m}from"./build-rm-options-avnusYx-.js";const i=t(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,n=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,r]=s.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return s.getBuiltinModule(e)}return i(e)},{rm:c}=n("node:fs/promises"),l=async(e,o={})=>{a(e),await c(e,m(o))};export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import u from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as f}from"./build-rm-options-avnusYx-.js";const n=t(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,r]=s.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return s.getBuiltinModule(e)}return n(e)},{rmSync:c}=i("node:fs"),_=(e,o={})=>{u(e),c(e,f(o))};export{_ as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire as B}from"node:module";const W=B(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=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:w}=q("node:module"),N=globalThis.process??Object.create(null),_={versions:{}},x=new Proxy(N,{get(e,r){if(r in e)return e[r];if(r in _)return _[r]}}),I=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,i=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,l={};if(d)for(let o=0;o<=d;o++){const c=o+u;if(!i)l[c]=!0;else if(o===0){const p=r[c-1]?.length;l[c]=[i,(p??0)-i+1]}else if(o===d)l[c]=[0,f];else{const p=r[c-o]?.length;l[c]=[0,p]}}else i===f?l[u]=i?[i,0]:!0:l[u]=[i,(f??0)-(i??0)];return{end:h,markerLines:l,start:m}},L=x.platform==="win32"&&!x.env?.WT_SESSION?">":"❯",F=(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")?I(e):e).split(`
|
|
3
|
+
`);typeof n.tabWidth=="number"&&e.includes(" ")&&(a=a.map(o=>o.replaceAll(" "," ".repeat(n.tabWidth))));const{end:u,markerLines:i,start:g}=G(r,a,n.linesAbove,n.linesBelow),f=String(u).length,{gutter:m,marker:h,message:d}=n.color;let l=a.slice(g,u).map((o,c)=>{const p=g+1+c,A=i[p],M=String(p).padStart(f),R=!i[p+1],v=` ${M}${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(v.replaceAll(/\d/g," "))," ",S,h("^").repeat(k)].join(""),R&&n.message&&($+=` ${d(n.message)}`)}return[n.prefix+h(L),m(v),o.length>0?` ${o}`:"",$].join("")}return`${n.prefix} ${m(v)}${o.length>0?` ${o}`:""}`}).join(`
|
|
5
|
+
`);return n.message&&!s&&(l=`${n.prefix+" ".repeat(f+1)+n.message}
|
|
6
|
+
${l}`),l},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)/,P=e=>e.split(O).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),H=(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=P(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}},U=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&U.set("AggregateError",AggregateError);const V=w(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,z=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 V(e)};z("node:util");const C=w(import.meta.url),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=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 C(e)};T("node:fs");T("node:path");T("node:url");export{F as W,H as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as o,dirname as s}from"@visulima/path";const p=(t,e)=>typeof t!="string"?t:t.startsWith("./")?o(t):typeof e=="string"?o(s(e),t):new URL(t,e);export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as h}from"node:module";const j=h(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:p}=d,l="unnamed",x=128,u={'"':"ˮ","*":"⁎","/":"⁄",":":"꞉","<":"‹",">":"›","?":"ʔ","\\":"∖","|":"ǀ"},m=/[\u0000-\u001F\u0080-\u009F]/g,w=/^(?:\.+[/\\]+)+|^\.+$/g,a=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i,_=/[<>:"/\\|?*]/g,b=/\//g,c=new Set([" "," ","."]),f=(n,r)=>r>0&&r<n.length-1,$=(n,r)=>{const t=n.lastIndexOf(".");if(!f(n,t))return n.slice(0,r);const e=n.slice(0,t),i=n.slice(t),s=r-i.length;return s>0?`${e.slice(0,s)}${i}`:n.slice(0,r)},g=n=>{let r=0,t=n.length;for(;r<t;){const e=n[r];if(e===void 0||!c.has(e))break;r+=1}for(;t>r;){const e=n[t-1];if(e===void 0||!c.has(e))break;t-=1}return n.slice(r,t)},v=n=>{const r=n.lastIndexOf(".");if(f(n,r)){const e=n.slice(0,r),i=n.slice(r);let s=e;for(;s.length>0;){const o=s.at(-1);if(o===void 0||!c.has(o))break;s=s.slice(0,-1)}return s.length===0?i.slice(1):`${s}${i}`}let t=n;for(;t.length>0;){const e=t.at(-1);if(e===void 0||!c.has(e))break;t=t.slice(0,-1)}return t},I=n=>{const r=n.lastIndexOf(".");if(f(n,r))return!1;if(a.test(n))return!0;let t=n;for(;t.length>0;){const e=t.at(-1);if(e===void 0||!c.has(e))break;t=t.slice(0,-1)}return!!(t.length>0&&a.test(t))},O=n=>{const r=n.lastIndexOf(".");if(f(n,r)){const i=n.slice(0,r),s=n.slice(r),o=g(i);return o.length===0?void 0:`${o}${s}`}const t=n.trim();if(t.length>0&&t[0]==="."&&t.length<=5&&t.indexOf(".",1)===-1)return;const e=g(n);if(e.length!==0)return e},k=n=>{const r=n?.filesystem??"auto";return r==="auto"?p==="win32"?"win32":"unix":r==="darwin"?"unix":r},q=(n,r)=>{if(typeof n!="string"||n.length===0)return l;const t=k(r);let e=n;if(e=e.replace(m,""),e.length===0||(e=e.replace(w,""),e.length===0))return l;if(t==="win32"||t==="fat32"){const s=e.lastIndexOf(".");if(!f(e,s)&&a.test(e))return l}if(e=t==="win32"||t==="fat32"?e.replaceAll(_,s=>u[s]??""):e.replaceAll(b,u["/"]),e=e.trim(),(t==="win32"||t==="fat32")&&(I(e)||t==="win32"&&(e=v(e),e.length===0)))return l;if(t==="fat32"){const s=O(e);if(s===void 0)return l;e=s}if(e.length===0)return l;const i=r?.maxLength??x;return e.length>i&&(e=$(e,i),e.length===0)?l:e};export{q as sanitize};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{INTERNAL_STRIP_JSON_REGEX as a}from"./FIND_UP_STOP-CAwY1qU7.js";const p=(t,{whitespace:s=!0}={})=>t.replace(a,e=>e.startsWith('"')||e[1]==="*"&&!e.endsWith("*/")?e:s?e.replaceAll(/\S/g," "):"");export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as o}from"node:module";const s=o(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=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 s(e)},{randomBytes:f}=i("node:crypto"),a=e=>`${e}.${process.pid.toString(36)}.${f(6).toString("hex")}.tmp`,c=new TextEncoder,p=e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return c.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")};export{p as i,a as o};
|
|
@@ -1,30 +1,107 @@
|
|
|
1
1
|
import { PathLike, Dirent } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
import { FSLike } from 'fdir';
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type FileSystemAdapter = Partial<FSLike>;
|
|
5
|
+
interface GlobOptions$1 {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to return absolute paths. Disable to have relative paths.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
absolute?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enables support for brace expansion syntax, like `{a,b}` or `{1..9}`.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
braceExpansion?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to match in case-sensitive mode.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
caseSensitiveMatch?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The working directory in which to search. Results will be returned relative to this directory, unless
|
|
23
|
+
* {@link absolute} is set.
|
|
24
|
+
*
|
|
25
|
+
* It is important to avoid globbing outside this directory when possible, even with absolute paths enabled,
|
|
26
|
+
* as doing so can harm performance due to having to recalculate relative paths.
|
|
27
|
+
* @default process.cwd()
|
|
28
|
+
*/
|
|
29
|
+
cwd?: string | URL;
|
|
30
|
+
/**
|
|
31
|
+
* Logs useful debug information. Meant for development purposes. Logs can change at any time.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
debug?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Maximum directory depth to crawl.
|
|
37
|
+
* @default Infinity
|
|
38
|
+
*/
|
|
39
|
+
deep?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to return entries that start with a dot, like `.gitignore` or `.prettierrc`.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
dot?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to automatically expand directory patterns.
|
|
47
|
+
*
|
|
48
|
+
* Important to disable if migrating from [`fast-glob`](https://github.com/mrmlnc/fast-glob).
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
expandDirectories?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Enables support for extglobs, like `+(pattern)`.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
extglob?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to traverse and include symbolic links. Can slightly affect performance.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
followSymbolicLinks?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* An object that overrides `node:fs` functions.
|
|
64
|
+
* @default import('node:fs')
|
|
65
|
+
*/
|
|
66
|
+
fs?: FileSystemAdapter;
|
|
67
|
+
/**
|
|
68
|
+
* Enables support for matching nested directories with globstars (`**`).
|
|
69
|
+
* If `false`, `**` behaves exactly like `*`.
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
globstar?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Glob patterns to exclude from the results.
|
|
75
|
+
* @default []
|
|
76
|
+
*/
|
|
77
|
+
ignore?: string | readonly string[];
|
|
78
|
+
/**
|
|
79
|
+
* Enable to only return directories.
|
|
80
|
+
* If `true`, disables {@link onlyFiles}.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
onlyDirectories?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Enable to only return files.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
onlyFiles?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Provide patterns as the first argument instead.
|
|
91
|
+
*/
|
|
92
|
+
patterns?: string | readonly string[];
|
|
93
|
+
/**
|
|
94
|
+
* An `AbortSignal` to abort crawling the file system.
|
|
95
|
+
* @default undefined
|
|
96
|
+
*/
|
|
97
|
+
signal?: AbortSignal;
|
|
98
|
+
} //#endregion
|
|
99
|
+
//#region src/utils.d.ts
|
|
23
100
|
/**
|
|
24
|
-
*
|
|
25
|
-
* to
|
|
101
|
+
* Converts a path to a pattern depending on the platform.
|
|
102
|
+
* Identical to {@link escapePath} on POSIX systems.
|
|
103
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#convertPathToPattern}
|
|
26
104
|
*/
|
|
27
|
-
declare const FIND_UP_STOP: symbol;
|
|
28
105
|
/**
|
|
29
106
|
* Tracks newlines during parsing in order to provide an efficient API for
|
|
30
107
|
* determining the one-indexed `{ line, col }` position for any offset
|
|
@@ -1138,6 +1215,31 @@ declare class Directives {
|
|
|
1138
1215
|
tagString(tag: string): string;
|
|
1139
1216
|
toString(doc?: Document): string;
|
|
1140
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Constant to check if the path is visible to the calling process.
|
|
1220
|
+
* Corresponds to `node:fs.constants.F_OK`.
|
|
1221
|
+
*/
|
|
1222
|
+
declare const F_OK: number;
|
|
1223
|
+
/**
|
|
1224
|
+
* Constant to check if the path is readable to the calling process.
|
|
1225
|
+
* Corresponds to `node:fs.constants.R_OK`.
|
|
1226
|
+
*/
|
|
1227
|
+
declare const R_OK: number;
|
|
1228
|
+
/**
|
|
1229
|
+
* Constant to check if the path is writable to the calling process.
|
|
1230
|
+
* Corresponds to `node:fs.constants.W_OK`.
|
|
1231
|
+
*/
|
|
1232
|
+
declare const W_OK: number;
|
|
1233
|
+
/**
|
|
1234
|
+
* Constant to check if the path is executable by the calling process.
|
|
1235
|
+
* Corresponds to `node:fs.constants.X_OK`.
|
|
1236
|
+
*/
|
|
1237
|
+
declare const X_OK: number;
|
|
1238
|
+
/**
|
|
1239
|
+
* A special symbol that can be returned by the matcher function in `findUp` or `findUpSync`
|
|
1240
|
+
* to stop the search process prematurely.
|
|
1241
|
+
*/
|
|
1242
|
+
declare const FIND_UP_STOP: symbol;
|
|
1141
1243
|
type ColorizeMethod = (value: string) => string;
|
|
1142
1244
|
/**
|
|
1143
1245
|
* Options accepted by `jsonc-parser`'s `parse` function.
|
|
@@ -1366,6 +1468,14 @@ type ReadJsonOptions = CodeFrameOptions & {
|
|
|
1366
1468
|
* Options for writing files.
|
|
1367
1469
|
*/
|
|
1368
1470
|
type WriteFileOptions = {
|
|
1471
|
+
/**
|
|
1472
|
+
* When `true` and the target file already exists, the previous contents are
|
|
1473
|
+
* preserved by renaming the existing file to `${path}.bak` before the new
|
|
1474
|
+
* contents are written. This is independent of {@link WriteFileOptions.overwrite}.
|
|
1475
|
+
*
|
|
1476
|
+
* Default: `false`
|
|
1477
|
+
*/
|
|
1478
|
+
backup?: boolean;
|
|
1369
1479
|
/**
|
|
1370
1480
|
* The group and user ID used to set the file ownership. Default: `undefined`
|
|
1371
1481
|
*/
|
|
@@ -1386,7 +1496,10 @@ type WriteFileOptions = {
|
|
|
1386
1496
|
*/
|
|
1387
1497
|
mode?: number;
|
|
1388
1498
|
/**
|
|
1389
|
-
* Indicates whether the file should be overwritten if it already exists.
|
|
1499
|
+
* Indicates whether the file should be overwritten if it already exists.
|
|
1500
|
+
* When `false` and the target already exists, an `AlreadyExistsError` is thrown.
|
|
1501
|
+
*
|
|
1502
|
+
* Default: `true`
|
|
1390
1503
|
*/
|
|
1391
1504
|
overwrite?: boolean;
|
|
1392
1505
|
/**
|
|
@@ -1657,4 +1770,4 @@ type WriteIniExtras = {
|
|
|
1657
1770
|
* whitespace and inline `;` / `#` comments) for unchanged values.
|
|
1658
1771
|
*/
|
|
1659
1772
|
type WriteIniOptions = IniEncodeOptions & WriteFileOptions & WriteIniExtras;
|
|
1660
|
-
export { CodeFrameLocation as A, FIND_UP_STOP as B,
|
|
1773
|
+
export { CodeFrameLocation as A, FIND_UP_STOP as B, CompressionType as C, F_OK as D, FindUpNameFnResult as E, FindUpName as F, GlobOptions as G, FindUpNameSyncFnResult 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 $,join as q,normalize as P,basename as z}from"@visulima/path";import{toPath as B}from"@visulima/path/utils";import D from"./WalkError-B8qTd-v-.js";import E from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{a as S,s as m,l as p}from"./walk-include-BXhGSn6t.js";const F=x(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,o]=l.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return l.getBuiltinModule(e)}return F(e)},{readdir:I,realpath:N,stat:j}=T("node:fs/promises"),M=async e=>{const t=P(e),o=z(t),r=await j(t);return p(r,o,t)};async function*R(e,t={}){const{extensions:o,followSymlinks:r=!1,includeDirs:y=!0,includeFiles:h=!0,includeSymlinks:_=!0,match:w,maxDepth:f=Number.POSITIVE_INFINITY,skip:v}=t;if(E(e),f<0)return;const u=t.visited??new Set,c=w?w.map(i=>typeof i=="string"?S(i):i):void 0,a=v?v.map(i=>typeof i=="string"?S(i):i):void 0;if(e=$(B(e)),y&&m(e,o,c,a)&&(yield await M(e)),!(f<1||!m(e,void 0,void 0,a)))try{const i=await I(e,{withFileTypes:!0});for(const s of i){let n=q(e,s.name),g=s.isDirectory(),k=s.isFile();if(s.isSymbolicLink())if(r){const d=await N(n);if(u.has(d))continue;n=d;const b=await j(d);g=b.isDirectory(),k=b.isFile()}else if(_&&m(n,o,c,a)){yield p(s,s.name,n);continue}else continue;g?(r&&u.add(n),yield*R(n,{extensions:o,followSymlinks:r,includeDirs:y,includeFiles:h,includeSymlinks:_,match:c,maxDepth:f-1,skip:a,visited:u})):k&&h&&m(n,o,c,a)&&(yield p(s,s.name,n))}}catch(i){throw i instanceof D?i:new D(i,e)}}export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=e=>{const r=e.replace(/[$()+\\^]/g,String.raw`\$&`).replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`).replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");try{return new RegExp(`^${r}$`)}catch(t){throw new Error(`Invalid glob pattern: ${e}`,{cause:t})}};class c{name;path;#e;constructor(r,t,n){this.#e=r,this.name=t,this.path=n}isDirectory(){return this.#e.isDirectory()}isFile(){return this.#e.isFile()}isSymbolicLink(){return this.#e.isSymbolicLink()}}const l=(e,r,t)=>new c(e,r,t),o=(e,r,t,n)=>{if(Array.isArray(r)&&r.length>0&&!r.some(s=>e.endsWith(s)))return!1;const a=e.includes("\\")?e.replaceAll("\\","/"):e;return t&&!t.some(s=>s.test(a))?!1:!n?.some(s=>s.test(a))};export{i as a,l,o as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as T}from"node:module";import{resolve as P,join as $,normalize as p,basename as z}from"@visulima/path";import{toPath as B}from"@visulima/path/utils";import F from"./WalkError-B8qTd-v-.js";import E from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{a as j,s as m,l as y}from"./walk-include-BXhGSn6t.js";const x=T(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[o,t]=c.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return c.getBuiltinModule(e)}return x(e)},{readdirSync:N,realpathSync:q,statSync:w}=I("node:fs"),M=e=>{const o=p(e),t=w(o);return y(t,z(o),o)};function*R(e,o={}){const{extensions:t,followSymlinks:a=!1,includeDirs:h=!0,includeFiles:_=!0,includeSymlinks:S=!0,match:v,maxDepth:f=Number.POSITIVE_INFINITY,skip:g}=o;if(E(e),f<0)return;const d=o.visited??new Set,l=v?v.map(i=>typeof i=="string"?j(i):i):void 0,r=g?g.map(i=>typeof i=="string"?j(i):i):void 0;if(e=P(B(e)),h&&m(e,t,l,r)&&(yield M(e)),!(f<1||!m(e,void 0,void 0,r)))try{const i=N(e,{withFileTypes:!0});for(const n of i){let s=$(e,n.name),k=n.isDirectory(),b=n.isFile();if(n.isSymbolicLink())if(a){const u=q(s);if(d.has(u))continue;s=u;const D=w(u);k=D.isDirectory(),b=D.isFile()}else if(S&&m(s,t,l,r)){yield y(n,n.name,p(s));continue}else continue;k?(a&&d.add(s),yield*R(s,{extensions:t,followSymlinks:a,includeDirs:h,includeFiles:_,includeSymlinks:S,match:l,maxDepth:f-1,skip:r,visited:d})):b&&_&&m(s,t,l,r)&&(yield y(n,n.name,p(s)))}}catch(i){throw i instanceof F?i:new F(i,e)}}export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as f}from"node:module";import{dirname as _}from"@visulima/path";import{toPath as y}from"@visulima/path/utils";import{F_OK as v}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./AlreadyExistsError-DEb3UWja.js";import c from"./isAccessible-PmWJhV6I.js";import j from"./assertValidFileContents-CbIN7sy7.js";import k from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{o as q,i as x}from"./to-uint-8-array-BImOQNXm.js";const m=f(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=i=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[e,o]=a.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return a.getBuiltinModule(i)}return m(i)},{mkdir:d,writeFile:w,stat:l,rename:n,chown:p,chmod:g,unlink:h}=u("node:fs/promises"),O=async(i,e,o)=>{o={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...o},k(i),j(e),i=y(i);const s=await c(i,v);if(s&&!o.overwrite)throw new b(`file already exists, open '${i}'`);const r=q(i);try{!s&&o.recursive&&await d(_(i),{recursive:!0});let t;if(await w(r,typeof e=="string"?Buffer.from(e,o.encoding??"utf8"):x(e),{flag:"wx"}),s&&o.backup&&(t=await l(i),o.chown??={gid:t.gid,uid:t.uid},await n(i,`${i}.bak`)),o.chown)try{await p(r,o.chown.uid,o.chown.gid)}catch{}await g(r,t&&!o.mode?t.mode:o.mode??438),await n(r,i)}catch(t){throw new Error(`Failed to write file at: ${i} - ${t.message}`,{cause:t})}finally{await c(r)&&await h(r)}};export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";import{dirname as h}from"@visulima/path";import{toPath as _}from"@visulima/path/utils";import{F_OK as v}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./AlreadyExistsError-DEb3UWja.js";import f from"./isAccessibleSync-BrbOtwdr.js";import S from"./assertValidFileContents-CbIN7sy7.js";import j from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{o as k,i as q}from"./to-uint-8-array-BImOQNXm.js";const a=m(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=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 a(e)},{mkdirSync:d,writeFileSync:l,statSync:p,renameSync:s,chownSync:g,chmodSync:w,unlinkSync:y}=u("node:fs"),K=(e,i,o)=>{o={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...o},j(e),S(i),e=_(e);const c=f(e,v);if(c&&!o.overwrite)throw new b(`file already exists, open '${e}'`);const r=k(e);try{!c&&o.recursive&&d(h(e),{recursive:!0});let t;if(l(r,typeof i=="string"?Buffer.from(i,o.encoding??"utf8"):q(i),{flag:"wx"}),c&&o.backup&&(t=p(e),o.chown??={gid:t.gid,uid:t.uid},s(e,`${e}.bak`)),o.chown)try{g(r,o.chown.uid,o.chown.gid)}catch{}w(r,t&&!o.mode?t.mode:o.mode??438),s(r,e)}catch(t){throw new Error(`Failed to write file at: ${e} - ${t.message}`,{cause:t})}finally{f(r)&&y(r)}};export{K as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as A}from"node:module";import{parse as I,stringify as N}from"ini";import{R_OK as O}from"./FIND_UP_STOP-CAwY1qU7.js";import R from"./isAccessible-PmWJhV6I.js";import{d as B,m as L}from"./ini-preserve-D1DopDLd.js";import M from"./writeFile-BrMtsJY7.js";const E=A(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=r=>{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(r)}return E(r)},{readFile:q}=T("node:fs/promises"),C=async(r,t,n={})=>{const{eol:g,preserveStyle:_=!0,whitespace:y,...w}=n,{align:h,bracketedArray:l,newline:b,platform:v,section:p,sort:j,...k}=w;let a=g,f=y,o,c;if(_&&await R(r,O))try{o=await q(r,"utf8"),c=I(o,{bracketedArray:l??!0});const e=B(o);a??=e.eol,f??=e.whitespace}catch(e){if(e.code!=="ENOENT")throw e}const m={align:h,bracketedArray:l,newline:b,platform:v,section:p,sort:j,whitespace:f},d=(e,u)=>N(e,u===void 0?m:{...m,section:u});let s;o!==void 0&&c?s=L(o,c,t,d,{eol:a??`
|
|
2
|
+
`}):(s=d(t,p),a===`\r
|
|
3
|
+
`&&(s=s.replaceAll(/\r?\n/g,`\r
|
|
4
|
+
`))),await M(r,s,k)};export{C as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as S}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-BrbOtwdr.js";import{d as R,m as B}from"./ini-preserve-D1DopDLd.js";import L from"./writeFileSync-W7Mf4BNy.js";const T=S(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=r=>{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(r)}return T(r)},{readFileSync:q}=k("node:fs"),C=(r,t,n={})=>{const{eol:_,preserveStyle:g=!0,whitespace:y,...h}=n,{align:b,bracketedArray:a,newline:v,platform:w,section:p,sort:j,...A}=h;let c=_,f=y,o,l;if(g&&O(r,N))try{o=q(r,"utf8"),l=E(o,{bracketedArray:a??!0});const e=R(o);c??=e.eol,f??=e.whitespace}catch(e){if(e.code!=="ENOENT")throw e}const m={align:b,bracketedArray:a,newline:v,platform:w,section:p,sort:j,whitespace:f},d=(e,u)=>I(e,u===void 0?m:{...m,section:u});let s;o!==void 0&&l?s=B(o,l,t,d,{eol:c??`
|
|
2
|
+
`}):(s=d(t,p),c===`\r
|
|
3
|
+
`&&(s=s.replaceAll(/\r?\n/g,`\r
|
|
4
|
+
`))),L(r,s,A)};export{C as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as u}from"node:module";import{k as h}from"./index-B2MhYg3r.js";import{R_OK as j}from"./FIND_UP_STOP-CAwY1qU7.js";import N from"./isAccessible-PmWJhV6I.js";import b from"./writeFile-BrMtsJY7.js";const _=u(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,s]=i.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return i.getBuiltinModule(e)}return _(e)},{readFile:y}=g("node:fs/promises"),O=async(e,t,s={})=>{const{detectIndent:c,indent:a,replacer:f,stringify:d=JSON.stringify,...p}={indent:" ",...s};let r=a,n=`
|
|
2
|
+
`;if(await N(e,j))try{const o=await y(e,"utf8");if(c){const{indent:l}=h(o);r=l}n=o.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const m=d(t,f,r);await b(e,`${m}${n}`,p)};export{O as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as l}from"node:module";import{k as y}from"./index-B2MhYg3r.js";import j from"json5";import{R_OK as q}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./isAccessible-PmWJhV6I.js";import w from"./writeFile-BrMtsJY7.js";const _=l(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=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 _(e)},{readFile:h}=g("node:fs/promises"),M=async(e,t,i={})=>{const{detectIndent:a,indent:f,quote:p,replacer:d,...m}={indent:" ",...i};let s=f,n=`
|
|
2
|
+
`;if(await b(e,q))try{const o=await h(e,"utf8");if(a){const{indent:c}=y(o);c&&(s=c)}n=o.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const u=j.stringify(t,{quote:p,replacer:d,space:s});await w(e,`${u}${n}`,m)};export{M as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{k as y}from"./index-B2MhYg3r.js";import j from"json5";import{R_OK as q}from"./FIND_UP_STOP-CAwY1qU7.js";import b from"./isAccessibleSync-BrbOtwdr.js";import T from"./writeFileSync-W7Mf4BNy.js";const _=a(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=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 _(e)},{readFileSync:h}=g("node:fs"),O=(e,t,s={})=>{const{detectIndent:f,indent:d,quote:p,replacer:m,...u}={indent:" ",...s};let i=d,n=`
|
|
2
|
+
`;if(b(e,q))try{const o=h(e,"utf8");if(f){const{indent:c}=y(o);c&&(i=c)}n=o.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const l=j.stringify(t,{quote:p,replacer:m,space:i});T(e,`${l}${n}`,u)};export{O as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{k as h}from"./index-B2MhYg3r.js";import{R_OK as j}from"./FIND_UP_STOP-CAwY1qU7.js";import N from"./isAccessibleSync-BrbOtwdr.js";import b from"./writeFileSync-W7Mf4BNy.js";const _=a(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,r]=n.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return n.getBuiltinModule(e)}return _(e)},{readFileSync:y}=g("node:fs"),$=(e,t,r={})=>{const{detectIndent:c,indent:f,replacer:d,stringify:p=JSON.stringify,...l}={indent:" ",...r};let i=f,s=`
|
|
2
|
+
`;if(N(e,j))try{const o=y(e,"utf8");if(c){const{indent:u}=h(o);i=u}s=o.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(o){if(o.code!=="ENOENT")throw o}const m=p(t,d,i);b(e,`${m}${s}`,l)};export{$ as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as u}from"node:module";import{k as b}from"./index-B2MhYg3r.js";import{R_OK as N}from"./FIND_UP_STOP-CAwY1qU7.js";import h from"./isAccessible-PmWJhV6I.js";import{b as y}from"./jsonc-merge-Bkw73TLW.js";import T from"./writeFile-BrMtsJY7.js";const _=u(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=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 _(e)},{readFile:w}=g("node:fs/promises"),j=async(e,t,n)=>{let r,o=n,s=`
|
|
2
|
+
`;if(!await h(e,N))return{indent:o,trailingNewline:s};try{if(r=await w(e,"utf8"),t){const{indent:i}=b(r);i&&(o=i)}s=r.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(i){if(i.code!=="ENOENT")throw i}return{existingText:r,indent:o,trailingNewline:s}},B=async(e,t,n={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:i=!0,replacer:c,...d}={indent:" ",...n},{existingText:l,indent:m,trailingNewline:p}=await j(e,r,s),f=y(l,t,i,m,p,o,c);await T(e,f,d)};export{B as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{k as b}from"./index-B2MhYg3r.js";import{R_OK as h}from"./FIND_UP_STOP-CAwY1qU7.js";import T from"./isAccessibleSync-BrbOtwdr.js";import{b as j}from"./jsonc-merge-Bkw73TLW.js";import x from"./writeFileSync-W7Mf4BNy.js";const _=a(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=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 _(e)},{readFileSync:N}=g("node:fs"),y=(e,t,i)=>{let r,o=i,s=`
|
|
2
|
+
`;if(!T(e,h))return{indent:o,trailingNewline:s};try{if(r=N(e,"utf8"),t){const{indent:n}=b(r);n&&(o=n)}s=r.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:""}catch(n){if(n.code!=="ENOENT")throw n}return{existingText:r,indent:o,trailingNewline:s}},E=(e,t,i={})=>{const{detectIndent:r,formattingOptions:o,indent:s,preserveComments:n=!0,replacer:d,...l}={indent:" ",...i},{existingText:f,indent:m,trailingNewline:p}=y(e,r,s),u=j(f,t,n,m,p,o,d);x(e,u,l)};export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as a}from"smol-toml";import i from"./writeFile-BrMtsJY7.js";const s=async(t,o,r)=>{await i(t,a(o),r)};export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as f}from"smol-toml";import i from"./writeFileSync-W7Mf4BNy.js";const p=(o,r,t)=>{i(o,f(r),t)};export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as p}from"yaml";import t from"./writeFile-BrMtsJY7.js";async function l(c,i,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 n=p(i,a,o??r);await t(c,n,r)}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stringify as n}from"yaml";import t from"./writeFileSync-W7Mf4BNy.js";function y(a,c,e,p){let r,o,f;typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e!="function"?(r=e,o=r.replacer,f=r.space):typeof p=="object"?(r=p,o=e,f=r.space):(o=e,f=p);const i=n(c,o,f??r);t(a,i,r)}export{y as default};
|