New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-bundler-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-bundler-webpack-plugin - npm Package Compare versions

Comparing version

to
4.18.1

4

package.json
{
"name": "html-bundler-webpack-plugin",
"version": "4.18.0",
"version": "4.18.1",
"description": "Generates complete single-page or multi-page website from source assets. Build-in support for Markdown, Eta, EJS, Handlebars, Nunjucks, Pug. Alternative to html-webpack-plugin.",

@@ -149,3 +149,3 @@ "keywords": [

"@types/html-minifier-terser": "^7.0.2",
"ansis": "3.9.0",
"ansis": "3.17.0",
"enhanced-resolve": ">=5.7.0",

@@ -152,0 +152,0 @@ "eta": "^3.5.0",

@@ -19,2 +19,17 @@ const fs = require('fs/promises');

/**
* The output path to save generated files.
*
* @type {string}
* */
outputPath = '';
/**
* The full output public path..
* It will be used if Webpack output.publicPath ia a URL.
*
* @type {string}
* */
outputUrl = '';
/**
* The key is the source HTML file, where was found the original `faviconFile` parsed in the `faviconTag`.

@@ -35,2 +50,3 @@ * The `faviconFile` is the source file of the parsed favicon file.

this.options.faviconsConfig = { ...config.defaults, ...(options.faviconOptions || {}) };
this.outputPath = this.options.faviconsConfig?.path ?? '';
}

@@ -41,3 +57,9 @@

const enabled = bundlerPluginOption.toBool(this.options?.enabled, true, 'auto');
const isUrlPublicPath = bundlerPluginOption.isUrlPublicPath();
if (isUrlPublicPath) {
let publicPath = bundlerPluginOption.getPublicPath();
this.outputUrl = new URL(this.outputPath, publicPath).href;
}
if (!enabled) {

@@ -96,2 +118,3 @@ return;

let outputFile = path.posix.join(this.options.faviconsConfig.path, name);
compilation.emitAsset(outputFile, new RawSource(contents));

@@ -109,3 +132,11 @@ });

if (page && this.faviconResponse) {
content = content.replace(page.faviconTag, this.faviconResponse.html);
let { outputUrl, outputPath } = this;
let faviconHtml = this.faviconResponse.html;
if (outputUrl) {
faviconHtml = faviconHtml.replaceAll(outputPath, outputUrl);
}
// inject generated <link> tags
content = content.replace(page.faviconTag, faviconHtml);
}

@@ -112,0 +143,0 @@

Sorry, the diff of this file is too big to display