Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

postcss

Package Overview
Dependencies
Maintainers
1
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss - npm Package Compare versions

Comparing version
8.5.9
to
8.5.10
+1
-1
lib/processor.js

@@ -10,3 +10,3 @@ 'use strict'

constructor(plugins = []) {
this.version = '8.5.9'
this.version = '8.5.10'
this.plugins = this.normalize(plugins)

@@ -13,0 +13,0 @@ }

'use strict'
// Escapes sequences that could break out of an HTML <style> context.
// Uses CSS unicode escaping (\3c = '<') which is valid CSS and parsed
// correctly by all compliant CSS consumers.
const STYLE_TAG = /(<)(\/?style\b)/gi
const COMMENT_OPEN = /(<)(!--)/g
function escapeHTMLInCSS(str) {
if (typeof str !== 'string') return str
if (!str.includes('<')) return str
return str.replace(STYLE_TAG, '\\3c $2').replace(COMMENT_OPEN, '\\3c $2')
}
const DEFAULT_RAW = {

@@ -41,3 +53,3 @@ after: '\n',

let end = (node.raws.between || '') + (semicolon ? ';' : '')
this.builder(name + params + end, node)
this.builder(escapeHTMLInCSS(name + params + end), node)
}

@@ -77,3 +89,3 @@ }

let between = this.raw(node, 'between', 'beforeOpen')
this.builder(start + between + '{', node, 'start')
this.builder(escapeHTMLInCSS(start + between) + '{', node, 'start')

@@ -88,3 +100,3 @@ let after

if (after) this.builder(after)
if (after) this.builder(escapeHTMLInCSS(after))
this.builder('}', node, 'end')

@@ -101,6 +113,7 @@ }

let semicolon = this.raw(node, 'semicolon')
let isDocument = node.type === 'document'
for (let i = 0; i < node.nodes.length; i++) {
let child = node.nodes[i]
let before = this.raw(child, 'before')
if (before) this.builder(before)
if (before) this.builder(isDocument ? before : escapeHTMLInCSS(before))
this.stringify(child, last !== i || semicolon)

@@ -113,3 +126,3 @@ }

let right = this.raw(node, 'right', 'commentRight')
this.builder('/*' + left + node.text + right + '*/', node)
this.builder(escapeHTMLInCSS('/*' + left + node.text + right + '*/'), node)
}

@@ -126,3 +139,3 @@

if (semicolon) string += ';'
this.builder(string, node)
this.builder(escapeHTMLInCSS(string), node)
}

@@ -333,3 +346,7 @@

this.body(node)
if (node.raws.after) this.builder(node.raws.after)
if (node.raws.after) {
let after = node.raws.after
let isDocument = node.parent && node.parent.type === 'document'
this.builder(isDocument ? after : escapeHTMLInCSS(after))
}
}

@@ -340,3 +357,3 @@

if (node.raws.ownSemicolon) {
this.builder(node.raws.ownSemicolon, node, 'end')
this.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, 'end')
}

@@ -343,0 +360,0 @@ }

{
"name": "postcss",
"version": "8.5.9",
"version": "8.5.10",
"description": "Tool for transforming styles with JS plugins",

@@ -5,0 +5,0 @@ "keywords": [