restrict-imports-loader
Version:
A Webpack loader to restrict imports in ES and TypeScript
24 lines (23 loc) • 664 B
TypeScript
import ts from "typescript";
declare type ImportDetails = Readonly<{
path: string;
node: ts.Node;
line: number;
}>;
export declare type RestrictedImportDetails = ImportDetails & Readonly<{
info: string | undefined;
}>;
export declare type Decision = {
restricted: false;
} | {
restricted: true;
info?: string;
};
export declare type AsyncDeciderFunction = (importPath: string) => Promise<Decision>;
export declare function checkAsync(x: {
source: string;
deciders: readonly AsyncDeciderFunction[];
fileName: string;
setParentNodes: boolean;
}): Promise<ReadonlyArray<ReadonlyArray<RestrictedImportDetails>>>;
export {};