UNPKG

1.74 kBPlain TextView Raw
1export const FSTree: FSTree.Static = require("fs-tree-diff");
2export const BroccoliPlugin: BroccoliPlugin.Static = require("broccoli-plugin");
3export const walkSync: WalkSync = require("walk-sync");
4export const md5Hex: MD5Hex = require("md5-hex");
5export const heimdall: Heimdall = require("heimdalljs");
6
7declare function require(id: string): any;
8
9export interface Token {
10 __tokenBrand: any;
11}
12
13export interface Heimdall {
14 start(name: string): Token;
15 stop(token: Token): void;
16}
17
18export type MD5Hex = (str: string) => string;
19
20export namespace BroccoliPlugin {
21 export interface PluginOptions {
22 name?: string;
23 annotation?: string;
24 persistentOutput?: boolean;
25 }
26
27 export interface Plugin {
28 inputPaths: string[];
29 outputPath: string;
30 cachePath: string;
31 }
32
33 export type Static = new (inputNodes: any[], options?: any) => Plugin;
34}
35
36export interface WalkSync {
37 (path: string, options?: any): string[];
38 entries(path: string, options?: any): WalkSync.Entry[];
39}
40
41export namespace WalkSync {
42 export type Row = string | RegExp[];
43
44 export interface Entry {
45 relativePath: string;
46 basePath: string;
47 fullPath: string;
48 checksum: string;
49 mode: number;
50 size: number;
51 mtime: Date;
52 isDirectory(): boolean;
53 }
54}
55
56export interface FSTree {
57 calculatePatch(
58 next: FSTree,
59 isUnchanged?: (a: WalkSync.Entry, b: WalkSync.Entry) => {}
60 ): FSTree.PatchOp[];
61}
62
63export namespace FSTree {
64 export type Op = "unlink" | "create" | "mkdir" | "rmdir" | "change";
65
66 export type PatchOp = [Op, string, WalkSync.Entry];
67
68 export interface Static {
69 fromEntries(
70 entries: WalkSync.Entry[],
71 options?: {
72 sortAndExpand?: boolean;
73 }
74 ): FSTree;
75 }
76}