UNPKG

1.66 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 interface Static {
26 new (inputNodes: any[], options?: any): Plugin;
27 }
28}
29export interface WalkSync {
30 (path: string, options?: any): string[];
31 entries(path: string, options?: any): WalkSync.Entry[];
32}
33export declare namespace WalkSync {
34 type Row = string | RegExp[];
35 interface Entry {
36 relativePath: string;
37 basePath: string;
38 fullPath: string;
39 checksum: string;
40 mode: number;
41 size: number;
42 mtime: Date;
43 isDirectory(): boolean;
44 }
45}
46export interface FSTree {
47 calculatePatch(next: FSTree, isUnchanged?: (a: WalkSync.Entry, b: WalkSync.Entry) => {}): FSTree.PatchOp[];
48}
49export declare namespace FSTree {
50 type Op = "unlink" | "create" | "mkdir" | "rmdir" | "change";
51 type PatchOp = [Op, string, WalkSync.Entry];
52 interface Static {
53 fromEntries(entries: WalkSync.Entry[], options?: {
54 sortAndExpand?: boolean;
55 }): FSTree;
56 }
57}