import type { Compiler, WebpackPluginInstance } from 'webpack'; import type { DynamicModuleMap } from '../utils/dynamic-module-parser'; export type DynamicModulePackageSpecs = { [pkgName: string]: Partial<{ /** @default 'dist/dynamic' */ dynamicModuleDir: string; /** @default 'dist/dynamic-modules.json' */ dynamicModuleMap: string; /** @default 'dist/esm/index.js' */ indexModule: string; /** @default 'module' */ resolutionField: string; }>; }; /** * Parse or generate dynamic module maps for the provided packages. */ export declare const resolveDynamicModuleMaps: ( /** Dynamic module package definitions. */ packageSpecs: DynamicModulePackageSpecs, /** Absolute paths to `node_modules` directories to search. */ modulePaths: string[], /** Optional check if the package is available. */ isPackageAvailable?: (pkgName: string) => boolean) => Record; export type DynamicModuleImportPluginOptions = { /** * Module specifier of the loader to use. * * By default, use `@openshift-console/dynamic-plugin-sdk-webpack` based module specifier. */ loader?: string; /** * Resolved module maps for all packages that support dynamic modules. * * @example * ```ts * { * '@patternfly/react-core': { * Alert: 'dist/dynamic/components/Alert', * AlertProps: 'dist/dynamic/components/Alert', * Wizard: 'dist/dynamic/components/Wizard', * } * } * ``` * * @see {@link resolveDynamicModuleMaps} */ dynamicModuleMaps: Record; /** * Modules that match this filter will have their imports transformed. * * Such transformations should only apply to JavaScript or TypeScript code. */ moduleFilter: (moduleRequest: string) => boolean; /** * Skip transforming imports whose module specifier matches one of these prefixes. */ skipImportPrefixes?: string[]; }; /** * Transforms import statements using Console dynamic module import loader. * * The loader is referenced using a module specifier since webpack takes care of creating * and initializing all loaders. */ export declare class DynamicModuleImportPlugin implements WebpackPluginInstance { private readonly options; constructor(options: DynamicModuleImportPluginOptions); apply(compiler: Compiler): void; }