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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to to wyw-in-js #414

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jul 31, 2023

TODO

Update PR to reflect removal of @griffel/babel-preset.

Summary

This PR upgrades @griffel/babel-preset and @griffel/webpack-loader to use wyw-in-js. wyw-in-js introduces a concept of processors to handle different CSS-in-JS implementations i.e. "implement your processor (transform) and use existing tooling to run it".

The information is obtainer from package.json files:

{
  "linaria": {
    "tags": {
      "makeStyles": "@griffel/linaria-processor/make-styles",
      "makeResetStyles": "@griffel/linaria-processor/make-reset-styles"
    }
  }
}

馃憜 indicates Linaria to process makeStyles & makeResetStyles with matching transforms

Another benefit is that Linaria v5 supports async resolving of dependencies that was a blocker for other bundlers (#33).

BREAKING CHANGES

@griffel/babel-preset

  • modules & projectRoot options removed from configs, use package.json to define processors (see Summary 猬嗭笍 )
  • EvalCache & Module are not longer exported and should not be used directly anymore
  • requires @griffel/linaria-processor installed

TODO

  • restore metadata parsing

@griffel/webpack-loader

  • modules & projectRoot options removed from configs, use package.json to define processors (see Summary 猬嗭笍 )
  • requires @griffel/linaria-processor installed

Details

@griffel/babel-preset

All internals of @griffel/babel-preset were removed: module evaluation is gone, parts related to assets handling were moved to @griffel/linaria-processor.

  • error-argument-count: not needed, check is not longer there
  • import-custom-module: aliases are configured now in package.json files
  • import-custom-name: aliases are configured now in package.json files
  • non-existing-module-call: removed, @linaria/shaker now works differently
  • require-custom-module: removed, not needed

Updated fixtures:

@griffel/webpack-loader

All internals of @griffel/webpack-loader were removed, now it's just a tiny wrapper around @linaria/webpack-loader.

Following fixtures were removed:

  • config-modules: aliases are configured now in package.json files
  • error-argument-count: not needed, check is not longer there
  • error-syntax: not needed

New fixture react-component to test a more real life example.

TODO

  • document breaking changes

Related issues

Fixes #104.
Fixes #184.
Fixes #313.

TODOs

@github-actions
Copy link

github-actions bot commented Jul 31, 2023

馃搳 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
core
__resetStyles (makeResetStyles)
273 B
197 B
core
__styles (makeStyles)
1.649 kB
788 B
core
makeResetStyles (runtime)
17.011 kB
6.513 kB
core
makeStyles (runtime)
21.499 kB
8.145 kB
core
mergeClasses
1.82 kB
876 B
core
shorthands.padding()
4.678 kB
1.52 kB
react
__css
1.645 kB
768 B
react
__styles
3.768 kB
1.661 kB
react
makeResetStyles (runtime)
19.172 kB
7.377 kB
react
makeStaticStyles (runtime)
9.136 kB
4.007 kB
react
makeStyles (runtime)
23.675 kB
8.991 kB
shadow-dom
createShadowDOMRenderer
3.236 kB
1.408 kB
馃 This report was generated against d25676dd97e2621865e30270d9029ddeeb420cdb

@layershifter layershifter marked this pull request as ready for review July 31, 2023 14:04
@layershifter layershifter requested a review from a team as a code owner July 31, 2023 14:04
@layershifter layershifter changed the title chore: upgrade to Linaria v4 chore: upgrade to Linaria v5 Sep 25, 2023
@layershifter layershifter marked this pull request as draft September 25, 2023 12:04
@layershifter layershifter force-pushed the chore/linaria-v4-2 branch 4 times, most recently from 27a8f05 to 1eeae6b Compare September 25, 2023 12:34
@layershifter layershifter changed the title chore: upgrade to Linaria v5 chore: migrate to to wyw-in-js Dec 8, 2023
layershifter added a commit to layershifter/office-ui-fabric-react that referenced this pull request Dec 11, 2023
Adds `wyw-in-js` field to `package.json` to support styles processing with WyW-in-JS compiler (https://wyw-in-js.dev/). The plan is to use this compiler for Vite/esbuild plugins (microsoft/griffel#41) and later switch our Webpack loader to it (microsoft/griffel#414).
layershifter added a commit to microsoft/fluentui that referenced this pull request Dec 15, 2023
)

Adds `wyw-in-js` field to `package.json` to support styles processing with WyW-in-JS compiler (https://wyw-in-js.dev/). The plan is to use this compiler for Vite/esbuild plugins (microsoft/griffel#41) and later switch our Webpack loader to it (microsoft/griffel#414).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant