Skip to content

Commit b437ac9

Browse files
authored
Fix publish errors (#464)
1 parent f24ba81 commit b437ac9

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

.changeset/dry-jeans-build.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Deprecates :global() selectors in favor of native CSS transpilation (`yak/css-global-deprecated`)
2+
3+
<!-- end auto-generated rule header -->
4+
5+
Deprecates `:global()` selectors in favor of native CSS transpilation.
6+
7+
## Reason why
8+
9+
The `:global()` selector was originally introduced to escape CSS module scoping, but with the introduction of native CSS transpilation mode, it is no longer necessary and will be removed in the next major version.
10+
11+
Native CSS transpilation provides a cleaner approach that doesn't require special selectors.
12+
13+
## Migration
14+
15+
To migrate to native CSS transpilation, add the following to your `next.config.js`:
16+
17+
```js
18+
experiments: {
19+
transpilationMode: 'Css'
20+
}
21+
```
22+
23+
See https://yak.js.org/docs/migration-to-native-css for the full migration guide.
24+
25+
## Rule details
26+
27+
This rule triggers an error when `:global()` selectors are used in styled or css template literals.
28+
29+
The following patterns are considered errors:
30+
31+
```js
32+
styled.div`
33+
:global(body) {
34+
margin: 0;
35+
}
36+
`;
37+
38+
styled.div`
39+
:global(.some-class) {
40+
color: red;
41+
}
42+
`;
43+
44+
css`
45+
:global(html) {
46+
font-size: 16px;
47+
}
48+
`;
49+
```
50+
51+
The following patterns are not considered errors (after migrating to native CSS transpilation):
52+
53+
```js
54+
styled.div`
55+
body {
56+
margin: 0;
57+
}
58+
`;
59+
60+
styled.div`
61+
.some-class {
62+
color: red;
63+
}
64+
`;
65+
```

packages/next-yak/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"require": "./dist/internal.cjs"
3636
},
3737
"./withYak": {
38+
"types": "./dist/withYak/index.d.ts",
3839
"import": "./dist/withYak/index.js",
3940
"require": "./dist/withYak/index.cjs"
4041
},
@@ -62,7 +63,10 @@
6263
},
6364
"./loaders/webpack-loader": "./dist/loaders/webpack-loader.cjs",
6465
"./loaders/turbopack-loader": "./dist/loaders/turbopack-loader.cjs",
65-
"./vite": "./dist/loaders/vite-plugin.js"
66+
"./vite": {
67+
"types": "./dist/loaders/vite-plugin.d.ts",
68+
"import": "./dist/loaders/vite-plugin.js"
69+
}
6670
},
6771
"scripts": {
6872
"prepublishOnly": "node ../../scripts/check-pnpm.js && npm run build && npm run test && npm run test:types:code && npm run test:types:test",

0 commit comments

Comments
 (0)