/** * Functions which touch the filesystem * @module */ import type { JsonValue } from 'type-fest'; import type { MkDocsYml } from './model.js'; import { type NormalizedPackageJson, type PackageJson } from './utils/index.js'; /** * Stringifies a thing into a YAML * @param value Something to yamlify * @returns Some nice YAML 4 u */ export declare const stringifyYaml: (value: JsonValue) => string; /** * Pretty-stringifies a JSON value * @param value Something to stringify * @returns JSON string */ export declare const stringifyJson: (value: JsonValue) => string; /** * Finds a file from `cwd`. Searches up to the package root (dir containing `package.json`). * * @param filename Filename to look for * @param cwd Dir it should be in * @returns */ export declare function findInPkgDir(filename: string, cwd?: string): Promise; /** * Finds an `mkdocs.yml`, expected to be a sibling of `package.json` * * Caches the result. * @param cwd - Current working directory * @returns Path to `mkdocs.yml` */ export declare const findMkDocsYml: ((cwd?: any) => Promise) & { cache: Map>; }; /** * Given a directory path, finds closest `package.json` and reads it. * @param cwd - Current working directory * @param normalize - Whether or not to normalize the result. Defaults to `true`. * @returns A {@linkcode PackageJson} object if `normalize` is `false`, otherwise a {@linkcode NormalizedPackageJson} object */ declare function _readPkgJson(cwd: string, normalize?: true): Promise<{ pkgPath: string; pkg: NormalizedPackageJson; }>; declare function _readPkgJson(cwd: string, normalize: false): Promise<{ pkgPath: string; pkg: PackageJson; }>; /** * Given a directory to start from, reads a `package.json` file and returns its path and contents */ export declare const readPackageJson: typeof _readPkgJson & { cache: Map>; }; /** * Reads a JSON file and parses it */ export declare const readJson: ((filepath: string) => Promise) & { cache: Map>; }; /** * Writes contents to a file. Any JSON objects are stringified * @param filepath - Path to file * @param content - File contents */ export declare function writeFileString(filepath: string, content: JsonValue): Promise; /** * Check if `mkdocs` is installed */ export declare const isMkDocsInstalled: (() => Promise) & { cache: Map>; }; /** * `mike` cannot be invoked via `python -m`, so we need to find the script. */ export declare const findMike: () => Promise; /** * Finds the `python3` or `python` executable in the user's `PATH`. * * `python3` is preferred over `python`, since the latter could be Python 2. */ export declare const findPython: (() => Promise) & { cache: Map>; }; /** * Check if a path to Python exists, otherwise raise DocutilsError */ export declare function requirePython(pythonPath?: string): Promise; /** * Reads an `mkdocs.yml` file, merges inherited configs, and returns the result. The result is cached. * * **IMPORTANT**: The paths of `site_dir` and `docs_dir` are resolved to absolute paths, since they * are expressed as relative paths, and each inherited config file can live in different paths. * @param filepath Patgh to an `mkdocs.yml` file * @returns Parsed `mkdocs.yml` file */ export declare const readMkDocsYml: (filepath: string, cwd?: string) => Promise; export {}; //# sourceMappingURL=fs.d.ts.map