script-ext-html-webpack-plugin
Advanced tools
Comparing version 2.0.1 to 2.0.3
'use strict'; | ||
const htmlWebpackPlugin = require('html-webpack-plugin'); | ||
const { EVENT, PLUGIN } = require('./constants.js'); | ||
@@ -50,3 +52,4 @@ | ||
if (compilation.hooks) { | ||
compilation.hooks.htmlWebpackPluginAlterAssetTags.tap(PLUGIN, alterAssetTags); | ||
const alterAssetTagGroups = compilation.hooks.htmlWebpackPluginAlterAssetTags || htmlWebpackPlugin.getHooks(compilation).alterAssetTagGroups; | ||
alterAssetTagGroups.tap(PLUGIN, alterAssetTags); | ||
} else { | ||
@@ -59,2 +62,4 @@ compilation.plugin(EVENT, alterAssetTags); | ||
const options = this.options; | ||
const headTagName = pluginArgs.hasOwnProperty('headTags') ? 'headTags' : 'head'; | ||
const bodyTagName = pluginArgs.hasOwnProperty('bodyTags') ? 'bodyTags' : 'body'; | ||
try { | ||
@@ -66,12 +71,12 @@ options.htmlWebpackOptions = getHtmlWebpackOptions(pluginArgs); | ||
debugEvent('replacing <head> <script> elements'); | ||
pluginArgs.head = elements.update(compilation.assets, options, pluginArgs.head); | ||
pluginArgs[headTagName] = elements.update(compilation.assets, options, pluginArgs[headTagName]); | ||
debugEvent('replacing <body> <script> elements'); | ||
pluginArgs.body = elements.update(compilation.assets, options, pluginArgs.body); | ||
pluginArgs[bodyTagName] = elements.update(compilation.assets, options, pluginArgs[bodyTagName]); | ||
} | ||
if (shouldAddResourceHints(options)) { | ||
debugEvent('adding resource hints'); | ||
pluginArgs.head = falsySafeConcat([ | ||
pluginArgs.head, | ||
addInitialChunkResourceHints(options, pluginArgs.head), | ||
addInitialChunkResourceHints(options, pluginArgs.body), | ||
pluginArgs[headTagName] = falsySafeConcat([ | ||
pluginArgs[headTagName], | ||
addInitialChunkResourceHints(options, pluginArgs[headTagName]), | ||
addInitialChunkResourceHints(options, pluginArgs[bodyTagName]), | ||
addAsyncChunkResourceHints(compilation.chunks, options) | ||
@@ -82,5 +87,5 @@ ]); | ||
debugEvent('adding custom attribues to <head> <script> elements'); | ||
pluginArgs.head = customAttributes.add(options, pluginArgs.head); | ||
pluginArgs[headTagName] = customAttributes.add(options, pluginArgs[headTagName]); | ||
debugEvent('adding custom attributes to <body> <script> elements'); | ||
pluginArgs.body = customAttributes.add(options, pluginArgs.body); | ||
pluginArgs[bodyTagName] = customAttributes.add(options, pluginArgs[bodyTagName]); | ||
} | ||
@@ -87,0 +92,0 @@ debugEvent('completed'); |
{ | ||
"name": "script-ext-html-webpack-plugin", | ||
"version": "2.0.1", | ||
"version": "2.0.3", | ||
"description": "Enhances html-webpack-plugin functionality with async and defer attributes for script elements", | ||
@@ -12,9 +12,12 @@ "main": "index.js", | ||
"pretest": "semistandard & install-module-versions dynavers.json", | ||
"test": "VERSION=webpack1 jasmine && VERSION=webpack2 jasmine && VERSION=webpack3 jasmine && VERSION=webpack4 jasmine", | ||
"test:webpack1": "VERSION=webpack1 jasmine", | ||
"test:webpack2": "VERSION=webpack2 jasmine", | ||
"test:webpack3": "VERSION=webpack3 jasmine", | ||
"test:webpack4": "VERSION=webpack4 jasmine", | ||
"debug": "DEBUG=ScriptExt VERSION=webpack4 jasmine", | ||
"node-debug": "DEBUG=ScriptExt VERSION=webpack4 node-debug jasmine" | ||
"test": "npm run test:hwp", | ||
"test:hwp": "npm run test:hwp3 && npm run test:hwp4", | ||
"test:hwp3": "cross-env VERSION=webpack1 HWP_VERSION=hwp3 jasmine && cross-env VERSION=webpack2 HWP_VERSION=hwp3 jasmine && cross-env VERSION=webpack3 HWP_VERSION=hwp3 jasmine && cross-env VERSION=webpack4 HWP_VERSION=hwp3 jasmine", | ||
"test:hwp4": "cross-env VERSION=webpack4 HWP_VERSION=hwp4 jasmine", | ||
"test:webpack1": "cross-env VERSION=webpack1 jasmine", | ||
"test:webpack2": "cross-env VERSION=webpack2 jasmine", | ||
"test:webpack3": "cross-env VERSION=webpack3 jasmine", | ||
"test:webpack4": "cross-env VERSION=webpack4 jasmine", | ||
"debug": "cross-env DEBUG=ScriptExt VERSION=webpack4 HWP_VERSION=hwp4 jasmine", | ||
"node-debug": "cross-env DEBUG=ScriptExt VERSION=webpack4 HWP_VERSION=hwp4 node-debug jasmine" | ||
}, | ||
@@ -47,21 +50,21 @@ "repository": { | ||
"dependencies": { | ||
"debug": "^3.1.0" | ||
"debug": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"css-loader": "^0.28.10", | ||
"cross-env": "^5.2.0", | ||
"css-loader": "^1.0.1", | ||
"dynavers": "^0.2.0", | ||
"handlebars": "^4.0.11", | ||
"handlebars-loader": "1.6.0", | ||
"html-webpack-plugin": "^3.0.6", | ||
"jasmine": "^3.1.0", | ||
"handlebars": "^4.0.12", | ||
"handlebars-loader": "1.7.0", | ||
"jasmine": "^3.3.0", | ||
"jasmine-spec-reporter": "^4.2.1", | ||
"jasmine2-custom-message": "^0.9.0", | ||
"jasmine2-custom-message": "^0.9.3", | ||
"rimraf": "^2.6.2", | ||
"semistandard": "^12.0.1", | ||
"uglifyjs-webpack-plugin": "^1.2.2", | ||
"webpack-config": "7.0.0" | ||
"uglifyjs-webpack-plugin": "^2.0.1", | ||
"webpack-config": "7.5.0" | ||
}, | ||
"peerDependencies": { | ||
"webpack": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0", | ||
"html-webpack-plugin": "^3.0.0" | ||
"html-webpack-plugin": "^3.0.0 || ^4.0.0" | ||
}, | ||
@@ -68,0 +71,0 @@ "engines": { |
@@ -32,3 +32,3 @@ Script Extension for HTML Webpack Plugin | ||
``` | ||
Not that you will need v3.0.6+ of [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) | ||
Not that you will need v3.0.6+ or v4.x of [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) | ||
@@ -298,4 +298,5 @@ For those requiring earlier versions of node, please use the [last 1.x version](https://github.com/numical/script-ext-html-webpack-plugin/tree/v1.8.8) of this plugin. However please note this does not have webpack 4.x support: | ||
v2.0.x | ||
* support html-webpack-plugin 4.x - huge thanks to [@snadn](https://github.com/snadn) | ||
* support webpack 4.x - huge thanks to [@sherlock1982](https://github.com/sherlock1982) | ||
* node 9.x testing | ||
* node 9.x 10,x, 11.x testing | ||
* remove support for node 4.x and 5.x | ||
@@ -302,0 +303,0 @@ * remove Appveyor config |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33027
458
349
+ Added@types/html-minifier-terser@5.1.2(transitive)
+ Added@types/node@22.5.4(transitive)
+ Added@types/source-list-map@0.1.6(transitive)
+ Added@types/tapable@1.0.12(transitive)
+ Added@types/uglify-js@3.17.5(transitive)
+ Added@types/webpack@4.41.39(transitive)
+ Added@types/webpack-sources@3.2.3(transitive)
+ Addedcamel-case@4.1.2(transitive)
+ Addedcommander@4.1.1(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddot-case@3.0.4(transitive)
+ Addedhtml-minifier-terser@5.1.1(transitive)
+ Addedhtml-webpack-plugin@4.5.2(transitive)
+ Addedlower-case@2.0.2(transitive)
+ Addedno-case@3.0.4(transitive)
+ Addedparam-case@3.0.4(transitive)
+ Addedpascal-case@3.1.2(transitive)
+ Addedsource-map@0.7.4(transitive)
+ Addedtslib@2.7.0(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removedbig.js@3.2.0(transitive)
- Removedcamel-case@3.0.0(transitive)
- Removedcommander@2.17.12.19.0(transitive)
- Removeddebug@3.2.7(transitive)
- Removedemojis-list@2.1.0(transitive)
- Removedhtml-minifier@3.5.21(transitive)
- Removedhtml-webpack-plugin@3.2.0(transitive)
- Removedjson5@0.5.1(transitive)
- Removedloader-utils@0.2.17(transitive)
- Removedlower-case@1.1.4(transitive)
- Removedno-case@2.3.2(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedparam-case@2.1.1(transitive)
- Removedtoposort@1.0.7(transitive)
- Removeduglify-js@3.4.10(transitive)
- Removedupper-case@1.1.3(transitive)
Updateddebug@^4.1.0