governance.PosixPathtypeno test imports ittype PosixPath = Brand<string, "anyfs posix path">;An absolute path in the view of a store: /, or / and segments joined by /. Made only by resolvePosix and parseAbsolute.
The paths a program of POSIX gives, and how they become the keys of a store. A POSIX path is text: absolute from the root of the store, or relative to a working directory the program holds as a value (there is none in the process). . and .. are resolved by the text alone, and .. at the root stays at the root, as a file system does. A backslash, a control character and a NUL are refused at this boundary, never passed on. The key of a store is made from the resolved path by the parser of the store, so that nothing here can name what a store would refuse.
import { resolvePosix, ROOT_PATH } from "./posix-path.ts";
const r = resolvePosix(ROOT_PATH, "a//b/./c/../d");
r.kind === "ok" && r.value; // "/a/b/d"governance.PosixPathtypeno test imports ittype PosixPath = Brand<string, "anyfs posix path">;An absolute path in the view of a store: /, or / and segments joined by /. Made only by resolvePosix and parseAbsolute.
governance.ROOT_PATHconstno test imports itconst ROOT_PATH: PosixPathThe root.
governance.resolvePosixfunctionno test imports itfunction resolvePosix(cwd: PosixPath, text: string): Result<PosixPath, string>A path from text, resolved against a working directory: absolute where it begins with /, otherwise below the working directory.
governance.parseAbsolutefunctionno test imports itfunction parseAbsolute(text: string): Result<PosixPath, string>An absolute path from text: the text begins with /.
governance.storePathOffunctionno test imports itfunction storePathOf(path: PosixPath): Result<Path | undefined, string>The key of a store for a path: nothing for the root, and the reason where the store would not take the path.
governance.prefixOffunctionno test imports itfunction prefixOf(path: PosixPath): Result<Prefix, string>The prefix of a store for a path: the root for the root.
governance.posixOffunctionno test imports itfunction posixOf(path: Path): PosixPathThe path of a key of a store.
governance.parentPosixfunctionno test imports itfunction parentPosix(path: PosixPath): PosixPathThe directory that holds a path: the root holds itself.
governance.baseNamefunctionno test imports itfunction baseName(path: PosixPath): string | undefinedThe last name of a path: nothing for the root.
governance.joinPosixfunctionno test imports itfunction joinPosix(dir: PosixPath, name: string): PosixPathThe path of a name in a directory.
governance.isBelowfunctionno test imports itfunction isBelow(dir: PosixPath, path: PosixPath): booleanWhether a path is below a directory: the root holds every other path, and a path is not below itself.
governance.ancestorsOffunctionno test imports itfunction ancestorsOf(path: PosixPath): readonly PosixPath[]Every directory above a path, from the root's child down to its parent: none for the root and for a path of one name.
PosixPathtypetype PosixPath = Brand<string, "anyfs posix path">;An absolute path in the view of a store: /, or / and segments joined by /. Made only by resolvePosix and parseAbsolute.
ROOT_PATHconstconst ROOT_PATH: PosixPathThe root.
resolvePosixfunctionfunction resolvePosix(cwd: PosixPath, text: string): Result<PosixPath, string>A path from text, resolved against a working directory: absolute where it begins with /, otherwise below the working directory.
parseAbsolutefunctionfunction parseAbsolute(text: string): Result<PosixPath, string>An absolute path from text: the text begins with /.
storePathOffunctionfunction storePathOf(path: PosixPath): Result<Path | undefined, string>The key of a store for a path: nothing for the root, and the reason where the store would not take the path.
prefixOffunctionfunction prefixOf(path: PosixPath): Result<Prefix, string>The prefix of a store for a path: the root for the root.
posixOffunctionfunction posixOf(path: Path): PosixPathThe path of a key of a store.
parentPosixfunctionfunction parentPosix(path: PosixPath): PosixPathThe directory that holds a path: the root holds itself.
baseNamefunctionfunction baseName(path: PosixPath): string | undefinedThe last name of a path: nothing for the root.
joinPosixfunctionfunction joinPosix(dir: PosixPath, name: string): PosixPathThe path of a name in a directory.
isBelowfunctionfunction isBelow(dir: PosixPath, path: PosixPath): booleanWhether a path is below a directory: the root holds every other path, and a path is not below itself.
ancestorsOffunctionfunction ancestorsOf(path: PosixPath): readonly PosixPath[]Every directory above a path, from the root's child down to its parent: none for the root and for a path of one name.