html-webpack-plugin 5.6.3 → 5.6.5
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/index.js +23 -58
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -632,62 +632,23 @@ class HtmlWebpackPlugin {
|
|
|
632
632
|
const templateWithoutLoaders = templateFilename
|
|
633
633
|
.replace(/^.+!/, "")
|
|
634
634
|
.replace(/\?.+$/, "");
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
CustomEvent: global.CustomEvent,
|
|
653
|
-
DecompressionStream: global.DecompressionStream,
|
|
654
|
-
Event: global.Event,
|
|
655
|
-
EventTarget: global.EventTarget,
|
|
656
|
-
File: global.File,
|
|
657
|
-
FormData: global.FormData,
|
|
658
|
-
Headers: global.Headers,
|
|
659
|
-
MessageChannel: global.MessageChannel,
|
|
660
|
-
MessageEvent: global.MessageEvent,
|
|
661
|
-
MessagePort: global.MessagePort,
|
|
662
|
-
PerformanceEntry: global.PerformanceEntry,
|
|
663
|
-
PerformanceMark: global.PerformanceMark,
|
|
664
|
-
PerformanceMeasure: global.PerformanceMeasure,
|
|
665
|
-
PerformanceObserver: global.PerformanceObserver,
|
|
666
|
-
PerformanceObserverEntryList: global.PerformanceObserverEntryList,
|
|
667
|
-
PerformanceResourceTiming: global.PerformanceResourceTiming,
|
|
668
|
-
ReadableByteStreamController: global.ReadableByteStreamController,
|
|
669
|
-
ReadableStream: global.ReadableStream,
|
|
670
|
-
ReadableStreamBYOBReader: global.ReadableStreamBYOBReader,
|
|
671
|
-
ReadableStreamBYOBRequest: global.ReadableStreamBYOBRequest,
|
|
672
|
-
ReadableStreamDefaultController: global.ReadableStreamDefaultController,
|
|
673
|
-
ReadableStreamDefaultReader: global.ReadableStreamDefaultReader,
|
|
674
|
-
Response: global.Response,
|
|
675
|
-
Request: global.Request,
|
|
676
|
-
SubtleCrypto: global.SubtleCrypto,
|
|
677
|
-
DOMException: global.DOMException,
|
|
678
|
-
TextDecoder: global.TextDecoder,
|
|
679
|
-
TextDecoderStream: global.TextDecoderStream,
|
|
680
|
-
TextEncoder: global.TextEncoder,
|
|
681
|
-
TextEncoderStream: global.TextEncoderStream,
|
|
682
|
-
TransformStream: global.TransformStream,
|
|
683
|
-
TransformStreamDefaultController: global.TransformStreamDefaultController,
|
|
684
|
-
URL: global.URL,
|
|
685
|
-
URLSearchParams: global.URLSearchParams,
|
|
686
|
-
WebAssembly: global.WebAssembly,
|
|
687
|
-
WritableStream: global.WritableStream,
|
|
688
|
-
WritableStreamDefaultController: global.WritableStreamDefaultController,
|
|
689
|
-
WritableStreamDefaultWriter: global.WritableStreamDefaultWriter,
|
|
690
|
-
});
|
|
635
|
+
const globalClone = Object.create(
|
|
636
|
+
Object.getPrototypeOf(global),
|
|
637
|
+
Object.getOwnPropertyDescriptors(global),
|
|
638
|
+
);
|
|
639
|
+
// Presence of `eval` breaks template's explicit `eval` call, might be a bug in Node
|
|
640
|
+
delete globalClone.eval;
|
|
641
|
+
// Not using `...global` as it throws when localStorage is not explicitly enabled in Node 25+
|
|
642
|
+
const vmContext = vm.createContext(
|
|
643
|
+
Object.assign(globalClone, {
|
|
644
|
+
HTML_WEBPACK_PLUGIN: true,
|
|
645
|
+
// Copying nonstandard globals like `require` explicitly as they may be absent from `global`
|
|
646
|
+
require: require,
|
|
647
|
+
htmlWebpackPluginPublicPath: publicPath,
|
|
648
|
+
__filename: templateWithoutLoaders,
|
|
649
|
+
__dirname: path.dirname(templateWithoutLoaders),
|
|
650
|
+
}),
|
|
651
|
+
);
|
|
691
652
|
|
|
692
653
|
const vmScript = new vm.Script(source, {
|
|
693
654
|
filename: templateWithoutLoaders,
|
|
@@ -1307,7 +1268,9 @@ class HtmlWebpackPlugin {
|
|
|
1307
1268
|
|
|
1308
1269
|
if ("error" in templateResult) {
|
|
1309
1270
|
compilation.errors.push(
|
|
1310
|
-
|
|
1271
|
+
new Error(
|
|
1272
|
+
prettyError(templateResult.error, compiler.context).toString(),
|
|
1273
|
+
),
|
|
1311
1274
|
);
|
|
1312
1275
|
}
|
|
1313
1276
|
|
|
@@ -1497,7 +1460,9 @@ class HtmlWebpackPlugin {
|
|
|
1497
1460
|
.catch((err) => {
|
|
1498
1461
|
// In case anything went wrong the promise is resolved
|
|
1499
1462
|
// with the error message and an error is logged
|
|
1500
|
-
compilation.errors.push(
|
|
1463
|
+
compilation.errors.push(
|
|
1464
|
+
new Error(prettyError(err, compiler.context).toString()),
|
|
1465
|
+
);
|
|
1501
1466
|
return this.options.showErrors
|
|
1502
1467
|
? prettyError(err, compiler.context).toHtml()
|
|
1503
1468
|
: "ERROR";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-webpack-plugin",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.5",
|
|
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)",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"standard-version": "^9.3.0",
|
|
59
59
|
"style-loader": "2.0.0",
|
|
60
60
|
"typescript": "4.9.4",
|
|
61
|
-
"webpack": "^5.
|
|
61
|
+
"webpack": "^5.101.0",
|
|
62
62
|
"webpack-cli": "4.5.0",
|
|
63
63
|
"webpack-recompilation-simulator": "3.2.0"
|
|
64
64
|
},
|