postcss-styl
Advanced tools
Comparing version 0.5.11 to 0.6.0
@@ -520,3 +520,3 @@ "use strict" | ||
node, | ||
{ propStartNode: node, atblockLast: valueNode }, | ||
{ propStartNode: node, valueLast: valueNode }, | ||
parent, | ||
@@ -643,2 +643,11 @@ info | ||
} | ||
if (name === "atblock") { | ||
this.atruleAtblockImpl( | ||
node, | ||
{ blockNode: first.block }, | ||
parent, | ||
info | ||
).expression = true | ||
return | ||
} | ||
} else if (node.nodes.length > 1) { | ||
@@ -685,8 +694,5 @@ const first = node.nodes[0] | ||
const atblock = node.val.nodes[0] | ||
this.declImpl( | ||
this.atruleAtblockImpl( | ||
node, | ||
{ | ||
propStartNode: node, | ||
atblockLast: atblock.nodes[atblock.nodes.length - 1], | ||
}, | ||
{ blockNode: atblock.block }, | ||
parent, | ||
@@ -1128,2 +1134,13 @@ info | ||
atruleAtblockImpl(node, { blockNode }, parent, info) { | ||
const atrule = this.atruleImpl( | ||
node, | ||
{ expression: true, blockNode }, | ||
parent, | ||
info | ||
) | ||
atrule.atblock = true | ||
return atrule | ||
} | ||
atruleExpressionImpl(node, parent, _info) { | ||
@@ -1465,3 +1482,3 @@ // `{...}` | ||
declImpl(node, { propStartNode, atblockLast }, parent, _info) { | ||
declImpl(node, { propStartNode, valueLast }, parent, _info) { | ||
const propStartIndex = this.sourceCode.getIndex(propStartNode) | ||
@@ -1483,4 +1500,4 @@ const { prop, endIndex: propEndIndex } = parseProp( | ||
{ | ||
minEnd: atblockLast | ||
? this.sourceCode.getIndex(atblockLast) | ||
minEnd: valueLast | ||
? this.sourceCode.getIndex(valueLast) | ||
: undefined, | ||
@@ -1487,0 +1504,0 @@ } |
@@ -30,2 +30,10 @@ "use strict" | ||
} | ||
// Check expression @block | ||
if (node.type === "atrule" && node.atblock) { | ||
const nameAndParams = node.name + node.params | ||
if (nameAndParams.toLowerCase() === "@block" || !nameAndParams.trim()) { | ||
// Expression @block (No assignment @block) | ||
return false | ||
} | ||
} | ||
return true | ||
@@ -219,3 +227,8 @@ } | ||
} | ||
if (node.raws.identifier == null && !node.function && !node.postfix) { | ||
if ( | ||
node.raws.identifier == null && | ||
!node.function && | ||
!node.postfix && | ||
!node.atblock | ||
) { | ||
super.atrule(node, !node.omittedSemi && semicolon) | ||
@@ -238,8 +251,18 @@ } else { | ||
// name += "" | ||
} else if (params) { | ||
} else if (params && name) { | ||
name += " " | ||
} | ||
let nameAndParams = name + params | ||
if (node.atblock) { | ||
// adjust @block | ||
if (isPythonic(node)) { | ||
nameAndParams = nameAndParams.replace(/@block$/iu, "") | ||
} else if (!/@block/iu.test(nameAndParams)) { | ||
nameAndParams += "@block" | ||
} | ||
} | ||
if (!node.postfix && node.nodes) { | ||
this.block(node, name + params) | ||
this.block(node, nameAndParams) | ||
} else { | ||
@@ -249,3 +272,3 @@ const end = | ||
(!node.omittedSemi && semicolon ? ";" : "") | ||
this.builder(name + params + end, node) | ||
this.builder(nameAndParams + end, node) | ||
} | ||
@@ -252,0 +275,0 @@ } |
{ | ||
"name": "postcss-styl", | ||
"version": "0.5.11", | ||
"version": "0.6.0", | ||
"description": "PostCSS parser plugin for converting Stylus syntax to PostCSS AST.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125558
3828