/**** * Lexer-bounded import edit primitives. * * Single parse per file - reused across all strategies. * This eliminates redundant parsing that happened with the fragmented system. */ import type { ImportSpecifierInfo } from "./types.js"; import type { ImportSpecifier } from "../esm/lexer.js"; /** * Initialize the ModuleLexer (must be called before parsing). */ export declare function initLexer(): Promise; /** * Parsed import information with position data. */ export interface ParsedImportEdits { /** All imports found in the code */ imports: ImportSpecifierInfo[]; /** Dynamic imports whose specifier is an expression rather than a literal. */ computedDynamicImports: Array<{ start: number; end: number; dynamicImportStart: number; }>; /** URL map for restoring masked HTTP URLs */ urlMap: Map; /** Original masked code (for position calculations) */ maskedCode: string; } /** * Parse all imports from code using es-module-lexer. * Returns structured import info with position data. */ export declare function parseImportEdits(code: string): Promise; /** * Wrap computed browser imports without changing native import options. * * es-module-lexer 2.3 exposes `s..e` as the first-argument expression even * when a second import-options argument exists. Non-string values are returned * untouched so the native import operation retains responsibility for coercion. */ export declare function applyComputedDynamicImportPinning(parsed: ParsedImportEdits, modulePath?: string, options?: { ssr?: boolean; }): string; /** * Apply import rewrites to code. * * Takes the parsed imports and a map of specifier -> replacement. * Applies replacements from end to start to preserve positions. * * IMPORTANT: Positions from es-module-lexer are relative to the masked code * (HTTP URLs replaced with short placeholders). We must apply rewrites to the * masked code first, then unmask the final result to restore any untouched URLs. */ export declare function applyImportEdits(parsed: ParsedImportEdits, rewrites: Map): string; /** * Simple specifier replacement (for strategies that don't need full statement control). */ export declare function replaceImportSpecifiers(code: string, replacer: (specifier: string, isDynamic: boolean) => string | null | undefined): Promise; /** * The range holding everything a specifier declares after its own text: the * `with` clause of a static import, or the options argument of a dynamic one. * * The range is empty when the import declares no attributes. */ export declare function importAttributeRange(imp: ImportSpecifier): { start: number; end: number; }; //# sourceMappingURL=import-edit.d.ts.map