Socket
Socket
Sign inDemoInstall

script-ext-html-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

script-ext-html-webpack-plugin - npm Package Compare versions

Comparing version 2.0.1 to 2.0.3

23

lib/plugin.js
'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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc