Socket
Socket
Sign inDemoInstall

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 10.0.1 to 11.0.0

35

cli.js

@@ -38,11 +38,11 @@ #!/usr/bin/env node

type: 'string',
alias: 'c',
shortFlag: 'c',
},
html: {
type: 'string',
alias: 'h',
shortFlag: 'h',
},
ignore: {
type: 'string',
alias: 'i',
shortFlag: 'i',
isMultiple: true,

@@ -52,3 +52,3 @@ },

type: 'boolean',
alias: 'm',
shortFlag: 'm',
default: true,

@@ -58,15 +58,15 @@ },

type: 'boolean',
alias: 'e',
shortFlag: 'e',
},
base: {
type: 'string',
alias: 'b',
shortFlag: 'b',
},
selector: {
type: 'string',
alias: 's',
shortFlag: 's',
},
preload: {
type: 'boolean',
alias: 'p',
shortFlag: 'p',
default: false,

@@ -95,3 +95,3 @@ },

case 'css':
case 'html':
case 'html': {
try {

@@ -102,6 +102,10 @@ result[key] = read(value);

break;
case 'base':
}
case 'base': {
result.basePath = value;
break;
case 'ignore':
}
case 'ignore': {
result.ignore = (value || []).map((ignore) => {

@@ -119,5 +123,8 @@ // Check regex

break;
default:
}
default: {
result[key] = value;
break;
}
}

@@ -182,3 +189,2 @@

// Get stdin
stdin().then(run);
setTimeout(() => {

@@ -191,1 +197,4 @@ if (ok) {

}, 100);
const input = await stdin();
run(input);

@@ -20,3 +20,2 @@ /**

import slash from 'slash';
import Dom from './src/dom.js';

@@ -112,4 +111,3 @@ import {removeDuplicateStyles} from './src/css.js';

// Add link tags before old links
// eslint-disable-next-line array-callback-return
o.replaceStylesheets.map((href) => {
o.replaceStylesheets.forEach((href) => {
const link = document.createElement('link');

@@ -149,4 +147,3 @@

// Remove old links
// eslint-disable-next-line array-callback-return
removable.map((link) => {
removable.forEach((link) => {
if (link.parentElement.tagName === 'NOSCRIPT') {

@@ -160,4 +157,3 @@ document.remove(link.parentElement);

// Modify links and add clones to noscript block
// eslint-disable-next-line array-callback-return
links.map((link) => {
links.forEach((link) => {
const href = link.getAttribute('href');

@@ -168,2 +164,6 @@ const media = link.getAttribute('media');

if (['print', 'speech'].includes(media)) {
return;
}
if (o.extract) {

@@ -170,0 +170,0 @@ const file = resolve(join(o.basePath || process.cwd, href));

{
"name": "inline-critical",
"version": "10.0.1",
"version": "11.0.0",
"description": "Inline critical-path css and load the existing stylesheets asynchronously",

@@ -41,3 +41,3 @@ "main": "index.js",

"dependencies": {
"clean-css": "^5.3.1",
"clean-css": "^5.3.2",
"css": "^3.0.0",

@@ -48,3 +48,3 @@ "detect-indent": "^7.0.1",

"indent-string": "^5.0.0",
"jsdom": "^20.0.0",
"jsdom": "^22.1.0",
"lodash.defaults": "^4.2.0",

@@ -54,19 +54,18 @@ "lodash.escaperegexp": "^4.1.2",

"lodash.isstring": "^4.0.1",
"meow": "^10.1.3",
"meow": "^12.1.1",
"normalize-newline": "^4.1.0",
"picocolors": "^1.0.0",
"postcss": "^8.4.16",
"postcss": "^8.4.31",
"postcss-discard": "^2.0.0",
"reaver": "^2.0.0",
"slash": "^5.0.0",
"uglify-js": "^3.17.1"
"slash": "^5.1.0",
"uglify-js": "^3.17.4"
},
"devDependencies": {
"cross-env": "^7.0.3",
"eslint": "^8.23.1",
"execa": "^6.1.0",
"fs-extra": "^10.1.0",
"jest": "^29.0.3",
"read-pkg-up": "^9.1.0",
"xo": "^0.52.3"
"eslint": "^8.51.0",
"fs-extra": "^11.1.1",
"jest": "^29.7.0",
"read-pkg-up": "^10.1.0",
"xo": "^0.56.0"
},

@@ -100,4 +99,4 @@ "xo": {

"engines": {
"node": ">=14.16"
"node": ">=16.10"
}
}

@@ -11,3 +11,3 @@ import {readFileSync} from 'node:fs';

const escapeRegExp = (string) => (string || '').replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
const escapeRegExp = (string) => (string || '').replaceAll(/[\\^$.*+?()[\]{}|]/g, '\\$&');

@@ -43,3 +43,3 @@ /**

const result = [];
html.replace(new RegExp(`<${tag}(?:\\s[^>]+)?>`, 'ig'), (match, offset, string) => {
html.replaceAll(new RegExp(`<${tag}(?:\\s[^>]+)?>`, 'ig'), (match, offset, string) => {
if (match.includes('/>')) {

@@ -120,7 +120,7 @@ result.push(string.slice(offset, offset + match.length));

if (head.length > 0) {
result = result.replace(/^([\s\t]*)(<\/\s*head>)/gim, `$1$1${head.join('\n$1$1')}\n$1$2`);
result = result.replaceAll(/^([\s\t]*)(<\/\s*head>)/gim, `$1$1${head.join('\n$1$1')}\n$1$2`);
}
if (body.length > 0) {
result = result.replace(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${body.join('\n$1$1')}\n$1$2`);
result = result.replaceAll(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${body.join('\n$1$1')}\n$1$2`);
}

@@ -127,0 +127,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