mdrefine 0.2.0-rc.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/workspace/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5F,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIrF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAmBvE,6FAA6F;AAC7F,MAAM,OAAO,GAAG,IAAI,OAAO,EAAuC,CAAC;AACnE,sEAAsE;AACtE,SAAS,IAAI,CAAC,KAA+B,EAAE,KAAiC;IAC9E,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CA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IACH,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["import { access, lstat, readdir, readFile, realpath, open, unlink } from \"node:fs/promises\";\nimport type { FileHandle } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { constants, lstatSync, readFileSync, realpathSync, statSync } from \"node:fs\";\nimport type { Dirent, Stats } from \"node:fs\";\nimport type { ResolveOptions } from \"../core/types.js\";\nimport type { LookupResult, WorkspaceSource } from \"./index.js\";\nimport { randomBytes, randomUUID } from \"node:crypto\";\nimport ignore from \"ignore\";\nimport type { Ignore } from \"ignore\";\nimport { minimatch, Minimatch } from \"minimatch\";\nimport { exists, pathError, refusal, refusalText, systemErrorText } from \"./access.js\";\nimport type { RefusalCode } from \"./access.js\";\nimport { decodeText } from \"./encoding.js\";\nimport { excludesFile, ignoreSettings, optionalText, repositoryTop, trackedFiles } from \"./git.js\";\nimport { isMarkdownName } from \"./index.js\";\nimport { enclosingVault, isVault, lineBreakSetting } from \"./vault.js\";\nimport type { SettingsProblem, Vault } from \"./vault.js\";\n\n/** A path that discovery could not use and left out of the run. */\nexport interface Skipped {\n /** The directory or file, relative to the workspace root. */\n path: string;\n /** Whether a directory or a file was left out. */\n type: \"directory\" | \"file\";\n /**\n * The system's error code, `INVALID` for a settings file with unusable\n * content, or `IGNORED` for an input that was named but is ignored.\n */\n code: RefusalCode | \"INVALID\" | \"IGNORED\";\n /** What was skipped, why, and what follows from it. */\n message: string;\n}\n/** Names a path of the workspace, given relative to the root, as a message shows it. */\ntype PathText = (file: string) => string;\n/** The words of each skipped entry's message, with the paths it names left to the caller. */\nconst wording = new WeakMap<Skipped, (show: PathText) => string>();\n/** A skipped entry whose message names paths relative to the root. */\nfunction skip(entry: Omit<Skipped, \"message\">, words: (show: PathText) => string): Skipped {\n const item = { ...entry, message: words((file) => file) };\n wording.set(item, words);\n return item;\n}\n/**\n * The message of a skipped entry with each path of the workspace that it names\n * given by `show`, which receives the path relative to the root. The CLI's text\n * names them from the current directory.\n */\nexport function skippedMessage(item: Skipped, show: PathText): string {\n return wording.get(item)?.(show) ?? item.message;\n}\n/** A file of ignore rules as a message shows it: one outside the repository by its full path. */\nfunction showFile(show: PathText, file: string): string {\n return path.isAbsolute(file) ? file : show(file);\n}\n/**\n * Names of folders and files that discovery never enters or selects, wherever\n * they are. A link can still name what is in them; `unlistedLookup` finds it.\n */\nconst alwaysSkipped = new Set([\".git\", \".obsidian\", \"node_modules\", \"dist\", \"coverage\"]);\n/**\n * Whether letter case is ignored where the file system usually ignores it, as\n * those of Windows and macOS do by default. Git turns `core.ignorecase` on when\n * it creates a repository on such a file system, and `.gitignore` patterns\n * match accordingly; where Git cannot say, this stands in for the setting.\n */\nconst caseInsensitive = process.platform === \"win32\" || process.platform === \"darwin\";\n/**\n * Characters that make an input a pattern when no path of its name exists:\n * wildcards, a character class, a brace list, or an extended group.\n */\nconst patternCharacters = /[*?[{]|[!@+]\\(/;\n/**\n * How input patterns match, on every system: `/` separates folders and `\\`\n * escapes the next character; a name starting with a dot is matched like any\n * other, as discovery finds it; letter case is ignored where the file system\n * usually ignores it, as the `glob` package does.\n */\nconst patternOptions = { dot: true, nocomment: true, nonegate: true, nocase: caseInsensitive };\n/**\n * A file of Git ignore rules for the folder whose paths its patterns match: a\n * `.gitignore` for the folder that holds it, and a repository's\n * `info/exclude` or the global excludes file for the repository's top level.\n */\ninterface IgnoreLayer {\n /**\n * The folder, relative to the top level of the repository that holds the\n * workspace root, or to the root outside a repository; empty for that folder.\n */\n base: string;\n /** The file, as messages name it. */\n file: string;\n /** The file's text. */\n text: string;\n /** Whether its patterns match without regard to letter case, as its repository says. */\n ignoreCase: boolean;\n matcher: Ignore;\n}\n/** A gitignore pattern that matches exactly one folder, at a path relative to the file's folder. */\nfunction folderOnly(folder: string): string {\n return `/${folder.replace(/[\\\\*?[]/g, \"\\\\$&\")}/`;\n}\n/**\n * The matchers for the entries of the folder `at`, relative to where the\n * layers' folders are, one for each file of rules above them, nearest last,\n * with the path from that file's folder. Git asks each file only whether its\n * patterns match the path itself; that nothing below an excluded folder counts\n * is settled by the walk, which never enters one. The `ignore` package also\n * answers that a path is ignored when the file's patterns exclude a folder\n * above it, which is wrong when a deeper `.gitignore` included that folder\n * again. For such a folder, the file's patterns are tested with each folder on\n * the way marked as included.\n */\nfunction ignoreScopes(at: string, layers: IgnoreLayer[]) {\n return layers.map((layer) => {\n const inner = at.slice(layer.base ? layer.base.length + 1 : 0);\n let { matcher } = layer;\n if (inner && matcher.test(`${inner}/`).ignored) {\n const folders = inner\n .split(\"/\")\n .map((_, index, parts) => parts.slice(0, index + 1).join(\"/\"));\n matcher = ignore({ ignorecase: layer.ignoreCase })\n .add(layer.text)\n .add(folders.map((folder) => `!${folderOnly(folder)}`));\n }\n return { layer, matcher, prefix: inner ? `${inner}/` : \"\" };\n });\n}\n/**\n * The file and pattern that exclude an entry, or undefined when none does: the\n * nearest file whose patterns match the entry decides, and a negated pattern\n * includes it.\n */\nfunction gitIgnoreRule(\n scopes: ReturnType<typeof ignoreScopes>,\n entry: string,\n directory: boolean,\n): { file: string; pattern: string } | undefined {\n for (let index = scopes.length - 1; index >= 0; index--) {\n const { layer, matcher, prefix } = scopes[index]!;\n const result = matcher.test(prefix + entry + (directory ? \"/\" : \"\"));\n if (result.ignored) return { file: layer.file, pattern: result.rule?.pattern ?? \"\" };\n if (result.unignored) return undefined;\n }\n return undefined;\n}\n/**\n * The layer of the rules `text`, read from `file`, for the folder `base`, in a\n * repository that ignores letter case or not.\n */\nfunction ignoreLayer(base: string, file: string, text: string, ignoreCase: boolean): IgnoreLayer {\n return { base, file, text, ignoreCase, matcher: ignore({ ignorecase: ignoreCase }).add(text) };\n}\n/** A path that the user named among the inputs. */\ninterface NamedInput {\n /** The real path, relative to the root. */\n path: string;\n directory: boolean;\n /** Why discovery leaves it out, when it does, naming paths through `show`. */\n reason?: (show: PathText) => string;\n}\n/** An input that is a pattern, with one matcher of paths from the root for each brace alternative. */\ninterface PatternInput {\n input: string;\n matchers: Minimatch[];\n /** The folders, relative to the root, that the alternatives' literal parts name. */\n folders: string[];\n matched: boolean;\n}\n/**\n * An input that names no existing path, read as a pattern relative to `base`.\n * The literal folders at the start of each alternative are located as a path\n * is, so the pattern can match paths from the workspace root. Undefined for an\n * input without pattern characters.\n */\nasync function patternInput(\n input: string,\n root: string,\n base: string,\n): Promise<PatternInput | undefined> {\n if (!patternCharacters.test(input)) return undefined;\n const result: PatternInput = { input, matchers: [], folders: [], matched: false };\n for (const alternative of minimatch.braceExpand(input)) {\n const parts = alternative.split(\"/\");\n let literal = 0;\n while (\n literal < parts.length - 1 &&\n !patternCharacters.test(parts[literal]!) &&\n !parts[literal]!.includes(\"\\\\\")\n )\n literal++;\n const prefix = parts.slice(0, literal).join(\"/\");\n // A pattern that starts with `/` or with a drive and `/`, such as `C:/`,\n // starts at that root: `C:` alone names the drive's current folder.\n const start = literal && /^(?:[A-Za-z]:)?$/.test(prefix) ? `${prefix}/` : prefix || \".\";\n let folder: string;\n try {\n folder = await realpath(path.resolve(base, start));\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n // A folder that is not there holds nothing that could match.\n if (code === \"ENOENT\" || code === \"ENOTDIR\") continue;\n throw pathError(\"Input\", input, error);\n }\n const relative = path.relative(root, folder).split(path.sep).join(\"/\");\n if (relative.startsWith(\"../\") || relative === \"..\" || path.isAbsolute(relative))\n throw new Error(`Input is outside the workspace: ${input}`);\n const rest = parts.slice(literal).join(\"/\");\n result.folders.push(relative);\n result.matchers.push(\n new Minimatch(relative ? `${relative.replace(/[\\\\*?[\\](){}!+@]/g, \"\\\\$&\")}/${rest}` : rest, {\n ...patternOptions,\n // The braces were expanded already; a folder's name may hold one.\n nobrace: true,\n }),\n );\n }\n return result;\n}\nexport interface FileSet {\n root: string;\n files: Record<string, WorkspaceSource>;\n directories: string[];\n /**\n * The entries below the root that discovery did not enter and that Git does\n * not ignore: folders and files of the names that it always leaves out, and\n * symbolic links and junctions. Their files are not in `files`, but a link\n * can name one.\n */\n unlisted: string[];\n /** What discovery could not read or use, sorted by path. */\n skipped: Skipped[];\n selected: string[];\n /**\n * The Obsidian vaults that hold documents of the workspace, sorted by path:\n * the one at or above the root, and each one in a folder that discovery\n * visited.\n */\n vaults: Vault[];\n}\n/**\n * The workspace's lookup of a path at or below one of the set's `unlisted`\n * entries, on disk: a link that names such a path is checked there instead of\n * being called missing. The workspace root still bounds what is read, so a\n * path whose real location lies outside it, through a symbolic link or a\n * junction, is reported as such and not read.\n */\nexport function unlistedLookup(\n set: FileSet,\n): (name: string, folded: boolean) => LookupResult | undefined {\n const exact = new Set(set.unlisted);\n // Obsidian matches paths without regard to case.\n const folded = new Map(set.unlisted.map((name) => [name.toLowerCase(), name]));\n return (name, fold) => {\n if (!set.unlisted.length) return undefined;\n const parts = name.split(\"/\");\n for (let count = 1; count <= parts.length; count++) {\n const prefix = parts.slice(0, count).join(\"/\");\n const entry = fold\n ? folded.get(prefix.toLowerCase())\n : exact.has(prefix)\n ? prefix\n : undefined;\n if (entry !== undefined) return onDisk(set.root, [entry, ...parts.slice(count)].join(\"/\"));\n }\n return undefined;\n };\n}\n/** What is at the path `name` below `root`, following links as far as the root allows. */\nfunction onDisk(root: string, name: string): LookupResult | undefined {\n const parts = name.split(\"/\");\n // Each step on the way, so that what stands in the way can be named.\n for (let count = 1; count <= parts.length; count++) {\n const step = parts.slice(0, count).join(\"/\");\n let actual: string;\n try {\n if (!lstatSync(path.join(root, step)).isSymbolicLink()) continue;\n actual = realpathSync.native(path.join(root, step));\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n // A path through something that is not there, or a link that leads nowhere.\n if (code === \"ENOENT\" || code === \"ENOTDIR\" || code === \"ELOOP\") return undefined;\n if (refusal(error))\n return { type: \"unreadable\", at: count > 1 ? parts.slice(0, count - 1).join(\"/\") : step };\n throw error;\n }\n const relative = path.relative(root, actual);\n if (relative === \"..\" || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n return { type: \"outside\", through: step };\n }\n let info: Stats;\n try {\n info = statSync(path.join(root, name));\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === \"ENOENT\" || code === \"ENOTDIR\" || code === \"ELOOP\") return undefined;\n if (refusal(error)) return { type: \"unreadable\", at: name };\n throw error;\n }\n if (info.isDirectory()) return { type: \"directory\" };\n const full = path.join(root, name);\n let cached: string | undefined;\n return {\n type: \"file\",\n path: name,\n source: isMarkdownName(name) ? () => (cached ??= decodeText(readFileSync(full), name)) : null,\n };\n}\n/** The workspace's record of the vault in `directory`, and of its settings file if unusable. */\nasync function describeVault(\n root: string,\n part: string,\n directory: string,\n): Promise<{ vault: Vault; skipped?: Skipped }> {\n const setting = await lineBreakSetting(directory);\n // Only the vault that holds the root can lie above it.\n const below = part ? \"\" : path.relative(directory, root).split(path.sep).join(\"/\");\n const vault: Vault = {\n path: part,\n ...(setting.value !== undefined ? { strictLineBreaks: setting.value } : {}),\n ...(below ? { rootInVault: below } : {}),\n };\n if (!setting.problem) return { vault };\n const problem: SettingsProblem = setting.problem;\n const file = path\n .relative(root, path.join(directory, \".obsidian\", \"app.json\"))\n .split(path.sep)\n .join(\"/\");\n return {\n vault,\n skipped: skip(\n { path: file, type: \"file\", code: problem.code },\n (show) =>\n `Skipped ${problem.code === \"INVALID\" ? \"unusable\" : \"unreadable\"} settings file: ${show(file)} (${problem.reason}). Obsidian's strictLineBreaks setting is not verified for that vault, so its documents are not reflowed.`,\n ),\n };\n}\n/**\n * The vault that holds the document `name` of the workspace, which need not\n * exist on disk: text read from stdin can be named into a folder that discovery\n * did not visit. The vault is found by searching upward from the document's\n * folder and is added to the set when it is new.\n */\nexport async function vaultFor(set: FileSet, name: string): Promise<Vault | undefined> {\n const directory = await enclosingVault(path.join(set.root, name));\n if (!directory) return undefined;\n const relative = path.relative(set.root, directory).split(path.sep).join(\"/\");\n const part =\n relative === \"..\" || relative.startsWith(\"../\") || path.isAbsolute(relative) ? \"\" : relative;\n const known = set.vaults.find((vault) => vault.path === part);\n if (known) return known;\n const described = await describeVault(set.root, part, directory);\n set.vaults.push(described.vault);\n if (described.skipped) set.skipped.push(described.skipped);\n return described.vault;\n}\n/**\n * Where Git's ignore rules for the workspace at `root` come from. They start at\n * `top`, the top level of the repository that holds the root, which can lie\n * above it; in each repository nested in the workspace, only its own rules\n * apply. What a repository tracks is never ignored.\n */\nfunction gitRules(root: string, top: string | undefined) {\n /** The root, relative to the repository's top level. */\n const lead = top ? path.relative(top, root).split(path.sep).join(\"/\") : \"\";\n /** A path relative to the root, relative to the repository's top level instead. */\n const fromTop = (relative: string) =>\n lead && relative ? `${lead}/${relative}` : lead || relative;\n /** How messages name a file of rules: from the root, or in full outside the repository. */\n function shown(file: string): string {\n const inside = path.relative(top ?? root, file);\n if (inside === \"..\" || inside.startsWith(`..${path.sep}`) || path.isAbsolute(inside))\n return file;\n return path.relative(root, file).split(path.sep).join(\"/\");\n }\n /** The file whose read failed, as messages name it. */\n const failed = (error: unknown, fallback: string) =>\n shown((error as NodeJS.ErrnoException).path ?? fallback);\n /**\n * The tracked files, from the top level, and the folders that hold them,\n * each kept as its repository compares letter case: as they are, or in lower\n * case.\n */\n const exact = { tracked: new Set<string>(), holding: new Set<string>() };\n const folded = { tracked: new Set<string>(), holding: new Set<string>() };\n /**\n * The rules for the top level of the repository in `directory`, `base` from\n * the outer repository's top level, with the lowest precedence first: the\n * global excludes file that the repository's settings name, then its\n * `info/exclude`; and whether its patterns ignore letter case. What the\n * repository tracks is recorded on the way.\n */\n async function repositoryLayers(\n directory: string,\n base: string,\n ): Promise<{ layers: IgnoreLayer[]; ignoreCase: boolean }> {\n const settings = ignoreSettings(directory).then(async (found) => ({\n ...found,\n text: found.excludesFile === undefined ? undefined : await optionalText(found.excludesFile),\n }));\n const listed = trackedFiles(directory);\n let text: string | undefined;\n let exclude: string | undefined;\n try {\n exclude = await excludesFile(directory);\n text = exclude === undefined ? undefined : await optionalText(exclude);\n } finally {\n // Git runs in the repository's folder, which Windows does not let anyone\n // remove until it is done, so discovery waits for it also after a failure.\n await Promise.allSettled([settings, listed]);\n }\n const global = await settings;\n // Where Git cannot say, case is compared as the file system usually does.\n const ignoreCase = global.ignoreCase ?? caseInsensitive;\n const sets = ignoreCase ? folded : exact;\n for (const name of (await listed) ?? []) {\n let at = base ? `${base}/${name}` : name;\n if (ignoreCase) at = at.toLowerCase();\n sets.tracked.add(at);\n for (\n at = path.posix.dirname(at);\n at !== \".\" && !sets.holding.has(at);\n at = path.posix.dirname(at)\n )\n sets.holding.add(at);\n }\n const layers: IgnoreLayer[] = [];\n if (global.text !== undefined)\n layers.push(ignoreLayer(base, shown(global.excludesFile!), global.text, ignoreCase));\n if (text !== undefined) layers.push(ignoreLayer(base, shown(exclude!), text, ignoreCase));\n return { layers, ignoreCase };\n }\n /** Whether a repository tracks the path `at`, from the top level, or a file in that folder. */\n function isTracked(at: string): boolean {\n if (exact.tracked.has(at) || exact.holding.has(at)) return true;\n if (!folded.tracked.size) return false;\n const lower = at.toLowerCase();\n return folded.tracked.has(lower) || folded.holding.has(lower);\n }\n return { lead, fromTop, shown, failed, repositoryLayers, isTracked };\n}\n/**\n * The files of the workspace at `rootPath`, and the documents that `supplied`\n * files, folders, and patterns select, or all of them when `supplied` is\n * empty. Relative inputs are resolved from `base`.\n *\n * A folder or pattern selects the Markdown files in it or matching it, by\n * name (`isMarkdownName`), that nothing ignores. A file named on its own is\n * selected whatever its name: naming it is the request. When ignore rules\n * leave out a named file or folder, `skipped` says so and why.\n */\nexport async function discover(\n rootPath: string,\n supplied: string[],\n excluded: string[],\n resolve: ResolveOptions = {},\n base = process.cwd(),\n): Promise<FileSet> {\n const root = await realpath(rootPath);\n let top: string | undefined;\n try {\n top = await repositoryTop(root);\n } catch (error) {\n const code = refusal(error);\n if (!code) throw error;\n // Only the root itself can refuse it: each folder above leads to the root.\n throw new Error(`Workspace root cannot be read: ${rootPath} (${refusalText(code)})`, {\n cause: error,\n });\n }\n const { lead, fromTop, shown, failed, repositoryLayers, isTracked } = gitRules(root, top);\n // Compiled once: compiling a pattern costs more than matching it.\n const ignorePatterns = excluded.map((pattern) => ({\n pattern,\n matcher: new Minimatch(pattern, { dot: true }),\n }));\n const files: Record<string, WorkspaceSource> = {};\n const directories: string[] = [];\n const unlisted: string[] = [];\n const selected: string[] = [];\n /** The folders that select their Markdown files, relative to the root. */\n const requests: string[] = [];\n /** The paths named as inputs, by their own path and that of each folder above them. */\n const named = new Map<string, NamedInput[]>();\n const namedInputs = new Map<string, NamedInput>();\n const patterns: PatternInput[] = [];\n /** Each input as given, with a path from the root that it names or searches. */\n const located: { input: string; path: string }[] = [];\n /** The folders that are vaults, by the part of the workspace that each holds. */\n const vaultFolders = new Map<string, string>();\n for (const input of supplied.length ? supplied : [root]) {\n const absolute = path.resolve(base, input);\n let resolved: string;\n let directory: boolean;\n try {\n const info = await lstat(absolute);\n if (info.isSymbolicLink()) throw new Error(`Refusing symbolic-link input: ${input}`);\n directory = info.isDirectory();\n resolved = await realpath(absolute);\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n const pattern =\n code === \"ENOENT\" || code === \"ENOTDIR\" ? await patternInput(input, root, base) : undefined;\n if (pattern) {\n patterns.push(pattern);\n for (const folder of pattern.folders) located.push({ input, path: folder });\n continue;\n }\n throw pathError(\"Input\", input, error);\n }\n const relative = path.relative(root, resolved).split(path.sep).join(\"/\");\n if (relative.startsWith(\"../\") || relative === \"..\" || path.isAbsolute(relative))\n throw new Error(`Input is outside the workspace: ${input}`);\n located.push({ input, path: relative });\n if (directory) requests.push(relative);\n if (!relative || namedInputs.has(relative)) continue;\n const request: NamedInput = { path: relative, directory };\n namedInputs.set(relative, request);\n for (let at = relative; at !== \".\"; at = path.posix.dirname(at)) {\n const list = named.get(at);\n if (list) list.push(request);\n else named.set(at, [request]);\n }\n }\n /**\n * Record why the entry `name` leaves out the named inputs at or below it for\n * which `applies` holds, unless something above it did already.\n */\n function leaveNamed(\n name: string,\n why: (input: NamedInput) => (show: PathText) => string,\n applies: (input: NamedInput) => boolean = () => true,\n ) {\n for (const request of named.get(name) ?? [])\n if (applies(request)) request.reason ??= why(request);\n }\n /** Whether Git's rules can leave out a named input: Git ignores nothing that it tracks. */\n const untracked = (input: NamedInput) => !isTracked(fromTop(input.path));\n /** Directories left out, with the path whose read the system refused. */\n const refused: { directory: string; reading: string; code: RefusalCode }[] = [];\n const reason = (item: { reading: string; code: RefusalCode }, subject: string) =>\n refusalText(item.code) + (item.reading === subject ? \"\" : ` for ${item.reading}`);\n /**\n * Leave out a directory that the system refuses to let the tool read. Any\n * other error is a fault and stops the run, and so does a refusal for the\n * workspace root, without which there is nothing to do.\n */\n function leaveOut(directory: string, reading: string, error: unknown): void {\n const code = refusal(error);\n if (!code) throw error;\n if (!directory)\n throw new Error(\n `Workspace root cannot be read: ${rootPath} (${reason({ reading, code }, \"\")})`,\n { cause: error },\n );\n refused.push({ directory, reading, code });\n }\n /** The rules that apply at the root, from the repository's top level down. */\n let rootLayers: IgnoreLayer[] = [];\n /** Whether the rules of the repository that holds the root ignore letter case. */\n let rootIgnoreCase = caseInsensitive;\n /** The folder at or above the root that Git ignores, from the top level, and the rule. */\n let ignoredRoot: { folder: string; file: string; pattern: string } | undefined;\n if (top) {\n try {\n ({ layers: rootLayers, ignoreCase: rootIgnoreCase } = await repositoryLayers(top, \"\"));\n const parts = lead ? lead.split(\"/\") : [];\n for (let index = 0; index < parts.length && !ignoredRoot; index++) {\n const at = parts.slice(0, index).join(\"/\");\n const file = path.join(top, ...parts.slice(0, index), \".gitignore\");\n const text = await optionalText(file);\n if (text !== undefined) rootLayers.push(ignoreLayer(at, shown(file), text, rootIgnoreCase));\n const rule = gitIgnoreRule(ignoreScopes(at, rootLayers), parts[index]!, true);\n if (rule) ignoredRoot = { folder: parts.slice(0, index + 1).join(\"/\"), ...rule };\n }\n } catch (error) {\n leaveOut(\"\", failed(error, path.join(top, \".git\")), error);\n }\n }\n /**\n * Visit a directory, whose repository's rules ignore letter case or not.\n * Below a folder that Git's rules exclude, nothing can be included again, as\n * in Git, except what Git tracks. Such a folder is visited for what it\n * tracks, and otherwise only for link targets.\n */\n async function walk(\n relative: string,\n inherited: IgnoreLayer[],\n ignoreCase: boolean,\n targetOnly = false,\n gitIgnoredAbove = false,\n ) {\n const directory = path.join(root, relative);\n const layers = [...inherited];\n const rules = path.join(directory, \".gitignore\");\n let entries: Dirent[];\n // What is being read: the directory itself, or its `.gitignore`. Without the\n // ignore rules nothing tells which of the directory's files may be touched.\n let reading = relative;\n try {\n if (!gitIgnoredAbove && (await exists(rules))) {\n reading = relative ? `${relative}/.gitignore` : \".gitignore\";\n const text = await readFile(rules, \"utf8\");\n layers.push(ignoreLayer(fromTop(relative), reading, text, ignoreCase));\n reading = relative;\n }\n entries = await readdir(directory, { withFileTypes: true });\n } catch (error) {\n leaveOut(relative, reading, error);\n return;\n }\n // Obsidian creates the settings folder itself; a link to one shares a vault's settings.\n const settings = entries.find((entry) => entry.name === \".obsidian\");\n if (settings?.isDirectory() || (settings?.isSymbolicLink() && (await isVault(directory))))\n vaultFolders.set(relative, directory);\n const scopes = gitIgnoredAbove ? [] : ignoreScopes(fromTop(relative), layers);\n for (const entry of entries) {\n const name = relative ? `${relative}/${entry.name}` : entry.name;\n const rule = gitIgnoredAbove\n ? undefined\n : gitIgnoreRule(scopes, entry.name, entry.isDirectory());\n const gitExcluded = gitIgnoredAbove || rule !== undefined;\n // Git ignores no file that it tracks, and no folder that holds one,\n // though the folder's other files stay ignored.\n const gitIgnored = gitExcluded && !isTracked(fromTop(name));\n const skippedName = alwaysSkipped.has(entry.name);\n if (skippedName || entry.isSymbolicLink()) {\n if (skippedName)\n leaveNamed(\n name,\n (input) => (show) =>\n input.path === name\n ? `discovery always leaves out ${entry.name}`\n : `in ${show(name)}, which discovery always leaves out`,\n );\n // Not entered, but a link can name what is in it or behind it, unless\n // Git ignores it and so its files are no link targets.\n if (!gitIgnored || resolve.gitIgnored === true) unlisted.push(name);\n continue;\n }\n if (rule)\n leaveNamed(\n name,\n (input) => (show) =>\n input.path === name\n ? `matched by \"${rule.pattern}\" in ${showFile(show, rule.file)}`\n : `in ${show(name)}, which \"${rule.pattern}\" in ${showFile(show, rule.file)} matches`,\n untracked,\n );\n if (gitIgnored && resolve.gitIgnored !== true) continue;\n const full = path.join(root, name);\n if (entry.isDirectory()) {\n directories.push(name);\n let nested: boolean;\n try {\n nested = await exists(path.join(full, \".git\"));\n } catch (error) {\n // A directory that cannot be entered: nothing in it can be read.\n leaveOut(name, name, error);\n continue;\n }\n if (nested)\n leaveNamed(\n name,\n (input) => (show) =>\n input.path === name ? \"a nested repository\" : `in ${show(name)}, a nested repository`,\n );\n if (nested && resolve.nestedRepositories !== true) continue;\n // Inside a nested repository, only its own rules and settings apply, as in Git.\n let inner = { layers, ignoreCase };\n if (nested && !gitIgnored)\n try {\n inner = await repositoryLayers(full, fromTop(name));\n } catch (error) {\n leaveOut(name, failed(error, path.join(full, \".git\")), error);\n continue;\n }\n await walk(\n name,\n inner.layers,\n inner.ignoreCase,\n targetOnly || gitIgnored || nested,\n nested && !gitIgnored ? false : gitExcluded,\n );\n } else if (entry.isFile()) {\n const request = named.get(name)?.find((input) => input.path === name && !input.directory);\n const markdown = isMarkdownName(name);\n let cached: string | undefined;\n files[name] =\n markdown || request ? () => (cached ??= decodeText(readFileSync(full), name)) : null;\n if (!(markdown || request) || targetOnly || gitIgnored) continue;\n const pattern = ignorePatterns.find((item) => item.matcher.match(name))?.pattern;\n if (pattern !== undefined) {\n if (request)\n request.reason ??= () => `matched by the configuration's ignore pattern \"${pattern}\"`;\n continue;\n }\n let chosen = request !== undefined;\n if (markdown) {\n chosen ||= requests.some(\n (folder) => !folder || name === folder || name.startsWith(`${folder}/`),\n );\n for (const item of patterns)\n if (item.matchers.some((matcher) => matcher.match(name))) chosen = item.matched = true;\n }\n if (chosen) selected.push(name);\n }\n }\n }\n await walk(\"\", rootLayers, rootIgnoreCase, false, ignoredRoot !== undefined);\n // Nothing that Git does not track is processed in a root that Git ignores.\n let rootIgnored: ((show: PathText) => string) | undefined;\n if (ignoredRoot) {\n const { file, pattern } = ignoredRoot;\n // The root itself, or a folder above it.\n const folder = path.posix.relative(lead, ignoredRoot.folder);\n const why = (show: PathText) =>\n folder\n ? `in ${show(folder)}, which \"${pattern}\" in ${showFile(show, file)} matches`\n : `matched by \"${pattern}\" in ${showFile(show, file)}`;\n for (const input of namedInputs.values())\n if (untracked(input))\n input.reason ??= folder ? why : (show) => `in the workspace root, which is ${why(show)}`;\n if (!namedInputs.size && !isTracked(lead)) rootIgnored = why;\n }\n // An input in a directory that was left out is an error: the user asked for it.\n for (const { input, path: request } of located) {\n const item = refused.find(\n ({ directory }) => request === directory || request.startsWith(`${directory}/`),\n );\n if (item) throw new Error(`Input cannot be read: ${input} (${reason(item, request)})`);\n }\n // A pattern stands for the documents it matches, so one that matches none is\n // an error, as a path that does not exist is.\n for (const item of patterns)\n if (!item.matched)\n throw new Error(\n `Input pattern matches no document: ${item.input}${\n item.input.includes(\"\\\\\") ? \" (patterns separate folders with /)\" : \"\"\n }`,\n );\n const skipped: Skipped[] = refused.map((item) =>\n skip(\n { path: item.directory, type: \"directory\", code: item.code },\n (show) =>\n `Skipped unreadable directory: ${show(item.directory)} (${refusalText(item.code)}${item.reading === item.directory ? \"\" : ` for ${showFile(show, item.reading)}`}). Its files are not processed, and links into it cannot be checked.`,\n ),\n );\n if (rootIgnored) {\n const why = rootIgnored;\n skipped.push(\n skip(\n { path: \".\", type: \"directory\", code: \"IGNORED\" },\n (show) =>\n `Skipped ignored workspace root: ${show(\".\") || \".\"} (${why(show)}). Its files are not processed.`,\n ),\n );\n }\n // A named input that ignore rules leave out is not an error, but the user asked for it.\n for (const input of namedInputs.values()) {\n const why = input.reason;\n if (why)\n skipped.push(\n skip(\n { path: input.path, type: input.directory ? \"directory\" : \"file\", code: \"IGNORED\" },\n (show) =>\n `Skipped ignored input: ${show(input.path)} (${why(show)}). ${input.directory ? \"Its files are\" : \"It is\"} not processed.`,\n ),\n );\n }\n // A root that is no vault itself can be a folder of one.\n if (!vaultFolders.has(\"\")) {\n const outer = await enclosingVault(root);\n if (outer) vaultFolders.set(\"\", outer);\n }\n const vaults: Vault[] = [];\n for (const [part, directory] of vaultFolders) {\n const described = await describeVault(root, part, directory);\n vaults.push(described.vault);\n if (described.skipped) skipped.push(described.skipped);\n }\n const byPath = (a: { path: string }, b: { path: string }) =>\n a.path < b.path ? -1 : a.path > b.path ? 1 : 0;\n return {\n root,\n files,\n directories,\n unlisted,\n skipped: skipped.sort(byPath),\n selected: selected.sort(),\n vaults: vaults.sort(byPath),\n };\n}\n/**\n * A file that `writeFormatted` would not write, or did not write completely,\n * with the reason in words that do not name it.\n */\nexport class ReplacementRefused extends Error {\n constructor(\n readonly reason: string,\n message: string,\n options?: ErrorOptions,\n ) {\n super(message, options);\n }\n}\n/**\n * Why `file` cannot be written, or undefined when nothing stands in the way\n * that can be seen before writing: the file may not be written, or its folder\n * does not let the trial file be created beside it. A read-only file is refused\n * on every platform: the flag marks a file that is not to be edited.\n */\nexport async function replacementProblem(file: string): Promise<string | undefined> {\n for (const [target, subject] of [\n [file, \"The file\"],\n [path.dirname(file), \"The file's folder\"],\n ] as const) {\n try {\n await access(target, constants.W_OK);\n } catch (error) {\n const text = systemErrorText(error);\n if (!text) throw error;\n return `${subject} may not be written (${text})`;\n }\n }\n return undefined;\n}\n/**\n * What went wrong when `writeFormatted` failed for a file, in words that do\n * not name it, or undefined for an error that is a fault of the tool.\n */\nexport function replacementFailure(error: unknown): string | undefined {\n if (error instanceof ReplacementRefused) return error.reason;\n const text = systemErrorText(error);\n return text ? `The file could not be written (${text}) and is unchanged` : undefined;\n}\n/** The refusal for a file whose bytes are no longer those that were read. */\nfunction changedOnDisk(file: string, when: string): ReplacementRefused {\n return new ReplacementRefused(\n \"The file changed on disk during formatting and was not written\",\n `File changed ${when}: ${file}`,\n );\n}\n/**\n * Show that `size` more bytes fit on the disk of `folder`, by writing a file\n * of that size there and removing it. It holds random bytes, not the\n * document's text: a file left behind by a crash then reveals nothing, and a\n * disk that compresses what it stores cannot make the trial smaller than the\n * write. Common file systems set aside the room when the bytes are written, so\n * the trial is not flushed to the disk; a file system that runs out of room only\n * then makes the write itself fail, and the file's content is written back.\n */\nasync function trialWrite(folder: string, size: number): Promise<void> {\n const trial = path.join(folder, `.mdtools-${randomUUID()}.tmp`);\n const handle = await open(trial, \"wx\", 0o600);\n try {\n await handle.writeFile(randomBytes(size));\n } finally {\n await handle.close();\n await unlink(trial).catch((error: NodeJS.ErrnoException) => {\n if (error.code !== \"ENOENT\") throw error;\n });\n }\n}\n/** Make the open file hold exactly `content`. */\nasync function overwrite(handle: FileHandle, content: Buffer): Promise<void> {\n for (let at = 0; at < content.length;)\n at += (await handle.write(content, at, content.length - at, at)).bytesWritten;\n await handle.truncate(content.length);\n await handle.sync();\n}\n/**\n * Write the formatted text `after` into `file`, whose text was read as\n * `before`, if the file still holds exactly the bytes that were read. The file\n * itself is written, not replaced by a new one, so that it keeps its\n * permissions, attributes, owner, creation time, and hard links, which Node.js\n * cannot all carry over to a new file. A trial write beside the file first shows that\n * the new content fits on the disk. The file is then checked through the open\n * file, just before writing. If writing fails part way, the bytes that were read\n * are written back, and the reason says whether that worked. A file that already\n * holds `after`, as the second name of a hard link written earlier in the batch\n * does, is left as it is.\n */\nexport async function writeFormatted(file: string, before: string, after: string): Promise<void> {\n const info = await lstat(file);\n if (!info.isFile() || info.isSymbolicLink())\n throw new ReplacementRefused(\n \"The file is not a regular file and was not written\",\n `Refusing non-regular file: ${file}`,\n );\n // The text was decoded from valid UTF-8, so encoding it again gives the bytes\n // that were read; comparing the text instead would miss a change to bytes that\n // decode to the same text.\n const expected = Buffer.from(before, \"utf8\");\n const content = Buffer.from(after, \"utf8\");\n const found = await readFile(file);\n if (found.equals(content)) return;\n if (!found.equals(expected)) throw changedOnDisk(file, \"during formatting\");\n await trialWrite(path.dirname(file), content.length);\n const handle = await open(file, \"r+\");\n try {\n // The path may lead to another file by now, such as through a link put in its place.\n const current = await handle.stat();\n if (current.ino !== info.ino || !(await handle.readFile()).equals(expected))\n throw changedOnDisk(file, \"before writing\");\n try {\n await overwrite(handle, content);\n } catch (error) {\n const text = systemErrorText(error);\n if (!text) throw error;\n let undone: string | undefined;\n try {\n await overwrite(handle, expected);\n } catch (again) {\n undone = systemErrorText(again);\n if (!undone) throw again;\n }\n throw new ReplacementRefused(\n undone === undefined\n ? `The file could not be written (${text}), and its content from before formatting was written back`\n : `The file could not be written (${text}), and writing its content from before formatting back failed too (${undone}); it may be incomplete`,\n `File written in part: ${file}`,\n { cause: error },\n );\n }\n } finally {\n await handle.close();\n }\n}\n"]}
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/workspace/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5F,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIrF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,E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, readFile, realpath, open, unlink } from \"node:fs/promises\";\nimport type { FileHandle } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { constants, lstatSync, readFileSync, realpathSync, statSync } from \"node:fs\";\nimport type { Dirent, Stats } from \"node:fs\";\nimport type { ResolveOptions } from \"../core/types.js\";\nimport type { LookupResult, WorkspaceSource } from \"./index.js\";\nimport { randomBytes, randomUUID } from \"node:crypto\";\nimport ignore from \"ignore\";\nimport type { Ignore } from \"ignore\";\nimport { minimatch, Minimatch } from \"minimatch\";\nimport { exists, pathError, refusal, refusalText, systemErrorText } from \"./access.js\";\nimport type { RefusalCode } from \"./access.js\";\nimport { decodeText } from \"./encoding.js\";\nimport { excludesFile, ignoreSettings, optionalText, repositoryTop, trackedFiles } from \"./git.js\";\nimport { isMarkdownName } from \"./index.js\";\nimport { enclosingVault, isVault, lineBreakSetting } from \"./vault.js\";\nimport type { SettingsProblem, Vault } from \"./vault.js\";\n\n/** A path that discovery could not use and left out of the run. */\nexport interface Skipped {\n /** The directory or file, relative to the workspace root. */\n path: string;\n /** Whether a directory or a file was left out. */\n type: \"directory\" | \"file\";\n /**\n * The system's error code, `INVALID` for a settings file with unusable\n * content, or `IGNORED` for an input that was named but is ignored.\n */\n code: RefusalCode | \"INVALID\" | \"IGNORED\";\n /** What was skipped, why, and what follows from it. */\n message: string;\n}\n/** Names a path of the workspace, given relative to the root, as a message shows it. */\ntype PathText = (file: string) => string;\n/** The words of each skipped entry's message, with the paths it names left to the caller. */\nconst wording = new WeakMap<Skipped, (show: PathText) => string>();\n/** A skipped entry whose message names paths relative to the root. */\nfunction skip(entry: Omit<Skipped, \"message\">, words: (show: PathText) => string): Skipped {\n const item = { ...entry, message: words((file) => file) };\n wording.set(item, words);\n return item;\n}\n/**\n * The message of a skipped entry with each path of the workspace that it names\n * given by `show`, which receives the path relative to the root. The CLI's text\n * names them from the current directory.\n */\nexport function skippedMessage(item: Skipped, show: PathText): string {\n return wording.get(item)?.(show) ?? item.message;\n}\n/** The skipped entries of named inputs that ignore rules leave out. */\nconst ignoredInputs = new WeakSet<Skipped>();\n/**\n * Whether a skipped entry reports a named file or folder that discovery leaves\n * out as ignored, a warning that the CLI's `--no-warn-ignored` leaves out. An\n * ignored workspace root is not one: no path named it, and none of its files is\n * processed.\n */\nexport function isIgnoredInput(item: Skipped): boolean {\n return ignoredInputs.has(item);\n}\n/** A file of ignore rules as a message shows it: one outside the repository by its full path. */\nfunction showFile(show: PathText, file: string): string {\n return path.isAbsolute(file) ? file : show(file);\n}\n/**\n * Names of folders and files that discovery never enters or selects, wherever\n * they are. A link can still name what is in them; `unlistedLookup` finds it.\n */\nconst alwaysSkipped = new Set([\".git\", \".obsidian\", \"node_modules\", \"dist\", \"coverage\"]);\n/**\n * Whether letter case is ignored where the file system usually ignores it, as\n * those of Windows and macOS do by default. Git turns `core.ignorecase` on when\n * it creates a repository on such a file system, and `.gitignore` patterns\n * match accordingly; where Git cannot say, this stands in for the setting.\n */\nconst caseInsensitive = process.platform === \"win32\" || process.platform === \"darwin\";\n/**\n * Characters that make an input a pattern when no path of its name exists:\n * wildcards, a character class, a brace list, or an extended group.\n */\nconst patternCharacters = /[*?[{]|[!@+]\\(/;\n/**\n * How input patterns match, on every system: `/` separates folders and `\\`\n * escapes the next character; a name starting with a dot is matched like any\n * other, as discovery finds it; letter case is ignored where the file system\n * usually ignores it, as the `glob` package does.\n */\nconst patternOptions = { dot: true, nocomment: true, nonegate: true, nocase: caseInsensitive };\n/**\n * A file of Git ignore rules for the folder whose paths its patterns match: a\n * `.gitignore` for the folder that holds it, and a repository's\n * `info/exclude` or the global excludes file for the repository's top level.\n */\ninterface IgnoreLayer {\n /**\n * The folder, relative to the top level of the repository that holds the\n * workspace root, or to the root outside a repository; empty for that folder.\n */\n base: string;\n /** The file, as messages name it. */\n file: string;\n /** The file's text. */\n text: string;\n /** Whether its patterns match without regard to letter case, as its repository says. */\n ignoreCase: boolean;\n matcher: Ignore;\n}\n/** A gitignore pattern that matches exactly one folder, at a path relative to the file's folder. */\nfunction folderOnly(folder: string): string {\n return `/${folder.replace(/[\\\\*?[]/g, \"\\\\$&\")}/`;\n}\n/**\n * The matchers for the entries of the folder `at`, relative to where the\n * layers' folders are, one for each file of rules above them, nearest last,\n * with the path from that file's folder. Git asks each file only whether its\n * patterns match the path itself; that nothing below an excluded folder counts\n * is settled by the walk, which never enters one. The `ignore` package also\n * answers that a path is ignored when the file's patterns exclude a folder\n * above it, which is wrong when a deeper `.gitignore` included that folder\n * again. For such a folder, the file's patterns are tested with each folder on\n * the way marked as included.\n */\nfunction ignoreScopes(at: string, layers: IgnoreLayer[]) {\n return layers.map((layer) => {\n const inner = at.slice(layer.base ? layer.base.length + 1 : 0);\n let { matcher } = layer;\n if (inner && matcher.test(`${inner}/`).ignored) {\n const folders = inner\n .split(\"/\")\n .map((_, index, parts) => parts.slice(0, index + 1).join(\"/\"));\n matcher = ignore({ ignorecase: layer.ignoreCase })\n .add(layer.text)\n .add(folders.map((folder) => `!${folderOnly(folder)}`));\n }\n return { layer, matcher, prefix: inner ? `${inner}/` : \"\" };\n });\n}\n/**\n * The file and pattern that exclude an entry, or undefined when none does: the\n * nearest file whose patterns match the entry decides, and a negated pattern\n * includes it.\n */\nfunction gitIgnoreRule(\n scopes: ReturnType<typeof ignoreScopes>,\n entry: string,\n directory: boolean,\n): { file: string; pattern: string } | undefined {\n for (let index = scopes.length - 1; index >= 0; index--) {\n const { layer, matcher, prefix } = scopes[index]!;\n const result = matcher.test(prefix + entry + (directory ? \"/\" : \"\"));\n if (result.ignored) return { file: layer.file, pattern: result.rule?.pattern ?? \"\" };\n if (result.unignored) return undefined;\n }\n return undefined;\n}\n/**\n * The layer of the rules `text`, read from `file`, for the folder `base`, in a\n * repository that ignores letter case or not.\n */\nfunction ignoreLayer(base: string, file: string, text: string, ignoreCase: boolean): IgnoreLayer {\n return { base, file, text, ignoreCase, matcher: ignore({ ignorecase: ignoreCase }).add(text) };\n}\n/** A path that the user named among the inputs. */\ninterface NamedInput {\n /** The real path, relative to the root. */\n path: string;\n directory: boolean;\n /** Whether it is only a supplied document's path, which selects nothing on disk. */\n document?: boolean;\n /** Why discovery leaves it out, when it does, naming paths through `show`. */\n reason?: (show: PathText) => string;\n}\n/** An input that is a pattern, with one matcher of paths from the root for each brace alternative. */\ninterface PatternInput {\n input: string;\n matchers: Minimatch[];\n /** The folders, relative to the root, that the alternatives' literal parts name. */\n folders: string[];\n matched: boolean;\n}\n/**\n * An input that names no existing path, read as a pattern relative to `base`.\n * The literal folders at the start of each alternative are located as a path\n * is, so the pattern can match paths from the workspace root. Undefined for an\n * input without pattern characters.\n */\nasync function patternInput(\n input: string,\n root: string,\n base: string,\n): Promise<PatternInput | undefined> {\n if (!patternCharacters.test(input)) return undefined;\n const result: PatternInput = { input, matchers: [], folders: [], matched: false };\n for (const alternative of minimatch.braceExpand(input)) {\n const parts = alternative.split(\"/\");\n let literal = 0;\n while (\n literal < parts.length - 1 &&\n !patternCharacters.test(parts[literal]!) &&\n !parts[literal]!.includes(\"\\\\\")\n )\n literal++;\n const prefix = parts.slice(0, literal).join(\"/\");\n // A pattern that starts with `/` or with a drive and `/`, such as `C:/`,\n // starts at that root: `C:` alone names the drive's current folder.\n const start = literal && /^(?:[A-Za-z]:)?$/.test(prefix) ? `${prefix}/` : prefix || \".\";\n let folder: string;\n try {\n folder = await realpath(path.resolve(base, start));\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n // A folder that is not there holds nothing that could match.\n if (code === \"ENOENT\" || code === \"ENOTDIR\") continue;\n throw pathError(\"Input\", input, error);\n }\n const relative = path.relative(root, folder).split(path.sep).join(\"/\");\n if (relative.startsWith(\"../\") || relative === \"..\" || path.isAbsolute(relative))\n throw new Error(`Input is outside the workspace: ${input}`);\n const rest = parts.slice(literal).join(\"/\");\n result.folders.push(relative);\n result.matchers.push(\n new Minimatch(relative ? `${relative.replace(/[\\\\*?[\\](){}!+@]/g, \"\\\\$&\")}/${rest}` : rest, {\n ...patternOptions,\n // The braces were expanded already; a folder's name may hold one.\n nobrace: true,\n }),\n );\n }\n return result;\n}\nexport interface FileSet {\n root: string;\n files: Record<string, WorkspaceSource>;\n directories: string[];\n /**\n * The entries below the root that discovery did not enter and that Git does\n * not ignore: folders and files of the names that it always leaves out, and\n * symbolic links and junctions. Their files are not in `files`, but a link\n * can name one.\n */\n unlisted: string[];\n /** What discovery could not read or use, sorted by path. */\n skipped: Skipped[];\n selected: string[];\n /**\n * The Obsidian vaults that hold documents of the workspace, sorted by path:\n * the one at or above the root, and each one in a folder that discovery\n * visited.\n */\n vaults: Vault[];\n}\n/**\n * The workspace's lookup of a path at or below one of the set's `unlisted`\n * entries, on disk: a link that names such a path is checked there instead of\n * being called missing. The workspace root still bounds what is read, so a\n * path whose real location lies outside it, through a symbolic link or a\n * junction, is reported as such and not read.\n */\nexport function unlistedLookup(\n set: FileSet,\n): (name: string, folded: boolean) => LookupResult | undefined {\n const exact = new Set(set.unlisted);\n // Obsidian matches paths without regard to case.\n const folded = new Map(set.unlisted.map((name) => [name.toLowerCase(), name]));\n return (name, fold) => {\n if (!set.unlisted.length) return undefined;\n const parts = name.split(\"/\");\n for (let count = 1; count <= parts.length; count++) {\n const prefix = parts.slice(0, count).join(\"/\");\n const entry = fold\n ? folded.get(prefix.toLowerCase())\n : exact.has(prefix)\n ? prefix\n : undefined;\n if (entry !== undefined) return onDisk(set.root, [entry, ...parts.slice(count)].join(\"/\"));\n }\n return undefined;\n };\n}\n/** What is at the path `name` below `root`, following links as far as the root allows. */\nfunction onDisk(root: string, name: string): LookupResult | undefined {\n const parts = name.split(\"/\");\n // Each step on the way, so that what stands in the way can be named.\n for (let count = 1; count <= parts.length; count++) {\n const step = parts.slice(0, count).join(\"/\");\n let actual: string;\n try {\n if (!lstatSync(path.join(root, step)).isSymbolicLink()) continue;\n actual = realpathSync.native(path.join(root, step));\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n // A path through something that is not there, or a link that leads nowhere.\n if (code === \"ENOENT\" || code === \"ENOTDIR\" || code === \"ELOOP\") return undefined;\n if (refusal(error))\n return { type: \"unreadable\", at: count > 1 ? parts.slice(0, count - 1).join(\"/\") : step };\n throw error;\n }\n const relative = path.relative(root, actual);\n if (relative === \"..\" || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n return { type: \"outside\", through: step };\n }\n let info: Stats;\n try {\n info = statSync(path.join(root, name));\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === \"ENOENT\" || code === \"ENOTDIR\" || code === \"ELOOP\") return undefined;\n if (refusal(error)) return { type: \"unreadable\", at: name };\n throw error;\n }\n if (info.isDirectory()) return { type: \"directory\" };\n const full = path.join(root, name);\n let cached: string | undefined;\n return {\n type: \"file\",\n path: name,\n source: isMarkdownName(name) ? () => (cached ??= decodeText(readFileSync(full), name)) : null,\n };\n}\n/** The workspace's record of the vault in `directory`, and of its settings file if unusable. */\nasync function describeVault(\n root: string,\n part: string,\n directory: string,\n): Promise<{ vault: Vault; skipped?: Skipped }> {\n const setting = await lineBreakSetting(directory);\n // Only the vault that holds the root can lie above it.\n const below = part ? \"\" : path.relative(directory, root).split(path.sep).join(\"/\");\n const vault: Vault = {\n path: part,\n ...(setting.value !== undefined ? { strictLineBreaks: setting.value } : {}),\n ...(below ? { rootInVault: below } : {}),\n };\n if (!setting.problem) return { vault };\n const problem: SettingsProblem = setting.problem;\n const file = path\n .relative(root, path.join(directory, \".obsidian\", \"app.json\"))\n .split(path.sep)\n .join(\"/\");\n return {\n vault,\n skipped: skip(\n { path: file, type: \"file\", code: problem.code },\n (show) =>\n `Skipped ${problem.code === \"INVALID\" ? \"unusable\" : \"unreadable\"} settings file: ${show(file)} (${problem.reason}). Obsidian's strictLineBreaks setting is not verified for that vault, so its documents are not reflowed.`,\n ),\n };\n}\n/**\n * The vault that holds the document `name` of the workspace, which need not\n * exist on disk: text read from stdin can be named into a folder that discovery\n * did not visit. The vault is found by searching upward from the document's\n * folder and is added to the set when it is new.\n */\nexport async function vaultFor(set: FileSet, name: string): Promise<Vault | undefined> {\n const directory = await enclosingVault(path.join(set.root, name));\n if (!directory) return undefined;\n const relative = path.relative(set.root, directory).split(path.sep).join(\"/\");\n const part =\n relative === \"..\" || relative.startsWith(\"../\") || path.isAbsolute(relative) ? \"\" : relative;\n const known = set.vaults.find((vault) => vault.path === part);\n if (known) return known;\n const described = await describeVault(set.root, part, directory);\n set.vaults.push(described.vault);\n if (described.skipped) set.skipped.push(described.skipped);\n return described.vault;\n}\n/**\n * Where Git's ignore rules for the workspace at `root` come from. They start at\n * `top`, the top level of the repository that holds the root, which can lie\n * above it; in each repository nested in the workspace, only its own rules\n * apply. What a repository tracks is never ignored.\n */\nfunction gitRules(root: string, top: string | undefined) {\n /** The root, relative to the repository's top level. */\n const lead = top ? path.relative(top, root).split(path.sep).join(\"/\") : \"\";\n /** A path relative to the root, relative to the repository's top level instead. */\n const fromTop = (relative: string) =>\n lead && relative ? `${lead}/${relative}` : lead || relative;\n /** How messages name a file of rules: from the root, or in full outside the repository. */\n function shown(file: string): string {\n const inside = path.relative(top ?? root, file);\n if (inside === \"..\" || inside.startsWith(`..${path.sep}`) || path.isAbsolute(inside))\n return file;\n return path.relative(root, file).split(path.sep).join(\"/\");\n }\n /** The file whose read failed, as messages name it. */\n const failed = (error: unknown, fallback: string) =>\n shown((error as NodeJS.ErrnoException).path ?? fallback);\n /**\n * The tracked files, from the top level, and the folders that hold them,\n * each kept as its repository compares letter case: as they are, or in lower\n * case.\n */\n const exact = { tracked: new Set<string>(), holding: new Set<string>() };\n const folded = { tracked: new Set<string>(), holding: new Set<string>() };\n /**\n * The rules for the top level of the repository in `directory`, `base` from\n * the outer repository's top level, with the lowest precedence first: the\n * global excludes file that the repository's settings name, then its\n * `info/exclude`; and whether its patterns ignore letter case. What the\n * repository tracks is recorded on the way.\n */\n async function repositoryLayers(\n directory: string,\n base: string,\n ): Promise<{ layers: IgnoreLayer[]; ignoreCase: boolean }> {\n const settings = ignoreSettings(directory).then(async (found) => ({\n ...found,\n text: found.excludesFile === undefined ? undefined : await optionalText(found.excludesFile),\n }));\n const listed = trackedFiles(directory);\n let text: string | undefined;\n let exclude: string | undefined;\n try {\n exclude = await excludesFile(directory);\n text = exclude === undefined ? undefined : await optionalText(exclude);\n } finally {\n // Git runs in the repository's folder, which Windows does not let anyone\n // remove until it is done, so discovery waits for it also after a failure.\n await Promise.allSettled([settings, listed]);\n }\n const global = await settings;\n // Where Git cannot say, case is compared as the file system usually does.\n const ignoreCase = global.ignoreCase ?? caseInsensitive;\n const sets = ignoreCase ? folded : exact;\n for (const name of (await listed) ?? []) {\n let at = base ? `${base}/${name}` : name;\n if (ignoreCase) at = at.toLowerCase();\n sets.tracked.add(at);\n for (\n at = path.posix.dirname(at);\n at !== \".\" && !sets.holding.has(at);\n at = path.posix.dirname(at)\n )\n sets.holding.add(at);\n }\n const layers: IgnoreLayer[] = [];\n if (global.text !== undefined)\n layers.push(ignoreLayer(base, shown(global.excludesFile!), global.text, ignoreCase));\n if (text !== undefined) layers.push(ignoreLayer(base, shown(exclude!), text, ignoreCase));\n return { layers, ignoreCase };\n }\n /** Whether a repository tracks the path `at`, from the top level, or a file in that folder. */\n function isTracked(at: string): boolean {\n if (exact.tracked.has(at) || exact.holding.has(at)) return true;\n if (!folded.tracked.size) return false;\n const lower = at.toLowerCase();\n return folded.tracked.has(lower) || folded.holding.has(lower);\n }\n return { lead, fromTop, shown, failed, repositoryLayers, isTracked };\n}\n/**\n * The files of the workspace at `rootPath`, and the documents that `supplied`\n * files, folders, and patterns select, or all of them when `supplied` is\n * empty. Relative inputs are resolved from `base`.\n *\n * A folder or pattern selects the Markdown files in it or matching it, by\n * name (`isMarkdownName`), that nothing ignores. A file named on its own is\n * selected whatever its name: naming it is the request. When ignore rules\n * leave out a named file or folder, `skipped` says so and why.\n *\n * `documents` are paths from the root of documents whose text a caller\n * supplies, which need not exist. They are not selected here, but ignore rules\n * leave them out as named files, as far as their folders exist. With\n * `selectNone`, the caller selects nothing from disk, and an ignored root is\n * not reported.\n */\nexport async function discover(\n rootPath: string,\n supplied: string[],\n excluded: string[],\n resolve: ResolveOptions = {},\n base = process.cwd(),\n { documents = [], selectNone = false }: { documents?: string[]; selectNone?: boolean } = {},\n): Promise<FileSet> {\n const root = await realpath(rootPath);\n let top: string | undefined;\n try {\n top = await repositoryTop(root);\n } catch (error) {\n const code = refusal(error);\n if (!code) throw error;\n // Only the root itself can refuse it: each folder above leads to the root.\n throw new Error(`Workspace root cannot be read: ${rootPath} (${refusalText(code)})`, {\n cause: error,\n });\n }\n const { lead, fromTop, shown, failed, repositoryLayers, isTracked } = gitRules(root, top);\n // Compiled once: compiling a pattern costs more than matching it.\n const ignorePatterns = excluded.map((pattern) => ({\n pattern,\n matcher: new Minimatch(pattern, { dot: true }),\n }));\n const files: Record<string, WorkspaceSource> = {};\n const directories: string[] = [];\n const unlisted: string[] = [];\n const selected: string[] = [];\n /** The folders that select their Markdown files, relative to the root. */\n const requests: string[] = [];\n /** The paths named as inputs, by their own path and that of each folder above them. */\n const named = new Map<string, NamedInput[]>();\n const namedInputs = new Map<string, NamedInput>();\n const patterns: PatternInput[] = [];\n /** Each input as given, with a path from the root that it names or searches. */\n const located: { input: string; path: string }[] = [];\n /** The folders that are vaults, by the part of the workspace that each holds. */\n const vaultFolders = new Map<string, string>();\n for (const input of supplied.length ? supplied : [root]) {\n const absolute = path.resolve(base, input);\n let resolved: string;\n let directory: boolean;\n try {\n const info = await lstat(absolute);\n if (info.isSymbolicLink()) throw new Error(`Refusing symbolic-link input: ${input}`);\n directory = info.isDirectory();\n resolved = await realpath(absolute);\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n const pattern =\n code === \"ENOENT\" || code === \"ENOTDIR\" ? await patternInput(input, root, base) : undefined;\n if (pattern) {\n patterns.push(pattern);\n for (const folder of pattern.folders) located.push({ input, path: folder });\n continue;\n }\n throw pathError(\"Input\", input, error);\n }\n const relative = path.relative(root, resolved).split(path.sep).join(\"/\");\n if (relative.startsWith(\"../\") || relative === \"..\" || path.isAbsolute(relative))\n throw new Error(`Input is outside the workspace: ${input}`);\n located.push({ input, path: relative });\n if (directory) requests.push(relative);\n if (!relative || namedInputs.has(relative)) continue;\n const request: NamedInput = { path: relative, directory };\n namedInputs.set(relative, request);\n for (let at = relative; at !== \".\"; at = path.posix.dirname(at)) {\n const list = named.get(at);\n if (list) list.push(request);\n else named.set(at, [request]);\n }\n }\n /** The supplied documents, which ignore rules leave out as they do named files. */\n const documentInputs: NamedInput[] = [];\n for (const name of documents) {\n const existing = namedInputs.get(name);\n if (existing) {\n if (!existing.directory) documentInputs.push(existing);\n continue;\n }\n const request: NamedInput = { path: name, directory: false, document: true };\n namedInputs.set(name, request);\n documentInputs.push(request);\n for (let at = name; at !== \".\"; at = path.posix.dirname(at)) {\n const list = named.get(at);\n if (list) list.push(request);\n else named.set(at, [request]);\n }\n }\n /**\n * Record why the entry `name` leaves out the named inputs at or below it for\n * which `applies` holds, unless something above it did already.\n */\n function leaveNamed(\n name: string,\n why: (input: NamedInput) => (show: PathText) => string,\n applies: (input: NamedInput) => boolean = () => true,\n ) {\n for (const request of named.get(name) ?? [])\n if (applies(request)) request.reason ??= why(request);\n }\n /** Whether Git's rules can leave out a named input: Git ignores nothing that it tracks. */\n const untracked = (input: NamedInput) => !isTracked(fromTop(input.path));\n /** Directories left out, with the path whose read the system refused. */\n const refused: { directory: string; reading: string; code: RefusalCode }[] = [];\n const reason = (item: { reading: string; code: RefusalCode }, subject: string) =>\n refusalText(item.code) + (item.reading === subject ? \"\" : ` for ${item.reading}`);\n /**\n * Leave out a directory that the system refuses to let the tool read. Any\n * other error is a fault and stops the run, and so does a refusal for the\n * workspace root, without which there is nothing to do.\n */\n function leaveOut(directory: string, reading: string, error: unknown): void {\n const code = refusal(error);\n if (!code) throw error;\n if (!directory)\n throw new Error(\n `Workspace root cannot be read: ${rootPath} (${reason({ reading, code }, \"\")})`,\n { cause: error },\n );\n refused.push({ directory, reading, code });\n }\n /** The rules that apply at the root, from the repository's top level down. */\n let rootLayers: IgnoreLayer[] = [];\n /** Whether the rules of the repository that holds the root ignore letter case. */\n let rootIgnoreCase = caseInsensitive;\n /** The folder at or above the root that Git ignores, from the top level, and the rule. */\n let ignoredRoot: { folder: string; file: string; pattern: string } | undefined;\n if (top) {\n try {\n ({ layers: rootLayers, ignoreCase: rootIgnoreCase } = await repositoryLayers(top, \"\"));\n const parts = lead ? lead.split(\"/\") : [];\n for (let index = 0; index < parts.length && !ignoredRoot; index++) {\n const at = parts.slice(0, index).join(\"/\");\n const file = path.join(top, ...parts.slice(0, index), \".gitignore\");\n const text = await optionalText(file);\n if (text !== undefined) rootLayers.push(ignoreLayer(at, shown(file), text, rootIgnoreCase));\n const rule = gitIgnoreRule(ignoreScopes(at, rootLayers), parts[index]!, true);\n if (rule) ignoredRoot = { folder: parts.slice(0, index + 1).join(\"/\"), ...rule };\n }\n } catch (error) {\n leaveOut(\"\", failed(error, path.join(top, \".git\")), error);\n }\n }\n /**\n * Visit a directory, whose repository's rules ignore letter case or not.\n * Below a folder that Git's rules exclude, nothing can be included again, as\n * in Git, except what Git tracks. Such a folder is visited for what it\n * tracks, and otherwise only for link targets.\n */\n async function walk(\n relative: string,\n inherited: IgnoreLayer[],\n ignoreCase: boolean,\n targetOnly = false,\n gitIgnoredAbove = false,\n ) {\n const directory = path.join(root, relative);\n const layers = [...inherited];\n const rules = path.join(directory, \".gitignore\");\n let entries: Dirent[];\n // What is being read: the directory itself, or its `.gitignore`. Without the\n // ignore rules nothing tells which of the directory's files may be touched.\n let reading = relative;\n try {\n if (!gitIgnoredAbove && (await exists(rules))) {\n reading = relative ? `${relative}/.gitignore` : \".gitignore\";\n const text = await readFile(rules, \"utf8\");\n layers.push(ignoreLayer(fromTop(relative), reading, text, ignoreCase));\n reading = relative;\n }\n entries = await readdir(directory, { withFileTypes: true });\n } catch (error) {\n leaveOut(relative, reading, error);\n return;\n }\n // Obsidian creates the settings folder itself; a link to one shares a vault's settings.\n const settings = entries.find((entry) => entry.name === \".obsidian\");\n if (settings?.isDirectory() || (settings?.isSymbolicLink() && (await isVault(directory))))\n vaultFolders.set(relative, directory);\n const scopes = gitIgnoredAbove ? [] : ignoreScopes(fromTop(relative), layers);\n for (const entry of entries) {\n const name = relative ? `${relative}/${entry.name}` : entry.name;\n const rule = gitIgnoredAbove\n ? undefined\n : gitIgnoreRule(scopes, entry.name, entry.isDirectory());\n const gitExcluded = gitIgnoredAbove || rule !== undefined;\n // Git ignores no file that it tracks, and no folder that holds one,\n // though the folder's other files stay ignored.\n const gitIgnored = gitExcluded && !isTracked(fromTop(name));\n const skippedName = alwaysSkipped.has(entry.name);\n if (skippedName || entry.isSymbolicLink()) {\n if (skippedName)\n leaveNamed(\n name,\n (input) => (show) =>\n input.path === name\n ? `discovery always leaves out ${entry.name}`\n : `in ${show(name)}, which discovery always leaves out`,\n );\n // Not entered, but a link can name what is in it or behind it, unless\n // Git ignores it and so its files are no link targets.\n if (!gitIgnored || resolve.gitIgnored === true) unlisted.push(name);\n continue;\n }\n if (rule)\n leaveNamed(\n name,\n (input) => (show) =>\n input.path === name\n ? `matched by \"${rule.pattern}\" in ${showFile(show, rule.file)}`\n : `in ${show(name)}, which \"${rule.pattern}\" in ${showFile(show, rule.file)} matches`,\n untracked,\n );\n if (gitIgnored && resolve.gitIgnored !== true) continue;\n const full = path.join(root, name);\n if (entry.isDirectory()) {\n directories.push(name);\n let nested: boolean;\n try {\n nested = await exists(path.join(full, \".git\"));\n } catch (error) {\n // A directory that cannot be entered: nothing in it can be read.\n leaveOut(name, name, error);\n continue;\n }\n // A nested repository is another project, not one that a rule leaves\n // alone: text supplied for one of its documents is read as its own.\n if (nested)\n leaveNamed(\n name,\n (input) => (show) =>\n input.path === name ? \"a nested repository\" : `in ${show(name)}, a nested repository`,\n (input) => !input.document,\n );\n if (nested && resolve.nestedRepositories !== true) continue;\n // Inside a nested repository, only its own rules and settings apply, as in Git.\n let inner = { layers, ignoreCase };\n if (nested && !gitIgnored)\n try {\n inner = await repositoryLayers(full, fromTop(name));\n } catch (error) {\n leaveOut(name, failed(error, path.join(full, \".git\")), error);\n continue;\n }\n await walk(\n name,\n inner.layers,\n inner.ignoreCase,\n targetOnly || gitIgnored || nested,\n nested && !gitIgnored ? false : gitExcluded,\n );\n } else if (entry.isFile()) {\n const request = named.get(name)?.find((input) => input.path === name && !input.directory);\n const markdown = isMarkdownName(name);\n let cached: string | undefined;\n files[name] =\n markdown || request ? () => (cached ??= decodeText(readFileSync(full), name)) : null;\n if (!(markdown || request) || targetOnly || gitIgnored) continue;\n const pattern = ignorePatterns.find((item) => item.matcher.match(name))?.pattern;\n if (pattern !== undefined) {\n if (request)\n request.reason ??= () => `matched by the configuration's ignore pattern \"${pattern}\"`;\n continue;\n }\n let chosen = request !== undefined && !request.document;\n if (markdown) {\n chosen ||= requests.some(\n (folder) => !folder || name === folder || name.startsWith(`${folder}/`),\n );\n for (const item of patterns)\n if (item.matchers.some((matcher) => matcher.match(name))) chosen = item.matched = true;\n }\n if (chosen) selected.push(name);\n }\n }\n // A supplied document that no file holds yet is left out by the rules of\n // its folder as a file there would be.\n for (const request of documentInputs) {\n if (request.reason || request.path in files) continue;\n if (path.posix.dirname(request.path) !== (relative || \".\")) continue;\n const entry = path.posix.basename(request.path);\n if (alwaysSkipped.has(entry)) request.reason = () => `discovery always leaves out ${entry}`;\n const rule = gitIgnoredAbove ? undefined : gitIgnoreRule(scopes, entry, false);\n if (rule && untracked(request))\n request.reason ??= (show) => `matched by \"${rule.pattern}\" in ${showFile(show, rule.file)}`;\n }\n }\n await walk(\"\", rootLayers, rootIgnoreCase, false, ignoredRoot !== undefined);\n // The names that discovery always leaves out, and the configuration's\n // patterns, apply to a supplied document's path also where no folder of it\n // exists.\n for (const request of documentInputs) {\n if (request.reason) continue;\n const parts = request.path.split(\"/\");\n const at = parts.findIndex((part) => alwaysSkipped.has(part));\n if (at >= 0) {\n const folder = parts.slice(0, at + 1).join(\"/\");\n request.reason =\n folder === request.path\n ? () => `discovery always leaves out ${parts[at]}`\n : (show) => `in ${show(folder)}, which discovery always leaves out`;\n continue;\n }\n const pattern = ignorePatterns.find((item) => item.matcher.match(request.path))?.pattern;\n if (pattern !== undefined)\n request.reason = () => `matched by the configuration's ignore pattern \"${pattern}\"`;\n }\n // Nothing that Git does not track is processed in a root that Git ignores.\n let rootIgnored: ((show: PathText) => string) | undefined;\n if (ignoredRoot) {\n const { file, pattern } = ignoredRoot;\n // The root itself, or a folder above it.\n const folder = path.posix.relative(lead, ignoredRoot.folder);\n const why = (show: PathText) =>\n folder\n ? `in ${show(folder)}, which \"${pattern}\" in ${showFile(show, file)} matches`\n : `matched by \"${pattern}\" in ${showFile(show, file)}`;\n for (const input of namedInputs.values())\n if (untracked(input))\n input.reason ??= folder ? why : (show) => `in the workspace root, which is ${why(show)}`;\n if (!namedInputs.size && !selectNone && !isTracked(lead)) rootIgnored = why;\n }\n // An input in a directory that was left out is an error: the user asked for it.\n for (const { input, path: request } of located) {\n const item = refused.find(\n ({ directory }) => request === directory || request.startsWith(`${directory}/`),\n );\n if (item) throw new Error(`Input cannot be read: ${input} (${reason(item, request)})`);\n }\n // A pattern stands for the documents it matches, so one that matches none is\n // an error, as a path that does not exist is.\n for (const item of patterns)\n if (!item.matched)\n throw new Error(\n `Input pattern matches no document: ${item.input}${\n item.input.includes(\"\\\\\") ? \" (patterns separate folders with /)\" : \"\"\n }`,\n );\n const skipped: Skipped[] = refused.map((item) =>\n skip(\n { path: item.directory, type: \"directory\", code: item.code },\n (show) =>\n `Skipped unreadable directory: ${show(item.directory)} (${refusalText(item.code)}${item.reading === item.directory ? \"\" : ` for ${showFile(show, item.reading)}`}). Its files are not processed, and links into it cannot be checked.`,\n ),\n );\n if (rootIgnored) {\n const why = rootIgnored;\n skipped.push(\n skip(\n { path: \".\", type: \"directory\", code: \"IGNORED\" },\n (show) =>\n `Skipped ignored workspace root: ${show(\".\") || \".\"} (${why(show)}). Its files are not processed.`,\n ),\n );\n }\n // A named input that ignore rules leave out is not an error, but the user asked for it.\n for (const input of namedInputs.values()) {\n const why = input.reason;\n if (!why) continue;\n const item = skip(\n { path: input.path, type: input.directory ? \"directory\" : \"file\", code: \"IGNORED\" },\n (show) =>\n `Skipped ignored input: ${show(input.path)} (${why(show)}). ${input.directory ? \"Its files are\" : \"It is\"} not processed.`,\n );\n ignoredInputs.add(item);\n skipped.push(item);\n }\n // A root that is no vault itself can be a folder of one.\n if (!vaultFolders.has(\"\")) {\n const outer = await enclosingVault(root);\n if (outer) vaultFolders.set(\"\", outer);\n }\n const vaults: Vault[] = [];\n for (const [part, directory] of vaultFolders) {\n const described = await describeVault(root, part, directory);\n vaults.push(described.vault);\n if (described.skipped) skipped.push(described.skipped);\n }\n const byPath = (a: { path: string }, b: { path: string }) =>\n a.path < b.path ? -1 : a.path > b.path ? 1 : 0;\n return {\n root,\n files,\n directories,\n unlisted,\n skipped: skipped.sort(byPath),\n selected: selected.sort(),\n vaults: vaults.sort(byPath),\n };\n}\n/**\n * A file that `writeFormatted` would not write, or did not write completely,\n * with the reason in words that do not name it.\n */\nexport class ReplacementRefused extends Error {\n constructor(\n readonly reason: string,\n message: string,\n options?: ErrorOptions,\n ) {\n super(message, options);\n }\n}\n/**\n * Why `file` cannot be written, or undefined when nothing stands in the way\n * that can be seen before writing: the file may not be written, or its folder\n * does not let the trial file be created beside it. A read-only file is refused\n * on every platform: the flag marks a file that is not to be edited.\n */\nexport async function replacementProblem(file: string): Promise<string | undefined> {\n for (const [target, subject] of [\n [file, \"The file\"],\n [path.dirname(file), \"The file's folder\"],\n ] as const) {\n try {\n await access(target, constants.W_OK);\n } catch (error) {\n const text = systemErrorText(error);\n if (!text) throw error;\n return `${subject} may not be written (${text})`;\n }\n }\n return undefined;\n}\n/**\n * What went wrong when `writeFormatted` failed for a file, in words that do\n * not name it, or undefined for an error that is a fault of the tool.\n */\nexport function replacementFailure(error: unknown): string | undefined {\n if (error instanceof ReplacementRefused) return error.reason;\n const text = systemErrorText(error);\n return text ? `The file could not be written (${text}) and is unchanged` : undefined;\n}\n/** The refusal for a file whose bytes are no longer those that were read. */\nfunction changedOnDisk(file: string, when: string): ReplacementRefused {\n return new ReplacementRefused(\n \"The file changed on disk during formatting and was not written\",\n `File changed ${when}: ${file}`,\n );\n}\n/**\n * Show that `size` more bytes fit on the disk of `folder`, by writing a file\n * of that size there and removing it. It holds random bytes, not the\n * document's text: a file left behind by a crash then reveals nothing, and a\n * disk that compresses what it stores cannot make the trial smaller than the\n * write. Common file systems set aside the room when the bytes are written, so\n * the trial is not flushed to the disk; a file system that runs out of room only\n * then makes the write itself fail, and the file's content is written back.\n */\nasync function trialWrite(folder: string, size: number): Promise<void> {\n const trial = path.join(folder, `.mdtools-${randomUUID()}.tmp`);\n const handle = await open(trial, \"wx\", 0o600);\n try {\n await handle.writeFile(randomBytes(size));\n } finally {\n await handle.close();\n await unlink(trial).catch((error: NodeJS.ErrnoException) => {\n if (error.code !== \"ENOENT\") throw error;\n });\n }\n}\n/** Make the open file hold exactly `content`. */\nasync function overwrite(handle: FileHandle, content: Buffer): Promise<void> {\n for (let at = 0; at < content.length;)\n at += (await handle.write(content, at, content.length - at, at)).bytesWritten;\n await handle.truncate(content.length);\n await handle.sync();\n}\n/**\n * Write the formatted text `after` into `file`, whose text was read as\n * `before`, if the file still holds exactly the bytes that were read. The file\n * itself is written, not replaced by a new one, so that it keeps its\n * permissions, attributes, owner, creation time, and hard links, which Node.js\n * cannot all carry over to a new file. A trial write beside the file first shows that\n * the new content fits on the disk. The file is then checked through the open\n * file, just before writing. If writing fails part way, the bytes that were read\n * are written back, and the reason says whether that worked. A file that already\n * holds `after`, as the second name of a hard link written earlier in the batch\n * does, is left as it is.\n */\nexport async function writeFormatted(file: string, before: string, after: string): Promise<void> {\n const info = await lstat(file);\n if (!info.isFile() || info.isSymbolicLink())\n throw new ReplacementRefused(\n \"The file is not a regular file and was not written\",\n `Refusing non-regular file: ${file}`,\n );\n // The text was decoded from valid UTF-8, so encoding it again gives the bytes\n // that were read; comparing the text instead would miss a change to bytes that\n // decode to the same text.\n const expected = Buffer.from(before, \"utf8\");\n const content = Buffer.from(after, \"utf8\");\n const found = await readFile(file);\n if (found.equals(content)) return;\n if (!found.equals(expected)) throw changedOnDisk(file, \"during formatting\");\n await trialWrite(path.dirname(file), content.length);\n const handle = await open(file, \"r+\");\n try {\n // The path may lead to another file by now, such as through a link put in its place.\n const current = await handle.stat();\n if (current.ino !== info.ino || !(await handle.readFile()).equals(expected))\n throw changedOnDisk(file, \"before writing\");\n try {\n await overwrite(handle, content);\n } catch (error) {\n const text = systemErrorText(error);\n if (!text) throw error;\n let undone: string | undefined;\n try {\n await overwrite(handle, expected);\n } catch (again) {\n undone = systemErrorText(again);\n if (!undone) throw again;\n }\n throw new ReplacementRefused(\n undone === undefined\n ? `The file could not be written (${text}), and its content from before formatting was written back`\n : `The file could not be written (${text}), and writing its content from before formatting back failed too (${undone}); it may be incomplete`,\n `File written in part: ${file}`,\n { cause: error },\n );\n }\n } finally {\n await handle.close();\n }\n}\n"]}
package/docs/api.md CHANGED
@@ -181,7 +181,9 @@ and writes nothing: pass the configuration as `config`, plugin objects as
181
181
  - `exclude` lists files and directories to leave out, as paths, not patterns.
182
182
  - `documents` gives text for paths relative to `root`, such as an editor's
183
183
  unsaved buffer. Those documents are selected, and the workspace reads that
184
- text in place of a file, also where no file exists.
184
+ text in place of a file, also where no file exists. One whose path ignore
185
+ rules leave out is not selected and is an entry of `skipped`, as a named file
186
+ is.
185
187
 
186
188
  The result has `root`, the root's real path; `selected`, the documents as sorted
187
189
  forward-slash paths relative to it; and `skipped`, with the entries of the JSON
@@ -7,22 +7,22 @@ results, and says how good they are.
7
7
  ## In short
8
8
 
9
9
  - **Checking a whole workspace takes seconds.** From the command line, 500 pages
10
- of documentation (1.4 MB) are linted in about 3.2 s and checked for formatting
11
- in about 3.5 s, fast enough for CI or a check before every push.
12
- - **A single file is mostly start-up.** Every command needs about 0.26 s before
10
+ of documentation (1.4 MB) are linted in about 2.1 s and checked for formatting
11
+ in about 2.4 s, fast enough for CI or a check before every push.
12
+ - **A single file is mostly start-up.** Every command needs about 0.17 s before
13
13
  it reads a document, nearly all of it Node.js loading the tool's code. Pass
14
14
  many files to one command rather than running one command per file.
15
15
  - **Formatting is in the same range as Prettier.** Rewriting files takes about
16
- 1.9 times as long as Prettier, and checking formatted files slightly less,
16
+ 1.8 times as long as Prettier, and checking formatted files slightly less,
17
17
  although this tool also checks links and parses every changed document again
18
18
  to confirm its meaning.
19
19
  - **Cost grows in step with size.** Sixteen times as many files take about
20
- fifteen times as long, and a document of a megabyte costs about two fifths
20
+ sixteen times as long, and a document of a megabyte costs about two thirds
21
21
  more per kilobyte than a short one.
22
22
  - **Where it is weak.** The tool uses one CPU core and remembers nothing between
23
23
  runs, so formatting several thousand files takes tens of seconds every time.
24
24
  Memory grows with the workspace, though more slowly than the number of files:
25
- linting peaks near 170 MB for 126 pages and near 415 MB for 2,000. While one
25
+ linting peaks near 170 MB for 126 pages and near 425 MB for 2,000. While one
26
26
  document is parsed, it needs about 70 times its size for prose and about 130
27
27
  times for a long list of links.
28
28
 
@@ -47,7 +47,7 @@ and reading files, and printing.
47
47
 
48
48
  ## Reference results
49
49
 
50
- - Node.js v24.21.0 on Linux x64; AMD EPYC 7763 64-Core Processor, 4 logical
50
+ - Node.js v24.21.0 on Linux x64; AMD EPYC 9V45 96-Core Processor, 4 logical
51
51
  CPUs.
52
52
  - Each time is the median of 5 runs after one warm-up run.
53
53
  - Prettier 3.9.10 is the comparison formatter.
@@ -63,11 +63,11 @@ magnitude and as ratios between rows, not as a promise for another machine.
63
63
 
64
64
  | Step | Time | Fastest to slowest run | Per file | Per second | Compared with parsing |
65
65
  | ------------------------------------------ | ------ | ---------------------- | -------- | ---------- | --------------------- |
66
- | Parse only | 1.06 s | 1.04 s to 1.08 s | 2.11 ms | 1.29 MB | 1.0× |
67
- | Lint | 2.43 s | 2.42 s to 2.47 s | 4.85 ms | 0.56 MB | 2.3× |
68
- | Format, every file needs changes | 5.64 s | 5.60 s to 5.67 s | 11.26 ms | 0.24 MB | 5.3× |
69
- | Format, every file already formatted | 2.86 s | 2.85 s to 2.88 s | 5.71 ms | 0.54 MB | 2.7× |
70
- | Prettier on the same files, for comparison | 2.99 s | 2.95 s to 3.04 s | 5.98 ms | 0.45 MB | 2.8× |
66
+ | Parse only | 595 ms | 583 ms to 622 ms | 1.19 ms | 2.28 MB | 1.0× |
67
+ | Lint | 1.44 s | 1.43 s to 1.48 s | 2.87 ms | 0.94 MB | 2.4× |
68
+ | Format, every file needs changes | 3.40 s | 3.31 s to 3.42 s | 6.79 ms | 0.40 MB | 5.7× |
69
+ | Format, every file already formatted | 1.78 s | 1.72 s to 1.83 s | 3.54 ms | 0.86 MB | 3.0× |
70
+ | Prettier on the same files, for comparison | 1.90 s | 1.85 s to 1.97 s | 3.79 ms | 0.72 MB | 3.2× |
71
71
 
72
72
  - **Parse only** turns each file into a syntax tree. No rule can run without it,
73
73
  so it is the floor for the other rows.
@@ -89,10 +89,10 @@ magnitude and as ratios between rows, not as a promise for another machine.
89
89
 
90
90
  | Step | Time | Fastest to slowest run | Per file | Per second | Compared with parsing |
91
91
  | ------------------------------------ | ------ | ---------------------- | -------- | ---------- | --------------------- |
92
- | Parse only | 502 ms | 493 ms to 528 ms | 1.00 ms | 1.23 MB | 1.0× |
93
- | Lint | 1.21 s | 1.17 s to 1.25 s | 2.42 ms | 0.51 MB | 2.4× |
94
- | Format, every file needs changes | 2.89 s | 2.86 s to 2.94 s | 5.79 ms | 0.21 MB | 5.8× |
95
- | Format, every file already formatted | 1.30 s | 1.28 s to 1.35 s | 2.60 ms | 0.48 MB | 2.6× |
92
+ | Parse only | 278 ms | 266 ms to 281 ms | 0.56 ms | 2.22 MB | 1.0× |
93
+ | Lint | 702 ms | 681 ms to 740 ms | 1.40 ms | 0.88 MB | 2.5× |
94
+ | Format, every file needs changes | 1.75 s | 1.71 s to 1.85 s | 3.50 ms | 0.35 MB | 6.3× |
95
+ | Format, every file already formatted | 793 ms | 771 ms to 820 ms | 1.59 ms | 0.78 MB | 2.9× |
96
96
 
97
97
  The notes are less than half the size of the documentation pages, so each file
98
98
  is cheaper while the cost per megabyte is similar.
@@ -103,12 +103,12 @@ The repository documentation above, as 501 files on disk.
103
103
 
104
104
  | Command | Time | Fastest to slowest run | Peak memory |
105
105
  | ---------------------------------------------- | ------ | ---------------------- | ----------- |
106
- | Start Node.js and exit, for comparison | 25 ms | 24 ms to 26 ms | 51.8 MB |
107
- | Start the CLI and print its version | 257 ms | 255 ms to 259 ms | 84.9 MB |
108
- | Lint the workspace | 3.21 s | 3.18 s to 3.27 s | 270.6 MB |
109
- | Lint one file of the workspace | 367 ms | 364 ms to 370 ms | 98.9 MB |
110
- | Format and write, every file needs changes | 6.99 s | 6.80 s to 7.07 s | 374.3 MB |
111
- | Check formatting, every file already formatted | 3.51 s | 3.46 s to 3.54 s | 358.0 MB |
106
+ | Start Node.js and exit, for comparison | 22 ms | 20 ms to 23 ms | 51.7 MB |
107
+ | Start the CLI and print its version | 165 ms | 161 ms to 166 ms | 84.4 MB |
108
+ | Lint the workspace | 2.11 s | 2.06 s to 2.18 s | 270.5 MB |
109
+ | Lint one file of the workspace | 238 ms | 234 ms to 240 ms | 101.6 MB |
110
+ | Format and write, every file needs changes | 4.53 s | 4.45 s to 4.68 s | 377.1 MB |
111
+ | Check formatting, every file already formatted | 2.43 s | 2.39 s to 2.48 s | 359.4 MB |
112
112
 
113
113
  The difference between the first two rows, loading the tool, is paid by every
114
114
  command. Linting one file shows that unselected files cost almost nothing: they
@@ -123,13 +123,13 @@ the median of 3 runs without a warm-up run.
123
123
 
124
124
  | Files | Size | Lint | Lint per file | Format with changes | Format per file | Peak memory of a command-line lint |
125
125
  | ----- | ------- | ------ | ------------- | ------------------- | --------------- | ---------------------------------- |
126
- | 126 | 0.34 MB | 694 ms | 5.51 ms | 1.47 s | 11.64 ms | 170.8 MB |
127
- | 501 | 1.36 MB | 2.43 s | 4.85 ms | 5.64 s | 11.26 ms | 270.6 MB |
128
- | 2,001 | 5.44 MB | 9.66 s | 4.83 ms | 22.48 s | 11.23 ms | 415.4 MB |
126
+ | 126 | 0.34 MB | 380 ms | 3.02 ms | 884 ms | 7.02 ms | 172.0 MB |
127
+ | 501 | 1.36 MB | 1.44 s | 2.87 ms | 3.40 s | 6.79 ms | 270.5 MB |
128
+ | 2,001 | 5.44 MB | 5.94 s | 2.97 ms | 14.70 s | 7.35 ms | 426.8 MB |
129
129
 
130
130
  The per-file columns stay level, so the time for a larger workspace can be
131
131
  estimated by multiplying. Memory grows far more slowly: sixteen times as many
132
- files take about 2.4 times the memory, including about 85 MB that the tool needs
132
+ files take about 2.5 times the memory, including about 85 MB that the tool needs
133
133
  before it reads a document. Until a run finishes, the tool keeps every file's
134
134
  text and diagnostics, and the anchors of every document that a link points into;
135
135
  in the Obsidian dialect also about 70 bytes per file of the workspace,
@@ -140,15 +140,15 @@ Node.js reclaims memory, so it is an upper bound.
140
140
 
141
141
  | Document size | Format with changes | Per kilobyte |
142
142
  | ------------- | ------------------- | ------------ |
143
- | 17 kB | 48 ms | 2.86 ms |
144
- | 129 kB | 388 ms | 3.01 ms |
145
- | 1,024 kB | 4.07 s | 3.98 ms |
146
-
147
- The cost per kilobyte rises by about two fifths from a short document to one of
148
- a megabyte, far larger than documents usually are. In the previous reference
149
- results it rose by about a quarter, and most of the difference lies between 129
150
- kB and a megabyte. It is not explained yet; on Windows the cost per kilobyte
151
- stays level ([issue
143
+ | 17 kB | 29 ms | 1.76 ms |
144
+ | 129 kB | 315 ms | 2.44 ms |
145
+ | 1,024 kB | 3.04 s | 2.97 ms |
146
+
147
+ The cost per kilobyte rises by about two thirds from a short document to one of
148
+ a megabyte, far larger than documents usually are. Earlier reference results, on
149
+ another processor, showed a rise of two fifths and of a quarter, so the size of
150
+ the rise depends on the runner. It is not explained yet; on Windows the cost per
151
+ kilobyte stays level ([issue
152
152
  #300](https://github.com/viell-dev/slop-markdown-tools/issues/300)).
153
153
 
154
154
  While a document is parsed, the parser holds a list of every token it found,
@@ -172,12 +172,12 @@ sum; Node.js allows a few gigabytes by default.
172
172
 
173
173
  | Situation | Reference result | Verdict |
174
174
  | --------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
175
- | A hook or an agent lints one file | 0.37 s, most of it start-up | Fine, but not instant. Batch files into one command. |
176
- | CI lints and checks 500 pages | 3.2 s and 3.5 s | Good. Shorter than installing the dependencies. |
177
- | Formatting 500 pages for the first time | 7.0 s | Good for a one-time job. |
178
- | A workspace of 2,000 pages | About 9.7 s to lint, 22 s to format everything | Acceptable. Tens of seconds, on one core, every time. |
179
- | Compared with Prettier | 1.9 times its time when rewriting, slightly less than its time when checking | Comparable, while also validating links and meaning. |
180
- | Memory | About 270 MB to lint and 375 MB to format 500 pages; about 415 MB to lint 2,000 | Fine at these sizes. At this rate, tens of thousands of files could still need a gigabyte or more. |
175
+ | A hook or an agent lints one file | 0.24 s, most of it start-up | Fine, but not instant. Batch files into one command. |
176
+ | CI lints and checks 500 pages | 2.1 s and 2.4 s | Good. Shorter than installing the dependencies. |
177
+ | Formatting 500 pages for the first time | 4.5 s | Good for a one-time job. |
178
+ | A workspace of 2,000 pages | About 6 s to lint, 15 s to format everything | Acceptable. Seconds to tens of seconds, on one core, every time. |
179
+ | Compared with Prettier | 1.8 times its time when rewriting, slightly less than its time when checking | Comparable, while also validating links and meaning. |
180
+ | Memory | About 270 MB to lint and 375 MB to format 500 pages; about 425 MB to lint 2,000 | Fine at these sizes. At this rate, tens of thousands of files could still need a gigabyte or more. |
181
181
 
182
182
  The design accepts some slowness on purpose: parsing every changed document
183
183
  again is what lets the tool refuse an edit that would change a document's
package/docs/cli.md CHANGED
@@ -34,6 +34,7 @@ and exclude one another.
34
34
  | `--exclude <path>` | Leave out a file or a directory. Repeat it for more. |
35
35
  | `--json` | Print one [JSON report](#json-report) on stdout instead of text. |
36
36
  | `--quiet` | Report errors only. Warnings are left out of the output, the JSON report, and the counts, `--max-warnings` included. |
37
+ | `--no-warn-ignored` | Leave out the warning for a named file or directory that is [ignored](#which-files-are-processed). |
37
38
  | `--stdin-filepath <file>` | The path of the document read from [stdin](#read-from-stdin). |
38
39
  | `--max-warnings <count>` | Exit with code `1` when there are more warnings than this. |
39
40
  | `--check` | Exit with code `1`, naming the documents, when any would change. Writes nothing. |
@@ -58,7 +59,11 @@ links.
58
59
  on the command line is an error. A file or directory named on the command line
59
60
  that these leave out is skipped with a warning that says why, such as
60
61
  `Skipped ignored input: generated/x.md (in generated, which "generated/" in .gitignore matches)`,
61
- and the exit code does not change.
62
+ and the exit code does not change. `--no-warn-ignored` leaves this warning
63
+ out, so that a hook or script can pass every changed file without repeating
64
+ the ignore rules; the JSON report still lists the input in `skipped`, and the
65
+ other warnings, such as the one for a workspace root that Git ignores, still
66
+ print.
62
67
  - Git's ignore rules apply as in Git. A path is checked against each
63
68
  `.gitignore` from the deepest up to the repository's top level, including
64
69
  those above the workspace root, then the repository's `.git/info/exclude`,
@@ -103,12 +108,17 @@ npx mdtools format - --stdin-filepath notes/example.md < input.md > output.md
103
108
 
104
109
  `--stdin-filepath` gives the document's path, which decides its configuration,
105
110
  dialect, and links. It must lie inside the workspace; without it the path is
106
- `stdin.md` at the workspace root. `format -` prints the formatted document on
107
- stdout, or the diff with `--diff`, or nothing with `--check`; it cannot be
108
- combined with `--write`. `lint -` prints its findings. Neither prints a summary
109
- line. Stdin must be [UTF-8 text](#files-that-cannot-be-read-or-written), with or
110
- without a byte order mark; anything else stops the command with exit code `2`
111
- and a message such as
111
+ `stdin.md` at the workspace root. Ignore rules apply to the path that
112
+ `--stdin-filepath` gives as to a [named file](#which-files-are-processed), also
113
+ where no file or folder of it exists yet: for an ignored path, `lint -` reports
114
+ nothing and `format -` prints the document unchanged, both with the
115
+ `Skipped ignored input` warning, which `--no-warn-ignored` leaves out. A nested
116
+ repository is no such rule: a path in one is read as that repository's document.
117
+ `format -` prints the formatted document on stdout, or the diff with `--diff`,
118
+ or nothing with `--check`; it cannot be combined with `--write`. `lint -` prints
119
+ its findings. Neither prints a summary line. Stdin must be [UTF-8
120
+ text](#files-that-cannot-be-read-or-written), with or without a byte order mark;
121
+ anything else stops the command with exit code `2` and a message such as
112
122
  `mdtools: stdin is not UTF-8 text (it starts with a UTF-16LE byte order mark)`.
113
123
 
114
124
  The redirection above, in a POSIX shell or in `cmd`, passes the bytes unchanged.