UNPKG

watch-dependency-graph

Version:

[![npm version](https://img.shields.io/npm/v/watch-dependency-graph?style=flat&colorA=4488FF&colorB=4488FF)](https://www.npmjs.com/package/watch-dependency-graph) [![test coverage](https://img.shields.io/coveralls/github/sure-thing/watch-dependency-graph?

43 lines (42 loc) 1.74 kB
export declare type Alias = { [alias: string]: string; }; export declare type Options = { alias?: Alias; }; export declare type Tree = { [filename: string]: { entry: boolean; parents: string[]; children: string[]; }; }; export declare function createEmitter(): { clear: () => void; emit: (event: string, data?: any) => void; on: (event: string, handler: any) => () => void; listeners: (event: string) => any[]; }; export declare function resolveAliases(filepath: string, alias?: Alias): string; /** * Lifted from snowpack, props to their team * * @see https://github.com/snowpackjs/snowpack/blob/f75de1375fe14155674112d88bf211ca3721ac7c/snowpack/src/scan-imports.ts#L119 */ export declare function cleanCodeForParsing(code: string): string; export declare function getChildrenModuleIds(filepath: string, options?: Options): Promise<string[]>; export declare function walk(filepath: string, tree: Tree, options?: Options): Promise<Tree>; export declare function remove(filepath: string, tree: Tree): void; export declare function clearCacheUp(filepath: string, tree: Tree): void; export declare function findTopmostParents(filepath: string, tree: Tree, visited?: string[]): string[]; export declare function create(options?: Options): { readonly tree: Tree; on(event: string, handler: any): () => void; onAdd(handler: (files: string[]) => void): () => void; onRemove(handler: (files: string[]) => void): () => void; onChange(handler: (files: string[]) => void): () => void; onError(handler: (error: string | Error) => void): () => void; close(): void; add(filepaths: string | string[]): Promise<void>; remove(filepaths: string | string[]): void; };