import { toSafeImportPath } from "./import-specifier.js"; export { toSafeImportPath as toSafeRuntimeImportPath } from "./import-specifier.js"; export function resolveRuntimeImportSpecifier(baseUrl: string, parts: readonly string[]): string { const joined = parts.join(""); const safeJoined = toSafeImportPath(joined); if (safeJoined !== joined) { return safeJoined; } return new URL(joined, toSafeImportPath(baseUrl)).href; } export async function importRuntimeModule( baseUrl: string, parts: readonly string[], importModule: (specifier: string) => Promise = (specifier) => import(specifier), ): Promise { return (await importModule(resolveRuntimeImportSpecifier(baseUrl, parts))) as T; }