Socket
Socket
Sign inDemoInstall

critical-style-loader

Package Overview
Dependencies
4
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.14 to 2.0.0

2

lib/loader.js

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

var path = loaderUtils.stringifyRequest(this, "!!".concat(request));
return "\n var content = require(".concat(path, ");\n var hashCode = require('critical-style-loader/lib/hashCode.js');\n\n // function hashCode(hashString) {\n // var hash = 0;\n // var chr;\n\n // for (var i = 0; i < hashString.length; i += 1) {\n // chr = hashString.charCodeAt(i);\n // hash = (hash << 5) - hash + chr;\n // hash |= 0; // Convert to 32bit integer\n // }\n\n // return hash;\n // }\n\n if (\n 'undefined' !== typeof window &&\n 'undefined' !== typeof document\n ) {\n var preRendered = content.some(function(module) {\n var css = module[1];\n var id = hashCode(css);\n\n if (window.").concat(GLOBAL_HOOK, " && window.").concat(GLOBAL_HOOK, "[id]) {\n console.log('prerendered!', css, id);\n return true;\n }\n\n return false;\n });\n\n if (preRendered) {\n module.exports = '/* CSS output skipped for ' +\n module.id +\n ' prerendered server-side */';\n } else {\n module.exports = content;\n }\n } else {\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\n // Export CSS Modules\n if (content.locals) {\n module.exports = content.locals;\n }\n\n // Provide getter for raw CSS.\n module.exports.getCss = function() {\n return content;\n };\n }\n ");
return "\n var content = require(".concat(path, ");\n var hashCode = require('critical-style-loader/lib/hashCode.js');\n\n if (\n 'undefined' !== typeof window &&\n 'undefined' !== typeof document\n ) {\n var preRendered = content.some(function(module) {\n var css = module[1];\n var id = hashCode(css);\n\n if (window.").concat(GLOBAL_HOOK, " && window.").concat(GLOBAL_HOOK, "[id]) {\n return true;\n }\n\n return false;\n });\n\n if (preRendered) {\n module.exports = '/* CSS output skipped for ' +\n module.id +\n ' prerendered server-side */';\n } else {\n module.exports = content;\n }\n } else {\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\n // Export CSS Modules\n if (content.locals) {\n module.exports = content.locals;\n }\n\n // Provide getter for raw CSS.\n module.exports.getCss = function() {\n return content;\n };\n }\n ");
};
{
"name": "critical-style-loader",
"version": "2.0.0-beta.14",
"version": "2.0.0",
"description": "A webpack loader for rendering critical path CSS on the server with utilities to avoid client side style-loader style duplications.",

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

"dependencies": {
"loader-utils": "^1.1.0"
"loader-utils": "^2.0.0"
},

@@ -45,0 +45,0 @@ "devDependencies": {

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