@zthun/crumbtrail-fs 2.1.0 → 2.1.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":"index.cjs","sources":["../src/file-system/file-system-node.mts","../src/file-system/file-system-service.mts"],"sourcesContent":["import { isUndefined, omitBy } from \"lodash-es\";\n\n/**\n * Represents a type of a file system node.\n */\nexport enum ZFileSystemNodeType {\n File = \"file\",\n Folder = \"folder\",\n}\n\nexport interface IZFileSystemNode {\n /**\n * The absolute path of the node.\n */\n path: string;\n\n /**\n * The type of the node (file or folder).\n */\n type: ZFileSystemNodeType;\n\n /**\n * The creation date of the node.\n */\n created?: string;\n\n /**\n * The modification date of the node.\n */\n updated?: string;\n\n /**\n * The size of the node in bytes.\n */\n size?: bigint;\n}\n\n/**\n * Represents a builder for a file system node.\n */\nexport class ZFileSystemNodeBuilder {\n private _node: IZFileSystemNode;\n\n public constructor() {\n this._node = {\n path: \"/\",\n type: ZFileSystemNodeType.Folder,\n };\n }\n\n public created(at?: Date | string | undefined) {\n this._node.created = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public updated(at?: Date | string | undefined) {\n this._node.updated = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public size(bytes: bigint | number | undefined) {\n this._node.size = typeof bytes == \"number\" ? BigInt(bytes) : bytes;\n return this;\n }\n\n public path(path: string) {\n this._node.path = path;\n return this;\n }\n\n public type(type: ZFileSystemNodeType) {\n this._node.type = type;\n return this;\n }\n\n public file = this.type.bind(this, ZFileSystemNodeType.File);\n public folder = this.type.bind(this, ZFileSystemNodeType.Folder);\n\n public build() {\n const clone = structuredClone(this._node);\n return omitBy(clone, isUndefined) as IZFileSystemNode;\n }\n}\n","import { glob } from \"glob\";\nimport { access } from \"node:fs/promises\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\nimport { cwd } from \"node:process\";\nimport type { IZFileSystemNode } from \"./file-system-node.mjs\";\nimport { ZFileSystemNodeBuilder } from \"./file-system-node.mjs\";\n\n/**\n * Represents options for searches.\n */\nexport interface IZFileSystemSearchOptions {\n /**\n * The directory to search in.\n *\n * If this is not set, then the cwd of the application is used.\n */\n cwd?: string;\n\n /**\n * A flag that determines whether or not to load the\n * file system information.\n *\n * This is true by default.\n */\n stat?: boolean;\n}\n\n/**\n * Represents options for directory walking.\n */\nexport interface IZFileSystemWalkOptions {\n /**\n * The starting directory.\n *\n * The default is the current working directory\n *\n * @see process.cwd for more information.\n */\n start?: string;\n\n /**\n * The directory to stop at.\n *\n * The default is the root of the file system.\n */\n stop?: string;\n\n /**\n * The type of mode that the path must support in order\n * to be approved.\n *\n * The default is undefined and left up to the node api.\n */\n mode?: number;\n}\n\n/**\n * Represents a service to enumerate the file system.\n */\nexport interface IZFileSystemService {\n /**\n * Gets information about a node.\n *\n * @param path -\n * The path to get information for.\n *\n * @returns\n * Information about the node.\n */\n info(path: string): Promise<IZFileSystemNode>;\n\n /**\n * Reads all nodes that match a pattern.\n *\n * @param pattern -\n * The pattern string to match against.\n * @param options -\n * The options for the search.\n *\n * @returns\n * A list of path strings that match the given patterns.\n */\n search(\n pattern: string,\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]>;\n\n /**\n * Walks up a directory tree to search for existence of a given path.\n *\n * @param search -\n * The path to search for. This is the candidate folder path that\n * may or may not exist somewhere from the start directory all the\n * way up the directory tree.\n * @param options -\n * The given options for the search.\n *\n * @returns\n * The fully qualified path to the first path that matches the search\n * starting at the options start or the current working directory if not\n * specified. Returns null if no such directory exists.\n *\n * @example\n *\n * ```ts\n * import { resolve } from 'path'\n *\n * // Find any folder named .vscode from the current working directory all the way\n * // up the directory tree. Returns null if no vscode directory can be found.\n * const service = new ZFileSystemService();\n * const vscode = service.walk('.vscode');\n *\n * // Walk the directory tree from the current script and find the .config folder.\n * const config = service.walk('.config', { start: __dirname });\n *\n * // Walk the directory tree from the current script and stop when we reach\n * // at most 2 directories up.\n * const start = __dirname;\n * const stop = resolve(__dirname, '../..');\n * const file = service.walk('path/to/file.json', { start, stop });\n * ```\n */\n walk(\n search: string,\n options?: IZFileSystemWalkOptions,\n ): Promise<string | null>;\n}\n\n/**\n * Represents a node implementation of a file system service.\n */\nexport class ZFileSystemService implements IZFileSystemService {\n public async info(path: string): Promise<IZFileSystemNode> {\n const [file] = await this.search(path);\n return file;\n }\n\n public async search(\n pattern: string | string[],\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]> {\n const paths = await glob(pattern, {\n stat: true,\n ...options,\n withFileTypes: true,\n });\n\n return paths.map((path) => {\n let info = new ZFileSystemNodeBuilder()\n .path(path.fullpath())\n .created(path.birthtime)\n .updated(path.atime)\n .size(path.size);\n\n // Note that for folders, node will return the size of the underlying OS metadata,\n // hence, why we remove the size on the folder here.\n info = path.isFile() ? info.file() : info.folder().size(undefined);\n\n return info.build();\n });\n }\n\n public async walk(search: string, options?: IZFileSystemWalkOptions) {\n const start = options?.start || cwd();\n const stop = options?.stop || \"/\";\n const mode = options?.mode;\n\n const _test = async (path: string) => {\n try {\n await access(path, mode);\n return true;\n } catch {\n return false;\n }\n };\n\n if (isAbsolute(search)) {\n return (await _test(search)) ? search : null;\n }\n\n let dir = start;\n do {\n const path = resolve(dir, search);\n const exists = await _test(path);\n\n if (exists) {\n return path;\n }\n\n dir = dir === stop ? \"\" : dirname(dir);\n } while (dir.length);\n\n return null;\n }\n}\n"],"names":["ZFileSystemNodeType","ZFileSystemNodeBuilder","_node","path","type","created","at","Date","toJSON","updated","size","bytes","BigInt","file","bind","folder","build","clone","structuredClone","omitBy","isUndefined","ZFileSystemService","info","search","pattern","options","paths","glob","stat","withFileTypes","map","fullpath","birthtime","atime","isFile","undefined","walk","start","cwd","stop","mode","_test","access","isAbsolute","dir","resolve","exists","dirname","length"],"mappings":";;;;;;;;;;AAEA;;IAGO,IAAKA,mBAAAA,iBAAAA,SAAAA,mBAAAA,EAAAA;;;AAAAA,IAAAA,OA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A,MAAMC,OAAOf,OAAAA,EAASe,IAAAA;AAEtB,QAAA,MAAMC,QAAQ,OAAOtC,IAAAA,GAAAA;YACnB,IAAI;AACF,gBAAA,MAAMuC,gBAAOvC,IAAAA,EAAMqC,IAAAA,CAAAA;gBACnB,OAAO,IAAA;AACT,aAAA,CAAE,OAAM;gBACN,OAAO,KAAA;AACT;AACF,SAAA;AAEA,QAAA,IAAIG,qBAAWpB,MAAAA,CAAAA,EAAS;AACtB,YAAA,OAAO,MAAOkB,KAAAA,CAAMlB,MAAAA,CAAAA,GAAWA,MAAAA,GAAS,IAAA;AAC1C;AAEA,QAAA,IAAIqB,GAAAA,GAAMP,KAAAA;QACV,GAAG;YACD,MAAMlC,IAAAA,GAAO0C,kBAAQD,GAAAA,EAAKrB,MAAAA,CAAAA;YAC1B,MAAMuB,MAAAA,GAAS,MAAML,KAAAA,CAAMtC,IAAAA,CAAAA;AAE3B,YAAA,IAAI2C,MAAAA,EAAQ;gBACV,OAAO3C,IAAAA;AACT;YAEAyC,GAAAA,GAAMA,GAAAA,KAAQL,IAAAA,GAAO,EAAA,GAAKQ,iBAAAA,CAAQH,GAAAA,CAAAA;SACpC,OAASA,GAAAA,CAAII,MAAM;QAEnB,OAAO,IAAA;AACT;AACF;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/file-system/file-system-node.mts","../src/file-system/file-system-service.mts"],"sourcesContent":["import { isUndefined, omitBy } from \"lodash-es\";\n\n/**\n * Represents a type of a file system node.\n */\nexport enum ZFileSystemNodeType {\n File = \"file\",\n Folder = \"folder\",\n}\n\nexport interface IZFileSystemNode {\n /**\n * The absolute path of the node.\n */\n path: string;\n\n /**\n * The type of the node (file or folder).\n */\n type: ZFileSystemNodeType;\n\n /**\n * The creation date of the node.\n */\n created?: string;\n\n /**\n * The modification date of the node.\n */\n updated?: string;\n\n /**\n * The size of the node in bytes.\n */\n size?: bigint;\n}\n\n/**\n * Represents a builder for a file system node.\n */\nexport class ZFileSystemNodeBuilder {\n private _node: IZFileSystemNode;\n\n public constructor() {\n this._node = {\n path: \"/\",\n type: ZFileSystemNodeType.Folder,\n };\n }\n\n public created(at?: Date | string | undefined) {\n this._node.created = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public updated(at?: Date | string | undefined) {\n this._node.updated = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public size(bytes: bigint | number | undefined) {\n this._node.size = typeof bytes == \"number\" ? BigInt(bytes) : bytes;\n return this;\n }\n\n public path(path: string) {\n this._node.path = path;\n return this;\n }\n\n public type(type: ZFileSystemNodeType) {\n this._node.type = type;\n return this;\n }\n\n public file = this.type.bind(this, ZFileSystemNodeType.File);\n public folder = this.type.bind(this, ZFileSystemNodeType.Folder);\n\n public build() {\n const clone = structuredClone(this._node);\n return omitBy(clone, isUndefined) as IZFileSystemNode;\n }\n}\n","import { glob } from \"glob\";\nimport { access } from \"node:fs/promises\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\nimport { cwd } from \"node:process\";\nimport type { IZFileSystemNode } from \"./file-system-node.mjs\";\nimport { ZFileSystemNodeBuilder } from \"./file-system-node.mjs\";\n\n/**\n * Represents options for searches.\n */\nexport interface IZFileSystemSearchOptions {\n /**\n * The directory to search in.\n *\n * If this is not set, then the cwd of the application is used.\n */\n cwd?: string;\n\n /**\n * A flag that determines whether or not to load the\n * file system information.\n *\n * This is true by default.\n */\n stat?: boolean;\n}\n\n/**\n * Represents options for directory walking.\n */\nexport interface IZFileSystemWalkOptions {\n /**\n * The starting directory.\n *\n * The default is the current working directory\n *\n * @see process.cwd for more information.\n */\n start?: string;\n\n /**\n * The directory to stop at.\n *\n * The default is the root of the file system.\n */\n stop?: string;\n\n /**\n * The type of mode that the path must support in order\n * to be approved.\n *\n * The default is undefined and left up to the node api.\n */\n mode?: number;\n}\n\n/**\n * Represents a service to enumerate the file system.\n */\nexport interface IZFileSystemService {\n /**\n * Gets information about a node.\n *\n * @param path -\n * The path to get information for.\n *\n * @returns\n * Information about the node.\n */\n info(path: string): Promise<IZFileSystemNode>;\n\n /**\n * Reads all nodes that match a pattern.\n *\n * @param pattern -\n * The pattern string to match against.\n * @param options -\n * The options for the search.\n *\n * @returns\n * A list of path strings that match the given patterns.\n */\n search(\n pattern: string,\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]>;\n\n /**\n * Walks up a directory tree to search for existence of a given path.\n *\n * @param search -\n * The path to search for. This is the candidate folder path that\n * may or may not exist somewhere from the start directory all the\n * way up the directory tree.\n * @param options -\n * The given options for the search.\n *\n * @returns\n * The fully qualified path to the first path that matches the search\n * starting at the options start or the current working directory if not\n * specified. Returns null if no such directory exists.\n *\n * @example\n *\n * ```ts\n * import { resolve } from 'path'\n *\n * // Find any folder named .vscode from the current working directory all the way\n * // up the directory tree. Returns null if no vscode directory can be found.\n * const service = new ZFileSystemService();\n * const vscode = service.walk('.vscode');\n *\n * // Walk the directory tree from the current script and find the .config folder.\n * const config = service.walk('.config', { start: __dirname });\n *\n * // Walk the directory tree from the current script and stop when we reach\n * // at most 2 directories up.\n * const start = __dirname;\n * const stop = resolve(__dirname, '../..');\n * const file = service.walk('path/to/file.json', { start, stop });\n * ```\n */\n walk(\n search: string,\n options?: IZFileSystemWalkOptions,\n ): Promise<string | null>;\n}\n\n/**\n * Represents a node implementation of a file system service.\n */\nexport class ZFileSystemService implements IZFileSystemService {\n public async info(path: string): Promise<IZFileSystemNode> {\n const [file] = await this.search(path);\n return file;\n }\n\n public async search(\n pattern: string | string[],\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]> {\n const paths = await glob(pattern, {\n stat: true,\n ...options,\n withFileTypes: true,\n });\n\n return paths.map((path) => {\n let info = new ZFileSystemNodeBuilder()\n .path(path.fullpath())\n .created(path.birthtime)\n .updated(path.atime)\n .size(path.size);\n\n // Note that for folders, node will return the size of the underlying OS metadata,\n // hence, why we remove the size on the folder here.\n info = path.isFile() ? info.file() : info.folder().size(undefined);\n\n return info.build();\n });\n }\n\n public async walk(search: string, options?: IZFileSystemWalkOptions) {\n const start = options?.start || cwd();\n const stop = options?.stop || \"/\";\n const mode = options?.mode;\n\n const _test = async (path: string) => {\n try {\n await access(path, mode);\n return true;\n } catch {\n return false;\n }\n };\n\n if (isAbsolute(search)) {\n return (await _test(search)) ? search : null;\n }\n\n let dir = start;\n do {\n const path = resolve(dir, search);\n const exists = await _test(path);\n\n if (exists) {\n return path;\n }\n\n dir = dir === stop ? \"\" : dirname(dir);\n } while (dir.length);\n\n return null;\n }\n}\n"],"names":["ZFileSystemNodeType","ZFileSystemNodeBuilder","_node","path","type","created","at","Date","toJSON","updated","size","bytes","BigInt","file","bind","folder","build","clone","structuredClone","omitBy","isUndefined","ZFileSystemService","info","search","pattern","options","paths","glob","stat","withFileTypes","map","fullpath","birthtime","atime","isFile","undefined","walk","start","cwd","stop","mode","_test","access","isAbsolute","dir","resolve","exists","dirname","length"],"mappings":";;;;;;;;;;AAEA;;IAGO,IAAKA,mBAAAA,iBAAAA,SAAAA,mBAAAA,EAAAA;;;AAAAA,IAAAA,OAAAA,mBAAAA;AAGX,CAAA,CAAA,EAAA;AA6BD;;AAEC,IACM,MAAMC,sBAAAA,CAAAA;IACHC,KAAAA;IAER,WAAA,EAAqB;QACnB,IAAI,CAACA,KAAK,GAAG;YACXC,IAAAA,EAAM,GAAA;YACNC,IAAI,EAAA;AACN,SAAA;AACF,IAAA;AAEOC,IAAAA,OAAAA,CAAQC,EAA8B,EAAE;QAC7C,IAAI,CAACJ,KAAK,CAACG,OAAO,GAAGC,EAAAA,YAAcC,IAAAA,GAAOD,EAAAA,CAAGE,MAAM,EAAA,GAAKF,EAAAA;AACxD,QAAA,OAAO,IAAI;AACb,IAAA;AAEOG,IAAAA,OAAAA,CAAQH,EAA8B,EAAE;QAC7C,IAAI,CAACJ,KAAK,CAACO,OAAO,GAAGH,EAAAA,YAAcC,IAAAA,GAAOD,EAAAA,CAAGE,MAAM,EAAA,GAAKF,EAAAA;AACxD,QAAA,OAAO,I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AAA;YAC1B,MAAMuB,MAAAA,GAAS,MAAML,KAAAA,CAAMtC,IAAAA,CAAAA;AAE3B,YAAA,IAAI2C,MAAAA,EAAQ;gBACV,OAAO3C,IAAAA;AACT,YAAA;YAEAyC,GAAAA,GAAMA,GAAAA,KAAQL,IAAAA,GAAO,EAAA,GAAKQ,iBAAAA,CAAQH,GAAAA,CAAAA;QACpC,CAAA,OAASA,GAAAA,CAAII,MAAM;QAEnB,OAAO,IAAA;AACT,IAAA;AACF;;;;;;"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/file-system/file-system-node.mts","../src/file-system/file-system-service.mts"],"sourcesContent":["import { isUndefined, omitBy } from \"lodash-es\";\n\n/**\n * Represents a type of a file system node.\n */\nexport enum ZFileSystemNodeType {\n File = \"file\",\n Folder = \"folder\",\n}\n\nexport interface IZFileSystemNode {\n /**\n * The absolute path of the node.\n */\n path: string;\n\n /**\n * The type of the node (file or folder).\n */\n type: ZFileSystemNodeType;\n\n /**\n * The creation date of the node.\n */\n created?: string;\n\n /**\n * The modification date of the node.\n */\n updated?: string;\n\n /**\n * The size of the node in bytes.\n */\n size?: bigint;\n}\n\n/**\n * Represents a builder for a file system node.\n */\nexport class ZFileSystemNodeBuilder {\n private _node: IZFileSystemNode;\n\n public constructor() {\n this._node = {\n path: \"/\",\n type: ZFileSystemNodeType.Folder,\n };\n }\n\n public created(at?: Date | string | undefined) {\n this._node.created = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public updated(at?: Date | string | undefined) {\n this._node.updated = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public size(bytes: bigint | number | undefined) {\n this._node.size = typeof bytes == \"number\" ? BigInt(bytes) : bytes;\n return this;\n }\n\n public path(path: string) {\n this._node.path = path;\n return this;\n }\n\n public type(type: ZFileSystemNodeType) {\n this._node.type = type;\n return this;\n }\n\n public file = this.type.bind(this, ZFileSystemNodeType.File);\n public folder = this.type.bind(this, ZFileSystemNodeType.Folder);\n\n public build() {\n const clone = structuredClone(this._node);\n return omitBy(clone, isUndefined) as IZFileSystemNode;\n }\n}\n","import { glob } from \"glob\";\nimport { access } from \"node:fs/promises\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\nimport { cwd } from \"node:process\";\nimport type { IZFileSystemNode } from \"./file-system-node.mjs\";\nimport { ZFileSystemNodeBuilder } from \"./file-system-node.mjs\";\n\n/**\n * Represents options for searches.\n */\nexport interface IZFileSystemSearchOptions {\n /**\n * The directory to search in.\n *\n * If this is not set, then the cwd of the application is used.\n */\n cwd?: string;\n\n /**\n * A flag that determines whether or not to load the\n * file system information.\n *\n * This is true by default.\n */\n stat?: boolean;\n}\n\n/**\n * Represents options for directory walking.\n */\nexport interface IZFileSystemWalkOptions {\n /**\n * The starting directory.\n *\n * The default is the current working directory\n *\n * @see process.cwd for more information.\n */\n start?: string;\n\n /**\n * The directory to stop at.\n *\n * The default is the root of the file system.\n */\n stop?: string;\n\n /**\n * The type of mode that the path must support in order\n * to be approved.\n *\n * The default is undefined and left up to the node api.\n */\n mode?: number;\n}\n\n/**\n * Represents a service to enumerate the file system.\n */\nexport interface IZFileSystemService {\n /**\n * Gets information about a node.\n *\n * @param path -\n * The path to get information for.\n *\n * @returns\n * Information about the node.\n */\n info(path: string): Promise<IZFileSystemNode>;\n\n /**\n * Reads all nodes that match a pattern.\n *\n * @param pattern -\n * The pattern string to match against.\n * @param options -\n * The options for the search.\n *\n * @returns\n * A list of path strings that match the given patterns.\n */\n search(\n pattern: string,\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]>;\n\n /**\n * Walks up a directory tree to search for existence of a given path.\n *\n * @param search -\n * The path to search for. This is the candidate folder path that\n * may or may not exist somewhere from the start directory all the\n * way up the directory tree.\n * @param options -\n * The given options for the search.\n *\n * @returns\n * The fully qualified path to the first path that matches the search\n * starting at the options start or the current working directory if not\n * specified. Returns null if no such directory exists.\n *\n * @example\n *\n * ```ts\n * import { resolve } from 'path'\n *\n * // Find any folder named .vscode from the current working directory all the way\n * // up the directory tree. Returns null if no vscode directory can be found.\n * const service = new ZFileSystemService();\n * const vscode = service.walk('.vscode');\n *\n * // Walk the directory tree from the current script and find the .config folder.\n * const config = service.walk('.config', { start: __dirname });\n *\n * // Walk the directory tree from the current script and stop when we reach\n * // at most 2 directories up.\n * const start = __dirname;\n * const stop = resolve(__dirname, '../..');\n * const file = service.walk('path/to/file.json', { start, stop });\n * ```\n */\n walk(\n search: string,\n options?: IZFileSystemWalkOptions,\n ): Promise<string | null>;\n}\n\n/**\n * Represents a node implementation of a file system service.\n */\nexport class ZFileSystemService implements IZFileSystemService {\n public async info(path: string): Promise<IZFileSystemNode> {\n const [file] = await this.search(path);\n return file;\n }\n\n public async search(\n pattern: string | string[],\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]> {\n const paths = await glob(pattern, {\n stat: true,\n ...options,\n withFileTypes: true,\n });\n\n return paths.map((path) => {\n let info = new ZFileSystemNodeBuilder()\n .path(path.fullpath())\n .created(path.birthtime)\n .updated(path.atime)\n .size(path.size);\n\n // Note that for folders, node will return the size of the underlying OS metadata,\n // hence, why we remove the size on the folder here.\n info = path.isFile() ? info.file() : info.folder().size(undefined);\n\n return info.build();\n });\n }\n\n public async walk(search: string, options?: IZFileSystemWalkOptions) {\n const start = options?.start || cwd();\n const stop = options?.stop || \"/\";\n const mode = options?.mode;\n\n const _test = async (path: string) => {\n try {\n await access(path, mode);\n return true;\n } catch {\n return false;\n }\n };\n\n if (isAbsolute(search)) {\n return (await _test(search)) ? search : null;\n }\n\n let dir = start;\n do {\n const path = resolve(dir, search);\n const exists = await _test(path);\n\n if (exists) {\n return path;\n }\n\n dir = dir === stop ? \"\" : dirname(dir);\n } while (dir.length);\n\n return null;\n }\n}\n"],"names":["ZFileSystemNodeType","ZFileSystemNodeBuilder","_node","path","type","created","at","Date","toJSON","updated","size","bytes","BigInt","file","bind","folder","build","clone","structuredClone","omitBy","isUndefined","ZFileSystemService","info","search","pattern","options","paths","glob","stat","withFileTypes","map","fullpath","birthtime","atime","isFile","undefined","walk","start","cwd","stop","mode","_test","access","isAbsolute","dir","resolve","exists","dirname","length"],"mappings":";;;;;;AAEA;;IAGO,IAAKA,mBAAAA,iBAAAA,SAAAA,mBAAAA,EAAAA;;;AAAAA,IAAAA,OAAAA,mBAAAA;AAGX,CAAA,CAAA,EAAA;AA6BD;;AAEC,IACM,MAAMC,sBAAAA,CAAAA;IACHC,KAAAA;IAER,WAAA,EAAqB;QACnB,IAAI,CAACA,KAAK,GAAG;YACXC,IAAAA,EAAM,GAAA;YACNC,IAAI,EAAA;AACN,SAAA;AACF;AAEOC,IAAAA,OAAAA,CAAQC,EAA8B,EAAE;QAC7C,IAAI,CAACJ,KAAK,CAACG,OAAO,GAAGC,EAAAA,YAAcC,IAAAA,GAAOD,EAAAA,CAAGE,MAAM,EAAA,GAAKF,EAAAA;AACxD,QAAA,OAAO,IAAI;AACb;AAEOG,IAAAA,OAAAA,CAAQH,EAA8B,EAAE;QAC7C,IAAI,CAACJ,KAAK,CAACO,OAAO,GAAGH,EAAAA,YAAcC,IAAAA,GAAOD,EAAAA,CAAGE,MAAM,EAAA,GAAKF,EAAAA;AACxD,QAAA,OAAO,IAAI;AACb;AAEOI,IAAAA,IAAAA,CAAKC,KAAkC,EAAE;QAC9C,IAAI,CAACT,KAAK,CAACQ,IAAI,GAAG,OAAOC,KAAAA,IAAS,QAAA,GAAWC,MAAAA,CAAOD,KAAAA,CAAAA,GAASA,KAAAA;AAC7D,QAAA,OAAO,IAAI;AACb;AAEOR,IAAAA,IAAAA,CAAKA,IAAY,EAAE;AACxB,QAAA,IAAI,CAACD,KAAK,CAACC,IAAI,GAAGA,IAAAA;AAClB,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKA,IAAyB,EAAE;AACrC,QAAA,IAAI,CAACF,KAAK,CAACE,IAAI,GAAGA,IAAAA;AAClB,QAAA,OAAO,IAAI;AACb;AAE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SAAA,CAAA;AACF;AAEA,IAAA,MAAaoB,IAAAA,CAAKb,MAAc,EAAEE,OAAiC,EAAE;QACnE,MAAMY,KAAAA,GAAQZ,SAASY,KAAAA,IAASC,GAAAA,EAAAA;QAChC,MAAMC,IAAAA,GAAOd,SAASc,IAAAA,IAAQ,GAAA;AAC9B,QAAA,MAAMC,OAAOf,OAAAA,EAASe,IAAAA;AAEtB,QAAA,MAAMC,QAAQ,OAAOtC,IAAAA,GAAAA;YACnB,IAAI;AACF,gBAAA,MAAMuC,OAAOvC,IAAAA,EAAMqC,IAAAA,CAAAA;gBACnB,OAAO,IAAA;AACT,aAAA,CAAE,OAAM;gBACN,OAAO,KAAA;AACT;AACF,SAAA;AAEA,QAAA,IAAIG,WAAWpB,MAAAA,CAAAA,EAAS;AACtB,YAAA,OAAO,MAAOkB,KAAAA,CAAMlB,MAAAA,CAAAA,GAAWA,MAAAA,GAAS,IAAA;AAC1C;AAEA,QAAA,IAAIqB,GAAAA,GAAMP,KAAAA;QACV,GAAG;YACD,MAAMlC,IAAAA,GAAO0C,QAAQD,GAAAA,EAAKrB,MAAAA,CAAAA;YAC1B,MAAMuB,MAAAA,GAAS,MAAML,KAAAA,CAAMtC,IAAAA,CAAAA;AAE3B,YAAA,IAAI2C,MAAAA,EAAQ;gBACV,OAAO3C,IAAAA;AACT;YAEAyC,GAAAA,GAAMA,GAAAA,KAAQL,IAAAA,GAAO,EAAA,GAAKQ,OAAAA,CAAQH,GAAAA,CAAAA;SACpC,OAASA,GAAAA,CAAII,MAAM;QAEnB,OAAO,IAAA;AACT;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/file-system/file-system-node.mts","../src/file-system/file-system-service.mts"],"sourcesContent":["import { isUndefined, omitBy } from \"lodash-es\";\n\n/**\n * Represents a type of a file system node.\n */\nexport enum ZFileSystemNodeType {\n File = \"file\",\n Folder = \"folder\",\n}\n\nexport interface IZFileSystemNode {\n /**\n * The absolute path of the node.\n */\n path: string;\n\n /**\n * The type of the node (file or folder).\n */\n type: ZFileSystemNodeType;\n\n /**\n * The creation date of the node.\n */\n created?: string;\n\n /**\n * The modification date of the node.\n */\n updated?: string;\n\n /**\n * The size of the node in bytes.\n */\n size?: bigint;\n}\n\n/**\n * Represents a builder for a file system node.\n */\nexport class ZFileSystemNodeBuilder {\n private _node: IZFileSystemNode;\n\n public constructor() {\n this._node = {\n path: \"/\",\n type: ZFileSystemNodeType.Folder,\n };\n }\n\n public created(at?: Date | string | undefined) {\n this._node.created = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public updated(at?: Date | string | undefined) {\n this._node.updated = at instanceof Date ? at.toJSON() : at;\n return this;\n }\n\n public size(bytes: bigint | number | undefined) {\n this._node.size = typeof bytes == \"number\" ? BigInt(bytes) : bytes;\n return this;\n }\n\n public path(path: string) {\n this._node.path = path;\n return this;\n }\n\n public type(type: ZFileSystemNodeType) {\n this._node.type = type;\n return this;\n }\n\n public file = this.type.bind(this, ZFileSystemNodeType.File);\n public folder = this.type.bind(this, ZFileSystemNodeType.Folder);\n\n public build() {\n const clone = structuredClone(this._node);\n return omitBy(clone, isUndefined) as IZFileSystemNode;\n }\n}\n","import { glob } from \"glob\";\nimport { access } from \"node:fs/promises\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\nimport { cwd } from \"node:process\";\nimport type { IZFileSystemNode } from \"./file-system-node.mjs\";\nimport { ZFileSystemNodeBuilder } from \"./file-system-node.mjs\";\n\n/**\n * Represents options for searches.\n */\nexport interface IZFileSystemSearchOptions {\n /**\n * The directory to search in.\n *\n * If this is not set, then the cwd of the application is used.\n */\n cwd?: string;\n\n /**\n * A flag that determines whether or not to load the\n * file system information.\n *\n * This is true by default.\n */\n stat?: boolean;\n}\n\n/**\n * Represents options for directory walking.\n */\nexport interface IZFileSystemWalkOptions {\n /**\n * The starting directory.\n *\n * The default is the current working directory\n *\n * @see process.cwd for more information.\n */\n start?: string;\n\n /**\n * The directory to stop at.\n *\n * The default is the root of the file system.\n */\n stop?: string;\n\n /**\n * The type of mode that the path must support in order\n * to be approved.\n *\n * The default is undefined and left up to the node api.\n */\n mode?: number;\n}\n\n/**\n * Represents a service to enumerate the file system.\n */\nexport interface IZFileSystemService {\n /**\n * Gets information about a node.\n *\n * @param path -\n * The path to get information for.\n *\n * @returns\n * Information about the node.\n */\n info(path: string): Promise<IZFileSystemNode>;\n\n /**\n * Reads all nodes that match a pattern.\n *\n * @param pattern -\n * The pattern string to match against.\n * @param options -\n * The options for the search.\n *\n * @returns\n * A list of path strings that match the given patterns.\n */\n search(\n pattern: string,\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]>;\n\n /**\n * Walks up a directory tree to search for existence of a given path.\n *\n * @param search -\n * The path to search for. This is the candidate folder path that\n * may or may not exist somewhere from the start directory all the\n * way up the directory tree.\n * @param options -\n * The given options for the search.\n *\n * @returns\n * The fully qualified path to the first path that matches the search\n * starting at the options start or the current working directory if not\n * specified. Returns null if no such directory exists.\n *\n * @example\n *\n * ```ts\n * import { resolve } from 'path'\n *\n * // Find any folder named .vscode from the current working directory all the way\n * // up the directory tree. Returns null if no vscode directory can be found.\n * const service = new ZFileSystemService();\n * const vscode = service.walk('.vscode');\n *\n * // Walk the directory tree from the current script and find the .config folder.\n * const config = service.walk('.config', { start: __dirname });\n *\n * // Walk the directory tree from the current script and stop when we reach\n * // at most 2 directories up.\n * const start = __dirname;\n * const stop = resolve(__dirname, '../..');\n * const file = service.walk('path/to/file.json', { start, stop });\n * ```\n */\n walk(\n search: string,\n options?: IZFileSystemWalkOptions,\n ): Promise<string | null>;\n}\n\n/**\n * Represents a node implementation of a file system service.\n */\nexport class ZFileSystemService implements IZFileSystemService {\n public async info(path: string): Promise<IZFileSystemNode> {\n const [file] = await this.search(path);\n return file;\n }\n\n public async search(\n pattern: string | string[],\n options?: IZFileSystemSearchOptions,\n ): Promise<IZFileSystemNode[]> {\n const paths = await glob(pattern, {\n stat: true,\n ...options,\n withFileTypes: true,\n });\n\n return paths.map((path) => {\n let info = new ZFileSystemNodeBuilder()\n .path(path.fullpath())\n .created(path.birthtime)\n .updated(path.atime)\n .size(path.size);\n\n // Note that for folders, node will return the size of the underlying OS metadata,\n // hence, why we remove the size on the folder here.\n info = path.isFile() ? info.file() : info.folder().size(undefined);\n\n return info.build();\n });\n }\n\n public async walk(search: string, options?: IZFileSystemWalkOptions) {\n const start = options?.start || cwd();\n const stop = options?.stop || \"/\";\n const mode = options?.mode;\n\n const _test = async (path: string) => {\n try {\n await access(path, mode);\n return true;\n } catch {\n return false;\n }\n };\n\n if (isAbsolute(search)) {\n return (await _test(search)) ? search : null;\n }\n\n let dir = start;\n do {\n const path = resolve(dir, search);\n const exists = await _test(path);\n\n if (exists) {\n return path;\n }\n\n dir = dir === stop ? \"\" : dirname(dir);\n } while (dir.length);\n\n return null;\n }\n}\n"],"names":["ZFileSystemNodeType","ZFileSystemNodeBuilder","_node","path","type","created","at","Date","toJSON","updated","size","bytes","BigInt","file","bind","folder","build","clone","structuredClone","omitBy","isUndefined","ZFileSystemService","info","search","pattern","options","paths","glob","stat","withFileTypes","map","fullpath","birthtime","atime","isFile","undefined","walk","start","cwd","stop","mode","_test","access","isAbsolute","dir","resolve","exists","dirname","length"],"mappings":";;;;;;AAEA;;IAGO,IAAKA,mBAAAA,iBAAAA,SAAAA,mBAAAA,EAAAA;;;AAAAA,IAAAA,OAAAA,mBAAAA;AAGX,CAAA,CAAA,EAAA;AA6BD;;AAEC,IACM,MAAMC,sBAAAA,CAAAA;IACHC,KAAAA;IAER,WAAA,EAAqB;QACnB,IAAI,CAACA,KAAK,GAAG;YACXC,IAAAA,EAAM,GAAA;YACNC,IAAI,EAAA;AACN,SAAA;AACF,IAAA;AAEOC,IAAAA,OAAAA,CAAQC,EAA8B,EAAE;QAC7C,IAAI,CAACJ,KAAK,CAACG,OAAO,GAAGC,EAAAA,YAAcC,IAAAA,GAAOD,EAAAA,CAAGE,MAAM,EAAA,GAAKF,EAAAA;AACxD,QAAA,OAAO,IA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KAAAA,CAAMlB,MAAAA,CAAAA,GAAWA,MAAAA,GAAS,IAAA;AAC1C,QAAA;AAEA,QAAA,IAAIqB,GAAAA,GAAMP,KAAAA;QACV,GAAG;YACD,MAAMlC,IAAAA,GAAO0C,QAAQD,GAAAA,EAAKrB,MAAAA,CAAAA;YAC1B,MAAMuB,MAAAA,GAAS,MAAML,KAAAA,CAAMtC,IAAAA,CAAAA;AAE3B,YAAA,IAAI2C,MAAAA,EAAQ;gBACV,OAAO3C,IAAAA;AACT,YAAA;YAEAyC,GAAAA,GAAMA,GAAAA,KAAQL,IAAAA,GAAO,EAAA,GAAKQ,OAAAA,CAAQH,GAAAA,CAAAA;QACpC,CAAA,OAASA,GAAAA,CAAII,MAAM;QAEnB,OAAO,IAAA;AACT,IAAA;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zthun/crumbtrail-fs",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A better file system module for node",
5
5
  "author": "Anthony Bonta",
6
6
  "license": "MIT",
@@ -32,13 +32,13 @@
32
32
  "lodash-es": "^4.17.21"
33
33
  },
34
34
  "devDependencies": {
35
- "@zthun/janitor-build-config": "^19.2.6",
36
- "vite": "^6.3.5",
35
+ "@zthun/janitor-build-config": "^19.3.1",
36
+ "vite": "^7.0.5",
37
37
  "vitest": "^3.2.4"
38
38
  },
39
39
  "files": [
40
40
  "dist"
41
41
  ],
42
42
  "sideEffects": false,
43
- "gitHead": "7bd93a9893a40004ed0f59f1be35397963de8583"
43
+ "gitHead": "d564d17a1cfb1e616ca6595eee7e6bc281078830"
44
44
  }