-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sass-parser support for variable declarations
- Loading branch information
Showing
18 changed files
with
1,025 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 1.80.5-dev | ||
|
||
* No user-visible changes. | ||
|
||
## 1.80.4 | ||
|
||
* No user-visible changes. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
pkg/sass-parser/lib/src/statement/__snapshots__/variable-declaration.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`a variable declaration toJSON 1`] = ` | ||
{ | ||
"expression": <"bar">, | ||
"global": false, | ||
"guarded": false, | ||
"inputs": [ | ||
{ | ||
"css": "baz.$foo: "bar"", | ||
"hasBOM": false, | ||
"id": "<input css _____>", | ||
}, | ||
], | ||
"namespace": "baz", | ||
"raws": {}, | ||
"sassType": "variable-declaration", | ||
"source": <1:1-1:16 in 0>, | ||
"type": "decl", | ||
"variableName": "foo", | ||
} | ||
`; |
77 changes: 77 additions & 0 deletions
77
pkg/sass-parser/lib/src/statement/declaration-internal.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2024 Google Inc. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import * as postcss from 'postcss'; | ||
|
||
import {Rule} from './rule'; | ||
import {Root} from './root'; | ||
import {AtRule, ChildNode, Comment, Declaration, NewNode} from '.'; | ||
|
||
/** | ||
* A fake intermediate class to convince TypeScript to use Sass types for | ||
* various upstream methods. | ||
* | ||
* @hidden | ||
*/ | ||
export class _Declaration<Props> extends postcss.Declaration { | ||
// Override the PostCSS container types to constrain them to Sass types only. | ||
// Unfortunately, there's no way to abstract this out, because anything | ||
// mixin-like returns an intersection type which doesn't actually override | ||
// parent methods. See microsoft/TypeScript#59394. | ||
|
||
after(newNode: NewNode): this; | ||
append(...nodes: NewNode[]): this; | ||
assign(overrides: Partial<Props>): this; | ||
before(newNode: NewNode): this; | ||
cloneAfter(overrides?: Partial<Props>): this; | ||
cloneBefore(overrides?: Partial<Props>): this; | ||
each( | ||
callback: (node: ChildNode, index: number) => false | void | ||
): false | undefined; | ||
every( | ||
condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean | ||
): boolean; | ||
insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; | ||
insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; | ||
next(): ChildNode | undefined; | ||
prepend(...nodes: NewNode[]): this; | ||
prev(): ChildNode | undefined; | ||
replaceWith(...nodes: NewNode[]): this; | ||
root(): Root; | ||
some( | ||
condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean | ||
): boolean; | ||
walk( | ||
callback: (node: ChildNode, index: number) => false | void | ||
): false | undefined; | ||
walkAtRules( | ||
nameFilter: RegExp | string, | ||
callback: (atRule: AtRule, index: number) => false | void | ||
): false | undefined; | ||
walkAtRules( | ||
callback: (atRule: AtRule, index: number) => false | void | ||
): false | undefined; | ||
walkComments( | ||
callback: (comment: Comment, indexed: number) => false | void | ||
): false | undefined; | ||
walkComments( | ||
callback: (comment: Comment, indexed: number) => false | void | ||
): false | undefined; | ||
walkDecls( | ||
propFilter: RegExp | string, | ||
callback: (decl: Declaration, index: number) => false | void | ||
): false | undefined; | ||
walkDecls( | ||
callback: (decl: Declaration, index: number) => false | void | ||
): false | undefined; | ||
walkRules( | ||
selectorFilter: RegExp | string, | ||
callback: (rule: Rule, index: number) => false | void | ||
): false | undefined; | ||
walkRules( | ||
callback: (rule: Rule, index: number) => false | void | ||
): false | undefined; | ||
get first(): ChildNode | undefined; | ||
get last(): ChildNode | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright 2024 Google Inc. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
exports._Declaration = require('postcss').Declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.