Socket
Socket
Sign inDemoInstall

html-loader

Package Overview
Dependencies
Maintainers
10
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-loader - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

8

CHANGELOG.md

@@ -5,2 +5,10 @@ # Changelog

### [2.1.1](https://github.com/webpack-contrib/html-loader/compare/v2.1.0...v2.1.1) (2021-02-24)
### Bug Fixes
* handle the `content` attribute ([#372](https://github.com/webpack-contrib/html-loader/issues/372)) ([002e2a1](https://github.com/webpack-contrib/html-loader/commit/002e2a144c26601136cca1073cd84f1a18e67033))
* invalid URL for runtime helpers ([#373](https://github.com/webpack-contrib/html-loader/issues/373)) ([b19cfd0](https://github.com/webpack-contrib/html-loader/commit/b19cfd0e9344f15edf69df58afd8def96436b11d))
## [2.1.0](https://github.com/webpack-contrib/html-loader/compare/v2.0.0...v2.1.0) (2021-02-20)

@@ -7,0 +15,0 @@

2

dist/plugins/sources-plugin.js

@@ -160,3 +160,3 @@ "use strict";

importName,
source: (0, _utils.stringifyRequest)(options.context, newUrl)
source: newUrl
});

@@ -163,0 +163,0 @@ }

@@ -11,3 +11,2 @@ "use strict";

exports.isUrlRequestable = isUrlRequestable;
exports.stringifyRequest = stringifyRequest;
exports.srcType = srcType;

@@ -25,3 +24,3 @@ exports.srcsetType = srcsetType;

var _path = _interopRequireDefault(require("path"));
var _url = require("url");

@@ -423,40 +422,2 @@ var _HtmlSourceError = _interopRequireDefault(require("./HtmlSourceError"));

const matchRelativePath = /^\.\.?[/\\]/;
function isAbsolutePath(str) {
return matchNativeWin32Path.test(str) && _path.default.win32.isAbsolute(str);
}
function isRelativePath(str) {
return matchRelativePath.test(str);
}
function stringifyRequest(context, request) {
const splitted = request.split('!');
return JSON.stringify(splitted.map(part => {
// First, separate singlePath from query, because the query might contain paths again
const splittedPart = part.match(/^(.*?)(\?.*)/);
const query = splittedPart ? splittedPart[2] : '';
let singlePath = splittedPart ? splittedPart[1] : part;
if (isAbsolutePath(singlePath) && context) {
singlePath = _path.default.relative(context, singlePath);
if (isAbsolutePath(singlePath)) {
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
// In this case, we leave the path platform-specific without replacing any separators.
// @see https://github.com/webpack/loader-utils/pull/14
return singlePath + query;
}
if (isRelativePath(singlePath) === false) {
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
singlePath = `./${singlePath}`;
}
}
return singlePath.replace(/\\/g, '/') + query;
}).join('!'));
}
function isProductionMode(loaderContext) {

@@ -542,3 +503,3 @@ return loaderContext.mode === 'production' || !loaderContext.mode;

const META = new Map([['name', new Set([// msapplication-TileImage
'msapplication-tileimage', 'msapplication-square70x70logo', 'msapplication-square150x150logo', 'msapplication-wide310x150logo', 'msapplication-square310x310logo', 'msapplication-config', 'twitter:image'])], ['property', new Set(['og:image', 'og:image:url', 'og:image:secure_url', 'og:audio', 'og:audio:secure_url', 'og:video', 'og:video:secure_url', 'vk:image'])], ['itemprop', new Set(['image', 'logo', 'screenshot', 'thumbnailurl', 'contenturl', 'downloadurl', 'duringmedia', 'embedurl', 'installurl', 'layoutimage'])], ['name', new Set(['msapplication-task'])]]);
'msapplication-tileimage', 'msapplication-square70x70logo', 'msapplication-square150x150logo', 'msapplication-wide310x150logo', 'msapplication-square310x310logo', 'msapplication-config', 'msapplication-task', 'twitter:image'])], ['property', new Set(['og:image', 'og:image:url', 'og:image:secure_url', 'og:audio', 'og:audio:secure_url', 'og:video', 'og:video:secure_url', 'vk:image'])], ['itemprop', new Set(['image', 'logo', 'screenshot', 'thumbnailurl', 'contenturl', 'downloadurl', 'duringmedia', 'embedurl', 'installurl', 'layoutimage'])]]);

@@ -865,4 +826,4 @@ function linkItempropFilter(tag, attribute, attributes) {

const stringifiedHelperRequest = `"${_path.default.relative(loaderContext.context, require.resolve('./runtime/getUrl.js')).replace(/\\/g, '/')}"`;
let code = options.esModule ? `import ${GET_SOURCE_FROM_IMPORT_NAME} from ${stringifiedHelperRequest};\n` : `var ${GET_SOURCE_FROM_IMPORT_NAME} = require(${stringifiedHelperRequest});\n`;
const fileURLToHelper = (0, _url.pathToFileURL)(require.resolve('./runtime/getUrl.js'));
let code = options.esModule ? `import ${GET_SOURCE_FROM_IMPORT_NAME} from "${fileURLToHelper}";\n` : `var ${GET_SOURCE_FROM_IMPORT_NAME} = require("${fileURLToHelper}");\n`;

@@ -874,3 +835,3 @@ for (const item of imports) {

} = item;
code += options.esModule ? `var ${importName} = new URL(${source}, import.meta.url);\n` : `var ${importName} = require(${source});\n`;
code += options.esModule ? `var ${importName} = new URL("${source}", import.meta.url);\n` : `var ${importName} = require("${source}");\n`;
}

@@ -877,0 +838,0 @@

{
"name": "html-loader",
"version": "2.1.0",
"version": "2.1.1",
"description": "Html loader module for webpack",

@@ -69,2 +69,3 @@ "license": "MIT",

"handlebars": "^4.7.6",
"html-webpack-plugin": "^5.2.0",
"husky": "^5.0.9",

@@ -71,0 +72,0 @@ "jest": "^26.6.3",

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