Socket
Socket
Sign inDemoInstall

html-webpack-plugin

Package Overview
Dependencies
65
Maintainers
2
Versions
138
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

CHANGES.md

69

index.js

@@ -26,2 +26,3 @@ 'use strict';

minify: false,
cache: true,
chunks: 'all',

@@ -88,3 +89,6 @@ excludeChunks: [],

// and replace it with its content
return self.evaluateCompilationResult(compilation, resultAsset);
if (self.built || !self.options.cache) {
self.evaluatedCompilationResult = self.evaluateCompilationResult(compilation, resultAsset);
}
return self.evaluatedCompilationResult;
})

@@ -158,11 +162,2 @@ // Execute the template

// Create a subCache (copied from https://github.com/SanderSpies/extract-text-webpack-plugin/blob/master/loader.js)
childCompiler.plugin('compilation', function(compilation) {
if(compilation.cache) {
if(!compilation.cache[compilerName]) {
compilation.cache[compilerName] = {};
}
compilation.cache = compilation.cache[compilerName];
}
});
// Compile and return a promise

@@ -179,6 +174,8 @@ return new Promise(function (resolve, reject) {

} else {
resolve(compilation.assets[outputFilename]);
this.built = this.hash !== entries[0].hash;
this.hash = entries[0].hash;
resolve(childCompilation.assets[outputFilename]);
}
});
});
}.bind(this));
}.bind(this));
};

@@ -194,2 +191,3 @@

}
var source = compilationResult.source();

@@ -255,2 +253,5 @@ // The LibraryTemplatePlugin stores the template result in a local variable.

var self = this;
if (typeof html !== 'string') {
return Promise.reject('Expected html to be a string but got ' + JSON.stringify(html));
}
return Promise.resolve()

@@ -305,3 +306,3 @@ // Inject

HtmlWebpackPlugin.prototype.sortChunks = function(chunks, sortMode) {
// Sort mode auto by default:
// Sort mode auto by default:
if (typeof sortMode === 'undefined' || sortMode === 'auto') {

@@ -451,4 +452,7 @@ return chunks.sort(function orderEntryLast(a, b) {

// Injections
var htmlRegExp = /(<html[^>]*>)/i;
var head = [];
var headRegExp = /(<\/head>)/i;
var body = [];
var bodyRegExp = /(<\/body>)/i;

@@ -467,10 +471,33 @@ // If there is a favicon present, add it to the head

}
// Append assets to head element
html = html.replace(/(<\/head>)/i, function (match) {
return head.join('') + match;
});
// Append assets to body element
html = html.replace(/(<\/body>)/i, function (match) {
return body.join('') + match;
if (body.length) {
if(bodyRegExp.test(html)) {
// Append assets to body element
html = html.replace(bodyRegExp, function (match) {
return body.join('') + match;
});
} else {
// Append scripts to the end of the file if no <body> element exists:
html += body.join('');
}
}
if (head.length) {
// Create a head tag if none exists
if (!headRegExp.test(html)) {
if (!htmlRegExp.test(html)) {
html = '<head></head>' + html;
} else {
html = html.replace(htmlRegExp, function(match) {
return match + '<head></head>';
});
}
}
// Append assets to head element
html = html.replace(headRegExp, function (match) {
return head.join('') + match;
});
}
// Inject manifest into the opening html tag

@@ -477,0 +504,0 @@ if (assets.manifest) {

@@ -17,2 +17,6 @@ 'use strict';

}
// Skip .js files
if (/\.js$/.test(this.request)) {
return source;
}
// Use underscore for a minimalistic loader

@@ -19,0 +23,0 @@ var options = loaderUtils.parseQuery(this.query);

{
"name": "html-webpack-plugin",
"version": "2.1.0",
"version": "2.2.0",
"description": "Simplifies creation of HTML files to serve your webpack bundles",

@@ -34,23 +34,23 @@ "main": "index.js",

"appcache-webpack-plugin": "^1.2.1",
"css-loader": "^0.23.0",
"css-loader": "^0.23.1",
"es6-promise": "^3.0.2",
"extract-text-webpack-plugin": "^0.9.1",
"file-loader": "^0.8.4",
"html-loader": "^0.3.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"html-loader": "^0.4.0",
"jade-loader": "^0.8.0",
"jasmine-node": "^1.14.5",
"jshint": "^2.9.1-rc1",
"rimraf": "^2.4.4",
"jshint": "^2.9.1-rc2",
"rimraf": "^2.5.0",
"style-loader": "^0.13.0",
"underscore-template-loader": "^0.5.2",
"url-loader": "^0.5.6",
"webpack": "^1.12.8"
"url-loader": "^0.5.7",
"webpack": "^1.12.10"
},
"dependencies": {
"loader-utils": "^0.2.11",
"loader-utils": "^0.2.12",
"syntax-error": "^1.1.4",
"bluebird": "^3.0.5",
"html-minifier": "^1.0.0",
"bluebird": "^3.1.1",
"html-minifier": "^1.1.1",
"lodash": "^3.10.1"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc