UNPKG

@bscotch/stitch

Version:

Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.

69 lines 2.65 kB
/// <reference types="node" /> import nodePath from 'path'; /** * Given a path with any style of separators, * return the same path with POSIX-style separators. */ declare function asPosixPath(pathString: string): string; /** * Get the number of directory levels between a child and * parent. Treats both as paths for directories and trims trailing slashes. * Ignores case! * * For example: * * - If the parent and child are the same, returns `0`. * - If the child is an immediate child of the parent, returns `1`. * - If the child is not inside parent at all, returns `NaN`. */ declare function generationsFromParent(parent: string, child: string): number; /** * For a set of parents and a child, return the parent closest * to that child (if there is one, else return `undefined`). */ declare function findClosestParent(parents: string[], child: string): string | undefined; /** * Pass to `.sort()` got an array of paths to get * them sorted by *least* to *most* specific (i.e. * fewest to most subdirs) and alphabetically by * directory within a specificity tier. */ declare function pathSpecificitySort(path1: string, path2: string): number; /** * Given a path, return all of the parent paths * leading up to it. Sorted by least to most specific * (e.g. /hello comes before /hello/world) */ declare function heirarchy(path: string): string[]; /** * Given the path to a directory, return the final subdirectory name. * E.g. from /hello/world/ return "world". */ declare function subfolderName(directoryPath: string): string; declare function changeExtension(path: string, newExtension: string): string; declare const _default: { pathSpecificitySort: typeof pathSpecificitySort; heirarchy: typeof heirarchy; asPosixPath: typeof asPosixPath; subfolderName: typeof subfolderName; changeExtension: typeof changeExtension; generationsFromParent: typeof generationsFromParent; findClosestParent: typeof findClosestParent; normalize(path: string): string; join(...paths: string[]): string; resolve(...paths: string[]): string; isAbsolute(path: string): boolean; relative(from: string, to: string): string; dirname(path: string): string; basename(path: string, suffix?: string | undefined): string; extname(path: string): string; sep: "\\" | "/"; delimiter: ";" | ":"; parse(path: string): nodePath.ParsedPath; format(pathObject: nodePath.FormatInputPathObject): string; toNamespacedPath(path: string): string; posix: nodePath.PlatformPath; win32: nodePath.PlatformPath; }; export default _default; //# sourceMappingURL=paths.d.ts.map