@visulima/fs 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/{chunk-2B2JUVOG.cjs → chunk-FYO7FPUG.cjs} +1 -1
- package/dist/{chunk-2B2JUVOG.cjs.map → chunk-FYO7FPUG.cjs.map} +1 -1
- package/dist/{chunk-DXCWJAJU.js → chunk-O3QEU6GI.js} +1 -1
- package/dist/{chunk-DXCWJAJU.js.map → chunk-O3QEU6GI.js.map} +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +5 -5
- package/dist/utils.js +1 -1
- package/package.json +6 -6
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts","../src/ensure/ensure-dir.ts","../src/utils/get-file-info-type.ts","../src/ensure/ensure-dir-sync.ts","../src/ensure/ensure-file.ts","../src/ensure/ensure-file-sync.ts","../src/ensure/ensure-link.ts","../src/utils/is-stats-identical.ts","../src/ensure/ensure-link-sync.ts","../src/eol.ts","../src/find/walk.ts","../src/utils/glob-to-regex.ts","../src/utils/walk-include.ts","../src/find/collect.ts","../src/find/walk-sync.ts","../src/find/collect-sync.ts","../src/find/find-up.ts","../src/find/find-up-sync.ts","../src/is-accessible.ts","../src/is-accessible-sync.ts","../src/read/read-file.ts","../src/read/read-file-sync.ts","../src/read/read-json.ts","../src/read/read-json-sync.ts","../src/read/read-yaml.ts","../src/read/read-yaml-sync.ts","../src/remove/empty-dir.ts","../src/remove/empty-dir-sync.ts","../src/remove/remove.ts","../src/remove/remove-sync.ts","../src/write/write-file.ts","../src/utils/to-uint-8-array.ts","../src/write/write-file-sync.ts","../src/write/write-json.ts","../../../node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js","../src/write/write-json-sync.ts","../src/write/write-yaml.ts","../src/write/write-yaml-sync.ts"],"names":["F_OK","R_OK","W_OK","X_OK","FIND_UP_STOP","lstat","mkdir","getFileInfoType","fileInfo","ensureDir","directory","assert_valid_file_or_directory_path_default","error","ensure_dir_default","lstatSync","mkdirSync","ensureDirSync","ensure_dir_sync_default","writeFile","dirname","ensureFile","filePath","stat","to_path_default","ensure_file_default","writeFileSync","ensureFileSync","ensure_file_sync_default","link","isStatsIdentical","sourceStat","destinationStat","is_stats_identical_default","ensureLink","source","destination","ensure_link_default","linkSync","ensureLinkSync","ensure_link_sync_default","platform","regDetect","LF","CRLF","EOL","detect","content","d","crlf","newline","lf","format","eol","readdir","realpath","basename","join","normalize","resolve","globToRegExp","glob","reString","glob_to_regex_default","walkInclude","path","extensions","match","skip","extension","pattern","walk_include_default","_createWalkEntry","normalizePath","name","info","walk","followSymlinks","includeDirectories","includeFiles","includeSymlinks","maxDepth","mappedMatch","mappedSkip","entry","walk_error_default","collect","options","config","entries","collect_default","readdirSync","realpathSync","statSync","walkSync","collectSync","collect_sync_default","parse","isAbsolute","findUp","cwd","root","stopPath","stopAt","type","getMatchers","currentDirectory","fileName","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","existsSync","rm","emptyDir","dir","item","empty_dir_default","rmSync","empty_dir_sync_default","unlink","remove","remove_default","unlinkSync","removeSync","remove_sync_default","chmod","chown","rename","nodeStat","nodeWriteFile","encoder","toUint8Array","contents","bytes","to_uint_8_array_default","assert_valid_file_contents_default","pathExists","temporaryPath","write_file_default","chmodSync","chownSync","renameSync","nodeWriteFileSync","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":"mIACO,IAAMA,EAAO,EAGPC,EAAO,EAGPC,GAAO,EAGPC,GAAO,EAEPC,EAAe,OAAO,YAAY,ECX/C,OAAS,SAAAC,EAAO,SAAAC,OAAa,mBCStB,IAAMC,EAAmBC,GAA0C,CACtE,GAAIA,EAAS,OAAO,EAChB,MAAO,OAGX,GAAIA,EAAS,YAAY,EACrB,MAAO,MAGX,GAAIA,EAAS,eAAe,EACxB,MAAO,SAIf,EDbA,IAAMC,GAAY,MAAOC,GAA2C,CAChEC,EAA+BD,CAAS,EAExC,GAAI,CAEA,IAAMF,EAAW,MAAMH,EAAMK,CAAS,EAEtC,GAAI,CAACF,EAAS,YAAY,EACtB,MAAM,IAAI,MAAM,4CAA4CD,EAAgBC,CAAQ,CAAC,GAAG,EAG5F,MAEJ,OAASI,EAAY,CAEjB,GAAIA,EAAM,OAAS,SACf,MAAMA,CAEd,CAIA,GAAI,CAEA,MAAMN,GAAMI,EAAW,CAAE,UAAW,EAAK,CAAC,CAE9C,OAASE,EAAY,CAEjB,GAAIA,EAAM,OAAS,SACf,MAAMA,EAIV,IAAMJ,EAAW,MAAMH,EAAMK,CAAS,EAEtC,GAAI,CAACF,EAAS,YAAY,EACtB,MAAM,IAAI,MAAM,4CAA4CD,EAAgBC,CAAQ,CAAC,GAAG,CAEhG,CACJ,EAEOK,EAAQJ,GEnDf,OAAS,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3B,GAAI,CAEA,IAAM6J,EAAOtF,GAAavE,EAAM,MAAM,EAEtC,GAAIqJ,EAAc,CACd,GAAM,CAAE,OAAQS,CAAQ,EAAIT,EAAeQ,CAAI,EAE/CzB,EAAS0B,CACb,CAEAF,EAAkBC,EAAK,SAAS;AAAA,CAAI,EAAI;AAAA,EAAO,EAEnD,OAASjN,EAAY,CAEjB,GAAIA,EAAM,OAAS,SACf,MAAMA,CAEd,CAIJ,IAAMmN,EAAOL,EAAU9E,EAAM6E,EAAUrB,CAAM,EAE7CZ,EAAcxH,EAAM,GAAG+J,CAAI,GAAGH,CAAe,GAAID,CAAY,CACjE,EAEOO,GAAQD,GC1Cf,OAAS,aAAAP,OAAiB,OAuB1B,eAAeS,GACXnK,EAEA4E,EAEA6E,EAEAnI,EACa,CACb,IAAMxC,EAAU,OAAO2K,GAAa,YAAc,MAAM,QAAQA,CAAQ,EAAIC,GAAU9E,EAAM6E,EAAUnI,CAAO,EAAIoI,GAAU9E,EAAM6E,CAAwB,EAEzJ,MAAMtC,EAAUnH,EAAMlB,CAAO,CACjC,CAEA,IAAOsL,GAAQD,GCrCf,OAAS,aAAAT,OAAiB,OAuB1B,SAASW,GACLrK,EAEA4E,EAEA6E,EAEAnI,EACI,CACJ,IAAMxC,EAAU,OAAO2K,GAAa,YAAc,MAAM,QAAQA,CAAQ,EAAIC,GAAU9E,EAAM6E,EAAUnI,CAAO,EAAIoI,GAAU9E,EAAM6E,CAAwB,EAEzJjC,EAAcxH,EAAMlB,CAAO,CAC/B,CAEA,IAAOwL,GAAQD","sourcesContent":["/** 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 { lstat, mkdir } from \"node:fs/promises\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\n\n/**\n * Ensures that the directory exists.\n * If the directory structure does not exist, it is created. Like mkdir -p.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst ensureDir = async (directory: URL | string): Promise<void> => {\n assertValidFileOrDirectoryPath(directory);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = await lstat(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n\n return;\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 // The dir doesn't exist. Create it.\n // This can be racy. So we catch AlreadyExists and check lstat again.\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await mkdir(directory, { recursive: true });\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 !== \"EEXIST\") {\n throw error;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = await lstat(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n }\n};\n\nexport default ensureDir;\n","import type { Stats } from \"node:fs\";\n\n// eslint-disable-next-line import/no-unused-modules\nexport type PathType = \"dir\" | \"file\" | \"symlink\";\n\n/**\n * Get a human-readable file type string.\n *\n * @param fileInfo A FileInfo describes a file and is returned by `stat`, `lstat`\n */\nexport const getFileInfoType = (fileInfo: Stats): PathType | undefined => {\n if (fileInfo.isFile()) {\n return \"file\";\n }\n\n if (fileInfo.isDirectory()) {\n return \"dir\";\n }\n\n if (fileInfo.isSymbolicLink()) {\n return \"symlink\";\n }\n\n return undefined;\n};\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { lstatSync, mkdirSync } from \"node:fs\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\n\n/**\n * Ensures that the directory exists.\n * If the directory structure does not exist, it is created. Like mkdir -p.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst ensureDirSync = (directory: URL | string): void => {\n assertValidFileOrDirectoryPath(directory);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = lstatSync(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n\n return;\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 // The dir doesn't exist. Create it.\n // This can be racy. So we catch AlreadyExists and check lstat again.\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n mkdirSync(directory, { recursive: true });\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 !== \"EEXIST\") {\n throw error;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = lstatSync(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n }\n};\n\nexport default ensureDirSync;\n","import { lstat, writeFile } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDir from \"./ensure-dir\";\n\n/**\n * Ensures that the file exists.\n * If the file that is requested to be created is in directories that do not exist,\n * these directories are created. If the file already exists, it is NOTMODIFIED.\n */\nconst ensureFile = async (filePath: URL | string): Promise<void> => {\n assertValidFileOrDirectoryPath(filePath);\n\n try {\n // if file exists\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stat = await lstat(filePath);\n\n if (!stat.isFile()) {\n throw new Error(`Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // if file not exists\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code === \"ENOENT\") {\n // ensure dir exists\n await ensureDir(dirname(toPath(filePath)));\n // create file\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await writeFile(filePath, new Uint8Array());\n\n return;\n }\n\n throw error;\n }\n};\n\nexport default ensureFile;\n","import { lstatSync, writeFileSync } from \"node:fs\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDirSync from \"./ensure-dir-sync\";\n\n/**\n * Ensures that the file exists.\n * If the file that is requested to be created is in directories that do not exist,\n * these directories are created. If the file already exists, it is NOTMODIFIED.\n */\nconst ensureFileSync = (filePath: URL | string): void => {\n assertValidFileOrDirectoryPath(filePath);\n\n try {\n // if file exists\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stat = lstatSync(filePath);\n\n if (!stat.isFile()) {\n throw new Error(`Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // if file not exists\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code === \"ENOENT\") {\n // ensure dir exists\n ensureDirSync(dirname(toPath(filePath)));\n // create file\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n writeFileSync(filePath, new Uint8Array());\n\n return;\n }\n\n throw error;\n }\n};\n\nexport default ensureFileSync;\n","import { link, lstat } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport isStatsIdentical from \"../utils/is-stats-identical\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDir from \"./ensure-dir\";\n\n/**\n * Ensures that the hard link exists.\n * If the directory structure does not exist, it is created.\n */\nconst ensureLink = async (source: URL | string, destination: URL | string): Promise<void> => {\n assertValidFileOrDirectoryPath(source);\n assertValidFileOrDirectoryPath(destination);\n\n let destinationStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n destinationStat = await lstat(destination);\n } catch {\n // ignore error\n }\n\n let sourceStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n sourceStat = await lstat(source);\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 error.message = error.message.replace(\"lstat\", \"ensureLink\");\n\n throw error;\n }\n\n if (destinationStat && isStatsIdentical(sourceStat, destinationStat)) {\n return;\n }\n\n await ensureDir(dirname(toPath(destination)));\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await link(source, destination);\n};\n\nexport default ensureLink;\n","import type { Stats } from \"node:fs\";\n\nconst isStatsIdentical = (sourceStat: Stats, destinationStat: Stats): boolean =>\n !!destinationStat.ino && !!destinationStat.dev && destinationStat.ino === sourceStat.ino && destinationStat.dev === sourceStat.dev;\n\nexport default isStatsIdentical;\n","import { linkSync, lstatSync } from \"node:fs\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport isStatsIdentical from \"../utils/is-stats-identical\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDirSync from \"./ensure-dir-sync\";\n\n/**\n * Ensures that the hard link exists.\n * If the directory structure does not exist, it is created.\n */\nconst ensureLinkSync = (source: URL | string, destination: URL | string): void => {\n assertValidFileOrDirectoryPath(source);\n assertValidFileOrDirectoryPath(destination);\n\n let destinationStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n destinationStat = lstatSync(destination);\n } catch {\n // ignore error\n }\n\n let sourceStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n sourceStat = lstatSync(source);\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 error.message = error.message.replace(\"lstat\", \"ensureLink\");\n\n throw error;\n }\n\n if (destinationStat && isStatsIdentical(sourceStat, destinationStat)) {\n return;\n }\n\n ensureDirSync(dirname(toPath(destination)));\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n linkSync(source, destination);\n};\n\nexport default ensureLinkSync;\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","// 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\";\n\nimport { basename, join, normalize, resolve } from \"pathe\";\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","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\";\n\nimport { basename, join, normalize, resolve } from \"pathe\";\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 // 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: basename(normalizePath),\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: normalize(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: normalize(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","import { stat } from \"node:fs/promises\";\nimport { parse } from \"node:path\";\n\nimport { dirname, isAbsolute, resolve } from \"pathe\";\n\nimport { FIND_UP_STOP } from \"../constants\";\nimport type { FindUpOptions, Match } from \"../types\";\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 let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\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 { parse } from \"node:path\";\n\nimport { dirname, isAbsolute, resolve } from \"pathe\";\n\nimport { FIND_UP_STOP } from \"../constants\";\nimport type { FindUpOptions, Match } from \"../types\";\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 let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\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 type { JsonReviver, ReadJsonOptions } from \"../types\";\nimport parseJson from \"../utils/parse-json\";\nimport toPath from \"../utils/to-path\";\nimport readFile from \"./read-file\";\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 return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJson;\n","import type { JsonValue } from \"type-fest\";\n\nimport type { JsonReviver, ReadJsonOptions } from \"../types\";\nimport parseJson from \"../utils/parse-json\";\nimport toPath from \"../utils/to-path\";\nimport readFileSync from \"./read-file-sync\";\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 return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJsonSync;\n","import { parse } from \"yaml\";\n\nimport type { ReadYamlOptions, YamlReviver } from \"../types\";\nimport readFile from \"./read-file\";\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 const { buffer, compression, encoding = \"utf8\", flag, ...parseOptions } = options ?? {};\n\n const content = await readFile(path, { buffer, compression, encoding, flag });\n\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 type { ReadYamlOptions, YamlReviver } from \"../types\";\nimport readFileSync from \"./read-file-sync\";\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 const { buffer, compression, encoding = \"utf8\", flag, ...parseOptions } = options ?? {};\n\n const content = readFileSync(path, { buffer, compression, encoding, flag });\n\n return (typeof reviver === \"function\" ? parse(content, reviver, parseOptions) : parse(content, parseOptions)) as R;\n}\n\nexport default readYamlSync;\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readdir, rm } from \"node:fs/promises\";\n\nimport { join } from \"pathe\";\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\";\n\nimport { join } from \"pathe\";\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 { rm, unlink } from \"node:fs/promises\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\n\nconst remove = async (\n path: URL | string,\n options: {\n /**\n * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or\n * `EPERM` error is encountered, Node.js will retry the operation with a linear\n * backoff wait of `retryDelay` ms longer on each try. This option represents the\n * number of retries. This option is ignored if the `recursive` option is not\n * `true`.\n * @default 0\n */\n maxRetries?: number | undefined;\n /**\n * The amount of time in milliseconds to wait between retries.\n * This option is ignored if the `recursive` option is not `true`.\n * @default 100\n */\n retryDelay?: number | undefined;\n } = {},\n): Promise<void> => {\n assertValidFileOrDirectoryPath(path);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await unlink(path);\n } catch {\n /* empty */\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n await rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });\n } catch {\n /* empty */\n }\n};\n\nexport default remove;\n","import { rmSync, unlinkSync } from \"node:fs\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\n\nconst removeSync = (\n path: URL | string,\n options: {\n /**\n * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or\n * `EPERM` error is encountered, Node.js will retry the operation with a linear\n * backoff wait of `retryDelay` ms longer on each try. This option represents the\n * number of retries. This option is ignored if the `recursive` option is not\n * `true`.\n * @default 0\n */\n maxRetries?: number | undefined;\n /**\n * The amount of time in milliseconds to wait between retries.\n * This option is ignored if the `recursive` option is not `true`.\n * @default 100\n */\n retryDelay?: number | undefined;\n } = {},\n): void => {\n assertValidFileOrDirectoryPath(path);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n unlinkSync(path);\n } catch {\n /* empty */\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n rmSync(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });\n } catch {\n /* empty */\n }\n};\n\nexport default removeSync;\n","import type { Stats } from \"node:fs\";\nimport { chmod, chown, mkdir, rename, stat as nodeStat, unlink, writeFile as nodeWriteFile } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\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","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\";\n\nimport { dirname } from \"pathe\";\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 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 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 const content = typeof replacer === \"function\" || Array.isArray(replacer) ? stringify(data, replacer, options) : stringify(data, replacer as YamlReplacer);\n\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 const content = typeof replacer === \"function\" || Array.isArray(replacer) ? stringify(data, replacer, options) : stringify(data, replacer as YamlReplacer);\n\n writeFileSync(path, content);\n}\n\nexport default writeYamlSync;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/ensure/ensure-dir.ts","../src/utils/get-file-info-type.ts","../src/ensure/ensure-dir-sync.ts","../src/ensure/ensure-file.ts","../src/ensure/ensure-file-sync.ts","../src/ensure/ensure-link.ts","../src/utils/is-stats-identical.ts","../src/ensure/ensure-link-sync.ts","../src/eol.ts","../src/find/walk.ts","../src/utils/glob-to-regex.ts","../src/utils/walk-include.ts","../src/find/collect.ts","../src/find/walk-sync.ts","../src/find/collect-sync.ts","../src/find/find-up.ts","../src/find/find-up-sync.ts","../src/is-accessible.ts","../src/is-accessible-sync.ts","../src/read/read-file.ts","../src/read/read-file-sync.ts","../src/read/read-json.ts","../src/read/read-json-sync.ts","../src/read/read-yaml.ts","../src/read/read-yaml-sync.ts","../src/remove/empty-dir.ts","../src/remove/empty-dir-sync.ts","../src/remove/remove.ts","../src/remove/remove-sync.ts","../src/write/write-file.ts","../src/utils/to-uint-8-array.ts","../src/write/write-file-sync.ts","../src/write/write-json.ts","../../../node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js","../src/write/write-json-sync.ts","../src/write/write-yaml.ts","../src/write/write-yaml-sync.ts"],"names":["F_OK","R_OK","W_OK","X_OK","FIND_UP_STOP","lstat","mkdir","getFileInfoType","fileInfo","ensureDir","directory","assert_valid_file_or_directory_path_default","error","ensure_dir_default","lstatSync","mkdirSync","ensureDirSync","ensure_dir_sync_default","writeFile","dirname","ensureFile","filePath","stat","to_path_default","ensure_file_default","writeFileSync","ensureFileSync","ensure_file_sync_default","link","isStatsIdentical","sourceStat","destinationStat","is_stats_identical_default","ensureLink","source","destination","ensure_link_default","linkSync","ensureLinkSync","ensure_link_sync_default","platform","regDetect","LF","CRLF","EOL","detect","content","d","crlf","newline","lf","format","eol","readdir","realpath","basename","join","normalize","resolve","globToRegExp","glob","reString","glob_to_regex_default","walkInclude","path","extensions","match","skip","extension","pattern","walk_include_default","_createWalkEntry","normalizePath","name","info","walk","followSymlinks","includeDirectories","includeFiles","includeSymlinks","maxDepth","mappedMatch","mappedSkip","entry","walk_error_default","collect","options","entries","collect_default","readdirSync","realpathSync","statSync","walkSync","collectSync","collect_sync_default","parse","isAbsolute","findUp","cwd","root","stopPath","stopAt","type","getMatchers","currentDirectory","fileName","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","existsSync","rm","emptyDir","dir","item","empty_dir_default","rmSync","empty_dir_sync_default","unlink","remove","remove_default","unlinkSync","removeSync","remove_sync_default","chmod","chown","rename","nodeStat","nodeWriteFile","encoder","toUint8Array","contents","bytes","to_uint_8_array_default","assert_valid_file_contents_default","pathExists","temporaryPath","write_file_default","chmodSync","chownSync","renameSync","nodeWriteFileSync","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":"mIACO,IAAMA,EAAO,EAGPC,EAAO,EAGPC,GAAO,EAGPC,GAAO,EAEPC,EAAe,OAAO,YAAY,ECX/C,OAAS,SAAAC,EAAO,SAAAC,OAAa,mBCStB,IAAMC,EAAmBC,GAA0C,CACtE,GAAIA,EAAS,OAAO,EAChB,MAAO,OAGX,GAAIA,EAAS,YAAY,EACrB,MAAO,MAGX,GAAIA,EAAS,eAAe,EACxB,MAAO,SAIf,EDbA,IAAMC,GAAY,MAAOC,GAA2C,CAChEC,EAA+BD,CAAS,EA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lB,CAAO,CACjC,CAEA,IAAOqL,GAAQD,GCrCf,OAAS,aAAAT,OAAiB,OAuB1B,SAASW,GACLpK,EAEA2E,EAEA6E,EAEAlI,EACI,CACJ,IAAMxC,EAAU,OAAO0K,GAAa,YAAc,MAAM,QAAQA,CAAQ,EAAIC,GAAU9E,EAAM6E,EAAUlI,CAAO,EAAImI,GAAU9E,EAAM6E,CAAwB,EAEzJjC,EAAcvH,EAAMlB,CAAO,CAC/B,CAEA,IAAOuL,GAAQD","sourcesContent":["/** 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 { lstat, mkdir } from \"node:fs/promises\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\n\n/**\n * Ensures that the directory exists.\n * If the directory structure does not exist, it is created. Like mkdir -p.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst ensureDir = async (directory: URL | string): Promise<void> => {\n assertValidFileOrDirectoryPath(directory);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = await lstat(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n\n return;\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 // The dir doesn't exist. Create it.\n // This can be racy. So we catch AlreadyExists and check lstat again.\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await mkdir(directory, { recursive: true });\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 !== \"EEXIST\") {\n throw error;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = await lstat(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n }\n};\n\nexport default ensureDir;\n","import type { Stats } from \"node:fs\";\n\n// eslint-disable-next-line import/no-unused-modules\nexport type PathType = \"dir\" | \"file\" | \"symlink\";\n\n/**\n * Get a human-readable file type string.\n *\n * @param fileInfo A FileInfo describes a file and is returned by `stat`, `lstat`\n */\nexport const getFileInfoType = (fileInfo: Stats): PathType | undefined => {\n if (fileInfo.isFile()) {\n return \"file\";\n }\n\n if (fileInfo.isDirectory()) {\n return \"dir\";\n }\n\n if (fileInfo.isSymbolicLink()) {\n return \"symlink\";\n }\n\n return undefined;\n};\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { lstatSync, mkdirSync } from \"node:fs\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\n\n/**\n * Ensures that the directory exists.\n * If the directory structure does not exist, it is created. Like mkdir -p.\n */\n// eslint-disable-next-line unicorn/prevent-abbreviations\nconst ensureDirSync = (directory: URL | string): void => {\n assertValidFileOrDirectoryPath(directory);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = lstatSync(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n\n return;\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 // The dir doesn't exist. Create it.\n // This can be racy. So we catch AlreadyExists and check lstat again.\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n mkdirSync(directory, { recursive: true });\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 !== \"EEXIST\") {\n throw error;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const fileInfo = lstatSync(directory);\n\n if (!fileInfo.isDirectory()) {\n throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);\n }\n }\n};\n\nexport default ensureDirSync;\n","import { lstat, writeFile } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDir from \"./ensure-dir\";\n\n/**\n * Ensures that the file exists.\n * If the file that is requested to be created is in directories that do not exist,\n * these directories are created. If the file already exists, it is NOTMODIFIED.\n */\nconst ensureFile = async (filePath: URL | string): Promise<void> => {\n assertValidFileOrDirectoryPath(filePath);\n\n try {\n // if file exists\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stat = await lstat(filePath);\n\n if (!stat.isFile()) {\n throw new Error(`Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // if file not exists\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code === \"ENOENT\") {\n // ensure dir exists\n await ensureDir(dirname(toPath(filePath)));\n // create file\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await writeFile(filePath, new Uint8Array());\n\n return;\n }\n\n throw error;\n }\n};\n\nexport default ensureFile;\n","import { lstatSync, writeFileSync } from \"node:fs\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport { getFileInfoType } from \"../utils/get-file-info-type\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDirSync from \"./ensure-dir-sync\";\n\n/**\n * Ensures that the file exists.\n * If the file that is requested to be created is in directories that do not exist,\n * these directories are created. If the file already exists, it is NOTMODIFIED.\n */\nconst ensureFileSync = (filePath: URL | string): void => {\n assertValidFileOrDirectoryPath(filePath);\n\n try {\n // if file exists\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const stat = lstatSync(filePath);\n\n if (!stat.isFile()) {\n throw new Error(`Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // if file not exists\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code === \"ENOENT\") {\n // ensure dir exists\n ensureDirSync(dirname(toPath(filePath)));\n // create file\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n writeFileSync(filePath, new Uint8Array());\n\n return;\n }\n\n throw error;\n }\n};\n\nexport default ensureFileSync;\n","import { link, lstat } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport isStatsIdentical from \"../utils/is-stats-identical\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDir from \"./ensure-dir\";\n\n/**\n * Ensures that the hard link exists.\n * If the directory structure does not exist, it is created.\n */\nconst ensureLink = async (source: URL | string, destination: URL | string): Promise<void> => {\n assertValidFileOrDirectoryPath(source);\n assertValidFileOrDirectoryPath(destination);\n\n let destinationStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n destinationStat = await lstat(destination);\n } catch {\n // ignore error\n }\n\n let sourceStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n sourceStat = await lstat(source);\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 error.message = error.message.replace(\"lstat\", \"ensureLink\");\n\n throw error;\n }\n\n if (destinationStat && isStatsIdentical(sourceStat, destinationStat)) {\n return;\n }\n\n await ensureDir(dirname(toPath(destination)));\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await link(source, destination);\n};\n\nexport default ensureLink;\n","import type { Stats } from \"node:fs\";\n\nconst isStatsIdentical = (sourceStat: Stats, destinationStat: Stats): boolean =>\n !!destinationStat.ino && !!destinationStat.dev && destinationStat.ino === sourceStat.ino && destinationStat.dev === sourceStat.dev;\n\nexport default isStatsIdentical;\n","import { linkSync, lstatSync } from \"node:fs\";\n\nimport { dirname } from \"pathe\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\nimport isStatsIdentical from \"../utils/is-stats-identical\";\nimport toPath from \"../utils/to-path\";\n// eslint-disable-next-line unicorn/prevent-abbreviations\nimport ensureDirSync from \"./ensure-dir-sync\";\n\n/**\n * Ensures that the hard link exists.\n * If the directory structure does not exist, it is created.\n */\nconst ensureLinkSync = (source: URL | string, destination: URL | string): void => {\n assertValidFileOrDirectoryPath(source);\n assertValidFileOrDirectoryPath(destination);\n\n let destinationStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n destinationStat = lstatSync(destination);\n } catch {\n // ignore error\n }\n\n let sourceStat;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n sourceStat = lstatSync(source);\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 error.message = error.message.replace(\"lstat\", \"ensureLink\");\n\n throw error;\n }\n\n if (destinationStat && isStatsIdentical(sourceStat, destinationStat)) {\n return;\n }\n\n ensureDirSync(dirname(toPath(destination)));\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n linkSync(source, destination);\n};\n\nexport default ensureLinkSync;\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","// 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\";\n\nimport { basename, join, normalize, resolve } from \"pathe\";\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","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 (Array.isArray(extensions) && extensions.length > 0 && !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 if (!Array.isArray(options.extensions)) {\n // eslint-disable-next-line no-param-reassign\n options.extensions = [\"js\", \"mjs\", \"cjs\", \"ts\"];\n }\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, options)) {\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\";\n\nimport { basename, join, normalize, resolve } from \"pathe\";\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 // 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: basename(normalizePath),\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: normalize(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: normalize(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 if (!Array.isArray(options.extensions)) {\n // eslint-disable-next-line no-param-reassign\n options.extensions = [\"js\", \"mjs\", \"cjs\", \"ts\"];\n }\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, options)) {\n entries.push(entry.path);\n }\n\n return entries;\n};\n\nexport default collectSync;\n","import { stat } from \"node:fs/promises\";\nimport { parse } from \"node:path\";\n\nimport { dirname, isAbsolute, resolve } from \"pathe\";\n\nimport { FIND_UP_STOP } from \"../constants\";\nimport type { FindUpOptions, Match } from \"../types\";\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 let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\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 { parse } from \"node:path\";\n\nimport { dirname, isAbsolute, resolve } from \"pathe\";\n\nimport { FIND_UP_STOP } from \"../constants\";\nimport type { FindUpOptions, Match } from \"../types\";\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 let directory = resolve(cwd);\n\n const { root } = parse(directory);\n const stopPath = toPath(options.stopAt ?? root);\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 type { JsonReviver, ReadJsonOptions } from \"../types\";\nimport parseJson from \"../utils/parse-json\";\nimport toPath from \"../utils/to-path\";\nimport readFile from \"./read-file\";\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 return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJson;\n","import type { JsonValue } from \"type-fest\";\n\nimport type { JsonReviver, ReadJsonOptions } from \"../types\";\nimport parseJson from \"../utils/parse-json\";\nimport toPath from \"../utils/to-path\";\nimport readFileSync from \"./read-file-sync\";\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 return parseJson<T>(data, reviver, toPath(path), { color });\n}\n\nexport default readJsonSync;\n","import { parse } from \"yaml\";\n\nimport type { ReadYamlOptions, YamlReviver } from \"../types\";\nimport readFile from \"./read-file\";\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 const { buffer, compression, encoding = \"utf8\", flag, ...parseOptions } = options ?? {};\n\n const content = await readFile(path, { buffer, compression, encoding, flag });\n\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 type { ReadYamlOptions, YamlReviver } from \"../types\";\nimport readFileSync from \"./read-file-sync\";\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 const { buffer, compression, encoding = \"utf8\", flag, ...parseOptions } = options ?? {};\n\n const content = readFileSync(path, { buffer, compression, encoding, flag });\n\n return (typeof reviver === \"function\" ? parse(content, reviver, parseOptions) : parse(content, parseOptions)) as R;\n}\n\nexport default readYamlSync;\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readdir, rm } from \"node:fs/promises\";\n\nimport { join } from \"pathe\";\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\";\n\nimport { join } from \"pathe\";\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 { rm, unlink } from \"node:fs/promises\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\n\nconst remove = async (\n path: URL | string,\n options: {\n /**\n * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or\n * `EPERM` error is encountered, Node.js will retry the operation with a linear\n * backoff wait of `retryDelay` ms longer on each try. This option represents the\n * number of retries. This option is ignored if the `recursive` option is not\n * `true`.\n * @default 0\n */\n maxRetries?: number | undefined;\n /**\n * The amount of time in milliseconds to wait between retries.\n * This option is ignored if the `recursive` option is not `true`.\n * @default 100\n */\n retryDelay?: number | undefined;\n } = {},\n): Promise<void> => {\n assertValidFileOrDirectoryPath(path);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n await unlink(path);\n } catch {\n /* empty */\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n await rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });\n } catch {\n /* empty */\n }\n};\n\nexport default remove;\n","import { rmSync, unlinkSync } from \"node:fs\";\n\nimport assertValidFileOrDirectoryPath from \"../utils/assert-valid-file-or-directory-path\";\n\nconst removeSync = (\n path: URL | string,\n options: {\n /**\n * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or\n * `EPERM` error is encountered, Node.js will retry the operation with a linear\n * backoff wait of `retryDelay` ms longer on each try. This option represents the\n * number of retries. This option is ignored if the `recursive` option is not\n * `true`.\n * @default 0\n */\n maxRetries?: number | undefined;\n /**\n * The amount of time in milliseconds to wait between retries.\n * This option is ignored if the `recursive` option is not `true`.\n * @default 100\n */\n retryDelay?: number | undefined;\n } = {},\n): void => {\n assertValidFileOrDirectoryPath(path);\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n unlinkSync(path);\n } catch {\n /* empty */\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n rmSync(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });\n } catch {\n /* empty */\n }\n};\n\nexport default removeSync;\n","import type { Stats } from \"node:fs\";\nimport { chmod, chown, mkdir, rename, stat as nodeStat, unlink, writeFile as nodeWriteFile } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\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","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\";\n\nimport { dirname } from \"pathe\";\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 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 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 const content = typeof replacer === \"function\" || Array.isArray(replacer) ? stringify(data, replacer, options) : stringify(data, replacer as YamlReplacer);\n\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 const content = typeof replacer === \"function\" || Array.isArray(replacer) ? stringify(data, replacer, options) : stringify(data, replacer as YamlReplacer);\n\n writeFileSync(path, content);\n}\n\nexport default writeYamlSync;\n"]}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFYO7FPUG_cjs = require('./chunk-FYO7FPUG.cjs');
|
|
4
4
|
var chunkN5NZURYL_cjs = require('./chunk-N5NZURYL.cjs');
|
|
5
5
|
|
|
6
6
|
var p=(t,{whitespace:e=!0}={})=>t.replace(i,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:e?r.replaceAll(/\S/g," "):""),i=/"(?:[^"\\]|\\.)*"?|\/\/[^\r\n]*|\/\*(?:[^*]|\*[^/])*(?:\*\/)?/g,d=p;
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, 'assertValidFileContents', {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkFYO7FPUG_cjs.d; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, 'assertValidFileOrDirectoryPath', {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkFYO7FPUG_cjs.a; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, 'parseJson', {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkFYO7FPUG_cjs.c; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, 'toPath', {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkFYO7FPUG_cjs.b; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, 'JSONError', {
|
|
25
25
|
enumerable: true,
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as assertValidFileContents, a as assertValidFileOrDirectoryPath, c as parseJson, b as toPath } from './chunk-
|
|
1
|
+
export { d as assertValidFileContents, a as assertValidFileOrDirectoryPath, c as parseJson, b as toPath } from './chunk-O3QEU6GI.js';
|
|
2
2
|
export { a as JSONError } from './chunk-UPN3Y5W3.js';
|
|
3
3
|
|
|
4
4
|
var i=(t,{whitespace:e=!0}={})=>t.replace(d,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:e?r.replaceAll(/\S/g," "):""),d=/"(?:[^"\\]|\\.)*"?|\/\/[^\r\n]*|\/\*(?:[^*]|\*[^/])*(?:\*\/)?/g,u=i;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/fs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Human friendly file system utilities for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
135
|
"pathe": "^1.1.2",
|
|
136
|
-
"type-fest": "^4.
|
|
136
|
+
"type-fest": "^4.14.0"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
139
|
"@anolilab/eslint-config": "^15.0.3",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"@babel/core": "^7.24.3",
|
|
143
143
|
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
144
144
|
"@types/node": "18.18.14",
|
|
145
|
-
"@visulima/error": "3.2.
|
|
145
|
+
"@visulima/error": "3.2.4",
|
|
146
146
|
"@vitest/coverage-v8": "^1.4.0",
|
|
147
147
|
"@vitest/ui": "^1.4.0",
|
|
148
148
|
"cross-env": "^7.0.3",
|
|
@@ -152,15 +152,15 @@
|
|
|
152
152
|
"eslint-plugin-etc": "^2.0.3",
|
|
153
153
|
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
|
|
154
154
|
"eslint-plugin-mdx": "^3.1.5",
|
|
155
|
-
"eslint-plugin-vitest": "^0.
|
|
155
|
+
"eslint-plugin-vitest": "^0.4.0",
|
|
156
156
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
157
157
|
"fast-safe-stringify": "2.1.1",
|
|
158
158
|
"prettier": "^3.2.5",
|
|
159
159
|
"redos-detector": "^5.1.0",
|
|
160
160
|
"rimraf": "^5.0.5",
|
|
161
161
|
"safe-regex2": "^3.1.0",
|
|
162
|
-
"semantic-release": "^23.0.
|
|
163
|
-
"sort-package-json": "^2.
|
|
162
|
+
"semantic-release": "^23.0.6",
|
|
163
|
+
"sort-package-json": "^2.10.0",
|
|
164
164
|
"tempy": "^3.1.0",
|
|
165
165
|
"tsup": "^8.0.2",
|
|
166
166
|
"typescript": "^5.4.3",
|