UNPKG

1.65 kBTypeScriptView Raw
1export declare const FSTree: FSTree.Static;
2export declare const BroccoliPlugin: BroccoliPlugin.Static;
3export declare const walkSync: WalkSync;
4export declare const md5Hex: MD5Hex;
5export declare const heimdall: Heimdall;
6export interface Token {
7 __tokenBrand: any;
8}
9export interface Heimdall {
10 start(name: string): Token;
11 stop(token: Token): void;
12}
13export declare type MD5Hex = (str: string) => string;
14export declare namespace BroccoliPlugin {
15 interface PluginOptions {
16 name?: string;
17 annotation?: string;
18 persistentOutput?: boolean;
19 }
20 interface Plugin {
21 inputPaths: string[];
22 outputPath: string;
23 cachePath: string;
24 }
25 type Static = new (inputNodes: any[], options?: any) => Plugin;
26}
27export interface WalkSync {
28 (path: string, options?: any): string[];
29 entries(path: string, options?: any): WalkSync.Entry[];
30}
31export declare namespace WalkSync {
32 type Row = string | RegExp[];
33 interface Entry {
34 relativePath: string;
35 basePath: string;
36 fullPath: string;
37 checksum: string;
38 mode: number;
39 size: number;
40 mtime: Date;
41 isDirectory(): boolean;
42 }
43}
44export interface FSTree {
45 calculatePatch(next: FSTree, isUnchanged?: (a: WalkSync.Entry, b: WalkSync.Entry) => {}): FSTree.PatchOp[];
46}
47export declare namespace FSTree {
48 type Op = "unlink" | "create" | "mkdir" | "rmdir" | "change";
49 type PatchOp = [Op, string, WalkSync.Entry];
50 interface Static {
51 fromEntries(entries: WalkSync.Entry[], options?: {
52 sortAndExpand?: boolean;
53 }): FSTree;
54 }
55}