webpack 5.90.2 → 5.90.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

package/types.d.ts CHANGED
@@ -817,9 +817,7 @@ declare abstract class BasicEvaluatedExpression {
817
817
  | TemplateElement
818
818
  ): BasicEvaluatedExpression;
819
819
  }
820
- declare interface BuildInfo {
821
- [index: string]: any;
822
- }
820
+ type BuildInfo = KnownBuildInfo & Record<string, any>;
823
821
  type BuildMeta = KnownBuildMeta & Record<string, any>;
824
822
  declare abstract class ByTypeGenerator extends Generator {
825
823
  map: Record<string, Generator>;
@@ -958,15 +956,15 @@ declare interface CallbackAsyncQueue<T> {
958
956
  declare interface CallbackCache<T> {
959
957
  (err?: null | WebpackError, result?: T): void;
960
958
  }
961
- declare interface CallbackFunction<T> {
959
+ declare interface CallbackFunction_1<T> {
962
960
  (err?: null | Error, result?: T): any;
963
961
  }
962
+ declare interface CallbackFunction_2<T> {
963
+ (err?: null | Error, stats?: T): void;
964
+ }
964
965
  declare interface CallbackNormalErrorCache<T> {
965
966
  (err?: null | Error, result?: T): void;
966
967
  }
967
- declare interface CallbackWebpack<T> {
968
- (err?: Error, stats?: T): void;
969
- }
970
968
  type Cell<T> = undefined | T;
971
969
  declare class Chunk {
972
970
  constructor(name?: string, backCompat?: boolean);
@@ -1858,7 +1856,7 @@ declare class Compilation {
1858
1856
  compilationDependencies: { add: (item?: any) => LazySet<string> };
1859
1857
  getStats(): Stats;
1860
1858
  createStatsOptions(
1861
- optionsOrPreset?: string | StatsOptions,
1859
+ optionsOrPreset?: string | boolean | StatsOptions,
1862
1860
  context?: CreateStatsOptionsContext
1863
1861
  ): NormalizedStatsOptions;
1864
1862
  createStatsFactory(options?: any): StatsFactory;
@@ -2278,8 +2276,11 @@ declare class Compiler {
2278
2276
  watchMode: boolean;
2279
2277
  getCache(name: string): CacheFacade;
2280
2278
  getInfrastructureLogger(name: string | (() => string)): WebpackLogger;
2281
- watch(watchOptions: WatchOptions, handler: CallbackFunction<Stats>): Watching;
2282
- run(callback: CallbackFunction<Stats>): void;
2279
+ watch(
2280
+ watchOptions: WatchOptions,
2281
+ handler: CallbackFunction_1<Stats>
2282
+ ): Watching;
2283
+ run(callback: CallbackFunction_1<Stats>): void;
2283
2284
  runAsChild(
2284
2285
  callback: (
2285
2286
  err?: null | Error,
@@ -2288,9 +2289,12 @@ declare class Compiler {
2288
2289
  ) => any
2289
2290
  ): void;
2290
2291
  purgeInputFileSystem(): void;
2291
- emitAssets(compilation: Compilation, callback: CallbackFunction<void>): void;
2292
- emitRecords(callback: CallbackFunction<void>): void;
2293
- readRecords(callback: CallbackFunction<void>): void;
2292
+ emitAssets(
2293
+ compilation: Compilation,
2294
+ callback: CallbackFunction_1<void>
2295
+ ): void;
2296
+ emitRecords(callback: CallbackFunction_1<void>): void;
2297
+ readRecords(callback: CallbackFunction_1<void>): void;
2294
2298
  createChildCompiler(
2295
2299
  compilation: Compilation,
2296
2300
  compilerName: string,
@@ -2307,8 +2311,8 @@ declare class Compiler {
2307
2311
  normalModuleFactory: NormalModuleFactory;
2308
2312
  contextModuleFactory: ContextModuleFactory;
2309
2313
  };
2310
- compile(callback: CallbackFunction<Compilation>): void;
2311
- close(callback: CallbackFunction<void>): void;
2314
+ compile(callback: CallbackFunction_1<Compilation>): void;
2315
+ close(callback: CallbackFunction_1<void>): void;
2312
2316
  }
2313
2317
  declare class ConcatSource extends Source {
2314
2318
  constructor(...args: (string | Source)[]);
@@ -4822,6 +4826,9 @@ declare class Generator {
4822
4826
  updateHash(hash: Hash, __1: UpdateHashContextGenerator): void;
4823
4827
  static byType(map: Record<string, Generator>): ByTypeGenerator;
4824
4828
  }
4829
+ declare interface GeneratorOptions {
4830
+ [index: string]: any;
4831
+ }
4825
4832
  type GeneratorOptionsByModuleType = GeneratorOptionsByModuleTypeKnown &
4826
4833
  GeneratorOptionsByModuleTypeUnknown;
4827
4834
 
@@ -6588,6 +6595,19 @@ declare interface KnownAssetInfo {
6588
6595
  */
6589
6596
  related?: Record<string, string | string[]>;
6590
6597
  }
6598
+ declare interface KnownBuildInfo {
6599
+ cacheable?: boolean;
6600
+ parsed?: boolean;
6601
+ fileDependencies?: LazySet<string>;
6602
+ contextDependencies?: LazySet<string>;
6603
+ missingDependencies?: LazySet<string>;
6604
+ buildDependencies?: LazySet<string>;
6605
+ valueDependencies?: Map<string, string | Set<string>>;
6606
+ hash?: any;
6607
+ assets?: Record<string, Source>;
6608
+ assetsInfo?: Map<string, undefined | AssetInfo>;
6609
+ snapshot?: null | Snapshot;
6610
+ }
6591
6611
  declare interface KnownBuildMeta {
6592
6612
  moduleArgument?: string;
6593
6613
  exportsArgument?: string;
@@ -7717,7 +7737,7 @@ declare class Module extends DependenciesBlock {
7717
7737
  * Module should be unsafe cached. Get data that's needed for that.
7718
7738
  * This data will be passed to restoreFromUnsafeCache later.
7719
7739
  */
7720
- getUnsafeCacheData(): object;
7740
+ getUnsafeCacheData(): UnsafeCacheData;
7721
7741
 
7722
7742
  /**
7723
7743
  * Assuming this module is in the cache. Remove internal references to allow freeing some memory.
@@ -8283,21 +8303,21 @@ declare class MultiCompiler {
8283
8303
  outputFileSystem: OutputFileSystem;
8284
8304
  watchFileSystem: WatchFileSystem;
8285
8305
  intermediateFileSystem: IntermediateFileSystem;
8286
- getInfrastructureLogger(name?: any): WebpackLogger;
8306
+ getInfrastructureLogger(name: string | (() => string)): WebpackLogger;
8287
8307
  setDependencies(compiler: Compiler, dependencies: string[]): void;
8288
- validateDependencies(callback: CallbackFunction<MultiStats>): boolean;
8308
+ validateDependencies(callback: CallbackFunction_1<MultiStats>): boolean;
8289
8309
  runWithDependencies(
8290
8310
  compilers: Compiler[],
8291
- fn: (compiler: Compiler, callback: CallbackFunction<MultiStats>) => any,
8292
- callback: CallbackFunction<MultiStats>
8311
+ fn: (compiler: Compiler, callback: CallbackFunction_1<MultiStats>) => any,
8312
+ callback: CallbackFunction_1<MultiStats>
8293
8313
  ): void;
8294
8314
  watch(
8295
8315
  watchOptions: WatchOptions | WatchOptions[],
8296
- handler: CallbackFunction<MultiStats>
8316
+ handler: CallbackFunction_1<MultiStats>
8297
8317
  ): MultiWatching;
8298
- run(callback: CallbackFunction<MultiStats>): void;
8318
+ run(callback: CallbackFunction_1<MultiStats>): void;
8299
8319
  purgeInputFileSystem(): void;
8300
- close(callback: CallbackFunction<void>): void;
8320
+ close(callback: CallbackFunction_1<void>): void;
8301
8321
  }
8302
8322
  declare interface MultiCompilerOptions {
8303
8323
  /**
@@ -8316,10 +8336,10 @@ declare abstract class MultiStats {
8316
8336
  declare abstract class MultiWatching {
8317
8337
  watchings: Watching[];
8318
8338
  compiler: MultiCompiler;
8319
- invalidate(callback?: CallbackFunction<void>): void;
8339
+ invalidate(callback?: CallbackFunction_1<void>): void;
8320
8340
  suspend(): void;
8321
8341
  resume(): void;
8322
- close(callback: CallbackFunction<void>): void;
8342
+ close(callback: CallbackFunction_1<void>): void;
8323
8343
  }
8324
8344
  declare class NamedChunkIdsPlugin {
8325
8345
  constructor(options?: NamedChunkIdsPluginOptions);
@@ -8454,36 +8474,40 @@ declare class NormalModule extends Module {
8454
8474
  userRequest: string;
8455
8475
  rawRequest: string;
8456
8476
  binary: boolean;
8457
- parser: Parser;
8458
- parserOptions?: Record<string, any>;
8459
- generator: Generator;
8460
- generatorOptions?: Record<string, any>;
8477
+ parser?: Parser;
8478
+ parserOptions?: ParserOptions;
8479
+ generator?: Generator;
8480
+ generatorOptions?: GeneratorOptions;
8461
8481
  resource: string;
8462
8482
  resourceResolveData?: Record<string, any>;
8463
8483
  matchResource?: string;
8464
8484
  loaders: LoaderItem[];
8465
- error?: null | WebpackError;
8485
+ error: null | WebpackError;
8486
+
8487
+ /**
8488
+ * restore unsafe cache data
8489
+ */
8466
8490
  restoreFromUnsafeCache(
8467
- unsafeCacheData?: any,
8468
- normalModuleFactory?: any
8491
+ unsafeCacheData: NormalModuleUnsafeCacheData,
8492
+ normalModuleFactory: NormalModuleFactory
8469
8493
  ): void;
8470
8494
  createSourceForAsset(
8471
8495
  context: string,
8472
8496
  name: string,
8473
- content: string,
8474
- sourceMap?: any,
8497
+ content: string | Buffer,
8498
+ sourceMap?: string | SourceMap,
8475
8499
  associatedObjectForCache?: Object
8476
8500
  ): Source;
8477
- getCurrentLoader(loaderContext?: any, index?: any): null | LoaderItem;
8501
+ getCurrentLoader(loaderContext?: any, index?: number): null | LoaderItem;
8478
8502
  createSource(
8479
8503
  context: string,
8480
8504
  content: string | Buffer,
8481
- sourceMap?: any,
8505
+ sourceMap?: string | SourceMapSource,
8482
8506
  associatedObjectForCache?: Object
8483
8507
  ): Source;
8484
8508
  markModuleAsErrored(error: WebpackError): void;
8485
- applyNoParseRule(rule?: any, content?: any): any;
8486
- shouldPreventParsing(noParseRule?: any, request?: any): any;
8509
+ applyNoParseRule(rule: any, content: string): boolean;
8510
+ shouldPreventParsing(noParseRule: any, request: string): boolean;
8487
8511
  static getCompilationHooks(
8488
8512
  compilation: Compilation
8489
8513
  ): NormalModuleCompilationHooks;
@@ -8559,7 +8583,7 @@ declare interface NormalModuleCreateData {
8559
8583
  /**
8560
8584
  * the options of the parser used
8561
8585
  */
8562
- parserOptions?: Record<string, any>;
8586
+ parserOptions?: ParserOptions;
8563
8587
 
8564
8588
  /**
8565
8589
  * the generator used
@@ -8569,7 +8593,7 @@ declare interface NormalModuleCreateData {
8569
8593
  /**
8570
8594
  * the options of the generator used
8571
8595
  */
8572
- generatorOptions?: Record<string, any>;
8596
+ generatorOptions?: GeneratorOptions;
8573
8597
 
8574
8598
  /**
8575
8599
  * options used for resolving requests from this module
@@ -8603,40 +8627,47 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
8603
8627
  ],
8604
8628
  Module
8605
8629
  >;
8606
- createParser: HookMap<SyncBailHook<any, any>>;
8607
- parser: HookMap<SyncHook<any>>;
8608
- createGenerator: HookMap<SyncBailHook<any, any>>;
8609
- generator: HookMap<SyncHook<any>>;
8610
- createModuleClass: HookMap<SyncBailHook<any, any>>;
8630
+ createParser: HookMap<SyncBailHook<[ParserOptions], Parser>>;
8631
+ parser: HookMap<SyncBailHook<[any, ParserOptions], void>>;
8632
+ createGenerator: HookMap<SyncBailHook<[GeneratorOptions], Generator>>;
8633
+ generator: HookMap<SyncBailHook<[any, GeneratorOptions], void>>;
8634
+ createModuleClass: HookMap<SyncBailHook<[any, ResolveData], Module>>;
8611
8635
  }>;
8612
8636
  resolverFactory: ResolverFactory;
8613
8637
  ruleSet: RuleSet;
8614
8638
  context: string;
8615
8639
  fs: InputFileSystem;
8616
- parserCache: Map<string, WeakMap<Object, any>>;
8640
+ parserCache: Map<string, WeakMap<Object, Parser>>;
8617
8641
  generatorCache: Map<string, WeakMap<Object, Generator>>;
8618
8642
  cleanupForCache(): void;
8619
8643
  resolveResource(
8620
- contextInfo?: any,
8621
- context?: any,
8622
- unresolvedResource?: any,
8623
- resolver?: any,
8624
- resolveContext?: any,
8625
- callback?: any
8644
+ contextInfo: ModuleFactoryCreateDataContextInfo,
8645
+ context: string,
8646
+ unresolvedResource: string,
8647
+ resolver: ResolverWithOptions,
8648
+ resolveContext: ResolveContext,
8649
+ callback: (
8650
+ err: null | Error,
8651
+ res?: string | false,
8652
+ req?: ResolveRequest
8653
+ ) => void
8626
8654
  ): void;
8627
8655
  resolveRequestArray(
8628
- contextInfo?: any,
8629
- context?: any,
8630
- array?: any,
8631
- resolver?: any,
8632
- resolveContext?: any,
8633
- callback?: any
8634
- ): any;
8635
- getParser(type?: any, parserOptions?: object): any;
8636
- createParser(type: string, parserOptions?: { [index: string]: any }): Parser;
8637
- getGenerator(type?: any, generatorOptions?: object): undefined | Generator;
8638
- createGenerator(type?: any, generatorOptions?: object): any;
8639
- getResolver(type?: any, resolveOptions?: any): ResolverWithOptions;
8656
+ contextInfo: ModuleFactoryCreateDataContextInfo,
8657
+ context: string,
8658
+ array: LoaderItem[],
8659
+ resolver: ResolverWithOptions,
8660
+ resolveContext: ResolveContext,
8661
+ callback: CallbackFunction_2<LoaderItem[]>
8662
+ ): void;
8663
+ getParser(type: string, parserOptions?: ParserOptions): Parser;
8664
+ createParser(type: string, parserOptions?: ParserOptions): Parser;
8665
+ getGenerator(type: string, generatorOptions?: GeneratorOptions): Generator;
8666
+ createGenerator(type: string, generatorOptions?: GeneratorOptions): Generator;
8667
+ getResolver(
8668
+ type: string,
8669
+ resolveOptions?: ResolveOptionsWithDependencyType
8670
+ ): ResolverWithOptions;
8640
8671
  }
8641
8672
 
8642
8673
  /**
@@ -8680,7 +8711,7 @@ declare interface NormalModuleLoaderContext<OptionsType> {
8680
8711
  utils: {
8681
8712
  absolutify: (context: string, request: string) => string;
8682
8713
  contextify: (context: string, request: string) => string;
8683
- createHash: (algorithm?: string) => Hash;
8714
+ createHash: (algorithm?: string | typeof Hash) => Hash;
8684
8715
  };
8685
8716
  rootContext: string;
8686
8717
  fs: InputFileSystem;
@@ -8707,6 +8738,12 @@ declare class NormalModuleReplacementPlugin {
8707
8738
  */
8708
8739
  apply(compiler: Compiler): void;
8709
8740
  }
8741
+ type NormalModuleUnsafeCacheData = UnsafeCacheData & {
8742
+ parser?: Parser;
8743
+ parserOptions?: ParserOptions;
8744
+ generator?: Generator;
8745
+ generatorOptions?: GeneratorOptions;
8746
+ };
8710
8747
  type NormalizedStatsOptions = KnownNormalizedStatsOptions &
8711
8748
  Omit<
8712
8749
  StatsOptions,
@@ -9820,6 +9857,9 @@ declare class Parser {
9820
9857
  state: ParserState
9821
9858
  ): ParserState;
9822
9859
  }
9860
+ declare interface ParserOptions {
9861
+ [index: string]: any;
9862
+ }
9823
9863
  type ParserOptionsByModuleType = ParserOptionsByModuleTypeKnown &
9824
9864
  ParserOptionsByModuleTypeUnknown;
9825
9865
 
@@ -10854,9 +10894,9 @@ type ResolverWithOptions = Resolver & WithOptions;
10854
10894
 
10855
10895
  declare interface ResourceDataWithData {
10856
10896
  resource: string;
10857
- path: string;
10858
- query: string;
10859
- fragment: string;
10897
+ path?: string;
10898
+ query?: string;
10899
+ fragment?: string;
10860
10900
  context?: string;
10861
10901
  data: Record<string, any>;
10862
10902
  }
@@ -12358,8 +12398,8 @@ declare class Stats {
12358
12398
  get endTime(): any;
12359
12399
  hasWarnings(): boolean;
12360
12400
  hasErrors(): boolean;
12361
- toJson(options?: string | StatsOptions): StatsCompilation;
12362
- toString(options?: string | StatsOptions): string;
12401
+ toJson(options?: string | boolean | StatsOptions): StatsCompilation;
12402
+ toString(options?: string | boolean | StatsOptions): string;
12363
12403
  }
12364
12404
  type StatsAsset = KnownStatsAsset & Record<string, any>;
12365
12405
  type StatsChunk = KnownStatsChunk & Record<string, any>;
@@ -12989,6 +13029,10 @@ declare interface TrustedTypes {
12989
13029
  policyName?: string;
12990
13030
  }
12991
13031
  declare const UNDEFINED_MARKER: unique symbol;
13032
+ declare interface UnsafeCacheData {
13033
+ factoryMeta?: FactoryMeta;
13034
+ resolveOptions?: ResolveOptionsWebpackOptions;
13035
+ }
12992
13036
  declare interface UpdateHashContextDependency {
12993
13037
  chunkGraph: ChunkGraph;
12994
13038
  runtime: RuntimeSpec;
@@ -13285,8 +13329,8 @@ declare interface WatcherInfo {
13285
13329
  declare abstract class Watching {
13286
13330
  startTime: null | number;
13287
13331
  invalid: boolean;
13288
- handler: CallbackFunction<Stats>;
13289
- callbacks: CallbackFunction<void>[];
13332
+ handler: CallbackFunction_1<Stats>;
13333
+ callbacks: CallbackFunction_1<void>[];
13290
13334
  closed: boolean;
13291
13335
  suspended: boolean;
13292
13336
  blocked: boolean;
@@ -13322,10 +13366,10 @@ declare abstract class Watching {
13322
13366
  dirs: Iterable<string>,
13323
13367
  missing: Iterable<string>
13324
13368
  ): void;
13325
- invalidate(callback?: CallbackFunction<void>): void;
13369
+ invalidate(callback?: CallbackFunction_1<void>): void;
13326
13370
  suspend(): void;
13327
13371
  resume(): void;
13328
- close(callback: CallbackFunction<void>): void;
13372
+ close(callback: CallbackFunction_1<void>): void;
13329
13373
  }
13330
13374
  declare abstract class WeakTupleMap<T extends any[], V> {
13331
13375
  set(...args: [T, ...V[]]): void;
@@ -13725,18 +13769,18 @@ type __Type_2 =
13725
13769
  | __Type_2[]);
13726
13770
  declare function exports(
13727
13771
  options: Configuration,
13728
- callback?: CallbackWebpack<Stats>
13772
+ callback?: CallbackFunction_2<Stats>
13729
13773
  ): Compiler;
13730
13774
  declare function exports(
13731
13775
  options: ReadonlyArray<Configuration> & MultiCompilerOptions,
13732
- callback?: CallbackWebpack<MultiStats>
13776
+ callback?: CallbackFunction_2<MultiStats>
13733
13777
  ): MultiCompiler;
13734
13778
  declare namespace exports {
13735
13779
  export const webpack: {
13736
- (options: Configuration, callback?: CallbackWebpack<Stats>): Compiler;
13780
+ (options: Configuration, callback?: CallbackFunction_2<Stats>): Compiler;
13737
13781
  (
13738
13782
  options: ReadonlyArray<Configuration> & MultiCompilerOptions,
13739
- callback?: CallbackWebpack<MultiStats>
13783
+ callback?: CallbackFunction_2<MultiStats>
13740
13784
  ): MultiCompiler;
13741
13785
  };
13742
13786
  export const validate: (options?: any) => void;