Skip to content

Commit a8248be

Browse files
authoredJan 29, 2025··
integration: Split out compiler into @vanilla-extract/compiler package (#1536)

20 files changed

+109
-31
lines changed
 

‎.changeset/many-flowers-switch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/vite-plugin': patch
3+
---
4+
5+
Consume compiler API from new `@vanilla-extract/compiler` package instead of `@vanilla-extract/integration`

‎.changeset/new-cameras-stare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/compiler': minor
3+
---
4+
5+
Initial release

‎.changeset/seven-drinks-drum.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/integration': minor
3+
---
4+
5+
Export `serializeVanillaModule` function

‎.changeset/tiny-needles-dance.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@vanilla-extract/integration': major
3+
---
4+
5+
Remove `createCompiler` function and `Compiler` and `CreateCompilerOptions` types
6+
7+
BREAKING CHANGE: These APIs have been moved to the new `@vanilla-extract/compiler` package

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tsconfig.tsbuildinfo
44
packages/**/README.md
55
!packages/sprinkles/README.md
66
!packages/integration/README.md
7+
!packages/compiler/README.md
78
test-results
89
.parcel-cache
910

‎packages/compiler/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# @vanilla-extract/compiler
2+
3+
This package is not intended for public consumption.

‎packages/compiler/package.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@vanilla-extract/compiler",
3+
"version": "0.0.0",
4+
"description": "Zero-runtime Stylesheets-in-TypeScript",
5+
"main": "dist/vanilla-extract-compiler.cjs.js",
6+
"module": "dist/vanilla-extract-compiler.esm.js",
7+
"types": "dist/vanilla-extract-compiler.cjs.d.ts",
8+
"files": [
9+
"/dist"
10+
],
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/vanilla-extract-css/vanilla-extract.git",
14+
"directory": "packages/compiler"
15+
},
16+
"author": "SEEK",
17+
"license": "MIT",
18+
"dependencies": {
19+
"@vanilla-extract/css": "workspace:^",
20+
"@vanilla-extract/integration": "workspace:^",
21+
"vite": "^5.0.11",
22+
"vite-node": "^1.2.0"
23+
}
24+
}

‎packages/integration/src/compiler.ts ‎packages/compiler/src/compiler.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import type { Adapter } from '@vanilla-extract/css';
44
import { transformCss } from '@vanilla-extract/css/transformCss';
55
import type { ModuleNode, UserConfig as ViteUserConfig } from 'vite';
66

7-
import type { IdentifierOption } from './types';
8-
import { cssFileFilter } from './filters';
9-
import { getPackageInfo } from './packageInfo';
10-
import { transform } from './transform';
11-
import { normalizePath } from './addFileScope';
7+
import {
8+
cssFileFilter,
9+
transform,
10+
normalizePath,
11+
getPackageInfo,
12+
serializeVanillaModule,
13+
type IdentifierOption,
14+
} from '@vanilla-extract/integration';
1215
import { lock } from './lock';
13-
import { serializeVanillaModule } from './processVanillaFile';
1416

1517
type Css = Parameters<Adapter['appendCss']>[0];
1618
type Composition = Parameters<Adapter['registerComposition']>[0];

‎packages/compiler/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export {
2+
createCompiler,
3+
type Compiler,
4+
type CreateCompilerOptions,
5+
} from './compiler';
File renamed without changes.

‎packages/esbuild-plugin-next/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"author": "SEEK",
1818
"license": "MIT",
1919
"dependencies": {
20+
"@vanilla-extract/compiler": "workspace:^",
2021
"@vanilla-extract/integration": "workspace:^"
2122
},
2223
"peerDependencies": {

‎packages/esbuild-plugin-next/src/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { dirname } from 'path';
22

33
import {
4-
cssFileFilter,
4+
type CreateCompilerOptions,
55
createCompiler,
6+
} from '@vanilla-extract/compiler';
7+
import {
8+
cssFileFilter,
69
vanillaExtractTransformPlugin,
710
IdentifierOption,
8-
CreateCompilerOptions,
911
} from '@vanilla-extract/integration';
1012
import type { Plugin } from 'esbuild';
1113

‎packages/integration/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
"eval": "0.1.8",
2525
"find-up": "^5.0.0",
2626
"javascript-stringify": "^2.0.1",
27-
"mlly": "^1.4.2",
28-
"vite": "^5.0.11",
29-
"vite-node": "^1.2.0"
27+
"mlly": "^1.4.2"
3028
},
3129
"devDependencies": {
3230
"@types/babel__core": "^7.20.5"

‎packages/integration/src/index.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ export {
22
processVanillaFile,
33
parseFileScope,
44
stringifyFileScope,
5+
serializeVanillaModule,
56
} from './processVanillaFile';
67
export { getSourceFromVirtualCssFile } from './virtualFile';
7-
export { getPackageInfo } from './packageInfo';
8-
export { compile, vanillaExtractTransformPlugin } from './compile';
9-
export { createCompiler } from './compiler';
8+
export { getPackageInfo, type PackageInfo } from './packageInfo';
9+
export {
10+
compile,
11+
vanillaExtractTransformPlugin,
12+
type CompileOptions,
13+
} from './compile';
1014
export { hash } from './hash';
1115
export { addFileScope, normalizePath } from './addFileScope';
1216
export { serializeCss, deserializeCss } from './serialize';
1317
export { transformSync, transform } from './transform';
14-
15-
export * from './filters';
16-
18+
export { cssFileFilter, virtualCssFileFilter } from './filters';
1719
export type { IdentifierOption } from './types';
18-
export type { PackageInfo } from './packageInfo';
19-
export type { CompileOptions } from './compile';
20-
export type { Compiler, CreateCompilerOptions } from './compiler';

‎packages/vite-plugin/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"author": "SEEK",
1717
"license": "MIT",
1818
"dependencies": {
19+
"@vanilla-extract/compiler": "workspace:^",
1920
"@vanilla-extract/integration": "workspace:^"
2021
},
2122
"devDependencies": {

‎packages/vite-plugin/src/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ import type {
99
TransformResult,
1010
UserConfig,
1111
} from 'vite';
12+
import { type Compiler, createCompiler } from '@vanilla-extract/compiler';
1213
import {
1314
cssFileFilter,
14-
IdentifierOption,
15+
type IdentifierOption,
1516
getPackageInfo,
1617
transform,
17-
type Compiler,
18-
createCompiler,
1918
normalizePath,
2019
} from '@vanilla-extract/integration';
2120

‎pnpm-lock.yaml

+24-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/compiler/compiler.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import path from 'path';
2-
import { createCompiler, normalizePath } from '@vanilla-extract/integration';
2+
import { createCompiler } from '@vanilla-extract/compiler';
3+
import { normalizePath } from '@vanilla-extract/integration';
34
import tsconfigPaths from 'vite-tsconfig-paths';
45

56
expect.addSnapshotSerializer({

‎tests/compiler/compiler.vitest.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path';
22
import { describe, beforeAll, afterAll, test, expect } from 'vitest';
3-
import { createCompiler, normalizePath } from '@vanilla-extract/integration';
3+
import { createCompiler } from '@vanilla-extract/compiler';
4+
import { normalizePath } from '@vanilla-extract/integration';
45

56
// Vitest has trouble with snapshots that don't contain wrapping quotes. See this regex and the functions above/below it:
67
// https://github.com/vitest-dev/vitest/blob/ae73f2737607a878ba589d548aa6f8ba639dc07c/packages/snapshot/src/port/inlineSnapshot.ts#L96

‎tests/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@testing-library/dom": "^10.0.0",
1010
"@testing-library/jest-dom": "^6.4.2",
1111
"@vanilla-extract-private/test-helpers": "workspace:*",
12+
"@vanilla-extract/compiler": "workspace:*",
1213
"@vanilla-extract/css": "workspace:*",
1314
"@vanilla-extract/dynamic": "workspace:*",
1415
"@vanilla-extract/integration": "workspace:*",

0 commit comments

Comments
 (0)
Please sign in to comment.