import type es from 'estree'; import { ArrayMap } from '../dict'; import type { ModuleDeclarationWithSource } from '../../modules/moduleTypes'; export declare function getModuleDeclarationSource(node: ModuleDeclarationWithSource): string; export declare function extractIdsFromPattern(pattern: es.Pattern): es.Identifier[]; /** * Extracts all the identifiers being declared by a VariableDeclaration */ export declare function extractDeclarations(decl: es.VariableDeclaration): es.Identifier[]; /** * Gets all the identifiers introduced by a declaration node */ export declare function getIdsFromDeclaration(decl: es.Declaration | es.ModuleDeclaration): es.Identifier[]; /** * Since Variable declarations in Source programs must be initialized and are guaranteed to only * have 1 declarator, this function unwraps variable declarations and its single declarator * into its id and init */ export declare function getSourceVariableDeclaration(decl: es.VariableDeclaration): { id: es.Identifier; init: es.Expression; loc: es.SourceLocation | null | undefined; }; /** * Get the name of an import/export specifier endpoint. ES2022 allows these to be * string literals (e.g. `export { x as "y" }`); Source only supports identifier * names, so fall back to the literal's stringified value. */ export declare const getSpecifierName: (node: es.Identifier | es.Literal) => string; export declare const getImportedName: (spec: es.ImportSpecifier | es.ImportDefaultSpecifier | es.ExportSpecifier) => string; export declare const specifierToString: (spec: es.ImportSpecifier | es.ImportDefaultSpecifier | es.ExportSpecifier) => string; type BlockBody = (es.Program | es.BlockStatement)['body'][number]; type BlocKBodyWithoutDeclarations = Exclude; /** * Returns true if the array of statements doesn't contain any declarations */ export declare function hasNoDeclarations(stmt: BlockBody[]): stmt is BlocKBodyWithoutDeclarations[]; type BlockBodyWithoutImports = Exclude; /** * Returns true if the array of statements doesn't contain any import declarations */ export declare function hasNoImportDeclarations(stmt: BlockBody[]): stmt is BlockBodyWithoutImports[]; /** * Filters out all import declarations from a program, and sorts them by * the module they import from */ export declare function filterImportDeclarations({ body, }: es.Program): [ArrayMap, BlockBodyWithoutImports[]]; export {};