@jesscss/scss-parser 2.0.0-alpha.11 → 2.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -9
- package/lib/chunks/parse-with.cjs +147 -0
- package/lib/chunks/parse-with.js +130 -0
- package/lib/chunks/trivia-labels.cjs +18 -0
- package/lib/chunks/trivia-labels.js +13 -0
- package/lib/cst/positions.cjs +24 -0
- package/lib/cst/positions.js +21 -0
- package/lib/cst.cjs +11 -4
- package/lib/cst.d.ts +8 -2
- package/lib/cst.js +10 -4
- package/lib/grammar/ast/positions.cjs +14296 -0
- package/lib/grammar/ast/positions.js +14295 -0
- package/lib/grammar/ast.cjs +70635 -0
- package/lib/grammar/ast.d.ts +11 -0
- package/lib/grammar/ast.js +70634 -0
- package/lib/grammar/cst/positions.cjs +14296 -0
- package/lib/grammar/cst/positions.js +14295 -0
- package/lib/grammar/cst.cjs +14294 -0
- package/lib/grammar/cst.d.ts +2 -0
- package/lib/grammar/cst.js +14293 -0
- package/lib/grammar.d.ts +6 -336
- package/lib/index.cjs +10 -103
- package/lib/index.d.ts +9 -9
- package/lib/index.js +9 -103
- package/lib/parse-error.d.ts +43 -0
- package/lib/parse-with.d.ts +5 -0
- package/lib/positions.cjs +12 -0
- package/lib/positions.js +9 -0
- package/lib/trivia-labels.d.ts +10 -0
- package/package.json +42 -12
- package/lib/ast/lower-user-function-calls.d.ts +0 -6
- package/lib/grammar.cjs +0 -99039
- package/lib/grammar.js +0 -99035
package/lib/grammar.d.ts
CHANGED
|
@@ -1,336 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly value: string;
|
|
8
|
-
};
|
|
9
|
-
type ScssValuePair = {
|
|
10
|
-
readonly separator: string;
|
|
11
|
-
readonly value: ValueSlot;
|
|
12
|
-
};
|
|
13
|
-
type ScssCallArg = {
|
|
14
|
-
readonly value: ValueSlot;
|
|
15
|
-
readonly name?: string;
|
|
16
|
-
readonly spread?: boolean;
|
|
17
|
-
};
|
|
18
|
-
type ScssComplexTail = {
|
|
19
|
-
readonly comb: ' ' | '>' | '+' | '~' | '||';
|
|
20
|
-
readonly compound: CompoundSelector;
|
|
21
|
-
};
|
|
22
|
-
type ScssRules = {
|
|
23
|
-
Stylesheet: Combinator<Stylesheet>;
|
|
24
|
-
ScssAstDocument: Combinator<Stylesheet>;
|
|
25
|
-
VariableDeclaration: Combinator<VariableDeclaration>;
|
|
26
|
-
DirectScssComment: Combinator<Comment>;
|
|
27
|
-
DirectScssVarReference: Combinator<VariableReference>;
|
|
28
|
-
SassInterpolation: Combinator<Interpolation>;
|
|
29
|
-
DirectScssQuoted: Combinator<Quoted | Interpolation>;
|
|
30
|
-
DirectScssStaticQuoted: Combinator<Quoted>;
|
|
31
|
-
DirectScssKeyword: Combinator<Keyword>;
|
|
32
|
-
DirectScssCustomPropertyValue: Combinator<Keyword>;
|
|
33
|
-
DirectScssColor: Combinator<Color>;
|
|
34
|
-
DirectScssUnicodeRange: Combinator<ValueNode>;
|
|
35
|
-
DirectScssDimension: Combinator<Dimension>;
|
|
36
|
-
DirectScssInterpolatedUrlValue: Combinator<Interpolation>;
|
|
37
|
-
DirectScssInterpolatedValue: Combinator<Interpolation>;
|
|
38
|
-
DirectScssParen: Combinator<ValueNode>;
|
|
39
|
-
DirectScssMapEntry: Combinator<Declaration>;
|
|
40
|
-
DirectScssMap: Combinator<Collection>;
|
|
41
|
-
DirectScssReturn: Combinator<Declaration>;
|
|
42
|
-
DirectScssFunction: Combinator<VariableDeclaration>;
|
|
43
|
-
DirectScssSquare: Combinator<ValueNode>;
|
|
44
|
-
ScssValueAtom: Combinator<ValueNode>;
|
|
45
|
-
DirectScssMathUnary: Combinator<ValueNode>;
|
|
46
|
-
DirectScssMathProduct: Combinator<ValueNode>;
|
|
47
|
-
DirectScssMathSum: Combinator<ValueNode>;
|
|
48
|
-
DirectScssMathTopProduct: Combinator<ValueNode>;
|
|
49
|
-
DirectScssMathTopSum: Combinator<ValueNode>;
|
|
50
|
-
DirectScssValueTerm: Combinator<ValueSlot>;
|
|
51
|
-
DirectScssValuePair: Combinator<ScssValuePair>;
|
|
52
|
-
DirectScssValue: Combinator<ValueSlot>;
|
|
53
|
-
DirectScssImportant: Combinator<true>;
|
|
54
|
-
DirectScssInterpolatedProperty: Combinator<Interpolation>;
|
|
55
|
-
DirectScssCustomPropertyName: Combinator<string | Interpolation>;
|
|
56
|
-
DirectScssCustomPart: Combinator<unknown>;
|
|
57
|
-
DirectScssCustomInnerPart: Combinator<unknown>;
|
|
58
|
-
DirectScssCustomParen: Combinator<readonly unknown[]>;
|
|
59
|
-
DirectScssCustomSquare: Combinator<readonly unknown[]>;
|
|
60
|
-
DirectScssCustomCurly: Combinator<readonly unknown[]>;
|
|
61
|
-
DirectScssCustomValue: Combinator<ValueNode>;
|
|
62
|
-
DirectScssCustomDeclaration: Combinator<Declaration>;
|
|
63
|
-
DirectScssDeclaration: Combinator<Declaration>;
|
|
64
|
-
DirectScssStaticNestedPropertyLeaf: Combinator<Declaration>;
|
|
65
|
-
DirectScssStaticNestedProperty: Combinator<Declaration>;
|
|
66
|
-
ScssImport: Combinator<ImportAtRule>;
|
|
67
|
-
DirectScssUseAs: Combinator<string>;
|
|
68
|
-
DirectScssUse: Combinator<StyleImport | ModuleImport>;
|
|
69
|
-
DirectScssForward: Combinator<StyleImport>;
|
|
70
|
-
DirectScssStaticImportUrl: Combinator<Url>;
|
|
71
|
-
DirectScssStaticImportLayer: Combinator<ValueNode>;
|
|
72
|
-
DirectScssStaticImportDeclaration: Combinator<ValueNode>;
|
|
73
|
-
DirectScssStaticImportSupports: Combinator<FunctionCall>;
|
|
74
|
-
DirectScssStaticImportQualifier: Combinator<ValueNode>;
|
|
75
|
-
DirectScssStaticImportMediaFeature: Combinator<ValueNode>;
|
|
76
|
-
DirectScssStaticImportMediaInParens: Combinator<ValueNode>;
|
|
77
|
-
DirectScssStaticImportMediaCondition: Combinator<ValueNode>;
|
|
78
|
-
DirectScssStaticImportMediaOnlyClause: Combinator<ValueNode>;
|
|
79
|
-
DirectScssStaticImportMediaClause: Combinator<ValueNode>;
|
|
80
|
-
DirectScssStaticImportMediaPrelude: Combinator<ValueNode>;
|
|
81
|
-
DirectScssStaticImportTail: Combinator<ValueNode>;
|
|
82
|
-
DirectScssMixinParam: Combinator<Param>;
|
|
83
|
-
DirectScssMixinParams: Combinator<Param[]>;
|
|
84
|
-
ScssMixinCallArg: Combinator<ScssCallArg>;
|
|
85
|
-
DirectScssMixinCall: Combinator<MixinCall>;
|
|
86
|
-
DirectScssMixinDef: Combinator<MixinDef>;
|
|
87
|
-
DirectScssEachName: Combinator<string>;
|
|
88
|
-
DirectScssEachBinding: Combinator<ForBinding>;
|
|
89
|
-
DirectScssEach: Combinator<For>;
|
|
90
|
-
DirectScssFor: Combinator<For>;
|
|
91
|
-
DirectScssIfCondition: Combinator<GuardNode>;
|
|
92
|
-
DirectScssIfAnd: Combinator<GuardNode>;
|
|
93
|
-
DirectScssIfTerm: Combinator<GuardNode>;
|
|
94
|
-
DirectScssIfAtom: Combinator<GuardNode>;
|
|
95
|
-
DirectScssIfComparison: Combinator<GuardNode>;
|
|
96
|
-
DirectScssIfBody: Combinator<Statement[]>;
|
|
97
|
-
DirectScssIfStaticRule: Combinator<Rule>;
|
|
98
|
-
DirectScssIfStaticConditionalBlock: Combinator<AtRuleBlock>;
|
|
99
|
-
DirectScssIf: Combinator<If>;
|
|
100
|
-
DirectScssQueryFeature: Combinator<ValueNode>;
|
|
101
|
-
DirectScssQueryFunction: Combinator<FunctionCall>;
|
|
102
|
-
DirectScssQueryInParens: Combinator<ValueNode>;
|
|
103
|
-
DirectScssQueryCondition: Combinator<ValueNode>;
|
|
104
|
-
DirectScssQueryClause: Combinator<ValueNode>;
|
|
105
|
-
DirectScssQueryPreludeTail: Combinator<ValueNode>;
|
|
106
|
-
DirectScssQueryPrelude: Combinator<ValueNode>;
|
|
107
|
-
DirectScssSupportsAtom: Combinator<ValueNode>;
|
|
108
|
-
DirectScssGeneralTemplate: Combinator<Interpolation>;
|
|
109
|
-
DirectScssGeneralTemplateParen: Combinator<Interpolation>;
|
|
110
|
-
DirectScssGeneralTemplateSquare: Combinator<Interpolation>;
|
|
111
|
-
DirectScssGeneralTemplateBrace: Combinator<Interpolation>;
|
|
112
|
-
DirectScssGeneralTemplateDoubleQuoted: Combinator<Interpolation>;
|
|
113
|
-
DirectScssGeneralTemplateSingleQuoted: Combinator<Interpolation>;
|
|
114
|
-
DirectScssGeneralEnclosed: Combinator<GeneralEnclosed>;
|
|
115
|
-
DirectScssSupportsFeature: Combinator<ValueNode>;
|
|
116
|
-
DirectScssSupportsInParens: Combinator<ValueNode>;
|
|
117
|
-
DirectScssSupportsNot: Combinator<Keyword>;
|
|
118
|
-
DirectScssSupportsAndOr: Combinator<Keyword>;
|
|
119
|
-
DirectScssSupportsCondition: Combinator<ValueNode>;
|
|
120
|
-
DirectScssSupportsPrelude: Combinator<ValueNode>;
|
|
121
|
-
DirectScssStaticMediaPrelude: Combinator<ValueNode>;
|
|
122
|
-
/** Static-only generic CSS header capture for known passthrough blocks. */
|
|
123
|
-
DirectScssStaticAtPrelude: Combinator<ValueNode | null>;
|
|
124
|
-
DirectScssStaticAtPreludeAtom: Combinator<Token>;
|
|
125
|
-
DirectScssStaticAtPreludeParen: Combinator<Token>;
|
|
126
|
-
DirectScssStaticAtPreludeSquare: Combinator<Token>;
|
|
127
|
-
DirectScssStaticAtPreludeDoubleQuoted: Combinator<Token>;
|
|
128
|
-
DirectScssStaticAtPreludeSingleQuoted: Combinator<Token>;
|
|
129
|
-
DirectScssAtRuleStatement: Combinator<AtRuleStatement>;
|
|
130
|
-
DirectScssScopeBlock: Combinator<AtRuleBlock>;
|
|
131
|
-
DirectScssNestedScopeBlock: Combinator<AtRuleBlock>;
|
|
132
|
-
DirectScssConditionalBlock: Combinator<AtRuleBlock>;
|
|
133
|
-
DirectScssStartingStyleBlock: Combinator<AtRuleBlock>;
|
|
134
|
-
DirectScssLayerBlock: Combinator<AtRuleBlock>;
|
|
135
|
-
/** Static `@document` / `@-moz-document` with a frame-one stylesheet body. */
|
|
136
|
-
DirectScssDocumentBlock: Combinator<AtRuleBlock>;
|
|
137
|
-
DirectScssPageMarginBox: Combinator<AtRuleBlock>;
|
|
138
|
-
DirectScssPageBlock: Combinator<AtRuleBlock>;
|
|
139
|
-
DirectScssFontFeatureValueBlock: Combinator<AtRuleBlock>;
|
|
140
|
-
DirectScssFontFeatureValuesBlock: Combinator<AtRuleBlock>;
|
|
141
|
-
DirectScssFontFace: Combinator<AtRuleBlock>;
|
|
142
|
-
DirectScssCounterStyle: Combinator<AtRuleBlock>;
|
|
143
|
-
DirectScssPropertyName: Combinator<Keyword>;
|
|
144
|
-
DirectScssPropertyAtRule: Combinator<AtRuleBlock>;
|
|
145
|
-
DirectScssKeyframeSelector: Combinator<SimpleSelector>;
|
|
146
|
-
DirectScssKeyframeBlock: Combinator<Rule>;
|
|
147
|
-
DirectScssKeyframes: Combinator<AtRuleBlock>;
|
|
148
|
-
DirectScssNestedConditionalBlock: Combinator<AtRuleBlock>;
|
|
149
|
-
DirectScssNestedStartingStyleBlock: Combinator<AtRuleBlock>;
|
|
150
|
-
DirectScssNestedLayerBlock: Combinator<AtRuleBlock>;
|
|
151
|
-
DirectScssSimple: Combinator<SimpleSelector>;
|
|
152
|
-
DirectScssInterpolatedSimple: Combinator<SimpleSelector>;
|
|
153
|
-
DirectScssPlaceholder: Combinator<SimpleSelector>;
|
|
154
|
-
DirectScssAttribute: Combinator<SimpleSelector>;
|
|
155
|
-
DirectScssPseudoArgument: Combinator<string>;
|
|
156
|
-
DirectScssStaticSelectorPseudoArgument: Combinator<string>;
|
|
157
|
-
DirectScssStaticSelectorPseudoItem: Combinator<string>;
|
|
158
|
-
DirectScssStaticSelectorPseudoTail: Combinator<string>;
|
|
159
|
-
DirectScssStaticPseudoArgument: Combinator<string>;
|
|
160
|
-
DirectScssStaticPseudoGroup: Combinator<string>;
|
|
161
|
-
DirectScssStaticPseudoSquare: Combinator<string>;
|
|
162
|
-
DirectScssPseudo: Combinator<SimpleToken>;
|
|
163
|
-
DirectScssNestingSelector: Combinator<SimpleSelector>;
|
|
164
|
-
DirectScssCompound: Combinator<CompoundSelector>;
|
|
165
|
-
DirectScssComplexTail: Combinator<ScssComplexTail>;
|
|
166
|
-
DirectScssComplex: Combinator<ComplexSelector>;
|
|
167
|
-
DirectScssSelectorTail: Combinator<ComplexSelector>;
|
|
168
|
-
DirectScssSelector: Combinator<SelectorList>;
|
|
169
|
-
DirectScssExtend: Combinator<ExtendInstruction>;
|
|
170
|
-
DirectScssOpaquePrelude: Combinator<string | null>;
|
|
171
|
-
DirectScssOpaqueBody: Combinator<string>;
|
|
172
|
-
DirectScssOpaqueAtRuleBlock: Combinator<OpaqueAtRuleBlock>;
|
|
173
|
-
DirectScssOpaqueAtRuleStatement: Combinator<AtRuleStatement>;
|
|
174
|
-
DirectScssRule: Combinator<Rule>;
|
|
175
|
-
rw: Combinator<unknown>;
|
|
176
|
-
whitespace: Combinator<unknown>;
|
|
177
|
-
};
|
|
178
|
-
type ScssInputRules = ScssRules & typeof cssSyntax & typeof cssPseudoSyntax & typeof opaqueAtRuleRecognition;
|
|
179
|
-
export declare const scssFactory: (g: ScssInputRules) => {
|
|
180
|
-
Stylesheet: Combinator<Stylesheet>;
|
|
181
|
-
ScssAstDocument: Combinator<Stylesheet>;
|
|
182
|
-
VariableDeclaration: Combinator<VariableDeclaration>;
|
|
183
|
-
DirectScssComment: Combinator<Comment>;
|
|
184
|
-
DirectScssVarReference: Combinator<VariableReference>;
|
|
185
|
-
SassInterpolation: Combinator<Interpolation>;
|
|
186
|
-
DirectScssQuoted: Combinator<Interpolation | Quoted>;
|
|
187
|
-
DirectScssStaticQuoted: Combinator<Quoted>;
|
|
188
|
-
DirectScssKeyword: Combinator<Keyword>;
|
|
189
|
-
DirectScssCustomPropertyValue: Combinator<Keyword>;
|
|
190
|
-
DirectScssColor: Combinator<Color>;
|
|
191
|
-
DirectScssUnicodeRange: Combinator<ValueNode>;
|
|
192
|
-
DirectScssDimension: Combinator<Dimension>;
|
|
193
|
-
DirectScssInterpolatedUrlValue: Combinator<Interpolation>;
|
|
194
|
-
DirectScssInterpolatedValue: Combinator<Interpolation>;
|
|
195
|
-
DirectScssParen: Combinator<ValueNode>;
|
|
196
|
-
DirectScssMapEntry: Combinator<Declaration>;
|
|
197
|
-
DirectScssMap: Combinator<Collection>;
|
|
198
|
-
DirectScssReturn: Combinator<Declaration>;
|
|
199
|
-
DirectScssFunction: Combinator<VariableDeclaration>;
|
|
200
|
-
DirectScssSquare: Combinator<ValueNode>;
|
|
201
|
-
ScssValueAtom: Combinator<ValueNode>;
|
|
202
|
-
DirectScssMathUnary: Combinator<ValueNode>;
|
|
203
|
-
DirectScssMathProduct: Combinator<ValueNode>;
|
|
204
|
-
DirectScssMathSum: Combinator<ValueNode>;
|
|
205
|
-
DirectScssMathTopProduct: Combinator<ValueNode>;
|
|
206
|
-
DirectScssMathTopSum: Combinator<ValueNode>;
|
|
207
|
-
DirectScssValueTerm: Combinator<ValueSlot>;
|
|
208
|
-
DirectScssValuePair: Combinator<ScssValuePair>;
|
|
209
|
-
DirectScssValue: Combinator<ValueSlot>;
|
|
210
|
-
DirectScssImportant: Combinator<true>;
|
|
211
|
-
DirectScssInterpolatedProperty: Combinator<Interpolation>;
|
|
212
|
-
DirectScssCustomPropertyName: Combinator<string | Interpolation>;
|
|
213
|
-
DirectScssCustomPart: Combinator<unknown>;
|
|
214
|
-
DirectScssCustomInnerPart: Combinator<unknown>;
|
|
215
|
-
DirectScssCustomParen: Combinator<readonly unknown[]>;
|
|
216
|
-
DirectScssCustomSquare: Combinator<readonly unknown[]>;
|
|
217
|
-
DirectScssCustomCurly: Combinator<readonly unknown[]>;
|
|
218
|
-
DirectScssCustomValue: Combinator<ValueNode>;
|
|
219
|
-
DirectScssCustomDeclaration: Combinator<Declaration>;
|
|
220
|
-
DirectScssDeclaration: Combinator<Declaration>;
|
|
221
|
-
DirectScssStaticNestedPropertyLeaf: Combinator<Declaration>;
|
|
222
|
-
DirectScssStaticNestedProperty: Combinator<Declaration>;
|
|
223
|
-
ScssImport: Combinator<ImportAtRule>;
|
|
224
|
-
DirectScssUseAs: Combinator<string>;
|
|
225
|
-
DirectScssUse: Combinator<ModuleImport | StyleImport>;
|
|
226
|
-
DirectScssForward: Combinator<StyleImport>;
|
|
227
|
-
DirectScssStaticImportUrl: Combinator<Url>;
|
|
228
|
-
DirectScssStaticImportLayer: Combinator<ValueNode>;
|
|
229
|
-
DirectScssStaticImportDeclaration: Combinator<ValueNode>;
|
|
230
|
-
DirectScssStaticImportSupports: Combinator<FunctionCall>;
|
|
231
|
-
DirectScssStaticImportQualifier: Combinator<ValueNode>;
|
|
232
|
-
DirectScssStaticImportMediaFeature: Combinator<ValueNode>;
|
|
233
|
-
DirectScssStaticImportMediaInParens: Combinator<ValueNode>;
|
|
234
|
-
DirectScssStaticImportMediaCondition: Combinator<ValueNode>;
|
|
235
|
-
DirectScssStaticImportMediaOnlyClause: Combinator<ValueNode>;
|
|
236
|
-
DirectScssStaticImportMediaClause: Combinator<ValueNode>;
|
|
237
|
-
DirectScssStaticImportMediaPrelude: Combinator<ValueNode>;
|
|
238
|
-
DirectScssStaticImportTail: Combinator<ValueNode>;
|
|
239
|
-
DirectScssMixinParam: Combinator<Param>;
|
|
240
|
-
DirectScssMixinParams: Combinator<Param[]>;
|
|
241
|
-
ScssMixinCallArg: Combinator<ScssCallArg>;
|
|
242
|
-
DirectScssMixinCall: Combinator<MixinCall>;
|
|
243
|
-
DirectScssMixinDef: Combinator<MixinDef>;
|
|
244
|
-
DirectScssEachName: Combinator<string>;
|
|
245
|
-
DirectScssEachBinding: Combinator<ForBinding>;
|
|
246
|
-
DirectScssEach: Combinator<For>;
|
|
247
|
-
DirectScssFor: Combinator<For>;
|
|
248
|
-
DirectScssIfCondition: Combinator<GuardNode>;
|
|
249
|
-
DirectScssIfAnd: Combinator<GuardNode>;
|
|
250
|
-
DirectScssIfTerm: Combinator<GuardNode>;
|
|
251
|
-
DirectScssIfAtom: Combinator<GuardNode>;
|
|
252
|
-
DirectScssIfComparison: Combinator<GuardNode>;
|
|
253
|
-
DirectScssIfBody: Combinator<Statement[]>;
|
|
254
|
-
DirectScssIfStaticRule: Combinator<Rule>;
|
|
255
|
-
DirectScssIfStaticConditionalBlock: Combinator<AtRuleBlock>;
|
|
256
|
-
DirectScssIf: Combinator<If>;
|
|
257
|
-
DirectScssQueryFeature: Combinator<ValueNode>;
|
|
258
|
-
DirectScssQueryFunction: Combinator<FunctionCall>;
|
|
259
|
-
DirectScssQueryInParens: Combinator<ValueNode>;
|
|
260
|
-
DirectScssQueryCondition: Combinator<ValueNode>;
|
|
261
|
-
DirectScssQueryClause: Combinator<ValueNode>;
|
|
262
|
-
DirectScssQueryPreludeTail: Combinator<ValueNode>;
|
|
263
|
-
DirectScssQueryPrelude: Combinator<ValueNode>;
|
|
264
|
-
DirectScssSupportsAtom: Combinator<ValueNode>;
|
|
265
|
-
DirectScssGeneralTemplate: Combinator<Interpolation>;
|
|
266
|
-
DirectScssGeneralTemplateParen: Combinator<Interpolation>;
|
|
267
|
-
DirectScssGeneralTemplateSquare: Combinator<Interpolation>;
|
|
268
|
-
DirectScssGeneralTemplateBrace: Combinator<Interpolation>;
|
|
269
|
-
DirectScssGeneralTemplateDoubleQuoted: Combinator<Interpolation>;
|
|
270
|
-
DirectScssGeneralTemplateSingleQuoted: Combinator<Interpolation>;
|
|
271
|
-
DirectScssGeneralEnclosed: Combinator<GeneralEnclosed>;
|
|
272
|
-
DirectScssSupportsFeature: Combinator<ValueNode>;
|
|
273
|
-
DirectScssSupportsInParens: Combinator<ValueNode>;
|
|
274
|
-
DirectScssSupportsNot: Combinator<Keyword>;
|
|
275
|
-
DirectScssSupportsAndOr: Combinator<Keyword>;
|
|
276
|
-
DirectScssSupportsCondition: Combinator<ValueNode>;
|
|
277
|
-
DirectScssSupportsPrelude: Combinator<ValueNode>;
|
|
278
|
-
DirectScssStaticMediaPrelude: Combinator<ValueNode>;
|
|
279
|
-
DirectScssStaticAtPrelude: Combinator<ValueNode | null>;
|
|
280
|
-
DirectScssStaticAtPreludeAtom: Combinator<Token>;
|
|
281
|
-
DirectScssStaticAtPreludeParen: Combinator<Token>;
|
|
282
|
-
DirectScssStaticAtPreludeSquare: Combinator<Token>;
|
|
283
|
-
DirectScssStaticAtPreludeDoubleQuoted: Combinator<Token>;
|
|
284
|
-
DirectScssStaticAtPreludeSingleQuoted: Combinator<Token>;
|
|
285
|
-
DirectScssAtRuleStatement: Combinator<AtRuleStatement>;
|
|
286
|
-
DirectScssScopeBlock: Combinator<AtRuleBlock>;
|
|
287
|
-
DirectScssNestedScopeBlock: Combinator<AtRuleBlock>;
|
|
288
|
-
DirectScssConditionalBlock: Combinator<AtRuleBlock>;
|
|
289
|
-
DirectScssStartingStyleBlock: Combinator<AtRuleBlock>;
|
|
290
|
-
DirectScssLayerBlock: Combinator<AtRuleBlock>;
|
|
291
|
-
DirectScssDocumentBlock: Combinator<AtRuleBlock>;
|
|
292
|
-
DirectScssPageMarginBox: Combinator<AtRuleBlock>;
|
|
293
|
-
DirectScssPageBlock: Combinator<AtRuleBlock>;
|
|
294
|
-
DirectScssFontFeatureValueBlock: Combinator<AtRuleBlock>;
|
|
295
|
-
DirectScssFontFeatureValuesBlock: Combinator<AtRuleBlock>;
|
|
296
|
-
DirectScssNestedConditionalBlock: Combinator<AtRuleBlock>;
|
|
297
|
-
DirectScssNestedStartingStyleBlock: Combinator<AtRuleBlock>;
|
|
298
|
-
DirectScssNestedLayerBlock: Combinator<AtRuleBlock>;
|
|
299
|
-
DirectScssFontFace: Combinator<AtRuleBlock>;
|
|
300
|
-
DirectScssCounterStyle: Combinator<AtRuleBlock>;
|
|
301
|
-
DirectScssPropertyName: Combinator<Keyword>;
|
|
302
|
-
DirectScssPropertyAtRule: Combinator<AtRuleBlock>;
|
|
303
|
-
DirectScssKeyframeSelector: Combinator<SimpleSelector>;
|
|
304
|
-
DirectScssKeyframeBlock: Combinator<Rule>;
|
|
305
|
-
DirectScssKeyframes: Combinator<AtRuleBlock>;
|
|
306
|
-
DirectScssOpaquePrelude: Combinator<string | null>;
|
|
307
|
-
DirectScssOpaqueBody: Combinator<string>;
|
|
308
|
-
DirectScssOpaqueAtRuleBlock: Combinator<OpaqueAtRuleBlock>;
|
|
309
|
-
DirectScssOpaqueAtRuleStatement: Combinator<AtRuleStatement>;
|
|
310
|
-
DirectScssSimple: Combinator<SimpleSelector>;
|
|
311
|
-
DirectScssInterpolatedSimple: Combinator<SimpleSelector>;
|
|
312
|
-
DirectScssPlaceholder: Combinator<SimpleSelector>;
|
|
313
|
-
DirectScssAttribute: Combinator<SimpleSelector>;
|
|
314
|
-
DirectScssPseudoArgument: Combinator<string>;
|
|
315
|
-
DirectScssStaticSelectorPseudoArgument: Combinator<string>;
|
|
316
|
-
DirectScssStaticSelectorPseudoItem: Combinator<string>;
|
|
317
|
-
DirectScssStaticSelectorPseudoTail: Combinator<string>;
|
|
318
|
-
DirectScssStaticPseudoArgument: Combinator<string>;
|
|
319
|
-
DirectScssStaticPseudoGroup: Combinator<string>;
|
|
320
|
-
DirectScssStaticPseudoSquare: Combinator<string>;
|
|
321
|
-
DirectScssPseudo: Combinator<SimpleToken>;
|
|
322
|
-
DirectScssNestingSelector: Combinator<SimpleSelector>;
|
|
323
|
-
DirectScssCompound: Combinator<CompoundSelector>;
|
|
324
|
-
DirectScssComplexTail: Combinator<ScssComplexTail>;
|
|
325
|
-
DirectScssComplex: Combinator<ComplexSelector>;
|
|
326
|
-
DirectScssSelectorTail: Combinator<ComplexSelector>;
|
|
327
|
-
DirectScssSelector: Combinator<SelectorList>;
|
|
328
|
-
DirectScssExtend: Combinator<ExtendInstruction>;
|
|
329
|
-
DirectScssRule: Combinator<Rule>;
|
|
330
|
-
rw: Combinator<string[]>;
|
|
331
|
-
whitespace: Combinator<string[]>;
|
|
332
|
-
};
|
|
333
|
-
export declare const scssGrammar: Record<keyof ScssRules, FusedRule>;
|
|
334
|
-
export declare const scssAstGrammar: Record<keyof ScssRules, FusedRule>;
|
|
335
|
-
export declare const scssCstGrammar: Record<keyof ScssRules, FusedRule>;
|
|
336
|
-
export {};
|
|
1
|
+
export declare const scssGrammar: Record<string, import("parseman").Runnable>;
|
|
2
|
+
/** AST artifact with Parseman line/column tracking enabled. */
|
|
3
|
+
export declare const scssPositionsGrammar: Record<string, import("parseman").Runnable>;
|
|
4
|
+
export declare const scssCstGrammar: Record<string, import("parseman").Runnable>;
|
|
5
|
+
/** CST artifact with Parseman line/column tracking enabled. */
|
|
6
|
+
export declare const scssCstPositionsGrammar: Record<string, import("parseman").Runnable>;
|
package/lib/index.cjs
CHANGED
|
@@ -1,111 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
//#region src/ast/lower-user-function-calls.ts
|
|
2
|
+
const require_parse_with = require("./chunks/parse-with.cjs");
|
|
3
|
+
let src_grammar_ast_js = require("./grammar/ast.cjs");
|
|
4
|
+
//#region src/index.ts
|
|
6
5
|
/**
|
|
7
|
-
* SCSS
|
|
8
|
-
* to a `$var`-bound value lambda (`AnonymousMixin` with `params`). A CALL to that
|
|
9
|
-
* function — `f(2)` — parses as an ordinary `FunctionCall`, indistinguishable at
|
|
10
|
-
* the leaf from a builtin Sass call (`darken(...)`). This post-parse pass rewrites
|
|
11
|
-
* every `FunctionCall` whose name is a USER-defined `@function` into the shared
|
|
12
|
-
* `$f(args)` invoke form (a `Reference` with a `Call` step on the bound variable),
|
|
13
|
-
* so it reaches the general "call a value-lambda" evaluator path. Builtin Sass
|
|
14
|
-
* functions are left as `FunctionCall`s and continue to route to `fns`.
|
|
6
|
+
* Parse SCSS directly into the canonical AST v2 document.
|
|
15
7
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* so "a VariableDeclaration whose value is an AnonymousMixin" is an exact marker.
|
|
20
|
-
*/
|
|
21
|
-
function isRecord(value) {
|
|
22
|
-
return typeof value === "object" && value !== null;
|
|
23
|
-
}
|
|
24
|
-
function isFunctionCall(value) {
|
|
25
|
-
return isRecord(value) && value.type === "FunctionCall" && typeof value.name === "string" && Array.isArray(value.args);
|
|
26
|
-
}
|
|
27
|
-
/** A non-array value slot is a single value node. */
|
|
28
|
-
function isValueNode(slot) {
|
|
29
|
-
return !Array.isArray(slot);
|
|
30
|
-
}
|
|
31
|
-
function isStylesheet$1(value) {
|
|
32
|
-
return isRecord(value) && value.type === "Stylesheet" && Array.isArray(value.children);
|
|
33
|
-
}
|
|
34
|
-
/** Collect every user `@function` name: a VariableDeclaration bound to an
|
|
35
|
-
* AnonymousMixin (the only SCSS shape that produces one). */
|
|
36
|
-
function collectUserFunctionNames(node, into) {
|
|
37
|
-
if (Array.isArray(node)) {
|
|
38
|
-
for (const child of node) collectUserFunctionNames(child, into);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!isRecord(node)) return;
|
|
42
|
-
if (node.type === "VariableDeclaration" && typeof node.name === "string" && isRecord(node.value) && node.value.type === "AnonymousMixin") into.add(node.name);
|
|
43
|
-
for (const key of Object.keys(node)) collectUserFunctionNames(node[key], into);
|
|
44
|
-
}
|
|
45
|
-
/** Best-effort authored spelling of a call argument, for a Reference `raw`
|
|
46
|
-
* fallback (only ever emitted if the invoke fails to resolve). */
|
|
47
|
-
function argRaw(slot) {
|
|
48
|
-
if (!isValueNode(slot)) return slot.map(argRaw).join(" ");
|
|
49
|
-
if (slot.type === "VariableReference") return `$${slot.name}`;
|
|
50
|
-
if ("src" in slot && typeof slot.src === "string") return slot.src;
|
|
51
|
-
return "";
|
|
52
|
-
}
|
|
53
|
-
/** Deep-transform the tree, rewriting user-function `FunctionCall`s (post-order,
|
|
54
|
-
* so nested user calls inside the args lower first). Non-AST scalars pass through. */
|
|
55
|
-
function rewrite(node, userFns) {
|
|
56
|
-
if (Array.isArray(node)) return node.map((child) => rewrite(child, userFns));
|
|
57
|
-
if (!isRecord(node)) return node;
|
|
58
|
-
const out = {};
|
|
59
|
-
for (const key of Object.keys(node)) out[key] = rewrite(node[key], userFns);
|
|
60
|
-
if (isFunctionCall(out) && userFns.has(out.name)) {
|
|
61
|
-
const args = out.args.map((value) => ({ value }));
|
|
62
|
-
const raw = `${out.name}(${out.args.map(argRaw).join(", ")})`;
|
|
63
|
-
return (0, _jesscss_core_ast.reference)((0, _jesscss_core_ast.variableReference)(out.name, "live"), [{
|
|
64
|
-
type: "Call",
|
|
65
|
-
args
|
|
66
|
-
}], raw);
|
|
67
|
-
}
|
|
68
|
-
return out;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Rewrite user-`@function` call sites in a parsed SCSS document to `$f(args)`
|
|
72
|
-
* lambda invokes. Returns the document unchanged when it defines no user function.
|
|
8
|
+
* Spans carry offsets only. For `startLine`/`startColumn` facts import `parse`
|
|
9
|
+
* from `@jesscss/scss-parser/positions` — the same function bound to the
|
|
10
|
+
* line-aware compiled table. This entry never loads that table.
|
|
73
11
|
*/
|
|
74
|
-
function lowerUserFunctionCalls(sheet) {
|
|
75
|
-
const userFns = /* @__PURE__ */ new Set();
|
|
76
|
-
collectUserFunctionNames(sheet.children, userFns);
|
|
77
|
-
if (userFns.size === 0) return sheet;
|
|
78
|
-
const lowered = rewrite(sheet, userFns);
|
|
79
|
-
if (!isStylesheet$1(lowered)) throw new TypeError("SCSS user-function lowering did not preserve the Stylesheet root.");
|
|
80
|
-
return lowered;
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/index.ts
|
|
84
|
-
/** Structured failure from the public direct SCSS parser. */
|
|
85
|
-
var ScssParseError = class extends SyntaxError {
|
|
86
|
-
code = "parse/syntax-error";
|
|
87
|
-
offset;
|
|
88
|
-
expected;
|
|
89
|
-
constructor(offset, expected) {
|
|
90
|
-
const detail = expected.length > 0 ? ` Expected: ${expected.join(", ")}.` : "";
|
|
91
|
-
super(`SCSS parser error.${detail}`);
|
|
92
|
-
this.name = "ScssParseError";
|
|
93
|
-
this.offset = offset;
|
|
94
|
-
this.expected = expected;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
function isStylesheet(value) {
|
|
98
|
-
return typeof value === "object" && value !== null && "type" in value && value.type === "Stylesheet" && "children" in value && Array.isArray(value.children);
|
|
99
|
-
}
|
|
100
|
-
/** Parse SCSS directly into the canonical AST v2 document. */
|
|
101
12
|
function parse(input) {
|
|
102
|
-
|
|
103
|
-
const trivia = require_grammar.scssAstGrammar.whitespace;
|
|
104
|
-
if (entry === void 0 || trivia === void 0) throw new TypeError("SCSS AST grammar is missing its public document entry.");
|
|
105
|
-
const result = (0, parseman.run)(entry, input, { trivia });
|
|
106
|
-
if (!result.ok || result.unconsumedFrom !== null || !isStylesheet(result.value)) throw new ScssParseError(result.ok ? result.unconsumedFrom ?? result.span.end : result.span.start, result.expected);
|
|
107
|
-
return (0, _jesscss_core_ast.withTriviaMap)((0, _jesscss_core_ast.withSourceSpan)(lowerUserFunctionCalls(result.value), result.span), (0, _jesscss_core_ast.createTriviaMapFromParseman)(input, result.triviaMap));
|
|
13
|
+
return require_parse_with.parseWith(src_grammar_ast_js.scssGrammar, input);
|
|
108
14
|
}
|
|
109
15
|
//#endregion
|
|
110
|
-
exports.
|
|
16
|
+
exports.ScssImportPostludeError = require_parse_with.ScssImportPostludeError;
|
|
17
|
+
exports.ScssParseError = require_parse_with.ScssParseError;
|
|
111
18
|
exports.parse = parse;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { Stylesheet } from '@jesscss/core/ast';
|
|
2
|
+
export { ScssImportPostludeError, ScssParseError } from './parse-error.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse SCSS directly into the canonical AST v2 document.
|
|
5
|
+
*
|
|
6
|
+
* Spans carry offsets only. For `startLine`/`startColumn` facts import `parse`
|
|
7
|
+
* from `@jesscss/scss-parser/positions` — the same function bound to the
|
|
8
|
+
* line-aware compiled table. This entry never loads that table.
|
|
9
|
+
*/
|
|
10
10
|
export declare function parse(input: string): Stylesheet;
|
package/lib/index.js
CHANGED
|
@@ -1,109 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/ast/lower-user-function-calls.ts
|
|
1
|
+
import { n as ScssImportPostludeError, r as ScssParseError, t as parseWith } from "./chunks/parse-with.js";
|
|
2
|
+
import { scssGrammar } from "./grammar/ast.js";
|
|
3
|
+
//#region src/index.ts
|
|
5
4
|
/**
|
|
6
|
-
* SCSS
|
|
7
|
-
* to a `$var`-bound value lambda (`AnonymousMixin` with `params`). A CALL to that
|
|
8
|
-
* function — `f(2)` — parses as an ordinary `FunctionCall`, indistinguishable at
|
|
9
|
-
* the leaf from a builtin Sass call (`darken(...)`). This post-parse pass rewrites
|
|
10
|
-
* every `FunctionCall` whose name is a USER-defined `@function` into the shared
|
|
11
|
-
* `$f(args)` invoke form (a `Reference` with a `Call` step on the bound variable),
|
|
12
|
-
* so it reaches the general "call a value-lambda" evaluator path. Builtin Sass
|
|
13
|
-
* functions are left as `FunctionCall`s and continue to route to `fns`.
|
|
5
|
+
* Parse SCSS directly into the canonical AST v2 document.
|
|
14
6
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* so "a VariableDeclaration whose value is an AnonymousMixin" is an exact marker.
|
|
19
|
-
*/
|
|
20
|
-
function isRecord(value) {
|
|
21
|
-
return typeof value === "object" && value !== null;
|
|
22
|
-
}
|
|
23
|
-
function isFunctionCall(value) {
|
|
24
|
-
return isRecord(value) && value.type === "FunctionCall" && typeof value.name === "string" && Array.isArray(value.args);
|
|
25
|
-
}
|
|
26
|
-
/** A non-array value slot is a single value node. */
|
|
27
|
-
function isValueNode(slot) {
|
|
28
|
-
return !Array.isArray(slot);
|
|
29
|
-
}
|
|
30
|
-
function isStylesheet$1(value) {
|
|
31
|
-
return isRecord(value) && value.type === "Stylesheet" && Array.isArray(value.children);
|
|
32
|
-
}
|
|
33
|
-
/** Collect every user `@function` name: a VariableDeclaration bound to an
|
|
34
|
-
* AnonymousMixin (the only SCSS shape that produces one). */
|
|
35
|
-
function collectUserFunctionNames(node, into) {
|
|
36
|
-
if (Array.isArray(node)) {
|
|
37
|
-
for (const child of node) collectUserFunctionNames(child, into);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!isRecord(node)) return;
|
|
41
|
-
if (node.type === "VariableDeclaration" && typeof node.name === "string" && isRecord(node.value) && node.value.type === "AnonymousMixin") into.add(node.name);
|
|
42
|
-
for (const key of Object.keys(node)) collectUserFunctionNames(node[key], into);
|
|
43
|
-
}
|
|
44
|
-
/** Best-effort authored spelling of a call argument, for a Reference `raw`
|
|
45
|
-
* fallback (only ever emitted if the invoke fails to resolve). */
|
|
46
|
-
function argRaw(slot) {
|
|
47
|
-
if (!isValueNode(slot)) return slot.map(argRaw).join(" ");
|
|
48
|
-
if (slot.type === "VariableReference") return `$${slot.name}`;
|
|
49
|
-
if ("src" in slot && typeof slot.src === "string") return slot.src;
|
|
50
|
-
return "";
|
|
51
|
-
}
|
|
52
|
-
/** Deep-transform the tree, rewriting user-function `FunctionCall`s (post-order,
|
|
53
|
-
* so nested user calls inside the args lower first). Non-AST scalars pass through. */
|
|
54
|
-
function rewrite(node, userFns) {
|
|
55
|
-
if (Array.isArray(node)) return node.map((child) => rewrite(child, userFns));
|
|
56
|
-
if (!isRecord(node)) return node;
|
|
57
|
-
const out = {};
|
|
58
|
-
for (const key of Object.keys(node)) out[key] = rewrite(node[key], userFns);
|
|
59
|
-
if (isFunctionCall(out) && userFns.has(out.name)) {
|
|
60
|
-
const args = out.args.map((value) => ({ value }));
|
|
61
|
-
const raw = `${out.name}(${out.args.map(argRaw).join(", ")})`;
|
|
62
|
-
return reference(variableReference(out.name, "live"), [{
|
|
63
|
-
type: "Call",
|
|
64
|
-
args
|
|
65
|
-
}], raw);
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Rewrite user-`@function` call sites in a parsed SCSS document to `$f(args)`
|
|
71
|
-
* lambda invokes. Returns the document unchanged when it defines no user function.
|
|
7
|
+
* Spans carry offsets only. For `startLine`/`startColumn` facts import `parse`
|
|
8
|
+
* from `@jesscss/scss-parser/positions` — the same function bound to the
|
|
9
|
+
* line-aware compiled table. This entry never loads that table.
|
|
72
10
|
*/
|
|
73
|
-
function lowerUserFunctionCalls(sheet) {
|
|
74
|
-
const userFns = /* @__PURE__ */ new Set();
|
|
75
|
-
collectUserFunctionNames(sheet.children, userFns);
|
|
76
|
-
if (userFns.size === 0) return sheet;
|
|
77
|
-
const lowered = rewrite(sheet, userFns);
|
|
78
|
-
if (!isStylesheet$1(lowered)) throw new TypeError("SCSS user-function lowering did not preserve the Stylesheet root.");
|
|
79
|
-
return lowered;
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/index.ts
|
|
83
|
-
/** Structured failure from the public direct SCSS parser. */
|
|
84
|
-
var ScssParseError = class extends SyntaxError {
|
|
85
|
-
code = "parse/syntax-error";
|
|
86
|
-
offset;
|
|
87
|
-
expected;
|
|
88
|
-
constructor(offset, expected) {
|
|
89
|
-
const detail = expected.length > 0 ? ` Expected: ${expected.join(", ")}.` : "";
|
|
90
|
-
super(`SCSS parser error.${detail}`);
|
|
91
|
-
this.name = "ScssParseError";
|
|
92
|
-
this.offset = offset;
|
|
93
|
-
this.expected = expected;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
function isStylesheet(value) {
|
|
97
|
-
return typeof value === "object" && value !== null && "type" in value && value.type === "Stylesheet" && "children" in value && Array.isArray(value.children);
|
|
98
|
-
}
|
|
99
|
-
/** Parse SCSS directly into the canonical AST v2 document. */
|
|
100
11
|
function parse(input) {
|
|
101
|
-
|
|
102
|
-
const trivia = scssAstGrammar.whitespace;
|
|
103
|
-
if (entry === void 0 || trivia === void 0) throw new TypeError("SCSS AST grammar is missing its public document entry.");
|
|
104
|
-
const result = run(entry, input, { trivia });
|
|
105
|
-
if (!result.ok || result.unconsumedFrom !== null || !isStylesheet(result.value)) throw new ScssParseError(result.ok ? result.unconsumedFrom ?? result.span.end : result.span.start, result.expected);
|
|
106
|
-
return withTriviaMap(withSourceSpan(lowerUserFunctionCalls(result.value), result.span), createTriviaMapFromParseman(input, result.triviaMap));
|
|
12
|
+
return parseWith(scssGrammar, input);
|
|
107
13
|
}
|
|
108
14
|
//#endregion
|
|
109
|
-
export { ScssParseError, parse };
|
|
15
|
+
export { ScssImportPostludeError, ScssParseError, parse };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public SCSS parse failure lives in its own module so that both AST
|
|
3
|
+
* entries — `.` and `./positions` — can export it without either one reaching
|
|
4
|
+
* the other's compiled grammar table. A class declared in an entry cannot be
|
|
5
|
+
* re-exported by a sibling entry without dragging that entry's imports along.
|
|
6
|
+
*/
|
|
7
|
+
/** Structured failure from the public direct SCSS parser. */
|
|
8
|
+
export declare class ScssParseError extends SyntaxError {
|
|
9
|
+
readonly code: "parse/syntax-error";
|
|
10
|
+
readonly offset: number;
|
|
11
|
+
readonly expected: readonly string[];
|
|
12
|
+
readonly line?: number;
|
|
13
|
+
readonly column?: number;
|
|
14
|
+
readonly endLine?: number;
|
|
15
|
+
readonly endColumn?: number;
|
|
16
|
+
readonly reason?: string;
|
|
17
|
+
readonly fix?: string;
|
|
18
|
+
constructor(offset: number, expected: readonly string[], options?: {
|
|
19
|
+
message?: string;
|
|
20
|
+
reason?: string;
|
|
21
|
+
fix?: string;
|
|
22
|
+
line?: number;
|
|
23
|
+
column?: number;
|
|
24
|
+
endLine?: number;
|
|
25
|
+
endColumn?: number;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A media/layer/supports postlude belongs to the plain CSS `@import` form only.
|
|
30
|
+
*
|
|
31
|
+
* Once the parser has decided an `@import` is compile-time — a Sass partial
|
|
32
|
+
* rather than a `.css` file or a URL — a trailing query has nothing left to
|
|
33
|
+
* describe: the partial's rules are spliced into this document, not linked as a
|
|
34
|
+
* separate CSS resource.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ScssImportPostludeError extends SyntaxError {
|
|
37
|
+
readonly code: "parse/import-postlude-on-compile-time-import";
|
|
38
|
+
readonly offset: number;
|
|
39
|
+
readonly endOffset: number;
|
|
40
|
+
readonly reason = "A media, layer, or supports query is only valid on a plain CSS @import.";
|
|
41
|
+
readonly fix = "Drop the query, or wrap the import in an explicit @media/@supports/@layer block.";
|
|
42
|
+
constructor(offset: number, endOffset: number);
|
|
43
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Stylesheet } from '@jesscss/core/ast';
|
|
2
|
+
import type { scssGrammar } from './grammar/ast.js';
|
|
3
|
+
/** The rule map both compiled SCSS AST variants expose. */
|
|
4
|
+
export type ScssAstGrammar = typeof scssGrammar;
|
|
5
|
+
export declare function parseWith(grammar: ScssAstGrammar, input: string): Stylesheet;
|