html-webpack-plugin 5.0.0-beta.5 → 5.2.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.
- package/CHANGELOG.md +49 -0
- package/README.md +7 -3
- package/index.js +20 -4
- package/lib/child-compiler.js +11 -1
- package/lib/hooks.js +2 -0
- package/lib/html-tags.js +8 -4
- package/package.json +4 -5
- package/typings.d.ts +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.1.0...v5.2.0) (2021-02-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* improve ssr ([73d2a66](https://github.com/jantimon/html-webpack-plugin/commit/73d2a660b10b9ebf8a341f0ddb173bcaaf1e513c))
|
|
11
|
+
|
|
12
|
+
## [5.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.0.0...v5.1.0) (2021-02-12)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* omit html tag attribute with null/undefined/false value ([aa6e78d](https://github.com/jantimon/html-webpack-plugin/commit/aa6e78d1430c17d9cf05550b2c9f73a9a0c0166c)), closes [#1598](https://github.com/jantimon/html-webpack-plugin/issues/1598)
|
|
18
|
+
|
|
19
|
+
## [5.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v5.0.0) (2021-02-03)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### ⚠ BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* Drop support for `webpack` 4 and `node` <= 10 - For older webpack or node versions please use `html-webpack-plugin` 4.x
|
|
25
|
+
* Entry javascript resources are now beeing loaded deferred in the `<head>` tag to improve the page load performance by default - You can set the `scriptLoading` option to `'blocking'` to keep the previous behaviour
|
|
26
|
+
* Setting publicPath to `''` (an empty string) will no longer calculate a relative path from the html file to the assets anymore - You can set the `publicPath` option to `'auto'` to keep the previous behaviour
|
|
27
|
+
* Plugins for `html-webpack-plugin` which add additional assetTags should provide a `meta` attribute
|
|
28
|
+
* Drop support for `appcache-webpack-plugin`
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* drop `webpack` 4 and `node` <= 10 support to make use of the latest APIs ([b7a9e8f](https://github.com/jantimon/html-webpack-plugin/commit/b7a9e8f2a3c146cfec8f5c42888abd6aa0cde0b9))
|
|
33
|
+
* use the new webpack 5 APIs and create html files during the new `webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS` compilation stage ([8964bc4](https://github.com/jantimon/html-webpack-plugin/commit/8964bc4182e41807a564d3000217a40bc5f93ad2), [b6895cb](https://github.com/jantimon/html-webpack-plugin/commit/b6895cb5b85b1e6e850f638470cf9b839d421516), [a97234e](https://github.com/jantimon/html-webpack-plugin/commit/a97234ead5ea2dbba07a6e6a70c5ddb6a5a3c288), [1b59e09](https://github.com/jantimon/html-webpack-plugin/commit/1b59e0944f561b264f11847ef245c9fc3f05b80f), [4fca596](https://github.com/jantimon/html-webpack-plugin/commit/4fca5965315c49f6706812d9fdf6c7284d23d75b), [ed64a6b](https://github.com/jantimon/html-webpack-plugin/commit/ed64a6b35fe9cdbc610e9b766700f3b2fc2b8e4c), [86245db](https://github.com/jantimon/html-webpack-plugin/commit/86245db670a9b3bdd0e2aba9f2031745a98434c7), [50b3bec](https://github.com/jantimon/html-webpack-plugin/commit/50b3bec51a43289d6d1b4e1e6439560eb791576f), [c697725](https://github.com/jantimon/html-webpack-plugin/commit/c697725e9f4dd990bd4b7927bbfa7b826d2f36f2))
|
|
34
|
+
* allow generating one file per chunk with the new `'[name]'` placeholder for the `filename` option ([cd5bd2a](https://github.com/jantimon/html-webpack-plugin/commit/cd5bd2afc902bbe5a5ceec4756ef634a26aa1332), [3d9ff48](https://github.com/jantimon/html-webpack-plugin/commit/3d9ff48543d04d9f7c3440bfefb43751775a9e81))
|
|
35
|
+
* the `filename` option can now be a function ([c5beb4b](https://github.com/jantimon/html-webpack-plugin/commit/c5beb4bd16e4916b5355c300abebf9d7d3c587da))
|
|
36
|
+
* add support for `'auto'` public paths inside templates ([a059fcf](https://github.com/jantimon/html-webpack-plugin/commit/a059fcf32d94aaaa738359cedce0b0e4af68f0de), [b09b439](https://github.com/jantimon/html-webpack-plugin/commit/b09b439f50ecb75994acde2eb2967ad690ff1cf0))
|
|
37
|
+
* use defer as default script loading mechanism ([35b6b87](https://github.com/jantimon/html-webpack-plugin/commit/35b6b878db17f0f5704a187b336a14fdd58cedfc))
|
|
38
|
+
* allow to set publicPath to an empty string `''` ([5ea7de4](https://github.com/jantimon/html-webpack-plugin/commit/5ea7de4ba271813835be700316c8a1763b205d2d))
|
|
39
|
+
* improve typings ([197ddd8](https://github.com/jantimon/html-webpack-plugin/commit/197ddd88f39a2e6e70863b6fed2385d33043d137))
|
|
40
|
+
* provide public path to the alterAssetTagGroups hook ([1b54dfb](https://github.com/jantimon/html-webpack-plugin/commit/1b54dfbd62c0d0df10dd3d2be9937626142d518f))
|
|
41
|
+
* provide public path to the alterAssetTags hook ([b754626](https://github.com/jantimon/html-webpack-plugin/commit/b75462653d11803a428b1d29479e259c3010163f))
|
|
42
|
+
* use `thisCompilation` in child compiler for faster builds ([1d59e9a](https://github.com/jantimon/html-webpack-plugin/commit/1d59e9a71ddba1429168c42569a7bd9bdd363f4f))
|
|
43
|
+
* export new major in static property ([8b692bd](https://github.com/jantimon/html-webpack-plugin/commit/8b692bd7cc0b75ddf55f47da317eed9bd19dab91))
|
|
44
|
+
* reduce dependencies ([8c28aaa](https://github.com/jantimon/html-webpack-plugin/commit/8c28aaa2bed5a7147b397fef3801cfe8fb5c34b9), [56e633f](https://github.com/jantimon/html-webpack-plugin/commit/56e633fcb90909c2bbedbd63590ecaa825d8b31f))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* emit files on every build to work properly with plugins like the
|
|
50
|
+
clean-webpack-plugin ([6b3d087](https://github.com/jantimon/html-webpack-plugin/commit/6b3d087cf17f63b596c298d70a42a7462dd0f881))
|
|
51
|
+
* generate html files even if no webpack entry exists ([2693dfa](https://github.com/jantimon/html-webpack-plugin/commit/2693dfaf4c94625eab86afadfd0e4d8822092d6b))
|
|
52
|
+
* keep binary format when adding assets ([7e2b208](https://github.com/jantimon/html-webpack-plugin/commit/7e2b208634e26299c509e0c6b3189e01e4c3d3df)), closes [#1537](https://github.com/jantimon/html-webpack-plugin/issues/1537)
|
|
53
|
+
|
|
5
54
|
### [4.5.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.0...v4.5.1) (2021-01-03)
|
|
6
55
|
|
|
7
56
|
|
package/README.md
CHANGED
|
@@ -88,6 +88,8 @@ The `html-webpack-plugin` provides [hooks](https://github.com/jantimon/html-webp
|
|
|
88
88
|
* [csp-html-webpack-plugin](https://github.com/slackhq/csp-html-webpack-plugin) to add [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) meta tags to the HTML output
|
|
89
89
|
* [webpack-nomodule-plugin](https://github.com/swimmadude66/webpack-nomodule-plugin) allows you to add a `nomodule` attribute to specific injected scripts, which prevents the scripts from being loaded by newer browsers. Good for limiting loads of polyfills.
|
|
90
90
|
* [html-webpack-skip-assets-plugin](https://github.com/swimmadude66/html-webpack-skip-assets-plugin) Skip adding certain output files to the html file. Built as a drop-in replacement for [html-webpack-exclude-assets-plugin](https://www.npmjs.com/package/html-webpack-exclude-assets-plugin) and works with newer [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) versions
|
|
91
|
+
* [html-webpack-inject-preload](https://github.com/principalstudio/html-webpack-inject-preload) allows to add preload links <link rel='preload'> anywhere you want.
|
|
92
|
+
|
|
91
93
|
|
|
92
94
|
|
|
93
95
|
<h2 align="center">Usage</h2>
|
|
@@ -148,7 +150,7 @@ Allowed values are as follows:
|
|
|
148
150
|
|**`templateParameters`**|`{Boolean\|Object\|Function}`| `false`| Allows to overwrite the parameters used in the template - see [example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/template-parameters) |
|
|
149
151
|
|**`inject`**|`{Boolean\|String}`|`true`|`true \|\| 'head' \|\| 'body' \|\| false` Inject all assets into the given `template` or `templateContent`. When passing `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. Passing `true` will add it to the head/body depending on the `scriptLoading` option. Passing `false` will disable automatic injections. - see the [inject:false example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/custom-insertion-position)|
|
|
150
152
|
|**`publicPath`**|`{String\|'auto'}`|`'auto'`|The publicPath used for script and link tags|
|
|
151
|
-
|**`scriptLoading`**|`{'blocking'\|'defer'}`|`'
|
|
153
|
+
|**`scriptLoading`**|`{'blocking'\|'defer'}`|`'defer'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. |
|
|
152
154
|
|**`favicon`**|`{String}`|``|Adds the given favicon path to the output HTML|
|
|
153
155
|
|**`meta`**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`|
|
|
154
156
|
|**`base`**|`{Object\|String\|false}`|`false`|Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. E.g. `base: "https://example.com/path/page.html`|
|
|
@@ -519,6 +521,7 @@ about which values are passed.
|
|
|
519
521
|
styles: Array<HtmlTagObject>,
|
|
520
522
|
meta: Array<HtmlTagObject>,
|
|
521
523
|
},
|
|
524
|
+
publicPath: string,
|
|
522
525
|
outputName: string,
|
|
523
526
|
plugin: HtmlWebpackPlugin
|
|
524
527
|
}>
|
|
@@ -530,6 +533,7 @@ about which values are passed.
|
|
|
530
533
|
AsyncSeriesWaterfallHook<{
|
|
531
534
|
headTags: Array<HtmlTagObject | HtmlTagObject>,
|
|
532
535
|
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
|
|
536
|
+
publicPath: string,
|
|
533
537
|
outputName: string,
|
|
534
538
|
plugin: HtmlWebpackPlugin
|
|
535
539
|
}>
|
|
@@ -666,5 +670,5 @@ This project uses the [semistandard code style](https://github.com/Flet/semistan
|
|
|
666
670
|
[deps]: https://david-dm.org/jantimon/html-webpack-plugin.svg
|
|
667
671
|
[deps-url]: https://david-dm.org/jantimon/html-webpack-plugin
|
|
668
672
|
|
|
669
|
-
[tests]:
|
|
670
|
-
[tests-url]: https://
|
|
673
|
+
[tests]: https://github.com/jantimon/html-webpack-plugin/workflows/CI/badge.svg
|
|
674
|
+
[tests-url]: https://github.com/jantimon/html-webpack-plugin/actions?query=workflow%3ACI
|
package/index.js
CHANGED
|
@@ -123,12 +123,20 @@ class HtmlWebpackPlugin {
|
|
|
123
123
|
return Promise.reject(new Error('The child compilation didn\'t provide a result'));
|
|
124
124
|
}
|
|
125
125
|
// The LibraryTemplatePlugin stores the template result in a local variable.
|
|
126
|
-
//
|
|
127
|
-
if (source
|
|
126
|
+
// By adding it to the end the value gets extracted during evaluation
|
|
127
|
+
if (source.indexOf('HTML_WEBPACK_PLUGIN_RESULT') >= 0) {
|
|
128
128
|
source += ';\nHTML_WEBPACK_PLUGIN_RESULT';
|
|
129
129
|
}
|
|
130
130
|
const templateWithoutLoaders = templateFilename.replace(/^.+!/, '').replace(/\?.+$/, '');
|
|
131
|
-
const vmContext = vm.createContext({
|
|
131
|
+
const vmContext = vm.createContext({
|
|
132
|
+
...global,
|
|
133
|
+
HTML_WEBPACK_PLUGIN: true,
|
|
134
|
+
require: require,
|
|
135
|
+
htmlWebpackPluginPublicPath:
|
|
136
|
+
publicPath,
|
|
137
|
+
URL: require('url').URL,
|
|
138
|
+
__filename: templateWithoutLoaders
|
|
139
|
+
});
|
|
132
140
|
const vmScript = new vm.Script(source, { filename: templateWithoutLoaders });
|
|
133
141
|
// Evaluate code and cast to string
|
|
134
142
|
let newSource;
|
|
@@ -147,7 +155,8 @@ class HtmlWebpackPlugin {
|
|
|
147
155
|
}
|
|
148
156
|
|
|
149
157
|
/**
|
|
150
|
-
*
|
|
158
|
+
* connect the html-webpack-plugin to the webpack compiler lifecycle hooks
|
|
159
|
+
*
|
|
151
160
|
* @param {import('webpack').Compiler} compiler
|
|
152
161
|
* @param {ProcessedHtmlWebpackOptions} options
|
|
153
162
|
* @param {HtmlWebpackPlugin} plugin
|
|
@@ -298,6 +307,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
298
307
|
]
|
|
299
308
|
},
|
|
300
309
|
outputName: childCompilationOutputName,
|
|
310
|
+
publicPath: htmlPublicPath,
|
|
301
311
|
plugin: plugin
|
|
302
312
|
}))
|
|
303
313
|
.then(({ assetTags }) => {
|
|
@@ -311,6 +321,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
311
321
|
headTags: assetGroups.headTags,
|
|
312
322
|
bodyTags: assetGroups.bodyTags,
|
|
313
323
|
outputName: childCompilationOutputName,
|
|
324
|
+
publicPath: htmlPublicPath,
|
|
314
325
|
plugin: plugin
|
|
315
326
|
});
|
|
316
327
|
});
|
|
@@ -715,6 +726,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
715
726
|
return jsAssets.map(scriptAsset => ({
|
|
716
727
|
tagName: 'script',
|
|
717
728
|
voidTag: false,
|
|
729
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
718
730
|
attributes: {
|
|
719
731
|
defer: options.scriptLoading !== 'blocking',
|
|
720
732
|
src: scriptAsset
|
|
@@ -731,6 +743,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
731
743
|
return cssAssets.map(styleAsset => ({
|
|
732
744
|
tagName: 'link',
|
|
733
745
|
voidTag: true,
|
|
746
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
734
747
|
attributes: {
|
|
735
748
|
href: styleAsset,
|
|
736
749
|
rel: 'stylesheet'
|
|
@@ -753,6 +766,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
753
766
|
return [{
|
|
754
767
|
tagName: 'base',
|
|
755
768
|
voidTag: true,
|
|
769
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
756
770
|
attributes: (typeof baseOption === 'string') ? {
|
|
757
771
|
href: baseOption
|
|
758
772
|
} : baseOption
|
|
@@ -795,6 +809,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
795
809
|
return {
|
|
796
810
|
tagName: 'meta',
|
|
797
811
|
voidTag: true,
|
|
812
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
798
813
|
attributes: metaTagAttributes
|
|
799
814
|
};
|
|
800
815
|
});
|
|
@@ -812,6 +827,7 @@ function hookIntoCompiler (compiler, options, plugin) {
|
|
|
812
827
|
return [{
|
|
813
828
|
tagName: 'link',
|
|
814
829
|
voidTag: true,
|
|
830
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
815
831
|
attributes: {
|
|
816
832
|
rel: 'icon',
|
|
817
833
|
href: faviconPath
|
package/lib/child-compiler.js
CHANGED
|
@@ -75,6 +75,7 @@ class HtmlWebpackChildCompiler {
|
|
|
75
75
|
const webpack = mainCompilation.compiler.webpack;
|
|
76
76
|
const Compilation = webpack.Compilation;
|
|
77
77
|
|
|
78
|
+
const NodeTemplatePlugin = webpack.node.NodeTemplatePlugin;
|
|
78
79
|
const NodeTargetPlugin = webpack.node.NodeTargetPlugin;
|
|
79
80
|
const LoaderTargetPlugin = webpack.LoaderTargetPlugin;
|
|
80
81
|
const EntryPlugin = webpack.EntryPlugin;
|
|
@@ -103,6 +104,7 @@ class HtmlWebpackChildCompiler {
|
|
|
103
104
|
const childCompiler = mainCompilation.createChildCompiler(compilerName, outputOptions, [
|
|
104
105
|
// Compile the template to nodejs javascript
|
|
105
106
|
new NodeTargetPlugin(),
|
|
107
|
+
new NodeTemplatePlugin(),
|
|
106
108
|
new LoaderTargetPlugin('node'),
|
|
107
109
|
new webpack.library.EnableLibraryPlugin('var')
|
|
108
110
|
]);
|
|
@@ -114,10 +116,18 @@ class HtmlWebpackChildCompiler {
|
|
|
114
116
|
|
|
115
117
|
// Add all templates
|
|
116
118
|
this.templates.forEach((template, index) => {
|
|
117
|
-
new EntryPlugin(childCompiler.context, 'data:text/javascript,__webpack_public_path__ = htmlWebpackPluginPublicPath;', `HtmlWebpackPlugin_${index}-${this.id}`).apply(childCompiler);
|
|
119
|
+
new EntryPlugin(childCompiler.context, 'data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;', `HtmlWebpackPlugin_${index}-${this.id}`).apply(childCompiler);
|
|
118
120
|
new EntryPlugin(childCompiler.context, template, `HtmlWebpackPlugin_${index}-${this.id}`).apply(childCompiler);
|
|
119
121
|
});
|
|
120
122
|
|
|
123
|
+
// The templates are compiled and executed by NodeJS - similar to server side rendering
|
|
124
|
+
// Unfortunately this causes issues as some loaders require an absolute URL to support ES Modules
|
|
125
|
+
// The following config enables relative URL support for the child compiler
|
|
126
|
+
childCompiler.options.module = { ...childCompiler.options.module };
|
|
127
|
+
childCompiler.options.module.parser = { ...childCompiler.options.module.parser };
|
|
128
|
+
childCompiler.options.module.parser.javascript = { ...childCompiler.options.module.parser.javascript,
|
|
129
|
+
url: 'relative' };
|
|
130
|
+
|
|
121
131
|
this.compilationStartedTimestamp = new Date().getTime();
|
|
122
132
|
this.compilationPromise = new Promise((resolve, reject) => {
|
|
123
133
|
const extractedAssets = [];
|
package/lib/hooks.js
CHANGED
|
@@ -32,6 +32,7 @@ const AsyncSeriesWaterfallHook = require('tapable').AsyncSeriesWaterfallHook;
|
|
|
32
32
|
styles: Array<HtmlTagObject>,
|
|
33
33
|
meta: Array<HtmlTagObject>,
|
|
34
34
|
},
|
|
35
|
+
publicPath: string,
|
|
35
36
|
outputName: string,
|
|
36
37
|
plugin: HtmlWebpackPlugin
|
|
37
38
|
}>,
|
|
@@ -39,6 +40,7 @@ const AsyncSeriesWaterfallHook = require('tapable').AsyncSeriesWaterfallHook;
|
|
|
39
40
|
AsyncSeriesWaterfallHook<{
|
|
40
41
|
headTags: Array<HtmlTagObject | HtmlTagObject>,
|
|
41
42
|
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
|
|
43
|
+
publicPath: string,
|
|
42
44
|
outputName: string,
|
|
43
45
|
plugin: HtmlWebpackPlugin
|
|
44
46
|
}>,
|
package/lib/html-tags.js
CHANGED
|
@@ -25,12 +25,12 @@ const voidTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'k
|
|
|
25
25
|
* A tag element according to the htmlWebpackPlugin object notation
|
|
26
26
|
*
|
|
27
27
|
* @param xhtml {boolean}
|
|
28
|
-
*
|
|
28
|
+
* Whether the generated html should add closing slashes to be xhtml compliant
|
|
29
29
|
*/
|
|
30
30
|
function htmlTagObjectToString (tagDefinition, xhtml) {
|
|
31
31
|
const attributes = Object.keys(tagDefinition.attributes || {})
|
|
32
32
|
.filter(function (attributeName) {
|
|
33
|
-
return tagDefinition.attributes[attributeName]
|
|
33
|
+
return tagDefinition.attributes[attributeName] === '' || tagDefinition.attributes[attributeName];
|
|
34
34
|
})
|
|
35
35
|
.map(function (attributeName) {
|
|
36
36
|
if (tagDefinition.attributes[attributeName] === true) {
|
|
@@ -49,18 +49,22 @@ function htmlTagObjectToString (tagDefinition, xhtml) {
|
|
|
49
49
|
* @param {string} tagName
|
|
50
50
|
* the name of the tag e.g. 'div'
|
|
51
51
|
*
|
|
52
|
-
* @param {{[attributeName: string]: string|boolean}} [attributes]
|
|
52
|
+
* @param {{[attributeName: string]: string|boolean|null|undefined}} [attributes]
|
|
53
53
|
* tag attributes e.g. `{ 'class': 'example', disabled: true }`
|
|
54
54
|
*
|
|
55
55
|
* @param {string} [innerHTML]
|
|
56
56
|
*
|
|
57
|
+
* @param {{[attributeName: string]: string|boolean|null|undefined}} [meta]
|
|
58
|
+
* meta information about the tag e.g. `{ 'plugin': 'html-webpack-plugin' }`
|
|
59
|
+
*
|
|
57
60
|
* @returns {HtmlTagObject}
|
|
58
61
|
*/
|
|
59
|
-
function createHtmlTagObject (tagName, attributes, innerHTML) {
|
|
62
|
+
function createHtmlTagObject (tagName, attributes, innerHTML, meta) {
|
|
60
63
|
return {
|
|
61
64
|
tagName: tagName,
|
|
62
65
|
voidTag: voidTags.indexOf(tagName) !== -1,
|
|
63
66
|
attributes: attributes || {},
|
|
67
|
+
meta: meta || {},
|
|
64
68
|
innerHTML: innerHTML
|
|
65
69
|
};
|
|
66
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-webpack-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Simplifies creation of HTML files to serve your webpack bundles",
|
|
6
6
|
"author": "Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)",
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
"css-loader": "5.0.1",
|
|
35
35
|
"cz-conventional-changelog": "2.1.0",
|
|
36
36
|
"dir-compare": "1.7.2",
|
|
37
|
-
"
|
|
38
|
-
"html-loader": "1.3.2",
|
|
37
|
+
"html-loader": "2.0.0",
|
|
39
38
|
"jest": "26.5.3",
|
|
40
39
|
"mini-css-extract-plugin": "1.0.0",
|
|
41
40
|
"pug": "2.0.3",
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
"standard-version": "9.1.0",
|
|
47
46
|
"style-loader": "2.0.0",
|
|
48
47
|
"typescript": "4.1.3",
|
|
49
|
-
"webpack": "
|
|
48
|
+
"webpack": "5.23.0",
|
|
50
49
|
"webpack-recompilation-simulator": "3.2.0",
|
|
51
50
|
"webpack-cli": "4.2.0"
|
|
52
51
|
},
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
"tapable": "^2.0.0"
|
|
60
59
|
},
|
|
61
60
|
"peerDependencies": {
|
|
62
|
-
"webpack": "^5.
|
|
61
|
+
"webpack": "^5.20.0"
|
|
63
62
|
},
|
|
64
63
|
"keywords": [
|
|
65
64
|
"webpack",
|
package/typings.d.ts
CHANGED
|
@@ -209,6 +209,7 @@ declare namespace HtmlWebpackPlugin {
|
|
|
209
209
|
styles: HtmlTagObject[];
|
|
210
210
|
meta: HtmlTagObject[];
|
|
211
211
|
};
|
|
212
|
+
publicPath: string,
|
|
212
213
|
outputName: string;
|
|
213
214
|
plugin: HtmlWebpackPlugin;
|
|
214
215
|
}>;
|
|
@@ -217,6 +218,7 @@ declare namespace HtmlWebpackPlugin {
|
|
|
217
218
|
headTags: HtmlTagObject[];
|
|
218
219
|
bodyTags: HtmlTagObject[];
|
|
219
220
|
outputName: string;
|
|
221
|
+
publicPath: string,
|
|
220
222
|
plugin: HtmlWebpackPlugin;
|
|
221
223
|
}>;
|
|
222
224
|
|
|
@@ -261,7 +263,7 @@ declare namespace HtmlWebpackPlugin {
|
|
|
261
263
|
* E.g. `{'disabled': true, 'value': 'demo'}`
|
|
262
264
|
*/
|
|
263
265
|
attributes: {
|
|
264
|
-
[attributeName: string]: string | boolean;
|
|
266
|
+
[attributeName: string]: string | boolean | null | undefined;
|
|
265
267
|
};
|
|
266
268
|
/**
|
|
267
269
|
* The tag name e.g. `'div'`
|
|
@@ -276,5 +278,13 @@ declare namespace HtmlWebpackPlugin {
|
|
|
276
278
|
* @see https://www.w3.org/TR/html5/syntax.html#void-elements
|
|
277
279
|
*/
|
|
278
280
|
voidTag: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Meta information about the tag
|
|
283
|
+
* E.g. `{'plugin': 'html-webpack-plugin'}`
|
|
284
|
+
*/
|
|
285
|
+
meta: {
|
|
286
|
+
plugin?: string,
|
|
287
|
+
[metaAttributeName: string]: any;
|
|
288
|
+
};
|
|
279
289
|
}
|
|
280
290
|
}
|