webpack 5.69.0 → 5.71.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 (73) hide show
  1. package/hot/poll.js +1 -1
  2. package/hot/signal.js +1 -1
  3. package/lib/BannerPlugin.js +10 -4
  4. package/lib/Chunk.js +1 -1
  5. package/lib/ChunkGroup.js +1 -1
  6. package/lib/CleanPlugin.js +64 -18
  7. package/lib/Compilation.js +51 -25
  8. package/lib/Compiler.js +16 -3
  9. package/lib/ConstPlugin.js +2 -2
  10. package/lib/ContextModule.js +54 -22
  11. package/lib/ContextModuleFactory.js +13 -12
  12. package/lib/DelegatedModuleFactoryPlugin.js +1 -1
  13. package/lib/Dependency.js +7 -0
  14. package/lib/EntryOptionPlugin.js +1 -0
  15. package/lib/ErrorHelpers.js +2 -2
  16. package/lib/ExternalModuleFactoryPlugin.js +4 -4
  17. package/lib/FileSystemInfo.js +8 -0
  18. package/lib/Generator.js +1 -0
  19. package/lib/LoaderOptionsPlugin.js +1 -1
  20. package/lib/Module.js +2 -0
  21. package/lib/ModuleFilenameHelpers.js +3 -3
  22. package/lib/ModuleHashingError.js +29 -0
  23. package/lib/NodeStuffPlugin.js +10 -0
  24. package/lib/NormalModule.js +23 -18
  25. package/lib/NormalModuleFactory.js +17 -10
  26. package/lib/ProgressPlugin.js +3 -4
  27. package/lib/RuntimePlugin.js +18 -0
  28. package/lib/RuntimeTemplate.js +1 -0
  29. package/lib/WebpackOptionsApply.js +2 -0
  30. package/lib/asset/AssetGenerator.js +119 -31
  31. package/lib/cache/ResolverCachePlugin.js +15 -6
  32. package/lib/config/browserslistTargetHandler.js +3 -5
  33. package/lib/config/defaults.js +9 -1
  34. package/lib/config/normalization.js +1 -0
  35. package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -2
  36. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  37. package/lib/dependencies/ContextElementDependency.js +33 -1
  38. package/lib/dependencies/HarmonyAcceptImportDependency.js +5 -3
  39. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +95 -0
  40. package/lib/dependencies/HarmonyExportInitFragment.js +4 -1
  41. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +127 -43
  42. package/lib/dependencies/HarmonyImportSpecifierDependency.js +22 -8
  43. package/lib/dependencies/HarmonyModulesPlugin.js +10 -0
  44. package/lib/dependencies/ImportContextDependency.js +0 -2
  45. package/lib/dependencies/ImportMetaContextDependency.js +35 -0
  46. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +252 -0
  47. package/lib/dependencies/ImportMetaContextPlugin.js +59 -0
  48. package/lib/dependencies/LoaderPlugin.js +2 -0
  49. package/lib/dependencies/RequireContextDependency.js +0 -16
  50. package/lib/esm/ModuleChunkLoadingPlugin.js +3 -1
  51. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +24 -8
  52. package/lib/hmr/HotModuleReplacement.runtime.js +29 -14
  53. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +4 -3
  54. package/lib/ids/HashedModuleIdsPlugin.js +2 -2
  55. package/lib/ids/IdHelpers.js +1 -1
  56. package/lib/javascript/BasicEvaluatedExpression.js +5 -2
  57. package/lib/javascript/JavascriptParser.js +66 -40
  58. package/lib/library/UmdLibraryPlugin.js +5 -3
  59. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +22 -7
  60. package/lib/node/RequireChunkLoadingRuntimeModule.js +22 -7
  61. package/lib/runtime/BaseUriRuntimeModule.js +31 -0
  62. package/lib/schemes/HttpUriPlugin.js +44 -3
  63. package/lib/stats/DefaultStatsFactoryPlugin.js +1 -1
  64. package/lib/util/internalSerializables.js +4 -0
  65. package/lib/web/JsonpChunkLoadingRuntimeModule.js +17 -6
  66. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +30 -20
  67. package/module.d.ts +15 -0
  68. package/package.json +2 -2
  69. package/schemas/WebpackOptions.check.js +1 -1
  70. package/schemas/WebpackOptions.json +17 -1
  71. package/schemas/plugins/schemes/HttpUriPlugin.check.js +1 -1
  72. package/schemas/plugins/schemes/HttpUriPlugin.json +4 -0
  73. package/types.d.ts +179 -83
@@ -70,7 +70,7 @@
70
70
  ]
71
71
  },
72
72
  "AssetGeneratorDataUrlFunction": {
73
- "description": "Function that executes for module and should return an DataUrl string.",
73
+ "description": "Function that executes for module and should return an DataUrl string. It can have a string as 'ident' property which contributes to the module hash.",
74
74
  "instanceof": "Function",
75
75
  "tsType": "((source: string | Buffer, context: { filename: string, module: import('../lib/Module') }) => string)"
76
76
  },
@@ -496,6 +496,10 @@
496
496
  "description": "Enable/disable creating async chunks that are loaded on demand.",
497
497
  "type": "boolean"
498
498
  },
499
+ "baseUri": {
500
+ "description": "Base uri for this entry.",
501
+ "type": "string"
502
+ },
499
503
  "chunkLoading": {
500
504
  "$ref": "#/definitions/ChunkLoading"
501
505
  },
@@ -553,6 +557,10 @@
553
557
  "description": "Enable/disable creating async chunks that are loaded on demand.",
554
558
  "type": "boolean"
555
559
  },
560
+ "baseUri": {
561
+ "description": "Base uri for this entry.",
562
+ "type": "string"
563
+ },
556
564
  "chunkLoading": {
557
565
  "$ref": "#/definitions/ChunkLoading"
558
566
  },
@@ -1417,6 +1425,10 @@
1417
1425
  "type": "string",
1418
1426
  "absolutePath": true
1419
1427
  },
1428
+ "proxy": {
1429
+ "description": "Proxy configuration, which can be used to specify a proxy server to use for HTTP requests.",
1430
+ "type": "string"
1431
+ },
1420
1432
  "upgrade": {
1421
1433
  "description": "When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.",
1422
1434
  "type": "boolean"
@@ -1612,6 +1624,10 @@
1612
1624
  "description": "Enable/disable evaluating import.meta.",
1613
1625
  "type": "boolean"
1614
1626
  },
1627
+ "importMetaContext": {
1628
+ "description": "Enable/disable evaluating import.meta.webpackContext.",
1629
+ "type": "boolean"
1630
+ },
1615
1631
  "node": {
1616
1632
  "$ref": "#/definitions/Node"
1617
1633
  },
@@ -3,4 +3,4 @@
3
3
  * DO NOT MODIFY BY HAND.
4
4
  * Run `yarn special-lint-fix` to update
5
5
  */
6
- const r=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;module.exports=n,module.exports.default=n;const t=new RegExp("^https?://","u");function e(n,{instancePath:o="",parentData:s,parentDataProperty:a,rootData:l=n}={}){let i=null,p=0;if(0===p){if(!n||"object"!=typeof n||Array.isArray(n))return e.errors=[{params:{type:"object"}}],!1;{let o;if(void 0===n.allowedUris&&(o="allowedUris"))return e.errors=[{params:{missingProperty:o}}],!1;{const o=p;for(const r in n)if("allowedUris"!==r&&"cacheLocation"!==r&&"frozen"!==r&&"lockfileLocation"!==r&&"upgrade"!==r)return e.errors=[{params:{additionalProperty:r}}],!1;if(o===p){if(void 0!==n.allowedUris){let r=n.allowedUris;const o=p;if(p==p){if(!Array.isArray(r))return e.errors=[{params:{type:"array"}}],!1;{const n=r.length;for(let o=0;o<n;o++){let n=r[o];const s=p,a=p;let l=!1;const f=p;if(!(n instanceof RegExp)){const r={params:{}};null===i?i=[r]:i.push(r),p++}var c=f===p;if(l=l||c,!l){const r=p;if(p===r)if("string"==typeof n){if(!t.test(n)){const r={params:{pattern:"^https?://"}};null===i?i=[r]:i.push(r),p++}}else{const r={params:{type:"string"}};null===i?i=[r]:i.push(r),p++}if(c=r===p,l=l||c,!l){const r=p;if(!(n instanceof Function)){const r={params:{}};null===i?i=[r]:i.push(r),p++}c=r===p,l=l||c}}if(!l){const r={params:{}};return null===i?i=[r]:i.push(r),p++,e.errors=i,!1}if(p=a,null!==i&&(a?i.length=a:i=null),s!==p)break}}}var f=o===p}else f=!0;if(f){if(void 0!==n.cacheLocation){let t=n.cacheLocation;const o=p,s=p;let a=!1;const l=p;if(!1!==t){const r={params:{}};null===i?i=[r]:i.push(r),p++}var u=l===p;if(a=a||u,!a){const e=p;if(p===e)if("string"==typeof t){if(t.includes("!")||!0!==r.test(t)){const r={params:{}};null===i?i=[r]:i.push(r),p++}}else{const r={params:{type:"string"}};null===i?i=[r]:i.push(r),p++}u=e===p,a=a||u}if(!a){const r={params:{}};return null===i?i=[r]:i.push(r),p++,e.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),f=o===p}else f=!0;if(f){if(void 0!==n.frozen){const r=p;if("boolean"!=typeof n.frozen)return e.errors=[{params:{type:"boolean"}}],!1;f=r===p}else f=!0;if(f){if(void 0!==n.lockfileLocation){let t=n.lockfileLocation;const o=p;if(p===o){if("string"!=typeof t)return e.errors=[{params:{type:"string"}}],!1;if(t.includes("!")||!0!==r.test(t))return e.errors=[{params:{}}],!1}f=o===p}else f=!0;if(f)if(void 0!==n.upgrade){const r=p;if("boolean"!=typeof n.upgrade)return e.errors=[{params:{type:"boolean"}}],!1;f=r===p}else f=!0}}}}}}}return e.errors=i,0===p}function n(r,{instancePath:t="",parentData:o,parentDataProperty:s,rootData:a=r}={}){let l=null,i=0;const p=i;let c=!1,f=null;const u=i;if(e(r,{instancePath:t,parentData:o,parentDataProperty:s,rootData:a})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),u===i&&(c=!0,f=0),!c){const r={params:{passingSchemas:f}};return null===l?l=[r]:l.push(r),i++,n.errors=l,!1}return i=p,null!==l&&(p?l.length=p:l=null),n.errors=l,0===i}
6
+ const r=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;module.exports=n,module.exports.default=n;const t=new RegExp("^https?://","u");function e(n,{instancePath:o="",parentData:s,parentDataProperty:a,rootData:l=n}={}){let i=null,p=0;if(0===p){if(!n||"object"!=typeof n||Array.isArray(n))return e.errors=[{params:{type:"object"}}],!1;{let o;if(void 0===n.allowedUris&&(o="allowedUris"))return e.errors=[{params:{missingProperty:o}}],!1;{const o=p;for(const r in n)if("allowedUris"!==r&&"cacheLocation"!==r&&"frozen"!==r&&"lockfileLocation"!==r&&"proxy"!==r&&"upgrade"!==r)return e.errors=[{params:{additionalProperty:r}}],!1;if(o===p){if(void 0!==n.allowedUris){let r=n.allowedUris;const o=p;if(p==p){if(!Array.isArray(r))return e.errors=[{params:{type:"array"}}],!1;{const n=r.length;for(let o=0;o<n;o++){let n=r[o];const s=p,a=p;let l=!1;const c=p;if(!(n instanceof RegExp)){const r={params:{}};null===i?i=[r]:i.push(r),p++}var f=c===p;if(l=l||f,!l){const r=p;if(p===r)if("string"==typeof n){if(!t.test(n)){const r={params:{pattern:"^https?://"}};null===i?i=[r]:i.push(r),p++}}else{const r={params:{type:"string"}};null===i?i=[r]:i.push(r),p++}if(f=r===p,l=l||f,!l){const r=p;if(!(n instanceof Function)){const r={params:{}};null===i?i=[r]:i.push(r),p++}f=r===p,l=l||f}}if(!l){const r={params:{}};return null===i?i=[r]:i.push(r),p++,e.errors=i,!1}if(p=a,null!==i&&(a?i.length=a:i=null),s!==p)break}}}var c=o===p}else c=!0;if(c){if(void 0!==n.cacheLocation){let t=n.cacheLocation;const o=p,s=p;let a=!1;const l=p;if(!1!==t){const r={params:{}};null===i?i=[r]:i.push(r),p++}var u=l===p;if(a=a||u,!a){const e=p;if(p===e)if("string"==typeof t){if(t.includes("!")||!0!==r.test(t)){const r={params:{}};null===i?i=[r]:i.push(r),p++}}else{const r={params:{type:"string"}};null===i?i=[r]:i.push(r),p++}u=e===p,a=a||u}if(!a){const r={params:{}};return null===i?i=[r]:i.push(r),p++,e.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),c=o===p}else c=!0;if(c){if(void 0!==n.frozen){const r=p;if("boolean"!=typeof n.frozen)return e.errors=[{params:{type:"boolean"}}],!1;c=r===p}else c=!0;if(c){if(void 0!==n.lockfileLocation){let t=n.lockfileLocation;const o=p;if(p===o){if("string"!=typeof t)return e.errors=[{params:{type:"string"}}],!1;if(t.includes("!")||!0!==r.test(t))return e.errors=[{params:{}}],!1}c=o===p}else c=!0;if(c){if(void 0!==n.proxy){const r=p;if("string"!=typeof n.proxy)return e.errors=[{params:{type:"string"}}],!1;c=r===p}else c=!0;if(c)if(void 0!==n.upgrade){const r=p;if("boolean"!=typeof n.upgrade)return e.errors=[{params:{type:"boolean"}}],!1;c=r===p}else c=!0}}}}}}}}return e.errors=i,0===p}function n(r,{instancePath:t="",parentData:o,parentDataProperty:s,rootData:a=r}={}){let l=null,i=0;const p=i;let f=!1,c=null;const u=i;if(e(r,{instancePath:t,parentData:o,parentDataProperty:s,rootData:a})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),u===i&&(f=!0,c=0),!f){const r={params:{passingSchemas:c}};return null===l?l=[r]:l.push(r),i++,n.errors=l,!1}return i=p,null!==l&&(p?l.length=p:l=null),n.errors=l,0===i}
@@ -29,6 +29,10 @@
29
29
  "type": "string",
30
30
  "absolutePath": true
31
31
  },
32
+ "proxy": {
33
+ "description": "Proxy configuration, which can be used to specify a proxy server to use for HTTP requests.",
34
+ "type": "string"
35
+ },
32
36
  "upgrade": {
33
37
  "description": "When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.",
34
38
  "type": "boolean"
package/types.d.ts CHANGED
@@ -474,9 +474,10 @@ declare abstract class BasicEvaluatedExpression {
474
474
  prefix?: BasicEvaluatedExpression;
475
475
  postfix?: BasicEvaluatedExpression;
476
476
  wrappedInnerExpressions: any;
477
- identifier?: string;
477
+ identifier?: string | VariableInfoInterface;
478
478
  rootInfo: VariableInfoInterface;
479
479
  getMembers: () => string[];
480
+ getMembersOptionals: () => boolean[];
480
481
  expression: NodeEstreeIndex;
481
482
  isUnknown(): boolean;
482
483
  isNull(): boolean;
@@ -528,7 +529,8 @@ declare abstract class BasicEvaluatedExpression {
528
529
  setIdentifier(
529
530
  identifier?: any,
530
531
  rootInfo?: any,
531
- getMembers?: any
532
+ getMembers?: any,
533
+ getMembersOptionals?: any
532
534
  ): BasicEvaluatedExpression;
533
535
  setWrapped(
534
536
  prefix?: any,
@@ -681,6 +683,7 @@ declare interface CallExpressionInfo {
681
683
  getCalleeMembers: () => string[];
682
684
  name: string;
683
685
  getMembers: () => string[];
686
+ getMembersOptionals: () => boolean[];
684
687
  }
685
688
  declare interface CallbackAsyncQueue<T> {
686
689
  (err?: null | WebpackError, result?: T): any;
@@ -1239,6 +1242,11 @@ declare interface CodeGenerationContext {
1239
1242
  * code generation results of other modules (need to have a codeGenerationDependency to use that)
1240
1243
  */
1241
1244
  codeGenerationResults: CodeGenerationResults;
1245
+
1246
+ /**
1247
+ * the compilation
1248
+ */
1249
+ compilation?: Compilation;
1242
1250
  }
1243
1251
  declare interface CodeGenerationResult {
1244
1252
  /**
@@ -2454,7 +2462,7 @@ declare interface ContainerReferencePluginOptions {
2454
2462
  shareScope?: string;
2455
2463
  }
2456
2464
  declare abstract class ContextElementDependency extends ModuleDependency {
2457
- referencedExports: any;
2465
+ referencedExports?: string[][];
2458
2466
  }
2459
2467
  declare class ContextExclusionPlugin {
2460
2468
  constructor(negativeMatcher: RegExp);
@@ -2526,7 +2534,7 @@ declare interface ContextModuleOptions {
2526
2534
  * exports referenced from modules (won't be mangled)
2527
2535
  */
2528
2536
  referencedExports?: string[][];
2529
- resource: string | string[];
2537
+ resource: string | false | string[];
2530
2538
  resourceQuery?: string;
2531
2539
  resourceFragment?: string;
2532
2540
  resolveOptions: any;
@@ -2637,6 +2645,7 @@ declare class Dependency {
2637
2645
  endLine?: any,
2638
2646
  endColumn?: any
2639
2647
  ): void;
2648
+ getContext(): undefined | string;
2640
2649
  getResourceIdentifier(): null | string;
2641
2650
  couldAffectReferencingModule(): boolean | typeof TRANSITIVE;
2642
2651
 
@@ -3139,6 +3148,11 @@ declare interface EntryDescription {
3139
3148
  */
3140
3149
  asyncChunks?: boolean;
3141
3150
 
3151
+ /**
3152
+ * Base uri for this entry.
3153
+ */
3154
+ baseUri?: string;
3155
+
3142
3156
  /**
3143
3157
  * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
3144
3158
  */
@@ -3194,6 +3208,11 @@ declare interface EntryDescriptionNormalized {
3194
3208
  */
3195
3209
  asyncChunks?: boolean;
3196
3210
 
3211
+ /**
3212
+ * Base uri for this entry.
3213
+ */
3214
+ baseUri?: string;
3215
+
3197
3216
  /**
3198
3217
  * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
3199
3218
  */
@@ -3809,6 +3828,7 @@ declare interface ExpressionExpressionInfo {
3809
3828
  rootInfo: string | VariableInfo;
3810
3829
  name: string;
3811
3830
  getMembers: () => string[];
3831
+ getMembersOptionals: () => boolean[];
3812
3832
  }
3813
3833
  type ExternalItem =
3814
3834
  | string
@@ -4553,6 +4573,11 @@ declare interface HttpUriOptions {
4553
4573
  */
4554
4574
  lockfileLocation?: string;
4555
4575
 
4576
+ /**
4577
+ * Proxy configuration, which can be used to specify a proxy server to use for HTTP requests.
4578
+ */
4579
+ proxy?: string;
4580
+
4556
4581
  /**
4557
4582
  * When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
4558
4583
  */
@@ -4645,6 +4670,11 @@ declare interface ImportModuleOptions {
4645
4670
  * the target public path
4646
4671
  */
4647
4672
  publicPath?: string;
4673
+
4674
+ /**
4675
+ * target base uri
4676
+ */
4677
+ baseUri?: string;
4648
4678
  }
4649
4679
  type ImportSource =
4650
4680
  | undefined
@@ -5077,7 +5107,7 @@ declare class JavascriptParser extends Parser {
5077
5107
  topLevelAwait: SyncBailHook<[Expression], boolean | void>;
5078
5108
  call: HookMap<SyncBailHook<[Expression], boolean | void>>;
5079
5109
  callMemberChain: HookMap<
5080
- SyncBailHook<[CallExpression, string[]], boolean | void>
5110
+ SyncBailHook<[CallExpression, string[], boolean[]], boolean | void>
5081
5111
  >;
5082
5112
  memberChainOfCallMemberChain: HookMap<
5083
5113
  SyncBailHook<
@@ -5093,9 +5123,10 @@ declare class JavascriptParser extends Parser {
5093
5123
  >;
5094
5124
  optionalChaining: SyncBailHook<[ChainExpression], boolean | void>;
5095
5125
  new: HookMap<SyncBailHook<[NewExpression], boolean | void>>;
5126
+ binaryExpression: SyncBailHook<[BinaryExpression], boolean | void>;
5096
5127
  expression: HookMap<SyncBailHook<[Expression], boolean | void>>;
5097
5128
  expressionMemberChain: HookMap<
5098
- SyncBailHook<[Expression, string[]], boolean | void>
5129
+ SyncBailHook<[Expression, string[], boolean[]], boolean | void>
5099
5130
  >;
5100
5131
  unhandledExpressionMemberChain: HookMap<
5101
5132
  SyncBailHook<[Expression, string[]], boolean | void>
@@ -5163,7 +5194,7 @@ declare class JavascriptParser extends Parser {
5163
5194
  )[];
5164
5195
  prevStatement: any;
5165
5196
  currentTagData: any;
5166
- getRenameIdentifier(expr?: any): undefined | string;
5197
+ getRenameIdentifier(expr?: any): undefined | string | VariableInfoInterface;
5167
5198
  walkClass(classy: ClassExpression | ClassDeclaration): void;
5168
5199
  preWalkStatements(statements?: any): void;
5169
5200
  blockPreWalkStatements(statements?: any): void;
@@ -5310,12 +5341,10 @@ declare class JavascriptParser extends Parser {
5310
5341
  enterArrayPattern(pattern?: any, onIdent?: any): void;
5311
5342
  enterRestElement(pattern?: any, onIdent?: any): void;
5312
5343
  enterAssignmentPattern(pattern?: any, onIdent?: any): void;
5313
- evaluateExpression(
5314
- expression: Expression
5315
- ): undefined | BasicEvaluatedExpression;
5344
+ evaluateExpression(expression: Expression): BasicEvaluatedExpression;
5316
5345
  parseString(expression?: any): any;
5317
5346
  parseCalculatedString(expression?: any): any;
5318
- evaluate(source?: any): undefined | BasicEvaluatedExpression;
5347
+ evaluate(source: string): BasicEvaluatedExpression;
5319
5348
  isPure(
5320
5349
  expr:
5321
5350
  | undefined
@@ -5398,6 +5427,7 @@ declare class JavascriptParser extends Parser {
5398
5427
  | ImportExpression
5399
5428
  | ChainExpression
5400
5429
  | Super;
5430
+ membersOptionals: boolean[];
5401
5431
  };
5402
5432
  getFreeInfoFromVariable(varName: string): {
5403
5433
  name: string;
@@ -5488,6 +5518,11 @@ declare interface JavascriptParserOptions {
5488
5518
  */
5489
5519
  importMeta?: boolean;
5490
5520
 
5521
+ /**
5522
+ * Enable/disable evaluating import.meta.webpackContext.
5523
+ */
5524
+ importMetaContext?: boolean;
5525
+
5491
5526
  /**
5492
5527
  * Include polyfills or mocks for various node stuff.
5493
5528
  */
@@ -7236,6 +7271,37 @@ declare interface ModuleReferenceOptions {
7236
7271
  */
7237
7272
  asiSafe?: boolean;
7238
7273
  }
7274
+ declare interface ModuleSettings {
7275
+ /**
7276
+ * Specifies the layer in which the module should be placed in.
7277
+ */
7278
+ layer?: string;
7279
+
7280
+ /**
7281
+ * Module type to use for the module.
7282
+ */
7283
+ type?: string;
7284
+
7285
+ /**
7286
+ * Options for the resolver.
7287
+ */
7288
+ resolve?: ResolveOptionsWebpackOptions;
7289
+
7290
+ /**
7291
+ * Options for parsing.
7292
+ */
7293
+ parser?: { [index: string]: any };
7294
+
7295
+ /**
7296
+ * The options for the module generator.
7297
+ */
7298
+ generator?: { [index: string]: any };
7299
+
7300
+ /**
7301
+ * Flags a module as with or without side effects.
7302
+ */
7303
+ sideEffects?: boolean;
7304
+ }
7239
7305
  declare abstract class ModuleTemplate {
7240
7306
  type: string;
7241
7307
  hooks: Readonly<{
@@ -7425,11 +7491,11 @@ type NodeEstreeIndex =
7425
7491
  | PropertyDefinition
7426
7492
  | VariableDeclarator
7427
7493
  | Program
7428
- | Super
7429
7494
  | SwitchCase
7430
7495
  | CatchClause
7431
7496
  | Property
7432
7497
  | AssignmentProperty
7498
+ | Super
7433
7499
  | TemplateElement
7434
7500
  | SpreadElement
7435
7501
  | ObjectPattern
@@ -7487,76 +7553,15 @@ declare class NodeTemplatePlugin {
7487
7553
  }
7488
7554
  type NodeWebpackOptions = false | NodeOptions;
7489
7555
  declare class NormalModule extends Module {
7490
- constructor(__0: {
7491
- /**
7492
- * an optional layer in which the module is
7493
- */
7494
- layer?: string;
7495
- /**
7496
- * module type
7497
- */
7498
- type: string;
7499
- /**
7500
- * request string
7501
- */
7502
- request: string;
7503
- /**
7504
- * request intended by user (without loaders from config)
7505
- */
7506
- userRequest: string;
7507
- /**
7508
- * request without resolving
7509
- */
7510
- rawRequest: string;
7511
- /**
7512
- * list of loaders
7513
- */
7514
- loaders: LoaderItem[];
7515
- /**
7516
- * path + query of the real resource
7517
- */
7518
- resource: string;
7519
- /**
7520
- * resource resolve data
7521
- */
7522
- resourceResolveData?: Record<string, any>;
7523
- /**
7524
- * context directory for resolving
7525
- */
7526
- context: string;
7527
- /**
7528
- * path + query of the matched resource (virtual)
7529
- */
7530
- matchResource?: string;
7531
- /**
7532
- * the parser used
7533
- */
7534
- parser: Parser;
7535
- /**
7536
- * the options of the parser used
7537
- */
7538
- parserOptions: object;
7539
- /**
7540
- * the generator used
7541
- */
7542
- generator: Generator;
7543
- /**
7544
- * the options of the generator used
7545
- */
7546
- generatorOptions: object;
7547
- /**
7548
- * options used for resolving requests from this module
7549
- */
7550
- resolveOptions: Object;
7551
- });
7556
+ constructor(__0: NormalModuleCreateData);
7552
7557
  request: string;
7553
7558
  userRequest: string;
7554
7559
  rawRequest: string;
7555
7560
  binary: boolean;
7556
7561
  parser: Parser;
7557
- parserOptions: object;
7562
+ parserOptions?: Record<string, any>;
7558
7563
  generator: Generator;
7559
- generatorOptions: object;
7564
+ generatorOptions?: Record<string, any>;
7560
7565
  resource: string;
7561
7566
  resourceResolveData?: Record<string, any>;
7562
7567
  matchResource?: string;
@@ -7599,20 +7604,109 @@ declare interface NormalModuleCompilationHooks {
7599
7604
  readResource: HookMap<AsyncSeriesBailHook<[object], string | Buffer>>;
7600
7605
  needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
7601
7606
  }
7607
+ declare interface NormalModuleCreateData {
7608
+ /**
7609
+ * an optional layer in which the module is
7610
+ */
7611
+ layer?: string;
7612
+
7613
+ /**
7614
+ * module type
7615
+ */
7616
+ type: string;
7617
+
7618
+ /**
7619
+ * request string
7620
+ */
7621
+ request: string;
7622
+
7623
+ /**
7624
+ * request intended by user (without loaders from config)
7625
+ */
7626
+ userRequest: string;
7627
+
7628
+ /**
7629
+ * request without resolving
7630
+ */
7631
+ rawRequest: string;
7632
+
7633
+ /**
7634
+ * list of loaders
7635
+ */
7636
+ loaders: LoaderItem[];
7637
+
7638
+ /**
7639
+ * path + query of the real resource
7640
+ */
7641
+ resource: string;
7642
+
7643
+ /**
7644
+ * resource resolve data
7645
+ */
7646
+ resourceResolveData?: Record<string, any>;
7647
+
7648
+ /**
7649
+ * context directory for resolving
7650
+ */
7651
+ context: string;
7652
+
7653
+ /**
7654
+ * path + query of the matched resource (virtual)
7655
+ */
7656
+ matchResource?: string;
7657
+
7658
+ /**
7659
+ * the parser used
7660
+ */
7661
+ parser: Parser;
7662
+
7663
+ /**
7664
+ * the options of the parser used
7665
+ */
7666
+ parserOptions?: Record<string, any>;
7667
+
7668
+ /**
7669
+ * the generator used
7670
+ */
7671
+ generator: Generator;
7672
+
7673
+ /**
7674
+ * the options of the generator used
7675
+ */
7676
+ generatorOptions?: Record<string, any>;
7677
+
7678
+ /**
7679
+ * options used for resolving requests from this module
7680
+ */
7681
+ resolveOptions?: ResolveOptionsWebpackOptions;
7682
+ }
7602
7683
  declare abstract class NormalModuleFactory extends ModuleFactory {
7603
7684
  hooks: Readonly<{
7604
- resolve: AsyncSeriesBailHook<[ResolveData], any>;
7685
+ resolve: AsyncSeriesBailHook<[ResolveData], false | void | Module>;
7605
7686
  resolveForScheme: HookMap<
7606
7687
  AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
7607
7688
  >;
7608
7689
  resolveInScheme: HookMap<
7609
7690
  AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
7610
7691
  >;
7611
- factorize: AsyncSeriesBailHook<[ResolveData], any>;
7612
- beforeResolve: AsyncSeriesBailHook<[ResolveData], any>;
7613
- afterResolve: AsyncSeriesBailHook<[ResolveData], any>;
7614
- createModule: AsyncSeriesBailHook<[Object, ResolveData], any>;
7615
- module: SyncWaterfallHook<[Module, Object, ResolveData], any>;
7692
+ factorize: AsyncSeriesBailHook<[ResolveData], Module>;
7693
+ beforeResolve: AsyncSeriesBailHook<[ResolveData], false | void>;
7694
+ afterResolve: AsyncSeriesBailHook<[ResolveData], false | void>;
7695
+ createModule: AsyncSeriesBailHook<
7696
+ [
7697
+ Partial<NormalModuleCreateData & { settings: ModuleSettings }>,
7698
+ ResolveData
7699
+ ],
7700
+ void | Module
7701
+ >;
7702
+ module: SyncWaterfallHook<
7703
+ [
7704
+ Module,
7705
+ Partial<NormalModuleCreateData & { settings: ModuleSettings }>,
7706
+ ResolveData
7707
+ ],
7708
+ Module
7709
+ >;
7616
7710
  createParser: HookMap<SyncBailHook<any, any>>;
7617
7711
  parser: HookMap<SyncHook<any>>;
7618
7712
  createGenerator: HookMap<SyncBailHook<any, any>>;
@@ -9419,7 +9513,7 @@ declare interface ResolveData {
9419
9513
  assertions?: Record<string, any>;
9420
9514
  dependencies: ModuleDependency[];
9421
9515
  dependencyType: string;
9422
- createData: Object;
9516
+ createData: Partial<NormalModuleCreateData & { settings: ModuleSettings }>;
9423
9517
  fileDependencies: LazySet<string>;
9424
9518
  missingDependencies: LazySet<string>;
9425
9519
  contextDependencies: LazySet<string>;
@@ -10202,6 +10296,7 @@ declare abstract class RuntimeTemplate {
10202
10296
  outputOptions: OutputNormalized;
10203
10297
  requestShortener: RequestShortener;
10204
10298
  globalObject: string;
10299
+ contentHashReplacement: string;
10205
10300
  isIIFE(): undefined | boolean;
10206
10301
  isModule(): undefined | boolean;
10207
10302
  supportsConst(): undefined | boolean;
@@ -11728,6 +11823,7 @@ declare interface UpdateHashContextGenerator {
11728
11823
  module: NormalModule;
11729
11824
  chunkGraph: ChunkGraph;
11730
11825
  runtime: RuntimeSpec;
11826
+ runtimeTemplate?: RuntimeTemplate;
11731
11827
  }
11732
11828
  type UsageStateType = 0 | 1 | 2 | 3 | 4;
11733
11829
  declare interface UserResolveOptions {