UNPKG

vite-require

Version:
28 lines (27 loc) 844 B
import type { AcornNode } from './types'; export declare enum TopScopeType { ExpressionStatement = "ExpressionStatement", VariableDeclaration = "VariableDeclaration" } export interface RequireStatement { node: AcornNode; ancestors: AcornNode[]; /** * If require statement located top-level scope ant it is convertible, this will have a value(🎯-①) * 如果 require 在顶级作用于,并且是可转换 import 的,那么 topScopeNode 将会被赋值 */ topScopeNode?: AcornNode & { type: TopScopeType; }; dynamic?: 'dynamic' | 'Literal'; } export interface Analyzed { ast: AcornNode; code: string; require: RequireStatement[]; } /** * `require` statement analyzer * require 语法分析器 */ export declare function analyze(ast: AcornNode, code: string): Analyzed;