@rspack/core
Version:
The fast Rust-based web bundler with webpack-compatible API
120 lines (119 loc) • 3.54 kB
TypeScript
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/DllReferencePlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { JsBuildMeta } from "@rspack/binding";
import type { Compiler } from "../Compiler";
export type DllReferencePluginOptions = {
/**
* Context of requests in the manifest (or content property) as absolute path.
*/
context?: string;
/**
* Extensions used to resolve modules in the dll bundle (only used when using 'scope').
*/
extensions?: string[];
/**
* An object containing content and name or a string to the absolute path of the JSON manifest to be loaded upon compilation.
*/
manifest: string | DllReferencePluginOptionsManifest;
/**
* The name where the dll is exposed (external name, defaults to manifest.name).
*/
name?: string;
/**
* Prefix which is used for accessing the content of the dll.
*/
scope?: string;
/**
* How the dll is exposed (libraryTarget, defaults to manifest.type).
*/
sourceType?: DllReferencePluginOptionsSourceType;
/**
* The way how the export of the dll bundle is used.
*/
type?: "require" | "object";
} | {
/**
* The mappings from request to module info.
*/
content: DllReferencePluginOptionsContent;
/**
* Context of requests in the manifest (or content property) as absolute path.
*/
context?: string;
/**
* Extensions used to resolve modules in the dll bundle (only used when using 'scope').
*/
extensions?: string[];
/**
* The name where the dll is exposed (external name).
*/
name: string;
/**
* Prefix which is used for accessing the content of the dll.
*/
scope?: string;
/**
* How the dll is exposed (libraryTarget).
*/
sourceType?: DllReferencePluginOptionsSourceType;
/**
* The way how the export of the dll bundle is used.
*/
type?: "require" | "object";
};
/**
* The type how the dll is exposed (external type).
*/
export type DllReferencePluginOptionsSourceType = "var" | "assign" | "this" | "window" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system";
/**
* An object containing content, name and type.
*/
export interface DllReferencePluginOptionsManifest {
/**
* The mappings from request to module info.
*/
content: DllReferencePluginOptionsContent;
/**
* The name where the dll is exposed (external name).
*/
name?: string;
/**
* The type how the dll is exposed (external type).
*/
type?: DllReferencePluginOptionsSourceType;
}
/**
* The mappings from request to module info.
*/
export interface DllReferencePluginOptionsContent {
/**
* Module info.
*/
[k: string]: {
/**
* Meta information about the module.
*/
buildMeta?: JsBuildMeta;
/**
* Information about the provided exports of the module.
*/
exports?: string[] | true;
/**
* Module ID.
*/
id?: string | number;
};
}
export declare class DllReferencePlugin {
private options;
private errors;
constructor(options: DllReferencePluginOptions);
apply(compiler: Compiler): void;
}