/** * RSCWebpackPlugin — the webpack React Server Components plugin, owned as * TypeScript source. * * This is a faithful port of the previously vendored build of React's * reference `ReactFlightWebpackPlugin` * (`src/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js`, now removed) * including every historical fork patch and in-repo edit that file accumulated: * * - Server-build support: `isServer` option, server manifest emission * (`react-server-client-manifest.json`), and server chunk-group scanning. * - CSS-before-JS chunk scan: CSS and JS files are recorded independently * of their order inside `chunk.files` (#44 regression coverage). * - Runtime-chunk filtering: files of each entrypoint's runtime chunk are * excluded from per-module chunk lists on the client build. * - #54: client manifest entries are built from the chunk group created by * each client reference's `AsyncDependenciesBlock` (matched through the * `ClientReferenceDependency`), with an eager-import fallback pass and a * warning when client-reference blocks are unavailable. * - #52: runtime-chunk CSS and `.hot-update.css` files are excluded from * the CLIENT manifest; the server manifest retains runtime CSS. * - #43: duplicate-package-install runtime detection — the Flight client * runtime is recognized by exact resolved path or by walking up from a * `react-server-dom-webpack/client.*.js` resource to a `package.json` * named `react-server-dom-webpack`. * - #23: manifest entries for a module recorded from several chunk groups * merge their chunk lists (deduped by chunk id) and CSS lists (deduped * by URL). The server build and the #54 fallback pass still rely on * these merge semantics. * * The `"use client"` directive detection reuses the shared * `hasUseClientDirective` helper from `../clientReferences` (also used by * the rspack plugin and `RSCReferenceDiscoveryPlugin`). */ import webpack = require('webpack'); declare const ModuleDependency: typeof webpack.dependencies.ModuleDependency; export declare class ClientReferenceDependency extends ModuleDependency { constructor(request: string); get type(): string; } /** * Detects whether `resource` is the react-on-rails-rsc Flight client runtime * the plugin keys its client-reference injection on. Results are memoized * because the parser hook runs for every module in the compilation. */ declare function isReactOnRailsRSCRuntimeResource(resource: string | undefined, isServer: boolean): boolean; export type ClientReferenceSearchPath = { directory: string; recursive?: boolean; include: RegExp; exclude?: RegExp; }; export type ClientReferencePath = string | ClientReferenceSearchPath; export type Options = { isServer: boolean; clientReferences?: ClientReferencePath | ReadonlyArray; chunkName?: string; chunkGroupWarningThreshold?: number | false; clientManifestFilename?: string; serverConsumerManifestFilename?: string; }; type FlightResolver = { resolve(context: object, basePath: string, request: string, resolveContext: object, callback: (err: Error | null, result?: unknown) => void): void; }; type FlightContextModuleFactory = { resolveDependencies(fs: unknown, options: { resource: string; resourceQuery: string; recursive: boolean; regExp: RegExp; include: undefined; exclude: RegExp | undefined; }, callback: (err: Error | null, dependencies?: Array<{ userRequest: string; }>) => void): void; }; export declare class RSCWebpackPlugin { readonly isServer: boolean; readonly clientReferences: ReadonlyArray; readonly chunkName: string; readonly chunkGroupWarningThreshold: number | false; readonly clientManifestFilename: string; /** * Accepted for option-shape compatibility with React's reference plugin; * the previously vendored build never emitted this manifest and neither * does this port. */ readonly serverConsumerManifestFilename: string; static __internal_isReactOnRailsRSCRuntimeResource: typeof isReactOnRailsRSCRuntimeResource; constructor(options: Options); apply(compiler: webpack.Compiler): void; /** * Resolves every configured `clientReferences` entry to a * `ClientReferenceDependency`: * - string entries are direct file references, included unconditionally; * - search-path entries are expanded through the context module factory * and filtered to files containing a `"use client"` directive. */ resolveAllClientFiles(context: string, contextResolver: FlightResolver, normalResolver: FlightResolver, fs: unknown, contextModuleFactory: FlightContextModuleFactory, callback: (err: Error | null, result?: ClientReferenceDependency[]) => void): void; } export default RSCWebpackPlugin; //# sourceMappingURL=RSCWebpackPlugin.d.ts.map