import type { CallExpression, ImportDeclaration, MemberExpression, Node } from "acorn"; import type { ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier } from "acorn"; import type { Sourcemap } from "./sourcemap.js"; export type NamedImportSpecifier = ImportSpecifier | ImportDefaultSpecifier; export type AnyImportSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier; /** Throws a syntax error if any export declarations are found. */ export declare function checkExports(body: Node, { input }: { input: string; }): void; /** Returns true if the body includes an import declaration. */ export declare function hasImportDeclaration(body: Node): boolean; /** Returns true if the given node is an import.meta.resolve(…) call. */ export declare function isImportMetaResolve(node: CallExpression): boolean; /** Returns true if the given node is an import.meta.url expression. */ export declare function isImportMetaUrl(node: MemberExpression): boolean; export type RewriteImportOptions = { /** If true, resolve local imports relative to document.baseURI. */ resolveLocalImports?: boolean; }; export declare function rewriteImportExpressions(output: Sourcemap, body: Node, { resolveLocalImports }?: RewriteImportOptions): void; /** Note: mutates inputs! */ export declare function rewriteImportDeclarations(output: Sourcemap, body: Node, inputs: string[], { resolveLocalImports }?: RewriteImportOptions): void; export declare function getLocalName(node: NamedImportSpecifier): string; export declare function getImportedName(node: NamedImportSpecifier): string; export declare function flatMapImportSpecifiers(node: ImportDeclaration, f: (node: NamedImportSpecifier) => T): T[];