webpack 5.107.1 → 5.107.2

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.
package/types.d.ts CHANGED
@@ -2886,6 +2886,22 @@ declare interface CleanPluginCompilationHooks {
2886
2886
  */
2887
2887
  keep: SyncBailHook<[string], boolean | void>;
2888
2888
  }
2889
+ declare interface ClearCacheOptions {
2890
+ /**
2891
+ * drop cached source maps (default `true`)
2892
+ */
2893
+ maps?: boolean;
2894
+
2895
+ /**
2896
+ * drop cached source/buffer copies (default `true`)
2897
+ */
2898
+ source?: boolean;
2899
+
2900
+ /**
2901
+ * drop the parsed object form of cached source maps on `SourceMapSource` instances (default `false` — re-parsing JSON is significantly more expensive than `toString`). Only takes effect when a serialized form (buffer or string) is also retained, so the data remains recoverable.
2902
+ */
2903
+ parsedMap?: boolean;
2904
+ }
2889
2905
  declare interface CodeGenMapOverloads {
2890
2906
  get: <K extends string>(key: K) => undefined | CodeGenValue<K>;
2891
2907
  set: <K extends string>(
@@ -4038,6 +4054,27 @@ declare interface CompiledAliasOption {
4038
4054
  */
4039
4055
  arrayAlias: boolean;
4040
4056
  }
4057
+ declare interface CompiledAliasOptions {
4058
+ /**
4059
+ * declaration-ordered list
4060
+ */
4061
+ all: CompiledAliasOption[];
4062
+
4063
+ /**
4064
+ * bucketed by first char code
4065
+ */
4066
+ byFirstChar: Map<number, CompiledAliasOption[]>;
4067
+
4068
+ /**
4069
+ * true when an empty-prefix wildcard is present
4070
+ */
4071
+ hasAnyFirstChar: boolean;
4072
+
4073
+ /**
4074
+ * true when the bucket fast-path should be used at resolve time
4075
+ */
4076
+ useBuckets: boolean;
4077
+ }
4041
4078
  declare class Compiler {
4042
4079
  /**
4043
4080
  * Creates an instance of Compiler.
@@ -9658,7 +9695,10 @@ declare interface InputFileSystem {
9658
9695
  ) => void
9659
9696
  ) => void;
9660
9697
  readJsonSync?: (pathOrFileDescriptor: PathOrFileDescriptorFs) => JsonObjectFs;
9661
- purge?: (value?: string | string[] | Set<string>) => void;
9698
+ purge?: (
9699
+ value?: string | string[] | Set<string>,
9700
+ options?: { exact?: boolean }
9701
+ ) => void;
9662
9702
  join?: (path1: string, path2: string) => string;
9663
9703
  relative?: (from: string, to: string) => string;
9664
9704
  dirname?: (dirname: string) => string;
@@ -16656,11 +16696,55 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16656
16696
  */
16657
16697
  declare interface NormalModuleLoaderContext<OptionsType> {
16658
16698
  version: number;
16699
+
16700
+ /**
16701
+ * Extracts and parses the options of the current loader.
16702
+ * Parses string options as JSON or a query string.
16703
+ * Extracts and parses the options of the current loader.
16704
+ * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
16705
+ */
16706
+
16707
+ /**
16708
+ * Extracts and parses the options of the current loader.
16709
+ * Parses string options as JSON or a query string.
16710
+ */
16659
16711
  getOptions(): OptionsType;
16712
+
16713
+ /**
16714
+ * Extracts and parses the options of the current loader.
16715
+ * Parses string options as JSON or a query string.
16716
+ * Extracts and parses the options of the current loader.
16717
+ * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
16718
+ */
16719
+
16720
+ /**
16721
+ * Extracts and parses the options of the current loader.
16722
+ * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
16723
+ */
16660
16724
  getOptions(schema: Parameters<typeof validateFunction>[0]): OptionsType;
16661
- emitWarning(warning: Error): void;
16662
- emitError(error: Error): void;
16725
+
16726
+ /**
16727
+ * Emits a warning for this module.
16728
+ * The warning will be displayed to the user during compilation.
16729
+ */
16730
+ emitWarning(warning: string | Error): void;
16731
+
16732
+ /**
16733
+ * Emits an error for this module.
16734
+ * The error will be displayed to the user and typically causes the compilation to fail.
16735
+ */
16736
+ emitError(error: string | Error): void;
16737
+
16738
+ /**
16739
+ * Gets a logger instance scoped to this loader and module.
16740
+ * Useful for emitting debug or compilation information in a structured way.
16741
+ */
16663
16742
  getLogger(name?: string): WebpackLogger;
16743
+
16744
+ /**
16745
+ * Resolves a module request (e.g., a relative path or module name) to an absolute file path.
16746
+ * It uses Webpack's internal resolver, taking into account configured aliases and extensions.
16747
+ */
16664
16748
  resolve(
16665
16749
  context: string,
16666
16750
  request: string,
@@ -16670,6 +16754,11 @@ declare interface NormalModuleLoaderContext<OptionsType> {
16670
16754
  req?: ResolveRequest
16671
16755
  ) => void
16672
16756
  ): void;
16757
+
16758
+ /**
16759
+ * Creates a resolve function with specific options.
16760
+ * The returned function can be used as a Promise-based resolver or a callback-based resolver.
16761
+ */
16673
16762
  getResolve(options?: ResolveOptionsWithDependencyType): {
16674
16763
  (
16675
16764
  context: string,
@@ -16682,6 +16771,11 @@ declare interface NormalModuleLoaderContext<OptionsType> {
16682
16771
  ): void;
16683
16772
  (context: string, request: string): Promise<string>;
16684
16773
  };
16774
+
16775
+ /**
16776
+ * Emits a new file (asset) to the compilation output directory.
16777
+ * This allows loaders to generate additional files alongside the main module output.
16778
+ */
16685
16779
  emitFile(
16686
16780
  name: string,
16687
16781
  content: string | Buffer,
@@ -18757,7 +18851,7 @@ declare class ProgressPlugin {
18757
18851
  static createDefaultHandler: (
18758
18852
  profile: undefined | null | boolean,
18759
18853
  logger: WebpackLogger,
18760
- progressBar:
18854
+ progressBar?:
18761
18855
  | false
18762
18856
  | Required<{
18763
18857
  /**
@@ -22470,6 +22564,19 @@ declare class Source {
22470
22564
  map(options?: MapOptions): null | RawSourceMap;
22471
22565
  sourceAndMap(options?: MapOptions): SourceAndMap;
22472
22566
  updateHash(hash: HashLike): void;
22567
+
22568
+ /**
22569
+ * Release cached data held by this source. clearCache is a memory
22570
+ * hint: it never affects correctness or output, only how expensive
22571
+ * the next read is. Subclasses override; the base is a no-op so
22572
+ * every Source supports the call. Composite sources always recurse
22573
+ * into wrapped sources. When the same child is reachable via several
22574
+ * parents (e.g. modules shared across webpack chunks), pass a shared
22575
+ * `visited` WeakSet so each subtree is walked at most once.
22576
+ * Not safe to call concurrently with source/map/sourceAndMap/
22577
+ * streamChunks/updateHash on the same instance.
22578
+ */
22579
+ clearCache(options?: ClearCacheOptions, visited?: WeakSet<Source>): void;
22473
22580
  }
22474
22581
  declare interface SourceAndMap {
22475
22582
  /**
@@ -22517,6 +22624,11 @@ declare interface SourceLike {
22517
22624
  * hash updater
22518
22625
  */
22519
22626
  updateHash?: (hash: HashLike) => void;
22627
+
22628
+ /**
22629
+ * clear cache
22630
+ */
22631
+ clearCache?: (options?: ClearCacheOptions, visited?: WeakSet<Source>) => void;
22520
22632
  }
22521
22633
  declare class SourceMapDevToolPlugin {
22522
22634
  /**
@@ -23935,7 +24047,7 @@ declare interface TsconfigPathsData {
23935
24047
  /**
23936
24048
  * tsconfig file data
23937
24049
  */
23938
- alias: CompiledAliasOption[];
24050
+ alias: CompiledAliasOptions;
23939
24051
 
23940
24052
  /**
23941
24053
  * tsconfig file data