File tree Expand file tree Collapse file tree 13 files changed +588
-9
lines changed Expand file tree Collapse file tree 13 files changed +588
-9
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,6 @@ class SassParser extends StylesheetParser {
268
268
269
269
_readIndentation ();
270
270
}
271
- if (! buffer.trailingString.trimRight ().endsWith ("*/" )) buffer.write (" */" );
272
271
273
272
return LoudComment (buffer.interpolation (scanner.spanFrom (start)));
274
273
}
Original file line number Diff line number Diff line change @@ -1911,8 +1911,10 @@ final class _EvaluateVisitor
1911
1911
_endOfImports++ ;
1912
1912
}
1913
1913
1914
- _parent.addChild (ModifiableCssComment (
1915
- await _performInterpolation (node.text), node.span));
1914
+ var text = await _performInterpolation (node.text);
1915
+ // Indented syntax doesn't require */
1916
+ if (! text.endsWith ("*/" )) text += " */" ;
1917
+ _parent.addChild (ModifiableCssComment (text, node.span));
1916
1918
return null ;
1917
1919
}
1918
1920
Original file line number Diff line number Diff line change 5
5
// DO NOT EDIT. This file was generated from async_evaluate.dart.
6
6
// See tool/grind/synchronize.dart for details.
7
7
//
8
- // Checksum: ebf292c26dcfdd7f61fd70ce3dc9e0be2b6708b3
8
+ // Checksum: 2ab69d23a3b34cb54ddd74e2e854614dda582174
9
9
//
10
10
// ignore_for_file: unused_import
11
11
@@ -1903,8 +1903,10 @@ final class _EvaluateVisitor
1903
1903
_endOfImports++ ;
1904
1904
}
1905
1905
1906
- _parent.addChild (
1907
- ModifiableCssComment (_performInterpolation (node.text), node.span));
1906
+ var text = _performInterpolation (node.text);
1907
+ // Indented syntax doesn't require */
1908
+ if (! text.endsWith ("*/" )) text += " */" ;
1909
+ _parent.addChild (ModifiableCssComment (text, node.span));
1908
1910
return null ;
1909
1911
}
1910
1912
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const config = {
3
3
roots : [ 'lib' ] ,
4
4
testEnvironment : 'node' ,
5
5
setupFilesAfterEnv : [ 'jest-extended/all' , '<rootDir>/test/setup.ts' ] ,
6
+ verbose : false ,
6
7
} ;
7
8
8
9
export default config ;
Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ export {
33
33
InterpolationRaws ,
34
34
NewNodeForInterpolation ,
35
35
} from './src/interpolation' ;
36
+ export {
37
+ CssComment ,
38
+ CssCommentProps ,
39
+ CssCommentRaws ,
40
+ } from './src/statement/css-comment' ;
36
41
export {
37
42
DebugRule ,
38
43
DebugRuleProps ,
Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ declare namespace SassInternal {
101
101
readonly isExclusive : boolean ;
102
102
}
103
103
104
+ class LoudComment extends Statement {
105
+ readonly text : Interpolation ;
106
+ }
107
+
104
108
class Stylesheet extends ParentStatement < Statement [ ] > { }
105
109
106
110
class StyleRule extends ParentStatement < Statement [ ] > {
@@ -143,6 +147,7 @@ export type EachRule = SassInternal.EachRule;
143
147
export type ErrorRule = SassInternal . ErrorRule ;
144
148
export type ExtendRule = SassInternal . ExtendRule ;
145
149
export type ForRule = SassInternal . ForRule ;
150
+ export type LoudComment = SassInternal . LoudComment ;
146
151
export type Stylesheet = SassInternal . Stylesheet ;
147
152
export type StyleRule = SassInternal . StyleRule ;
148
153
export type Interpolation = SassInternal . Interpolation ;
@@ -158,6 +163,7 @@ export interface StatementVisitorObject<T> {
158
163
visitErrorRule ( node : ErrorRule ) : T ;
159
164
visitExtendRule ( node : ExtendRule ) : T ;
160
165
visitForRule ( node : ForRule ) : T ;
166
+ visitLoudComment ( node : LoudComment ) : T ;
161
167
visitStyleRule ( node : StyleRule ) : T ;
162
168
}
163
169
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` a CSS-style comment toJSON 1` ] = `
4
+ {
5
+ " inputs" : [
6
+ {
7
+ " css" : " /* foo */" ,
8
+ " hasBOM" : false ,
9
+ " id" : " <input css _____>" ,
10
+ },
11
+ ],
12
+ " raws" : {
13
+ " closed" : true ,
14
+ " left" : " " ,
15
+ " right" : " " ,
16
+ },
17
+ " sassType" : " comment" ,
18
+ " source" : < 1 :1 - 1 :10 in 0 > ,
19
+ " text" : " foo" ,
20
+ " textInterpolation" : <foo >,
21
+ "type": "comment",
22
+ }
23
+ `;
Original file line number Diff line number Diff line change
1
+ // Copyright 2024 Google Inc. Use of this source code is governed by an
2
+ // MIT-style license that can be found in the LICENSE file or at
3
+ // https://opensource.org/licenses/MIT.
4
+
5
+ import * as postcss from 'postcss' ;
6
+
7
+ import { Root } from './root' ;
8
+ import { ChildNode , NewNode } from '.' ;
9
+
10
+ /**
11
+ * A fake intermediate class to convince TypeScript to use Sass types for
12
+ * various upstream methods.
13
+ *
14
+ * @hidden
15
+ */
16
+ export class _Comment < Props > extends postcss . Comment {
17
+ // Override the PostCSS types to constrain them to Sass types only.
18
+ // Unfortunately, there's no way to abstract this out, because anything
19
+ // mixin-like returns an intersection type which doesn't actually override
20
+ // parent methods. See microsoft/TypeScript#59394.
21
+
22
+ after ( newNode : NewNode ) : this;
23
+ assign ( overrides : Partial < Props > ) : this;
24
+ before ( newNode : NewNode ) : this;
25
+ cloneAfter ( overrides ?: Partial < Props > ) : this;
26
+ cloneBefore ( overrides ?: Partial < Props > ) : this;
27
+ next ( ) : ChildNode | undefined ;
28
+ prev ( ) : ChildNode | undefined ;
29
+ replaceWith ( ...nodes : NewNode [ ] ) : this;
30
+ root ( ) : Root ;
31
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2024 Google Inc. Use of this source code is governed by an
2
+ // MIT-style license that can be found in the LICENSE file or at
3
+ // https://opensource.org/licenses/MIT.
4
+
5
+ exports . _Comment = require ( 'postcss' ) . Comment ;
You can’t perform that action at this time.
0 commit comments