import type { RuntimeAdapter } from "../../../platform/adapters/base.js"; /** * Point an esm.sh bundle's server-absolute and relative specifiers at absolute * esm.sh URLs, so the module still resolves once it is written to a temp file. * * The rewrite is driven by the module lexer rather than by pattern matching: * only a position the lexer reports as a specifier is edited, so ordinary * string data that happens to read like an import statement - say * `const help = 'from "/v135/help"'` - is left alone. Guessing with a regex * would reintroduce exactly the string-versus-specifier confusion this avoids. * * A bundle the lexer cannot read fails the load. Writing it out verbatim would * be sound only if every specifier in it were already absolute, and deciding * that without the lexer means re-deriving JS tokenisation from a regex: * comments and regular-expression literals carrying a quote desynchronise the * scan, escaped delimiters and line continuations hide the specifiers after * them, and an escaped specifier such as `".\/dep.js"` does not compare equal * to the path it denotes. Every one of those misses reads as "nothing to * rewrite" and ships an artifact whose imports resolve against the temp * directory rather than esm.sh - a broken module reported as a successful * fetch. There is no partial answer worth having here, so an unreadable bundle * is refused, the same way `staticImportSpecifiers` treats one as entirely * static rather than quietly shipping a remote dependency. */ export declare function rewriteEsmPaths(code: string, urlBase: string): Promise; export declare function fetchEsmModule(url: string, tmpDir: string, localAdapter: RuntimeAdapter, esmCache: Map): Promise; //# sourceMappingURL=esm-rewriter.d.ts.map