@@ -498,7 +498,7 @@ class StylusParser {
498498 if ( rawAfter . after !== rawAfter . stylusAfter ) {
499499 rootNode . raws . stylusAfter = rawAfter . stylusAfter
500500 }
501- this . pushInlineComments ( rootNode , rawAfter . inlineComments )
501+ this . pushComments ( rootNode , rawAfter . inlineComments )
502502 return rootNode
503503 }
504504
@@ -1241,7 +1241,9 @@ class StylusParser {
12411241 let rawStylusBefore = null
12421242 if ( postfix ) {
12431243 const { after : postfixBefore , stylusAfter : postfixStylusBefore } =
1244- parseRawAfter ( this . sourceCode , startIndex - 1 )
1244+ parseRawAfter ( this . sourceCode , startIndex - 1 , {
1245+ blockCommentAsRaw : true ,
1246+ } )
12451247 rawBefore = ""
12461248 rawStylusBefore = ""
12471249 atRuleRaws . postfixBefore = postfixBefore
@@ -1311,7 +1313,7 @@ class StylusParser {
13111313 childNodes . forEach ( ( n , i ) =>
13121314 this . process ( n , atRule , new ProcessInfo ( childNodes , i , info ) ) ,
13131315 )
1314- this . pushInlineComments ( atRule , blockAfterInlineComments )
1316+ this . pushComments ( atRule , blockAfterInlineComments )
13151317 }
13161318 atrulePostProc ( atRule , { postfix, parsedNameAndCondition } )
13171319 return atRule
@@ -1528,7 +1530,7 @@ class StylusParser {
15281530 }
15291531 } )
15301532
1531- this . pushInlineComments ( atRule , blockAfterInlineComments )
1533+ this . pushComments ( atRule , blockAfterInlineComments )
15321534 atrulePostProc ( atRule , { } )
15331535
15341536 atRule . object = true
@@ -1749,7 +1751,7 @@ class StylusParser {
17491751 blockNode . nodes . forEach ( ( n , i ) =>
17501752 this . process ( n , rule , new ProcessInfo ( blockNode . nodes , i , info ) ) ,
17511753 )
1752- this . pushInlineComments ( rule , afterInlineComments )
1754+ this . pushComments ( rule , afterInlineComments )
17531755
17541756 // raws.semicolon
17551757 const lastAstNode = findLast ( rule . nodes , ( n ) => n . type !== "comment" )
@@ -2045,7 +2047,7 @@ class StylusParser {
20452047 sourceCode ,
20462048 initEndIndex ,
20472049 {
2048- blockCommentAsRaw : false ,
2050+ blockCommentAsRaw : true ,
20492051 maxIndent : blockContentIndent ,
20502052 } ,
20512053 )
@@ -2135,15 +2137,18 @@ class StylusParser {
21352137 end && this . sourceCode . getIndex ( end ) ,
21362138 )
21372139 }
2138- this . pushInlineComments ( parent , parsedRawBefore . inlineComments )
2140+ this . pushComments ( parent , parsedRawBefore . inlineComments )
21392141 return parsedRawBefore
21402142 }
21412143
2142- pushInlineComments ( parent , inlineComments ) {
2143- for ( const { token, before, stylusBefore } of inlineComments ) {
2144+ pushComments ( parent , comments ) {
2145+ for ( const { token, before, stylusBefore } of comments ) {
2146+ const inline = token . type === "inline-comment"
21442147 const startIndex = token . range [ 0 ]
21452148 const endIndex = token . range [ 1 ] - 1
2146- const contents = token . value . replace ( / ^ \/ \/ / gu, "" )
2149+ const contents = inline
2150+ ? token . value . replace ( / ^ \/ \/ / gu, "" )
2151+ : token . value . replace ( / ^ \/ \* | \* \/ $ / gu, "" )
21472152 const text = contents . trim ( )
21482153 const commentSource = {
21492154 start : this . sourceCode . getLoc ( startIndex ) ,
@@ -2154,7 +2159,7 @@ class StylusParser {
21542159 before,
21552160 left : text ? / ^ \s * / u. exec ( contents ) [ 0 ] : contents ,
21562161 right : text ? / \s * $ / u. exec ( contents ) [ 0 ] : "" ,
2157- inline : true ,
2162+ inline,
21582163 }
21592164 if ( before !== stylusBefore ) {
21602165 commentRaws . stylusBefore = stylusBefore
0 commit comments