Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add createCompiler to integration package #1030

Merged
merged 59 commits into from
Mar 10, 2023
Merged

Conversation

markdalgleish
Copy link
Contributor

@markdalgleish markdalgleish commented Mar 8, 2023

This PR adds a new compiler to the integration package, powered by vite-node.

This allows us to cache results across builds which can dramatically improve build performance, particularly for esbuild consumers since it doesn't automatically manage caching of plugins.

I've also added a new esbuild plugin that makes use of the new compiler, but it's been marked as private for now. This allows us to run tests and fixtures against the new plugin without forcing us to release it immediately. In the meantime, since Remix uses @vanilla-extract/integration directly, Remix will be able to roll out the new Vanilla Extract compiler immediately without waiting for all official plugins to be migrated.

You can run a fixture against the new compiler like this:

pnpm build
pnpm start-fixture themed --type=esbuild-next

@changeset-bot
Copy link

changeset-bot bot commented Mar 8, 2023

🦋 Changeset detected

Latest commit: 06cb763

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@vanilla-extract/css Minor
@vanilla-extract/esbuild-plugin Patch
@vanilla-extract/integration Minor
@vanilla-extract/jest-transform Patch
@fixtures/features Patch
@fixtures/low-level Patch
@fixtures/recipes Patch
@fixtures/sprinkles Patch
@fixtures/themed Patch
@fixtures/unused-modules Patch
vanilla-extract-example-webpack-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@markdalgleish markdalgleish changed the title Add createCompiler function Add createCompiler to integration package Mar 8, 2023
getIdentOption: () => identifiers,
onBeginFileScope: (fileScope) => {
// Before evaluating a file, reset the cache for it
cssByFileScope.set(fileScope.filePath, []);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should scope the cache to include packageName from the filescope

Comment on lines 35 to 37
for (const importedModule of moduleNode.importedModules) {
queue.push(importedModule);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (const importedModule of moduleNode.importedModules) {
queue.push(importedModule);
}
queue.push(...moduleNode.importedModules);

Copy link
Contributor

@mattcompiles mattcompiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 🚀 🍻

@markdalgleish markdalgleish merged commit 49ff399 into master Mar 10, 2023
@markdalgleish markdalgleish deleted the create-compiler-api branch March 10, 2023 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants