webpack 5.111.0 → 5.111.1

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.
Files changed (144) hide show
  1. package/lib/APIPlugin.js +3 -4
  2. package/lib/CompatibilityPlugin.js +3 -4
  3. package/lib/Compilation.js +16 -35
  4. package/lib/Compiler.js +4 -5
  5. package/lib/ConstPlugin.js +16 -132
  6. package/lib/DependencyTemplate.js +2 -1
  7. package/lib/DotenvPlugin.js +24 -28
  8. package/lib/ErrorHelpers.js +113 -0
  9. package/lib/ExportsInfo.js +20 -16
  10. package/lib/ExternalModule.js +6 -8
  11. package/lib/FlagDependencyExportsPlugin.js +8 -13
  12. package/lib/FlagDependencyUsagePlugin.js +9 -13
  13. package/lib/Generator.js +24 -2
  14. package/lib/HotModuleReplacementPlugin.js +2 -0
  15. package/lib/IgnorePlugin.js +1 -1
  16. package/lib/LoaderOptionsPlugin.js +1 -1
  17. package/lib/Module.js +3 -3
  18. package/lib/ModuleGraph.js +6 -9
  19. package/lib/MultiCompiler.js +6 -16
  20. package/lib/NormalModule.js +96 -44
  21. package/lib/RuntimeTemplate.js +33 -43
  22. package/lib/SourceMapDevToolPlugin.js +53 -103
  23. package/lib/TemplatedPathPlugin.js +16 -59
  24. package/lib/asset/AssetBytesGenerator.js +7 -1
  25. package/lib/asset/AssetGenerator.js +25 -16
  26. package/lib/asset/AssetSourceGenerator.js +7 -1
  27. package/lib/buildChunkGraph.js +11 -15
  28. package/lib/cache/MemoryCachePlugin.js +4 -4
  29. package/lib/cache/MemoryWithGcCachePlugin.js +7 -8
  30. package/lib/cache/PackFileCacheStrategy.js +3 -18
  31. package/lib/cache/getLazyHashedEtag.js +3 -5
  32. package/lib/config/browserslistTargetHandler.js +2 -8
  33. package/lib/config/defaults.js +52 -78
  34. package/lib/config/getClaimedAssetTypes.js +10 -11
  35. package/lib/config/target.js +3 -4
  36. package/lib/{ContextExclusionPlugin.js → context/ContextExclusionPlugin.js} +1 -1
  37. package/lib/{ContextModule.js → context/ContextModule.js} +37 -34
  38. package/lib/{ContextModuleFactory.js → context/ContextModuleFactory.js} +19 -21
  39. package/lib/{ContextReplacementPlugin.js → context/ContextReplacementPlugin.js} +4 -4
  40. package/lib/css/CssGenerator.js +19 -11
  41. package/lib/css/CssParser.js +18 -20
  42. package/lib/css/cssMinify.js +32 -29
  43. package/lib/css/data.js +797 -288
  44. package/lib/css/syntax.js +2250 -934
  45. package/lib/debug/ProfilingPlugin.js +3 -4
  46. package/lib/dependencies/CommonJsExportRequireDependency.js +10 -11
  47. package/lib/dependencies/CommonJsImportsParserPlugin.js +4 -5
  48. package/lib/dependencies/CommonJsSelfReferenceDependency.js +2 -4
  49. package/lib/dependencies/ContextDependency.js +1 -1
  50. package/lib/dependencies/ContextDependencyHelpers.js +3 -9
  51. package/lib/dependencies/ContextElementDependency.js +1 -1
  52. package/lib/dependencies/CssIcssExportDependency.js +6 -8
  53. package/lib/dependencies/CssIcssImportDependency.js +3 -6
  54. package/lib/dependencies/CssUrlDependency.js +3 -5
  55. package/lib/dependencies/HarmonyCompatibilityDependency.js +11 -20
  56. package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -4
  57. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -4
  58. package/lib/dependencies/HarmonyExportExpressionDependency.js +3 -4
  59. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +3 -4
  60. package/lib/dependencies/HarmonyExportInitFragment.js +26 -19
  61. package/lib/dependencies/HarmonyExportSpecifierDependency.js +7 -28
  62. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +103 -16
  63. package/lib/dependencies/HarmonyImportSideEffectDependency.js +3 -4
  64. package/lib/dependencies/HarmonyImportSpecifierDependency.js +16 -2
  65. package/lib/dependencies/HtmlEntryDependency.js +74 -102
  66. package/lib/dependencies/HtmlInlineScriptDependency.js +3 -4
  67. package/lib/dependencies/HtmlInlineStyleDependency.js +3 -4
  68. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
  69. package/lib/dependencies/ImportMetaGlobHelpers.js +1 -1
  70. package/lib/dependencies/ImportMetaPlugin.js +8 -10
  71. package/lib/dependencies/ImportParserPlugin.js +1 -1
  72. package/lib/dependencies/LoaderPlugin.js +26 -1
  73. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  74. package/lib/dependencies/URLContextDependency.js +1 -1
  75. package/lib/dependencies/URLDependency.js +6 -5
  76. package/lib/dependencies/WorkerAndWorkletPlugin.js +15 -21
  77. package/lib/dependencies/WorkerDependency.js +6 -5
  78. package/lib/dependencies/WorkletDependency.js +6 -9
  79. package/lib/errors/HookWebpackError.js +3 -2
  80. package/lib/hmr/LazyCompilationPlugin.js +3 -5
  81. package/lib/html/HtmlGenerator.js +61 -82
  82. package/lib/html/HtmlModulesPlugin.js +88 -139
  83. package/lib/html/HtmlParser.js +97 -141
  84. package/lib/html/data.js +21 -0
  85. package/lib/html/htmlMinify.js +10 -11
  86. package/lib/html/syntax.js +883 -993
  87. package/lib/index.js +46 -3
  88. package/lib/javascript/ChunkFormatHelpers.js +4 -3
  89. package/lib/javascript/JavascriptGenerator.js +8 -1
  90. package/lib/javascript/JavascriptModulesPlugin.js +21 -48
  91. package/lib/javascript/JavascriptParser.js +721 -178
  92. package/lib/javascript/parser.js +6 -0
  93. package/lib/javascript/syntax.js +420 -92
  94. package/lib/json/JsonGenerator.js +7 -1
  95. package/lib/library/ModuleLibraryPlugin.js +64 -136
  96. package/lib/loaders/LoaderRunner.js +137 -9
  97. package/lib/node/NodeWatchFileSystem.js +3 -9
  98. package/lib/optimize/AggressiveMergingPlugin.js +3 -5
  99. package/lib/optimize/ConcatenatedModule.js +81 -100
  100. package/lib/optimize/FlagIncludedChunksPlugin.js +3 -11
  101. package/lib/optimize/InnerGraphPlugin.js +7 -13
  102. package/lib/optimize/LimitChunkCountPlugin.js +5 -8
  103. package/lib/optimize/MangleExportsPlugin.js +3 -4
  104. package/lib/optimize/ModuleConcatenationPlugin.js +3 -4
  105. package/lib/optimize/SideEffectsFlagPlugin.js +7 -19
  106. package/lib/optimize/SplitChunksPlugin.js +2 -4
  107. package/lib/performance/BroadContextsPlugin.js +1 -1
  108. package/lib/performance/CacheEffectivenessPlugin.js +3 -4
  109. package/lib/performance/SizeLimitsPlugin.js +2 -4
  110. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +6 -8
  111. package/lib/prefetch/ResourceHintPlugin.js +17 -21
  112. package/lib/prefetch/StartupAssetHintRuntimeModule.js +7 -10
  113. package/lib/runtime/AsyncModuleRuntimeModule.js +3 -5
  114. package/lib/runtime/GetChunkFilenameRuntimeModule.js +3 -4
  115. package/lib/runtime/GlobalRuntimeModule.js +2 -4
  116. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +55 -85
  117. package/lib/schemes/DataUriPlugin.js +3 -6
  118. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  119. package/lib/serialization/BinaryMiddleware.js +9 -9
  120. package/lib/serialization/FileMiddleware.js +16 -16
  121. package/lib/serialization/ObjectMiddleware.js +30 -33
  122. package/lib/stats/DefaultStatsFactoryPlugin.js +3 -4
  123. package/lib/typescript/TypeScriptPlugin.js +2 -3
  124. package/lib/url/URLParserPlugin.js +6 -8
  125. package/lib/util/LocConverter.js +4 -7
  126. package/lib/util/SourceProcessor.js +15 -22
  127. package/lib/util/chainedImports.js +3 -4
  128. package/lib/util/concatenate.js +4 -4
  129. package/lib/util/createHooksRegistry.js +1 -2
  130. package/lib/util/dataURL.js +2 -3
  131. package/lib/util/deterministicGrouping.js +8 -13
  132. package/lib/util/findGraphRoots.js +6 -13
  133. package/lib/util/globUtils.js +1 -1
  134. package/lib/util/hash/wasm-hash.js +3 -4
  135. package/lib/util/internalSerializables.js +1 -1
  136. package/lib/util/semver.js +5 -3
  137. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +6 -1
  138. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -1
  139. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +3 -4
  140. package/lib/wasm-sync/WebAssemblyGenerator.js +6 -1
  141. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +5 -1
  142. package/lib/wasm-sync/WebAssemblyUtils.js +2 -4
  143. package/package.json +30 -23
  144. package/types.d.ts +299 -280
package/types.d.ts CHANGED
@@ -233,8 +233,11 @@ declare interface AbstractLibraryPluginOptions {
233
233
  */
234
234
  type: string;
235
235
  }
236
- declare interface AdditionalData {
237
- [index: string]: any;
236
+ type AdditionalData = AdditionalDataKnown & Record<string, any>;
237
+ declare interface AdditionalDataKnown {
238
+ /**
239
+ * the AST webpack should parse instead of the source
240
+ */
238
241
  webpackAST: object;
239
242
  }
240
243
  type AfterContextResolveData = ContextResolveData &
@@ -334,6 +337,21 @@ declare interface AllCodeGenerationSchemas {
334
337
  */
335
338
  externalReexport: string;
336
339
 
340
+ /**
341
+ * export definitions left out of a javascript module's source on demand (see `KnownMeta.onDemandExports`), to be placed before its body where it is wrapped
342
+ */
343
+ exportsSource: string;
344
+
345
+ /**
346
+ * export definitions left out on demand that read the module's own declarations, to be placed after its body where it is wrapped
347
+ */
348
+ exportsBindingSource: string;
349
+
350
+ /**
351
+ * final name of each used export of a concatenated module whose definitions were left out on demand
352
+ */
353
+ exportsFinalName: Record<string, string>;
354
+
337
355
  /**
338
356
  * url for asset modules
339
357
  */
@@ -362,7 +380,8 @@ declare interface AllCodeGenerationSchemas {
362
380
  type AnalyzableForm =
363
381
  "import" | "url" | "url-runtime" | "url-inline" | "wasm" | "wasm-relative";
364
382
  type AnyLoaderContext = NormalModuleLoaderContext<any> &
365
- LoaderRunnerLoaderContext<any> &
383
+ LoaderRunnerMutableContext<any> &
384
+ LoaderRunnerReadonlyContext<any> &
366
385
  LoaderPluginLoaderContext &
367
386
  HotModuleReplacementPluginLoaderContext;
368
387
 
@@ -3106,6 +3125,9 @@ type CodeGenValue<K extends string> = K extends
3106
3125
  | "freeNames"
3107
3126
  | "chunkInitFragments"
3108
3127
  | "externalReexport"
3128
+ | "exportsSource"
3129
+ | "exportsBindingSource"
3130
+ | "exportsFinalName"
3109
3131
  | "url"
3110
3132
  | "fullContentHash"
3111
3133
  ? AllCodeGenerationSchemas[K]
@@ -6881,6 +6903,11 @@ declare interface DependencyTemplateContext {
6881
6903
  * chunkInitFragments
6882
6904
  */
6883
6905
  chunkInitFragments: InitFragment<GenerateContext>[];
6906
+
6907
+ /**
6908
+ * get access to the code generation data
6909
+ */
6910
+ getData?: () => CodeGenerationResultData;
6884
6911
  }
6885
6912
  declare abstract class DependencyTemplates {
6886
6913
  /**
@@ -7335,6 +7362,19 @@ declare interface DotenvPluginOptions {
7335
7362
  */
7336
7363
  template?: string[];
7337
7364
  }
7365
+
7366
+ declare interface DualModeResolve {
7367
+ (
7368
+ context: string,
7369
+ request: string,
7370
+ callback: (
7371
+ err: null | ErrorWithDetail,
7372
+ res?: string | false,
7373
+ req?: ResolveRequest
7374
+ ) => void
7375
+ ): void;
7376
+ (context: string, request: string): Promise<string>;
7377
+ }
7338
7378
  declare class DynamicEntryPlugin {
7339
7379
  /**
7340
7380
  * Creates an instance of DynamicEntryPlugin.
@@ -8474,7 +8514,9 @@ declare abstract class ExportInfo {
8474
8514
  isReexport(): undefined | boolean;
8475
8515
 
8476
8516
  /**
8477
- * Returns the target, undefined when there is no target, false when no target is valid.
8517
+ * Walks the reexport chain and returns the first target whose module passes
8518
+ * `validTargetModuleFilter`. Returns undefined when there is no target, false
8519
+ * when the chain ends without a valid module.
8478
8520
  */
8479
8521
  findTarget(
8480
8522
  moduleGraph: ModuleGraph,
@@ -8482,7 +8524,9 @@ declare abstract class ExportInfo {
8482
8524
  ): undefined | null | false | TargetItemWithoutConnection;
8483
8525
 
8484
8526
  /**
8485
- * Returns the target.
8527
+ * Resolves the reexport chain as far as `resolveTargetFilter` allows and
8528
+ * returns where it ends. Returns undefined when there is no target, the
8529
+ * targets disagree, or the chain is circular.
8486
8530
  */
8487
8531
  getTarget(
8488
8532
  moduleGraph: ModuleGraph,
@@ -9893,12 +9937,23 @@ declare class Generator {
9893
9937
  [index: string]: undefined | Generator;
9894
9938
  }): ByTypeGenerator;
9895
9939
 
9940
+ /**
9941
+ * Returns what a module that failed to build says about it in the output.
9942
+ * The stack it carries is written relative to the context, keeping a
9943
+ * position only where a second build names the same one.
9944
+ */
9945
+ static buildErrorMessage(
9946
+ error: Error,
9947
+ requestShortener?: RequestShortener
9948
+ ): string;
9949
+
9896
9950
  /**
9897
9951
  * Returns the statement a module that failed to build throws when executed.
9898
9952
  */
9899
9953
  static throwBuildErrorCode(
9900
9954
  error: Error,
9901
- parseErrorConstructor?: string
9955
+ parseErrorConstructor?: string,
9956
+ requestShortener?: RequestShortener
9902
9957
  ): string;
9903
9958
  }
9904
9959
  declare interface GeneratorOptions {
@@ -10049,6 +10104,11 @@ declare class GetChunkFilenameRuntimeModule extends RuntimeModule {
10049
10104
  static getSourceBasicTypes(module: Module): ReadonlySet<string>;
10050
10105
  }
10051
10106
 
10107
+ declare interface GetOptionsMethod<OptionsType> {
10108
+ (): OptionsType;
10109
+ (schema: Parameters<typeof validateFunction>[0]): OptionsType;
10110
+ }
10111
+
10052
10112
  /**
10053
10113
  * Creates a callback wrapper that waits for a fixed number of completions and
10054
10114
  * forwards the first error immediately.
@@ -10457,10 +10517,6 @@ declare class HotModuleReplacementPlugin {
10457
10517
  */
10458
10518
  static getParserHooks(parser: JavascriptParser): HMRJavascriptParserHooks;
10459
10519
  }
10460
-
10461
- /**
10462
- * These properties are added by the HotModuleReplacementPlugin
10463
- */
10464
10520
  declare interface HotModuleReplacementPluginLoaderContext {
10465
10521
  hot?: boolean;
10466
10522
  }
@@ -10861,7 +10917,7 @@ declare interface HtmlProcessOptions {
10861
10917
  sortTokenLists?: boolean;
10862
10918
 
10863
10919
  /**
10864
- * drop an attribute whose value is the element's own default; `true` is `"smart"`, and `"all"` also drops the spec defaults a selector can match (default false)
10920
+ * drop an attribute whose value is the element's own default; `true` is `"smart"`, and `"all"` also drops the spec defaults a selector can match, and with them a value naming no keyword where that says the same (default false)
10865
10921
  */
10866
10922
  removeRedundantAttributes?: boolean | "all" | "smart";
10867
10923
 
@@ -11662,6 +11718,15 @@ declare interface ImportMetaParserOptionsKnown {
11662
11718
  declare interface ImportMetaParserOptionsUnknown {
11663
11719
  [index: string]: boolean;
11664
11720
  }
11721
+
11722
+ declare interface ImportModuleMethod {
11723
+ (
11724
+ request: string,
11725
+ options: undefined | ImportModuleOptions,
11726
+ callback: (err?: null | Error, exports?: any) => void
11727
+ ): void;
11728
+ (request: string, options?: ImportModuleOptions): Promise<any>;
11729
+ }
11665
11730
  declare interface ImportModuleOptions {
11666
11731
  /**
11667
11732
  * the target layer
@@ -12103,15 +12168,6 @@ declare class JavascriptModulesPlugin {
12103
12168
  [Module, Partial<RenderBootstrapContext>],
12104
12169
  string | void
12105
12170
  >;
12106
- /**
12107
- * Offers a module's rendered export-definition call to a consumer that can place
12108
- * it better — a library whose entry exports the same bindings natively takes it
12109
- * over and emits it only where the module is wrapped. Return true to take it.
12110
- */
12111
- onDemandExportsGeneration: SyncBailHook<
12112
- [Module, RuntimeSpec, string, boolean],
12113
- boolean | void
12114
- >;
12115
12171
  /**
12116
12172
  * @since 5.22.0
12117
12173
  */
@@ -12192,15 +12248,6 @@ declare class JavascriptModulesPlugin {
12192
12248
  [Module, Partial<RenderBootstrapContext>],
12193
12249
  string | void
12194
12250
  >;
12195
- /**
12196
- * Offers a module's rendered export-definition call to a consumer that can place
12197
- * it better — a library whose entry exports the same bindings natively takes it
12198
- * over and emits it only where the module is wrapped. Return true to take it.
12199
- */
12200
- onDemandExportsGeneration: SyncBailHook<
12201
- [Module, RuntimeSpec, string, boolean],
12202
- boolean | void
12203
- >;
12204
12251
  /**
12205
12252
  * @since 5.22.0
12206
12253
  */
@@ -12281,15 +12328,6 @@ declare class JavascriptModulesPlugin {
12281
12328
  [Module, Partial<RenderBootstrapContext>],
12282
12329
  string | void
12283
12330
  >;
12284
- /**
12285
- * Offers a module's rendered export-definition call to a consumer that can place
12286
- * it better — a library whose entry exports the same bindings natively takes it
12287
- * over and emits it only where the module is wrapped. Return true to take it.
12288
- */
12289
- onDemandExportsGeneration: SyncBailHook<
12290
- [Module, RuntimeSpec, string, boolean],
12291
- boolean | void
12292
- >;
12293
12331
  /**
12294
12332
  * @since 5.22.0
12295
12333
  */
@@ -12372,15 +12410,6 @@ declare class JavascriptModulesPlugin {
12372
12410
  [Module, Partial<RenderBootstrapContext>],
12373
12411
  string | void
12374
12412
  >;
12375
- /**
12376
- * Offers a module's rendered export-definition call to a consumer that can place
12377
- * it better — a library whose entry exports the same bindings natively takes it
12378
- * over and emits it only where the module is wrapped. Return true to take it.
12379
- */
12380
- onDemandExportsGeneration: SyncBailHook<
12381
- [Module, RuntimeSpec, string, boolean],
12382
- boolean | void
12383
- >;
12384
12413
  /**
12385
12414
  * @since 5.22.0
12386
12415
  */
@@ -12461,15 +12490,6 @@ declare class JavascriptModulesPlugin {
12461
12490
  [Module, Partial<RenderBootstrapContext>],
12462
12491
  string | void
12463
12492
  >;
12464
- /**
12465
- * Offers a module's rendered export-definition call to a consumer that can place
12466
- * it better — a library whose entry exports the same bindings natively takes it
12467
- * over and emits it only where the module is wrapped. Return true to take it.
12468
- */
12469
- onDemandExportsGeneration: SyncBailHook<
12470
- [Module, RuntimeSpec, string, boolean],
12471
- boolean | void
12472
- >;
12473
12493
  /**
12474
12494
  * @since 5.22.0
12475
12495
  */
@@ -12550,15 +12570,6 @@ declare class JavascriptModulesPlugin {
12550
12570
  [Module, Partial<RenderBootstrapContext>],
12551
12571
  string | void
12552
12572
  >;
12553
- /**
12554
- * Offers a module's rendered export-definition call to a consumer that can place
12555
- * it better — a library whose entry exports the same bindings natively takes it
12556
- * over and emits it only where the module is wrapped. Return true to take it.
12557
- */
12558
- onDemandExportsGeneration: SyncBailHook<
12559
- [Module, RuntimeSpec, string, boolean],
12560
- boolean | void
12561
- >;
12562
12573
  /**
12563
12574
  * @since 5.22.0
12564
12575
  */
@@ -12638,15 +12649,6 @@ declare class JavascriptModulesPlugin {
12638
12649
  [Module, Partial<RenderBootstrapContext>],
12639
12650
  string | void
12640
12651
  >;
12641
- /**
12642
- * Offers a module's rendered export-definition call to a consumer that can place
12643
- * it better — a library whose entry exports the same bindings natively takes it
12644
- * over and emits it only where the module is wrapped. Return true to take it.
12645
- */
12646
- onDemandExportsGeneration: SyncBailHook<
12647
- [Module, RuntimeSpec, string, boolean],
12648
- boolean | void
12649
- >;
12650
12652
  /**
12651
12653
  * @since 5.22.0
12652
12654
  */
@@ -12808,6 +12810,11 @@ declare class JavascriptParser extends ParserClass {
12808
12810
  boolean | void
12809
12811
  >
12810
12812
  >;
12813
+ /**
12814
+ * Every statement the hoisting pass reads, which a tap on this turns
12815
+ * back into a walk of them all. Tap `preStatementByType` instead.
12816
+ * @deprecated TODO webpack 6: remove, with the statement walk it turns on
12817
+ */
12811
12818
  preStatement: SyncBailHook<
12812
12819
  [
12813
12820
  | ImportDeclaration
@@ -12842,6 +12849,9 @@ declare class JavascriptParser extends ParserClass {
12842
12849
  boolean | void
12843
12850
  >;
12844
12851
  /**
12852
+ * Each declaration the parser records: a variable, function or class
12853
+ * one. Any other type turns the pass back into a walk of every
12854
+ * statement, and goes away with that walk in webpack 6.
12845
12855
  * @since 5.109.0
12846
12856
  */
12847
12857
  preStatementByType: HookMap<
@@ -12879,6 +12889,11 @@ declare class JavascriptParser extends ParserClass {
12879
12889
  boolean | void
12880
12890
  >
12881
12891
  >;
12892
+ /**
12893
+ * Every statement the block pass reads, which a tap on this turns back
12894
+ * into a walk of them all. Tap `blockPreStatementByType` instead.
12895
+ * @deprecated TODO webpack 6: remove, with the statement walk it turns on
12896
+ */
12882
12897
  blockPreStatement: SyncBailHook<
12883
12898
  [
12884
12899
  | ImportDeclaration
@@ -12913,6 +12928,9 @@ declare class JavascriptParser extends ParserClass {
12913
12928
  boolean | void
12914
12929
  >;
12915
12930
  /**
12931
+ * Each statement the parser records for the block pass: a variable, class
12932
+ * or export declaration. Any other type turns the pass back into a walk
12933
+ * of every statement, and goes away with that walk in webpack 6.
12916
12934
  * @since 5.109.0
12917
12935
  */
12918
12936
  blockPreStatementByType: HookMap<
@@ -13125,6 +13143,10 @@ declare class JavascriptParser extends ParserClass {
13125
13143
  canRename: HookMap<SyncBailHook<[ExpressionEstreeIndex], boolean | void>>;
13126
13144
  rename: HookMap<SyncBailHook<[ExpressionEstreeIndex], boolean | void>>;
13127
13145
  assign: HookMap<SyncBailHook<[AssignmentExpression], boolean | void>>;
13146
+ write: HookMap<SyncBailHook<[WriteStatement], boolean | void>>;
13147
+ writeMemberChain: HookMap<
13148
+ SyncBailHook<[WriteStatement, string[]], boolean | void>
13149
+ >;
13128
13150
  assignMemberChain: HookMap<
13129
13151
  SyncBailHook<[AssignmentExpression, string[]], boolean | void>
13130
13152
  >;
@@ -13376,9 +13398,11 @@ declare class JavascriptParser extends ParserClass {
13376
13398
  ): void;
13377
13399
 
13378
13400
  /**
13379
- * Module pre walking iterates the scope for import entries
13401
+ * Walk every statement of a scope to declare what hoists to it. Only a tap
13402
+ * on the deprecated `preStatement` hook asks for this.
13403
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13380
13404
  */
13381
- modulePreWalkStatements(
13405
+ preWalkStatements(
13382
13406
  statements: (
13383
13407
  | ImportDeclaration
13384
13408
  | ExportNamedDeclaration
@@ -13410,9 +13434,89 @@ declare class JavascriptParser extends ParserClass {
13410
13434
  ): void;
13411
13435
 
13412
13436
  /**
13413
- * Pre walking iterates the scope for variable declarations
13437
+ * Pre walk block statement.
13438
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13414
13439
  */
13415
- preWalkStatements(
13440
+ preWalkBlockStatement(statement: BlockStatement): void;
13441
+
13442
+ /**
13443
+ * Pre walk if statement.
13444
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13445
+ */
13446
+ preWalkIfStatement(statement: IfStatement): void;
13447
+
13448
+ /**
13449
+ * Pre walk labeled statement.
13450
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13451
+ */
13452
+ preWalkLabeledStatement(statement: LabeledStatement): void;
13453
+
13454
+ /**
13455
+ * Pre walk with statement.
13456
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13457
+ */
13458
+ preWalkWithStatement(statement: WithStatement): void;
13459
+
13460
+ /**
13461
+ * Pre walk switch statement.
13462
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13463
+ */
13464
+ preWalkSwitchStatement(statement: SwitchStatement): void;
13465
+
13466
+ /**
13467
+ * Pre walk switch cases.
13468
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13469
+ */
13470
+ preWalkSwitchCases(switchCases: SwitchCase[]): void;
13471
+
13472
+ /**
13473
+ * Pre walk try statement.
13474
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13475
+ */
13476
+ preWalkTryStatement(statement: TryStatement): void;
13477
+
13478
+ /**
13479
+ * Pre walk catch clause.
13480
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13481
+ */
13482
+ preWalkCatchClause(catchClause: CatchClause): void;
13483
+
13484
+ /**
13485
+ * Pre walk while statement.
13486
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13487
+ */
13488
+ preWalkWhileStatement(statement: WhileStatement): void;
13489
+
13490
+ /**
13491
+ * Pre walk do while statement.
13492
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13493
+ */
13494
+ preWalkDoWhileStatement(statement: DoWhileStatement): void;
13495
+
13496
+ /**
13497
+ * Pre walk for statement.
13498
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13499
+ */
13500
+ preWalkForStatement(statement: ForStatement): void;
13501
+
13502
+ /**
13503
+ * Pre walk for in statement.
13504
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13505
+ */
13506
+ preWalkForInStatement(statement: ForInStatement): void;
13507
+
13508
+ /**
13509
+ * Pre walk for of statement. `for await` is reported by the walk, not here.
13510
+ * @deprecated TODO webpack 6: remove, with the `preStatement` hook
13511
+ */
13512
+ preWalkForOfStatement(statement: ForOfStatement): void;
13513
+
13514
+ /**
13515
+ * Scan every top-level statement for the program's module declarations.
13516
+ * The parser records them now, so nothing inside webpack scans for them.
13517
+ * @deprecated TODO webpack 6: remove
13518
+ */
13519
+ modulePreWalkStatements(
13416
13520
  statements: (
13417
13521
  | ImportDeclaration
13418
13522
  | ExportNamedDeclaration
@@ -13444,7 +13548,9 @@ declare class JavascriptParser extends ParserClass {
13444
13548
  ): void;
13445
13549
 
13446
13550
  /**
13447
- * Block pre walking iterates the scope for block variable declarations
13551
+ * Walk every statement of a list to declare what it binds. Only a tap on the
13552
+ * deprecated `blockPreStatement` hook asks for this.
13553
+ * @deprecated TODO webpack 6: remove, with the `blockPreStatement` hook
13448
13554
  */
13449
13555
  blockPreWalkStatements(
13450
13556
  statements: (
@@ -13623,11 +13729,6 @@ declare class JavascriptParser extends ParserClass {
13623
13729
  */
13624
13730
  walkNestedStatement(statement: Statement): void;
13625
13731
 
13626
- /**
13627
- * Pre walk block statement.
13628
- */
13629
- preWalkBlockStatement(statement: BlockStatement): void;
13630
-
13631
13732
  /**
13632
13733
  * Walk block statement.
13633
13734
  */
@@ -13638,11 +13739,6 @@ declare class JavascriptParser extends ParserClass {
13638
13739
  */
13639
13740
  walkExpressionStatement(statement: ExpressionStatement): void;
13640
13741
 
13641
- /**
13642
- * Pre walk if statement.
13643
- */
13644
- preWalkIfStatement(statement: IfStatement): void;
13645
-
13646
13742
  /**
13647
13743
  * Walks a conditional branch with its guard frame (if any) pushed onto the
13648
13744
  * parser-state guard stack for the duration of the branch body.
@@ -13654,31 +13750,16 @@ declare class JavascriptParser extends ParserClass {
13654
13750
  */
13655
13751
  walkIfStatement(statement: IfStatement): void;
13656
13752
 
13657
- /**
13658
- * Pre walk labeled statement.
13659
- */
13660
- preWalkLabeledStatement(statement: LabeledStatement): void;
13661
-
13662
13753
  /**
13663
13754
  * Walk labeled statement.
13664
13755
  */
13665
13756
  walkLabeledStatement(statement: LabeledStatement): void;
13666
13757
 
13667
- /**
13668
- * Pre walk with statement.
13669
- */
13670
- preWalkWithStatement(statement: WithStatement): void;
13671
-
13672
13758
  /**
13673
13759
  * Walk with statement.
13674
13760
  */
13675
13761
  walkWithStatement(statement: WithStatement): void;
13676
13762
 
13677
- /**
13678
- * Pre walk switch statement.
13679
- */
13680
- preWalkSwitchStatement(statement: SwitchStatement): void;
13681
-
13682
13763
  /**
13683
13764
  * Walk switch statement.
13684
13765
  */
@@ -13699,61 +13780,31 @@ declare class JavascriptParser extends ParserClass {
13699
13780
  */
13700
13781
  walkThrowStatement(statement: ThrowStatement): void;
13701
13782
 
13702
- /**
13703
- * Pre walk try statement.
13704
- */
13705
- preWalkTryStatement(statement: TryStatement): void;
13706
-
13707
13783
  /**
13708
13784
  * Walk try statement.
13709
13785
  */
13710
13786
  walkTryStatement(statement: TryStatement): void;
13711
13787
 
13712
- /**
13713
- * Pre walk while statement.
13714
- */
13715
- preWalkWhileStatement(statement: WhileStatement): void;
13716
-
13717
13788
  /**
13718
13789
  * Walk while statement.
13719
13790
  */
13720
13791
  walkWhileStatement(statement: WhileStatement): void;
13721
13792
 
13722
- /**
13723
- * Pre walk do while statement.
13724
- */
13725
- preWalkDoWhileStatement(statement: DoWhileStatement): void;
13726
-
13727
13793
  /**
13728
13794
  * Walk do while statement.
13729
13795
  */
13730
13796
  walkDoWhileStatement(statement: DoWhileStatement): void;
13731
13797
 
13732
- /**
13733
- * Pre walk for statement.
13734
- */
13735
- preWalkForStatement(statement: ForStatement): void;
13736
-
13737
13798
  /**
13738
13799
  * Walk for statement.
13739
13800
  */
13740
13801
  walkForStatement(statement: ForStatement): void;
13741
13802
 
13742
- /**
13743
- * Pre walk for in statement.
13744
- */
13745
- preWalkForInStatement(statement: ForInStatement): void;
13746
-
13747
13803
  /**
13748
13804
  * Walk for in statement.
13749
13805
  */
13750
13806
  walkForInStatement(statement: ForInStatement): void;
13751
13807
 
13752
- /**
13753
- * Pre walk for of statement.
13754
- */
13755
- preWalkForOfStatement(statement: ForOfStatement): void;
13756
-
13757
13808
  /**
13758
13809
  * Walk for of statement.
13759
13810
  */
@@ -13898,21 +13949,11 @@ declare class JavascriptParser extends ParserClass {
13898
13949
  statement: ClassDeclaration | MaybeNamedClassDeclaration
13899
13950
  ): void;
13900
13951
 
13901
- /**
13902
- * Pre walk switch cases.
13903
- */
13904
- preWalkSwitchCases(switchCases: SwitchCase[]): void;
13905
-
13906
13952
  /**
13907
13953
  * Processes the provided switch case.
13908
13954
  */
13909
13955
  walkSwitchCases(switchCases: SwitchCase[]): void;
13910
13956
 
13911
- /**
13912
- * Pre walk catch clause.
13913
- */
13914
- preWalkCatchClause(catchClause: CatchClause): void;
13915
-
13916
13957
  /**
13917
13958
  * Processes the provided catch clause.
13918
13959
  */
@@ -14555,6 +14596,12 @@ declare class JavascriptParser extends ParserClass {
14555
14596
  */
14556
14597
  getComments(range: [number, number]): CommentJavascriptParser[];
14557
14598
 
14599
+ /**
14600
+ * Where the comments written for `statement` begin: the run of comments
14601
+ * before it that whitespace alone separates from it and from each other.
14602
+ */
14603
+ getAttachedCommentsStart(statement: StatementPathItem): number;
14604
+
14558
14605
  /**
14559
14606
  * Reports whether `identifier` may occur as a word in the source text of
14560
14607
  * `range`. A conservative pre-filter for expensive AST scans: `false` means
@@ -15445,21 +15492,6 @@ declare interface KnownBuildMeta {
15445
15492
  defaultObject?: false | "redirect" | "redirect-warn";
15446
15493
  async?: boolean;
15447
15494
  sideEffectFree?: boolean;
15448
-
15449
- /**
15450
- * using in ModuleLibraryPlugin
15451
- */
15452
- exportsFinalNameByRuntime?: Map<string, Record<string, string>>;
15453
-
15454
- /**
15455
- * using in ModuleLibraryPlugin
15456
- */
15457
- exportsSourceByRuntime?: Map<string, string>;
15458
-
15459
- /**
15460
- * export definitions `ModuleLibraryPlugin` took over, re-emitted only where the module is wrapped
15461
- */
15462
- exportsBindingSourceByRuntime?: Map<string, string>;
15463
15495
  }
15464
15496
  declare interface KnownConcatenatedModuleBuildInfo {
15465
15497
  fileDependencies?: LazySet<string>;
@@ -15601,6 +15633,11 @@ declare interface KnownJsonModuleBuildInfo {
15601
15633
  declare interface KnownMeta {
15602
15634
  importVarMap?: Map<Module, string>;
15603
15635
  deferredImportVarMap?: Map<Module, string>;
15636
+
15637
+ /**
15638
+ * generate export definitions on demand
15639
+ */
15640
+ onDemandExports?: boolean;
15604
15641
  }
15605
15642
  declare interface KnownNormalModuleBuildInfo {
15606
15643
  parsed?: boolean;
@@ -16500,10 +16537,33 @@ declare class LoadScriptRuntimeModule extends HelperRuntimeModule {
16500
16537
  declare interface Loader {
16501
16538
  [index: string]: any;
16502
16539
  }
16503
- type LoaderContext<OptionsType> = NormalModuleLoaderContext<OptionsType> &
16504
- LoaderRunnerLoaderContext<OptionsType> &
16540
+ type LoaderContextLibIndex<OptionsType> =
16541
+ NormalModuleLoaderContext<OptionsType> &
16542
+ LoaderRunnerMutableContext<OptionsType> &
16543
+ LoaderRunnerReadonlyContext<OptionsType> &
16544
+ LoaderPluginLoaderContext &
16545
+ HotModuleReplacementPluginLoaderContext;
16546
+ type LoaderContextNormalModule<T> = NormalModuleLoaderContext<T> &
16547
+ LoaderRunnerMutableContext<T> &
16548
+ LoaderRunnerReadonlyContext<T> &
16505
16549
  LoaderPluginLoaderContext &
16506
16550
  HotModuleReplacementPluginLoaderContext;
16551
+ declare interface LoaderContextUtils {
16552
+ /**
16553
+ * returns a new request string using absolute paths when possible
16554
+ */
16555
+ absolutify: (context: string, request: string) => string;
16556
+
16557
+ /**
16558
+ * returns a new request string avoiding absolute paths when possible
16559
+ */
16560
+ contextify: (context: string, request: string) => string;
16561
+
16562
+ /**
16563
+ * creates a hash with the compilation's function
16564
+ */
16565
+ createHash: (algorithm?: string | typeof Hash) => Hash;
16566
+ }
16507
16567
  type LoaderDefinition<
16508
16568
  OptionsType = {},
16509
16569
  ContextAdditions = {}
@@ -16517,7 +16577,8 @@ declare interface LoaderDefinitionFunction<
16517
16577
  > {
16518
16578
  (
16519
16579
  this: NormalModuleLoaderContext<OptionsType> &
16520
- LoaderRunnerLoaderContext<OptionsType> &
16580
+ LoaderRunnerMutableContext<OptionsType> &
16581
+ LoaderRunnerReadonlyContext<OptionsType> &
16521
16582
  LoaderPluginLoaderContext &
16522
16583
  HotModuleReplacementPluginLoaderContext &
16523
16584
  ContextAdditions,
@@ -16526,6 +16587,21 @@ declare interface LoaderDefinitionFunction<
16526
16587
  additionalData?: AdditionalData
16527
16588
  ): string | void | Buffer | Promise<string | Buffer>;
16528
16589
  }
16590
+ declare interface LoaderEntry {
16591
+ request: string;
16592
+ path: string;
16593
+ query: string;
16594
+ fragment: string;
16595
+ options?: string | object;
16596
+ ident: string;
16597
+ normal?: Function;
16598
+ pitch?: Function;
16599
+ raw?: boolean;
16600
+ data?: object;
16601
+ pitchExecuted: boolean;
16602
+ normalExecuted: boolean;
16603
+ type?: "module" | "commonjs";
16604
+ }
16529
16605
  declare interface LoaderItem {
16530
16606
  loader: string;
16531
16607
  options?: null | string | Record<string, any>;
@@ -16575,10 +16651,6 @@ declare interface LoaderOptionsPluginOptions {
16575
16651
  context?: string;
16576
16652
  };
16577
16653
  }
16578
-
16579
- /**
16580
- * These properties are added by the LoaderPlugin
16581
- */
16582
16654
  declare interface LoaderPluginLoaderContext {
16583
16655
  /**
16584
16656
  * Resolves the given request to a module, applies all configured loaders and calls
@@ -16586,7 +16658,7 @@ declare interface LoaderPluginLoaderContext {
16586
16658
  * instance of NormalModule). Use this function if you need to know the source code
16587
16659
  * of another module to generate the result.
16588
16660
  */
16589
- loadModule(
16661
+ loadModule: (
16590
16662
  request: string,
16591
16663
  callback: (
16592
16664
  err: null | Error,
@@ -16594,36 +16666,27 @@ declare interface LoaderPluginLoaderContext {
16594
16666
  sourceMap?: null | object,
16595
16667
  module?: Module
16596
16668
  ) => void
16597
- ): void;
16598
- importModule(
16599
- request: string,
16600
- options: undefined | ImportModuleOptions,
16601
- callback: (err?: null | Error, exports?: any) => void
16602
- ): void;
16603
- importModule(request: string, options?: ImportModuleOptions): Promise<any>;
16669
+ ) => void;
16670
+ importModule: ImportModuleMethod;
16604
16671
  }
16605
-
16606
- /**
16607
- * The properties are added by https://github.com/webpack/loader-runner
16608
- */
16609
- declare interface LoaderRunnerLoaderContext<OptionsType> {
16672
+ declare interface LoaderRunnerMutableContext<OptionsType> {
16610
16673
  /**
16611
16674
  * Add a directory as dependency of the loader result.
16612
16675
  */
16613
- addContextDependency(context: string): void;
16676
+ addContextDependency: (context: string) => void;
16614
16677
 
16615
16678
  /**
16616
16679
  * Adds a file as dependency of the loader result in order to make them watchable.
16617
16680
  * For example, html-loader uses this technique as it finds src and src-set attributes.
16618
16681
  * Then, it sets the url's for those attributes as dependencies of the html file that is parsed.
16619
16682
  */
16620
- addDependency(file: string): void;
16621
- addMissingDependency(context: string): void;
16683
+ addDependency: (file: string) => void;
16684
+ addMissingDependency: (context: string) => void;
16622
16685
 
16623
16686
  /**
16624
16687
  * Make this loader async.
16625
16688
  */
16626
- async(): (
16689
+ async: () => (
16627
16690
  err?: null | Error,
16628
16691
  content?: string | Buffer,
16629
16692
  sourceMap?: null | string | RawSourceMap,
@@ -16636,7 +16699,7 @@ declare interface LoaderRunnerLoaderContext<OptionsType> {
16636
16699
  * This means the loader shouldn't have other dependencies than specified with this.addDependency.
16637
16700
  * Most loaders are deterministic and cacheable.
16638
16701
  */
16639
- cacheable(flag?: boolean): void;
16702
+ cacheable: (flag?: boolean) => void;
16640
16703
  callback: (
16641
16704
  err?: null | Error,
16642
16705
  content?: string | Buffer,
@@ -16647,15 +16710,13 @@ declare interface LoaderRunnerLoaderContext<OptionsType> {
16647
16710
  /**
16648
16711
  * Remove all dependencies of the loader result. Even initial dependencies and these of other loaders.
16649
16712
  */
16650
- clearDependencies(): void;
16713
+ clearDependencies: () => void;
16651
16714
 
16652
16715
  /**
16653
16716
  * The directory of the module. Can be used as context for resolving other stuff.
16654
16717
  * eg '/workspaces/ts-loader/examples/vanilla/src'
16655
16718
  */
16656
16719
  context: string;
16657
- readonly currentRequest: string;
16658
- readonly data: any;
16659
16720
 
16660
16721
  /**
16661
16722
  * alias of addDependency
@@ -16663,53 +16724,22 @@ declare interface LoaderRunnerLoaderContext<OptionsType> {
16663
16724
  * For example, html-loader uses this technique as it finds src and src-set attributes.
16664
16725
  * Then, it sets the url's for those attributes as dependencies of the html file that is parsed.
16665
16726
  */
16666
- dependency(file: string): void;
16667
- getContextDependencies(): string[];
16668
- getDependencies(): string[];
16669
- getMissingDependencies(): string[];
16727
+ dependency: (file: string) => void;
16728
+ getContextDependencies: () => string[];
16729
+ getDependencies: () => string[];
16730
+ getMissingDependencies: () => string[];
16670
16731
 
16671
16732
  /**
16672
16733
  * The index in the loaders array of the current loader.
16673
16734
  * In the example: in loader1: 0, in loader2: 1
16674
16735
  */
16675
16736
  loaderIndex: number;
16676
- readonly previousRequest: string;
16677
- readonly query: string | OptionsType;
16678
- readonly remainingRequest: string;
16679
- readonly request: string;
16680
16737
 
16681
16738
  /**
16682
16739
  * An array of all the loaders. It is writeable in the pitch phase.
16683
16740
  * loaders = [{request: string, path: string, query: string, module: function}]
16684
- * In the example:
16685
- * [
16686
- * { request: "/abc/loader1.js?xyz",
16687
- * path: "/abc/loader1.js",
16688
- * query: "?xyz",
16689
- * module: [Function]
16690
- * },
16691
- * { request: "/abc/node_modules/loader2/index.js",
16692
- * path: "/abc/node_modules/loader2/index.js",
16693
- * query: "",
16694
- * module: [Function]
16695
- * }
16696
- * ]
16697
- */
16698
- loaders: {
16699
- request: string;
16700
- path: string;
16701
- query: string;
16702
- fragment: string;
16703
- options?: string | object;
16704
- ident: string;
16705
- normal?: Function;
16706
- pitch?: Function;
16707
- raw?: boolean;
16708
- data?: object;
16709
- pitchExecuted: boolean;
16710
- normalExecuted: boolean;
16711
- type?: "module" | "commonjs";
16712
- }[];
16741
+ */
16742
+ loaders: LoaderEntry[];
16713
16743
 
16714
16744
  /**
16715
16745
  * The resource path.
@@ -16747,6 +16777,14 @@ declare interface LoaderRunnerLoaderContext<OptionsType> {
16747
16777
  */
16748
16778
  environment: Environment;
16749
16779
  }
16780
+ declare interface LoaderRunnerReadonlyContext<OptionsType> {
16781
+ readonly currentRequest: string;
16782
+ readonly data: any;
16783
+ readonly previousRequest: string;
16784
+ readonly query: string | OptionsType;
16785
+ readonly remainingRequest: string;
16786
+ readonly request: string;
16787
+ }
16750
16788
  declare class LoaderTargetPlugin {
16751
16789
  /**
16752
16790
  * Creates an instance of LoaderTargetPlugin.
@@ -19387,7 +19425,12 @@ declare class NormalModule extends Module {
19387
19425
  sourceMap?: null | string | RawSourceMap,
19388
19426
  associatedObjectForCache?: object
19389
19427
  ): Source;
19390
- markModuleAsErrored(error: Error): void;
19428
+
19429
+ /**
19430
+ * Marks the module as failed, so what it generates says so. A tap or a
19431
+ * loader may fail with anything, and what reads the failure expects an error.
19432
+ */
19433
+ markModuleAsErrored(error?: any): void;
19391
19434
  applyNoParseRule(
19392
19435
  rule: string | RegExp | ((content: string) => boolean),
19393
19436
  content: string
@@ -20010,62 +20053,38 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
20010
20053
  resolveOptions?: ResolveOptionsWithDependencyType
20011
20054
  ): ResolverWithOptions;
20012
20055
  }
20013
-
20014
- /**
20015
- * These properties are added by the NormalModule
20016
- */
20017
20056
  declare interface NormalModuleLoaderContext<OptionsType> {
20018
20057
  version: number;
20019
20058
 
20020
20059
  /**
20021
20060
  * Extracts and parses the options of the current loader.
20022
20061
  * Parses string options as JSON or a query string.
20023
- * Extracts and parses the options of the current loader.
20024
- * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
20025
- */
20026
-
20027
- /**
20028
- * Extracts and parses the options of the current loader.
20029
- * Parses string options as JSON or a query string.
20030
- */
20031
- getOptions(): OptionsType;
20032
-
20033
- /**
20034
- * Extracts and parses the options of the current loader.
20035
- * Parses string options as JSON or a query string.
20036
- * Extracts and parses the options of the current loader.
20037
- * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
20038
20062
  */
20039
-
20040
- /**
20041
- * Extracts and parses the options of the current loader.
20042
- * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
20043
- */
20044
- getOptions(schema: Parameters<typeof validateFunction>[0]): OptionsType;
20063
+ getOptions: GetOptionsMethod<OptionsType>;
20045
20064
 
20046
20065
  /**
20047
20066
  * Emits a warning for this module.
20048
20067
  * The warning will be displayed to the user during compilation.
20049
20068
  */
20050
- emitWarning(warning: string | Error): void;
20069
+ emitWarning: (warning: string | Error) => void;
20051
20070
 
20052
20071
  /**
20053
20072
  * Emits an error for this module.
20054
20073
  * The error will be displayed to the user and typically causes the compilation to fail.
20055
20074
  */
20056
- emitError(error: string | Error): void;
20075
+ emitError: (error: string | Error) => void;
20057
20076
 
20058
20077
  /**
20059
20078
  * Gets a logger instance scoped to this loader and module.
20060
20079
  * Useful for emitting debug or compilation information in a structured way.
20061
20080
  */
20062
- getLogger(name?: string): WebpackLogger;
20081
+ getLogger: (name?: string) => WebpackLogger;
20063
20082
 
20064
20083
  /**
20065
20084
  * Resolves a module request (e.g., a relative path or module name) to an absolute file path.
20066
20085
  * It uses Webpack's internal resolver, taking into account configured aliases and extensions.
20067
20086
  */
20068
- resolve(
20087
+ resolve: (
20069
20088
  context: string,
20070
20089
  request: string,
20071
20090
  callback: (
@@ -20073,41 +20092,26 @@ declare interface NormalModuleLoaderContext<OptionsType> {
20073
20092
  res?: string | false,
20074
20093
  req?: ResolveRequest
20075
20094
  ) => void
20076
- ): void;
20095
+ ) => void;
20077
20096
 
20078
20097
  /**
20079
20098
  * Creates a resolve function with specific options.
20080
20099
  * The returned function can be used as a Promise-based resolver or a callback-based resolver.
20081
20100
  */
20082
- getResolve(options?: ResolveOptionsWithDependencyType): {
20083
- (
20084
- context: string,
20085
- request: string,
20086
- callback: (
20087
- err: null | ErrorWithDetail,
20088
- res?: string | false,
20089
- req?: ResolveRequest
20090
- ) => void
20091
- ): void;
20092
- (context: string, request: string): Promise<string>;
20093
- };
20101
+ getResolve: (options?: ResolveOptionsWithDependencyType) => DualModeResolve;
20094
20102
 
20095
20103
  /**
20096
20104
  * Emits a new file (asset) to the compilation output directory.
20097
20105
  * This allows loaders to generate additional files alongside the main module output.
20098
20106
  */
20099
- emitFile(
20107
+ emitFile: (
20100
20108
  name: string,
20101
20109
  content: string | Buffer,
20102
20110
  sourceMap?: string,
20103
20111
  assetInfo?: AssetInfo
20104
- ): void;
20105
- addBuildDependency(dep: string): void;
20106
- utils: {
20107
- absolutify: (context: string, request: string) => string;
20108
- contextify: (context: string, request: string) => string;
20109
- createHash: (algorithm?: string | typeof Hash) => Hash;
20110
- };
20112
+ ) => void;
20113
+ addBuildDependency: (dep: string) => void;
20114
+ utils: LoaderContextUtils;
20111
20115
  rootContext: string;
20112
20116
  fs: InputFileSystem;
20113
20117
  sourceMap?: boolean;
@@ -23068,7 +23072,8 @@ declare interface PitchLoaderDefinitionFunction<
23068
23072
  > {
23069
23073
  (
23070
23074
  this: NormalModuleLoaderContext<OptionsType> &
23071
- LoaderRunnerLoaderContext<OptionsType> &
23075
+ LoaderRunnerMutableContext<OptionsType> &
23076
+ LoaderRunnerReadonlyContext<OptionsType> &
23072
23077
  LoaderPluginLoaderContext &
23073
23078
  HotModuleReplacementPluginLoaderContext &
23074
23079
  ContextAdditions,
@@ -23737,7 +23742,8 @@ declare interface RawLoaderDefinitionFunction<
23737
23742
  > {
23738
23743
  (
23739
23744
  this: NormalModuleLoaderContext<OptionsType> &
23740
- LoaderRunnerLoaderContext<OptionsType> &
23745
+ LoaderRunnerMutableContext<OptionsType> &
23746
+ LoaderRunnerReadonlyContext<OptionsType> &
23741
23747
  LoaderPluginLoaderContext &
23742
23748
  HotModuleReplacementPluginLoaderContext &
23743
23749
  ContextAdditions,
@@ -27283,6 +27289,7 @@ declare abstract class ScopeParser {
27283
27289
  lexical?: Set<string>;
27284
27290
  functions?: Set<string>;
27285
27291
  firstLexical?: string;
27292
+ hoisted?: (number | NodeLike)[];
27286
27293
  }
27287
27294
 
27288
27295
  /**
@@ -29733,6 +29740,16 @@ declare class TokenStream {
29733
29740
  */
29734
29741
  skipWhitespace(): void;
29735
29742
 
29743
+ /**
29744
+ * Step over the run of selector-prelude leaves a skip-mode parse drops (CSS
29745
+ * Syntax §5.4.3's "append to prelude", which skip mode does not do), without
29746
+ * lexing one token each. Only valid where every leaf up to the next
29747
+ * `BC_PRELUDE_STOP` code point is dropped whatever it is — which in
29748
+ * `consumeAQualifiedRule` is once the two tokens the `--foo: {`
29749
+ * disambiguation reads have both been seen. No-op while a token is cached.
29750
+ */
29751
+ skipPreludeLeaves(): void;
29752
+
29736
29753
  /**
29737
29754
  * Mark (CSS Syntax §3 "mark") — push the current cursor position.
29738
29755
  */
@@ -30040,7 +30057,7 @@ declare interface VirtualModule {
30040
30057
  * The source function that provides the virtual content.
30041
30058
  */
30042
30059
  source: (
30043
- loaderContext: LoaderContext<any>
30060
+ loaderContext: LoaderContextNormalModule<any>
30044
30061
  ) => string | Buffer | Promise<string | Buffer>;
30045
30062
 
30046
30063
  /**
@@ -30056,7 +30073,7 @@ declare interface VirtualModule {
30056
30073
  type VirtualModuleContent =
30057
30074
  | string
30058
30075
  | ((
30059
- loaderContext: LoaderContext<any>
30076
+ loaderContext: LoaderContextNormalModule<any>
30060
30077
  ) => string | Buffer | Promise<string | Buffer>)
30061
30078
  | VirtualModule;
30062
30079
  declare interface VirtualModules {
@@ -30962,6 +30979,8 @@ type WriteFileOptions =
30962
30979
  declare interface WriteOnlySet<T> {
30963
30980
  add: (item: T) => void;
30964
30981
  }
30982
+ type WriteStatement =
30983
+ AssignmentExpression | UpdateExpression | ForInStatement | ForOfStatement;
30965
30984
  type WriteStreamOptions = StreamOptions & {
30966
30985
  fs?: null | CreateWriteStreamFSImplementation;
30967
30986
  flush?: boolean;
@@ -32498,7 +32517,7 @@ declare namespace exports {
32498
32517
  LoaderDefinitionFunction,
32499
32518
  PitchLoaderDefinitionFunction,
32500
32519
  RawLoaderDefinitionFunction,
32501
- LoaderContext
32520
+ LoaderContextLibIndex as LoaderContext
32502
32521
  };
32503
32522
  }
32504
32523
  declare const topLevelSymbolTag: unique symbol;