@caweb/html-webpack-plugin 2.0.2 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/index.js +7 -5
- package/package.json +5 -5
- package/tests/webpack.tests.js +3 -11
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -67,6 +67,8 @@ const processAssets = ( assets = [] , type = 'style') => {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
const pluginName = 'CAWebHTMLPlugin';
|
|
71
|
+
|
|
70
72
|
/**
|
|
71
73
|
* Launches CAWeb HTML Markup
|
|
72
74
|
*
|
|
@@ -79,7 +81,7 @@ const processAssets = ( assets = [] , type = 'style') => {
|
|
|
79
81
|
* @typedef {CAWebHTMLPlugin}
|
|
80
82
|
* @extends {HtmlWebpackPlugin}
|
|
81
83
|
*/
|
|
82
|
-
class
|
|
84
|
+
class CAWebHTMLPlugin extends HtmlWebpackPlugin{
|
|
83
85
|
|
|
84
86
|
// we change some of the html-webpack-plugin defaults
|
|
85
87
|
constructor(opts = {}) {
|
|
@@ -200,14 +202,14 @@ class CAWebHtmlWebpackPlugin extends HtmlWebpackPlugin{
|
|
|
200
202
|
apply(compiler) {
|
|
201
203
|
super.apply(compiler);
|
|
202
204
|
|
|
203
|
-
compiler.hooks.compilation.tap(
|
|
205
|
+
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
204
206
|
/**
|
|
205
207
|
* Hook into the HtmlWebpackPlugin events
|
|
206
208
|
*
|
|
207
209
|
* @link https://github.com/jantimon/html-webpack-plugin?tab=readme-ov-file#events
|
|
208
210
|
*/
|
|
209
211
|
HtmlWebpackPlugin.getCompilationHooks(compilation).beforeEmit.tapAsync(
|
|
210
|
-
|
|
212
|
+
pluginName,
|
|
211
213
|
({html, outputName, plugin}, cb) => {
|
|
212
214
|
// if the html contains local assets those assets are added to the options.assets array
|
|
213
215
|
// and the assets are added to the compilation afterEmit
|
|
@@ -241,7 +243,7 @@ class CAWebHtmlWebpackPlugin extends HtmlWebpackPlugin{
|
|
|
241
243
|
);
|
|
242
244
|
|
|
243
245
|
HtmlWebpackPlugin.getCompilationHooks(compilation).afterEmit.tapAsync(
|
|
244
|
-
|
|
246
|
+
pluginName,
|
|
245
247
|
({outputName, plugin}, cb) => {
|
|
246
248
|
|
|
247
249
|
// if there are any assets in the options.assets array
|
|
@@ -292,4 +294,4 @@ class CAWebHtmlWebpackPlugin extends HtmlWebpackPlugin{
|
|
|
292
294
|
} // end of class
|
|
293
295
|
|
|
294
296
|
|
|
295
|
-
export default
|
|
297
|
+
export default CAWebHTMLPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caweb/html-webpack-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "CAWebPublishing Site Generation HTML Webpack Plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@caweb/framework": "^1.9.
|
|
29
|
-
"@caweb/icon-library": "^1.1.
|
|
30
|
-
"@caweb/template": "^1.0.
|
|
28
|
+
"@caweb/framework": "^1.9.4",
|
|
29
|
+
"@caweb/icon-library": "^1.1.7",
|
|
30
|
+
"@caweb/template": "^1.0.13",
|
|
31
31
|
"html-webpack-plugin": "^5.6.6"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"test": "echo \"Error: run tests from root\" && exit 0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"webpack": "^5.
|
|
40
|
+
"webpack": "^5.105.1",
|
|
41
41
|
"webpack-cli": "^6.0.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/tests/webpack.tests.js
CHANGED
|
@@ -12,21 +12,13 @@ import path from 'path';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
// we import this current plugin to test it
|
|
15
|
-
import
|
|
15
|
+
import CAWebHTMLPlugin from '../index.js';
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
18
|
plugins: [
|
|
19
|
-
new
|
|
19
|
+
new CAWebHTMLPlugin({
|
|
20
20
|
templateParameters: {
|
|
21
21
|
}
|
|
22
22
|
})
|
|
23
|
-
]
|
|
24
|
-
devServer: {
|
|
25
|
-
static: [
|
|
26
|
-
// we all serving the local template media files for testing
|
|
27
|
-
{
|
|
28
|
-
directory: path.join( process.cwd(), '..', 'template', 'media' ),
|
|
29
|
-
},
|
|
30
|
-
]
|
|
31
|
-
}
|
|
23
|
+
]
|
|
32
24
|
};
|