Skip to content

Commit

Permalink
Add a thirdparty fixture to test precompiled Vanilla Extract styles (
Browse files Browse the repository at this point in the history
  • Loading branch information
mrm007 authored Jan 16, 2024
1 parent 610c50b commit 0081273
Show file tree
Hide file tree
Showing 29 changed files with 757 additions and 458 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"vitest.enable": true,
"vitest.commandLine": "pnpm test:vitest"
}
12 changes: 12 additions & 0 deletions fixtures/thirdparty/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./src/index.ts"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions fixtures/thirdparty/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@fixtures/thirdparty",
"version": "0.0.1",
"main": "src/index.ts",
"author": "SEEK",
"private": true,
"dependencies": {
"@fixtures/thirdparty-dep": "0.0.1",
"@vanilla-extract/css": "1.14.0"
}
}
14 changes: 14 additions & 0 deletions fixtures/thirdparty/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { block, depBlock, depdepBlock } from './styles.css';
import testNodes from '../test-nodes.json';

document.body.innerHTML = `
<div id="${testNodes.first}" class="${block}">
I'm a first-party block
<div id="${testNodes.third}" class="${depBlock}">
I'm a third party block
<div id="${testNodes.thirdThird}" class="${depdepBlock}">
I'm a third party of third party block
</div>
</div>
</div>
`;
18 changes: 18 additions & 0 deletions fixtures/thirdparty/src/styles.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { style, createVar } from '@vanilla-extract/css';

export {
depBlock,
depColor,
depdepBlock,
depdepColor,
// @ts-expect-error no types
} from '@fixtures/thirdparty-dep';

const color = createVar();

export const block = style({
vars: {
[color]: 'red',
},
backgroundColor: color,
});
5 changes: 5 additions & 0 deletions fixtures/thirdparty/test-nodes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"first": "first",
"third": "third",
"thirdThird": "thirdThird"
}
3 changes: 3 additions & 0 deletions fixtures/thirdparty/thirdparty-dep/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { depBlock, depColor } from './styles.css.mjs';

export { depdepBlock, depdepColor } from '@fixtures/thirdparty-dep-dep';
16 changes: 16 additions & 0 deletions fixtures/thirdparty/thirdparty-dep/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@fixtures/thirdparty-dep",
"version": "0.0.1",
"exports": {
".": {
"import": "./index.mjs"
},
"./package.json": "./package.json"
},
"author": "SEEK",
"private": true,
"dependencies": {
"@fixtures/thirdparty-dep-dep": "0.0.1",
"@vanilla-extract/css": "1.14.0"
}
}
10 changes: 10 additions & 0 deletions fixtures/thirdparty/thirdparty-dep/styles.css.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { style, createVar } from '@vanilla-extract/css';

export const depColor = createVar();

export const depBlock = style({
vars: {
[depColor]: 'green',
},
backgroundColor: depColor,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { depdepBlock, depdepColor } from './styles.css.mjs';
15 changes: 15 additions & 0 deletions fixtures/thirdparty/thirdparty-dep/thirdparty-dep-dep/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@fixtures/thirdparty-dep-dep",
"version": "0.0.1",
"exports": {
".": {
"import": "./index.mjs"
},
"./package.json": "./package.json"
},
"author": "SEEK",
"private": true,
"dependencies": {
"@vanilla-extract/css": "1.14.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { style, createVar } from '@vanilla-extract/css';

export const depdepColor = createVar();

export const depdepBlock = style({
vars: {
[depdepColor]: 'blue',
},
backgroundColor: depdepColor,
});
Loading

0 comments on commit 0081273

Please sign in to comment.