diff --git a/lib/Dependency.js b/lib/Dependency.js index 6ff5ebe25..721c08995 100644 --- a/lib/Dependency.js +++ b/lib/Dependency.js @@ -215,7 +215,9 @@ class Dependency { } } +/** @type {string[][]} */ Dependency.NO_EXPORTS_REFERENCED = []; +/** @type {string[][]} */ Dependency.EXPORTS_OBJECT_REFERENCED = [[]]; Object.defineProperty(Dependency.prototype, "module", { diff --git a/lib/index.js b/lib/index.js index c4974ee22..dfcf631fa 100644 --- a/lib/index.js +++ b/lib/index.js @@ -114,6 +114,9 @@ module.exports = mergeExports(fn, { get AutomaticPrefetchPlugin() { return require("./AutomaticPrefetchPlugin"); }, + get AsyncDependenciesBlock() { + return require("./AsyncDependenciesBlock"); + }, get BannerPlugin() { return require("./BannerPlugin"); }, @@ -318,6 +321,18 @@ module.exports = mergeExports(fn, { } }, + dependencies: { + get ModuleDependency() { + return require("./dependencies/ModuleDependency"); + }, + get ConstDependency() { + return require("./dependencies/ConstDependency"); + }, + get NullDependency() { + return require("./dependencies/NullDependency"); + } + }, + ids: { get ChunkModuleIdRangePlugin() { return require("./ids/ChunkModuleIdRangePlugin"); diff --git a/types.d.ts b/types.d.ts index dea158c11..d15d676ac 100644 --- a/types.d.ts +++ b/types.d.ts @@ -318,7 +318,14 @@ declare interface AssetResourceGeneratorOptions { */ publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); } -declare abstract class AsyncDependenciesBlock extends DependenciesBlock { +declare class AsyncDependenciesBlock extends DependenciesBlock { + constructor( + groupOptions: RawChunkGroupOptions & { name?: string } & { + entryOptions?: EntryOptions; + }, + loc?: SyntheticDependencyLocation | RealDependencyLocation, + request?: string + ); groupOptions: RawChunkGroupOptions & { name?: string } & { entryOptions?: EntryOptions; }; @@ -2099,6 +2106,22 @@ type ConnectionState = | boolean | typeof TRANSITIVE_ONLY | typeof CIRCULAR_CONNECTION; +declare class ConstDependency extends NullDependency { + constructor( + expression: string, + range: number | [number, number], + runtimeRequirements?: string[] + ); + expression: string; + range: number | [number, number]; + runtimeRequirements: null | Set; + static Template: typeof ConstDependencyTemplate; + static NO_EXPORTS_REFERENCED: string[][]; + static EXPORTS_OBJECT_REFERENCED: string[][]; +} +declare class ConstDependencyTemplate extends NullDependencyTemplate { + constructor(); +} declare interface Constructor { new (...params: any[]): any; } @@ -2436,14 +2459,15 @@ declare class Dependency { deserialize(__0: { read: any }): void; module: any; readonly disconnect: any; - static NO_EXPORTS_REFERENCED: any[]; - static EXPORTS_OBJECT_REFERENCED: never[][]; + static NO_EXPORTS_REFERENCED: string[][]; + static EXPORTS_OBJECT_REFERENCED: string[][]; } declare interface DependencyConstructor { new (...args: any[]): Dependency; } type DependencyLocation = SyntheticDependencyLocation | RealDependencyLocation; -declare abstract class DependencyTemplate { +declare class DependencyTemplate { + constructor(); apply( dependency: Dependency, source: ReplaceSource, @@ -5897,10 +5921,14 @@ declare class ModuleConcatenationPlugin { */ apply(compiler: Compiler): void; } -declare abstract class ModuleDependency extends Dependency { +declare class ModuleDependency extends Dependency { + constructor(request: string); request: string; userRequest: string; range: any; + static Template: typeof DependencyTemplate; + static NO_EXPORTS_REFERENCED: string[][]; + static EXPORTS_OBJECT_REFERENCED: string[][]; } declare abstract class ModuleFactory { create( @@ -6791,6 +6819,15 @@ type NormalizedStatsOptions = KnownNormalizedStatsOptions & | "_env" > & Record; +declare class NullDependency extends Dependency { + constructor(); + static Template: typeof NullDependencyTemplate; + static NO_EXPORTS_REFERENCED: string[][]; + static EXPORTS_OBJECT_REFERENCED: string[][]; +} +declare class NullDependencyTemplate extends DependencyTemplate { + constructor(); +} declare interface ObjectDeserializerContext { read: () => any; } @@ -11439,6 +11476,9 @@ declare namespace exports { options: WebpackOptionsNormalized ) => void; } + export namespace dependencies { + export { ModuleDependency, ConstDependency, NullDependency }; + } export namespace ids { export { ChunkModuleIdRangePlugin, @@ -11630,6 +11670,7 @@ declare namespace exports { ) => void; export { AutomaticPrefetchPlugin, + AsyncDependenciesBlock, BannerPlugin, Cache, Chunk,