webpack 5.66.0 → 5.67.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 (72) hide show
  1. package/README.md +1 -1
  2. package/lib/Cache.js +1 -1
  3. package/lib/CacheFacade.js +2 -2
  4. package/lib/CleanPlugin.js +1 -1
  5. package/lib/Compilation.js +12 -9
  6. package/lib/Compiler.js +57 -3
  7. package/lib/ContextModule.js +21 -17
  8. package/lib/DelegatedModule.js +1 -1
  9. package/lib/DependencyTemplates.js +1 -1
  10. package/lib/DllModule.js +1 -1
  11. package/lib/EvalDevToolModulePlugin.js +16 -1
  12. package/lib/EvalSourceMapDevToolPlugin.js +18 -1
  13. package/lib/ExternalModule.js +1 -1
  14. package/lib/ExternalModuleFactoryPlugin.js +1 -1
  15. package/lib/FileSystemInfo.js +29 -25
  16. package/lib/HookWebpackError.js +1 -1
  17. package/lib/Module.js +1 -1
  18. package/lib/MultiCompiler.js +1 -1
  19. package/lib/MultiWatching.js +1 -1
  20. package/lib/NormalModule.js +6 -4
  21. package/lib/RawModule.js +1 -1
  22. package/lib/RuntimeGlobals.js +18 -0
  23. package/lib/RuntimeModule.js +1 -1
  24. package/lib/RuntimePlugin.js +28 -3
  25. package/lib/RuntimeTemplate.js +1 -1
  26. package/lib/Watching.js +1 -1
  27. package/lib/WebpackOptionsApply.js +1 -1
  28. package/lib/asset/AssetGenerator.js +62 -24
  29. package/lib/asset/AssetModulesPlugin.js +3 -0
  30. package/lib/asset/RawDataUrlModule.js +8 -5
  31. package/lib/cache/ResolverCachePlugin.js +1 -1
  32. package/lib/cli.js +44 -3
  33. package/lib/config/defaults.js +22 -5
  34. package/lib/config/normalization.js +5 -0
  35. package/lib/container/ContainerEntryModule.js +4 -2
  36. package/lib/container/FallbackModule.js +4 -4
  37. package/lib/container/RemoteModule.js +4 -2
  38. package/lib/css/CssExportsGenerator.js +139 -0
  39. package/lib/css/CssGenerator.js +3 -0
  40. package/lib/css/CssLoadingRuntimeModule.js +139 -85
  41. package/lib/css/CssModulesPlugin.js +20 -3
  42. package/lib/debug/ProfilingPlugin.js +12 -10
  43. package/lib/dependencies/CreateScriptUrlDependency.js +12 -0
  44. package/lib/dependencies/LoaderPlugin.js +2 -2
  45. package/lib/hmr/LazyCompilationPlugin.js +45 -21
  46. package/lib/hmr/lazyCompilationBackend.js +1 -1
  47. package/lib/ids/DeterministicModuleIdsPlugin.js +55 -35
  48. package/lib/ids/HashedModuleIdsPlugin.js +9 -12
  49. package/lib/ids/IdHelpers.js +24 -10
  50. package/lib/ids/NamedModuleIdsPlugin.js +6 -9
  51. package/lib/ids/NaturalModuleIdsPlugin.js +10 -13
  52. package/lib/ids/OccurrenceModuleIdsPlugin.js +13 -10
  53. package/lib/ids/SyncModuleIdsPlugin.js +140 -0
  54. package/lib/index.js +5 -0
  55. package/lib/optimize/ConcatenatedModule.js +1 -1
  56. package/lib/runtime/CreateScriptRuntimeModule.js +36 -0
  57. package/lib/runtime/CreateScriptUrlRuntimeModule.js +9 -34
  58. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +76 -0
  59. package/lib/schemes/HttpUriPlugin.js +8 -8
  60. package/lib/sharing/ConsumeSharedModule.js +4 -2
  61. package/lib/sharing/ProvideSharedModule.js +4 -2
  62. package/lib/sharing/utils.js +1 -1
  63. package/lib/stats/DefaultStatsFactoryPlugin.js +112 -67
  64. package/lib/stats/DefaultStatsPrinterPlugin.js +88 -23
  65. package/lib/util/AsyncQueue.js +1 -1
  66. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -11
  67. package/package.json +3 -10
  68. package/schemas/WebpackOptions.check.js +1 -1
  69. package/schemas/WebpackOptions.json +43 -6
  70. package/schemas/plugins/asset/AssetGeneratorOptions.check.js +1 -1
  71. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +1 -1
  72. package/types.d.ts +163 -42
@@ -108,6 +108,9 @@
108
108
  "filename": {
109
109
  "$ref": "#/definitions/FilenameTemplate"
110
110
  },
111
+ "outputPath": {
112
+ "$ref": "#/definitions/AssetModuleOutputPath"
113
+ },
111
114
  "publicPath": {
112
115
  "$ref": "#/definitions/RawPublicPath"
113
116
  }
@@ -136,6 +139,19 @@
136
139
  }
137
140
  ]
138
141
  },
142
+ "AssetModuleOutputPath": {
143
+ "description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
144
+ "anyOf": [
145
+ {
146
+ "type": "string",
147
+ "absolutePath": false
148
+ },
149
+ {
150
+ "instanceof": "Function",
151
+ "tsType": "((pathData: import(\"../lib/Compilation\").PathData, assetInfo?: import(\"../lib/Compilation\").AssetInfo) => string)"
152
+ }
153
+ ]
154
+ },
139
155
  "AssetParserDataUrlFunction": {
140
156
  "description": "Function that executes for module and should return whenever asset should be inlined as DataUrl.",
141
157
  "instanceof": "Function",
@@ -182,6 +198,9 @@
182
198
  "filename": {
183
199
  "$ref": "#/definitions/FilenameTemplate"
184
200
  },
201
+ "outputPath": {
202
+ "$ref": "#/definitions/AssetModuleOutputPath"
203
+ },
185
204
  "publicPath": {
186
205
  "$ref": "#/definitions/RawPublicPath"
187
206
  }
@@ -343,6 +362,17 @@
343
362
  }
344
363
  ]
345
364
  },
365
+ "CssExperimentOptions": {
366
+ "description": "Options for css handling.",
367
+ "type": "object",
368
+ "additionalProperties": false,
369
+ "properties": {
370
+ "exportsOnly": {
371
+ "description": "Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.",
372
+ "type": "boolean"
373
+ }
374
+ }
375
+ },
346
376
  "CssFilename": {
347
377
  "description": "Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.",
348
378
  "oneOf": [
@@ -750,7 +780,14 @@
750
780
  },
751
781
  "css": {
752
782
  "description": "Enable css support.",
753
- "type": "boolean"
783
+ "anyOf": [
784
+ {
785
+ "type": "boolean"
786
+ },
787
+ {
788
+ "$ref": "#/definitions/CssExperimentOptions"
789
+ }
790
+ ]
754
791
  },
755
792
  "futureDefaults": {
756
793
  "description": "Apply defaults of next major version.",
@@ -802,10 +839,6 @@
802
839
  "description": "Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.",
803
840
  "type": "boolean"
804
841
  },
805
- "css": {
806
- "description": "Enable css support.",
807
- "type": "boolean"
808
- },
809
842
  "futureDefaults": {
810
843
  "description": "Apply defaults of next major version.",
811
844
  "type": "boolean"
@@ -856,7 +889,11 @@
856
889
  },
857
890
  "css": {
858
891
  "description": "Enable css support.",
859
- "type": "boolean"
892
+ "oneOf": [
893
+ {
894
+ "$ref": "#/definitions/CssExperimentOptions"
895
+ }
896
+ ]
860
897
  },
861
898
  "futureDefaults": {
862
899
  "description": "Apply defaults of next major version.",
@@ -3,4 +3,4 @@
3
3
  * DO NOT MODIFY BY HAND.
4
4
  * Run `yarn special-lint-fix` to update
5
5
  */
6
- const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function n(t,{instancePath:r="",parentData:e,parentDataProperty:a,rootData:s=t}={}){let o=null,l=0;const i=l;let p=!1;const c=l;if(l==l)if(t&&"object"==typeof t&&!Array.isArray(t)){const n=l;for(const n in t)if("encoding"!==n&&"mimetype"!==n){const t={params:{additionalProperty:n}};null===o?o=[t]:o.push(t),l++;break}if(n===l){if(void 0!==t.encoding){let n=t.encoding;const r=l;if(!1!==n&&"base64"!==n){const t={params:{}};null===o?o=[t]:o.push(t),l++}var u=r===l}else u=!0;if(u)if(void 0!==t.mimetype){const n=l;if("string"!=typeof t.mimetype){const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}u=n===l}else u=!0}}else{const t={params:{type:"object"}};null===o?o=[t]:o.push(t),l++}var f=c===l;if(p=p||f,!p){const n=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=n===l,p=p||f}if(!p){const t={params:{}};return null===o?o=[t]:o.push(t),l++,n.errors=o,!1}return l=i,null!==o&&(i?o.length=i:o=null),n.errors=o,0===l}function r(e,{instancePath:a="",parentData:s,parentDataProperty:o,rootData:l=e}={}){let i=null,p=0;if(0===p){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const s=p;for(const t in e)if("dataUrl"!==t&&"emit"!==t&&"filename"!==t&&"publicPath"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(s===p){if(void 0!==e.dataUrl){const t=p;n(e.dataUrl,{instancePath:a+"/dataUrl",parentData:e,parentDataProperty:"dataUrl",rootData:l})||(i=null===i?n.errors:i.concat(n.errors),p=i.length);var c=t===p}else c=!0;if(c){if(void 0!==e.emit){const t=p;if("boolean"!=typeof e.emit)return r.errors=[{params:{type:"boolean"}}],!1;c=t===p}else c=!0;if(c){if(void 0!==e.filename){let n=e.filename;const a=p,s=p;let o=!1;const l=p;if(p===l)if("string"==typeof n){if(n.includes("!")||!1!==t.test(n)){const t={params:{}};null===i?i=[t]:i.push(t),p++}else if(n.length<1){const t={params:{}};null===i?i=[t]:i.push(t),p++}}else{const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var u=l===p;if(o=o||u,!o){const t=p;if(!(n instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}u=t===p,o=o||u}if(!o){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),c=a===p}else c=!0;if(c)if(void 0!==e.publicPath){let t=e.publicPath;const n=p,a=p;let s=!1;const o=p;if("string"!=typeof t){const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var f=o===p;if(s=s||f,!s){const n=p;if(!(t instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}f=n===p,s=s||f}if(!s){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=a,null!==i&&(a?i.length=a:i=null),c=n===p}else c=!0}}}}}return r.errors=i,0===p}function e(t,{instancePath:n="",parentData:a,parentDataProperty:s,rootData:o=t}={}){let l=null,i=0;return r(t,{instancePath:n,parentData:a,parentDataProperty:s,rootData:o})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),e.errors=l,0===i}module.exports=e,module.exports.default=e;
6
+ const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function n(t,{instancePath:r="",parentData:e,parentDataProperty:a,rootData:s=t}={}){let o=null,l=0;const i=l;let p=!1;const u=l;if(l==l)if(t&&"object"==typeof t&&!Array.isArray(t)){const n=l;for(const n in t)if("encoding"!==n&&"mimetype"!==n){const t={params:{additionalProperty:n}};null===o?o=[t]:o.push(t),l++;break}if(n===l){if(void 0!==t.encoding){let n=t.encoding;const r=l;if(!1!==n&&"base64"!==n){const t={params:{}};null===o?o=[t]:o.push(t),l++}var c=r===l}else c=!0;if(c)if(void 0!==t.mimetype){const n=l;if("string"!=typeof t.mimetype){const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}c=n===l}else c=!0}}else{const t={params:{type:"object"}};null===o?o=[t]:o.push(t),l++}var f=u===l;if(p=p||f,!p){const n=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=n===l,p=p||f}if(!p){const t={params:{}};return null===o?o=[t]:o.push(t),l++,n.errors=o,!1}return l=i,null!==o&&(i?o.length=i:o=null),n.errors=o,0===l}function r(e,{instancePath:a="",parentData:s,parentDataProperty:o,rootData:l=e}={}){let i=null,p=0;if(0===p){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const s=p;for(const t in e)if("dataUrl"!==t&&"emit"!==t&&"filename"!==t&&"outputPath"!==t&&"publicPath"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(s===p){if(void 0!==e.dataUrl){const t=p;n(e.dataUrl,{instancePath:a+"/dataUrl",parentData:e,parentDataProperty:"dataUrl",rootData:l})||(i=null===i?n.errors:i.concat(n.errors),p=i.length);var u=t===p}else u=!0;if(u){if(void 0!==e.emit){const t=p;if("boolean"!=typeof e.emit)return r.errors=[{params:{type:"boolean"}}],!1;u=t===p}else u=!0;if(u){if(void 0!==e.filename){let n=e.filename;const a=p,s=p;let o=!1;const l=p;if(p===l)if("string"==typeof n){if(n.includes("!")||!1!==t.test(n)){const t={params:{}};null===i?i=[t]:i.push(t),p++}else if(n.length<1){const t={params:{}};null===i?i=[t]:i.push(t),p++}}else{const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var c=l===p;if(o=o||c,!o){const t=p;if(!(n instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}c=t===p,o=o||c}if(!o){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),u=a===p}else u=!0;if(u){if(void 0!==e.outputPath){let n=e.outputPath;const a=p,s=p;let o=!1;const l=p;if(p===l)if("string"==typeof n){if(n.includes("!")||!1!==t.test(n)){const t={params:{}};null===i?i=[t]:i.push(t),p++}}else{const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var f=l===p;if(o=o||f,!o){const t=p;if(!(n instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}f=t===p,o=o||f}if(!o){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),u=a===p}else u=!0;if(u)if(void 0!==e.publicPath){let t=e.publicPath;const n=p,a=p;let s=!1;const o=p;if("string"!=typeof t){const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var h=o===p;if(s=s||h,!s){const n=p;if(!(t instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}h=n===p,s=s||h}if(!s){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=a,null!==i&&(a?i.length=a:i=null),u=n===p}else u=!0}}}}}}return r.errors=i,0===p}function e(t,{instancePath:n="",parentData:a,parentDataProperty:s,rootData:o=t}={}){let l=null,i=0;return r(t,{instancePath:n,parentData:a,parentDataProperty:s,rootData:o})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),e.errors=l,0===i}module.exports=e,module.exports.default=e;
@@ -3,4 +3,4 @@
3
3
  * DO NOT MODIFY BY HAND.
4
4
  * Run `yarn special-lint-fix` to update
5
5
  */
6
- const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function r(n,{instancePath:e="",parentData:a,parentDataProperty:s,rootData:o=n}={}){let l=null,i=0;if(0===i){if(!n||"object"!=typeof n||Array.isArray(n))return r.errors=[{params:{type:"object"}}],!1;{const e=i;for(const t in n)if("emit"!==t&&"filename"!==t&&"publicPath"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(e===i){if(void 0!==n.emit){const t=i;if("boolean"!=typeof n.emit)return r.errors=[{params:{type:"boolean"}}],!1;var p=t===i}else p=!0;if(p){if(void 0!==n.filename){let e=n.filename;const a=i,s=i;let o=!1;const c=i;if(i===c)if("string"==typeof e){if(e.includes("!")||!1!==t.test(e)){const t={params:{}};null===l?l=[t]:l.push(t),i++}else if(e.length<1){const t={params:{}};null===l?l=[t]:l.push(t),i++}}else{const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var u=c===i;if(o=o||u,!o){const t=i;if(!(e instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}u=t===i,o=o||u}if(!o){const t={params:{}};return null===l?l=[t]:l.push(t),i++,r.errors=l,!1}i=s,null!==l&&(s?l.length=s:l=null),p=a===i}else p=!0;if(p)if(void 0!==n.publicPath){let t=n.publicPath;const e=i,a=i;let s=!1;const o=i;if("string"!=typeof t){const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var c=o===i;if(s=s||c,!s){const r=i;if(!(t instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}c=r===i,s=s||c}if(!s){const t={params:{}};return null===l?l=[t]:l.push(t),i++,r.errors=l,!1}i=a,null!==l&&(a?l.length=a:l=null),p=e===i}else p=!0}}}}return r.errors=l,0===i}function n(t,{instancePath:e="",parentData:a,parentDataProperty:s,rootData:o=t}={}){let l=null,i=0;return r(t,{instancePath:e,parentData:a,parentDataProperty:s,rootData:o})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),n.errors=l,0===i}module.exports=n,module.exports.default=n;
6
+ const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function n(r,{instancePath:e="",parentData:s,parentDataProperty:a,rootData:o=r}={}){let l=null,i=0;if(0===i){if(!r||"object"!=typeof r||Array.isArray(r))return n.errors=[{params:{type:"object"}}],!1;{const e=i;for(const t in r)if("emit"!==t&&"filename"!==t&&"outputPath"!==t&&"publicPath"!==t)return n.errors=[{params:{additionalProperty:t}}],!1;if(e===i){if(void 0!==r.emit){const t=i;if("boolean"!=typeof r.emit)return n.errors=[{params:{type:"boolean"}}],!1;var u=t===i}else u=!0;if(u){if(void 0!==r.filename){let e=r.filename;const s=i,a=i;let o=!1;const c=i;if(i===c)if("string"==typeof e){if(e.includes("!")||!1!==t.test(e)){const t={params:{}};null===l?l=[t]:l.push(t),i++}else if(e.length<1){const t={params:{}};null===l?l=[t]:l.push(t),i++}}else{const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var p=c===i;if(o=o||p,!o){const t=i;if(!(e instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}p=t===i,o=o||p}if(!o){const t={params:{}};return null===l?l=[t]:l.push(t),i++,n.errors=l,!1}i=a,null!==l&&(a?l.length=a:l=null),u=s===i}else u=!0;if(u){if(void 0!==r.outputPath){let e=r.outputPath;const s=i,a=i;let o=!1;const p=i;if(i===p)if("string"==typeof e){if(e.includes("!")||!1!==t.test(e)){const t={params:{}};null===l?l=[t]:l.push(t),i++}}else{const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var c=p===i;if(o=o||c,!o){const t=i;if(!(e instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}c=t===i,o=o||c}if(!o){const t={params:{}};return null===l?l=[t]:l.push(t),i++,n.errors=l,!1}i=a,null!==l&&(a?l.length=a:l=null),u=s===i}else u=!0;if(u)if(void 0!==r.publicPath){let t=r.publicPath;const e=i,s=i;let a=!1;const o=i;if("string"!=typeof t){const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var f=o===i;if(a=a||f,!a){const n=i;if(!(t instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}f=n===i,a=a||f}if(!a){const t={params:{}};return null===l?l=[t]:l.push(t),i++,n.errors=l,!1}i=s,null!==l&&(s?l.length=s:l=null),u=e===i}else u=!0}}}}}return n.errors=l,0===i}function r(t,{instancePath:e="",parentData:s,parentDataProperty:a,rootData:o=t}={}){let l=null,i=0;return n(t,{instancePath:e,parentData:s,parentDataProperty:a,rootData:o})||(l=null===l?n.errors:l.concat(n.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
package/types.d.ts CHANGED
@@ -215,6 +215,7 @@ declare interface Argument {
215
215
  }
216
216
  declare interface ArgumentConfig {
217
217
  description: string;
218
+ negatedDescription?: string;
218
219
  path: string;
219
220
  multiple: boolean;
220
221
  type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset";
@@ -320,6 +321,11 @@ declare interface AssetResourceGeneratorOptions {
320
321
  */
321
322
  filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
322
323
 
324
+ /**
325
+ * Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
326
+ */
327
+ outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
328
+
323
329
  /**
324
330
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
325
331
  */
@@ -675,16 +681,16 @@ declare interface CallExpressionInfo {
675
681
  getMembers: () => string[];
676
682
  }
677
683
  declare interface CallbackAsyncQueue<T> {
678
- (err?: WebpackError, result?: T): any;
684
+ (err?: null | WebpackError, result?: T): any;
679
685
  }
680
686
  declare interface CallbackCache<T> {
681
- (err?: WebpackError, result?: T): void;
687
+ (err?: null | WebpackError, result?: T): void;
682
688
  }
683
689
  declare interface CallbackFunction<T> {
684
- (err?: Error, result?: T): any;
690
+ (err?: null | Error, result?: T): any;
685
691
  }
686
692
  declare interface CallbackNormalErrorCache<T> {
687
- (err?: Error, result?: T): void;
693
+ (err?: null | Error, result?: T): void;
688
694
  }
689
695
  declare interface CallbackWebpack<T> {
690
696
  (err?: Error, stats?: T): void;
@@ -1541,7 +1547,7 @@ declare class Compilation {
1541
1547
  getLogger(name: string | (() => string)): WebpackLogger;
1542
1548
  addModule(
1543
1549
  module: Module,
1544
- callback: (err?: WebpackError, result?: Module) => void
1550
+ callback: (err?: null | WebpackError, result?: Module) => void
1545
1551
  ): void;
1546
1552
 
1547
1553
  /**
@@ -1559,21 +1565,21 @@ declare class Compilation {
1559
1565
  */
1560
1566
  buildModule(
1561
1567
  module: Module,
1562
- callback: (err?: WebpackError, result?: Module) => void
1568
+ callback: (err?: null | WebpackError, result?: Module) => void
1563
1569
  ): void;
1564
1570
  processModuleDependencies(
1565
1571
  module: Module,
1566
- callback: (err?: WebpackError, result?: Module) => void
1572
+ callback: (err?: null | WebpackError, result?: Module) => void
1567
1573
  ): void;
1568
1574
  processModuleDependenciesNonRecursive(module: Module): void;
1569
1575
  handleModuleCreation(
1570
1576
  __0: HandleModuleCreationOptions,
1571
- callback: (err?: WebpackError, result?: Module) => void
1577
+ callback: (err?: null | WebpackError, result?: Module) => void
1572
1578
  ): void;
1573
1579
  addModuleChain(
1574
1580
  context: string,
1575
1581
  dependency: Dependency,
1576
- callback: (err?: WebpackError, result?: Module) => void
1582
+ callback: (err?: null | WebpackError, result?: Module) => void
1577
1583
  ): void;
1578
1584
  addModuleTree(
1579
1585
  __0: {
@@ -1590,27 +1596,27 @@ declare class Compilation {
1590
1596
  */
1591
1597
  contextInfo?: Partial<ModuleFactoryCreateDataContextInfo>;
1592
1598
  },
1593
- callback: (err?: WebpackError, result?: Module) => void
1599
+ callback: (err?: null | WebpackError, result?: Module) => void
1594
1600
  ): void;
1595
1601
  addEntry(
1596
1602
  context: string,
1597
1603
  entry: Dependency,
1598
1604
  optionsOrName: string | EntryOptions,
1599
- callback: (err?: WebpackError, result?: Module) => void
1605
+ callback: (err?: null | WebpackError, result?: Module) => void
1600
1606
  ): void;
1601
1607
  addInclude(
1602
1608
  context: string,
1603
1609
  dependency: Dependency,
1604
1610
  options: EntryOptions,
1605
- callback: (err?: WebpackError, result?: Module) => void
1611
+ callback: (err?: null | WebpackError, result?: Module) => void
1606
1612
  ): void;
1607
1613
  rebuildModule(
1608
1614
  module: Module,
1609
- callback: (err?: WebpackError, result?: Module) => void
1615
+ callback: (err?: null | WebpackError, result?: Module) => void
1610
1616
  ): void;
1611
1617
  finish(callback?: any): void;
1612
1618
  unseal(): void;
1613
- seal(callback: (err?: WebpackError) => void): void;
1619
+ seal(callback: (err?: null | WebpackError) => void): void;
1614
1620
  reportDependencyErrorsAndWarnings(
1615
1621
  module: Module,
1616
1622
  blocks: DependenciesBlock[]
@@ -1643,11 +1649,15 @@ declare class Compilation {
1643
1649
  module: RuntimeModule,
1644
1650
  chunkGraph?: ChunkGraph
1645
1651
  ): void;
1652
+
1653
+ /**
1654
+ * If `module` is passed, `loc` and `request` must also be passed.
1655
+ */
1646
1656
  addChunkInGroup(
1647
1657
  groupOptions: string | ChunkGroupOptions,
1648
- module: Module,
1649
- loc: DependencyLocation,
1650
- request: string
1658
+ module?: Module,
1659
+ loc?: SyntheticDependencyLocation | RealDependencyLocation,
1660
+ request?: string
1651
1661
  ): ChunkGroup;
1652
1662
  addAsyncEntrypoint(
1653
1663
  options: EntryOptions,
@@ -1698,7 +1708,7 @@ declare class Compilation {
1698
1708
  clearAssets(): void;
1699
1709
  createModuleAssets(): void;
1700
1710
  getRenderManifest(options: RenderManifestOptions): RenderManifestEntry[];
1701
- createChunkAssets(callback: (err?: WebpackError) => void): void;
1711
+ createChunkAssets(callback: (err?: null | WebpackError) => void): void;
1702
1712
  getPath(
1703
1713
  filename: string | ((arg0: PathData, arg1?: AssetInfo) => string),
1704
1714
  data?: PathData
@@ -1734,17 +1744,20 @@ declare class Compilation {
1734
1744
  executeModule(
1735
1745
  module: Module,
1736
1746
  options: ExecuteModuleOptions,
1737
- callback: (err?: WebpackError, result?: ExecuteModuleResult) => void
1747
+ callback: (err?: null | WebpackError, result?: ExecuteModuleResult) => void
1738
1748
  ): void;
1739
1749
  checkConstraints(): void;
1740
1750
  factorizeModule: {
1741
1751
  (
1742
1752
  options: FactorizeModuleOptions & { factoryResult?: false },
1743
- callback: (err?: WebpackError, result?: Module) => void
1753
+ callback: (err?: null | WebpackError, result?: Module) => void
1744
1754
  ): void;
1745
1755
  (
1746
1756
  options: FactorizeModuleOptions & { factoryResult: true },
1747
- callback: (err?: WebpackError, result?: ModuleFactoryResult) => void
1757
+ callback: (
1758
+ err?: null | WebpackError,
1759
+ result?: ModuleFactoryResult
1760
+ ) => void
1748
1761
  ): void;
1749
1762
  };
1750
1763
 
@@ -1887,6 +1900,8 @@ declare class Compiler {
1887
1900
  make: AsyncParallelHook<[Compilation]>;
1888
1901
  finishMake: AsyncParallelHook<[Compilation]>;
1889
1902
  afterCompile: AsyncSeriesHook<[Compilation]>;
1903
+ readRecords: AsyncSeriesHook<[]>;
1904
+ emitRecords: AsyncSeriesHook<[]>;
1890
1905
  watchRun: AsyncSeriesHook<[Compiler]>;
1891
1906
  failed: SyncHook<[Error]>;
1892
1907
  invalid: SyncHook<[null | string, number]>;
@@ -1942,7 +1957,11 @@ declare class Compiler {
1942
1957
  watch(watchOptions: WatchOptions, handler: CallbackFunction<Stats>): Watching;
1943
1958
  run(callback: CallbackFunction<Stats>): void;
1944
1959
  runAsChild(
1945
- callback: (err?: Error, entries?: Chunk[], compilation?: Compilation) => any
1960
+ callback: (
1961
+ err?: null | Error,
1962
+ entries?: Chunk[],
1963
+ compilation?: Compilation
1964
+ ) => any
1946
1965
  ): void;
1947
1966
  purgeInputFileSystem(): void;
1948
1967
  emitAssets(compilation: Compilation, callback: CallbackFunction<void>): void;
@@ -2476,7 +2495,10 @@ declare abstract class ContextModuleFactory extends ModuleFactory {
2476
2495
  resolveDependencies(
2477
2496
  fs: InputFileSystem,
2478
2497
  options: ContextModuleOptions,
2479
- callback: (err?: Error, dependencies?: ContextElementDependency[]) => any
2498
+ callback: (
2499
+ err?: null | Error,
2500
+ dependencies?: ContextElementDependency[]
2501
+ ) => any
2480
2502
  ): void;
2481
2503
  }
2482
2504
 
@@ -2526,6 +2548,16 @@ declare interface ContextTimestampAndHash {
2526
2548
  }
2527
2549
  type CreateStatsOptionsContext = KnownCreateStatsOptionsContext &
2528
2550
  Record<string, any>;
2551
+
2552
+ /**
2553
+ * Options for css handling.
2554
+ */
2555
+ declare interface CssExperimentOptions {
2556
+ /**
2557
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
2558
+ */
2559
+ exportsOnly?: boolean;
2560
+ }
2529
2561
  type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
2530
2562
  declare class DefinePlugin {
2531
2563
  /**
@@ -2739,8 +2771,58 @@ declare class DeterministicChunkIdsPlugin {
2739
2771
  apply(compiler: Compiler): void;
2740
2772
  }
2741
2773
  declare class DeterministicModuleIdsPlugin {
2742
- constructor(options?: any);
2743
- options: any;
2774
+ constructor(options?: {
2775
+ /**
2776
+ * context relative to which module identifiers are computed
2777
+ */
2778
+ context?: string;
2779
+ /**
2780
+ * selector function for modules
2781
+ */
2782
+ test?: (arg0: Module) => boolean;
2783
+ /**
2784
+ * maximum id length in digits (used as starting point)
2785
+ */
2786
+ maxLength?: number;
2787
+ /**
2788
+ * hash salt for ids
2789
+ */
2790
+ salt?: number;
2791
+ /**
2792
+ * do not increase the maxLength to find an optimal id space size
2793
+ */
2794
+ fixedLength?: boolean;
2795
+ /**
2796
+ * throw an error when id conflicts occur (instead of rehashing)
2797
+ */
2798
+ failOnConflict?: boolean;
2799
+ });
2800
+ options: {
2801
+ /**
2802
+ * context relative to which module identifiers are computed
2803
+ */
2804
+ context?: string;
2805
+ /**
2806
+ * selector function for modules
2807
+ */
2808
+ test?: (arg0: Module) => boolean;
2809
+ /**
2810
+ * maximum id length in digits (used as starting point)
2811
+ */
2812
+ maxLength?: number;
2813
+ /**
2814
+ * hash salt for ids
2815
+ */
2816
+ salt?: number;
2817
+ /**
2818
+ * do not increase the maxLength to find an optimal id space size
2819
+ */
2820
+ fixedLength?: boolean;
2821
+ /**
2822
+ * throw an error when id conflicts occur (instead of rehashing)
2823
+ */
2824
+ failOnConflict?: boolean;
2825
+ };
2744
2826
 
2745
2827
  /**
2746
2828
  * Apply the plugin
@@ -3359,11 +3441,6 @@ declare interface ExperimentsCommon {
3359
3441
  */
3360
3442
  cacheUnaffected?: boolean;
3361
3443
 
3362
- /**
3363
- * Enable css support.
3364
- */
3365
- css?: boolean;
3366
-
3367
3444
  /**
3368
3445
  * Apply defaults of next major version.
3369
3446
  */
@@ -3399,6 +3476,11 @@ declare interface ExperimentsExtra {
3399
3476
  */
3400
3477
  buildHttp?: HttpUriOptions | (string | RegExp | ((uri: string) => boolean))[];
3401
3478
 
3479
+ /**
3480
+ * Enable css support.
3481
+ */
3482
+ css?: boolean | CssExperimentOptions;
3483
+
3402
3484
  /**
3403
3485
  * Compile entrypoints and import()s only when they are accessed.
3404
3486
  */
@@ -3415,6 +3497,11 @@ declare interface ExperimentsNormalizedExtra {
3415
3497
  */
3416
3498
  buildHttp?: HttpUriOptions;
3417
3499
 
3500
+ /**
3501
+ * Enable css support.
3502
+ */
3503
+ css?: CssExperimentOptions;
3504
+
3418
3505
  /**
3419
3506
  * Compile entrypoints and import()s only when they are accessed.
3420
3507
  */
@@ -4119,40 +4206,43 @@ declare abstract class FileSystemInfo {
4119
4206
  getFileTimestamp(
4120
4207
  path: string,
4121
4208
  callback: (
4122
- arg0?: WebpackError,
4209
+ arg0?: null | WebpackError,
4123
4210
  arg1?: null | FileSystemInfoEntry | "ignore"
4124
4211
  ) => void
4125
4212
  ): void;
4126
4213
  getContextTimestamp(
4127
4214
  path: string,
4128
4215
  callback: (
4129
- arg0?: WebpackError,
4216
+ arg0?: null | WebpackError,
4130
4217
  arg1?: null | "ignore" | ResolvedContextFileSystemInfoEntry
4131
4218
  ) => void
4132
4219
  ): void;
4133
4220
  getFileHash(
4134
4221
  path: string,
4135
- callback: (arg0?: WebpackError, arg1?: string) => void
4222
+ callback: (arg0?: null | WebpackError, arg1?: string) => void
4136
4223
  ): void;
4137
4224
  getContextHash(
4138
4225
  path: string,
4139
- callback: (arg0?: WebpackError, arg1?: string) => void
4226
+ callback: (arg0?: null | WebpackError, arg1?: string) => void
4140
4227
  ): void;
4141
4228
  getContextTsh(
4142
4229
  path: string,
4143
4230
  callback: (
4144
- arg0?: WebpackError,
4231
+ arg0?: null | WebpackError,
4145
4232
  arg1?: ResolvedContextTimestampAndHash
4146
4233
  ) => void
4147
4234
  ): void;
4148
4235
  resolveBuildDependencies(
4149
4236
  context: string,
4150
4237
  deps: Iterable<string>,
4151
- callback: (arg0?: Error, arg1?: ResolveBuildDependenciesResult) => void
4238
+ callback: (
4239
+ arg0?: null | Error,
4240
+ arg1?: ResolveBuildDependenciesResult
4241
+ ) => void
4152
4242
  ): void;
4153
4243
  checkResolveResultsValid(
4154
4244
  resolveResults: Map<string, string | false>,
4155
- callback: (arg0?: Error, arg1?: boolean) => void
4245
+ callback: (arg0?: null | Error, arg1?: boolean) => void
4156
4246
  ): void;
4157
4247
  createSnapshot(
4158
4248
  startTime: number,
@@ -4169,12 +4259,12 @@ declare abstract class FileSystemInfo {
4169
4259
  */
4170
4260
  timestamp?: boolean;
4171
4261
  },
4172
- callback: (arg0?: WebpackError, arg1?: Snapshot) => void
4262
+ callback: (arg0?: null | WebpackError, arg1?: null | Snapshot) => void
4173
4263
  ): void;
4174
4264
  mergeSnapshots(snapshot1: Snapshot, snapshot2: Snapshot): Snapshot;
4175
4265
  checkSnapshotValid(
4176
4266
  snapshot: Snapshot,
4177
- callback: (arg0?: WebpackError, arg1?: boolean) => void
4267
+ callback: (arg0?: null | WebpackError, arg1?: boolean) => void
4178
4268
  ): void;
4179
4269
  getDeprecatedFileTimestamps(): Map<any, any>;
4180
4270
  getDeprecatedContextTimestamps(): Map<any, any>;
@@ -6219,7 +6309,7 @@ declare interface LoaderPluginLoaderContext {
6219
6309
  importModule(
6220
6310
  request: string,
6221
6311
  options: ImportModuleOptions,
6222
- callback: (err?: Error, exports?: any) => any
6312
+ callback: (err?: null | Error, exports?: any) => any
6223
6313
  ): void;
6224
6314
  importModule(request: string, options?: ImportModuleOptions): Promise<any>;
6225
6315
  }
@@ -6585,7 +6675,7 @@ declare class Module extends DependenciesBlock {
6585
6675
  hasReasons(moduleGraph: ModuleGraph, runtime: RuntimeSpec): boolean;
6586
6676
  needBuild(
6587
6677
  context: NeedBuildContext,
6588
- callback: (arg0?: WebpackError, arg1?: boolean) => void
6678
+ callback: (arg0?: null | WebpackError, arg1?: boolean) => void
6589
6679
  ): void;
6590
6680
  needRebuild(
6591
6681
  fileTimestamps: Map<string, null | number>,
@@ -7455,7 +7545,7 @@ declare class NormalModule extends Module {
7455
7545
  resourceResolveData?: Record<string, any>;
7456
7546
  matchResource?: string;
7457
7547
  loaders: LoaderItem[];
7458
- error?: WebpackError;
7548
+ error?: null | WebpackError;
7459
7549
  restoreFromUnsafeCache(
7460
7550
  unsafeCacheData?: any,
7461
7551
  normalModuleFactory?: any
@@ -11511,6 +11601,31 @@ type StatsValue =
11511
11601
  | "minimal"
11512
11602
  | "normal"
11513
11603
  | "detailed";
11604
+ declare class SyncModuleIdsPlugin {
11605
+ constructor(__0: {
11606
+ /**
11607
+ * path to file
11608
+ */
11609
+ path: string;
11610
+ /**
11611
+ * context for module names
11612
+ */
11613
+ context?: string;
11614
+ /**
11615
+ * selector for modules
11616
+ */
11617
+ test: (arg0: Module) => boolean;
11618
+ /**
11619
+ * operation mode (defaults to merge)
11620
+ */
11621
+ mode?: "read" | "create" | "merge" | "update";
11622
+ });
11623
+
11624
+ /**
11625
+ * Apply the plugin
11626
+ */
11627
+ apply(compiler: Compiler): void;
11628
+ }
11514
11629
  declare interface SyntheticDependencyLocation {
11515
11630
  name: string;
11516
11631
  index?: number;
@@ -12380,11 +12495,14 @@ declare namespace exports {
12380
12495
  export let uncaughtErrorHandler: string;
12381
12496
  export let scriptNonce: string;
12382
12497
  export let loadScript: string;
12498
+ export let createScript: string;
12383
12499
  export let createScriptUrl: string;
12500
+ export let getTrustedTypesPolicy: string;
12384
12501
  export let chunkName: string;
12385
12502
  export let runtimeId: string;
12386
12503
  export let getChunkScriptFilename: string;
12387
12504
  export let getChunkCssFilename: string;
12505
+ export let hasCssModules: string;
12388
12506
  export let getChunkUpdateScriptFilename: string;
12389
12507
  export let getChunkUpdateCssFilename: string;
12390
12508
  export let startup: string;
@@ -12722,6 +12840,9 @@ declare namespace exports {
12722
12840
  export namespace schemes {
12723
12841
  export { HttpUriPlugin };
12724
12842
  }
12843
+ export namespace ids {
12844
+ export { SyncModuleIdsPlugin };
12845
+ }
12725
12846
  }
12726
12847
  export type WebpackPluginFunction = (
12727
12848
  this: Compiler,