-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disregard TypeScript nodes when pruning CSS (#14446)
* make get_possible_element_siblings non-recursive * treat slots as blocks * simplify * simplify * add test * changeset
- Loading branch information
1 parent
3fa08d5
commit a6ad5af
Showing
5 changed files
with
88 additions
and
97 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: disregard TypeScript nodes when pruning CSS |
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
20 changes: 20 additions & 0 deletions
20
packages/svelte/tests/css/samples/unused-ts-as-expression/_config.js
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,20 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
warnings: [ | ||
{ | ||
code: 'css_unused_selector', | ||
end: { | ||
character: 127, | ||
column: 28, | ||
line: 10 | ||
}, | ||
message: 'Unused CSS selector "[data-active=\'true\'] > span"', | ||
start: { | ||
character: 100, | ||
column: 1, | ||
line: 10 | ||
} | ||
} | ||
] | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/svelte/tests/css/samples/unused-ts-as-expression/expected.css
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,4 @@ | ||
|
||
/* (unused) [data-active='true'] > span { | ||
background-color: red; | ||
}*/ |
13 changes: 13 additions & 0 deletions
13
packages/svelte/tests/css/samples/unused-ts-as-expression/input.svelte
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,13 @@ | ||
<script lang="ts"> | ||
// | ||
</script> | ||
|
||
<div data-active={false as true}> | ||
<span></span> | ||
</div> | ||
|
||
<style> | ||
[data-active='true'] > span { | ||
background-color: red; | ||
} | ||
</style> |