webpack-userscript
Version:
A Webpack plugin for userscript projects.
24 lines (23 loc) • 982 B
TypeScript
/// <reference types="node" />
export interface Stats {
isFile: () => boolean;
isDirectory: () => boolean;
}
export interface FsStat {
stat(path: string, callback: (err: Error | null, stats: Stats) => void): void;
}
export interface FsReadFile {
readFile(path: string, callback: (err: Error | null, content: Buffer) => void): void;
}
export interface FsWriteFile {
writeFile(path: string, data: string | Buffer, callback: (err: Error | null) => void): void;
}
export interface FsMkdir {
mkdir(path: string, options: {
recursive?: boolean;
}, callback: (err: Error | null, path?: string) => void): void;
}
export declare function findPackage(cwd: string, fs: FsStat): Promise<string>;
export declare function readJSON<T>(file: string, fs: FsReadFile): Promise<T>;
export declare function writeJSON(file: string, data: unknown, fs: FsWriteFile): Promise<void>;
export declare function mkdirp(dir: string, fs: FsMkdir): Promise<string | undefined>;