UNPKG

@storm-stack/core

Version:

A build toolkit and runtime used by Storm Software in TypeScript applications

39 lines (36 loc) 1.61 kB
import { NodePath } from '@babel/core'; import { ParseResult } from '@babel/parser'; import * as t from '@babel/types'; /** * Finds an export in the given Babel AST program by its key. * * @param ast - The parsed Babel AST result containing the program body. * @param key - The name of the export to find (e.g., "default" or a named export). * @returns The declaration of the export if found, otherwise undefined. */ declare function findExport(ast: ParseResult<t.File>, key: string): any; /** * Lists all exports from the given Babel AST program. * * @param codeOrAst - The parsed Babel AST result containing the program body. * @returns An array of export names, including "default" for default exports. */ declare function listExports(codeOrAst: ParseResult<t.File> | string): string[]; /** * Lists all imports from the given Babel AST program. * * @param ast - The parsed Babel AST result containing the program body. * @returns An array of import names, including "default" for default imports. */ declare function listImports(ast: ParseResult<t.File> | t.File): string[]; declare function isImportCall(calleePath: NodePath<t.CallExpression | t.NewExpression>): boolean; /** * Gets the import declaration for a given name and specifier. * * @param specifier - The specifier of the import. * @param name - The name of the import. * @param named - Optional named import. * @returns The import declaration. */ declare function getImport(specifier: string, name: string, named?: string): t.ImportDeclaration; export { findExport, getImport, isImportCall, listExports, listImports };