postcss-styl
Advanced tools
Comparing version 0.5.6 to 0.5.7
@@ -1542,2 +1542,3 @@ "use strict" | ||
let bodyStartIndex = null | ||
let openBraceIndex = null | ||
if (!hasBrace) { | ||
@@ -1566,8 +1567,12 @@ // stylus style selector | ||
// ^ | ||
const braceIndex = beforeBlockNodeEndIndex + checkBrase[0].length | ||
bodyStartIndex = braceIndex + 1 | ||
startIndex = braceIndex | ||
openBraceIndex = beforeBlockNodeEndIndex + checkBrase[0].length | ||
bodyStartIndex = openBraceIndex + 1 | ||
startIndex = openBraceIndex | ||
} | ||
const endIndex = this.getBlockEndIndex(bodyStartIndex, parent, info) | ||
const endIndex = this.getBlockEndIndex(bodyStartIndex, parent, { | ||
hasBrace, | ||
info, | ||
openBraceIndex, | ||
}) | ||
const bodyText = this.sourceCode.text.slice( | ||
@@ -1606,3 +1611,7 @@ bodyStartIndex, | ||
getBlockEndIndex(_bodyStartIndex, parent, info) { | ||
getBlockEndIndex( | ||
_bodyStartIndex, | ||
parent, | ||
{ hasBrace, openBraceIndex, info } | ||
) { | ||
const parentEndIndex = this.sourceCode.getIndex( | ||
@@ -1624,2 +1633,18 @@ parent.source.endChildren || parent.source.end || this.sourceEnd | ||
} | ||
if (hasBrace) { | ||
const cursor = this.sourceCode.createScopeTokenCursor( | ||
openBraceIndex, | ||
{ | ||
endLocationIndex: parentEndIndex, | ||
} | ||
) | ||
let token = cursor.next() | ||
while (token) { | ||
if (cursor.scopeLevel === 1 && token.value === "}") { | ||
return token.range[0] | ||
} | ||
token = cursor.next() | ||
} | ||
} | ||
const { startIndex } = parseRawAfter(this.sourceCode, parentEndIndex, { | ||
@@ -1626,0 +1651,0 @@ blockCommentIsRaw: false, |
@@ -72,5 +72,13 @@ "use strict" | ||
if (sourceCode.text[index] === "}") { | ||
if (node.nodes[0]) { | ||
return this.getStartIndex(sourceCode, node.nodes[0]) | ||
const c = sourceCode.text[index] | ||
if (c === "}" || c === "{") { | ||
// The index may shift if the selector is next to the brace. | ||
const firstChild = node.nodes[0] | ||
if ( | ||
firstChild && | ||
getName(firstChild) === "selector" && | ||
firstChild.column === node.column + 1 && | ||
firstChild.line === node.line | ||
) { | ||
return this.getStartIndex(sourceCode, firstChild) | ||
} | ||
@@ -77,0 +85,0 @@ } |
{ | ||
"name": "postcss-styl", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"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
120046
3655