import { createIdResolver as baseCreateIdResolver, } from "vite";
import { getLogger } from "./util/logger.js";
let internalResolver;
export function getFullImportPath(importPath) {
    if (!internalResolver) {
        getLogger().debug(`Resolver not initialized, cannot resolve import: ${importPath}`);
        return Promise.resolve(null);
    }
    return internalResolver(importPath);
}
export function createIdResolver(config, environment) {
    const idResolver = baseCreateIdResolver(config);
    internalResolver = async (id) => {
        try {
            const resolved = await idResolver(environment, id);
            if (!resolved) {
                return null;
            }
            return resolved;
        }
        catch (error) {
            getLogger().debug(`Failed to resolve import "${id}": ${error}`);
            return null;
        }
    };
}
//# sourceMappingURL=resolver.js.map