import type { IsomorphicRollupFs } from "../../fs-iface"; export type NodeModulesSymlinkResolver = { /** * Given a real (symlink-resolved) `filePath`, looks up the node_modules * symlink/junction whose real path is a prefix of it and rewrites the * path to go through that symlink, so a subsequent `path.relative` call * produces a clean `node_modules/@pkg/...` name instead of a `../../..` * traversal. * * Returns `undefined` when no symlink matches `filePath`. */ resolve: (fs: IsomorphicRollupFs, filePath: string) => Promise<{ filePath: string; relativeRoot: string; } | undefined>; /** Evicts the memoized node_modules scan, forcing a re-scan on next use. */ reset: () => void; }; /** * Creates a resolver that maps a real (symlink-resolved) path back to its * `node_modules`-relative path — needed because pnpm (and other symlink- * based package managers) resolve symlinks before passing the module id to * rollup plugins, so a file path can be the real path under * `packages//dist/` with no `node_modules` ancestor. * * The `node_modules` scan is built lazily on first use and cached until * `reset()` is called, so repeated lookups (e.g. one per extracted * stylesheet in a single build) don't rescan `node_modules` every time. */ export declare function createNodeModulesSymlinkResolver(rootDir: string): NodeModulesSymlinkResolver;