vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
26 lines • 1.21 kB
TypeScript
import type { Logger } from "vite";
export interface DiscoverOptions {
/** Project root for the crawl. Defaults to process.cwd() */
root?: string;
/** Whether this is a `vite build` (vs `vite serve`). */
isBuild: boolean;
/** Manually-specified packages to merge with auto-detected ones. */
manual?: readonly string[];
/** Packages to exclude from the merged list (manual or auto). */
exclude?: readonly string[];
/** Optional logger for warnings. */
logger?: Pick<Logger, "warn">;
}
/**
* Discovers npm packages that ship per-file `"use client"` directives by
* crawling the project's dependency tree and selecting any package whose
* `package.json` lists `react` in `peerDependencies`. Mirrors the helper
* pattern used by `@vitejs/plugin-rsc`.
*
* Returns the merged set of `manual ∪ auto-detected` minus `exclude`.
* On crawl failure (missing lockfile, monorepo edge cases) falls back to
* `manual` and emits a warning if a logger was provided — the caller's
* build is never blocked by discovery alone.
*/
export declare const discoverClientPackages: (options: DiscoverOptions) => Promise<readonly string[]>;
//# sourceMappingURL=discover.d.ts.map