/**
 * InMemoryPackageSurface — `PackageSurfaceResolver` test double.
 *
 * Backed by a plain `Map<string, PackageSurface>`; calls for unknown
 * packages throw the same `package-not-installed` error the
 * `DtsPackageSurface` adapter throws, so test scenarios for the
 * `unresolved` path need no special handling.
 */
import { PackageSurfaceResolverError, } from "../../_vendor/ailf-core/index.js";
export class InMemoryPackageSurface {
    surfaces;
    constructor(surfaces = []) {
        this.surfaces = new Map();
        for (const surface of surfaces) {
            this.surfaces.set(surface.pkg, surface);
        }
    }
    set(surface) {
        this.surfaces.set(surface.pkg, surface);
    }
    async resolveExports(pkg) {
        const surface = this.surfaces.get(pkg);
        if (!surface) {
            throw new PackageSurfaceResolverError("package-not-installed", pkg, `InMemoryPackageSurface has no entry for "${pkg}".`);
        }
        return surface;
    }
}
