Skip to content

Commit 8fb9de8

Browse files
committed
chore: migrate to to wyw-in-js
1 parent 480aba5 commit 8fb9de8

File tree

125 files changed

+2161
-2715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2161
-2715
lines changed

apps/website/docs/react/ahead-of-time-compilation/with-babel.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import TabItem from '@theme/TabItem';
1313
<TabItem value="yarn" label="Yarn">
1414

1515
```shell
16-
yarn add --dev @griffel/babel-preset
16+
yarn add --dev @griffel/babel-preset @griffel/tag-processor
1717
```
1818

1919
</TabItem>
2020
<TabItem value="npm" label="NPM">
2121

2222
```shell
23-
npm install --save-dev @griffel/babel-preset
23+
npm install --save-dev @griffel/babel-preset @griffel/tag-processor
2424
```
2525

2626
</TabItem>

apps/website/docs/react/ahead-of-time-compilation/with-webpack.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import TabItem from '@theme/TabItem';
1313
<TabItem value="yarn" label="Yarn">
1414

1515
```shell
16-
yarn add --dev @griffel/webpack-loader
16+
yarn add --dev @griffel/tag-processor @griffel/webpack-loader
1717
```
1818

1919
</TabItem>
2020
<TabItem value="npm" label="NPM">
2121

2222
```shell
23-
npm install --save-dev @griffel/webpack-loader
23+
npm install --save-dev @griffel/tag-processor @griffel/webpack-loader
2424
```
2525

2626
</TabItem>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "BREAKING: migrate to to wyw-in-js",
4+
"packageName": "@griffel/babel-preset",
5+
"email": "olfedias@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "chore: initial release",
4+
"packageName": "@griffel/tag-processor",
5+
"email": "olfedias@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "chore: add meta to package.json for @griffel/tag-processor",
4+
"packageName": "@griffel/react",
5+
"email": "olfedias@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "BREAKING: migrate to to wyw-in-js",
4+
"packageName": "@griffel/webpack-loader",
5+
"email": "olfedias@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

e2e/nextjs/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"sourceRoot": "e2e/nextjs/src",
55
"projectType": "library",
6-
"implicitDependencies": ["@griffel/webpack-loader"],
6+
"implicitDependencies": ["@griffel/tag-processor", "@griffel/webpack-loader"],
77
"targets": {
88
"test": {
99
"executor": "nx:run-commands",

e2e/nextjs/src/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ async function performTest() {
2323
packLocalPackage(rootDir, tempDir, '@griffel/style-types'),
2424
packLocalPackage(rootDir, tempDir, '@griffel/core'),
2525
packLocalPackage(rootDir, tempDir, '@griffel/react'),
26+
packLocalPackage(rootDir, tempDir, '@griffel/tag-processor'),
2627
packLocalPackage(rootDir, tempDir, '@griffel/webpack-extraction-plugin'),
2728
packLocalPackage(rootDir, tempDir, '@griffel/webpack-loader'),
2829
packLocalPackage(rootDir, tempDir, '@griffel/next-extraction-plugin'),

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"type-check": "nx affected --target=type-check"
2727
},
2828
"devDependencies": {
29+
"@babel/generator": "^7.12.13",
2930
"@babel/preset-react": "^7.14.5",
3031
"@babel/preset-typescript": "7.12.13",
3132
"@codesandbox/sandpack-react": "1.18.4",
@@ -50,6 +51,7 @@
5051
"@storybook/builder-webpack5": "6.5.15",
5152
"@storybook/manager-webpack5": "6.5.15",
5253
"@storybook/react": "6.5.15",
54+
"@swc/core": "^1.3.19",
5355
"@testing-library/jest-dom": "5.16.1",
5456
"@testing-library/react": "13.4.0",
5557
"@tsconfig/docusaurus": "^1.0.4",
@@ -140,20 +142,18 @@
140142
},
141143
"dependencies": {
142144
"@babel/core": "^7.12.13",
143-
"@babel/generator": "^7.12.13",
144145
"@babel/helper-module-imports": "^7.12.13",
145146
"@babel/helper-plugin-utils": "^7.12.13",
146-
"@babel/template": "^7.12.13",
147-
"@babel/traverse": "^7.12.13",
148147
"@emotion/hash": "^0.9.0",
149-
"@linaria/babel-preset": "^3.0.0-beta.24",
150-
"@linaria/shaker": "^3.0.0-beta.22",
151-
"@swc/core": "^1.3.19",
148+
"@linaria/babel-preset": "^5.0.2",
149+
"@linaria/shaker": "^5.0.1",
150+
"@linaria/tags": "^5.0.1",
151+
"@linaria/utils": "^5.0.1",
152+
"@linaria/webpack-loader": "^5.0.2",
152153
"@typescript-eslint/utils": "^5.47.0",
153154
"ajv": "^8.4.0",
154155
"browserslist": "^4.19.1",
155156
"csstype": "^3.1.2",
156-
"enhanced-resolve": "^5.8.2",
157157
"rtl-css-js": "^1.16.1",
158158
"source-map-js": "1.0.2",
159159
"stylis": "^4.2.0",

packages/babel-preset/README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ A Babel preset that performs build time transforms for [`@griffel/react`](../rea
2222
## Install
2323

2424
```bash
25-
yarn add --dev @griffel/babel-preset
25+
yarn add --dev @griffel/babel-preset @griffel/tag-processor
2626
# or
27-
npm install --save-dev @griffel/babel-preset
27+
npm install --save-dev @griffel/babel-preset @griffel/tag-processor
2828
```
2929

3030
## When to use it?
@@ -50,22 +50,27 @@ import { makeStyles } from 'custom-package';
5050
import { createStyles } from 'custom-package';
5151
```
5252

53-
By default, preset handles imports from `@griffel/react` & `@fluentui/react-components`, to handle imports from custom packages settings should be tweaked:
53+
By default, preset handles imports from `@griffel/react` & `@fluentui/react-components`, to handle imports from custom packages settings you need to include meta information to a matching `package.json`:
5454

5555
```json
5656
{
57-
"presets": [
58-
[
59-
"@griffel",
60-
{
61-
"modules": [{ "moduleSource": "custom-package", "importName": "makeStyles" }]
62-
}
63-
]
64-
]
57+
"name": "custom-package",
58+
"version": "1.0.0",
59+
"linaria": {
60+
"tags": {
61+
"makeStyles": "@griffel/tag-processor/make-styles",
62+
"makeResetStyles": "@griffel/tag-processor/make-reset-styles"
63+
}
64+
}
6565
}
6666
```
6767

68-
> **Note**: "custom-package" should re-export `__styles` function from `@griffel/react`
68+
> **Note**: "custom-package" should re-export following functions from `@griffel/react`:
69+
>
70+
> - `__styles`
71+
> - `__css`
72+
> - `__resetStyles`
73+
> - `__resetCSS`
6974
7075
### Configuring Babel settings
7176

@@ -157,9 +162,9 @@ const useStyles = makeStyles({
157162
roughly to
158163

159164
```js
160-
import { __styles } from '@griffel/react';
165+
import { __styles as _styles } from '@griffel/react';
161166

162-
const useStyles = __styles(/* resolved styles */);
167+
const useStyles = _styles(/* resolved styles */);
163168
```
164169

165170
## Access CSS output from code
@@ -218,7 +223,7 @@ However, the concepts are not coupled to the repo setup.
218223

219224
### Module evaluation
220225

221-
The preset uses tools from [linaria](https://github.com/callstack/linaria) to evaluate runtime calls of `makeStyles`.
226+
The preset reuses `@linaria/babel-preset` from [linaria](https://github.com/callstack/linaria) to evaluate runtime calls of `makeStyles` and `makeResetStyles`.
222227
[Linaria's debugging documentation can help here](https://github.com/callstack/linaria/blob/master/CONTRIBUTING.md#debugging-and-deep-dive-into-babel-plugin).
223228

224229
Debugging output can be activated with following environment variables:
@@ -232,9 +237,3 @@ On Windows it's required to set environment variables via [`set`](https://docs.m
232237
```sh
233238
$ cross-env DEBUG=linaria\* LINARIA_LOG=debug yarn build
234239
```
235-
236-
The debug output will include:
237-
238-
- Prepared code
239-
- Evaluated code
240-
- AST that indicates what code has been shaken with `@linaria/shaker`

0 commit comments

Comments
 (0)