diff --git a/node-file-trace.d.ts b/node-file-trace.d.ts index c18d8336..ee4623c8 100644 --- a/node-file-trace.d.ts +++ b/node-file-trace.d.ts @@ -1,14 +1,58 @@ -interface NodeFileTraceOptions { +interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atimeMs: number; + mtimeMs: number; + ctimeMs: number; + birthtimeMs: number; + atime: Date; + mtime: Date; + ctime: Date; + birthtime: Date; +} + +export interface NodeFileTraceOptions { base?: string; ignore?: string | string[] | ((path: string) => boolean); ts?: boolean; log?: boolean; mixedModules?: boolean; readFile?: (path: string) => Buffer | string | null; - stat?: (path: string) => Object | null; + stat?: (path: string) => Stats | null; readlink?: (path: string) => string | null; } -declare function NodeFileTrace (files: string[], opts: NodeFileTraceOptions): Promise<{ fileList: string[], esmFileList: string[] }>; +export interface NodeFileTraceReasons { + [fileName: string]: { + type: string; + ignored: boolean; + parents: string[]; + }; +} + +export interface NodeFileTraceResult { + fileList: string[]; + esmFileList: string[]; + reasons: NodeFileTraceReasons; + warnings: Error[]; +} -export = NodeFileTrace; +export default function NodeFileTrace( + files: string[], + opts: NodeFileTraceOptions +): Promise;