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

feat: granular codegen updates & internal refactoring #1641

Merged
merged 30 commits into from
Nov 28, 2023

Conversation

astahmer
Copy link
Collaborator

@astahmer astahmer commented Nov 4, 2023

📝 Description

Only rewrite files affecteds by a config change, fix config change detection

💣 Is this a breaking change (Yes/No):

no

📝 Additional Information

wip(cli): granular codegen on config change
feat(diffs): granular deletes, split index artifacts
refactor(recipes): merge assignRules in save
refactor(builder): simplify config change logic
refactor(postcss): mv Builder to module level to share it between runs so that we don't always have to reload context
refactor(engines): as es6 class, merge base/context

refactor(recipes): merge assignRules in save
refactor(builder): simplify config change logic
refactor(postcss): mv Builder to module level so share it between runs
so that we don't always have to reload context
Copy link

changeset-bot bot commented Nov 4, 2023

🦋 Changeset detected

Latest commit: 091ca1a

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

This PR includes changesets to release 20 packages
Name Type
@pandacss/generator Patch
@pandacss/postcss Patch
@pandacss/config Patch
@pandacss/parser Patch
@pandacss/studio Patch
@pandacss/types Patch
@pandacss/core Patch
@pandacss/node Patch
@pandacss/dev Patch
@pandacss/astro Patch
@pandacss/fixture Patch
@pandacss/preset-atlaskit Patch
@pandacss/preset-base Patch
@pandacss/preset-panda Patch
@pandacss/token-dictionary Patch
@pandacss/error Patch
@pandacss/extractor Patch
@pandacss/is-valid-prop Patch
@pandacss/logger Patch
@pandacss/shared 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

Copy link

vercel bot commented Nov 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
panda-docs ✅ Ready (Inspect) Visit Preview Nov 28, 2023 6:41pm
panda-playground ✅ Ready (Inspect) Visit Preview Nov 28, 2023 6:41pm
panda-studio ✅ Ready (Inspect) Visit Preview Nov 28, 2023 6:41pm

the point is to be able to just update the config and get most of the context working reactively with the new values without much efforts
I initally wanted to inject/update just the engines parts that changed in the current context, I have no doubts it can be done

but due to the way it's currently working, the refactor needed for that to happen would be huge and can probably be done in another PR, if needed

we would need to find a way to make the config reactive across engines, e.g, change the config once in the context (after a diff has been detected) and it transitively gets updated across every engines (-> could be done with class getters)
currently each engines gets created with an option object and we would end up with stale config options everywhere
also, a lot of work is done in the constructor or shortly after for most engines (TokenDictionary, Utility, Recipes, Patterns) and was meant to be done only once, we would need to refactor/move that logic to be easily re-usable

so for now we get pretty much the same behaviour as before (nuke/rebuild almost everything on config change) but at least we don't rewrite every files and can selectively/incrementally migrate to updating just the diffs in the setConfig method
fix: stale closure with createSheet
can't destructure it anymore without losing "this" context

chore: revert preact config
@astahmer astahmer marked this pull request as ready for review November 5, 2023 22:38
@olafurns7
Copy link

Any news on progress on this @segunadebayo ? 😇

@segunadebayo
Copy link
Member

@olafurns7 No updates yet. I plan to get to it this week.

@segunadebayo
Copy link
Member

segunadebayo commented Nov 22, 2023

Note to self: Once this PR is sorted, we can do two things:

  • Add await to the emit in the builder
  • Move builder to the module level of the postcss plugin

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.

None yet

3 participants