webpack 5.110.1 → 5.110.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +10 -17
  2. package/lib/ExportsInfo.js +10 -0
  3. package/lib/RuntimeTemplate.js +423 -430
  4. package/lib/css/CssLoadingRuntimeModule.js +32 -13
  5. package/lib/css/CssModulesPlugin.js +9 -17
  6. package/lib/css/data.js +13 -3
  7. package/lib/css/syntax.js +78 -10
  8. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +10 -4
  9. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -0
  10. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +48 -3
  11. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +83 -14
  12. package/lib/dependencies/HarmonyImportSideEffectDependency.js +114 -0
  13. package/lib/dependencies/WorkerAndWorkletPlugin.js +1 -0
  14. package/lib/dependencies/WorkerDependency.js +6 -12
  15. package/lib/dependencies/WorkletDependency.js +7 -11
  16. package/lib/esm/ModuleChunkLoadingPlugin.js +6 -9
  17. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -1
  18. package/lib/html/HtmlModulesPlugin.js +55 -16
  19. package/lib/html/syntax.js +113 -26
  20. package/lib/javascript/JavascriptModulesPlugin.js +3 -10
  21. package/lib/loaders/LoaderRunner.js +33 -5
  22. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +8 -15
  23. package/lib/optimize/ConcatenatedModule.js +8 -0
  24. package/lib/optimize/ConstExportsPlugin.js +5 -0
  25. package/lib/optimize/InlineExports.js +121 -0
  26. package/lib/optimize/RealContentHashPlugin.js +111 -35
  27. package/lib/prefetch/ResourceHintPlugin.js +6 -12
  28. package/lib/typescript/TypeScriptPlugin.js +8 -10
  29. package/lib/util/SourceProcessor.js +24 -8
  30. package/lib/util/createMappings.js +25 -3
  31. package/lib/util/removeBOM.js +82 -1
  32. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +5 -3
  33. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +5 -3
  34. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +7 -12
  35. package/lib/web/FetchCompileAsyncWasmPlugin.js +10 -6
  36. package/lib/web/FetchCompileWasmPlugin.js +4 -2
  37. package/package.json +1 -1
  38. package/types.d.ts +69 -10
package/README.md CHANGED
@@ -98,18 +98,18 @@ interface](https://webpack.js.org/plugins/). Most of the features
98
98
  within webpack itself use this plugin interface. This makes webpack very
99
99
  **flexible**.
100
100
 
101
+ Webpack can generate HTML pages and extract CSS files itself, both experimental —
102
+ see what that covers, and what still needs a plugin, for
103
+ [CSS](https://webpack.js.org/guides/native-css/#whats-built-in) and
104
+ [HTML](https://webpack.js.org/guides/native-html/#whats-built-in).
105
+
101
106
  | Name | Status | Install Size | Description |
102
107
  | :---------------------------------------: | :----------------: | :-----------------: | :-------------------------------------------------------------------------------------- |
103
- | [mini-css-extract-plugin][mini-css] | ![mini-css-npm] | ![mini-css-size] | Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS. |
104
108
  | [compression-webpack-plugin][compression] | ![compression-npm] | ![compression-size] | Prepares compressed versions of assets to serve them with Content-Encoding |
105
109
  | [html-bundler-webpack-plugin][bundler] | ![bundler-npm] | ![bundler-size] | Renders a template (EJS, Handlebars, Pug) with referenced source asset files into HTML. |
106
- | [html-webpack-plugin][html-plugin] | ![html-plugin-npm] | ![html-plugin-size] | Simplifies creation of HTML files (`index.html`) to serve your bundles |
107
110
  | [pug-plugin][pug-plugin] | ![pug-plugin-npm] | ![pug-plugin-size] | Renders Pug files to HTML, extracts JS and CSS from sources specified directly in Pug. |
108
111
 
109
112
  [common-npm]: https://img.shields.io/npm/v/webpack.svg
110
- [mini-css]: https://github.com/webpack-contrib/mini-css-extract-plugin
111
- [mini-css-npm]: https://img.shields.io/npm/v/mini-css-extract-plugin.svg
112
- [mini-css-size]: https://packagephobia.com/badge?p=mini-css-extract-plugin
113
113
  [component]: https://github.com/webpack-contrib/component-webpack-plugin
114
114
  [component-npm]: https://img.shields.io/npm/v/component-webpack-plugin.svg
115
115
  [component-size]: https://packagephobia.com/badge?p=component-webpack-plugin
@@ -119,9 +119,6 @@ within webpack itself use this plugin interface. This makes webpack very
119
119
  [bundler]: https://github.com/webdiscus/html-bundler-webpack-plugin
120
120
  [bundler-npm]: https://img.shields.io/npm/v/html-bundler-webpack-plugin.svg
121
121
  [bundler-size]: https://packagephobia.com/badge?p=html-bundler-webpack-plugin
122
- [html-plugin]: https://github.com/jantimon/html-webpack-plugin
123
- [html-plugin-npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg
124
- [html-plugin-size]: https://packagephobia.com/badge?p=html-webpack-plugin
125
122
  [pug-plugin]: https://github.com/webdiscus/pug-plugin
126
123
  [pug-plugin-npm]: https://img.shields.io/npm/v/pug-plugin.svg
127
124
  [pug-plugin-size]: https://packagephobia.com/badge?p=pug-plugin
@@ -135,6 +132,11 @@ loaders](https://webpack.js.org/api/loaders/) using Node.js.
135
132
  Loaders are activated by using `loadername!` prefixes in `require()` statements,
136
133
  or are automatically applied via regex from your webpack configuration.
137
134
 
135
+ JavaScript, JSON and [assets](https://webpack.js.org/guides/asset-modules/) need no
136
+ loader, and [CSS](https://webpack.js.org/guides/native-css/#whats-built-in) and
137
+ [HTML](https://webpack.js.org/guides/native-html/#whats-built-in) have experimental
138
+ built-in support — but preprocessors and template engines keep their loaders.
139
+
138
140
  #### JSON
139
141
 
140
142
  | Name | Status | Install Size | Description |
@@ -163,14 +165,11 @@ or are automatically applied via regex from your webpack configuration.
163
165
 
164
166
  | Name | Status | Install Size | Description |
165
167
  | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------: | :--------------: | :-------------------------------------------------------------------------------------- |
166
- | <a href="https://github.com/webpack-contrib/html-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/html5/html5-original.svg"></a> | ![html-npm] | ![html-size] | Exports HTML as string, requires references to static resources |
167
168
  | <a href="https://github.com/webdiscus/pug-loader"><img width="48" height="48" src="https://cdn.rawgit.com/pugjs/pug-logo/master/SVG/pug-final-logo-_-colour-128.svg"></a> | ![pug-npm] | ![pug-size] | Compiles Pug to a function or HTML string, useful for use with Vue, React, Angular |
168
169
  | <a href="https://github.com/peerigon/markdown-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/markdown/markdown-original.svg"></a> | ![md-npm] | ![md-size] | Compiles Markdown to HTML |
169
170
  | <a href="https://github.com/posthtml/posthtml-loader"><img width="48" height="48" src="https://posthtml.github.io/posthtml/logo.svg"></a> | ![posthtml-npm] | ![posthtml-size] | Loads and transforms a HTML file using [PostHTML](https://github.com/posthtml/posthtml) |
170
171
  | <a href="https://github.com/pcardune/handlebars-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/handlebars/handlebars-original.svg"></a> | ![hbs-npm] | ![hbs-size] | Compiles Handlebars to HTML |
171
172
 
172
- [html-npm]: https://img.shields.io/npm/v/html-loader.svg
173
- [html-size]: https://packagephobia.com/badge?p=html-loader
174
173
  [pug-npm]: https://img.shields.io/npm/v/@webdiscus/pug-loader.svg
175
174
  [pug-size]: https://packagephobia.com/badge?p=@webdiscus/pug-loader
176
175
  [jade-npm]: https://img.shields.io/npm/v/jade-loader.svg
@@ -186,17 +185,11 @@ or are automatically applied via regex from your webpack configuration.
186
185
 
187
186
  | Name | Status | Install Size | Description |
188
187
  | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------: | :-------------: | :----------------------------------------------------------------------- |
189
- | <a href="https://github.com/webpack-contrib/style-loader">`<style>`</a> | ![style-npm] | ![style-size] | Add exports of a module as style to DOM |
190
- | <a href="https://github.com/webpack-contrib/css-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/css3/css3-original.svg"></a> | ![css-npm] | ![css-size] | Loads CSS file with resolved imports and returns CSS code |
191
188
  | <a href="https://github.com/webpack-contrib/less-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/less/less-plain-wordmark.svg"></a> | ![less-npm] | ![less-size] | Loads and compiles a LESS file |
192
189
  | <a href="https://github.com/webpack-contrib/sass-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/sass/sass-original.svg"></a> | ![sass-npm] | ![sass-size] | Loads and compiles a Sass/SCSS file |
193
190
  | <a href="https://github.com/shama/stylus-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/stylus/stylus-original.svg"></a> | ![stylus-npm] | ![stylus-size] | Loads and compiles a Stylus file |
194
191
  | <a href="https://github.com/postcss/postcss-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/postcss/postcss-original.svg"></a> | ![postcss-npm] | ![postcss-size] | Loads and transforms a CSS/SSS file using [PostCSS](https://postcss.org) |
195
192
 
196
- [style-npm]: https://img.shields.io/npm/v/style-loader.svg
197
- [style-size]: https://packagephobia.com/badge?p=style-loader
198
- [css-npm]: https://img.shields.io/npm/v/css-loader.svg
199
- [css-size]: https://packagephobia.com/badge?p=css-loader
200
193
  [less-npm]: https://img.shields.io/npm/v/less-loader.svg
201
194
  [less-size]: https://packagephobia.com/badge?p=less-loader
202
195
  [sass-npm]: https://img.shields.io/npm/v/sass-loader.svg
@@ -1747,6 +1747,16 @@ class ExportInfo {
1747
1747
  return result;
1748
1748
  }
1749
1749
 
1750
+ /**
1751
+ * Returns whether resolving the target leads back to this export, which
1752
+ * `getTarget` cannot express as it reports a cycle as "no target".
1753
+ * @param {ModuleGraph} moduleGraph the module graph
1754
+ * @returns {boolean} true, when the reexport chain is circular
1755
+ */
1756
+ hasCircularTarget(moduleGraph) {
1757
+ return this._getTarget(moduleGraph, RETURNS_TRUE, undefined) === CIRCULAR;
1758
+ }
1759
+
1750
1760
  /**
1751
1761
  * Returns the target.
1752
1762
  * @param {ModuleGraph} moduleGraph the module graph