@visulima/fs 1.11.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/chunk-2B2JUVOG.cjs +18 -0
- package/dist/chunk-2B2JUVOG.cjs.map +1 -0
- package/dist/chunk-DXCWJAJU.js +13 -0
- package/dist/chunk-DXCWJAJU.js.map +1 -0
- package/dist/chunk-JSJNX53G.cjs +8 -0
- package/dist/chunk-JSJNX53G.cjs.map +1 -0
- package/dist/chunk-X5PFFPHW.js +5 -0
- package/dist/chunk-X5PFFPHW.js.map +1 -0
- package/dist/error.cjs +7 -7
- package/dist/error.cjs.map +1 -1
- package/dist/error.d.cts +22 -10
- package/dist/error.d.ts +22 -10
- package/dist/error.js +3 -3
- package/dist/error.js.map +1 -1
- package/dist/index.cjs +42 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/{types-HVB0D8On.d.cts → types-BtNfXx_X.d.cts} +1 -1
- package/dist/{types-HVB0D8On.d.ts → types-BtNfXx_X.d.ts} +1 -1
- package/dist/utils.cjs +13 -5
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +6 -2
- package/dist/utils.d.ts +6 -2
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-3EHZOWRU.js +0 -5
- package/dist/chunk-3EHZOWRU.js.map +0 -1
- package/dist/chunk-4WZBYISP.js +0 -13
- package/dist/chunk-4WZBYISP.js.map +0 -1
- package/dist/chunk-KXYI7M76.cjs +0 -8
- package/dist/chunk-KXYI7M76.cjs.map +0 -1
- package/dist/chunk-QHWRBSYR.cjs +0 -16
- package/dist/chunk-QHWRBSYR.cjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { W as WalkOptions,
|
|
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-
|
|
1
|
+
import { W as WalkOptions, M as Match, F as FindUpOptions, a as WalkEntry, R as ReadFileOptions, C as ContentType, b as ReadJsonOptions, J as JsonReviver, c as ReadYamlOptions, Y as YamlReviver, E as EmptyDirOptions, d as WriteFileOptions, e as WriteJsonOptions, f as YamlReplacer } from './types-BtNfXx_X.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-BtNfXx_X.js';
|
|
3
3
|
import { JsonValue } from 'type-fest';
|
|
4
4
|
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
|
|
7
|
-
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
|
|
8
|
-
|
|
9
|
-
declare const collectSync: (directory: string, options?: WalkOptions) => string[];
|
|
10
|
-
|
|
11
|
-
declare const emptyDir$1: (dir: URL | string, options?: EmptyDirOptions) => Promise<void>;
|
|
12
|
-
|
|
13
|
-
declare const emptyDir: (dir: URL | string, options?: EmptyDirOptions) => void;
|
|
14
|
-
|
|
15
7
|
declare const ensureDir: (directory: URL | string) => Promise<void>;
|
|
16
8
|
|
|
17
9
|
declare const ensureDirSync: (directory: URL | string) => void;
|
|
@@ -30,10 +22,18 @@ declare const EOL: "\n" | "\r\n";
|
|
|
30
22
|
declare const detect: (content: string) => typeof EOL | null;
|
|
31
23
|
declare const format: (content: string, eol: typeof EOL) => string;
|
|
32
24
|
|
|
25
|
+
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
|
|
26
|
+
|
|
27
|
+
declare const collectSync: (directory: string, options?: WalkOptions) => string[];
|
|
28
|
+
|
|
33
29
|
declare const findUp: (name: string | string[] | readonly string[] | ((directory: string) => Match | Promise<Match>), options?: FindUpOptions) => Promise<string | undefined>;
|
|
34
30
|
|
|
35
31
|
declare const findUpSync: (name: string | string[] | readonly string[] | ((directory: string) => Match), options?: FindUpOptions) => string | undefined;
|
|
36
32
|
|
|
33
|
+
declare function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
34
|
+
|
|
35
|
+
declare function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
|
|
36
|
+
|
|
37
37
|
declare function isAccessible(path: URL | string, mode?: number): Promise<boolean>;
|
|
38
38
|
|
|
39
39
|
declare function isAccessibleSync(path: URL | string, mode?: number): boolean;
|
|
@@ -54,6 +54,10 @@ declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviv
|
|
|
54
54
|
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
55
55
|
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
56
56
|
|
|
57
|
+
declare const emptyDir$1: (dir: URL | string, options?: EmptyDirOptions) => Promise<void>;
|
|
58
|
+
|
|
59
|
+
declare const emptyDir: (dir: URL | string, options?: EmptyDirOptions) => void;
|
|
60
|
+
|
|
57
61
|
declare const remove: (path: URL | string, options?: {
|
|
58
62
|
maxRetries?: number | undefined;
|
|
59
63
|
retryDelay?: number | undefined;
|
|
@@ -64,10 +68,6 @@ declare const removeSync: (path: URL | string, options?: {
|
|
|
64
68
|
retryDelay?: number | undefined;
|
|
65
69
|
}) => void;
|
|
66
70
|
|
|
67
|
-
declare function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
68
|
-
|
|
69
|
-
declare function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
|
|
70
|
-
|
|
71
71
|
declare const writeFile: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => Promise<void>;
|
|
72
72
|
|
|
73
73
|
declare const writeFileSync: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { a as a$
|
|
2
|
-
import { a
|
|
1
|
+
import { a as a$1, b as b$1 } from './chunk-X5PFFPHW.js';
|
|
2
|
+
import { a, b, c, d } from './chunk-DXCWJAJU.js';
|
|
3
3
|
import './chunk-UPN3Y5W3.js';
|
|
4
|
-
import { readdir, realpath,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { readdir, realpath, lstat, mkdir, writeFile, link, stat, access, readFile, rm, unlink, rename, chown, chmod } from 'node:fs/promises';
|
|
5
|
+
import { readdirSync, realpathSync, lstatSync, mkdirSync, writeFileSync, linkSync, statSync, accessSync, readFileSync, existsSync, rmSync, unlinkSync, renameSync, chownSync, chmodSync } from 'node:fs';
|
|
6
|
+
import { resolve, join, normalize, dirname, basename, isAbsolute } from 'pathe';
|
|
7
7
|
import { platform } from 'node:process';
|
|
8
|
+
import { parse } from 'node:path';
|
|
8
9
|
import { brotliDecompress, unzip, brotliDecompressSync, unzipSync } from 'node:zlib';
|
|
9
10
|
import { parse as parse$1, stringify } from 'yaml';
|
|
10
11
|
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
`,
|
|
14
|
-
`;if(await R(t,4))try{let n=await readFile(t,"utf8");if(o){let{indent:g}=Y(n);u=g;}
|
|
12
|
+
var h=0,P=4,at=2,ft=1,k=Symbol("findUpStop");var w=t=>{if(t.isFile())return "file";if(t.isDirectory())return "dir";if(t.isSymbolicLink())return "symlink"};var mt=async t=>{a(t);try{let e=await lstat(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${w(e)}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await mkdir(t,{recursive:!0});}catch(e){if(e.code!=="EEXIST")throw e;let r=await lstat(t);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${w(r)}'`)}},E=mt;var lt=t=>{a(t);try{let e=lstatSync(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${w(e)}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{mkdirSync(t,{recursive:!0});}catch(e){if(e.code!=="EEXIST")throw e;let r=lstatSync(t);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${w(r)}'`)}},D=lt;var gt=async t=>{a(t);try{let e=await lstat(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${w(e)}'`)}catch(e){if(e.code==="ENOENT"){await E(dirname(b(t))),await writeFile(t,new Uint8Array);return}throw e}},wt=gt;var ht=t=>{a(t);try{let e=lstatSync(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${w(e)}'`)}catch(e){if(e.code==="ENOENT"){D(dirname(b(t))),writeFileSync(t,new Uint8Array);return}throw e}},xt=ht;var Ft=(t,e)=>!!e.ino&&!!e.dev&&e.ino===t.ino&&e.dev===t.dev,V=Ft;var kt=async(t,e)=>{a(t),a(e);let r;try{r=await lstat(e);}catch{}let o;try{o=await lstat(t);}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}r&&V(o,r)||(await E(dirname(b(e))),await link(t,e));},Et=kt;var Tt=(t,e)=>{a(t),a(e);let r;try{r=lstatSync(e);}catch{}let o;try{o=lstatSync(t);}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}r&&V(o,r)||(D(dirname(b(e))),linkSync(t,e));},vt=Tt;var q=/\r?\n/g,z=`
|
|
13
|
+
`,$=`\r
|
|
14
|
+
`,It=platform==="win32"?$:z,At=t=>{let e=t.match(q);if(!e||e.length===0)return null;let r=e.filter(i=>i===$).length,o=e.length-r;return r>o?$:z},Jt=(t,e)=>t.replaceAll(q,e);var Yt=t=>{let e=t.replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,"\\.").replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");return new RegExp(`^${e}$`)},F=Yt;var Nt=(t,e,r,o)=>e&&!e.some(i=>t.endsWith(i))||r&&!r.some(i=>i.test(t))?!1:!(o&&o.some(i=>i.test(t))),O=Nt;var Mt=async t=>{let e=normalize(t),r=basename(e),o=await stat(e);return {isDirectory:o.isDirectory,isFile:o.isFile,isSymbolicLink:o.isSymbolicLink,name:r,path:e}};async function*L(t,{extensions:e,followSymlinks:r=!1,includeDirs:o=!0,includeFiles:i=!0,includeSymlinks:s=!0,match:a$2,maxDepth:d=Number.POSITIVE_INFINITY,skip:u}={}){if(a(t),d<0)return;let f=a$2?a$2.map(n=>typeof n=="string"?F(n):n):void 0,y=u?u.map(n=>typeof n=="string"?F(n):n):void 0;if(t=resolve(b(t)),o&&O(t,e,f,y)&&(yield await Mt(t)),!(d<1||!O(t,void 0,void 0,y)))try{for await(let n of await readdir(t,{withFileTypes:!0})){let g=join(t,n.name);if(n.isSymbolicLink())if(r)g=await realpath(g);else if(s&&O(g,e,f,y))yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:g};else continue;n.isSymbolicLink()||n.isDirectory()?yield*L(g,{extensions:e,followSymlinks:r,includeDirs:o,includeFiles:i,includeSymlinks:s,match:f,maxDepth:d-1,skip:y}):n.isFile()&&i&&O(g,e,f,y)&&(yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:g});}}catch(n){throw n instanceof a$1?n:new a$1(n,t)}}var jt=async(t,e={})=>{let r={extensions:["js","mjs","cjs","ts"],...e},o=[];for await(let i of L(t,r))o.push(i.path);return o},Bt=jt;var te=t=>{let e=normalize(t),r=statSync(e);return {isDirectory:r.isDirectory,isFile:r.isFile,isSymbolicLink:r.isSymbolicLink,name:basename(e),path:e}};function*T(t,{extensions:e,followSymlinks:r=!1,includeDirs:o=!0,includeFiles:i=!0,includeSymlinks:s=!0,match:a$2,maxDepth:d=Number.POSITIVE_INFINITY,skip:u}={}){if(a(t),d<0)return;let f=a$2?a$2.map(n=>typeof n=="string"?F(n):n):void 0,y=u?u.map(n=>typeof n=="string"?F(n):n):void 0;if(t=resolve(b(t)),o&&O(t,e,f,y)&&(yield te(t)),!(d<1||!O(t,void 0,void 0,y)))try{for(let n of readdirSync(t,{withFileTypes:!0})){let g=join(t,n.name);if(n.isSymbolicLink())if(r)g=realpathSync(g);else if(s&&O(g,e,f,y))yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:normalize(g)};else continue;n.isSymbolicLink()||n.isDirectory()?yield*T(g,{extensions:e,followSymlinks:r,includeDirs:o,includeFiles:i,includeSymlinks:s,match:f,maxDepth:d-1,skip:y}):n.isFile()&&i&&O(g,e,f,y)&&(yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:normalize(g)});}}catch(n){throw n instanceof a$1?n:new a$1(n,t)}}var ee=(t,e={})=>{let r={extensions:["js","mjs","cjs","ts"],...e},o=[];for(let i of T(t,r))o.push(i.path);return o},re=ee;var ae=async(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");let r=e.cwd?b(e.cwd):process.cwd(),o=resolve(r),{root:i}=parse(o),s=b(e.stopAt??i),a=resolve(o,s),d=e.type??"file",u=async function(f){return typeof t=="function"?[await t(f)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};for(;o&&o!==a&&o!==i;){for await(let f of await u(o)){if(f===k)return;if(f===void 0)continue;let y=isAbsolute(f)?f:resolve(o,f);try{let n=await stat(y);if(d==="file"&&n.isFile()||d==="directory"&&n.isDirectory())return y}catch{}}o=dirname(o);}},fe=ae;var de=(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");let r=e.cwd?b(e.cwd):process.cwd(),o=resolve(r),{root:i}=parse(o),s=b(e.stopAt??i),a=resolve(o,s),d=e.type??"file",u=function(f){return typeof t=="function"?[t(f)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};for(;o&&o!==a&&o!==i;){for(let f of u(o)){if(f===k)return;if(f===void 0)continue;let y=isAbsolute(f)?f:resolve(o,f);try{let n=statSync(y);if(d==="file"&&n.isFile()||d==="directory"&&n.isDirectory())return y}catch{}}o=dirname(o);}},ye=de;async function ge(t,e=0){a(t),t=b(t);try{return await access(t,e),!0}catch{return !1}}var R=ge;function Oe(t,e=0){a(t),t=b(t);try{return accessSync(t,e),!0}catch{return !1}}var S=Oe;var xe={brotli:brotliDecompress,gzip:unzip,none:(t,e)=>{e(null,t);}},Fe=async(t,e)=>{if(a(t),t=b(t),!await R(t))throw new b$1(`unable to read the non-accessible file: ${t}`);if(!await R(t,4))throw new Error(`Unable to read the non-readable file: ${t}`);let{buffer:r,compression:o,encoding:i,flag:s}=e??{};return await readFile(t,s?{encoding:i,flag:s}:{encoding:i}).then(async a=>await new Promise((d,u)=>{xe[o??"none"](a,(f,y)=>{f?u(f):d(r?y:y.toString());});})).catch(a=>{throw a})},v=Fe;var Ee={brotli:brotliDecompressSync,gzip:unzipSync,none:t=>t},De=(t,e)=>{if(a(t),t=b(t),!S(t))throw new b$1(`unable to read the non-accessible file: ${t}`);if(!S(t,4))throw new b$1(`invalid access to read file at: ${t}`);let{buffer:r,compression:o,encoding:i,flag:s}=e??{},a$1=readFileSync(t,s?{encoding:i,flag:s}:{encoding:i}),d=Ee[o??"none"](a$1);return r?d:d.toString()},U=De;async function Le(t,e,r){typeof e=="object"&&(r=e,e=void 0);let o=await v(t,{buffer:!0,encoding:void 0}),i=new TextDecoder().decode(o),{beforeParse:s,color:a}=r??{};return typeof s=="function"&&(i=s(i)),c(i,e,b(t),{color:a})}var Te=Le;function ve(t,e,r){typeof e=="object"&&(r=e,e=void 0);let o=U(t,{buffer:!0,encoding:void 0}),i=new TextDecoder().decode(o),{beforeParse:s,color:a}=r??{};return typeof s=="function"&&(i=s(i)),c(i,e,b(t),{color:a})}var Ue=ve;async function Ie(t,e,r){let{buffer:o,compression:i,encoding:s="utf8",flag:a,...d}=r??{},u=await v(t,{buffer:o,compression:i,encoding:s,flag:a});return typeof e=="function"?parse$1(u,e,d):parse$1(u,d)}var Ae=Ie;function Je(t,e,r){let{buffer:o,compression:i,encoding:s="utf8",flag:a,...d}=r??{},u=U(t,{buffer:o,compression:i,encoding:s,flag:a});return typeof e=="function"?parse$1(u,e,d):parse$1(u,d)}var Ye=Je;var Ce=async(t,e)=>{if(a(t),!existsSync(t)){await mkdir(t,{recursive:!0});return}for await(let r of await readdir(t))await rm(join(b(t),r),{...e,force:!0,recursive:!0});},ze=Ce;var He=(t,e)=>{if(a(t),!existsSync(t)){mkdirSync(t,{recursive:!0});return}for(let r of readdirSync(t))rmSync(join(b(t),r),{...e,force:!0,recursive:!0});},Ge=He;var Ze=async(t,e={})=>{a(t);try{await unlink(t);}catch{}try{await rm(t,{force:!0,maxRetries:e?.maxRetries,recursive:!0,retryDelay:e?.retryDelay});}catch{}},tr=Ze;var or=(t,e={})=>{a(t);try{unlinkSync(t);}catch{}try{rmSync(t,{force:!0,maxRetries:e?.maxRetries,recursive:!0,retryDelay:e?.retryDelay});}catch{}},ir=or;var nr=new TextEncoder,sr=t=>{if(t instanceof Uint8Array)return t;if(typeof t=="string")return nr.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t)){let e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(e)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},C=sr;var yr=async(t,e,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},a(t),d(e),t=b(t);try{let o=await R(t,0);if(!o&&r.recursive){let a=dirname(t);await R(a,0)||await mkdir(a,{recursive:!0});}let i;await writeFile(`${t}.tmp`,C(e),{encoding:r.encoding,flag:r.flag}),o&&!r.overwrite&&(i=await stat(t),r.chown===void 0&&(r.chown={gid:i.gid,uid:i.uid}),await rename(t,`${t}.bak`));let s=`${t}.tmp`;if(r.chown)try{await chown(s,r.chown.uid,r.chown.gid);}catch{}await chmod(s,i&&!r.mode?i.mode:r.mode??438),await rename(s,t);}catch(o){throw new Error(`Failed to write file at: ${t} - ${o.message}`,{cause:o})}finally{await R(`${t}.tmp`)&&await unlink(`${t}.tmp`);}},I=yr;var xr=(t,e,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},a(t),d(e),t=b(t);try{let o=S(t,0);if(!o&&r.recursive){let a=dirname(t);S(a,0)||mkdirSync(a,{recursive:!0});}let i;writeFileSync(`${t}.tmp`,C(e),{encoding:r.encoding,flag:r.flag}),o&&!r.overwrite&&(i=statSync(t),r.chown===void 0&&(r.chown={gid:i.gid,uid:i.uid}),renameSync(t,`${t}.bak`));let s=`${t}.tmp`;if(r.chown)try{chownSync(s,r.chown.uid,r.chown.gid);}catch{}chmodSync(s,i&&!r.mode?i.mode:r.mode??438),renameSync(s,t);}catch(o){throw new Error(`Failed to write file at: ${t} - ${o.message}`,{cause:o})}finally{S(`${t}.tmp`)&&unlinkSync(`${t}.tmp`);}},A=xr;var Fr=/^(?:( )+|\t+)/,J="space",ot="tab";function rt(t,e){let r=new Map,o=0,i,s;for(let a of t.split(/\n/g)){if(!a)continue;let d,u,f,y,n,g=a.match(Fr);if(g===null)o=0,i="";else {if(d=g[0].length,u=g[1]?J:ot,e&&u===J&&d===1)continue;u!==i&&(o=0),i=u,f=1,y=0;let N=d-o;if(o=d,N===0)f=0,y=1;else {let st=N>0?N:-N;s=br(u,st);}n=r.get(s),n=n===void 0?[1,0]:[n[0]+f,n[1]+y],r.set(s,n);}}return r}function br(t,e){return (t===J?"s":"t")+String(e)}function Pr(t){let r=t[0]==="s"?J:ot,o=Number(t.slice(1));return {type:r,amount:o}}function kr(t){let e,r=0,o=0;for(let[i,[s,a]]of t)(s>r||s===r&&a>o)&&(r=s,o=a,e=i);return e}function Er(t,e){return (t===J?" ":" ").repeat(e)}function Y(t){if(typeof t!="string")throw new TypeError("Expected a string");let e=rt(t,!0);e.size===0&&(e=rt(t,!1));let r=kr(e),o,i=0,s="";return r!==void 0&&({type:o,amount:i}=Pr(r),s=Er(o,i)),{amount:i,type:o,indent:s}}var Lr=async(t,e,r={})=>{let{detectIndent:o,indent:i,replacer:s,stringify:a=JSON.stringify,...d}={indent:" ",...r},u=i,f=`
|
|
15
|
+
`;if(await R(t,4))try{let n=await readFile(t,"utf8");if(o){let{indent:g}=Y(n);u=g;}f=n.endsWith(`
|
|
15
16
|
`)?`
|
|
16
|
-
`:"";}catch(n){if(n.code!=="ENOENT")throw n}let y=
|
|
17
|
-
`;if(S(t,4))try{let n=readFileSync(t,"utf8");if(o){let{indent:g}=Y(n);u=g;}
|
|
17
|
+
`:"";}catch(n){if(n.code!=="ENOENT")throw n}let y=a(e,s,u);await I(t,`${y}${f}`,d);},Tr=Lr;var Ur=(t,e,r={})=>{let{detectIndent:o,indent:i,replacer:s,stringify:a=JSON.stringify,...d}={indent:" ",...r},u=i,f=`
|
|
18
|
+
`;if(S(t,4))try{let n=readFileSync(t,"utf8");if(o){let{indent:g}=Y(n);u=g;}f=n.endsWith(`
|
|
18
19
|
`)?`
|
|
19
|
-
`:"";}catch(n){if(n.code!=="ENOENT")throw n}let y=
|
|
20
|
+
`:"";}catch(n){if(n.code!=="ENOENT")throw n}let y=a(e,s,u);A(t,`${y}${f}`,d);},Ir=Ur;async function Ar(t,e,r,o){let i=typeof r=="function"||Array.isArray(r)?stringify(e,r,o):stringify(e,r);await I(t,i);}var Jr=Ar;function Yr(t,e,r,o){let i=typeof r=="function"||Array.isArray(r)?stringify(e,r,o):stringify(e,r);A(t,i);}var Nr=Yr;
|
|
20
21
|
|
|
21
|
-
export {
|
|
22
|
+
export { $ as CRLF, It as EOL, k as FIND_UP_STOP, h as F_OK, z as LF, P as R_OK, at as W_OK, ft as X_OK, Bt as collect, re as collectSync, At as detect, ze as emptyDir, Ge as emptyDirSync, E as ensureDir, D as ensureDirSync, wt as ensureFile, xt as ensureFileSync, Et as ensureLink, vt as ensureLinkSync, fe as findUp, ye as findUpSync, Jt as format, R as isAccessible, S as isAccessibleSync, v as readFile, U as readFileSync, Te as readJson, Ue as readJsonSync, Ae as readYaml, Ye as readYamlSync, tr as remove, ir as removeSync, L as walk, T as walkSync, I as writeFile, A as writeFileSync, Tr as writeJson, Ir as writeJsonSync, Jr as writeYaml, Nr as writeYamlSync };
|
|
22
23
|
//# sourceMappingURL=out.js.map
|
|
23
24
|
//# sourceMappingURL=index.js.map
|