vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
43 lines • 1.68 kB
TypeScript
import { type MessagePort } from "node:worker_threads";
import type { LoadHook, ResolveHook } from "node:module";
import type { SerializedResolvedConfig, SerializedUserOptions } from "../types.js";
/**
* Global port for communication between the main thread and the CSS loader.
* This port is used to send CSS file requests and receive responses.
*/
export declare let loaderPort: MessagePort | undefined;
/**
* Initializes the CSS loader with the necessary communication channels.
* Sets up message handlers for CSS file requests and responses.
*
* @param data - Configuration data for the CSS loader
* @param data.port - The message port for communication
*/
export declare function initialize(data: {
id: string;
port: MessagePort;
resolvedConfig: SerializedResolvedConfig;
userOptions: SerializedUserOptions;
}): Promise<void>;
/**
* Vite's load hook implementation for CSS files.
* Handles CSS file loading requests and returns a placeholder module.
* The actual CSS content is processed in the main thread.
*
* @param url - The URL of the module to load
* @param context - The load hook context
* @param defaultLoad - The default load function
* @returns A promise that resolves to the module content
*/
export declare const load: LoadHook;
/**
* Vite's resolve hook implementation.
* Handles module resolution during development.
*
* @param specifier - The module specifier to resolve
* @param context - The resolve hook context
* @param defaultResolve - The default resolve function
* @returns A promise that resolves to the resolved module
*/
export declare const resolve: ResolveHook;
//# sourceMappingURL=css-loader.d.ts.map