Skip to content

Commit 9e6e3bf

Browse files
authored
Merge pull request #2468 from sass/declaration
Add support for declarations
2 parents 3d3e925 + 34e0aaa commit 9e6e3bf

38 files changed

+1107
-151
lines changed

pkg/sass-parser/lib/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ export {
9999
DebugRuleProps,
100100
DebugRuleRaws,
101101
} from './src/statement/debug-rule';
102+
export {
103+
Declaration,
104+
DeclarationProps,
105+
DeclarationRaws,
106+
} from './src/statement/declaration';
102107
export {EachRule, EachRuleProps, EachRuleRaws} from './src/statement/each-rule';
103108
export {
104109
ErrorRule,
@@ -142,10 +147,12 @@ export {
142147
} from './src/statement/sass-comment';
143148
export {UseRule, UseRuleProps, UseRuleRaws} from './src/statement/use-rule';
144149
export {
150+
AnyDeclaration,
145151
AnyStatement,
146152
AtRule,
147153
ChildNode,
148154
ChildProps,
155+
Comment,
149156
ContainerProps,
150157
NewNode,
151158
Statement,
@@ -196,7 +203,7 @@ class _Syntax implements Syntax {
196203
}
197204

198205
stringify(node: postcss.AnyNode, builder: postcss.Builder): void {
199-
new Stringifier(builder).stringify(node, true);
206+
new Stringifier(builder).stringify(node, false);
200207
}
201208
}
202209

pkg/sass-parser/lib/src/argument-list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Argument, ArgumentProps} from './argument';
88
import {Container} from './container';
99
import {convertExpression} from './expression/convert';
1010
import {LazySource} from './lazy-source';
11-
import {Node} from './node';
11+
import {Node, NodeProps} from './node';
1212
import * as sassInternal from './sass-internal';
1313
import * as utils from './utils';
1414

@@ -30,7 +30,7 @@ export type NewArguments =
3030
*
3131
* @category Expression
3232
*/
33-
export interface ArgumentListObjectProps {
33+
export interface ArgumentListObjectProps extends NodeProps {
3434
nodes?: ReadonlyArray<NewArguments>;
3535
raws?: ArgumentListRaws;
3636
}

pkg/sass-parser/lib/src/argument.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as postcss from 'postcss';
66

77
import {Expression, ExpressionProps} from './expression';
88
import {fromProps} from './expression/from-props';
9-
import {Node} from './node';
9+
import {Node, NodeProps} from './node';
1010
import {ArgumentList} from './argument-list';
1111
import * as sassInternal from './sass-internal';
1212
import {RawWithValue} from './raw-with-value';
@@ -58,7 +58,7 @@ export interface ArgumentRaws {
5858
*
5959
* @category Expression
6060
*/
61-
export type ArgumentObjectProps = {
61+
export type ArgumentObjectProps = NodeProps & {
6262
raws?: ArgumentRaws;
6363
value: Expression | ExpressionProps;
6464
} & ({name?: string; rest?: never} | {name?: never; rest?: boolean});

pkg/sass-parser/lib/src/configuration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
ConfiguredVariableProps,
1111
} from './configured-variable';
1212
import {LazySource} from './lazy-source';
13-
import {Node} from './node';
13+
import {Node, NodeProps} from './node';
1414
import type * as sassInternal from './sass-internal';
1515
import * as utils from './utils';
1616
import {ForwardRule} from './statement/forward-rule';
@@ -37,7 +37,7 @@ export interface ConfigurationRaws {
3737
*
3838
* @category Statement
3939
*/
40-
export interface ConfigurationProps {
40+
export interface ConfigurationProps extends NodeProps {
4141
raws?: ConfigurationRaws;
4242
variables:
4343
| Record<string, ConfiguredVariableExpressionProps>

pkg/sass-parser/lib/src/configured-variable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {convertExpression} from './expression/convert';
99
import {Expression, ExpressionProps} from './expression';
1010
import {fromProps} from './expression/from-props';
1111
import {LazySource} from './lazy-source';
12-
import {Node} from './node';
12+
import {Node, NodeProps} from './node';
1313
import * as sassInternal from './sass-internal';
1414
import {RawWithValue} from './raw-with-value';
1515
import * as utils from './utils';
@@ -53,7 +53,7 @@ export interface ConfiguredVariableRaws {
5353
*
5454
* @category Statement
5555
*/
56-
export interface ConfiguredVariableObjectProps {
56+
export interface ConfiguredVariableObjectProps extends NodeProps {
5757
raws?: ConfiguredVariableRaws;
5858
name: string;
5959
expression: Expression | ExpressionProps;

pkg/sass-parser/lib/src/expression/binary-operation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import * as postcss from 'postcss';
66

77
import {LazySource} from '../lazy-source';
8+
import {NodeProps} from '../node';
89
import type * as sassInternal from '../sass-internal';
910
import * as utils from '../utils';
1011
import {Expression, ExpressionProps} from '.';
@@ -33,7 +34,7 @@ export type BinaryOperator =
3334
*
3435
* @category Expression
3536
*/
36-
export interface BinaryOperationExpressionProps {
37+
export interface BinaryOperationExpressionProps extends NodeProps {
3738
operator: BinaryOperator;
3839
left: Expression | ExpressionProps;
3940
right: Expression | ExpressionProps;

pkg/sass-parser/lib/src/expression/boolean.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import * as postcss from 'postcss';
66

77
import {LazySource} from '../lazy-source';
8+
import {NodeProps} from '../node';
89
import type * as sassInternal from '../sass-internal';
910
import * as utils from '../utils';
1011
import {Expression} from '.';
@@ -14,7 +15,7 @@ import {Expression} from '.';
1415
*
1516
* @category Expression
1617
*/
17-
export interface BooleanExpressionProps {
18+
export interface BooleanExpressionProps extends NodeProps {
1819
value: boolean;
1920
raws?: BooleanExpressionRaws;
2021
}

pkg/sass-parser/lib/src/expression/number.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import * as postcss from 'postcss';
66

77
import {LazySource} from '../lazy-source';
8+
import {NodeProps} from '../node';
89
import type * as sassInternal from '../sass-internal';
910
import * as utils from '../utils';
1011
import {Expression} from '.';
@@ -14,7 +15,7 @@ import {Expression} from '.';
1415
*
1516
* @category Expression
1617
*/
17-
export interface NumberExpressionProps {
18+
export interface NumberExpressionProps extends NodeProps {
1819
value: number;
1920
unit?: string;
2021
raws?: NumberExpressionRaws;

pkg/sass-parser/lib/src/expression/string.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as postcss from 'postcss';
66

77
import {Interpolation, InterpolationProps} from '../interpolation';
88
import {LazySource} from '../lazy-source';
9+
import {NodeProps} from '../node';
910
import type * as sassInternal from '../sass-internal';
1011
import * as utils from '../utils';
1112
import {Expression} from '.';
@@ -15,7 +16,7 @@ import {Expression} from '.';
1516
*
1617
* @category Expression
1718
*/
18-
export interface StringExpressionProps {
19+
export interface StringExpressionProps extends NodeProps {
1920
text: Interpolation | InterpolationProps;
2021
quotes?: boolean;
2122
raws?: StringExpressionRaws;

pkg/sass-parser/lib/src/interpolation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {convertExpression} from './expression/convert';
99
import {fromProps} from './expression/from-props';
1010
import {Expression, ExpressionProps} from './expression';
1111
import {LazySource} from './lazy-source';
12-
import {Node} from './node';
12+
import {Node, NodeProps} from './node';
1313
import {RawWithValue} from './raw-with-value';
1414
import type * as sassInternal from './sass-internal';
1515
import * as utils from './utils';
@@ -39,7 +39,7 @@ export type NewNodeForInterpolation =
3939
*
4040
* @category Expression
4141
*/
42-
export interface InterpolationObjectProps {
42+
export interface InterpolationObjectProps extends NodeProps {
4343
nodes: ReadonlyArray<NewNodeForInterpolation>;
4444
raws?: InterpolationRaws;
4545
}

0 commit comments

Comments
 (0)