fix(ui-theme): normalize stylesheet-scan paths to forward slashes for Windows

This commit is contained in:
Yif committed 2026-09-19 16:19:34 +08:00
1 parent 699d06a7eb
commit c6c1df6869
2 files changed
+4 -3

No files matched your search

@@ -113,7 +113,7 @@ describe('translucent menu surfaces pair fill and filter', () => {
] as const
const files = packageStylesheets()
for (const [suffix, container, background] of surfaces) {
const file = files.find(candidate => candidate.replaceAll('\\', '/').endsWith(suffix))
const file = files.find(candidate => candidate.endsWith(suffix))
expect(file, suffix).toBeDefined()
const rules = parseRules(readFileSync(file!, 'utf8'))
const declarations = (selector: string) => new Map(rules
@@ -74,7 +74,8 @@ export function varReferences(value: string): string[] {
/**
* Every CSS file shipped as package source, excluding build output and
* installed dependencies.
* @returns absolute paths of the stylesheets under packages/.
* @returns absolute stylesheet paths under packages/, `/`-separated on every
* platform so specs can match repo-relative suffixes verbatim.
*/
export function packageStylesheets(): string[] {
const found: string[] = []
@@ -83,7 +84,7 @@ export function packageStylesheets(): string[] {
const path = join(dir, entry.name)
if (entry.isDirectory()) {
if (entry.name !== 'node_modules' && entry.name !== 'lib' && entry.name !== 'dist') walk(path)
} else if (entry.name.endsWith('.css')) found.push(path)
} else if (entry.name.endsWith('.css')) found.push(path.replaceAll('\\', '/'))
}
}
walk(PACKAGES_DIR)