webpack 5.35.1 → 5.37.0

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.

Files changed (37) hide show
  1. package/lib/Chunk.js +8 -2
  2. package/lib/ChunkGraph.js +58 -35
  3. package/lib/Compilation.js +73 -43
  4. package/lib/Compiler.js +27 -13
  5. package/lib/Dependency.js +69 -4
  6. package/lib/EntryPlugin.js +1 -1
  7. package/lib/FileSystemInfo.js +1 -1
  8. package/lib/InitFragment.js +21 -6
  9. package/lib/ModuleGraph.js +2 -2
  10. package/lib/NormalModule.js +16 -2
  11. package/lib/NormalModuleFactory.js +27 -23
  12. package/lib/RuntimeGlobals.js +7 -0
  13. package/lib/RuntimePlugin.js +19 -1
  14. package/lib/SourceMapDevToolPlugin.js +1 -1
  15. package/lib/WebpackOptionsApply.js +1 -0
  16. package/lib/buildChunkGraph.js +7 -2
  17. package/lib/cache/PackFileCacheStrategy.js +65 -4
  18. package/lib/config/defaults.js +12 -1
  19. package/lib/config/normalization.js +10 -0
  20. package/lib/dependencies/CreateScriptUrlDependency.js +54 -0
  21. package/lib/dependencies/HarmonyExportInitFragment.js +47 -0
  22. package/lib/dependencies/NullDependency.js +0 -8
  23. package/lib/dependencies/WorkerPlugin.js +32 -4
  24. package/lib/javascript/JavascriptParser.js +39 -31
  25. package/lib/optimize/InnerGraphPlugin.js +8 -9
  26. package/lib/runtime/CreateScriptUrlRuntimeModule.js +61 -0
  27. package/lib/runtime/LoadScriptRuntimeModule.js +10 -2
  28. package/lib/util/AsyncQueue.js +6 -1
  29. package/lib/util/comparators.js +22 -16
  30. package/lib/util/fs.js +8 -8
  31. package/lib/util/internalSerializables.js +2 -0
  32. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +13 -1
  33. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +14 -4
  34. package/package.json +5 -5
  35. package/schemas/WebpackOptions.check.js +1 -1
  36. package/schemas/WebpackOptions.json +35 -0
  37. package/types.d.ts +479 -44
package/types.d.ts CHANGED
@@ -60,6 +60,7 @@ import {
60
60
  SequenceExpression,
61
61
  SimpleCallExpression,
62
62
  SimpleLiteral,
63
+ SourceLocation,
63
64
  SpreadElement,
64
65
  Super,
65
66
  SwitchCase,
@@ -78,12 +79,8 @@ import {
78
79
  WithStatement,
79
80
  YieldExpression
80
81
  } from "estree";
81
- import { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
82
- import { default as ValidationError } from "schema-utils/declarations/ValidationError";
83
- import {
84
- Extend,
85
- ValidationErrorConfiguration
86
- } from "schema-utils/declarations/validate";
82
+ import { ValidationError, validate as validateFunction } from "schema-utils";
83
+ import { ValidationErrorConfiguration } from "schema-utils/declarations/validate";
87
84
  import {
88
85
  AsArray,
89
86
  AsyncParallelHook,
@@ -152,6 +149,10 @@ declare class AbstractLibraryPlugin<T> {
152
149
  ): void;
153
150
  static COMMON_LIBRARY_NAME_MESSAGE: string;
154
151
  }
152
+ declare interface AdditionalData {
153
+ [index: string]: any;
154
+ webpackAST: object;
155
+ }
155
156
  declare class AggressiveMergingPlugin {
156
157
  constructor(options?: any);
157
158
  options: any;
@@ -1649,8 +1650,8 @@ declare class Compilation {
1649
1650
  */
1650
1651
  createChildCompiler(
1651
1652
  name: string,
1652
- outputOptions: OutputNormalized,
1653
- plugins: (
1653
+ outputOptions?: OutputNormalized,
1654
+ plugins?: (
1654
1655
  | ((this: Compiler, compiler: Compiler) => void)
1655
1656
  | WebpackPluginInstance
1656
1657
  )[]
@@ -1854,8 +1855,8 @@ declare class Compiler {
1854
1855
  compilation: Compilation,
1855
1856
  compilerName: string,
1856
1857
  compilerIndex: number,
1857
- outputOptions: OutputNormalized,
1858
- plugins: WebpackPluginInstance[]
1858
+ outputOptions?: OutputNormalized,
1859
+ plugins?: WebpackPluginInstance[]
1859
1860
  ): Compiler;
1860
1861
  isChild(): boolean;
1861
1862
  createCompilation(): Compilation;
@@ -2462,9 +2463,9 @@ declare class Dependency {
2462
2463
  constructor();
2463
2464
  weak: boolean;
2464
2465
  optional: boolean;
2465
- loc: DependencyLocation;
2466
2466
  readonly type: string;
2467
2467
  readonly category: string;
2468
+ loc: DependencyLocation;
2468
2469
  getResourceIdentifier(): null | string;
2469
2470
 
2470
2471
  /**
@@ -3034,7 +3035,7 @@ declare class EntryPlugin {
3034
3035
  * An entry plugin which will handle
3035
3036
  * creation of the EntryDependency
3036
3037
  */
3037
- constructor(context: string, entry: string, options: string | EntryOptions);
3038
+ constructor(context: string, entry: string, options?: string | EntryOptions);
3038
3039
  context: string;
3039
3040
  entry: string;
3040
3041
  options: string | EntryOptions;
@@ -3824,6 +3825,11 @@ declare interface FileCacheOptions {
3824
3825
  */
3825
3826
  name?: string;
3826
3827
 
3828
+ /**
3829
+ * Track and log detailed timing information for individual cache items.
3830
+ */
3831
+ profile?: boolean;
3832
+
3827
3833
  /**
3828
3834
  * When to store data to the filesystem. (pack: Store data when compiler is idle in a single file).
3829
3835
  */
@@ -4188,7 +4194,7 @@ declare interface HashedModuleIdsPluginOptions {
4188
4194
  /**
4189
4195
  * The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.
4190
4196
  */
4191
- hashDigest?: "hex" | "latin1" | "base64";
4197
+ hashDigest?: "base64" | "latin1" | "hex";
4192
4198
 
4193
4199
  /**
4194
4200
  * The prefix length of the hash digest to use, defaults to 4.
@@ -4211,6 +4217,13 @@ declare class HotModuleReplacementPlugin {
4211
4217
  apply(compiler: Compiler): void;
4212
4218
  static getParserHooks(parser: JavascriptParser): HMRJavascriptParserHooks;
4213
4219
  }
4220
+
4221
+ /**
4222
+ * These properties are added by the HotModuleReplacementPlugin
4223
+ */
4224
+ declare interface HotModuleReplacementPluginLoaderContext {
4225
+ hot?: boolean;
4226
+ }
4214
4227
  declare class HotUpdateChunk extends Chunk {
4215
4228
  constructor();
4216
4229
  }
@@ -4299,6 +4312,17 @@ type IgnorePluginOptions =
4299
4312
  */
4300
4313
  checkResource?: (resource: string, context: string) => boolean;
4301
4314
  };
4315
+ declare interface ImportModuleOptions {
4316
+ /**
4317
+ * the target layer
4318
+ */
4319
+ layer?: string;
4320
+
4321
+ /**
4322
+ * the target public path
4323
+ */
4324
+ publicPath?: string;
4325
+ }
4302
4326
  type ImportSource =
4303
4327
  | undefined
4304
4328
  | null
@@ -4359,30 +4383,30 @@ declare abstract class InitFragment {
4359
4383
  declare interface InputFileSystem {
4360
4384
  readFile: (
4361
4385
  arg0: string,
4362
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
4386
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
4363
4387
  ) => void;
4364
4388
  readJson?: (
4365
4389
  arg0: string,
4366
- arg1: (arg0?: Error | NodeJS.ErrnoException, arg1?: any) => void
4390
+ arg1: (arg0?: null | Error | NodeJS.ErrnoException, arg1?: any) => void
4367
4391
  ) => void;
4368
4392
  readlink: (
4369
4393
  arg0: string,
4370
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
4394
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
4371
4395
  ) => void;
4372
4396
  readdir: (
4373
4397
  arg0: string,
4374
4398
  arg1: (
4375
- arg0?: NodeJS.ErrnoException,
4399
+ arg0?: null | NodeJS.ErrnoException,
4376
4400
  arg1?: (string | Buffer)[] | IDirent[]
4377
4401
  ) => void
4378
4402
  ) => void;
4379
4403
  stat: (
4380
4404
  arg0: string,
4381
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: IStats) => void
4405
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
4382
4406
  ) => void;
4383
4407
  realpath?: (
4384
4408
  arg0: string,
4385
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
4409
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
4386
4410
  ) => void;
4387
4411
  purge?: (arg0?: string) => void;
4388
4412
  join?: (arg0: string, arg1: string) => string;
@@ -4398,7 +4422,7 @@ declare interface IntermediateFileSystemExtras {
4398
4422
  open: (
4399
4423
  arg0: string,
4400
4424
  arg1: string,
4401
- arg2: (arg0?: NodeJS.ErrnoException, arg1?: number) => void
4425
+ arg2: (arg0?: null | NodeJS.ErrnoException, arg1?: number) => void
4402
4426
  ) => void;
4403
4427
  read: (
4404
4428
  arg0: number,
@@ -4406,13 +4430,16 @@ declare interface IntermediateFileSystemExtras {
4406
4430
  arg2: number,
4407
4431
  arg3: number,
4408
4432
  arg4: number,
4409
- arg5: (arg0?: NodeJS.ErrnoException, arg1?: number) => void
4433
+ arg5: (arg0?: null | NodeJS.ErrnoException, arg1?: number) => void
4434
+ ) => void;
4435
+ close: (
4436
+ arg0: number,
4437
+ arg1: (arg0?: null | NodeJS.ErrnoException) => void
4410
4438
  ) => void;
4411
- close: (arg0: number, arg1: (arg0?: NodeJS.ErrnoException) => void) => void;
4412
4439
  rename: (
4413
4440
  arg0: string,
4414
4441
  arg1: string,
4415
- arg2: (arg0?: NodeJS.ErrnoException) => void
4442
+ arg2: (arg0?: null | NodeJS.ErrnoException) => void
4416
4443
  ) => void;
4417
4444
  }
4418
4445
  type InternalCell<T> = T | typeof TOMBSTONE | typeof UNDEFINED_MARKER;
@@ -4539,6 +4566,7 @@ declare class JavascriptParser extends Parser {
4539
4566
  | FunctionDeclaration
4540
4567
  | VariableDeclaration
4541
4568
  | ClassDeclaration
4569
+ | PrivateIdentifierNode
4542
4570
  ),
4543
4571
  number
4544
4572
  ],
@@ -4641,7 +4669,18 @@ declare class JavascriptParser extends Parser {
4641
4669
  boolean | void
4642
4670
  >;
4643
4671
  classBodyElement: SyncBailHook<
4644
- [MethodDefinition, ClassExpression | ClassDeclaration],
4672
+ [
4673
+ MethodDefinition | PropertyDefinitionNode,
4674
+ ClassExpression | ClassDeclaration
4675
+ ],
4676
+ boolean | void
4677
+ >;
4678
+ classBodyValue: SyncBailHook<
4679
+ [
4680
+ Expression,
4681
+ MethodDefinition | PropertyDefinitionNode,
4682
+ ClassExpression | ClassDeclaration
4683
+ ],
4645
4684
  boolean | void
4646
4685
  >;
4647
4686
  label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
@@ -4770,7 +4809,6 @@ declare class JavascriptParser extends Parser {
4770
4809
  currentTagData: any;
4771
4810
  getRenameIdentifier(expr?: any): undefined | string;
4772
4811
  walkClass(classy: ClassExpression | ClassDeclaration): void;
4773
- walkMethodDefinition(methodDefinition?: any): void;
4774
4812
  preWalkStatements(statements?: any): void;
4775
4813
  blockPreWalkStatements(statements?: any): void;
4776
4814
  walkStatements(statements?: any): void;
@@ -4955,7 +4993,8 @@ declare class JavascriptParser extends Parser {
4955
4993
  | ChainExpression
4956
4994
  | FunctionDeclaration
4957
4995
  | VariableDeclaration
4958
- | ClassDeclaration,
4996
+ | ClassDeclaration
4997
+ | PrivateIdentifierNode,
4959
4998
  commentsStartPos: number
4960
4999
  ): boolean;
4961
5000
  getComments(range?: any): any[];
@@ -5730,7 +5769,7 @@ declare interface LoadScriptCompilationHooks {
5730
5769
  createScript: SyncWaterfallHook<[string, Chunk]>;
5731
5770
  }
5732
5771
  declare class LoadScriptRuntimeModule extends HelperRuntimeModule {
5733
- constructor();
5772
+ constructor(withCreateScriptUrl?: boolean);
5734
5773
  static getCompilationHooks(
5735
5774
  compilation: Compilation
5736
5775
  ): LoadScriptCompilationHooks;
@@ -5762,12 +5801,45 @@ declare class LoadScriptRuntimeModule extends HelperRuntimeModule {
5762
5801
  declare interface Loader {
5763
5802
  [index: string]: any;
5764
5803
  }
5804
+ type LoaderContext<OptionsType> = NormalModuleLoaderContext<OptionsType> &
5805
+ LoaderRunnerLoaderContext<OptionsType> &
5806
+ LoaderPluginLoaderContext &
5807
+ HotModuleReplacementPluginLoaderContext;
5808
+ type LoaderDefinition<
5809
+ OptionsType = {},
5810
+ ContextAdditions = {}
5811
+ > = LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
5812
+ raw?: false;
5813
+ pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
5814
+ };
5815
+ declare interface LoaderDefinitionFunction<
5816
+ OptionsType = {},
5817
+ ContextAdditions = {}
5818
+ > {
5819
+ (
5820
+ this: NormalModuleLoaderContext<OptionsType> &
5821
+ LoaderRunnerLoaderContext<OptionsType> &
5822
+ LoaderPluginLoaderContext &
5823
+ HotModuleReplacementPluginLoaderContext &
5824
+ ContextAdditions,
5825
+ content: string,
5826
+ sourceMap?: string | SourceMap,
5827
+ additionalData?: AdditionalData
5828
+ ): string | void | Buffer | Promise<string | Buffer>;
5829
+ }
5765
5830
  declare interface LoaderItem {
5766
5831
  loader: string;
5767
5832
  options: any;
5768
5833
  ident: null | string;
5769
5834
  type: null | string;
5770
5835
  }
5836
+ declare interface LoaderModule<OptionsType = {}, ContextAdditions = {}> {
5837
+ default?:
5838
+ | RawLoaderDefinitionFunction<OptionsType, ContextAdditions>
5839
+ | LoaderDefinitionFunction<OptionsType, ContextAdditions>;
5840
+ raw?: false;
5841
+ pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
5842
+ }
5771
5843
  declare class LoaderOptionsPlugin {
5772
5844
  constructor(options?: LoaderOptionsPluginOptions);
5773
5845
  options: LoaderOptionsPluginOptions;
@@ -5801,6 +5873,165 @@ declare interface LoaderOptionsPluginOptions {
5801
5873
  context?: string;
5802
5874
  };
5803
5875
  }
5876
+
5877
+ /**
5878
+ * These properties are added by the LoaderPlugin
5879
+ */
5880
+ declare interface LoaderPluginLoaderContext {
5881
+ /**
5882
+ * Resolves the given request to a module, applies all configured loaders and calls
5883
+ * back with the generated source, the sourceMap and the module instance (usually an
5884
+ * instance of NormalModule). Use this function if you need to know the source code
5885
+ * of another module to generate the result.
5886
+ */
5887
+ loadModule(
5888
+ request: string,
5889
+ callback: (
5890
+ err: null | Error,
5891
+ source: string,
5892
+ sourceMap: any,
5893
+ module: NormalModule
5894
+ ) => void
5895
+ ): void;
5896
+ importModule(
5897
+ request: string,
5898
+ options: ImportModuleOptions,
5899
+ callback: (err?: Error, exports?: any) => any
5900
+ ): void;
5901
+ importModule(request: string, options?: ImportModuleOptions): Promise<any>;
5902
+ }
5903
+
5904
+ /**
5905
+ * The properties are added by https://github.com/webpack/loader-runner
5906
+ */
5907
+ declare interface LoaderRunnerLoaderContext<OptionsType> {
5908
+ /**
5909
+ * Add a directory as dependency of the loader result.
5910
+ */
5911
+ addContextDependency(context: string): void;
5912
+
5913
+ /**
5914
+ * Adds a file as dependency of the loader result in order to make them watchable.
5915
+ * For example, html-loader uses this technique as it finds src and src-set attributes.
5916
+ * Then, it sets the url's for those attributes as dependencies of the html file that is parsed.
5917
+ */
5918
+ addDependency(file: string): void;
5919
+ addMissingDependency(context: string): void;
5920
+
5921
+ /**
5922
+ * Make this loader async.
5923
+ */
5924
+ async(): (
5925
+ err?: null | Error,
5926
+ content?: string | Buffer,
5927
+ sourceMap?: string | SourceMap,
5928
+ additionalData?: AdditionalData
5929
+ ) => void;
5930
+
5931
+ /**
5932
+ * Make this loader result cacheable. By default it's cacheable.
5933
+ * A cacheable loader must have a deterministic result, when inputs and dependencies haven't changed.
5934
+ * This means the loader shouldn't have other dependencies than specified with this.addDependency.
5935
+ * Most loaders are deterministic and cacheable.
5936
+ */
5937
+ cacheable(flag?: boolean): void;
5938
+ callback: (
5939
+ err?: null | Error,
5940
+ content?: string | Buffer,
5941
+ sourceMap?: string | SourceMap,
5942
+ additionalData?: AdditionalData
5943
+ ) => void;
5944
+
5945
+ /**
5946
+ * Remove all dependencies of the loader result. Even initial dependencies and these of other loaders.
5947
+ */
5948
+ clearDependencies(): void;
5949
+
5950
+ /**
5951
+ * The directory of the module. Can be used as context for resolving other stuff.
5952
+ * eg '/workspaces/ts-loader/examples/vanilla/src'
5953
+ */
5954
+ context: string;
5955
+ readonly currentRequest: string;
5956
+ readonly data: any;
5957
+
5958
+ /**
5959
+ * alias of addDependency
5960
+ * Adds a file as dependency of the loader result in order to make them watchable.
5961
+ * For example, html-loader uses this technique as it finds src and src-set attributes.
5962
+ * Then, it sets the url's for those attributes as dependencies of the html file that is parsed.
5963
+ */
5964
+ dependency(file: string): void;
5965
+ getContextDependencies(): string[];
5966
+ getDependencies(): string[];
5967
+ getMissingDependencies(): string[];
5968
+
5969
+ /**
5970
+ * The index in the loaders array of the current loader.
5971
+ * In the example: in loader1: 0, in loader2: 1
5972
+ */
5973
+ loaderIndex: number;
5974
+ readonly previousRequest: string;
5975
+ readonly query: string | OptionsType;
5976
+ readonly remainingRequest: string;
5977
+ readonly request: string;
5978
+
5979
+ /**
5980
+ * An array of all the loaders. It is writeable in the pitch phase.
5981
+ * loaders = [{request: string, path: string, query: string, module: function}]
5982
+ * In the example:
5983
+ * [
5984
+ * { request: "/abc/loader1.js?xyz",
5985
+ * path: "/abc/loader1.js",
5986
+ * query: "?xyz",
5987
+ * module: [Function]
5988
+ * },
5989
+ * { request: "/abc/node_modules/loader2/index.js",
5990
+ * path: "/abc/node_modules/loader2/index.js",
5991
+ * query: "",
5992
+ * module: [Function]
5993
+ * }
5994
+ * ]
5995
+ */
5996
+ loaders: {
5997
+ request: string;
5998
+ path: string;
5999
+ query: string;
6000
+ fragment: string;
6001
+ options?: string | object;
6002
+ ident: string;
6003
+ normal?: Function;
6004
+ pitch?: Function;
6005
+ raw?: boolean;
6006
+ data?: object;
6007
+ pitchExecuted: boolean;
6008
+ normalExecuted: boolean;
6009
+ }[];
6010
+
6011
+ /**
6012
+ * The resource path.
6013
+ * In the example: "/abc/resource.js"
6014
+ */
6015
+ resourcePath: string;
6016
+
6017
+ /**
6018
+ * The resource query string.
6019
+ * Example: "?query"
6020
+ */
6021
+ resourceQuery: string;
6022
+
6023
+ /**
6024
+ * The resource fragment.
6025
+ * Example: "#frag"
6026
+ */
6027
+ resourceFragment: string;
6028
+
6029
+ /**
6030
+ * The resource inclusive query and fragment.
6031
+ * Example: "/abc/resource.js?query#frag"
6032
+ */
6033
+ resource: string;
6034
+ }
5804
6035
  declare class LoaderTargetPlugin {
5805
6036
  constructor(target: string);
5806
6037
  target: string;
@@ -6870,7 +7101,7 @@ declare class NormalModule extends Module {
6870
7101
  options: WebpackOptionsNormalized,
6871
7102
  compilation: Compilation,
6872
7103
  fs: InputFileSystem
6873
- ): any;
7104
+ ): NormalModuleLoaderContext<any>;
6874
7105
  getCurrentLoader(loaderContext?: any, index?: any): null | LoaderItem;
6875
7106
  createSource(
6876
7107
  context: string,
@@ -6946,6 +7177,60 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
6946
7177
  createGenerator(type?: any, generatorOptions?: object): any;
6947
7178
  getResolver(type?: any, resolveOptions?: any): ResolverWithOptions;
6948
7179
  }
7180
+
7181
+ /**
7182
+ * These properties are added by the NormalModule
7183
+ */
7184
+ declare interface NormalModuleLoaderContext<OptionsType> {
7185
+ version: number;
7186
+ getOptions(): OptionsType;
7187
+ getOptions(schema: Parameters<typeof validateFunction>[0]): OptionsType;
7188
+ emitWarning(warning: Error): void;
7189
+ emitError(error: Error): void;
7190
+ getLogger(name?: string): WebpackLogger;
7191
+ resolve(
7192
+ context: string,
7193
+ request: string,
7194
+ callback: (
7195
+ arg0: null | Error,
7196
+ arg1?: string | false,
7197
+ arg2?: ResolveRequest
7198
+ ) => void
7199
+ ): any;
7200
+ getResolve(
7201
+ options?: ResolveOptionsWithDependencyType
7202
+ ): {
7203
+ (
7204
+ context: string,
7205
+ request: string,
7206
+ callback: (
7207
+ arg0: null | Error,
7208
+ arg1?: string | false,
7209
+ arg2?: ResolveRequest
7210
+ ) => void
7211
+ ): void;
7212
+ (context: string, request: string): Promise<string>;
7213
+ };
7214
+ emitFile(
7215
+ name: string,
7216
+ content: string,
7217
+ sourceMap?: string,
7218
+ assetInfo?: AssetInfo
7219
+ ): void;
7220
+ addBuildDependency(dep: string): void;
7221
+ utils: {
7222
+ absolutify: (context: string, request: string) => string;
7223
+ contextify: (context: string, request: string) => string;
7224
+ };
7225
+ rootContext: string;
7226
+ fs: InputFileSystem;
7227
+ sourceMap?: boolean;
7228
+ mode: "development" | "production" | "none";
7229
+ webpack?: boolean;
7230
+ _module?: NormalModule;
7231
+ _compilation?: Compilation;
7232
+ _compiler?: Compiler;
7233
+ }
6949
7234
  declare class NormalModuleReplacementPlugin {
6950
7235
  /**
6951
7236
  * Create an instance of the plugin
@@ -7657,6 +7942,11 @@ declare interface Output {
7657
7942
  */
7658
7943
  strictModuleExceptionHandling?: boolean;
7659
7944
 
7945
+ /**
7946
+ * Use a Trusted Types policy to create urls for chunks. 'output.uniqueName' is used a default policy name. Passing a string sets a custom policy name.
7947
+ */
7948
+ trustedTypes?: string | true | TrustedTypes;
7949
+
7660
7950
  /**
7661
7951
  * If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
7662
7952
  */
@@ -7691,25 +7981,34 @@ declare interface OutputFileSystem {
7691
7981
  writeFile: (
7692
7982
  arg0: string,
7693
7983
  arg1: string | Buffer,
7694
- arg2: (arg0?: NodeJS.ErrnoException) => void
7984
+ arg2: (arg0?: null | NodeJS.ErrnoException) => void
7985
+ ) => void;
7986
+ mkdir: (
7987
+ arg0: string,
7988
+ arg1: (arg0?: null | NodeJS.ErrnoException) => void
7695
7989
  ) => void;
7696
- mkdir: (arg0: string, arg1: (arg0?: NodeJS.ErrnoException) => void) => void;
7697
7990
  readdir?: (
7698
7991
  arg0: string,
7699
7992
  arg1: (
7700
- arg0?: NodeJS.ErrnoException,
7993
+ arg0?: null | NodeJS.ErrnoException,
7701
7994
  arg1?: (string | Buffer)[] | IDirent[]
7702
7995
  ) => void
7703
7996
  ) => void;
7704
- rmdir?: (arg0: string, arg1: (arg0?: NodeJS.ErrnoException) => void) => void;
7705
- unlink?: (arg0: string, arg1: (arg0?: NodeJS.ErrnoException) => void) => void;
7997
+ rmdir?: (
7998
+ arg0: string,
7999
+ arg1: (arg0?: null | NodeJS.ErrnoException) => void
8000
+ ) => void;
8001
+ unlink?: (
8002
+ arg0: string,
8003
+ arg1: (arg0?: null | NodeJS.ErrnoException) => void
8004
+ ) => void;
7706
8005
  stat: (
7707
8006
  arg0: string,
7708
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: IStats) => void
8007
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
7709
8008
  ) => void;
7710
8009
  readFile: (
7711
8010
  arg0: string,
7712
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
8011
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
7713
8012
  ) => void;
7714
8013
  join?: (arg0: string, arg1: string) => string;
7715
8014
  relative?: (arg0: string, arg1: string) => string;
@@ -7919,6 +8218,11 @@ declare interface OutputNormalized {
7919
8218
  */
7920
8219
  strictModuleExceptionHandling?: boolean;
7921
8220
 
8221
+ /**
8222
+ * Use a Trusted Types policy to create urls for chunks.
8223
+ */
8224
+ trustedTypes?: TrustedTypes;
8225
+
7922
8226
  /**
7923
8227
  * A unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals.
7924
8228
  */
@@ -8065,6 +8369,21 @@ declare interface PerformanceOptions {
8065
8369
  */
8066
8370
  maxEntrypointSize?: number;
8067
8371
  }
8372
+ declare interface PitchLoaderDefinitionFunction<
8373
+ OptionsType = {},
8374
+ ContextAdditions = {}
8375
+ > {
8376
+ (
8377
+ this: NormalModuleLoaderContext<OptionsType> &
8378
+ LoaderRunnerLoaderContext<OptionsType> &
8379
+ LoaderPluginLoaderContext &
8380
+ HotModuleReplacementPluginLoaderContext &
8381
+ ContextAdditions,
8382
+ remainingRequest: string,
8383
+ previousRequest: string,
8384
+ data: object
8385
+ ): string | void | Buffer | Promise<string | Buffer>;
8386
+ }
8068
8387
  type Plugin =
8069
8388
  | { apply: (arg0: Resolver) => void }
8070
8389
  | ((this: Resolver, arg1: Resolver) => void);
@@ -8099,6 +8418,12 @@ declare interface PrintedElement {
8099
8418
  element: string;
8100
8419
  content: string;
8101
8420
  }
8421
+ declare interface PrivateIdentifierNode {
8422
+ type: "PrivateIdentifier";
8423
+ name: string;
8424
+ loc?: null | SourceLocation;
8425
+ range?: [number, number];
8426
+ }
8102
8427
  declare interface Problem {
8103
8428
  type: ProblemType;
8104
8429
  path: string;
@@ -8216,6 +8541,71 @@ declare interface ProgressPluginOptions {
8216
8541
  */
8217
8542
  profile?: null | boolean;
8218
8543
  }
8544
+ declare interface PropertyDefinitionNode {
8545
+ type: "PropertyDefinition";
8546
+ key:
8547
+ | UnaryExpression
8548
+ | ThisExpression
8549
+ | ArrayExpression
8550
+ | ObjectExpression
8551
+ | FunctionExpression
8552
+ | ArrowFunctionExpression
8553
+ | YieldExpression
8554
+ | SimpleLiteral
8555
+ | RegExpLiteral
8556
+ | BigIntLiteral
8557
+ | UpdateExpression
8558
+ | BinaryExpression
8559
+ | AssignmentExpression
8560
+ | LogicalExpression
8561
+ | MemberExpression
8562
+ | ConditionalExpression
8563
+ | SimpleCallExpression
8564
+ | NewExpression
8565
+ | SequenceExpression
8566
+ | TemplateLiteral
8567
+ | TaggedTemplateExpression
8568
+ | ClassExpression
8569
+ | MetaProperty
8570
+ | Identifier
8571
+ | AwaitExpression
8572
+ | ImportExpression
8573
+ | ChainExpression
8574
+ | PrivateIdentifierNode;
8575
+ value:
8576
+ | null
8577
+ | UnaryExpression
8578
+ | ThisExpression
8579
+ | ArrayExpression
8580
+ | ObjectExpression
8581
+ | FunctionExpression
8582
+ | ArrowFunctionExpression
8583
+ | YieldExpression
8584
+ | SimpleLiteral
8585
+ | RegExpLiteral
8586
+ | BigIntLiteral
8587
+ | UpdateExpression
8588
+ | BinaryExpression
8589
+ | AssignmentExpression
8590
+ | LogicalExpression
8591
+ | MemberExpression
8592
+ | ConditionalExpression
8593
+ | SimpleCallExpression
8594
+ | NewExpression
8595
+ | SequenceExpression
8596
+ | TemplateLiteral
8597
+ | TaggedTemplateExpression
8598
+ | ClassExpression
8599
+ | MetaProperty
8600
+ | Identifier
8601
+ | AwaitExpression
8602
+ | ImportExpression
8603
+ | ChainExpression;
8604
+ computed: boolean;
8605
+ static: boolean;
8606
+ loc?: null | SourceLocation;
8607
+ range?: [number, number];
8608
+ }
8219
8609
  declare class ProvidePlugin {
8220
8610
  constructor(definitions: Record<string, string | string[]>);
8221
8611
  definitions: Record<string, string | string[]>;
@@ -8281,6 +8671,28 @@ declare interface RawChunkGroupOptions {
8281
8671
  preloadOrder?: number;
8282
8672
  prefetchOrder?: number;
8283
8673
  }
8674
+ type RawLoaderDefinition<
8675
+ OptionsType = {},
8676
+ ContextAdditions = {}
8677
+ > = RawLoaderDefinitionFunction<OptionsType, ContextAdditions> & {
8678
+ raw: true;
8679
+ pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
8680
+ };
8681
+ declare interface RawLoaderDefinitionFunction<
8682
+ OptionsType = {},
8683
+ ContextAdditions = {}
8684
+ > {
8685
+ (
8686
+ this: NormalModuleLoaderContext<OptionsType> &
8687
+ LoaderRunnerLoaderContext<OptionsType> &
8688
+ LoaderPluginLoaderContext &
8689
+ HotModuleReplacementPluginLoaderContext &
8690
+ ContextAdditions,
8691
+ content: Buffer,
8692
+ sourceMap?: string | SourceMap,
8693
+ additionalData?: AdditionalData
8694
+ ): string | void | Buffer | Promise<string | Buffer>;
8695
+ }
8284
8696
  declare class RawSource extends Source {
8285
8697
  constructor(source: string | Buffer, convertToString?: boolean);
8286
8698
  isBuffer(): boolean;
@@ -9866,10 +10278,6 @@ declare interface RuntimeValueOptions {
9866
10278
  buildDependencies?: string[];
9867
10279
  version?: string | (() => string);
9868
10280
  }
9869
- type Schema =
9870
- | (JSONSchema4 & Extend)
9871
- | (JSONSchema6 & Extend)
9872
- | (JSONSchema7 & Extend);
9873
10281
  declare interface ScopeInfo {
9874
10282
  definitions: StackedMap<string, ScopeInfo | VariableInfo>;
9875
10283
  topLevelScope: boolean | "arrow";
@@ -10145,6 +10553,15 @@ declare interface SourceData {
10145
10553
  declare interface SourceLike {
10146
10554
  source(): string | Buffer;
10147
10555
  }
10556
+ declare interface SourceMap {
10557
+ version: number;
10558
+ sources: string[];
10559
+ mappings: string;
10560
+ file?: string;
10561
+ sourceRoot?: string;
10562
+ sourcesContent?: string[];
10563
+ names?: string[];
10564
+ }
10148
10565
  declare class SourceMapDevToolPlugin {
10149
10566
  constructor(options?: SourceMapDevToolPluginOptions);
10150
10567
  sourceMapFilename: string | false;
@@ -10896,6 +11313,16 @@ declare interface TimestampAndHash {
10896
11313
  timestampHash?: string;
10897
11314
  hash: string;
10898
11315
  }
11316
+
11317
+ /**
11318
+ * Use a Trusted Types policy to create urls for chunks.
11319
+ */
11320
+ declare interface TrustedTypes {
11321
+ /**
11322
+ * The name of the Trusted Types policy created by webpack to serve bundle chunks.
11323
+ */
11324
+ policyName?: string;
11325
+ }
10899
11326
  declare const UNDEFINED_MARKER: unique symbol;
10900
11327
  declare interface UpdateHashContextDependency {
10901
11328
  chunkGraph: ChunkGraph;
@@ -11534,8 +11961,8 @@ declare namespace exports {
11534
11961
  };
11535
11962
  export const validate: (options?: any) => void;
11536
11963
  export const validateSchema: (
11537
- schema: Schema,
11538
- options: object | object[],
11964
+ schema: Parameters<typeof validateFunction>[0],
11965
+ options: Parameters<typeof validateFunction>[1],
11539
11966
  validationConfiguration?: ValidationErrorConfiguration
11540
11967
  ) => void;
11541
11968
  export const version: string;
@@ -11623,6 +12050,7 @@ declare namespace exports {
11623
12050
  export let uncaughtErrorHandler: string;
11624
12051
  export let scriptNonce: string;
11625
12052
  export let loadScript: string;
12053
+ export let createScriptUrl: string;
11626
12054
  export let chunkName: string;
11627
12055
  export let runtimeId: string;
11628
12056
  export let getChunkScriptFilename: string;
@@ -11661,8 +12089,6 @@ declare namespace exports {
11661
12089
  Unknown: 3;
11662
12090
  Used: 4;
11663
12091
  }>;
11664
- export const WebpackOptionsValidationError: ValidationError;
11665
- export const ValidationError: ValidationError;
11666
12092
  export namespace cache {
11667
12093
  export { MemoryCachePlugin };
11668
12094
  }
@@ -11921,6 +12347,8 @@ declare namespace exports {
11921
12347
  WebpackError,
11922
12348
  WebpackOptionsApply,
11923
12349
  WebpackOptionsDefaulter,
12350
+ ValidationError as WebpackOptionsValidationError,
12351
+ ValidationError,
11924
12352
  Entry,
11925
12353
  EntryNormalized,
11926
12354
  EntryObject,
@@ -11953,7 +12381,14 @@ declare namespace exports {
11953
12381
  StatsModuleReason,
11954
12382
  StatsModuleTraceDependency,
11955
12383
  StatsModuleTraceItem,
11956
- StatsProfile
12384
+ StatsProfile,
12385
+ LoaderModule,
12386
+ RawLoaderDefinition,
12387
+ LoaderDefinition,
12388
+ LoaderDefinitionFunction,
12389
+ PitchLoaderDefinitionFunction,
12390
+ RawLoaderDefinitionFunction,
12391
+ LoaderContext
11957
12392
  };
11958
12393
  }
11959
12394