UNPKG

make-vfs

Version:

Easily make a virtual filesystem from a directory

17 lines (15 loc) 842 B
type Path = string; type Content = Buffer | ArrayBuffer | string; type ContentFormat = "buffer" | "string" | "arraybuffer" | "import-star" | "import-default" | "require" | "export-pathlist" | "import-bunfile"; interface SearchOpts { dirPath: string; targetPath?: string; extensions?: string[]; fileMatchFn?: (filename: string, path: string) => boolean; contentFormat?: ContentFormat; noImportExt?: boolean; } declare const getMatchingFilePaths: ({ dirPath, extensions, fileMatchFn, }: SearchOpts) => Promise<string[]>; declare const getVirtualFileSystemFromDirPath: (opts: SearchOpts) => Promise<Record<Path, Content>>; declare const getVirtualFilesystemModuleFromDirPath: (opts: SearchOpts) => Promise<string>; export { getMatchingFilePaths, getVirtualFileSystemFromDirPath, getVirtualFilesystemModuleFromDirPath };