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

Update Preconstruct and use import conditions #3198

Merged
merged 21 commits into from
Jul 19, 2024
Merged

Conversation

Andarist
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Jun 15, 2024

🦋 Changeset detected

Latest commit: 55cd353

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

This PR includes changesets to release 10 packages
Name Type
@emotion/cache Minor
@emotion/css Minor
@emotion/primitives-core Minor
@emotion/react Minor
@emotion/serialize Minor
@emotion/sheet Minor
@emotion/styled Minor
@emotion/use-insertion-effect-with-fallbacks Minor
@emotion/utils Minor
@emotion/jest Minor

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

codesandbox-ci bot commented Jun 15, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Comment on lines -82 to -86
"exports": {
"envConditions": [
"browser"
]
}
Copy link
Member Author

Choose a reason for hiding this comment

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

some packages had browser conditions but I didn't keep them because, from what I can tell, they were unused. I only kept them when I could recognize them as being used

Comment on lines 133 to 137
"#is-browser": {
"worker": "./src/conditions/false.js",
"browser": "./src/conditions/true.js",
"default": "./src/conditions/false.js"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

this is an important question: do we assume that default means node? or do we introduce a new node entry and make default contain an actual runtime check?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the default bundle should definitely contain the runtime check and like we could have worker and node point to just false, idk if it's worth it since the server-side bundle size consideration is nowhere near as big as client-side and maybe this wouldn't actually be a problem but you could e.g. use JSDOM in Node for tests in which case you'd want isBrowser to be true

Copy link
Member Author

Choose a reason for hiding this comment

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

i kinda feel like probably JSDOM users should use a jsdom condition or something but that's definitely not popular so ye, let's not add a node condition right now

Copy link
Member Author

Choose a reason for hiding this comment

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

Btw. jest-environment-jsdom is already preconfigured with the browser condition (in new Jest versions that is). So isBrowser would already be true in that context

@Andarist Andarist marked this pull request as ready for review June 29, 2024 11:00
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.84%. Comparing base (f4640f6) to head (e36919e).
Report is 55 commits behind head on main.

Additional details and impacted files
Files Coverage Δ
packages/cache/src/index.js 94.44% <100.00%> (-3.36%) ⬇️
packages/css/src/create-instance.ts 100.00% <100.00%> (ø)
packages/primitives-core/src/css.ts 100.00% <100.00%> (ø)
packages/react/src/class-names.js 100.00% <100.00%> (ø)
packages/react/src/context.js 95.65% <100.00%> (+0.19%) ⬆️
packages/react/src/emotion-element.js 98.59% <100.00%> (-1.41%) ⬇️
packages/react/src/global.js 100.00% <100.00%> (ø)
packages/react/src/index.js 30.76% <100.00%> (ø)
packages/react/src/theming.js 100.00% <100.00%> (ø)
packages/react/src/utils.js 100.00% <ø> (ø)
... and 5 more

... and 26 files with indirect coverage changes

Copy link
Member

@emmatown emmatown left a comment

Choose a reason for hiding this comment

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

I'd probably prefer if we ran all the tests in all environments by default and just had exceptions for the ones that only run in prod vs dev rather than running things only with the development condition by default but this is probably fine

@Andarist
Copy link
Member Author

I agree but i just didnt have the energy to go through lots of tests and make this more explicit. A lot of tests assume the dev env atm so a lot of them would have to be annotated explicitly. It would be cool to explore changing this latwr on… if anybody finds the time to do so 😅

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