@visulima/fs 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +38 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -5
- package/dist/index.d.ts +30 -5
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/{types-h2Rhl-Md.d.cts → types-HVB0D8On.d.cts} +8 -4
- package/dist/{types-h2Rhl-Md.d.ts → types-HVB0D8On.d.ts} +8 -4
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +16 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { W as WalkOptions, E as EmptyDirOptions, M as Match, F as FindUpOptions, R as ReadFileOptions, C as ContentType, a as ReadJsonOptions, J as JsonReviver, b as
|
|
2
|
-
export {
|
|
1
|
+
import { W as WalkOptions, E as EmptyDirOptions, M as Match, F as FindUpOptions, R as ReadFileOptions, C as ContentType, a as ReadJsonOptions, J as JsonReviver, b as ReadYamlOptions, Y as YamlReviver, c as WalkEntry, d as WriteFileOptions, e as WriteJsonOptions, f as YamlReplacer } from './types-HVB0D8On.cjs';
|
|
2
|
+
export { k as CodeFrameLocation, h as FIND_UP_STOP, g as F_OK, l as JsonReplacer, i as R_OK, m as ReadFileEncoding, j as W_OK, X as X_OK } from './types-HVB0D8On.cjs';
|
|
3
3
|
import { JsonValue } from 'type-fest';
|
|
4
|
+
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
|
|
4
5
|
import 'node:fs';
|
|
5
6
|
|
|
6
7
|
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
|
|
@@ -25,9 +26,9 @@ declare function isAccessible(path: URL | string, mode?: number): Promise<boolea
|
|
|
25
26
|
|
|
26
27
|
declare function isAccessibleSync(path: URL | string, mode?: number): boolean;
|
|
27
28
|
|
|
28
|
-
declare const readFile: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O
|
|
29
|
+
declare const readFile: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O>>;
|
|
29
30
|
|
|
30
|
-
declare const readFileSync: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O
|
|
31
|
+
declare const readFileSync: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O>;
|
|
31
32
|
|
|
32
33
|
declare function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;
|
|
33
34
|
declare function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;
|
|
@@ -35,6 +36,22 @@ declare function readJson<T extends JsonValue>(path: URL | string, reviver: Json
|
|
|
35
36
|
declare function readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;
|
|
36
37
|
declare function readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;
|
|
37
38
|
|
|
39
|
+
declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
40
|
+
declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
41
|
+
|
|
42
|
+
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
43
|
+
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
44
|
+
|
|
45
|
+
declare const remove: (path: URL | string, options?: {
|
|
46
|
+
maxRetries?: number | undefined;
|
|
47
|
+
retryDelay?: number | undefined;
|
|
48
|
+
}) => Promise<void>;
|
|
49
|
+
|
|
50
|
+
declare const removeSync: (path: URL | string, options?: {
|
|
51
|
+
maxRetries?: number | undefined;
|
|
52
|
+
retryDelay?: number | undefined;
|
|
53
|
+
}) => void;
|
|
54
|
+
|
|
38
55
|
declare function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
39
56
|
|
|
40
57
|
declare function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
|
|
@@ -47,4 +64,12 @@ declare const writeJson: (path: URL | string, data: unknown, options?: WriteJson
|
|
|
47
64
|
|
|
48
65
|
declare const writeJsonSync: (path: URL | string, data: unknown, options?: WriteJsonOptions) => void;
|
|
49
66
|
|
|
50
|
-
|
|
67
|
+
type Options$1 = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
|
|
68
|
+
declare function writeYaml(path: URL | string, data: any, options?: Options$1): Promise<void>;
|
|
69
|
+
declare function writeYaml(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options$1 | number | string): Promise<void>;
|
|
70
|
+
|
|
71
|
+
type Options = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
|
|
72
|
+
declare function writeYamlSync(path: URL | string, data: any, options?: Options): void;
|
|
73
|
+
declare function writeYamlSync(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options | number | string): void;
|
|
74
|
+
|
|
75
|
+
export { CRLF, EOL, EmptyDirOptions, FindUpOptions, JsonReviver, LF, ReadFileOptions, ReadJsonOptions, WalkEntry, WalkOptions, WriteFileOptions, WriteJsonOptions, YamlReplacer, collect, collectSync, detect, emptyDir$1 as emptyDir, emptyDir as emptyDirSync, findUp, findUpSync, format, isAccessible, isAccessibleSync, readFile, readFileSync, readJson, readJsonSync, readYaml, readYamlSync, remove, removeSync, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync, writeYaml, writeYamlSync };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { W as WalkOptions, E as EmptyDirOptions, M as Match, F as FindUpOptions, R as ReadFileOptions, C as ContentType, a as ReadJsonOptions, J as JsonReviver, b as
|
|
2
|
-
export {
|
|
1
|
+
import { W as WalkOptions, E as EmptyDirOptions, M as Match, F as FindUpOptions, R as ReadFileOptions, C as ContentType, a as ReadJsonOptions, J as JsonReviver, b as ReadYamlOptions, Y as YamlReviver, c as WalkEntry, d as WriteFileOptions, e as WriteJsonOptions, f as YamlReplacer } from './types-HVB0D8On.js';
|
|
2
|
+
export { k as CodeFrameLocation, h as FIND_UP_STOP, g as F_OK, l as JsonReplacer, i as R_OK, m as ReadFileEncoding, j as W_OK, X as X_OK } from './types-HVB0D8On.js';
|
|
3
3
|
import { JsonValue } from 'type-fest';
|
|
4
|
+
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
|
|
4
5
|
import 'node:fs';
|
|
5
6
|
|
|
6
7
|
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
|
|
@@ -25,9 +26,9 @@ declare function isAccessible(path: URL | string, mode?: number): Promise<boolea
|
|
|
25
26
|
|
|
26
27
|
declare function isAccessibleSync(path: URL | string, mode?: number): boolean;
|
|
27
28
|
|
|
28
|
-
declare const readFile: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O
|
|
29
|
+
declare const readFile: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O>>;
|
|
29
30
|
|
|
30
|
-
declare const readFileSync: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O
|
|
31
|
+
declare const readFileSync: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O>;
|
|
31
32
|
|
|
32
33
|
declare function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;
|
|
33
34
|
declare function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;
|
|
@@ -35,6 +36,22 @@ declare function readJson<T extends JsonValue>(path: URL | string, reviver: Json
|
|
|
35
36
|
declare function readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;
|
|
36
37
|
declare function readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;
|
|
37
38
|
|
|
39
|
+
declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
40
|
+
declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
41
|
+
|
|
42
|
+
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
43
|
+
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
44
|
+
|
|
45
|
+
declare const remove: (path: URL | string, options?: {
|
|
46
|
+
maxRetries?: number | undefined;
|
|
47
|
+
retryDelay?: number | undefined;
|
|
48
|
+
}) => Promise<void>;
|
|
49
|
+
|
|
50
|
+
declare const removeSync: (path: URL | string, options?: {
|
|
51
|
+
maxRetries?: number | undefined;
|
|
52
|
+
retryDelay?: number | undefined;
|
|
53
|
+
}) => void;
|
|
54
|
+
|
|
38
55
|
declare function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
39
56
|
|
|
40
57
|
declare function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
|
|
@@ -47,4 +64,12 @@ declare const writeJson: (path: URL | string, data: unknown, options?: WriteJson
|
|
|
47
64
|
|
|
48
65
|
declare const writeJsonSync: (path: URL | string, data: unknown, options?: WriteJsonOptions) => void;
|
|
49
66
|
|
|
50
|
-
|
|
67
|
+
type Options$1 = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
|
|
68
|
+
declare function writeYaml(path: URL | string, data: any, options?: Options$1): Promise<void>;
|
|
69
|
+
declare function writeYaml(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options$1 | number | string): Promise<void>;
|
|
70
|
+
|
|
71
|
+
type Options = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
|
|
72
|
+
declare function writeYamlSync(path: URL | string, data: any, options?: Options): void;
|
|
73
|
+
declare function writeYamlSync(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options | number | string): void;
|
|
74
|
+
|
|
75
|
+
export { CRLF, EOL, EmptyDirOptions, FindUpOptions, JsonReviver, LF, ReadFileOptions, ReadJsonOptions, WalkEntry, WalkOptions, WriteFileOptions, WriteJsonOptions, YamlReplacer, collect, collectSync, detect, emptyDir$1 as emptyDir, emptyDir as emptyDirSync, findUp, findUpSync, format, isAccessible, isAccessibleSync, readFile, readFileSync, readJson, readJsonSync, readYaml, readYamlSync, remove, removeSync, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync, writeYaml, writeYamlSync };
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { a as a$1, b
|
|
2
|
-
import { a, b as b$
|
|
1
|
+
import { a as a$1, b } from './chunk-3EHZOWRU.js';
|
|
2
|
+
import { a, b as b$1 } from './chunk-4WZBYISP.js';
|
|
3
3
|
import './chunk-UPN3Y5W3.js';
|
|
4
|
-
import { readdir, realpath, stat, mkdir, rm, access, readFile, writeFile, rename, chown, chmod
|
|
4
|
+
import { readdir, realpath, stat, mkdir, rm, access, readFile, unlink, writeFile, rename, chown, chmod } from 'node:fs/promises';
|
|
5
5
|
import { resolve, join, normalize, basename, parse, isAbsolute, dirname } from 'node:path';
|
|
6
|
-
import { readdirSync, realpathSync, statSync, existsSync, mkdirSync, rmSync, accessSync, readFileSync, writeFileSync, renameSync, chownSync, chmodSync
|
|
6
|
+
import { readdirSync, realpathSync, statSync, existsSync, mkdirSync, rmSync, accessSync, readFileSync, unlinkSync, writeFileSync, renameSync, chownSync, chmodSync } from 'node:fs';
|
|
7
7
|
import { platform } from 'node:process';
|
|
8
8
|
import { brotliDecompress, unzip, brotliDecompressSync, unzipSync } from 'node:zlib';
|
|
9
|
+
import { parse as parse$1, stringify } from 'yaml';
|
|
9
10
|
|
|
10
|
-
var
|
|
11
|
-
`,
|
|
12
|
-
`,
|
|
13
|
-
`;if(await O(e,4))try{let
|
|
11
|
+
var Q=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},y=Q;var Z=e=>{let t=e.replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,"\\.").replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");return new RegExp(`^${t}$`)},h=Z;var ee=(e,t,r,o)=>t&&!t.some(n=>e.endsWith(n))||r&&!r.some(n=>n.test(e))?!1:!(o&&o.some(n=>n.test(e))),w=ee;var fe=async e=>{let t=normalize(e),r=basename(t),o=await stat(t);return {isDirectory:o.isDirectory,isFile:o.isFile,isSymbolicLink:o.isSymbolicLink,name:r,path:t}};async function*x(e,{extensions:t,followSymlinks:r=!1,includeDirs:o=!0,includeFiles:n=!0,includeSymlinks:s=!0,match:a$2,maxDepth:c=Number.POSITIVE_INFINITY,skip:u}={}){if(y(e),c<0)return;let f=a$2?a$2.map(i=>typeof i=="string"?h(i):i):void 0,l=u?u.map(i=>typeof i=="string"?h(i):i):void 0;if(e=resolve(a(e)),o&&w(e,t,f,l)&&(yield await fe(e)),!(c<1||!w(e,void 0,void 0,l)))try{for await(let i of await readdir(e,{withFileTypes:!0})){let g=join(e,i.name);if(i.isSymbolicLink())if(r)g=await realpath(g);else if(s&&w(g,t,f,l))yield {isDirectory:i.isDirectory,isFile:i.isFile,isSymbolicLink:i.isSymbolicLink,name:i.name,path:g};else continue;i.isSymbolicLink()||i.isDirectory()?yield*x(g,{extensions:t,followSymlinks:r,includeDirs:o,includeFiles:n,includeSymlinks:s,match:f,maxDepth:c-1,skip:l}):i.isFile()&&n&&w(g,t,f,l)&&(yield {isDirectory:i.isDirectory,isFile:i.isFile,isSymbolicLink:i.isSymbolicLink,name:i.name,path:g});}}catch(i){throw i instanceof a$1?i:new a$1(i,e)}}var ce=async(e,t={})=>{let r={extensions:["js","mjs","cjs","ts"],...t},o=[];for await(let n of x(e,r))o.push(n.path);return o},me=ce;var Oe=e=>{let t=normalize(e),r=basename(t),o=statSync(t);return {isDirectory:o.isDirectory,isFile:o.isFile,isSymbolicLink:o.isSymbolicLink,name:r,path:t}};function*P(e,{extensions:t,followSymlinks:r=!1,includeDirs:o=!0,includeFiles:n=!0,includeSymlinks:s=!0,match:a$2,maxDepth:c=Number.POSITIVE_INFINITY,skip:u}={}){if(y(e),c<0)return;let f=a$2?a$2.map(i=>typeof i=="string"?h(i):i):void 0,l=u?u.map(i=>typeof i=="string"?h(i):i):void 0;if(e=resolve(a(e)),o&&w(e,t,f,l)&&(yield Oe(e)),!(c<1||!w(e,void 0,void 0,l)))try{for(let i of readdirSync(e,{withFileTypes:!0})){let g=join(e,i.name);if(i.isSymbolicLink())if(r)g=realpathSync(g);else if(s&&w(g,t,f,l))yield {isDirectory:i.isDirectory,isFile:i.isFile,isSymbolicLink:i.isSymbolicLink,name:i.name,path:g};else continue;i.isSymbolicLink()||i.isDirectory()?yield*P(g,{extensions:t,followSymlinks:r,includeDirs:o,includeFiles:n,includeSymlinks:s,match:f,maxDepth:c-1,skip:l}):i.isFile()&&n&&w(g,t,f,l)&&(yield {isDirectory:i.isDirectory,isFile:i.isFile,isSymbolicLink:i.isSymbolicLink,name:i.name,path:g});}}catch(i){throw i instanceof a$1?i:new a$1(i,e)}}var Re=(e,t={})=>{let r={extensions:["js","mjs","cjs","ts"],...t},o=[];for(let n of P(e,r))o.push(n.path);return o},Se=Re;var S=0,k=4,be=2,he=1,D=Symbol("findUpStop");var ve=async(e,t)=>{if(y(e),!existsSync(e)){await mkdir(e,{recursive:!0});return}for await(let r of await readdir(e))await rm(join(a(e),r),{...t,force:!0,recursive:!0});},Te=ve;var Ye=(e,t)=>{if(y(e),!existsSync(e)){mkdirSync(e,{recursive:!0});return}for(let r of readdirSync(e))rmSync(join(a(e),r),{...t,force:!0,recursive:!0});},We=Ye;var C=/\r?\n/g,N=`
|
|
12
|
+
`,W=`\r
|
|
13
|
+
`,_e=platform==="win32"?W:N,Ne=e=>{let t=e.match(C);if(!t||t.length===0)return null;let r=t.filter(n=>n===W).length,o=t.length-r;return r>o?W:N},Ve=(e,t)=>e.replaceAll(C,t);var Me=async(e,t={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");let r=t.cwd?a(t.cwd):process.cwd();y(r);let o=resolve(r),{root:n}=parse(o),s=a(t.stopAt??n);y(s);let a$1=resolve(o,s),c=t.type??"file",u=async function(f){return typeof e=="function"?[await e(f)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]};for(;o&&o!==a$1&&o!==n;){for await(let f of await u(o)){if(f===D)return;if(f===void 0)continue;let l=isAbsolute(f)?f:resolve(o,f);try{let i=await stat(l);if(c==="file"&&i.isFile()||c==="directory"&&i.isDirectory())return l}catch{}}o=dirname(o);}},Be=Me;var qe=(e,t={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");let r=t.cwd?a(t.cwd):process.cwd();y(r);let o=resolve(r),{root:n}=parse(o),s=a(t.stopAt??n);y(s);let a$1=resolve(o,s),c=t.type??"file",u=function(f){return typeof e=="function"?[e(f)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]};for(;o&&o!==a$1&&o!==n;){for(let f of u(o)){if(f===D)return;if(f===void 0)continue;let l=isAbsolute(f)?f:resolve(o,f);try{let i=statSync(l);if(c==="file"&&i.isFile()||c==="directory"&&i.isDirectory())return l}catch{}}o=dirname(o);}},Qe=qe;async function et(e,t=0){y(e),e=a(e);try{return await access(e,t),!0}catch{return !1}}var O=et;function rt(e,t=0){y(e),e=a(e);try{return accessSync(e,t),!0}catch{return !1}}var R=rt;var st={brotli:brotliDecompress,gzip:unzip,none:(e,t)=>{t(null,e);}},at=async(e,t)=>{if(y(e),e=a(e),!await O(e))throw new b(`unable to read the non-accessible file: ${e}`);if(!await O(e,4))throw new Error(`Unable to read the non-readable file: ${e}`);let{buffer:r,compression:o,encoding:n,flag:s}=t??{};return await readFile(e,s?{encoding:n,flag:s}:{encoding:n}).then(async a=>await new Promise((c,u)=>{st[o??"none"](a,(f,l)=>{f?u(f):c(r?l:l.toString());});})).catch(a=>{throw a})},v=at;var pt={brotli:brotliDecompressSync,gzip:unzipSync,none:e=>e},lt=(e,t)=>{if(y(e),e=a(e),!R(e))throw new b(`unable to read the non-accessible file: ${e}`);if(!R(e,4))throw new b(`invalid access to read file at: ${e}`);let{buffer:r,compression:o,encoding:n,flag:s}=t??{},a$1=readFileSync(e,s?{encoding:n,flag:s}:{encoding:n}),c=pt[o??"none"](a$1);return r?c:c.toString()},T=lt;async function dt(e,t,r){typeof t=="object"&&(r=t,t=void 0);let o=await v(e,{buffer:!0,encoding:void 0}),n=new TextDecoder().decode(o),{beforeParse:s,color:a$1}=r??{};return typeof s=="function"&&(n=s(n)),b$1(n,t,a(e),{color:a$1})}var yt=dt;function ut(e,t,r){typeof t=="object"&&(r=t,t=void 0);let o=T(e,{buffer:!0,encoding:void 0}),n=new TextDecoder().decode(o),{beforeParse:s,color:a$1}=r??{};return typeof s=="function"&&(n=s(n)),b$1(n,t,a(e),{color:a$1})}var gt=ut;async function wt(e,t,r){let{buffer:o,compression:n,encoding:s="utf8",flag:a,...c}=r??{},u=await v(e,{buffer:o,compression:n,encoding:s,flag:a});return typeof t=="function"?parse$1(u,t,c):parse$1(u,c)}var Ot=wt;function Rt(e,t,r){let{buffer:o,compression:n,encoding:s="utf8",flag:a,...c}=r??{},u=T(e,{buffer:o,compression:n,encoding:s,flag:a});return typeof t=="function"?parse$1(u,t,c):parse$1(u,c)}var St=Rt;var Ft=async(e,t={})=>{y(e);try{await unlink(e);}catch{}try{await rm(e,{force:!0,maxRetries:t?.maxRetries,recursive:!0,retryDelay:t?.retryDelay});}catch{}},xt=Ft;var Dt=(e,t={})=>{y(e);try{unlinkSync(e);}catch{}try{rmSync(e,{force:!0,maxRetries:t?.maxRetries,recursive:!0,retryDelay:t?.retryDelay});}catch{}},vt=Dt;var Tt=e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},I=Tt;var Et=new TextEncoder,Lt=e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return Et.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},_=Lt;var Nt=async(e,t,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},y(e),I(t),e=a(e);try{let o=await O(e,0);if(!o&&r.recursive){let a=dirname(e);await O(a,0)||await mkdir(a,{recursive:!0});}let n;await writeFile(`${e}.tmp`,_(t),{encoding:r.encoding,flag:r.flag}),o&&!r.overwrite&&(n=await stat(e),r.chown===void 0&&(r.chown={gid:n.gid,uid:n.uid}),await rename(e,`${e}.bak`));let s=`${e}.tmp`;if(r.chown)try{await chown(s,r.chown.uid,r.chown.gid);}catch{}await chmod(s,n&&!r.mode?n.mode:r.mode??438),await rename(s,e);}catch(o){throw new Error(`Failed to write file at: ${e} - ${o.message}`,{cause:o})}finally{await O(`${e}.tmp`)&&await unlink(`${e}.tmp`);}},E=Nt;var jt=(e,t,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},y(e),I(t),e=a(e);try{let o=R(e,0);if(!o&&r.recursive){let a=dirname(e);R(a,0)||mkdirSync(a,{recursive:!0});}let n;writeFileSync(`${e}.tmp`,_(t),{encoding:r.encoding,flag:r.flag}),o&&!r.overwrite&&(n=statSync(e),r.chown===void 0&&(r.chown={gid:n.gid,uid:n.uid}),renameSync(e,`${e}.bak`));let s=`${e}.tmp`;if(r.chown)try{chownSync(s,r.chown.uid,r.chown.gid);}catch{}chmodSync(s,n&&!r.mode?n.mode:r.mode??438),renameSync(s,e);}catch(o){throw new Error(`Failed to write file at: ${e} - ${o.message}`,{cause:o})}finally{R(`${e}.tmp`)&&unlinkSync(`${e}.tmp`);}},L=jt;var Xt=/^(?:( )+|\t+)/,U="space",X="tab";function j(e,t){let r=new Map,o=0,n,s;for(let a of e.split(/\n/g)){if(!a)continue;let c,u,f,l,i,g=a.match(Xt);if(g===null)o=0,n="";else {if(c=g[0].length,u=g[1]?U:X,t&&u===U&&c===1)continue;u!==n&&(o=0),n=u,f=1,l=0;let J=c-o;if(o=c,J===0)f=0,l=1;else {let q=J>0?J:-J;s=Ht(u,q);}i=r.get(s),i=i===void 0?[1,0]:[i[0]+f,i[1]+l],r.set(s,i);}}return r}function Ht(e,t){return (e===U?"s":"t")+String(t)}function Gt(e){let r=e[0]==="s"?U:X,o=Number(e.slice(1));return {type:r,amount:o}}function qt(e){let t,r=0,o=0;for(let[n,[s,a]]of e)(s>r||s===r&&a>o)&&(r=s,o=a,t=n);return t}function Qt(e,t){return (e===U?" ":" ").repeat(t)}function A(e){if(typeof e!="string")throw new TypeError("Expected a string");let t=j(e,!0);t.size===0&&(t=j(e,!1));let r=qt(t),o,n=0,s="";return r!==void 0&&({type:o,amount:n}=Gt(r),s=Qt(o,n)),{amount:n,type:o,indent:s}}var er=async(e,t,r={})=>{let{detectIndent:o,indent:n,replacer:s,stringify:a=JSON.stringify,...c}={indent:" ",...r},u=n,f=`
|
|
14
|
+
`;if(await O(e,4))try{let i=await readFile(e,"utf8");if(o){let{indent:g}=A(i);u=g;}f=i.endsWith(`
|
|
14
15
|
`)?`
|
|
15
|
-
`:"";}catch(
|
|
16
|
-
`;if(
|
|
16
|
+
`:"";}catch(i){if(i.code!=="ENOENT")throw i}let l=a(t,s,u);await E(e,`${l}${f}`,c);},tr=er;var or=(e,t,r={})=>{let{detectIndent:o,indent:n,replacer:s,stringify:a=JSON.stringify,...c}={indent:" ",...r},u=n,f=`
|
|
17
|
+
`;if(R(e,4))try{let i=readFileSync(e,"utf8");if(o){let{indent:g}=A(i);u=g;}f=i.endsWith(`
|
|
17
18
|
`)?`
|
|
18
|
-
`:"";}catch(
|
|
19
|
+
`:"";}catch(i){if(i.code!=="ENOENT")throw i}let l=a(t,s,u);L(e,`${l}${f}`,c);},ir=or;async function nr(e,t,r,o){let n=typeof r=="function"||Array.isArray(r)?stringify(t,r,o):stringify(t,r);await E(e,n);}var sr=nr;function ar(e,t,r,o){let n=typeof r=="function"||Array.isArray(r)?stringify(t,r,o):stringify(t,r);L(e,n);}var fr=ar;
|
|
19
20
|
|
|
20
|
-
export {
|
|
21
|
+
export { W as CRLF, _e as EOL, D as FIND_UP_STOP, S as F_OK, N as LF, k as R_OK, be as W_OK, he as X_OK, me as collect, Se as collectSync, Ne as detect, Te as emptyDir, We as emptyDirSync, Be as findUp, Qe as findUpSync, Ve as format, O as isAccessible, R as isAccessibleSync, v as readFile, T as readFileSync, yt as readJson, gt as readJsonSync, Ot as readYaml, St as readYamlSync, xt as remove, vt as removeSync, x as walk, P as walkSync, E as writeFile, L as writeFileSync, tr as writeJson, ir as writeJsonSync, sr as writeYaml, fr as writeYamlSync };
|
|
21
22
|
//# sourceMappingURL=out.js.map
|
|
22
23
|
//# sourceMappingURL=index.js.map
|