mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
// Type definitions for istanbul-lib-hook 1.0
|
|
// Project: https://github.com/istanbuljs/istanbuljs
|
|
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.4
|
|
|
|
export interface Options {
|
|
verbose: boolean;
|
|
}
|
|
|
|
export interface HookRequireOptions extends Options {
|
|
extensions: string[];
|
|
postLoadHook(filename: string): void;
|
|
}
|
|
|
|
export function hookRequire(
|
|
matcher: Matcher,
|
|
transformer: Transformer,
|
|
options?: Partial<HookRequireOptions>
|
|
): () => void;
|
|
|
|
export function hookCreateScript(
|
|
matcher: Matcher,
|
|
transformer: Transformer,
|
|
options?: Partial<Options>
|
|
): void;
|
|
|
|
export function unhookCreateScript(): void;
|
|
|
|
export function hookRunInThisContext(
|
|
matcher: Matcher,
|
|
transformer: Transformer,
|
|
options?: Partial<Options>
|
|
): void;
|
|
|
|
export function unhookRunInThisContext(): void;
|
|
|
|
export function unloadRequireCache(matcher: Matcher): void;
|
|
|
|
export type Matcher = (filename: string) => boolean;
|
|
export type Transformer = (code: string, filepath: string) => string;
|