vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
18 lines • 956 B
TypeScript
/**
* Heuristic: does this source carry Vite-injected preamble?
*
* Vite prepends code above a module's own source in several situations — most
* importantly a `__vitePreload` import for files that use dynamic `import()`,
* and HMR / env wiring in dev. That injected preamble lands *above* a file's
* `"use client"` / `"use server"` directive, which would otherwise look like
* "real code before the directive".
*
* react-server-loader is deliberately bundler-agnostic: its directive engine
* only warns about a misplaced directive unless the host says leading code is
* expected, via the `tolerateLeadingCode` predicate. This is vprs's Vite-aware
* implementation of that predicate — when these markers are present the leading
* code is Vite's, not the author's, so the directive-placement warning is
* suppressed.
*/
export declare const isViteInjectedCode: (source: string) => boolean;
//# sourceMappingURL=isViteInjectedCode.d.ts.map