@ainc/script
Version:
Script compiler for typescript
54 lines • 1.74 kB
TypeScript
/**
*****************************************
* 加载依赖
*****************************************
*/
import { types, NodePath, PluginPass } from '@babel/core';
import { Options as ResolvePathOptions } from '@ainc/fs/dist/resolvePath';
/**
*****************************************
* 插件状态
*****************************************
*/
interface State extends PluginPass {
dirname?: string;
calls?: string[];
resolveFile?(source: string, context?: string): void | string;
}
/**
*****************************************
* 访问调用表达式
*****************************************
*/
declare function visitCallExpression(expr: NodePath<types.CallExpression>, state: State): void;
/**
*****************************************
* 访问载入声明
*****************************************
*/
declare function visitImportDeclaration(expr: NodePath<types.ImportDeclaration | types.ExportDeclaration>, state: State): void;
/**
*****************************************
* 插件配置
*****************************************
*/
export interface Options extends ResolvePathOptions {
calls?: string[];
exclude?: string[];
}
declare const _default: (api: object, options: Options | null | undefined, dirname: string) => {
name: string;
pre(this: PluginPass, file: import("@babel/core").BabelFile): void;
visitor: {
ImportDeclaration: typeof visitImportDeclaration;
ExportDeclaration: typeof visitImportDeclaration;
CallExpression: typeof visitCallExpression;
};
};
/**
*****************************************
* 定义插件
*****************************************
*/
export default _default;
//# sourceMappingURL=module-paths-plugin.d.ts.map