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

inline-critical

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inline-critical - npm Package Compare versions

Comparing version 5.1.2 to 5.1.3

2

package.json
{
"name": "inline-critical",
"version": "5.1.2",
"version": "5.1.3",
"description": "Inline critical-path css and load the existing stylesheets asynchronously",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -30,12 +30,13 @@ const fs = require('fs');

const getPartials = (html = '', tag = 'svg') => {
const indices = [];
let start = html.indexOf(`<${tag}`, 0);
let end = html.indexOf(`</${tag}>`, start) + `</${tag}>`.length;
while (start >= 0) {
indices.push({start, end});
start = html.indexOf(`<${tag}`, end);
end = html.indexOf(`</${tag}>`, end) + `</${tag}>`.length;
}
const result = [];
html.replace(new RegExp(`<${tag}(?:\\s[^>]+)?>`, 'ig'), (match, offset, str) => {
if (match.includes('/>')) {
result.push(str.substring(offset, offset + match.length));
} else {
result.push(str.substring(offset, str.indexOf(`</${tag}>`, offset) + `</${tag}>`.length));
}
return match;
});
return indices.map(({start, end}) => html.substring(start, end));
return result;
};

@@ -68,2 +69,3 @@

const jsdom = new JSDOM(html);
const {window} = jsdom;

@@ -97,3 +99,3 @@ const {document} = window;

return result.replace(/^(\s*)(<\/\s*body>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`);
return result.replace(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`);
}

@@ -100,0 +102,0 @@

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