UNPKG

rsbuild-plugin-react-router

Version:
36 lines (35 loc) 1.89 kB
import type { Route, PluginOptions } from './types.js'; import type { RsbuildPluginAPI, Rspack } from '@rsbuild/core'; import { createReactRouterManifestStats, generateReactRouterManifestForDev, getReactRouterManifestForDev } from './manifest.js'; type StatsAssetWithIntegrity = { name?: string; integrity?: unknown; }; type StatsWithIntegrity = { assets?: StatsAssetWithIntegrity[]; }; type CompilationAssetWithIntegrity = { name: string; info?: { integrity?: unknown; }; }; type CompilationWithIntegrityAssets = { getAssets?: () => readonly CompilationAssetWithIntegrity[]; } | Pick<Rspack.Compilation, 'getAssets'>; type ModifyBrowserManifestOptions = { future?: { unstable_subResourceIntegrity?: boolean; }; subResourceIntegrity?: boolean; manifestChunkNames?: ReadonlySet<string>; onManifest?: (manifest: Awaited<ReturnType<typeof getReactRouterManifestForDev>>, sri: Record<string, string> | true | undefined, moduleExportsByRouteId: Awaited<ReturnType<typeof generateReactRouterManifestForDev>>['moduleExportsByRouteId'], context: { compilation: Rspack.Compilation; manifestStats: ReturnType<typeof createReactRouterManifestStats>; }) => void; }; type ProcessAssetsApi = Pick<RsbuildPluginAPI, 'processAssets'>; type AssetPrefixInput = string | (() => string); export declare const collectSubresourceIntegrity: (stats: StatsWithIntegrity | undefined, compilation: CompilationWithIntegrityAssets | undefined, assetPrefix?: string) => Record<string, string> | undefined; export declare function registerModifyBrowserManifestAssets(api: ProcessAssetsApi, routes: Record<string, Route>, pluginOptions: PluginOptions, appDirectory: string, assetPrefix?: AssetPrefixInput, routeChunkOptions?: Parameters<typeof getReactRouterManifestForDev>[5], options?: ModifyBrowserManifestOptions): void; export {};