Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-hot-loader

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-hot-loader - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0-beta

17

hotModuleReplacement.js
var normalizeUrl = require('normalize-url');
var srcByModuleId = Object.create(null);
var getCurrentScriptUrl = function() {
var src;
if (document) {
var getCurrentScriptUrl = function(moduleId) {
var src = srcByModuleId[moduleId];
if (!src && document) {
if (document.currentScript) {

@@ -12,2 +13,3 @@ src = document.currentScript.src;

}
srcByModuleId[moduleId] = src;
}

@@ -23,3 +25,3 @@

var reg = new RegExp(filename + '\\.js$', 'g')
return normalizeUrl(src.replace(reg, mapRule.replace(/{fileName}/g, filename) + '.css'));
return normalizeUrl(src.replace(reg, mapRule.replace(/{fileName}/g, filename) + '.css'), { stripWWW: false });
});

@@ -29,4 +31,2 @@ };

var getScriptSrc = getCurrentScriptUrl();
function updateCss(el, url) {

@@ -58,3 +58,3 @@ var newEl = el.cloneNode();

function getReloadUrl(href, src) {
href = normalizeUrl(href);
href = normalizeUrl(href, { stripWWW: false });
var ret;

@@ -76,3 +76,4 @@ src.some(function(url) {

module.exports = function(options) {
module.exports = function(moduleId, options) {
var getScriptSrc = getCurrentScriptUrl(moduleId);
return function() {

@@ -79,0 +80,0 @@ if (typeof document === 'undefined') {

@@ -16,3 +16,3 @@ const loaderUtils = require('loader-utils');

// ${Date.now()}
const cssReload = require(${loaderUtils.stringifyRequest(this, require.resolve('./hotModuleReplacement'))})(${JSON.stringify(options)});
const cssReload = require(${loaderUtils.stringifyRequest(this, require.resolve('./hotModuleReplacement'))})(module.id, ${JSON.stringify(options)});
module.hot.dispose(cssReload);

@@ -19,0 +19,0 @@ module.hot.accept(undefined, cssReload);

{
"name": "css-hot-loader",
"version": "1.2.0",
"version": "1.3.0-beta",
"description": "css hot reload work with extract-text-webpack-plugin",

@@ -10,2 +10,7 @@ "main": "index.js",

},
"files": [
"loader.js",
"hotModuleReplacement.js",
"index.js"
],
"homepage": "http://git.shepherdwind.com/css-hot-loader/",

@@ -12,0 +17,0 @@ "repository": {

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