@visulima/fs 5.0.9 → 5.0.11
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 +4 -0
- package/dist/eol.d.ts +25 -25
- package/dist/eol.js +2 -2
- package/dist/error.d.ts +218 -218
- package/dist/glob-parent.d.ts +27 -27
- package/dist/glob-parent.js +1 -1
- package/dist/glob.d.ts +2 -2
- package/dist/glob.js +1 -1
- package/dist/index.d.ts +765 -765
- package/dist/index.js +1 -1
- package/dist/ini.d.ts +59 -59
- package/dist/ini.js +1 -1
- package/dist/is-glob.d.ts +26 -26
- package/dist/json5.d.ts +25 -25
- package/dist/json5.js +1 -1
- package/dist/jsonc.d.ts +54 -54
- package/dist/jsonc.js +1 -1
- package/dist/match.d.ts +40 -40
- package/dist/packem_shared/{collect-CIKDOMiD.js → collect-B0S0bJoE.js} +1 -1
- package/dist/packem_shared/{collectSync-D0FRLLqg.js → collectSync-0M1eoilI.js} +1 -1
- package/dist/packem_shared/copy-DiR5_5iA.js +1 -0
- package/dist/packem_shared/copySync-DffsYlhb.js +1 -0
- package/dist/packem_shared/emptyDir-BlBeczk0.js +1 -0
- package/dist/packem_shared/emptyDirSync-DfUZ9Ejz.js +1 -0
- package/dist/packem_shared/ensureDir-BEiomfxz.js +1 -0
- package/dist/packem_shared/ensureDirSync-B0w9WMwE.js +1 -0
- package/dist/packem_shared/ensureFile-waD4hDO8.js +1 -0
- package/dist/packem_shared/ensureFileSync-CG07zjV7.js +1 -0
- package/dist/packem_shared/ensureLink-Dz-PDWa5.js +1 -0
- package/dist/packem_shared/ensureLinkSync-BZH7TaSQ.js +1 -0
- package/dist/packem_shared/ensureSymlink-Byi6ajoE.js +1 -0
- package/dist/packem_shared/ensureSymlinkSync-D7OCsAd8.js +1 -0
- package/dist/packem_shared/findUp-Ylerv_a2.js +1 -0
- package/dist/packem_shared/findUpSync-BWBPRzEq.js +1 -0
- package/dist/packem_shared/glob-BUjyjdE8.js +1 -0
- package/dist/packem_shared/glob-sync.d-DaAZHTsv.d.ts +54 -0
- package/dist/packem_shared/globSync-Bk9TUV7x.js +1 -0
- package/dist/packem_shared/index-CPZbuHkp.js +1 -0
- package/dist/packem_shared/isAccessible-B7guOm3k.js +1 -0
- package/dist/packem_shared/isAccessibleSync-XH4YleJW.js +1 -0
- package/dist/packem_shared/json-error.d-COL8oxF_.d.ts +52 -0
- package/dist/packem_shared/move-KhPRvsRd.js +1 -0
- package/dist/packem_shared/{parseJson-EASgP4J9.js → parseJson-_OfIPruP.js} +1 -1
- package/dist/packem_shared/readFile-VgxUDrNH.js +1 -0
- package/dist/packem_shared/readFileSync-CloFeQw8.js +1 -0
- package/dist/packem_shared/{readIni-BsXudu2r.js → readIni-CEXHWn92.js} +1 -1
- package/dist/packem_shared/readIniSync-DsxVHypc.js +1 -0
- package/dist/packem_shared/{readJson-CcAsHxE5.js → readJson-Q3T3RlSy.js} +1 -1
- package/dist/packem_shared/{readJson5-CM1TIiHd.js → readJson5-S68aVros.js} +1 -1
- package/dist/packem_shared/{readJson5Sync-Bc26c3Fy.js → readJson5Sync-Bi9Rv46R.js} +1 -1
- package/dist/packem_shared/{readJsonSync-DuMMeB3s.js → readJsonSync-BnWiH5-R.js} +1 -1
- package/dist/packem_shared/{readJsonc-BZjMw_0f.js → readJsonc-DSoFyuDk.js} +1 -1
- package/dist/packem_shared/{readJsoncSync-C-xzeZz4.js → readJsoncSync-CLtlvFKV.js} +1 -1
- package/dist/packem_shared/readToml-CN_xnICv.js +1 -0
- package/dist/packem_shared/readTomlSync-B9TVGzen.js +1 -0
- package/dist/packem_shared/{readYaml-DvPxndW_.js → readYaml-DcpUq11D.js} +1 -1
- package/dist/packem_shared/{readYamlSync-DZ-0hSbZ.js → readYamlSync-D5RVZwco.js} +1 -1
- package/dist/packem_shared/remove-D_CUIlBL.js +1 -0
- package/dist/packem_shared/removeSync-F4nKiwrU.js +1 -0
- package/dist/packem_shared/renderError-DjesnVYT-pWsLqw-_.js +6 -0
- package/dist/packem_shared/sanitize-aEqeyx4d.js +1 -0
- package/dist/packem_shared/to-uint-8-array-7sXMoZwU.js +1 -0
- package/dist/packem_shared/{types.d-BMdL_ygj.d.ts → types.d-D3Jo_iA-.d.ts} +361 -383
- package/dist/packem_shared/walk-BReeHTKb.js +1 -0
- package/dist/packem_shared/walkSync-yHJUIJb9.js +1 -0
- package/dist/packem_shared/writeFile-srDcYaRC.js +1 -0
- package/dist/packem_shared/writeFileSync-Ddl_u4my.js +1 -0
- package/dist/packem_shared/writeIni-CKinbquM.js +4 -0
- package/dist/packem_shared/writeIniSync-BISRFyg0.js +4 -0
- package/dist/packem_shared/writeJson-DlCrFMXb.js +4 -0
- package/dist/packem_shared/writeJson5-rSp3QAKP.js +4 -0
- package/dist/packem_shared/writeJson5Sync-tSBBKnaP.js +4 -0
- package/dist/packem_shared/writeJsonSync-CKqVRz_9.js +4 -0
- package/dist/packem_shared/writeJsonc-bxz1jdeU.js +4 -0
- package/dist/packem_shared/writeJsoncSync-C-W0H9qP.js +4 -0
- package/dist/packem_shared/{writeToml-IuMO-yDu.js → writeToml-CrpfWNyK.js} +1 -1
- package/dist/packem_shared/{writeTomlSync-DhL7hHzB.js → writeTomlSync-DveRchLG.js} +1 -1
- package/dist/packem_shared/{writeYaml-ClQgvQID.js → writeYaml-DvSQ_Jbn.js} +1 -1
- package/dist/packem_shared/{writeYamlSync-DrXtHQQq.js → writeYamlSync-CEf0PUGQ.js} +1 -1
- package/dist/size.d.ts +236 -236
- package/dist/size.js +1 -1
- package/dist/toml.d.ts +52 -52
- package/dist/toml.js +1 -1
- package/dist/utils.d.ts +88 -88
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/copy-Beb64BYG.js +0 -1
- package/dist/packem_shared/copySync-CagcIEBi.js +0 -1
- package/dist/packem_shared/emptyDir-C7lyd1lW.js +0 -1
- package/dist/packem_shared/emptyDirSync-B8EYpmO9.js +0 -1
- package/dist/packem_shared/ensureDir-DGarVZw8.js +0 -1
- package/dist/packem_shared/ensureDirSync-CsgPrsDH.js +0 -1
- package/dist/packem_shared/ensureFile-CMugWljp.js +0 -1
- package/dist/packem_shared/ensureFileSync-CJYTEx2r.js +0 -1
- package/dist/packem_shared/ensureLink-ChShf3lf.js +0 -1
- package/dist/packem_shared/ensureLinkSync-DPpq0I2Z.js +0 -1
- package/dist/packem_shared/ensureSymlink-y4FZjfxA.js +0 -1
- package/dist/packem_shared/ensureSymlinkSync-TcHssCH7.js +0 -1
- package/dist/packem_shared/findUp-Cii5ATt5.js +0 -1
- package/dist/packem_shared/findUpSync-C9Lkh7-v.js +0 -1
- package/dist/packem_shared/glob-DMbPwGSj.js +0 -1
- package/dist/packem_shared/glob-sync.d-hXe38TnZ.d.ts +0 -54
- package/dist/packem_shared/globSync-DiP2rtGn.js +0 -1
- package/dist/packem_shared/index-Ct4GqZSP.js +0 -1
- package/dist/packem_shared/isAccessible-PmWJhV6I.js +0 -1
- package/dist/packem_shared/isAccessibleSync-BrbOtwdr.js +0 -1
- package/dist/packem_shared/json-error.d-DVILOyHc.d.ts +0 -52
- package/dist/packem_shared/move-DopmzT-2.js +0 -1
- package/dist/packem_shared/readFile-BswaBgM0.js +0 -1
- package/dist/packem_shared/readFileSync-_fDF6Oj1.js +0 -1
- package/dist/packem_shared/readIniSync-DKwRbbs9.js +0 -1
- package/dist/packem_shared/readToml-D4jpe9q_.js +0 -1
- package/dist/packem_shared/readTomlSync-B5PIYT9z.js +0 -1
- package/dist/packem_shared/remove-CSbrd0dl.js +0 -1
- package/dist/packem_shared/removeSync-BoLAzRQE.js +0 -1
- package/dist/packem_shared/renderError-B3ePOoBG-Bi9WKMjv.js +0 -6
- package/dist/packem_shared/sanitize-DGZ3w-_w.js +0 -1
- package/dist/packem_shared/to-uint-8-array-BImOQNXm.js +0 -1
- package/dist/packem_shared/walk-OX4-6oCP.js +0 -1
- package/dist/packem_shared/walkSync-BPs6czIM.js +0 -1
- package/dist/packem_shared/writeFile-BrMtsJY7.js +0 -1
- package/dist/packem_shared/writeFileSync-W7Mf4BNy.js +0 -1
- package/dist/packem_shared/writeIni-BWX3cP1K.js +0 -4
- package/dist/packem_shared/writeIniSync-fOdgPFfL.js +0 -4
- package/dist/packem_shared/writeJson-bEVi25gX.js +0 -4
- package/dist/packem_shared/writeJson5-Ch8TpNPI.js +0 -4
- package/dist/packem_shared/writeJson5Sync-BrctV_Mk.js +0 -4
- package/dist/packem_shared/writeJsonSync-DkGnd416.js +0 -4
- package/dist/packem_shared/writeJsonc-CefrwsOc.js +0 -4
- package/dist/packem_shared/writeJsoncSync-BskDjn8o.js +0 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as h}from"node:module";import{FIND_UP_STOP as
|
|
1
|
+
import{createRequire as h}from"node:module";import{FIND_UP_STOP as R,F_OK as P,R_OK as $,W_OK as J,X_OK as K}from"./packem_shared/FIND_UP_STOP-CAwY1qU7.js";import{default as U}from"./packem_shared/copy-DiR5_5iA.js";import{default as B}from"./packem_shared/copySync-DffsYlhb.js";import{default as A}from"./packem_shared/ensureDir-BEiomfxz.js";import{default as N}from"./packem_shared/ensureDirSync-B0w9WMwE.js";import{default as G}from"./packem_shared/ensureFile-waD4hDO8.js";import{default as X}from"./packem_shared/ensureFileSync-CG07zjV7.js";import{default as Q}from"./packem_shared/ensureLink-Dz-PDWa5.js";import{default as Y}from"./packem_shared/ensureLinkSync-BZH7TaSQ.js";import{default as ee}from"./packem_shared/ensureSymlink-Byi6ajoE.js";import{default as te}from"./packem_shared/ensureSymlinkSync-D7OCsAd8.js";import{CRLF as se,EOL as ae,LF as ne,detect as ie,format as fe}from"./eol.js";import{default as le}from"./packem_shared/collect-B0S0bJoE.js";import{default as pe}from"./packem_shared/collectSync-0M1eoilI.js";import{default as de}from"./packem_shared/findUp-Ylerv_a2.js";import{default as ye}from"./packem_shared/findUpSync-BWBPRzEq.js";import{default as _e}from"./packem_shared/glob-BUjyjdE8.js";import{default as he}from"./packem_shared/globSync-Bk9TUV7x.js";import{default as be}from"./packem_shared/walk-BReeHTKb.js";import{default as we}from"./packem_shared/walkSync-yHJUIJb9.js";import{default as Ce}from"./glob-parent.js";import{default as je}from"./packem_shared/isAccessible-B7guOm3k.js";import{default as Oe}from"./packem_shared/isAccessibleSync-XH4YleJW.js";import{default as Re}from"./is-glob.js";import{match as $e,matcher as Je}from"./match.js";import{move as Te,moveSync as Ue,rename as We,renameSync as Be}from"./packem_shared/move-KhPRvsRd.js";import{default as Ae}from"./packem_shared/readFile-VgxUDrNH.js";import{default as Ne}from"./packem_shared/readFileSync-CloFeQw8.js";import{default as Ge}from"./packem_shared/readJson-Q3T3RlSy.js";import{default as Xe}from"./packem_shared/readJsonSync-BnWiH5-R.js";import{default as Qe}from"./packem_shared/emptyDir-BlBeczk0.js";import{default as Ye}from"./packem_shared/emptyDirSync-DfUZ9Ejz.js";import{default as er}from"./packem_shared/remove-D_CUIlBL.js";import{default as tr}from"./packem_shared/removeSync-F4nKiwrU.js";import{sanitize as sr}from"./packem_shared/sanitize-aEqeyx4d.js";import{default as nr}from"./packem_shared/writeFile-srDcYaRC.js";import{default as fr}from"./packem_shared/writeFileSync-Ddl_u4my.js";import{default as lr}from"./packem_shared/writeJson-DlCrFMXb.js";import{default as pr}from"./packem_shared/writeJsonSync-CKqVRz_9.js";let F;const b=n=>(F??=h(import.meta.url))(n),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=n=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[s,f]=i.versions.node.split(".").map(Number);if(s>22||s===22&&f>=3||s===20&&f>=16)return i.getBuiltinModule(n)}return b(n)},g=u("fs"),w=u("os"),k=u("path");var l={},x;function C(){if(x)return l;x=1;var n=Object.defineProperty,s=(o,e)=>n(o,"name",{value:e,configurable:!0}),f=g,y=w,S=k;const p=s(o=>{let e="";for(let r=0;r<o.length;r+=1){const t=o[r],a=t.toUpperCase();e+=t===a?t.toLowerCase():a}return e},"invertCase"),c=new Map,m=s((o,e)=>{const r=S.join(o,`.is-fs-case-sensitive-test-${process.pid}`);try{return e.writeFileSync(r,""),!e.existsSync(p(r))}finally{try{e.unlinkSync(r)}catch{}}},"checkDirectoryCaseWithWrite"),_=s((o,e,r)=>{try{return m(o,r)}catch(t){if(e===void 0)return m(y.tmpdir(),r);throw t}},"checkDirectoryCaseWithFallback"),v=s((o,e=f,r=!0)=>{const t=o??process.cwd();if(r&&c.has(t))return c.get(t);let a;const d=p(t);return d!==t&&e.existsSync(t)?a=!e.existsSync(d):a=_(t,o,e),r&&c.set(t,a),a},"isFsCaseSensitive");return l.isFsCaseSensitive=v,l}var D=C();const q=D.isFsCaseSensitive;export{se as CRLF,ae as EOL,R as FIND_UP_STOP,P as F_OK,ne as LF,$ as R_OK,J as W_OK,K as X_OK,le as collect,pe as collectSync,U as copy,B as copySync,ie as detect,Qe as emptyDir,Ye as emptyDirSync,A as ensureDir,N as ensureDirSync,G as ensureFile,X as ensureFileSync,Q as ensureLink,Y as ensureLinkSync,ee as ensureSymlink,te as ensureSymlinkSync,de as findUp,ye as findUpSync,fe as format,_e as glob,Ce as globParent,he as globSync,je as isAccessible,Oe as isAccessibleSync,q as isFsCaseSensitive,Re as isGlob,$e as match,Je as matcher,Te as move,Ue as moveSync,Ae as readFile,Ne as readFileSync,Ge as readJson,Xe as readJsonSync,er as remove,tr as removeSync,We as rename,Be as renameSync,sr as sanitize,be as walk,we as walkSync,nr as writeFile,fr as writeFileSync,lr as writeJson,pr as writeJsonSync};
|
package/dist/ini.d.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { C as CompressionType, R as ReadIniOptions, W as WriteIniOptions } from "./packem_shared/types.d-
|
|
2
|
-
export type { I as IniEncodeOptions, a as IniLineEnding } from "./packem_shared/types.d-
|
|
1
|
+
import { C as CompressionType, R as ReadIniOptions, W as WriteIniOptions } from "./packem_shared/types.d-D3Jo_iA-.js";
|
|
2
|
+
export type { I as IniEncodeOptions, a as IniLineEnding } from "./packem_shared/types.d-D3Jo_iA-.js";
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'fdir';
|
|
5
5
|
/**
|
|
6
|
-
* Asynchronously reads an INI file and parses it into an object.
|
|
7
|
-
* @template R The expected type of the parsed object. Defaults to `Record<string, unknown>`.
|
|
8
|
-
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
9
|
-
* @param options Optional configuration. See {@link ReadIniOptions}.
|
|
10
|
-
* @returns A promise that resolves with the parsed object.
|
|
11
|
-
* @example
|
|
12
|
-
* ```javascript
|
|
13
|
-
* import { readIni } from "@visulima/fs/ini";
|
|
14
|
-
*
|
|
15
|
-
* const config = await readIni("./config.ini");
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
6
|
+
* Asynchronously reads an INI file and parses it into an object.
|
|
7
|
+
* @template R The expected type of the parsed object. Defaults to `Record<string, unknown>`.
|
|
8
|
+
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
9
|
+
* @param options Optional configuration. See {@link ReadIniOptions}.
|
|
10
|
+
* @returns A promise that resolves with the parsed object.
|
|
11
|
+
* @example
|
|
12
|
+
* ```javascript
|
|
13
|
+
* import { readIni } from "@visulima/fs/ini";
|
|
14
|
+
*
|
|
15
|
+
* const config = await readIni("./config.ini");
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
18
|
declare const readIni: <R = Record<string, unknown>>(path: URL | string, options?: ReadIniOptions<CompressionType>) => Promise<R>;
|
|
19
19
|
/**
|
|
20
|
-
* Synchronously reads an INI file and parses it into an object.
|
|
21
|
-
* @template R The expected type of the parsed object. Defaults to `Record<string, unknown>`.
|
|
22
|
-
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
23
|
-
* @param options Optional configuration. See {@link ReadIniOptions}.
|
|
24
|
-
* @returns The parsed object.
|
|
25
|
-
* @example
|
|
26
|
-
* ```javascript
|
|
27
|
-
* import { readIniSync } from "@visulima/fs/ini";
|
|
28
|
-
*
|
|
29
|
-
* const config = readIniSync("./config.ini");
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
20
|
+
* Synchronously reads an INI file and parses it into an object.
|
|
21
|
+
* @template R The expected type of the parsed object. Defaults to `Record<string, unknown>`.
|
|
22
|
+
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
23
|
+
* @param options Optional configuration. See {@link ReadIniOptions}.
|
|
24
|
+
* @returns The parsed object.
|
|
25
|
+
* @example
|
|
26
|
+
* ```javascript
|
|
27
|
+
* import { readIniSync } from "@visulima/fs/ini";
|
|
28
|
+
*
|
|
29
|
+
* const config = readIniSync("./config.ini");
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
32
|
declare const readIniSync: (path: URL | string, options?: ReadIniOptions<CompressionType>) => Record<string, unknown>;
|
|
33
33
|
/**
|
|
34
|
-
* Asynchronously writes an object to an INI file.
|
|
35
|
-
*
|
|
36
|
-
* When an existing file is present and `preserveStyle` is `true` (the default), the original file's
|
|
37
|
-
* whitespace-around-`=` style and line endings are auto-detected and retained, and any line whose
|
|
38
|
-
* parsed value is unchanged is kept verbatim — preserving trailing whitespace and inline `;`/`#`
|
|
39
|
-
* comments. Explicit `whitespace` / `eol` options always win over detection.
|
|
40
|
-
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
41
|
-
* @param data The data to serialize.
|
|
42
|
-
* @param options Optional configuration. See {@link WriteIniOptions}.
|
|
43
|
-
* @returns A promise that resolves when the file has been written.
|
|
44
|
-
* @example
|
|
45
|
-
* ```javascript
|
|
46
|
-
* import { writeIni } from "@visulima/fs/ini";
|
|
47
|
-
*
|
|
48
|
-
* await writeIni("./config.ini", { server: { port: 8080 } });
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
34
|
+
* Asynchronously writes an object to an INI file.
|
|
35
|
+
*
|
|
36
|
+
* When an existing file is present and `preserveStyle` is `true` (the default), the original file's
|
|
37
|
+
* whitespace-around-`=` style and line endings are auto-detected and retained, and any line whose
|
|
38
|
+
* parsed value is unchanged is kept verbatim — preserving trailing whitespace and inline `;`/`#`
|
|
39
|
+
* comments. Explicit `whitespace` / `eol` options always win over detection.
|
|
40
|
+
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
41
|
+
* @param data The data to serialize.
|
|
42
|
+
* @param options Optional configuration. See {@link WriteIniOptions}.
|
|
43
|
+
* @returns A promise that resolves when the file has been written.
|
|
44
|
+
* @example
|
|
45
|
+
* ```javascript
|
|
46
|
+
* import { writeIni } from "@visulima/fs/ini";
|
|
47
|
+
*
|
|
48
|
+
* await writeIni("./config.ini", { server: { port: 8080 } });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
51
|
declare const writeIni: (path: URL | string, data: Record<string, unknown>, options?: WriteIniOptions) => Promise<void>;
|
|
52
52
|
/**
|
|
53
|
-
* Synchronously writes an object to an INI file.
|
|
54
|
-
*
|
|
55
|
-
* When an existing file is present and `preserveStyle` is `true` (the default), the original file's
|
|
56
|
-
* whitespace-around-`=` style and line endings are auto-detected and retained, and any line whose
|
|
57
|
-
* parsed value is unchanged is kept verbatim — preserving trailing whitespace and inline `;`/`#`
|
|
58
|
-
* comments. Explicit `whitespace` / `eol` options always win over detection.
|
|
59
|
-
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
60
|
-
* @param data The data to serialize.
|
|
61
|
-
* @param options Optional configuration. See {@link WriteIniOptions}.
|
|
62
|
-
* @example
|
|
63
|
-
* ```javascript
|
|
64
|
-
* import { writeIniSync } from "@visulima/fs/ini";
|
|
65
|
-
*
|
|
66
|
-
* writeIniSync("./config.ini", { server: { port: 8080 } });
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
53
|
+
* Synchronously writes an object to an INI file.
|
|
54
|
+
*
|
|
55
|
+
* When an existing file is present and `preserveStyle` is `true` (the default), the original file's
|
|
56
|
+
* whitespace-around-`=` style and line endings are auto-detected and retained, and any line whose
|
|
57
|
+
* parsed value is unchanged is kept verbatim — preserving trailing whitespace and inline `;`/`#`
|
|
58
|
+
* comments. Explicit `whitespace` / `eol` options always win over detection.
|
|
59
|
+
* @param path The path to the INI file. Can be a file URL or a string path.
|
|
60
|
+
* @param data The data to serialize.
|
|
61
|
+
* @param options Optional configuration. See {@link WriteIniOptions}.
|
|
62
|
+
* @example
|
|
63
|
+
* ```javascript
|
|
64
|
+
* import { writeIniSync } from "@visulima/fs/ini";
|
|
65
|
+
*
|
|
66
|
+
* writeIniSync("./config.ini", { server: { port: 8080 } });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
69
|
declare const writeIniSync: (path: URL | string, data: Record<string, unknown>, options?: WriteIniOptions) => void;
|
|
70
70
|
export { type ReadIniOptions, type WriteIniOptions, readIni, readIniSync, writeIni, writeIniSync };
|
package/dist/ini.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"./packem_shared/readIni-
|
|
1
|
+
import{default as a}from"./packem_shared/readIni-CEXHWn92.js";import{default as f}from"./packem_shared/readIniSync-DsxVHypc.js";import{default as d}from"./packem_shared/writeIni-CKinbquM.js";import{default as n}from"./packem_shared/writeIniSync-BISRFyg0.js";export{a as readIni,f as readIniSync,d as writeIni,n as writeIniSync};
|
package/dist/is-glob.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Options accepted by {@link isGlob}.
|
|
3
|
-
*/
|
|
2
|
+
* Options accepted by {@link isGlob}.
|
|
3
|
+
*/
|
|
4
4
|
interface IsGlobOptions {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
* When `false`, matches more permissively — any string containing unescaped glob
|
|
7
|
+
* meta characters (`*`, `?`, `{}`, `()`, `[]`) is treated as a glob, even when the
|
|
8
|
+
* sequence is not a valid glob expression.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
11
|
strict?: boolean;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Returns `true` if the given value looks like a glob pattern (including extglobs like `@(foo|bar)`).
|
|
15
|
-
*
|
|
16
|
-
* Escaped meta characters (e.g. `\\*`) are not considered globs. Non-string values always return `false`.
|
|
17
|
-
*
|
|
18
|
-
* Powered by [`is-glob`](https://github.com/micromatch/is-glob) which is bundled into the built output so it does
|
|
19
|
-
* not appear as a runtime dependency of `@visulima/fs`.
|
|
20
|
-
* @param value The value to inspect.
|
|
21
|
-
* @param options Optional configuration. See {@link IsGlobOptions}.
|
|
22
|
-
* @returns `true` if `value` looks like a glob pattern, otherwise `false`.
|
|
23
|
-
* @example
|
|
24
|
-
* ```javascript
|
|
25
|
-
* import { isGlob } from "@visulima/fs";
|
|
26
|
-
*
|
|
27
|
-
* isGlob("src/**\/*.ts"); // true
|
|
28
|
-
* isGlob("src/index.ts"); // false
|
|
29
|
-
* isGlob("src/\\*.ts"); // false — escaped
|
|
30
|
-
* isGlob("!foo.js"); // true — negation
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
14
|
+
* Returns `true` if the given value looks like a glob pattern (including extglobs like `@(foo|bar)`).
|
|
15
|
+
*
|
|
16
|
+
* Escaped meta characters (e.g. `\\*`) are not considered globs. Non-string values always return `false`.
|
|
17
|
+
*
|
|
18
|
+
* Powered by [`is-glob`](https://github.com/micromatch/is-glob) which is bundled into the built output so it does
|
|
19
|
+
* not appear as a runtime dependency of `@visulima/fs`.
|
|
20
|
+
* @param value The value to inspect.
|
|
21
|
+
* @param options Optional configuration. See {@link IsGlobOptions}.
|
|
22
|
+
* @returns `true` if `value` looks like a glob pattern, otherwise `false`.
|
|
23
|
+
* @example
|
|
24
|
+
* ```javascript
|
|
25
|
+
* import { isGlob } from "@visulima/fs";
|
|
26
|
+
*
|
|
27
|
+
* isGlob("src/**\/*.ts"); // true
|
|
28
|
+
* isGlob("src/index.ts"); // false
|
|
29
|
+
* isGlob("src/\\*.ts"); // false — escaped
|
|
30
|
+
* isGlob("!foo.js"); // true — negation
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
33
|
declare const isGlob: (value: unknown, options?: IsGlobOptions) => boolean;
|
|
34
34
|
export { type IsGlobOptions, isGlob as default };
|
package/dist/json5.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CompressionType, b as ReadJson5Options, J as Json5Reviver, c as WriteJson5Options } from "./packem_shared/types.d-
|
|
2
|
-
export type { d as Json5Replacer } from "./packem_shared/types.d-
|
|
1
|
+
import { C as CompressionType, b as ReadJson5Options, J as Json5Reviver, c as WriteJson5Options } from "./packem_shared/types.d-D3Jo_iA-.js";
|
|
2
|
+
export type { d as Json5Replacer } from "./packem_shared/types.d-D3Jo_iA-.js";
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'fdir';
|
|
5
5
|
declare function readJson5<R = unknown>(path: URL | string, options?: ReadJson5Options<CompressionType>): Promise<R>;
|
|
@@ -7,30 +7,30 @@ declare function readJson5<R = unknown>(path: URL | string, reviver: Json5Revive
|
|
|
7
7
|
declare function readJson5Sync(path: URL | string, options?: ReadJson5Options<CompressionType>): unknown;
|
|
8
8
|
declare function readJson5Sync(path: URL | string, reviver: Json5Reviver, options?: ReadJson5Options<CompressionType>): unknown;
|
|
9
9
|
/**
|
|
10
|
-
* Asynchronously writes a value to a JSON5 file.
|
|
11
|
-
* @param path The path to the JSON5 file. Can be a file URL or a string path.
|
|
12
|
-
* @param data The data to serialize.
|
|
13
|
-
* @param options Optional configuration. See {@link WriteJson5Options}.
|
|
14
|
-
* @returns A promise that resolves when the file has been written.
|
|
15
|
-
* @example
|
|
16
|
-
* ```javascript
|
|
17
|
-
* import { writeJson5 } from "@visulima/fs/json5";
|
|
18
|
-
*
|
|
19
|
-
* await writeJson5("./config.json5", { name: "app" }, { indent: 2, quote: "'" });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
10
|
+
* Asynchronously writes a value to a JSON5 file.
|
|
11
|
+
* @param path The path to the JSON5 file. Can be a file URL or a string path.
|
|
12
|
+
* @param data The data to serialize.
|
|
13
|
+
* @param options Optional configuration. See {@link WriteJson5Options}.
|
|
14
|
+
* @returns A promise that resolves when the file has been written.
|
|
15
|
+
* @example
|
|
16
|
+
* ```javascript
|
|
17
|
+
* import { writeJson5 } from "@visulima/fs/json5";
|
|
18
|
+
*
|
|
19
|
+
* await writeJson5("./config.json5", { name: "app" }, { indent: 2, quote: "'" });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
22
|
declare const writeJson5: (path: URL | string, data: unknown, options?: WriteJson5Options) => Promise<void>;
|
|
23
23
|
/**
|
|
24
|
-
* Synchronously writes a value to a JSON5 file.
|
|
25
|
-
* @param path The path to the JSON5 file. Can be a file URL or a string path.
|
|
26
|
-
* @param data The data to serialize.
|
|
27
|
-
* @param options Optional configuration. See {@link WriteJson5Options}.
|
|
28
|
-
* @example
|
|
29
|
-
* ```javascript
|
|
30
|
-
* import { writeJson5Sync } from "@visulima/fs/json5";
|
|
31
|
-
*
|
|
32
|
-
* writeJson5Sync("./config.json5", { name: "app" }, { indent: 2 });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
24
|
+
* Synchronously writes a value to a JSON5 file.
|
|
25
|
+
* @param path The path to the JSON5 file. Can be a file URL or a string path.
|
|
26
|
+
* @param data The data to serialize.
|
|
27
|
+
* @param options Optional configuration. See {@link WriteJson5Options}.
|
|
28
|
+
* @example
|
|
29
|
+
* ```javascript
|
|
30
|
+
* import { writeJson5Sync } from "@visulima/fs/json5";
|
|
31
|
+
*
|
|
32
|
+
* writeJson5Sync("./config.json5", { name: "app" }, { indent: 2 });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
35
|
declare const writeJson5Sync: (path: URL | string, data: unknown, options?: WriteJson5Options) => void;
|
|
36
36
|
export { type Json5Reviver, type ReadJson5Options, type WriteJson5Options, readJson5, readJson5Sync, writeJson5, writeJson5Sync };
|
package/dist/json5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./packem_shared/readJson5-
|
|
1
|
+
import{default as r}from"./packem_shared/readJson5-S68aVros.js";import{default as t}from"./packem_shared/readJson5Sync-Bi9Rv46R.js";import{default as s}from"./packem_shared/writeJson5-rSp3QAKP.js";import{default as n}from"./packem_shared/writeJson5Sync-tSBBKnaP.js";export{r as readJson5,t as readJson5Sync,s as writeJson5,n as writeJson5Sync};
|
package/dist/jsonc.d.ts
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { C as CompressionType, e as ReadJsoncOptions, f as WriteJsoncOptions } from "./packem_shared/types.d-
|
|
2
|
-
export type { g as JsoncFormattingOptions, h as JsoncParseOptions } from "./packem_shared/types.d-
|
|
1
|
+
import { C as CompressionType, e as ReadJsoncOptions, f as WriteJsoncOptions } from "./packem_shared/types.d-D3Jo_iA-.js";
|
|
2
|
+
export type { g as JsoncFormattingOptions, h as JsoncParseOptions } from "./packem_shared/types.d-D3Jo_iA-.js";
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'fdir';
|
|
5
5
|
/**
|
|
6
|
-
* Asynchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value.
|
|
7
|
-
* Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`.
|
|
8
|
-
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
9
|
-
* @param options Optional configuration. See {@link ReadJsoncOptions}.
|
|
10
|
-
* @returns A promise that resolves with the parsed value.
|
|
11
|
-
* @example
|
|
12
|
-
* ```javascript
|
|
13
|
-
* import { readJsonc } from "@visulima/fs/jsonc";
|
|
14
|
-
*
|
|
15
|
-
* const config = await readJsonc("./tsconfig.json", { allowTrailingComma: true });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
6
|
+
* Asynchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value.
|
|
7
|
+
* Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`.
|
|
8
|
+
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
9
|
+
* @param options Optional configuration. See {@link ReadJsoncOptions}.
|
|
10
|
+
* @returns A promise that resolves with the parsed value.
|
|
11
|
+
* @example
|
|
12
|
+
* ```javascript
|
|
13
|
+
* import { readJsonc } from "@visulima/fs/jsonc";
|
|
14
|
+
*
|
|
15
|
+
* const config = await readJsonc("./tsconfig.json", { allowTrailingComma: true });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
18
|
declare const readJsonc: (path: URL | string, options?: ReadJsoncOptions<CompressionType>) => Promise<unknown>;
|
|
19
19
|
/**
|
|
20
|
-
* Synchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value.
|
|
21
|
-
* Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`.
|
|
22
|
-
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
23
|
-
* @param options Optional configuration. See {@link ReadJsoncOptions}.
|
|
24
|
-
* @returns The parsed value.
|
|
25
|
-
* @example
|
|
26
|
-
* ```javascript
|
|
27
|
-
* import { readJsoncSync } from "@visulima/fs/jsonc";
|
|
28
|
-
*
|
|
29
|
-
* const config = readJsoncSync("./tsconfig.json", { allowTrailingComma: true });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
20
|
+
* Synchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value.
|
|
21
|
+
* Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`.
|
|
22
|
+
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
23
|
+
* @param options Optional configuration. See {@link ReadJsoncOptions}.
|
|
24
|
+
* @returns The parsed value.
|
|
25
|
+
* @example
|
|
26
|
+
* ```javascript
|
|
27
|
+
* import { readJsoncSync } from "@visulima/fs/jsonc";
|
|
28
|
+
*
|
|
29
|
+
* const config = readJsoncSync("./tsconfig.json", { allowTrailingComma: true });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
32
|
declare const readJsoncSync: (path: URL | string, options?: ReadJsoncOptions<CompressionType>) => unknown;
|
|
33
33
|
/**
|
|
34
|
-
* Asynchronously writes a value to a JSONC file. When `preserveComments` is `true` (the default)
|
|
35
|
-
* and the target file already exists, existing comments and formatting are preserved by computing
|
|
36
|
-
* a minimal diff against the new value via `jsonc-parser`'s `modify` API.
|
|
37
|
-
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
38
|
-
* @param data The data to serialize.
|
|
39
|
-
* @param options Optional configuration. See {@link WriteJsoncOptions}.
|
|
40
|
-
* @returns A promise that resolves when the file has been written.
|
|
41
|
-
* @example
|
|
42
|
-
* ```javascript
|
|
43
|
-
* import { writeJsonc } from "@visulima/fs/jsonc";
|
|
44
|
-
*
|
|
45
|
-
* // Preserves comments inside an existing tsconfig.json
|
|
46
|
-
* await writeJsonc("./tsconfig.json", { ...tsconfig, compilerOptions: { target: "es2024" } });
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
34
|
+
* Asynchronously writes a value to a JSONC file. When `preserveComments` is `true` (the default)
|
|
35
|
+
* and the target file already exists, existing comments and formatting are preserved by computing
|
|
36
|
+
* a minimal diff against the new value via `jsonc-parser`'s `modify` API.
|
|
37
|
+
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
38
|
+
* @param data The data to serialize.
|
|
39
|
+
* @param options Optional configuration. See {@link WriteJsoncOptions}.
|
|
40
|
+
* @returns A promise that resolves when the file has been written.
|
|
41
|
+
* @example
|
|
42
|
+
* ```javascript
|
|
43
|
+
* import { writeJsonc } from "@visulima/fs/jsonc";
|
|
44
|
+
*
|
|
45
|
+
* // Preserves comments inside an existing tsconfig.json
|
|
46
|
+
* await writeJsonc("./tsconfig.json", { ...tsconfig, compilerOptions: { target: "es2024" } });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
49
|
declare const writeJsonc: (path: URL | string, data: unknown, options?: WriteJsoncOptions) => Promise<void>;
|
|
50
50
|
/**
|
|
51
|
-
* Synchronously writes a value to a JSONC file. When `preserveComments` is `true` (the default)
|
|
52
|
-
* and the target file already exists, existing comments and formatting are preserved by computing
|
|
53
|
-
* a minimal diff against the new value via `jsonc-parser`'s `modify` API.
|
|
54
|
-
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
55
|
-
* @param data The data to serialize.
|
|
56
|
-
* @param options Optional configuration. See {@link WriteJsoncOptions}.
|
|
57
|
-
* @example
|
|
58
|
-
* ```javascript
|
|
59
|
-
* import { writeJsoncSync } from "@visulima/fs/jsonc";
|
|
60
|
-
*
|
|
61
|
-
* writeJsoncSync("./tsconfig.json", updated);
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
51
|
+
* Synchronously writes a value to a JSONC file. When `preserveComments` is `true` (the default)
|
|
52
|
+
* and the target file already exists, existing comments and formatting are preserved by computing
|
|
53
|
+
* a minimal diff against the new value via `jsonc-parser`'s `modify` API.
|
|
54
|
+
* @param path The path to the JSONC file. Can be a file URL or a string path.
|
|
55
|
+
* @param data The data to serialize.
|
|
56
|
+
* @param options Optional configuration. See {@link WriteJsoncOptions}.
|
|
57
|
+
* @example
|
|
58
|
+
* ```javascript
|
|
59
|
+
* import { writeJsoncSync } from "@visulima/fs/jsonc";
|
|
60
|
+
*
|
|
61
|
+
* writeJsoncSync("./tsconfig.json", updated);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
64
|
declare const writeJsoncSync: (path: URL | string, data: unknown, options?: WriteJsoncOptions) => void;
|
|
65
65
|
export { type ReadJsoncOptions, type WriteJsoncOptions, readJsonc, readJsoncSync, writeJsonc, writeJsoncSync };
|
package/dist/jsonc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./packem_shared/readJsonc-
|
|
1
|
+
import{default as r}from"./packem_shared/readJsonc-DSoFyuDk.js";import{default as t}from"./packem_shared/readJsoncSync-CLtlvFKV.js";import{default as s}from"./packem_shared/writeJsonc-bxz1jdeU.js";import{default as d}from"./packem_shared/writeJsoncSync-C-W0H9qP.js";export{r as readJsonc,t as readJsoncSync,s as writeJsonc,d as writeJsoncSync};
|
package/dist/match.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Options accepted by {@link match} and {@link matcher}.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors `picomatch.PicomatchOptions`; passed straight through to
|
|
5
|
-
* [`picomatch`](https://github.com/micromatch/picomatch#options); see its
|
|
6
|
-
* documentation for the full list.
|
|
7
|
-
*/
|
|
2
|
+
* Options accepted by {@link match} and {@link matcher}.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `picomatch.PicomatchOptions`; passed straight through to
|
|
5
|
+
* [`picomatch`](https://github.com/micromatch/picomatch#options); see its
|
|
6
|
+
* documentation for the full list.
|
|
7
|
+
*/
|
|
8
8
|
interface MatchOptions {
|
|
9
9
|
basename?: boolean;
|
|
10
10
|
bash?: boolean;
|
|
@@ -40,41 +40,41 @@ interface MatchOptions {
|
|
|
40
40
|
windows?: boolean;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Tests whether a path matches one or more glob patterns.
|
|
44
|
-
*
|
|
45
|
-
* Powered by [`picomatch`](https://github.com/micromatch/picomatch) which is bundled into the built output so it does
|
|
46
|
-
* not appear as a runtime dependency of `@visulima/fs`.
|
|
47
|
-
*
|
|
48
|
-
* If you match many values against the same pattern, prefer {@link matcher} to compile the pattern once.
|
|
49
|
-
* @param value The path (or paths) to test.
|
|
50
|
-
* @param pattern A single glob or array of globs.
|
|
51
|
-
* @param options Optional picomatch options. See {@link MatchOptions}.
|
|
52
|
-
* @returns `true` if `value` matches any of `pattern`.
|
|
53
|
-
* @example
|
|
54
|
-
* ```javascript
|
|
55
|
-
* import { match } from "@visulima/fs";
|
|
56
|
-
*
|
|
57
|
-
* match("src/index.ts", "src/**\/*.ts"); // true
|
|
58
|
-
* match("src/index.ts", ["**\/*.js", "**\/*.ts"]); // true
|
|
59
|
-
* match("src/index.ts", "**\/*.js"); // false
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
43
|
+
* Tests whether a path matches one or more glob patterns.
|
|
44
|
+
*
|
|
45
|
+
* Powered by [`picomatch`](https://github.com/micromatch/picomatch) which is bundled into the built output so it does
|
|
46
|
+
* not appear as a runtime dependency of `@visulima/fs`.
|
|
47
|
+
*
|
|
48
|
+
* If you match many values against the same pattern, prefer {@link matcher} to compile the pattern once.
|
|
49
|
+
* @param value The path (or paths) to test.
|
|
50
|
+
* @param pattern A single glob or array of globs.
|
|
51
|
+
* @param options Optional picomatch options. See {@link MatchOptions}.
|
|
52
|
+
* @returns `true` if `value` matches any of `pattern`.
|
|
53
|
+
* @example
|
|
54
|
+
* ```javascript
|
|
55
|
+
* import { match } from "@visulima/fs";
|
|
56
|
+
*
|
|
57
|
+
* match("src/index.ts", "src/**\/*.ts"); // true
|
|
58
|
+
* match("src/index.ts", ["**\/*.js", "**\/*.ts"]); // true
|
|
59
|
+
* match("src/index.ts", "**\/*.js"); // false
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
62
|
declare const match: (value: string | string[], pattern: string | string[], options?: MatchOptions) => boolean;
|
|
63
63
|
/**
|
|
64
|
-
* Compiles a glob pattern into a reusable matcher function.
|
|
65
|
-
*
|
|
66
|
-
* Powered by [`picomatch`](https://github.com/micromatch/picomatch) which is bundled into the built output so it does
|
|
67
|
-
* not appear as a runtime dependency of `@visulima/fs`.
|
|
68
|
-
* @param pattern A single glob or array of globs.
|
|
69
|
-
* @param options Optional picomatch options. See {@link MatchOptions}.
|
|
70
|
-
* @returns A function that returns `true` when its argument matches the compiled pattern.
|
|
71
|
-
* @example
|
|
72
|
-
* ```javascript
|
|
73
|
-
* import { matcher } from "@visulima/fs";
|
|
74
|
-
*
|
|
75
|
-
* const isTs = matcher("**\/*.ts");
|
|
76
|
-
* ["a.ts", "b.js", "c.ts"].filter(isTs); // ["a.ts", "c.ts"]
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
64
|
+
* Compiles a glob pattern into a reusable matcher function.
|
|
65
|
+
*
|
|
66
|
+
* Powered by [`picomatch`](https://github.com/micromatch/picomatch) which is bundled into the built output so it does
|
|
67
|
+
* not appear as a runtime dependency of `@visulima/fs`.
|
|
68
|
+
* @param pattern A single glob or array of globs.
|
|
69
|
+
* @param options Optional picomatch options. See {@link MatchOptions}.
|
|
70
|
+
* @returns A function that returns `true` when its argument matches the compiled pattern.
|
|
71
|
+
* @example
|
|
72
|
+
* ```javascript
|
|
73
|
+
* import { matcher } from "@visulima/fs";
|
|
74
|
+
*
|
|
75
|
+
* const isTs = matcher("**\/*.ts");
|
|
76
|
+
* ["a.ts", "b.js", "c.ts"].filter(isTs); // ["a.ts", "c.ts"]
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
79
|
declare const matcher: (pattern: string | string[], options?: MatchOptions) => (value: string) => boolean;
|
|
80
80
|
export { MatchOptions, match, matcher };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"./walk-
|
|
1
|
+
import n from"./walk-BReeHTKb.js";const e=async(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for await(const t of n(r,s))o.push(t.path);return o};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./walkSync-
|
|
1
|
+
import t from"./walkSync-yHJUIJb9.js";const a=(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for(const n of t(r,s))o.push(n.path);return o};export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import j from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";let y;const h=e=>(y??=v(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,t]=s.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return s.getBuiltinModule(e)}return h(e)},{cp:g}=b("node:fs/promises"),w=async(e,r,t={})=>{c(e),c(r);const{dereference:a=!1,errorOnExist:f=!0,filter:m,overwrite:l=!0,preserveTimestamps:p=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(e),o=n(r);try{await g(_,o,{dereference:a,errorOnExist:f,filter:m,force:l,preserveTimestamps:p,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new j(`destination already exists, copy '${o}'`):i}};export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import j from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";let y;const h=e=>(y??=v(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[r,t]=s.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return s.getBuiltinModule(e)}return h(e)},{cpSync:g}=b("node:fs"),q=(e,r,t={})=>{c(e),c(r);const{dereference:a=!1,errorOnExist:f=!0,filter:l,overwrite:m=!0,preserveTimestamps:p=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(e),o=n(r);try{g(_,o,{dereference:a,errorOnExist:f,filter:l,force:m,preserveTimestamps:p,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new j(`destination already exists, copy '${o}'`):i}};export{q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as c}from"node:module";import{join as _}from"@visulima/path";import{toPath as l}from"@visulima/path/utils";import j from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as g}from"./build-rm-options-avnusYx-.js";let a;const u=e=>(a??=c(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return u(e)},{existsSync:f}=i("node:fs"),{mkdir:m,readdir:d,rm:p}=i("node:fs/promises"),w=async(e,o)=>{if(j(e),!f(e)){await m(e,{recursive:!0});return}const s=await d(e),t=g(o);for(const n of s)await p(_(l(e),n),t)};export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";import{join as p}from"@visulima/path";import{toPath as _}from"@visulima/path/utils";import l from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as j}from"./build-rm-options-avnusYx-.js";let n;const c=e=>(n??=t(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,s]=o.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return o.getBuiltinModule(e)}return c(e)},{existsSync:f,mkdirSync:m,readdirSync:a,rmSync:d}=u("node:fs"),v=(e,r)=>{if(l(e),!f(e)){m(e,{recursive:!0});return}const s=j(r);for(const i of a(e))d(p(_(e),i),s)};export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as n}from"node:module";import p from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as i}from"./get-file-info-type-DzWpohDB.js";let c;const a=r=>(c??=n(import.meta.url))(r),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return a(r)},{lstat:s,mkdir:d}=u("node:fs/promises"),m=async r=>{p(r);try{const e=await s(r);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await d(r,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const t=await s(r);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(t))}'`,{cause:e})}};export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as n}from"node:module";import f from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as i}from"./get-file-info-type-DzWpohDB.js";let c;const u=r=>(c??=n(import.meta.url))(r),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return u(r)},{lstatSync:s,mkdirSync:d}=a("node:fs"),g=r=>{f(r);try{const e=s(r);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{d(r,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const t=s(r);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(t))}'`,{cause:e})}};export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as i}from"node:module";import{dirname as f}from"@visulima/path";import{toPath as m}from"@visulima/path/utils";import l from"./assertValidFileOrDirectoryPath-BTlt945W.js";import u from"./ensureDir-BEiomfxz.js";import{g as d}from"./get-file-info-type-DzWpohDB.js";let s;const n=e=>(s??=i(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[r,o]=t.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return t.getBuiltinModule(e)}return n(e)},{lstat:c,writeFile:p}=a("node:fs/promises"),T=async e=>{l(e);try{const r=await c(e);if(!r.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(d(r))}'`)}catch(r){if(r.code==="ENOENT"){await u(f(m(e))),await p(e,new Uint8Array);return}throw r}};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as i}from"node:module";import{dirname as a}from"@visulima/path";import{toPath as l}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import u from"./ensureDirSync-B0w9WMwE.js";import{g as d}from"./get-file-info-type-DzWpohDB.js";let s;const n=e=>(s??=i(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,t]=o.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return o.getBuiltinModule(e)}return n(e)},{lstatSync:f,writeFileSync:p}=c("node:fs"),T=e=>{m(e);try{const r=f(e);if(!r.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(d(r))}'`)}catch(r){if(r.code==="ENOENT"){u(a(l(e))),p(e,new Uint8Array);return}throw r}};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as p}from"node:module";import{toNamespacedPath as n,dirname as h}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import g from"./ensureDir-BEiomfxz.js";import{d as j}from"./is-stats-identical-l1GRN4Qu.js";let u;const f=e=>(u??=p(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[t,o]=s.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return s.getBuiltinModule(e)}return f(e)},{lstat:a,link:_}=d("node:fs/promises"),R=async(e,t)=>{m(e),m(t),e=n(c(e)),t=n(c(t));let o;try{o=await a(t)}catch{}let i;try{i=await a(e)}catch(l){const r=l;throw r.message=r.message.replace("lstat","ensureLink"),r}o&&j(i,o)||(await g(h(t)),await _(e,t))};export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as p}from"node:module";import{toNamespacedPath as c,dirname as h}from"@visulima/path";import{toPath as a}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import g from"./ensureDirSync-B0w9WMwE.js";import{d as y}from"./is-stats-identical-l1GRN4Qu.js";let u;const f=e=>(u??=p(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,t]=s.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return s.getBuiltinModule(e)}return f(e)},{lstatSync:i,linkSync:_}=d("node:fs"),T=(e,o)=>{m(e),m(o),e=c(a(e)),o=c(a(o));let t;try{t=i(o)}catch{}let n;try{n=i(e)}catch(l){const r=l;throw r.message=r.message.replace("lstat","ensureLink"),r}t&&y(n,t)||(g(h(o)),_(e,o))};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as g}from"node:module";import{toNamespacedPath as m,dirname as P,resolve as S}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import q from"./ensureDir-BEiomfxz.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";import{d as x}from"./is-stats-identical-l1GRN4Qu.js";import{t as E}from"./resolve-symlink-target-CWrn0v4P.js";import h from"./AlreadyExistsError-DEb3UWja.js";let j;const b=i=>(j??=g(import.meta.url))(i),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=i=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,o]=t.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return t.getBuiltinModule(i)}return b(i)},{lstat:c,stat:f,symlink:k,readlink:v}=T("node:fs/promises"),R=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Y=async(i,e,o)=>{d(i),d(e);const r=E(i,e);e=m(p(e));try{if((await c(e)).isSymbolicLink()){const[s,n]=await Promise.all([f(r),f(e)]);if(x(s,n))return}}catch{}const w=await c(r),y=u(w);await q(P(e));let a=o??"file";o||(R?a="junction":a=y==="dir"?"dir":"file");try{await k(m(p(r)),e,a)}catch(s){if(s.code!=="EEXIST")throw s;const n=await c(e);if(!n.isSymbolicLink())throw new h(`A ${String(u(n))} already exists at the path: ${e}`);const _=await v(e),l=m(S(_));if(l!==r)throw new h(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}};export{Y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as j}from"node:module";import{toNamespacedPath as l,dirname as q,resolve as x}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import P from"./ensureDirSync-B0w9WMwE.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";import{d as y}from"./is-stats-identical-l1GRN4Qu.js";import{t as E}from"./resolve-symlink-target-CWrn0v4P.js";import _ from"./AlreadyExistsError-DEb3UWja.js";let w;const b=o=>(w??=j(import.meta.url))(o),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=o=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,r]=i.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return i.getBuiltinModule(o)}return b(o)},{lstatSync:m,statSync:c,symlinkSync:k,readlinkSync:v}=T("node:fs"),R=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Y=(o,e,r)=>{d(o),d(e);const t=E(o,e);e=l(p(e));try{if(m(e).isSymbolicLink()&&y(c(t),c(e))){const s=c(t),n=c(e);if(y(s,n))return}}catch{}const h=m(t),g=u(h);P(q(e));let a=r??"file";r||(R?a="junction":a=g==="dir"?"dir":"file");try{k(l(p(t)),e,a)}catch(s){if(s.code!=="EEXIST")throw s;const n=m(e);if(!n.isSymbolicLink())throw new _(`A ${String(u(n))} already exists at the path: ${e}`);const S=v(e),f=l(x(S));if(f!==t)throw new _(`A symlink targeting to an undesired path already exists: ${e} -> ${f}`)}};export{Y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as g}from"node:module";import{resolve as c,parse as T,isAbsolute as v,dirname as q}from"@visulima/path";import{toPath as f}from"@visulima/path/utils";import{FIND_UP_STOP as B}from"./FIND_UP_STOP-CAwY1qU7.js";let w;const h=t=>(w??=g(import.meta.url))(t),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,i]=s.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return s.getBuiltinModule(t)}return h(t)},{stat:b,lstat:j}=A("node:fs/promises"),D=async(t,o={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const i=o.cwd?f(o.cwd):process.cwd();let r=c(i);const{root:a}=T(r),y=f(o.stopAt??a),m=c(r,y),u=o.type??"file",d=async function(n){return typeof t=="function"?[await t(n)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};o.allowSymlinks??=!0;const _=o.allowSymlinks?b:j;for(;r&&r!==m&&r!==a;){const n=await d(r);for(let e of n){if(e===B)return;if(e===void 0)continue;Buffer.isBuffer(e)?e=e.toString():e instanceof URL&&(e=f(e));const l=v(e)?e:c(r,e);try{const p=await _(l);if(u==="file"&&p.isFile()||u==="directory"&&p.isDirectory())return l}catch{}}r=q(r)}};export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as _}from"node:module";import{resolve as i,parse as A,isAbsolute as S,dirname as T}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import{FIND_UP_STOP as v}from"./FIND_UP_STOP-CAwY1qU7.js";let g;const h=e=>(g??=_(import.meta.url))(e),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,n]=s.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return s.getBuiltinModule(e)}return h(e)},{statSync:b,lstatSync:j}=w("node:fs"),F=(e,o={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const n=o.cwd?c(o.cwd):process.cwd();let r=i(n);const{root:f}=A(r),p=c(o.stopAt??f),y=i(r,p),u=o.type??"file",d=function(t){return typeof e=="function"?[e(t)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]};o.allowSymlinks??=!0;const m=o.allowSymlinks?b:j;for(;r&&r!==y&&r!==f;){for(let t of d(r)){if(t===v)return;if(t===void 0)continue;Buffer.isBuffer(t)?t=t.toString():t instanceof URL&&(t=c(t));const a=S(t)?t:i(r,t);try{const l=m(a);if(u==="file"&&l.isFile()||u==="directory"&&l.isDirectory())return a}catch{}}r=T(r)}};export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o}from"./index-CPZbuHkp.js";const i=async(a,t)=>await o(a,t);export{i as default};
|