Skip to content

Commit 0081273

Browse files
authored
Add a thirdparty fixture to test precompiled Vanilla Extract styles (#1263)
1 parent 610c50b commit 0081273

29 files changed

+757
-458
lines changed

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"vitest.enable": true,
4+
"vitest.commandLine": "pnpm test:vitest"
35
}

fixtures/thirdparty/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Vite App</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="./src/index.ts"></script>
11+
</body>
12+
</html>

fixtures/thirdparty/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "@fixtures/thirdparty",
3+
"version": "0.0.1",
4+
"main": "src/index.ts",
5+
"author": "SEEK",
6+
"private": true,
7+
"dependencies": {
8+
"@fixtures/thirdparty-dep": "0.0.1",
9+
"@vanilla-extract/css": "1.14.0"
10+
}
11+
}

fixtures/thirdparty/src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { block, depBlock, depdepBlock } from './styles.css';
2+
import testNodes from '../test-nodes.json';
3+
4+
document.body.innerHTML = `
5+
<div id="${testNodes.first}" class="${block}">
6+
I'm a first-party block
7+
<div id="${testNodes.third}" class="${depBlock}">
8+
I'm a third party block
9+
<div id="${testNodes.thirdThird}" class="${depdepBlock}">
10+
I'm a third party of third party block
11+
</div>
12+
</div>
13+
</div>
14+
`;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { style, createVar } from '@vanilla-extract/css';
2+
3+
export {
4+
depBlock,
5+
depColor,
6+
depdepBlock,
7+
depdepColor,
8+
// @ts-expect-error no types
9+
} from '@fixtures/thirdparty-dep';
10+
11+
const color = createVar();
12+
13+
export const block = style({
14+
vars: {
15+
[color]: 'red',
16+
},
17+
backgroundColor: color,
18+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"first": "first",
3+
"third": "third",
4+
"thirdThird": "thirdThird"
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { depBlock, depColor } from './styles.css.mjs';
2+
3+
export { depdepBlock, depdepColor } from '@fixtures/thirdparty-dep-dep';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "@fixtures/thirdparty-dep",
3+
"version": "0.0.1",
4+
"exports": {
5+
".": {
6+
"import": "./index.mjs"
7+
},
8+
"./package.json": "./package.json"
9+
},
10+
"author": "SEEK",
11+
"private": true,
12+
"dependencies": {
13+
"@fixtures/thirdparty-dep-dep": "0.0.1",
14+
"@vanilla-extract/css": "1.14.0"
15+
}
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { style, createVar } from '@vanilla-extract/css';
2+
3+
export const depColor = createVar();
4+
5+
export const depBlock = style({
6+
vars: {
7+
[depColor]: 'green',
8+
},
9+
backgroundColor: depColor,
10+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { depdepBlock, depdepColor } from './styles.css.mjs';

0 commit comments

Comments
 (0)