@visulima/fs 1.8.0 → 1.9.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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/walk.ts","../src/utils/assert-valid-file-or-directory-path.ts","../src/utils/glob-to-regex.ts","../src/utils/walk-include.ts","../src/collect.ts","../src/walk-sync.ts","../src/collect-sync.ts","../src/constants.ts","../src/empty-dir.ts","../src/empty-dir-sync.ts","../src/eol.ts","../src/find-up.ts","../src/find-up-sync.ts","../src/is-accessible.ts","../src/is-accessible-sync.ts","../src/read-file.ts","../src/read-file-sync.ts","../src/read-json.ts","../src/read-json-sync.ts","../src/write-file.ts","../src/utils/assert-valid-file-contents.ts","../src/utils/to-uint-8-array.ts","../src/write-file-sync.ts","../src/write-json.ts","../../../node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js","../src/write-json-sync.ts"],"names":["readdir","realpath","stat","basename","join","normalize","resolve","assertValidFileOrDirectoryPath","fileOrDirectoryPath","assert_valid_file_or_directory_path_default","globToRegExp","glob","reString","glob_to_regex_default","walkInclude","path","extensions","match","skip","extension","pattern","walk_include_default","_createWalkEntry","normalizePath","name","info","walk","directory","followSymlinks","includeDirectories","includeFiles","includeSymlinks","maxDepth","mappedMatch","mappedSkip","to_path_default","entry","error","walk_error_default","collect","options","config","entries","collect_default","readdirSync","realpathSync","statSync","walkSync","collectSync","collect_sync_default","F_OK","R_OK","W_OK","X_OK","FIND_UP_STOP","existsSync","mkdir","rm","emptyDir","dir","item","empty_dir_default","mkdirSync","rmSync","empty_dir_sync_default","platform","regDetect","LF","CRLF","EOL","detect","content","d","crlf","newline","lf","format","eol","dirname","isAbsolute","parse","findUp","cwd","root","stopPath","stopAt","type","getMatchers","currentDirectory","fileName","filePath","stats","find_up_default","findUpSync","find_up_sync_default","access","isAccessible","mode","is_accessible_default","accessSync","isAccessibleSync","is_accessible_sync_default","nodeReadFile","brotliDecompress","unzip","decompressionMethods","buffer","callback","readFile","permission_error_default","compression","encoding","flag","reject","result","read_file_default","nodeReadFileSync","brotliDecompressSync","unzipSync","readFileSync","decompressed","read_file_sync_default","readJson","reviver","data","beforeParse","color","parse_json_default","read_json_default","readJsonSync","read_json_sync_default","chmod","chown","rename","nodeStat","unlink","nodeWriteFile","assertValidFileContents","contents","assert_valid_file_contents_default","encoder","toUint8Array","bytes","to_uint_8_array_default","writeFile","pathExists","temporaryPath","write_file_default","chmodSync","chownSync","renameSync","unlinkSync","nodeWriteFileSync","writeFileSync","write_file_sync_default","INDENT_REGEX","INDENT_TYPE_SPACE","INDENT_TYPE_TAB","makeIndentsMap","string","ignoreSingleSpaces","indents","previousSize","previousIndentType","key","line","indent","indentType","use","weight","matches","indentDifference","absoluteIndentDifference","encodeIndentsKey","indentAmount","decodeIndentsKey","indentsKey","amount","getMostUsedKey","maxUsed","maxWeight","usedCount","makeIndentString","detectIndent","keyOfMostUsedIndent","writeJson","indentOption","replacer","stringify","writeOptions","trailingNewline","file","dIndent","json","write_json_default","writeJsonSync","write_json_sync_default"],"mappings":"0HAMA,OAAS,WAAAA,EAAS,YAAAC,EAAU,QAAAC,MAAY,mBACxC,OAAS,YAAAC,GAAU,QAAAC,GAAM,aAAAC,GAAW,WAAAC,OAAe,YCNnD,IAAMC,EAAkCC,GAAmC,CACvE,GAAI,CAACA,GAAwB,EAAEA,aAA+B,MAAQ,OAAOA,GAAwB,SACjG,MAAM,IAAI,UAAU,yCAAyC,CAErE,EAEOC,EAAQF,ECPf,IAAMG,EAAgBC,GAAyB,CAC3C,IAAMC,EAAWD,EAEZ,QAAQ,QAAS,UAAU,EAE3B,QAAQ,QAAS,MAAM,EAEvB,QAAQ,mBAAoB,SAAS,EAErC,QAAQ,MAAO,MAAM,EAErB,QAAQ,YAAa,KAAK,EAE1B,QAAQ,MAAO,GAAG,EAElB,QAAQ,MAAO,GAAG,EAElB,QAAQ,KAAM,GAAG,EAEjB,QAAQ,c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AE/CzB,EAAS0B,CACb,CAEAF,EAAkBC,EAAK,SAAS;AAAA,CAAI,EAAI;AAAA,EAAO,EAEnD,OAAS1J,EAAY,CAEjB,GAAIA,EAAM,OAAS,SACf,MAAMA,CAEd,CAIJ,IAAM4J,EAAOL,EAAUhE,EAAM+D,EAAUrB,CAAM,EAE7C,MAAMnB,EAAUpI,EAAM,GAAGkL,CAAI,GAAGH,CAAe,GAAID,CAAY,CACnE,EAEOK,GAAQT,GE5Cf,OAAS,gBAAAlE,OAAoB,UAU7B,IAAM4E,GAAgB,CAACpL,EAAoB6G,EAAepF,EAA4B,CAAC,IAAY,CAC/F,GAAM,CAAE,aAAA+I,EAAc,OAAQG,EAAc,SAAAC,EAAU,UAAAC,EAAY,KAAK,UAAW,GAAGC,CAAa,EAAI,CAAE,OAAQ,IAAM,GAAGrJ,CAAQ,EAE7H8H,EAASoB,EACTI,EAAkB;AAAA,EAEtB,GAAIzF,EAAiBtF,EAAM,CAAI,EAC3B,GAAI,CAEA,IAAMgL,EAAOxE,GAAaxG,EAAM,MAAM,EAEtC,GAAIwK,EAAc,CAEd,GAAM,CAAE,OAAQS,CAAQ,EAAIT,EAAeQ,CAAI,EAE/CzB,EAAS0B,CACb,CAEAF,EAAkBC,EAAK,SAAS;AAAA,CAAI,EAAI;AAAA,EAAO,EAEnD,OAAS1J,EAAY,CAEjB,GAAIA,EAAM,OAAS,SACf,MAAMA,CAEd,CAIJ,IAAM4J,EAAOL,EAAUhE,EAAM+D,EAAUrB,CAAM,EAE7CZ,EAAc3I,EAAM,GAAGkL,CAAI,GAAGH,CAAe,GAAID,CAAY,CACjE,EAEOO,GAAQD","sourcesContent":["// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.\n// Documentation and interface for walk were adapted from Go\n// https://golang.org/pkg/path/filepath/#Walk\n// Copyright 2009 The Go Authors. All rights reserved. BSD license.\n\nimport type { Stats } from \"node:fs\";\nimport { readdir, realpath, stat } from \"node:fs/promises\";\nimport { basename, join, normalize, resolve } from \"node:path\";\n\nimport WalkError from \"./error/walk-error\";\nimport type { WalkEntry, WalkOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport globToRegExp from \"./utils/glob-to-regex\";\nimport toPath from \"./utils/to-path\";\nimport walkInclude from \"./utils/walk-include\";\n\n// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\nconst _createWalkEntry = async (path: string): Promise<WalkEntry> => {\n const normalizePath: string = normalize(path as string);\n\n const name = basename(normalizePath);\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const info: Stats = await stat(normalizePath);\n\n return {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: info.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: info.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: info.isSymbolicLink,\n name,\n path: normalizePath,\n };\n};\n\n/**\n * Walks the file tree rooted at root, yielding each file or directory in the\n * tree filtered according to the given options.\n * Options:\n * - maxDepth?: number = Infinity;\n * - includeFiles?: boolean = true;\n * - includeDirs?: boolean = true;\n * - includeSymlinks?: boolean = true;\n * - followSymlinks?: boolean = false;\n * - extensions?: string[];\n * - match?: string | ReadonlyArray<string>;\n * - skip?: string | ReadonlyArray<string>;\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport default async function* walk(\n directory: URL | string,\n {\n extensions,\n followSymlinks = false,\n includeDirs: includeDirectories = true,\n includeFiles = true,\n includeSymlinks = true,\n match,\n maxDepth = Number.POSITIVE_INFINITY,\n skip,\n }: WalkOptions = {},\n): AsyncIterableIterator<WalkEntry> {\n assertValidFileOrDirectoryPath(directory);\n\n if (maxDepth < 0) {\n return;\n }\n\n const mappedMatch = match ? match.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n const mappedSkip = skip ? skip.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n\n // eslint-disable-next-line no-param-reassign\n directory = resolve(toPath(directory));\n\n if (includeDirectories && walkInclude(directory, extensions, mappedMatch, mappedSkip)) {\n yield await _createWalkEntry(directory);\n }\n\n if (maxDepth < 1 || !walkInclude(directory, undefined, undefined, mappedSkip)) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-restricted-syntax,security/detect-non-literal-fs-filename,no-loops/no-loops\n for await (const entry of await readdir(directory, {\n withFileTypes: true,\n })) {\n let path = join(directory, entry.name);\n\n if (entry.isSymbolicLink()) {\n if (followSymlinks) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n path = await realpath(path);\n } else if (includeSymlinks && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n } else {\n // eslint-disable-next-line no-continue\n continue;\n }\n }\n\n if (entry.isSymbolicLink() || entry.isDirectory()) {\n yield* walk(path, {\n extensions,\n followSymlinks,\n includeDirs: includeDirectories,\n includeFiles,\n includeSymlinks,\n match: mappedMatch,\n maxDepth: maxDepth - 1,\n skip: mappedSkip,\n } as WalkOptions);\n } else if (entry.isFile() && includeFiles && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n }\n }\n } catch (error) {\n if (error instanceof WalkError) {\n throw error;\n }\n\n throw new WalkError(error, directory);\n }\n}\n","// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileOrDirectoryPath = (fileOrDirectoryPath: any): void => {\n if (!fileOrDirectoryPath || (!(fileOrDirectoryPath instanceof URL) && typeof fileOrDirectoryPath !== \"string\")) {\n throw new TypeError(\"Path must be a non-empty string or URL.\");\n }\n};\n\nexport default assertValidFileOrDirectoryPath;\n","const globToRegExp = (glob: string): RegExp => {\n const reString = glob\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\.\\*/g, \".([^/]*)\") // Replace .* with .([^/]*)\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\*\\*/g, \"(.*)\") // Replace ** with (.*)\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/(?<!\\.)\\*(?!\\*)/g, \"([^/]*)\") // Replace * (not preceded by . or followed by *) with ([^/]*)\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\?/g, \"[^/]\") // Replace ? with [^/]\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\.(?!\\*)/g, \"\\\\.\") // Escape . that is not preceded by *\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\{/g, \"(\") // Replace { with (\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\}/g, \")\") // Replace } with )\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/,/g, \"|\") // Replace , with |\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\[!(.*?)\\]/g, \"[^$1]\"); // Replace [!number-number] with [^number-number]\n\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp,security/detect-non-literal-regexp\n return new RegExp(`^${reString}$`);\n};\n\nexport default globToRegExp;\n","const walkInclude = (path: string, extensions?: string[], match?: RegExp[], skip?: RegExp[]): boolean => {\n if (extensions && !extensions.some((extension): boolean => path.endsWith(extension))) {\n return false;\n }\n\n if (match && !match.some((pattern): boolean => pattern.test(path))) {\n return false;\n }\n\n return !(skip && skip.some((pattern): boolean => pattern.test(path)));\n};\n\nexport default walkInclude;\n","import type { WalkOptions } from \"./types\";\nimport walk from \"./walk\";\n\nconst collect = async (directory: string, options: WalkOptions = {}): Promise<string[]> => {\n const config = {\n extensions: [\"js\", \"mjs\", \"cjs\", \"ts\"],\n ...options,\n } as WalkOptions;\n\n const entries: string[] = [];\n\n // eslint-disable-next-line no-restricted-syntax,no-loops/no-loops\n for await (const entry of walk(directory, config)) {\n entries.push(entry.path);\n }\n\n return entries;\n};\n\nexport default collect;\n","// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.\n// Documentation and interface for walk were adapted from Go\n// https://golang.org/pkg/path/filepath/#Walk\n// Copyright 2009 The Go Authors. All rights reserved. BSD license.\n\nimport type { Stats } from \"node:fs\";\nimport { readdirSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, join, normalize, resolve } from \"node:path\";\n\nimport WalkError from \"./error/walk-error\";\nimport type { WalkEntry, WalkOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport globToRegExp from \"./utils/glob-to-regex\";\nimport toPath from \"./utils/to-path\";\nimport walkInclude from \"./utils/walk-include\";\n\n/** Create {@linkcode WalkEntry} for the `path` synchronously. */\n// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\nconst _createWalkEntry = (path: string): WalkEntry => {\n const normalizePath: string = normalize(path as string);\n\n const name = basename(normalizePath);\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const info: Stats = statSync(normalizePath);\n\n return {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: info.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: info.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: info.isSymbolicLink,\n name,\n path: normalizePath,\n };\n};\n\n/** Same as {@linkcode walk} but uses synchronous ops */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport default function* walkSync(\n directory: URL | string,\n {\n extensions,\n followSymlinks = false,\n includeDirs: includeDirectories = true,\n includeFiles = true,\n includeSymlinks = true,\n match,\n maxDepth = Number.POSITIVE_INFINITY,\n skip,\n }: WalkOptions = {},\n): IterableIterator<WalkEntry> {\n assertValidFileOrDirectoryPath(directory);\n\n if (maxDepth < 0) {\n return;\n }\n\n const mappedMatch = match ? match.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n const mappedSkip = skip ? skip.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n\n // eslint-disable-next-line no-param-reassign\n directory = resolve(toPath(directory));\n\n if (includeDirectories && walkInclude(directory, extensions, mappedMatch, mappedSkip)) {\n yield _createWalkEntry(directory);\n }\n\n if (maxDepth < 1 || !walkInclude(directory, undefined, undefined, mappedSkip)) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-restricted-syntax,no-loops/no-loops,security/detect-non-literal-fs-filename\n for (const entry of readdirSync(directory, {\n withFileTypes: true,\n })) {\n let path = join(directory, entry.name);\n\n if (entry.isSymbolicLink()) {\n if (followSymlinks) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n path = realpathSync(path);\n } else if (includeSymlinks && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n } else {\n // eslint-disable-next-line no-continue\n continue;\n }\n }\n\n if (entry.isSymbolicLink() || entry.isDirectory()) {\n yield* walkSync(path, {\n extensions,\n followSymlinks,\n includeDirs: includeDirectories,\n includeFiles,\n includeSymlinks,\n match: mappedMatch,\n maxDepth: maxDepth - 1,\n skip: mappedSkip,\n } as WalkOptions);\n } else if (entry.isFile() && includeFiles && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n }\n }\n } catch (error) {\n if (error instanceof WalkError) {\n throw error;\n }\n\n throw new WalkError(error, directory);\n }\n}\n","import type { WalkOptions } from \"./types\";\nimport walkSync from \"./walk-sync\";\n\nconst collectSync = (directory: string, options: WalkOptions = {}): string[] => {\n const config = {\n extensions: [\"js\", \"mjs\", \"cjs\", \"ts\"],\n ...options,\n } as WalkOptions;\n\n const entries: string[] = [];\n\n // eslint-disable-next-line no-restricted-syntax,no-loops/no-loops\n for (const entry of walkSync(directory, config)) {\n entries.push(entry.path);\n }\n\n return entries;\n};\n\nexport default collectSync;\n","/** Is the path visible to the calling process? */\nexport const F_OK = 0; // constants?.F_OK\n\n/** Is the path readable to the calling process? */\nexport const R_OK = 4; // constants?.R_OK\n\n/** Is the path writable to the calling process? */\nexport const W_OK = 2; // constants?.W_OK\n\n/** Is the path executable to the calling process? */\nexport const X_OK = 1; // constants?.X_OK\n\nexport const FIND_UP_STOP = Symbol(\"findUpStop\");\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readdir, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport type { EmptyDirOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/**\n * Ensures that a directory is empty.\n * Deletes directory contents if the directory is not empty.\n * If the directory does not exist, it is created.\n * The directory itself is not deleted.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst emptyDir = async (dir: URL | string, options?: EmptyDirOptions): Promise<void> => {\n assertValidFileOrDirectoryPath(dir);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(dir)) {\n // if not exist. then create it\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await mkdir(dir, { recursive: true });\n\n return;\n }\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,security/detect-non-literal-fs-filename\n for await (const item of await readdir(dir)) {\n await rm(join(toPath(dir), item), { ...options, force: true, recursive: true });\n }\n}\n\nexport default emptyDir;\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport type { EmptyDirOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/**\n * Ensures that a directory is empty.\n * Deletes directory contents if the directory is not empty.\n * If the directory does not exist, it is created.\n * The directory itself is not deleted.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst emptyDir = (dir: URL | string, options?: EmptyDirOptions): void => {\n assertValidFileOrDirectoryPath(dir);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(dir)) {\n // if not exist. then create it\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n mkdirSync(dir, { recursive: true });\n\n return;\n }\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,security/detect-non-literal-fs-filename\n for (const item of readdirSync(dir)) {\n rmSync(join(toPath(dir), item), { ...options, force: true, recursive: true });\n }\n}\n\nexport default emptyDir;\n","import { platform } from \"node:process\";\n\nconst regDetect = /\\r?\\n/g;\n\n/** End-of-line character for POSIX platforms such as macOS and Linux. */\nexport const LF = \"\\n\" as const;\n\n/** End-of-line character for Windows platforms. */\nexport const CRLF = \"\\r\\n\" as const;\n\n/**\n * End-of-line character evaluated for the current platform.\n */\nexport const EOL: \"\\n\" | \"\\r\\n\" = platform === \"win32\" ? CRLF : LF;\n\n/**\n * Detect the EOL character for string input.\n * Returns null if no newline.\n */\nexport const detect = (content: string): typeof EOL | null => {\n const d = content.match(regDetect);\n\n if (!d || d.length === 0) {\n return null;\n }\n\n const crlf = d.filter((newline) => newline === CRLF).length;\n const lf = d.length - crlf;\n\n return crlf > lf ? CRLF : LF;\n};\n\n/**\n * Format the file to the targeted EOL.\n */\nexport const format = (content: string, eol: typeof EOL): string => content.replaceAll(regDetect, eol);\n","import { stat } from \"node:fs/promises\";\nimport { dirname, isAbsolute, parse, resolve } from \"node:path\";\n\nimport { FIND_UP_STOP } from \"./constants\";\nimport type { FindUpOptions, Match } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst findUp = async (\n name: ReadonlyArray<string> | string[] | string | ((directory: string) => Match | Promise<Match>),\n options: FindUpOptions = {},\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): Promise<string | undefined> => {\n if (typeof name !== \"string\" && !Array.isArray(name) && typeof name !== \"function\") {\n throw new TypeError(\"The `name` argument must be of type `string` or `string[]`\");\n }\n\n const cwd = options.cwd ? toPath(options.cwd) : process.cwd();\n\n assertValidFileOrDirectoryPath(cwd);\n\n let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\n\n assertValidFileOrDirectoryPath(stopPath);\n\n const stopAt = resolve(directory, stopPath);\n const type = options.type ?? \"file\";\n\n const getMatchers = async function (currentDirectory: string): Promise<(string | typeof FIND_UP_STOP | undefined)[]> {\n if (typeof name === \"function\") {\n const match = await name(currentDirectory);\n\n return [match];\n }\n\n if (typeof name === \"string\") {\n return [name];\n }\n\n if (Array.isArray(name)) {\n return name as string[];\n }\n\n return [name];\n };\n\n // eslint-disable-next-line no-loops/no-loops\n while (directory && directory !== stopAt && directory !== root) {\n // eslint-disable-next-line no-await-in-loop,no-loops/no-loops,no-restricted-syntax\n for await (const fileName of await getMatchers(directory)) {\n if (fileName === FIND_UP_STOP) {\n return undefined;\n }\n\n if (fileName === undefined) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const filePath = isAbsolute(fileName) ? fileName : resolve(directory, fileName);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stats = await stat(filePath);\n\n if ((type === \"file\" && stats.isFile()) || (type === \"directory\" && stats.isDirectory())) {\n return filePath;\n }\n } catch {\n /* empty */\n }\n }\n\n directory = dirname(directory);\n }\n\n return undefined;\n};\n\nexport default findUp;\n","import { statSync } from \"node:fs\";\nimport { dirname, isAbsolute, parse, resolve } from \"node:path\";\n\nimport { FIND_UP_STOP } from \"./constants\";\nimport type { FindUpOptions, Match } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst findUpSync = (\n name: ReadonlyArray<string> | string[] | string | ((directory: string) => Match),\n options: FindUpOptions = {},\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): string | undefined => {\n if (typeof name !== \"string\" && !Array.isArray(name) && typeof name !== \"function\") {\n throw new TypeError(\"The `name` argument must be of type `string` or `string[]`\");\n }\n\n const cwd = options.cwd ? toPath(options.cwd) : process.cwd();\n\n assertValidFileOrDirectoryPath(cwd);\n\n let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\n\n assertValidFileOrDirectoryPath(stopPath);\n\n const stopAt = resolve(directory, stopPath);\n const type = options.type ?? \"file\";\n\n const getMatchers = function (currentDirectory: string): (string | typeof FIND_UP_STOP | undefined)[] {\n if (typeof name === \"function\") {\n const match = name(currentDirectory);\n\n return [match];\n }\n\n if (typeof name === \"string\") {\n return [name];\n }\n\n if (Array.isArray(name)) {\n return name as string[];\n }\n\n return [name];\n };\n\n // eslint-disable-next-line no-loops/no-loops\n while (directory && directory !== stopAt && directory !== root) {\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const fileName of getMatchers(directory)) {\n if (fileName === FIND_UP_STOP) {\n return undefined;\n }\n\n if (fileName === undefined) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const filePath = isAbsolute(fileName) ? fileName : resolve(directory, fileName);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stats = statSync(filePath);\n\n if ((type === \"file\" && stats.isFile()) || (type === \"directory\" && stats.isDirectory())) {\n return filePath;\n }\n } catch {\n /* empty */\n }\n }\n\n directory = dirname(directory);\n }\n\n return undefined;\n};\n\nexport default findUpSync;\n","import { access } from \"node:fs/promises\";\n\nimport { F_OK } from \"./constants\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/** Returns a Promise that resolves to a boolean indicating if the path is accessible or not. */\nasync function isAccessible(path: URL | string, mode?: number): Promise<boolean>;\n// eslint-disable-next-line func-style\nasync function isAccessible(path: URL | string, mode: number = F_OK): Promise<boolean> {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n await access(path, mode);\n\n return true;\n } catch {\n return false;\n }\n}\n\nexport default isAccessible;\n","import { accessSync } from \"node:fs\";\n\nimport { F_OK } from \"./constants\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/** Returns a boolean indicating if the path is accessible or not. */\nfunction isAccessibleSync(path: URL | string, mode?: number): boolean;\n// eslint-disable-next-line func-style\nfunction isAccessibleSync(path: URL | string, mode: number = F_OK): boolean {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n accessSync(path, mode);\n\n return true;\n } catch {\n return false;\n }\n}\n\nexport default isAccessibleSync;\n","import { readFile as nodeReadFile } from \"node:fs/promises\";\nimport { brotliDecompress, unzip } from \"node:zlib\";\n\nimport { R_OK } from \"./constants\";\nimport PermissionError from \"./error/permission-error\";\nimport isAccessible from \"./is-accessible\";\nimport type { ContentType, ReadFileOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst decompressionMethods = {\n brotli: brotliDecompress,\n gzip: unzip,\n none: (buffer: Buffer, callback: (error: Error | null, result: Buffer) => void) => {\n callback(null, buffer);\n },\n} as const;\n\nconst readFile = async <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(\n path: URL | string,\n options?: O,\n): Promise<ContentType<O> | undefined> => {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n if (!(await isAccessible(path))) {\n throw new PermissionError(`unable to read the non-accessible file: ${path}`);\n }\n\n if (!(await isAccessible(path, R_OK))) {\n throw new Error(`Unable to read the non-readable file: ${path}`);\n }\n\n const { buffer, compression, encoding, flag } = options ?? {};\n\n // @ts-expect-error - TS doesn't like our typed `encoding` option\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n return await nodeReadFile(path, flag ? { encoding, flag } : { encoding })\n .then(\n async (content) =>\n // eslint-disable-next-line compat/compat\n await new Promise<ContentType<O> | undefined>((resolve, reject) => {\n decompressionMethods[compression ?? \"none\"](content, (error, result) => {\n if (error) {\n reject(error);\n } else {\n resolve((buffer ? result : result.toString()) as ContentType<O>);\n }\n });\n }),\n )\n .catch((error: unknown) => {\n throw error;\n });\n};\n\nexport default readFile;\n","import { readFileSync as nodeReadFileSync } from \"node:fs\";\nimport { brotliDecompressSync, unzipSync } from \"node:zlib\";\n\nimport { R_OK } from \"./constants\";\nimport PermissionError from \"./error/permission-error\";\nimport isAccessibleSync from \"./is-accessible-sync\";\nimport type { ContentType, ReadFileOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst decompressionMethods = {\n brotli: brotliDecompressSync,\n gzip: unzipSync,\n none: (buffer: Buffer) => buffer,\n} as const;\n\nconst readFileSync = <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(\n path: URL | string,\n options?: O,\n): ContentType<O> | undefined => {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n if (!isAccessibleSync(path)) {\n throw new PermissionError(`unable to read the non-accessible file: ${path}`);\n }\n\n if (!isAccessibleSync(path, R_OK)) {\n throw new PermissionError(`invalid access to read file at: ${path}`);\n }\n\n const { buffer, compression, encoding, flag } = options ?? {};\n\n // @ts-expect-error - TS doesn't like our typed `encoding` option\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const content = nodeReadFileSync(path, flag ? { encoding, flag } : { encoding });\n\n const decompressed = decompressionMethods[compression ?? \"none\"](content);\n\n return (buffer ? decompressed : decompressed.toString()) as ContentType<O>;\n};\n\nexport default readFileSync;\n","import type { JsonValue } from \"type-fest\";\n\nimport readFile from \"./read-file\";\nimport type { JsonReviver, ReadJsonOptions } from \"./types\";\nimport parseJson from \"./utils/parse-json\";\nimport toPath from \"./utils/to-path\";\n\nasync function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;\n\nasync function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;\n// eslint-disable-next-line func-style\nasync function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver | ReadJsonOptions, options?: ReadJsonOptions): Promise<T> {\n if (typeof reviver === \"object\") {\n // eslint-disable-next-line no-param-reassign\n options = reviver;\n // eslint-disable-next-line no-param-reassign\n reviver = undefined;\n }\n\n const content = await readFile(path, {\n buffer: true,\n encoding: undefined,\n });\n\n // Unlike `buffer.toString()` and `fs.readFile(path, 'utf8')`, `TextDecoder` will remove BOM.\n let data = new TextDecoder().decode(content);\n\n const { beforeParse, color } = options ?? {};\n\n if (typeof beforeParse === \"function\") {\n data = beforeParse(data);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJson;\n","import type { JsonValue } from \"type-fest\";\n\nimport readFileSync from \"./read-file-sync\";\nimport type { JsonReviver, ReadJsonOptions } from \"./types\";\nimport parseJson from \"./utils/parse-json\";\nimport toPath from \"./utils/to-path\";\n\nfunction readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;\n\nfunction readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;\n// eslint-disable-next-line func-style\nfunction readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver | ReadJsonOptions, options?: ReadJsonOptions): T {\n if (typeof reviver === \"object\") {\n // eslint-disable-next-line no-param-reassign\n options = reviver;\n // eslint-disable-next-line no-param-reassign\n reviver = undefined;\n }\n\n const content = readFileSync(path, {\n buffer: true,\n encoding: undefined,\n });\n\n // Unlike `buffer.toString()` and `fs.readFile(path, 'utf8')`, `TextDecoder` will remove BOM.\n let data = new TextDecoder().decode(content);\n\n const { beforeParse, color } = options ?? {};\n\n if (typeof beforeParse === \"function\") {\n data = beforeParse(data);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJsonSync;\n","import type { Stats } from \"node:fs\";\nimport { chmod, chown, mkdir, rename, stat as nodeStat, unlink, writeFile as nodeWriteFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport { F_OK } from \"./constants\";\nimport isAccessible from \"./is-accessible\";\nimport type { WriteFileOptions } from \"./types\";\nimport assertValidFileContents from \"./utils/assert-valid-file-contents\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\nimport toUint8Array from \"./utils/to-uint-8-array\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeFile = async (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions): Promise<void> => {\n // eslint-disable-next-line no-param-reassign\n options = {\n encoding: \"utf8\",\n flag: \"w\",\n overwrite: true,\n recursive: true,\n ...options,\n };\n\n assertValidFileOrDirectoryPath(path);\n assertValidFileContents(content);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n const pathExists = await isAccessible(path, F_OK);\n\n if (!pathExists && options.recursive) {\n const directory = dirname(path);\n\n if (!(await isAccessible(directory, F_OK))) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await mkdir(directory, { recursive: true });\n }\n }\n\n let stat: Stats | undefined;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await nodeWriteFile(`${path}.tmp`, toUint8Array(content), { encoding: options.encoding, flag: options.flag });\n\n if (pathExists && !options.overwrite) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n stat = await nodeStat(path);\n\n if (options.chown === undefined) {\n // eslint-disable-next-line no-param-reassign\n options.chown = { gid: stat.gid, uid: stat.uid };\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await rename(path, `${path}.bak`);\n }\n\n const temporaryPath = `${path}.tmp`;\n\n if (options.chown) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await chown(temporaryPath, options.chown.uid, options.chown.gid);\n } catch {\n // On linux permissionless filesystems like exfat and fat32 the entire filesystem is normally owned by root,\n // and trying to chown it causes as permissions error.\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await chmod(temporaryPath, stat && !options.mode ? stat.mode : options.mode ?? 0o666);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await rename(temporaryPath, path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n throw new Error(`Failed to write file at: ${path} - ${error.message}`, { cause: error });\n } finally {\n if (await isAccessible(`${path}.tmp`)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await unlink(`${path}.tmp`);\n }\n }\n};\n\nexport default writeFile;\n","// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileContents = (contents: any): void => {\n if (typeof contents !== \"string\" && !(contents instanceof ArrayBuffer) && !ArrayBuffer.isView(contents)) {\n throw new TypeError(\"File contents must be a string, ArrayBuffer, or ArrayBuffer view.\");\n }\n};\n\nexport default assertValidFileContents;\n","const encoder = new TextEncoder();\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst toUint8Array = (contents: any) => {\n if (contents instanceof Uint8Array) {\n return contents;\n }\n\n if (typeof contents === \"string\") {\n return encoder.encode(contents);\n }\n\n if (contents instanceof ArrayBuffer) {\n return new Uint8Array(contents);\n }\n\n if (ArrayBuffer.isView(contents)) {\n const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);\n\n return new Uint8Array(bytes);\n }\n\n throw new TypeError(\"Invalid contents type. Expected string or ArrayBuffer.\");\n};\n\nexport default toUint8Array;\n","import type { Stats } from \"node:fs\";\nimport { chmodSync, chownSync, mkdirSync, renameSync, statSync, unlinkSync, writeFileSync as nodeWriteFileSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\nimport { F_OK } from \"./constants\";\nimport isAccessibleSync from \"./is-accessible-sync\";\nimport type { WriteFileOptions } from \"./types\";\nimport assertValidFileContents from \"./utils/assert-valid-file-contents\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\nimport toUint8Array from \"./utils/to-uint-8-array\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeFileSync = (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions): void => {\n // eslint-disable-next-line no-param-reassign\n options = {\n encoding: \"utf8\",\n flag: \"w\",\n overwrite: true,\n recursive: true,\n ...options,\n };\n\n assertValidFileOrDirectoryPath(path);\n assertValidFileContents(content);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n const pathExists = isAccessibleSync(path, F_OK);\n\n if (!pathExists && options.recursive) {\n const directory = dirname(path);\n\n if (!isAccessibleSync(directory, F_OK)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n mkdirSync(directory, { recursive: true });\n }\n }\n\n let stat: Stats | undefined;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n nodeWriteFileSync(`${path}.tmp`, toUint8Array(content), { encoding: options.encoding, flag: options.flag });\n\n if (pathExists && !options.overwrite) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n stat = statSync(path);\n\n if (options.chown === undefined) {\n // eslint-disable-next-line no-param-reassign\n options.chown = { gid: stat.gid, uid: stat.uid };\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n renameSync(path, `${path}.bak`);\n }\n\n const temporaryPath = `${path}.tmp`;\n\n if (options.chown) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n chownSync(temporaryPath, options.chown.uid, options.chown.gid);\n } catch {\n // On linux permissionless filesystems like exfat and fat32 the entire filesystem is normally owned by root,\n // and trying to chown it causes as permissions error.\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n chmodSync(temporaryPath, stat && !options.mode ? stat.mode : options.mode ?? 0o666);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n renameSync(temporaryPath, path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n throw new Error(`Failed to write file at: ${path} - ${error.message}`, { cause: error });\n } finally {\n if (isAccessibleSync(`${path}.tmp`)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n unlinkSync(`${path}.tmp`);\n }\n }\n};\n\nexport default writeFileSync;\n","import { readFile } from \"node:fs/promises\";\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport detectIndentFn from \"detect-indent\";\n\nimport { R_OK } from \"./constants\";\nimport isAccessible from \"./is-accessible\";\nimport type { WriteJsonOptions } from \"./types\";\nimport writeFile from \"./write-file\";\n\nconst writeJson = async (path: URL | string, data: unknown, options: WriteJsonOptions = {}): Promise<void> => {\n const { detectIndent, indent: indentOption, replacer, stringify = JSON.stringify, ...writeOptions } = { indent: \"\\t\", ...options };\n\n let indent = indentOption;\n let trailingNewline = \"\\n\";\n\n if (await isAccessible(path, R_OK)) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const file = await readFile(path, \"utf8\");\n\n if (detectIndent) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment\n const { indent: dIndent } = detectIndentFn(file);\n\n indent = dIndent as string;\n }\n\n trailingNewline = file.endsWith(\"\\n\") ? \"\\n\" : \"\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code !== \"ENOENT\") {\n throw error;\n }\n }\n }\n\n // @ts-expect-error - `replacer` is a valid argument for `JSON.stringify`\n const json = stringify(data, replacer, indent);\n\n await writeFile(path, `${json}${trailingNewline}`, writeOptions);\n};\n\nexport default writeJson;\n","// Detect either spaces or tabs but not both to properly handle tabs for indentation and spaces for alignment\nconst INDENT_REGEX = /^(?:( )+|\\t+)/;\n\nconst INDENT_TYPE_SPACE = 'space';\nconst INDENT_TYPE_TAB = 'tab';\n\n/**\nMake a Map that counts how many indents/unindents have occurred for a given size and how many lines follow a given indentation.\n\nThe key is a concatenation of the indentation type (s = space and t = tab) and the size of the indents/unindents.\n\n```\nindents = {\n\tt3: [1, 0],\n\tt4: [1, 5],\n\ts5: [1, 0],\n\ts12: [1, 0],\n}\n```\n*/\nfunction makeIndentsMap(string, ignoreSingleSpaces) {\n\tconst indents = new Map();\n\n\t// Remember the size of previous line's indentation\n\tlet previousSize = 0;\n\tlet previousIndentType;\n\n\t// Indents key (ident type + size of the indents/unindents)\n\tlet key;\n\n\tfor (const line of string.split(/\\n/g)) {\n\t\tif (!line) {\n\t\t\t// Ignore empty lines\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet indent;\n\t\tlet indentType;\n\t\tlet use;\n\t\tlet weight;\n\t\tlet entry;\n\t\tconst matches = line.match(INDENT_REGEX);\n\n\t\tif (matches === null) {\n\t\t\tpreviousSize = 0;\n\t\t\tpreviousIndentType = '';\n\t\t} else {\n\t\t\tindent = matches[0].length;\n\t\t\tindentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;\n\n\t\t\t// Ignore single space unless it's the only indent detected to prevent common false positives\n\t\t\tif (ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && indent === 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (indentType !== previousIndentType) {\n\t\t\t\tpreviousSize = 0;\n\t\t\t}\n\n\t\t\tpreviousIndentType = indentType;\n\n\t\t\tuse = 1;\n\t\t\tweight = 0;\n\n\t\t\tconst indentDifference = indent - previousSize;\n\t\t\tpreviousSize = indent;\n\n\t\t\t// Previous line have same indent?\n\t\t\tif (indentDifference === 0) {\n\t\t\t\t// Not a new \"use\" of the current indent:\n\t\t\t\tuse = 0;\n\t\t\t\t// But do add a bit to it for breaking ties:\n\t\t\t\tweight = 1;\n\t\t\t\t// We use the key from previous loop\n\t\t\t} else {\n\t\t\t\tconst absoluteIndentDifference = indentDifference > 0 ? indentDifference : -indentDifference;\n\t\t\t\tkey = encodeIndentsKey(indentType, absoluteIndentDifference);\n\t\t\t}\n\n\t\t\t// Update the stats\n\t\t\tentry = indents.get(key);\n\t\t\tentry = entry === undefined ? [1, 0] : [entry[0] + use, entry[1] + weight];\n\n\t\t\tindents.set(key, entry);\n\t\t}\n\t}\n\n\treturn indents;\n}\n\n// Encode the indent type and amount as a string (e.g. 's4') for use as a compound key in the indents Map.\nfunction encodeIndentsKey(indentType, indentAmount) {\n\tconst typeCharacter = indentType === INDENT_TYPE_SPACE ? 's' : 't';\n\treturn typeCharacter + String(indentAmount);\n}\n\n// Extract the indent type and amount from a key of the indents Map.\nfunction decodeIndentsKey(indentsKey) {\n\tconst keyHasTypeSpace = indentsKey[0] === 's';\n\tconst type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;\n\n\tconst amount = Number(indentsKey.slice(1));\n\n\treturn {type, amount};\n}\n\n// Return the key (e.g. 's4') from the indents Map that represents the most common indent,\n// or return undefined if there are no indents.\nfunction getMostUsedKey(indents) {\n\tlet result;\n\tlet maxUsed = 0;\n\tlet maxWeight = 0;\n\n\tfor (const [key, [usedCount, weight]] of indents) {\n\t\tif (usedCount > maxUsed || (usedCount === maxUsed && weight > maxWeight)) {\n\t\t\tmaxUsed = usedCount;\n\t\t\tmaxWeight = weight;\n\t\t\tresult = key;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction makeIndentString(type, amount) {\n\tconst indentCharacter = type === INDENT_TYPE_SPACE ? ' ' : '\\t';\n\treturn indentCharacter.repeat(amount);\n}\n\nexport default function detectIndent(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError('Expected a string');\n\t}\n\n\t// Identify indents while skipping single space indents to avoid common edge cases (e.g. code comments)\n\t// If no indents are identified, run again and include all indents for comprehensive detection\n\tlet indents = makeIndentsMap(string, true);\n\tif (indents.size === 0) {\n\t\tindents = makeIndentsMap(string, false);\n\t}\n\n\tconst keyOfMostUsedIndent = getMostUsedKey(indents);\n\n\tlet type;\n\tlet amount = 0;\n\tlet indent = '';\n\n\tif (keyOfMostUsedIndent !== undefined) {\n\t\t({type, amount} = decodeIndentsKey(keyOfMostUsedIndent));\n\t\tindent = makeIndentString(type, amount);\n\t}\n\n\treturn {\n\t\tamount,\n\t\ttype,\n\t\tindent,\n\t};\n}\n","import { readFileSync } from \"node:fs\";\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport detectIndentFn from \"detect-indent\";\n\nimport { R_OK } from \"./constants\";\nimport isAccessibleSync from \"./is-accessible-sync\";\nimport type { WriteJsonOptions } from \"./types\";\nimport writeFileSync from \"./write-file-sync\";\n\nconst writeJsonSync = (path: URL | string, data: unknown, options: WriteJsonOptions = {}): void => {\n const { detectIndent, indent: indentOption, replacer, stringify = JSON.stringify, ...writeOptions } = { indent: \"\\t\", ...options };\n\n let indent = indentOption;\n let trailingNewline = \"\\n\";\n\n if (isAccessibleSync(path, R_OK)) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const file = readFileSync(path, \"utf8\");\n\n if (detectIndent) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment\n const { indent: dIndent } = detectIndentFn(file);\n\n indent = dIndent as string;\n }\n\n trailingNewline = file.endsWith(\"\\n\") ? \"\\n\" : \"\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code !== \"ENOENT\") {\n throw error;\n }\n }\n }\n\n // @ts-expect-error - `replacer` is a valid argument for `JSON.stringify`\n const json = stringify(data, replacer, indent);\n\n writeFileSync(path, `${json}${trailingNewline}`, writeOptions);\n};\n\nexport default writeJsonSync;\n"]}
1
+ {"version":3,"sources":["../src/walk.ts","../src/utils/assert-valid-file-or-directory-path.ts","../src/utils/glob-to-regex.ts","../src/utils/walk-include.ts","../src/collect.ts","../src/walk-sync.ts","../src/collect-sync.ts","../src/constants.ts","../src/empty-dir.ts","../src/empty-dir-sync.ts","../src/eol.ts","../src/find-up.ts","../src/find-up-sync.ts","../src/is-accessible.ts","../src/is-accessible-sync.ts","../src/read-file.ts","../src/read-file-sync.ts","../src/read-json.ts","../src/read-json-sync.ts","../src/read-yaml.ts","../src/read-yaml-sync.ts","../src/write-file.ts","../src/utils/assert-valid-file-contents.ts","../src/utils/to-uint-8-array.ts","../src/write-file-sync.ts","../src/write-json.ts","../../../node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js","../src/write-json-sync.ts","../src/write-yaml.ts","../src/write-yaml-sync.ts"],"names":["readdir","realpath","stat","basename","join","normalize","resolve","assertValidFileOrDirectoryPath","fileOrDirectoryPath","assert_valid_file_or_directory_path_default","globToRegExp","glob","reString","glob_to_regex_default","walkInclude","path","extensions","match","skip","extension","pattern","walk_include_default","_createWalkEntry","normalizePath","name","info","walk","directory","followSymlinks","includeDirectories","includeFiles","includeSymlinks","maxDepth","mappedMatch","mappedSkip","to_path_default","entry","error","walk_error_default","collect","options","config","entries","collect_default","readdirSync","realpathSync","statSync","walkSync","collectSync","collect_sync_default","F_OK","R_OK","W_OK","X_OK","FIND_UP_STOP","existsSync","mkdir","rm","emptyDir","dir","item","empty_dir_default","mkdirSync","rmSync","empty_dir_sync_default","platform","regDetect","LF","CRLF","EOL","detect","content","d","crlf","newline","lf","format","eol","dirname","isAbsolute","parse","findUp","cwd","root","stopPath","stopAt","type","getMatchers","currentDirectory","fileName","filePath","stats","find_up_default","findUpSync","find_up_sync_default","access","isAccessible","mode","is_accessible_default","accessSync","isAccessibleSync","is_accessible_sync_default","nodeReadFile","brotliDecompress","unzip","decompressionMethods","buffer","callback","readFile","permission_error_default","compression","encoding","flag","reject","result","read_file_default","nodeReadFileSync","brotliDecompressSync","unzipSync","readFileSync","decompressed","read_file_sync_default","readJson","reviver","data","beforeParse","color","parse_json_default","read_json_default","readJsonSync","read_json_sync_default","readYaml","parseOptions","read_yaml_default","readYamlSync","read_yaml_sync_default","chmod","chown","rename","nodeStat","unlink","nodeWriteFile","assertValidFileContents","contents","assert_valid_file_contents_default","encoder","toUint8Array","bytes","to_uint_8_array_default","writeFile","pathExists","temporaryPath","write_file_default","chmodSync","chownSync","renameSync","unlinkSync","nodeWriteFileSync","writeFileSync","write_file_sync_default","INDENT_REGEX","INDENT_TYPE_SPACE","INDENT_TYPE_TAB","makeIndentsMap","string","ignoreSingleSpaces","indents","previousSize","previousIndentType","key","line","indent","indentType","use","weight","matches","indentDifference","absoluteIndentDifference","encodeIndentsKey","indentAmount","decodeIndentsKey","indentsKey","amount","getMostUsedKey","maxUsed","maxWeight","usedCount","makeIndentString","detectIndent","keyOfMostUsedIndent","writeJson","indentOption","replacer","stringify","writeOptions","trailingNewline","file","dIndent","json","write_json_default","writeJsonSync","write_json_sync_default","writeYaml","write_yaml_default","writeYamlSync","write_yaml_sync_default"],"mappings":"0HAMA,OAAS,WAAAA,GAAS,YAAAC,GAAU,QAAAC,OAAY,mBACxC,OAAS,YAAAC,GAAU,QAAAC,GAAM,aAAAC,GAAW,WAAAC,OAAe,YCNnD,IAAMC,EAAkCC,GAAmC,CACvE,GAAI,CAACA,GAAwB,EAAEA,aAA+B,MAAQ,OAAOA,GAAwB,SACjG,MAAM,IAAI,UAAU,yCAAyC,CAErE,EAEOC,EAAQF,ECPf,IAAMG,EAAgBC,GAAyB,CAC3C,IAAMC,EAAWD,EAEZ,QAAQ,QAAS,UAAU,EAE3B,QAAQ,QAAS,MAAM,EAEvB,QAAQ,mBAAoB,SAAS,EAErC,QAAQ,MAAO,MAAM,EAErB,QAAQ,YAAa,KAAK,EAE1B,QAAQ,MAAO,GAAG,EAElB,QAAQ,MAAO,GAAG,EAElB,QAAQ,KAAM,GAAG,EAEjB,QAAQ,cAAe,OAAO,EAGnC,OAAO,IAAI,OAAO,IAAIC,CAAQ,GAAG,CACrC,EAEOC,EAAQH,ECzBf,IAAMI,GAAc,CAACC,EAAcC,EAAuBC,EAAkBC,IACpEF,GAAc,CAACA,EAAW,KAAMG,GAAuBJ,EAAK,SAASI,CAAS,CAAC,GAI/EF,GAAS,CAACA,EAAM,KAAMG,GAAqBA,EAAQ,KAAKL,CAAI,CAAC,EACtD,GAGJ,EAAEG,GAAQA,EAAK,KAAME,GAAqBA,EAAQ,KAAKL,CAAI,CAAC,GAGhEM,EAAQP,GHKf,IAAMQ,GAAmB,MAAOP,GAAqC,CACjE,IAAMQ,EAAwBlB,GAAUU,CAAc,EAEhDS,EAAOrB,GAASoB,CAAa,EAE7BE,EAAc,MAAMvB,GAAKqB,CAAa,EAE5C,MAAO,CAEH,YAAaE,EAAK,YAElB,OAAQA,EAAK,OAEb,eAAgBA,EAAK,eACrB,KAAAD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O,GAAQD,GC3Cf,OAAS,aAAAP,MAAiB,OAuB1B,eAAeS,GACX3L,EAEA6G,EAEAoE,EAEAxJ,EACa,CAEb,IAAM+B,EAAU,OAAOyH,GAAa,YAAc,MAAM,QAAQA,CAAQ,EAAIC,EAAUrE,EAAMoE,EAAUxJ,CAAO,EAAIyJ,EAAUrE,EAAMoE,CAAwB,EAGzJ,MAAMxC,EAAUzI,EAAMwD,CAAO,CACjC,CAEA,IAAOoI,GAAQD,GCvCf,OAAS,aAAAT,MAAiB,OAuB1B,SAASW,GACL7L,EAEA6G,EAEAoE,EAEAxJ,EACI,CAEJ,IAAM+B,EAAU,OAAOyH,GAAa,YAAc,MAAM,QAAQA,CAAQ,EAAIC,EAAUrE,EAAMoE,EAAUxJ,CAAO,EAAIyJ,EAAUrE,EAAMoE,CAAwB,EAGzJjC,EAAchJ,EAAMwD,CAAO,CAC/B,CAEA,IAAOsI,GAAQD","sourcesContent":["// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.\n// Documentation and interface for walk were adapted from Go\n// https://golang.org/pkg/path/filepath/#Walk\n// Copyright 2009 The Go Authors. All rights reserved. BSD license.\n\nimport type { Stats } from \"node:fs\";\nimport { readdir, realpath, stat } from \"node:fs/promises\";\nimport { basename, join, normalize, resolve } from \"node:path\";\n\nimport WalkError from \"./error/walk-error\";\nimport type { WalkEntry, WalkOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport globToRegExp from \"./utils/glob-to-regex\";\nimport toPath from \"./utils/to-path\";\nimport walkInclude from \"./utils/walk-include\";\n\n// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\nconst _createWalkEntry = async (path: string): Promise<WalkEntry> => {\n const normalizePath: string = normalize(path as string);\n\n const name = basename(normalizePath);\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const info: Stats = await stat(normalizePath);\n\n return {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: info.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: info.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: info.isSymbolicLink,\n name,\n path: normalizePath,\n };\n};\n\n/**\n * Walks the file tree rooted at root, yielding each file or directory in the\n * tree filtered according to the given options.\n * Options:\n * - maxDepth?: number = Infinity;\n * - includeFiles?: boolean = true;\n * - includeDirs?: boolean = true;\n * - includeSymlinks?: boolean = true;\n * - followSymlinks?: boolean = false;\n * - extensions?: string[];\n * - match?: string | ReadonlyArray<string>;\n * - skip?: string | ReadonlyArray<string>;\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport default async function* walk(\n directory: URL | string,\n {\n extensions,\n followSymlinks = false,\n includeDirs: includeDirectories = true,\n includeFiles = true,\n includeSymlinks = true,\n match,\n maxDepth = Number.POSITIVE_INFINITY,\n skip,\n }: WalkOptions = {},\n): AsyncIterableIterator<WalkEntry> {\n assertValidFileOrDirectoryPath(directory);\n\n if (maxDepth < 0) {\n return;\n }\n\n const mappedMatch = match ? match.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n const mappedSkip = skip ? skip.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n\n // eslint-disable-next-line no-param-reassign\n directory = resolve(toPath(directory));\n\n if (includeDirectories && walkInclude(directory, extensions, mappedMatch, mappedSkip)) {\n yield await _createWalkEntry(directory);\n }\n\n if (maxDepth < 1 || !walkInclude(directory, undefined, undefined, mappedSkip)) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-restricted-syntax,security/detect-non-literal-fs-filename,no-loops/no-loops\n for await (const entry of await readdir(directory, {\n withFileTypes: true,\n })) {\n let path = join(directory, entry.name);\n\n if (entry.isSymbolicLink()) {\n if (followSymlinks) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n path = await realpath(path);\n } else if (includeSymlinks && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n } else {\n // eslint-disable-next-line no-continue\n continue;\n }\n }\n\n if (entry.isSymbolicLink() || entry.isDirectory()) {\n yield* walk(path, {\n extensions,\n followSymlinks,\n includeDirs: includeDirectories,\n includeFiles,\n includeSymlinks,\n match: mappedMatch,\n maxDepth: maxDepth - 1,\n skip: mappedSkip,\n } as WalkOptions);\n } else if (entry.isFile() && includeFiles && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n }\n }\n } catch (error) {\n if (error instanceof WalkError) {\n throw error;\n }\n\n throw new WalkError(error, directory);\n }\n}\n","// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileOrDirectoryPath = (fileOrDirectoryPath: any): void => {\n if (!fileOrDirectoryPath || (!(fileOrDirectoryPath instanceof URL) && typeof fileOrDirectoryPath !== \"string\")) {\n throw new TypeError(\"Path must be a non-empty string or URL.\");\n }\n};\n\nexport default assertValidFileOrDirectoryPath;\n","const globToRegExp = (glob: string): RegExp => {\n const reString = glob\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\.\\*/g, \".([^/]*)\") // Replace .* with .([^/]*)\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\*\\*/g, \"(.*)\") // Replace ** with (.*)\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/(?<!\\.)\\*(?!\\*)/g, \"([^/]*)\") // Replace * (not preceded by . or followed by *) with ([^/]*)\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\?/g, \"[^/]\") // Replace ? with [^/]\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\.(?!\\*)/g, \"\\\\.\") // Escape . that is not preceded by *\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\{/g, \"(\") // Replace { with (\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\}/g, \")\") // Replace } with )\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/,/g, \"|\") // Replace , with |\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\[!(.*?)\\]/g, \"[^$1]\"); // Replace [!number-number] with [^number-number]\n\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp,security/detect-non-literal-regexp\n return new RegExp(`^${reString}$`);\n};\n\nexport default globToRegExp;\n","const walkInclude = (path: string, extensions?: string[], match?: RegExp[], skip?: RegExp[]): boolean => {\n if (extensions && !extensions.some((extension): boolean => path.endsWith(extension))) {\n return false;\n }\n\n if (match && !match.some((pattern): boolean => pattern.test(path))) {\n return false;\n }\n\n return !(skip && skip.some((pattern): boolean => pattern.test(path)));\n};\n\nexport default walkInclude;\n","import type { WalkOptions } from \"./types\";\nimport walk from \"./walk\";\n\nconst collect = async (directory: string, options: WalkOptions = {}): Promise<string[]> => {\n const config = {\n extensions: [\"js\", \"mjs\", \"cjs\", \"ts\"],\n ...options,\n } as WalkOptions;\n\n const entries: string[] = [];\n\n // eslint-disable-next-line no-restricted-syntax,no-loops/no-loops\n for await (const entry of walk(directory, config)) {\n entries.push(entry.path);\n }\n\n return entries;\n};\n\nexport default collect;\n","// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.\n// Documentation and interface for walk were adapted from Go\n// https://golang.org/pkg/path/filepath/#Walk\n// Copyright 2009 The Go Authors. All rights reserved. BSD license.\n\nimport type { Stats } from \"node:fs\";\nimport { readdirSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, join, normalize, resolve } from \"node:path\";\n\nimport WalkError from \"./error/walk-error\";\nimport type { WalkEntry, WalkOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport globToRegExp from \"./utils/glob-to-regex\";\nimport toPath from \"./utils/to-path\";\nimport walkInclude from \"./utils/walk-include\";\n\n/** Create {@linkcode WalkEntry} for the `path` synchronously. */\n// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\nconst _createWalkEntry = (path: string): WalkEntry => {\n const normalizePath: string = normalize(path as string);\n\n const name = basename(normalizePath);\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const info: Stats = statSync(normalizePath);\n\n return {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: info.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: info.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: info.isSymbolicLink,\n name,\n path: normalizePath,\n };\n};\n\n/** Same as {@linkcode walk} but uses synchronous ops */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport default function* walkSync(\n directory: URL | string,\n {\n extensions,\n followSymlinks = false,\n includeDirs: includeDirectories = true,\n includeFiles = true,\n includeSymlinks = true,\n match,\n maxDepth = Number.POSITIVE_INFINITY,\n skip,\n }: WalkOptions = {},\n): IterableIterator<WalkEntry> {\n assertValidFileOrDirectoryPath(directory);\n\n if (maxDepth < 0) {\n return;\n }\n\n const mappedMatch = match ? match.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n const mappedSkip = skip ? skip.map((pattern): RegExp => (typeof pattern === \"string\" ? globToRegExp(pattern) : pattern)) : undefined;\n\n // eslint-disable-next-line no-param-reassign\n directory = resolve(toPath(directory));\n\n if (includeDirectories && walkInclude(directory, extensions, mappedMatch, mappedSkip)) {\n yield _createWalkEntry(directory);\n }\n\n if (maxDepth < 1 || !walkInclude(directory, undefined, undefined, mappedSkip)) {\n return;\n }\n\n try {\n // eslint-disable-next-line no-restricted-syntax,no-loops/no-loops,security/detect-non-literal-fs-filename\n for (const entry of readdirSync(directory, {\n withFileTypes: true,\n })) {\n let path = join(directory, entry.name);\n\n if (entry.isSymbolicLink()) {\n if (followSymlinks) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n path = realpathSync(path);\n } else if (includeSymlinks && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n } else {\n // eslint-disable-next-line no-continue\n continue;\n }\n }\n\n if (entry.isSymbolicLink() || entry.isDirectory()) {\n yield* walkSync(path, {\n extensions,\n followSymlinks,\n includeDirs: includeDirectories,\n includeFiles,\n includeSymlinks,\n match: mappedMatch,\n maxDepth: maxDepth - 1,\n skip: mappedSkip,\n } as WalkOptions);\n } else if (entry.isFile() && includeFiles && walkInclude(path, extensions, mappedMatch, mappedSkip)) {\n yield {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isDirectory: entry.isDirectory,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isFile: entry.isFile,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n isSymbolicLink: entry.isSymbolicLink,\n name: entry.name,\n path,\n };\n }\n }\n } catch (error) {\n if (error instanceof WalkError) {\n throw error;\n }\n\n throw new WalkError(error, directory);\n }\n}\n","import type { WalkOptions } from \"./types\";\nimport walkSync from \"./walk-sync\";\n\nconst collectSync = (directory: string, options: WalkOptions = {}): string[] => {\n const config = {\n extensions: [\"js\", \"mjs\", \"cjs\", \"ts\"],\n ...options,\n } as WalkOptions;\n\n const entries: string[] = [];\n\n // eslint-disable-next-line no-restricted-syntax,no-loops/no-loops\n for (const entry of walkSync(directory, config)) {\n entries.push(entry.path);\n }\n\n return entries;\n};\n\nexport default collectSync;\n","/** Is the path visible to the calling process? */\nexport const F_OK = 0; // constants?.F_OK\n\n/** Is the path readable to the calling process? */\nexport const R_OK = 4; // constants?.R_OK\n\n/** Is the path writable to the calling process? */\nexport const W_OK = 2; // constants?.W_OK\n\n/** Is the path executable to the calling process? */\nexport const X_OK = 1; // constants?.X_OK\n\nexport const FIND_UP_STOP = Symbol(\"findUpStop\");\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readdir, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport type { EmptyDirOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/**\n * Ensures that a directory is empty.\n * Deletes directory contents if the directory is not empty.\n * If the directory does not exist, it is created.\n * The directory itself is not deleted.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst emptyDir = async (dir: URL | string, options?: EmptyDirOptions): Promise<void> => {\n assertValidFileOrDirectoryPath(dir);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(dir)) {\n // if not exist. then create it\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await mkdir(dir, { recursive: true });\n\n return;\n }\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,security/detect-non-literal-fs-filename\n for await (const item of await readdir(dir)) {\n await rm(join(toPath(dir), item), { ...options, force: true, recursive: true });\n }\n}\n\nexport default emptyDir;\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport type { EmptyDirOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/**\n * Ensures that a directory is empty.\n * Deletes directory contents if the directory is not empty.\n * If the directory does not exist, it is created.\n * The directory itself is not deleted.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst emptyDir = (dir: URL | string, options?: EmptyDirOptions): void => {\n assertValidFileOrDirectoryPath(dir);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(dir)) {\n // if not exist. then create it\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n mkdirSync(dir, { recursive: true });\n\n return;\n }\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,security/detect-non-literal-fs-filename\n for (const item of readdirSync(dir)) {\n rmSync(join(toPath(dir), item), { ...options, force: true, recursive: true });\n }\n}\n\nexport default emptyDir;\n","import { platform } from \"node:process\";\n\nconst regDetect = /\\r?\\n/g;\n\n/** End-of-line character for POSIX platforms such as macOS and Linux. */\nexport const LF = \"\\n\" as const;\n\n/** End-of-line character for Windows platforms. */\nexport const CRLF = \"\\r\\n\" as const;\n\n/**\n * End-of-line character evaluated for the current platform.\n */\nexport const EOL: \"\\n\" | \"\\r\\n\" = platform === \"win32\" ? CRLF : LF;\n\n/**\n * Detect the EOL character for string input.\n * Returns null if no newline.\n */\nexport const detect = (content: string): typeof EOL | null => {\n const d = content.match(regDetect);\n\n if (!d || d.length === 0) {\n return null;\n }\n\n const crlf = d.filter((newline) => newline === CRLF).length;\n const lf = d.length - crlf;\n\n return crlf > lf ? CRLF : LF;\n};\n\n/**\n * Format the file to the targeted EOL.\n */\nexport const format = (content: string, eol: typeof EOL): string => content.replaceAll(regDetect, eol);\n","import { stat } from \"node:fs/promises\";\nimport { dirname, isAbsolute, parse, resolve } from \"node:path\";\n\nimport { FIND_UP_STOP } from \"./constants\";\nimport type { FindUpOptions, Match } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst findUp = async (\n name: ReadonlyArray<string> | string[] | string | ((directory: string) => Match | Promise<Match>),\n options: FindUpOptions = {},\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): Promise<string | undefined> => {\n if (typeof name !== \"string\" && !Array.isArray(name) && typeof name !== \"function\") {\n throw new TypeError(\"The `name` argument must be of type `string` or `string[]`\");\n }\n\n const cwd = options.cwd ? toPath(options.cwd) : process.cwd();\n\n assertValidFileOrDirectoryPath(cwd);\n\n let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\n\n assertValidFileOrDirectoryPath(stopPath);\n\n const stopAt = resolve(directory, stopPath);\n const type = options.type ?? \"file\";\n\n const getMatchers = async function (currentDirectory: string): Promise<(string | typeof FIND_UP_STOP | undefined)[]> {\n if (typeof name === \"function\") {\n const match = await name(currentDirectory);\n\n return [match];\n }\n\n if (typeof name === \"string\") {\n return [name];\n }\n\n if (Array.isArray(name)) {\n return name as string[];\n }\n\n return [name];\n };\n\n // eslint-disable-next-line no-loops/no-loops\n while (directory && directory !== stopAt && directory !== root) {\n // eslint-disable-next-line no-await-in-loop,no-loops/no-loops,no-restricted-syntax\n for await (const fileName of await getMatchers(directory)) {\n if (fileName === FIND_UP_STOP) {\n return undefined;\n }\n\n if (fileName === undefined) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const filePath = isAbsolute(fileName) ? fileName : resolve(directory, fileName);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stats = await stat(filePath);\n\n if ((type === \"file\" && stats.isFile()) || (type === \"directory\" && stats.isDirectory())) {\n return filePath;\n }\n } catch {\n /* empty */\n }\n }\n\n directory = dirname(directory);\n }\n\n return undefined;\n};\n\nexport default findUp;\n","import { statSync } from \"node:fs\";\nimport { dirname, isAbsolute, parse, resolve } from \"node:path\";\n\nimport { FIND_UP_STOP } from \"./constants\";\nimport type { FindUpOptions, Match } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst findUpSync = (\n name: ReadonlyArray<string> | string[] | string | ((directory: string) => Match),\n options: FindUpOptions = {},\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): string | undefined => {\n if (typeof name !== \"string\" && !Array.isArray(name) && typeof name !== \"function\") {\n throw new TypeError(\"The `name` argument must be of type `string` or `string[]`\");\n }\n\n const cwd = options.cwd ? toPath(options.cwd) : process.cwd();\n\n assertValidFileOrDirectoryPath(cwd);\n\n let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\n\n assertValidFileOrDirectoryPath(stopPath);\n\n const stopAt = resolve(directory, stopPath);\n const type = options.type ?? \"file\";\n\n const getMatchers = function (currentDirectory: string): (string | typeof FIND_UP_STOP | undefined)[] {\n if (typeof name === \"function\") {\n const match = name(currentDirectory);\n\n return [match];\n }\n\n if (typeof name === \"string\") {\n return [name];\n }\n\n if (Array.isArray(name)) {\n return name as string[];\n }\n\n return [name];\n };\n\n // eslint-disable-next-line no-loops/no-loops\n while (directory && directory !== stopAt && directory !== root) {\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const fileName of getMatchers(directory)) {\n if (fileName === FIND_UP_STOP) {\n return undefined;\n }\n\n if (fileName === undefined) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const filePath = isAbsolute(fileName) ? fileName : resolve(directory, fileName);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stats = statSync(filePath);\n\n if ((type === \"file\" && stats.isFile()) || (type === \"directory\" && stats.isDirectory())) {\n return filePath;\n }\n } catch {\n /* empty */\n }\n }\n\n directory = dirname(directory);\n }\n\n return undefined;\n};\n\nexport default findUpSync;\n","import { access } from \"node:fs/promises\";\n\nimport { F_OK } from \"./constants\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/** Returns a Promise that resolves to a boolean indicating if the path is accessible or not. */\nasync function isAccessible(path: URL | string, mode?: number): Promise<boolean>;\n// eslint-disable-next-line func-style\nasync function isAccessible(path: URL | string, mode: number = F_OK): Promise<boolean> {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n await access(path, mode);\n\n return true;\n } catch {\n return false;\n }\n}\n\nexport default isAccessible;\n","import { accessSync } from \"node:fs\";\n\nimport { F_OK } from \"./constants\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\n/** Returns a boolean indicating if the path is accessible or not. */\nfunction isAccessibleSync(path: URL | string, mode?: number): boolean;\n// eslint-disable-next-line func-style\nfunction isAccessibleSync(path: URL | string, mode: number = F_OK): boolean {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n accessSync(path, mode);\n\n return true;\n } catch {\n return false;\n }\n}\n\nexport default isAccessibleSync;\n","import { readFile as nodeReadFile } from \"node:fs/promises\";\nimport { brotliDecompress, unzip } from \"node:zlib\";\n\nimport { R_OK } from \"./constants\";\nimport PermissionError from \"./error/permission-error\";\nimport isAccessible from \"./is-accessible\";\nimport type { ContentType, ReadFileOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst decompressionMethods = {\n brotli: brotliDecompress,\n gzip: unzip,\n none: (buffer: Buffer, callback: (error: Error | null, result: Buffer) => void) => {\n callback(null, buffer);\n },\n} as const;\n\nconst readFile = async <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(\n path: URL | string,\n options?: O,\n): Promise<ContentType<O>> => {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n if (!(await isAccessible(path))) {\n throw new PermissionError(`unable to read the non-accessible file: ${path}`);\n }\n\n if (!(await isAccessible(path, R_OK))) {\n throw new Error(`Unable to read the non-readable file: ${path}`);\n }\n\n const { buffer, compression, encoding, flag } = options ?? {};\n\n // @ts-expect-error - TS doesn't like our typed `encoding` option\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n return await nodeReadFile(path, flag ? { encoding, flag } : { encoding })\n .then(\n async (content) =>\n // eslint-disable-next-line compat/compat\n await new Promise<ContentType<O> | undefined>((resolve, reject) => {\n decompressionMethods[compression ?? \"none\"](content, (error, result) => {\n if (error) {\n reject(error);\n } else {\n resolve((buffer ? result : result.toString()) as ContentType<O>);\n }\n });\n }),\n )\n .catch((error: unknown) => {\n throw error;\n });\n};\n\nexport default readFile;\n","import { readFileSync as nodeReadFileSync } from \"node:fs\";\nimport { brotliDecompressSync, unzipSync } from \"node:zlib\";\n\nimport { R_OK } from \"./constants\";\nimport PermissionError from \"./error/permission-error\";\nimport isAccessibleSync from \"./is-accessible-sync\";\nimport type { ContentType, ReadFileOptions } from \"./types\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\n\nconst decompressionMethods = {\n brotli: brotliDecompressSync,\n gzip: unzipSync,\n none: (buffer: Buffer) => buffer,\n} as const;\n\nconst readFileSync = <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(\n path: URL | string,\n options?: O,\n): ContentType<O> => {\n assertValidFileOrDirectoryPath(path);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n if (!isAccessibleSync(path)) {\n throw new PermissionError(`unable to read the non-accessible file: ${path}`);\n }\n\n if (!isAccessibleSync(path, R_OK)) {\n throw new PermissionError(`invalid access to read file at: ${path}`);\n }\n\n const { buffer, compression, encoding, flag } = options ?? {};\n\n // @ts-expect-error - TS doesn't like our typed `encoding` option\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const content = nodeReadFileSync(path, flag ? { encoding, flag } : { encoding });\n\n const decompressed = decompressionMethods[compression ?? \"none\"](content);\n\n return (buffer ? decompressed : decompressed.toString()) as ContentType<O>;\n};\n\nexport default readFileSync;\n","import type { JsonValue } from \"type-fest\";\n\nimport readFile from \"./read-file\";\nimport type { JsonReviver, ReadJsonOptions } from \"./types\";\nimport parseJson from \"./utils/parse-json\";\nimport toPath from \"./utils/to-path\";\n\nasync function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;\n\nasync function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;\n// eslint-disable-next-line func-style\nasync function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver | ReadJsonOptions, options?: ReadJsonOptions): Promise<T> {\n if (typeof reviver === \"object\") {\n // eslint-disable-next-line no-param-reassign\n options = reviver;\n // eslint-disable-next-line no-param-reassign\n reviver = undefined;\n }\n\n const content = await readFile(path, {\n buffer: true,\n encoding: undefined,\n });\n\n // Unlike `buffer.toString()` and `fs.readFile(path, 'utf8')`, `TextDecoder` will remove BOM.\n let data = new TextDecoder().decode(content);\n\n const { beforeParse, color } = options ?? {};\n\n if (typeof beforeParse === \"function\") {\n data = beforeParse(data);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJson;\n","import type { JsonValue } from \"type-fest\";\n\nimport readFileSync from \"./read-file-sync\";\nimport type { JsonReviver, ReadJsonOptions } from \"./types\";\nimport parseJson from \"./utils/parse-json\";\nimport toPath from \"./utils/to-path\";\n\nfunction readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;\n\nfunction readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;\n// eslint-disable-next-line func-style\nfunction readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver | ReadJsonOptions, options?: ReadJsonOptions): T {\n if (typeof reviver === \"object\") {\n // eslint-disable-next-line no-param-reassign\n options = reviver;\n // eslint-disable-next-line no-param-reassign\n reviver = undefined;\n }\n\n const content = readFileSync(path, {\n buffer: true,\n encoding: undefined,\n });\n\n // Unlike `buffer.toString()` and `fs.readFile(path, 'utf8')`, `TextDecoder` will remove BOM.\n let data = new TextDecoder().decode(content);\n\n const { beforeParse, color } = options ?? {};\n\n if (typeof beforeParse === \"function\") {\n data = beforeParse(data);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJsonSync;\n","import { parse } from \"yaml\";\n\nimport readFile from \"./read-file\";\nimport type { ReadYamlOptions, YamlReviver } from \"./types\";\n\nasync function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\">): Promise<R>;\nasync function readYaml<R = Record<string, unknown>>(\n path: URL | string,\n reviver?: YamlReviver,\n options?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\">,\n): Promise<R>;\n\n// eslint-disable-next-line func-style\nasync function readYaml<R = Record<string, unknown>>(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n reviver?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\"> | YamlReviver,\n options?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\">,\n): Promise<R> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const {\n buffer,\n compression,\n encoding = \"utf8\",\n flag,\n ...parseOptions\n } = options ?? {};\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const content = await readFile(path, { buffer, compression, encoding, flag });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return (typeof reviver === \"function\" ? parse(content, reviver, parseOptions) : parse(content, parseOptions)) as R;\n}\n\nexport default readYaml;\n","import { parse } from \"yaml\";\n\nimport readFileSync from \"./read-file-sync\";\nimport type { ReadYamlOptions, YamlReviver } from \"./types\";\n\nfunction readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\">): R;\nfunction readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\">): R;\n// eslint-disable-next-line func-style\nfunction readYamlSync<R = Record<string, unknown>>(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n reviver?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\"> | YamlReviver,\n options?: ReadYamlOptions<\"brotli\" | \"gzip\" | \"none\">,\n): R {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const {\n buffer,\n compression,\n encoding = \"utf8\",\n flag,\n ...parseOptions\n } = options ?? {};\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const content = readFileSync(path, { buffer, compression, encoding, flag });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return (typeof reviver === \"function\" ? parse(content, reviver, parseOptions) : parse(content, parseOptions)) as R;\n}\n\nexport default readYamlSync;\n","import type { Stats } from \"node:fs\";\nimport { chmod, chown, mkdir, rename, stat as nodeStat, unlink, writeFile as nodeWriteFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport { F_OK } from \"./constants\";\nimport isAccessible from \"./is-accessible\";\nimport type { WriteFileOptions } from \"./types\";\nimport assertValidFileContents from \"./utils/assert-valid-file-contents\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\nimport toUint8Array from \"./utils/to-uint-8-array\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeFile = async (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions): Promise<void> => {\n // eslint-disable-next-line no-param-reassign\n options = {\n encoding: \"utf8\",\n flag: \"w\",\n overwrite: true,\n recursive: true,\n ...options,\n };\n\n assertValidFileOrDirectoryPath(path);\n assertValidFileContents(content);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n const pathExists = await isAccessible(path, F_OK);\n\n if (!pathExists && options.recursive) {\n const directory = dirname(path);\n\n if (!(await isAccessible(directory, F_OK))) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await mkdir(directory, { recursive: true });\n }\n }\n\n let stat: Stats | undefined;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await nodeWriteFile(`${path}.tmp`, toUint8Array(content), { encoding: options.encoding, flag: options.flag });\n\n if (pathExists && !options.overwrite) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n stat = await nodeStat(path);\n\n if (options.chown === undefined) {\n // eslint-disable-next-line no-param-reassign\n options.chown = { gid: stat.gid, uid: stat.uid };\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await rename(path, `${path}.bak`);\n }\n\n const temporaryPath = `${path}.tmp`;\n\n if (options.chown) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await chown(temporaryPath, options.chown.uid, options.chown.gid);\n } catch {\n // On linux permissionless filesystems like exfat and fat32 the entire filesystem is normally owned by root,\n // and trying to chown it causes as permissions error.\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await chmod(temporaryPath, stat && !options.mode ? stat.mode : options.mode ?? 0o666);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await rename(temporaryPath, path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n throw new Error(`Failed to write file at: ${path} - ${error.message}`, { cause: error });\n } finally {\n if (await isAccessible(`${path}.tmp`)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await unlink(`${path}.tmp`);\n }\n }\n};\n\nexport default writeFile;\n","// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst assertValidFileContents = (contents: any): void => {\n if (typeof contents !== \"string\" && !(contents instanceof ArrayBuffer) && !ArrayBuffer.isView(contents)) {\n throw new TypeError(\"File contents must be a string, ArrayBuffer, or ArrayBuffer view.\");\n }\n};\n\nexport default assertValidFileContents;\n","const encoder = new TextEncoder();\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nconst toUint8Array = (contents: any) => {\n if (contents instanceof Uint8Array) {\n return contents;\n }\n\n if (typeof contents === \"string\") {\n return encoder.encode(contents);\n }\n\n if (contents instanceof ArrayBuffer) {\n return new Uint8Array(contents);\n }\n\n if (ArrayBuffer.isView(contents)) {\n const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);\n\n return new Uint8Array(bytes);\n }\n\n throw new TypeError(\"Invalid contents type. Expected string or ArrayBuffer.\");\n};\n\nexport default toUint8Array;\n","import type { Stats } from \"node:fs\";\nimport { chmodSync, chownSync, mkdirSync, renameSync, statSync, unlinkSync, writeFileSync as nodeWriteFileSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\nimport { F_OK } from \"./constants\";\nimport isAccessibleSync from \"./is-accessible-sync\";\nimport type { WriteFileOptions } from \"./types\";\nimport assertValidFileContents from \"./utils/assert-valid-file-contents\";\nimport assertValidFileOrDirectoryPath from \"./utils/assert-valid-file-or-directory-path\";\nimport toPath from \"./utils/to-path\";\nimport toUint8Array from \"./utils/to-uint-8-array\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeFileSync = (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions): void => {\n // eslint-disable-next-line no-param-reassign\n options = {\n encoding: \"utf8\",\n flag: \"w\",\n overwrite: true,\n recursive: true,\n ...options,\n };\n\n assertValidFileOrDirectoryPath(path);\n assertValidFileContents(content);\n\n // eslint-disable-next-line no-param-reassign\n path = toPath(path);\n\n try {\n const pathExists = isAccessibleSync(path, F_OK);\n\n if (!pathExists && options.recursive) {\n const directory = dirname(path);\n\n if (!isAccessibleSync(directory, F_OK)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n mkdirSync(directory, { recursive: true });\n }\n }\n\n let stat: Stats | undefined;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n nodeWriteFileSync(`${path}.tmp`, toUint8Array(content), { encoding: options.encoding, flag: options.flag });\n\n if (pathExists && !options.overwrite) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n stat = statSync(path);\n\n if (options.chown === undefined) {\n // eslint-disable-next-line no-param-reassign\n options.chown = { gid: stat.gid, uid: stat.uid };\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n renameSync(path, `${path}.bak`);\n }\n\n const temporaryPath = `${path}.tmp`;\n\n if (options.chown) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n chownSync(temporaryPath, options.chown.uid, options.chown.gid);\n } catch {\n // On linux permissionless filesystems like exfat and fat32 the entire filesystem is normally owned by root,\n // and trying to chown it causes as permissions error.\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n chmodSync(temporaryPath, stat && !options.mode ? stat.mode : options.mode ?? 0o666);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n renameSync(temporaryPath, path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n throw new Error(`Failed to write file at: ${path} - ${error.message}`, { cause: error });\n } finally {\n if (isAccessibleSync(`${path}.tmp`)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n unlinkSync(`${path}.tmp`);\n }\n }\n};\n\nexport default writeFileSync;\n","import { readFile } from \"node:fs/promises\";\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport detectIndentFn from \"detect-indent\";\n\nimport { R_OK } from \"./constants\";\nimport isAccessible from \"./is-accessible\";\nimport type { WriteJsonOptions } from \"./types\";\nimport writeFile from \"./write-file\";\n\nconst writeJson = async (path: URL | string, data: unknown, options: WriteJsonOptions = {}): Promise<void> => {\n const { detectIndent, indent: indentOption, replacer, stringify = JSON.stringify, ...writeOptions } = { indent: \"\\t\", ...options };\n\n let indent = indentOption;\n let trailingNewline = \"\\n\";\n\n if (await isAccessible(path, R_OK)) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const file = await readFile(path, \"utf8\");\n\n if (detectIndent) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment\n const { indent: dIndent } = detectIndentFn(file);\n\n indent = dIndent as string;\n }\n\n trailingNewline = file.endsWith(\"\\n\") ? \"\\n\" : \"\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code !== \"ENOENT\") {\n throw error;\n }\n }\n }\n\n // @ts-expect-error - `replacer` is a valid argument for `JSON.stringify`\n const json = stringify(data, replacer, indent);\n\n await writeFile(path, `${json}${trailingNewline}`, writeOptions);\n};\n\nexport default writeJson;\n","// Detect either spaces or tabs but not both to properly handle tabs for indentation and spaces for alignment\nconst INDENT_REGEX = /^(?:( )+|\\t+)/;\n\nconst INDENT_TYPE_SPACE = 'space';\nconst INDENT_TYPE_TAB = 'tab';\n\n/**\nMake a Map that counts how many indents/unindents have occurred for a given size and how many lines follow a given indentation.\n\nThe key is a concatenation of the indentation type (s = space and t = tab) and the size of the indents/unindents.\n\n```\nindents = {\n\tt3: [1, 0],\n\tt4: [1, 5],\n\ts5: [1, 0],\n\ts12: [1, 0],\n}\n```\n*/\nfunction makeIndentsMap(string, ignoreSingleSpaces) {\n\tconst indents = new Map();\n\n\t// Remember the size of previous line's indentation\n\tlet previousSize = 0;\n\tlet previousIndentType;\n\n\t// Indents key (ident type + size of the indents/unindents)\n\tlet key;\n\n\tfor (const line of string.split(/\\n/g)) {\n\t\tif (!line) {\n\t\t\t// Ignore empty lines\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet indent;\n\t\tlet indentType;\n\t\tlet use;\n\t\tlet weight;\n\t\tlet entry;\n\t\tconst matches = line.match(INDENT_REGEX);\n\n\t\tif (matches === null) {\n\t\t\tpreviousSize = 0;\n\t\t\tpreviousIndentType = '';\n\t\t} else {\n\t\t\tindent = matches[0].length;\n\t\t\tindentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;\n\n\t\t\t// Ignore single space unless it's the only indent detected to prevent common false positives\n\t\t\tif (ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && indent === 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (indentType !== previousIndentType) {\n\t\t\t\tpreviousSize = 0;\n\t\t\t}\n\n\t\t\tpreviousIndentType = indentType;\n\n\t\t\tuse = 1;\n\t\t\tweight = 0;\n\n\t\t\tconst indentDifference = indent - previousSize;\n\t\t\tpreviousSize = indent;\n\n\t\t\t// Previous line have same indent?\n\t\t\tif (indentDifference === 0) {\n\t\t\t\t// Not a new \"use\" of the current indent:\n\t\t\t\tuse = 0;\n\t\t\t\t// But do add a bit to it for breaking ties:\n\t\t\t\tweight = 1;\n\t\t\t\t// We use the key from previous loop\n\t\t\t} else {\n\t\t\t\tconst absoluteIndentDifference = indentDifference > 0 ? indentDifference : -indentDifference;\n\t\t\t\tkey = encodeIndentsKey(indentType, absoluteIndentDifference);\n\t\t\t}\n\n\t\t\t// Update the stats\n\t\t\tentry = indents.get(key);\n\t\t\tentry = entry === undefined ? [1, 0] : [entry[0] + use, entry[1] + weight];\n\n\t\t\tindents.set(key, entry);\n\t\t}\n\t}\n\n\treturn indents;\n}\n\n// Encode the indent type and amount as a string (e.g. 's4') for use as a compound key in the indents Map.\nfunction encodeIndentsKey(indentType, indentAmount) {\n\tconst typeCharacter = indentType === INDENT_TYPE_SPACE ? 's' : 't';\n\treturn typeCharacter + String(indentAmount);\n}\n\n// Extract the indent type and amount from a key of the indents Map.\nfunction decodeIndentsKey(indentsKey) {\n\tconst keyHasTypeSpace = indentsKey[0] === 's';\n\tconst type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;\n\n\tconst amount = Number(indentsKey.slice(1));\n\n\treturn {type, amount};\n}\n\n// Return the key (e.g. 's4') from the indents Map that represents the most common indent,\n// or return undefined if there are no indents.\nfunction getMostUsedKey(indents) {\n\tlet result;\n\tlet maxUsed = 0;\n\tlet maxWeight = 0;\n\n\tfor (const [key, [usedCount, weight]] of indents) {\n\t\tif (usedCount > maxUsed || (usedCount === maxUsed && weight > maxWeight)) {\n\t\t\tmaxUsed = usedCount;\n\t\t\tmaxWeight = weight;\n\t\t\tresult = key;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction makeIndentString(type, amount) {\n\tconst indentCharacter = type === INDENT_TYPE_SPACE ? ' ' : '\\t';\n\treturn indentCharacter.repeat(amount);\n}\n\nexport default function detectIndent(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError('Expected a string');\n\t}\n\n\t// Identify indents while skipping single space indents to avoid common edge cases (e.g. code comments)\n\t// If no indents are identified, run again and include all indents for comprehensive detection\n\tlet indents = makeIndentsMap(string, true);\n\tif (indents.size === 0) {\n\t\tindents = makeIndentsMap(string, false);\n\t}\n\n\tconst keyOfMostUsedIndent = getMostUsedKey(indents);\n\n\tlet type;\n\tlet amount = 0;\n\tlet indent = '';\n\n\tif (keyOfMostUsedIndent !== undefined) {\n\t\t({type, amount} = decodeIndentsKey(keyOfMostUsedIndent));\n\t\tindent = makeIndentString(type, amount);\n\t}\n\n\treturn {\n\t\tamount,\n\t\ttype,\n\t\tindent,\n\t};\n}\n","import { readFileSync } from \"node:fs\";\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport detectIndentFn from \"detect-indent\";\n\nimport { R_OK } from \"./constants\";\nimport isAccessibleSync from \"./is-accessible-sync\";\nimport type { WriteJsonOptions } from \"./types\";\nimport writeFileSync from \"./write-file-sync\";\n\nconst writeJsonSync = (path: URL | string, data: unknown, options: WriteJsonOptions = {}): void => {\n const { detectIndent, indent: indentOption, replacer, stringify = JSON.stringify, ...writeOptions } = { indent: \"\\t\", ...options };\n\n let indent = indentOption;\n let trailingNewline = \"\\n\";\n\n if (isAccessibleSync(path, R_OK)) {\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const file = readFileSync(path, \"utf8\");\n\n if (detectIndent) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment\n const { indent: dIndent } = detectIndentFn(file);\n\n indent = dIndent as string;\n }\n\n trailingNewline = file.endsWith(\"\\n\") ? \"\\n\" : \"\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code !== \"ENOENT\") {\n throw error;\n }\n }\n }\n\n // @ts-expect-error - `replacer` is a valid argument for `JSON.stringify`\n const json = stringify(data, replacer, indent);\n\n writeFileSync(path, `${json}${trailingNewline}`, writeOptions);\n};\n\nexport default writeJsonSync;\n","import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from \"yaml\";\nimport { stringify } from \"yaml\";\n\nimport type { YamlReplacer } from \"./types\";\nimport writeFile from \"./write-file\";\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype Options = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;\n\nasync function writeYaml(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any,\n options?: Options,\n): Promise<void>;\nasync function writeYaml(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any,\n replacer?: YamlReplacer,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n options?: Options | number | string,\n): Promise<void>;\n// eslint-disable-next-line func-style\nasync function writeYaml(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\n data: any,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n replacer?: Options | YamlReplacer,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n options?: Options | number | string,\n): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment\n const content = typeof replacer === \"function\" || Array.isArray(replacer) ? stringify(data, replacer, options) : stringify(data, replacer as YamlReplacer);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n await writeFile(path, content);\n}\n\nexport default writeYaml;\n","import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from \"yaml\";\nimport { stringify } from \"yaml\";\n\nimport type { YamlReplacer } from \"./types\";\nimport writeFileSync from \"./write-file-sync\";\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype Options = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;\n\nfunction writeYamlSync(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any,\n options?: Options,\n): void;\nfunction writeYamlSync(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any,\n replacer?: YamlReplacer,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n options?: Options | number | string,\n): void;\n// eslint-disable-next-line func-style\nfunction writeYamlSync(\n path: URL | string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\n data: any,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n replacer?: Options | YamlReplacer,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n options?: number | string | (CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions),\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment\n const content = typeof replacer === \"function\" || Array.isArray(replacer) ? stringify(data, replacer, options) : stringify(data, replacer as YamlReplacer);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n writeFileSync(path, content);\n}\n\nexport default writeYamlSync;\n"]}
@@ -1,4 +1,5 @@
1
1
  import { Dirent } from 'node:fs';
2
+ import { DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions } from 'yaml';
2
3
 
3
4
  declare const F_OK = 0;
4
5
  declare const R_OK = 4;
@@ -56,12 +57,13 @@ type WriteFileOptions = {
56
57
  overwrite?: boolean;
57
58
  recursive?: boolean;
58
59
  };
59
- type JsonReplacer = (this: unknown, key: string, value: unknown) => unknown;
60
+ type JsonReplacer = (number | string)[] | ((this: unknown, key: string, value: unknown) => unknown) | null;
61
+ type YamlReplacer = JsonReplacer;
60
62
  type WriteJsonOptions = WriteFileOptions & {
61
63
  detectIndent?: boolean;
62
64
  indent?: number | string | undefined;
63
- replacer?: (number | string)[] | JsonReplacer | null;
64
- stringify?: (data: unknown, replacer: JsonReplacer | null, space: number | string | undefined) => string;
65
+ replacer?: JsonReplacer;
66
+ stringify?: (data: unknown, replacer: JsonReplacer, space: number | string | undefined) => string;
65
67
  };
66
68
  type FindUpOptions = {
67
69
  cwd?: URL | string;
@@ -73,5 +75,7 @@ type EmptyDirOptions = {
73
75
  maxRetries?: number | undefined;
74
76
  retryDelay?: number | undefined;
75
77
  };
78
+ type ReadYamlOptions<C> = DocumentOptions & ParseOptions & ReadFileOptions<C> & SchemaOptions & ToJSOptions;
79
+ type YamlReviver = (key: unknown, value: unknown) => unknown;
76
80
 
77
- export { type ContentType as C, type EmptyDirOptions as E, type FindUpOptions as F, type JsonReviver as J, type Match as M, type ReadFileOptions as R, type WalkOptions as W, X_OK as X, type ReadJsonOptions as a, type WalkEntry as b, type WriteFileOptions as c, type WriteJsonOptions as d, F_OK as e, FIND_UP_STOP as f, R_OK as g, W_OK as h, type CodeFrameLocation as i, type JsonReplacer as j, type ReadFileEncoding as k, type CodeFrameOptions as l };
81
+ export { type ContentType as C, type EmptyDirOptions as E, type FindUpOptions as F, type JsonReviver as J, type Match as M, type ReadFileOptions as R, type WalkOptions as W, X_OK as X, type YamlReviver as Y, type ReadJsonOptions as a, type ReadYamlOptions as b, type WalkEntry as c, type WriteFileOptions as d, type WriteJsonOptions as e, type YamlReplacer as f, F_OK as g, FIND_UP_STOP as h, R_OK as i, W_OK as j, type CodeFrameLocation as k, type JsonReplacer as l, type ReadFileEncoding as m, type CodeFrameOptions as n };
@@ -1,4 +1,5 @@
1
1
  import { Dirent } from 'node:fs';
2
+ import { DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions } from 'yaml';
2
3
 
3
4
  declare const F_OK = 0;
4
5
  declare const R_OK = 4;
@@ -56,12 +57,13 @@ type WriteFileOptions = {
56
57
  overwrite?: boolean;
57
58
  recursive?: boolean;
58
59
  };
59
- type JsonReplacer = (this: unknown, key: string, value: unknown) => unknown;
60
+ type JsonReplacer = (number | string)[] | ((this: unknown, key: string, value: unknown) => unknown) | null;
61
+ type YamlReplacer = JsonReplacer;
60
62
  type WriteJsonOptions = WriteFileOptions & {
61
63
  detectIndent?: boolean;
62
64
  indent?: number | string | undefined;
63
- replacer?: (number | string)[] | JsonReplacer | null;
64
- stringify?: (data: unknown, replacer: JsonReplacer | null, space: number | string | undefined) => string;
65
+ replacer?: JsonReplacer;
66
+ stringify?: (data: unknown, replacer: JsonReplacer, space: number | string | undefined) => string;
65
67
  };
66
68
  type FindUpOptions = {
67
69
  cwd?: URL | string;
@@ -73,5 +75,7 @@ type EmptyDirOptions = {
73
75
  maxRetries?: number | undefined;
74
76
  retryDelay?: number | undefined;
75
77
  };
78
+ type ReadYamlOptions<C> = DocumentOptions & ParseOptions & ReadFileOptions<C> & SchemaOptions & ToJSOptions;
79
+ type YamlReviver = (key: unknown, value: unknown) => unknown;
76
80
 
77
- export { type ContentType as C, type EmptyDirOptions as E, type FindUpOptions as F, type JsonReviver as J, type Match as M, type ReadFileOptions as R, type WalkOptions as W, X_OK as X, type ReadJsonOptions as a, type WalkEntry as b, type WriteFileOptions as c, type WriteJsonOptions as d, F_OK as e, FIND_UP_STOP as f, R_OK as g, W_OK as h, type CodeFrameLocation as i, type JsonReplacer as j, type ReadFileEncoding as k, type CodeFrameOptions as l };
81
+ export { type ContentType as C, type EmptyDirOptions as E, type FindUpOptions as F, type JsonReviver as J, type Match as M, type ReadFileOptions as R, type WalkOptions as W, X_OK as X, type YamlReviver as Y, type ReadJsonOptions as a, type ReadYamlOptions as b, type WalkEntry as c, type WriteFileOptions as d, type WriteJsonOptions as e, type YamlReplacer as f, F_OK as g, FIND_UP_STOP as h, R_OK as i, W_OK as j, type CodeFrameLocation as k, type JsonReplacer as l, type ReadFileEncoding as m, type CodeFrameOptions as n };
package/dist/utils.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  export { J as JSONError } from './json-error-UVjLdb7z.cjs';
2
2
  import { JsonValue } from 'type-fest';
3
- import { l as CodeFrameOptions, J as JsonReviver } from './types-h2Rhl-Md.cjs';
3
+ import { n as CodeFrameOptions, J as JsonReviver } from './types-HVB0D8On.cjs';
4
4
  import 'node:fs';
5
+ import 'yaml';
5
6
 
6
7
  declare function parseJson<T = JsonValue>(string: string, filename?: string, options?: CodeFrameOptions): T;
7
8
  declare function parseJson<T = JsonValue>(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): T;
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export { J as JSONError } from './json-error-UVjLdb7z.js';
2
2
  import { JsonValue } from 'type-fest';
3
- import { l as CodeFrameOptions, J as JsonReviver } from './types-h2Rhl-Md.js';
3
+ import { n as CodeFrameOptions, J as JsonReviver } from './types-HVB0D8On.js';
4
4
  import 'node:fs';
5
+ import 'yaml';
5
6
 
6
7
  declare function parseJson<T = JsonValue>(string: string, filename?: string, options?: CodeFrameOptions): T;
7
8
  declare function parseJson<T = JsonValue>(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/fs",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Human friendly file system utilities for Node.js",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -29,9 +29,12 @@
29
29
  "path",
30
30
  "read",
31
31
  "read-file",
32
+ "read-yaml",
32
33
  "resolve",
33
34
  "safe",
34
35
  "search",
36
+ "std",
37
+ "standard",
35
38
  "up",
36
39
  "visulima",
37
40
  "walk",
@@ -39,7 +42,8 @@
39
42
  "write",
40
43
  "write-dir",
41
44
  "write-file",
42
- "write-safe"
45
+ "write-safe",
46
+ "yaml"
43
47
  ],
44
48
  "homepage": "https://www.visulima.com/docs/package/fs",
45
49
  "repository": {
@@ -154,7 +158,16 @@
154
158
  "tempy": "^3.1.0",
155
159
  "tsup": "^8.0.2",
156
160
  "typescript": "^5.4.2",
157
- "vitest": "^1.4.0"
161
+ "vitest": "^1.4.0",
162
+ "yaml": "^2.4.1"
163
+ },
164
+ "peerDependencies": {
165
+ "yaml": "^2.4.0"
166
+ },
167
+ "peerDependenciesMeta": {
168
+ "yaml": {
169
+ "optional": true
170
+ }
158
171
  },
159
172
  "engines": {
160
173
  "node": ">=18.* <=21.*"