@stylexswc/nextjs-plugin 0.11.1 → 0.11.2-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -4
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -47,10 +47,27 @@ npm install --save-dev @stylexswc/nextjs-plugin
|
|
|
47
47
|
|
|
48
48
|
- Type: `Partial<StyleXOptions>`
|
|
49
49
|
- Optional
|
|
50
|
-
- Description: StyleX compiler options that will be passed to the NAPI-RS
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
- Description: StyleX compiler options that will be passed to the NAPI-RS compiler.
|
|
51
|
+
For standard StyleX options, see the [official StyleX documentation](https://stylexjs.com/docs/api/configuration/babel-plugin/).
|
|
52
|
+
|
|
53
|
+
> [!NOTE]
|
|
54
|
+
> **New Features:** The `include` and `exclude` options are exclusive to this NAPI-RS compiler implementation and are not available in the official StyleX Babel plugin.
|
|
55
|
+
|
|
56
|
+
##### `rsOptions.include`
|
|
57
|
+
|
|
58
|
+
- Type: `(string | RegExp)[]`
|
|
59
|
+
- Optional
|
|
60
|
+
- Description: **RS-compiler Only** An array of glob patterns or regular expressions to include specific files for StyleX transformation.
|
|
61
|
+
When specified, only files matching at least one of these patterns will be transformed.
|
|
62
|
+
Patterns are matched against paths relative to the current working directory.
|
|
63
|
+
|
|
64
|
+
##### `rsOptions.exclude`
|
|
65
|
+
|
|
66
|
+
- Type: `(string | RegExp)[]`
|
|
67
|
+
- Optional
|
|
68
|
+
- Description: **RS-compiler Only** An array of glob patterns or regular expressions to exclude specific files from StyleX transformation.
|
|
69
|
+
Files matching any of these patterns will not be transformed, even if they match an `include` pattern.
|
|
70
|
+
Patterns are matched against paths relative to the current working directory.
|
|
54
71
|
|
|
55
72
|
#### `stylexImports`
|
|
56
73
|
|
|
@@ -93,6 +110,10 @@ module.exports = stylexPlugin({
|
|
|
93
110
|
// Add any StyleX options here
|
|
94
111
|
rsOptions: {
|
|
95
112
|
dev: process.env.NODE_ENV !== 'production',
|
|
113
|
+
// Include only specific directories
|
|
114
|
+
include: ['app/**/*.{ts,tsx}', 'components/**/*.{ts,tsx}', 'src/**/*.{ts,tsx}'],
|
|
115
|
+
// Exclude test files and API routes
|
|
116
|
+
exclude: ['**/*.test.*', '**/*.stories.*', '**/__tests__/**', 'app/api/**'],
|
|
96
117
|
aliases: {
|
|
97
118
|
'@/*': [path.join(rootDir, '*')],
|
|
98
119
|
},
|
|
@@ -119,6 +140,77 @@ module.exports = stylexPlugin({
|
|
|
119
140
|
});
|
|
120
141
|
```
|
|
121
142
|
|
|
143
|
+
### Path Filtering Examples
|
|
144
|
+
|
|
145
|
+
**Include only specific directories:**
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
stylexPlugin({
|
|
149
|
+
rsOptions: {
|
|
150
|
+
include: ['app/**/*.tsx', 'components/**/*.tsx'],
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Exclude test and build files:**
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
stylexPlugin({
|
|
159
|
+
rsOptions: {
|
|
160
|
+
exclude: ['**/*.test.*', '**/*.spec.*', '**/dist/**', '**/node_modules/**'],
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Using regular expressions:**
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
stylexPlugin({
|
|
169
|
+
rsOptions: {
|
|
170
|
+
include: [/app\/.*\.tsx$/, /components\/.*\.tsx$/],
|
|
171
|
+
exclude: [/\.test\./, /\.stories\./],
|
|
172
|
+
},
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Combined include and exclude (exclude takes precedence):**
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
stylexPlugin({
|
|
180
|
+
rsOptions: {
|
|
181
|
+
include: ['app/**/*.{ts,tsx}', 'components/**/*.{ts,tsx}'],
|
|
182
|
+
exclude: ['**/__tests__/**', '**/__mocks__/**', 'app/api/**'],
|
|
183
|
+
},
|
|
184
|
+
})
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Exclude node_modules except specific packages:**
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
stylexPlugin({
|
|
191
|
+
rsOptions: {
|
|
192
|
+
// Exclude all node_modules except @stylexjs/open-props
|
|
193
|
+
exclude: [/node_modules(?!\/@stylexjs\/open-props)/],
|
|
194
|
+
},
|
|
195
|
+
})
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Transform only specific packages from node_modules:**
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
stylexPlugin({
|
|
202
|
+
rsOptions: {
|
|
203
|
+
include: [
|
|
204
|
+
'app/**/*.{ts,tsx}',
|
|
205
|
+
'components/**/*.{ts,tsx}',
|
|
206
|
+
'node_modules/@stylexjs/open-props/**/*.js',
|
|
207
|
+
'node_modules/@my-org/design-system/**/*.js',
|
|
208
|
+
],
|
|
209
|
+
exclude: ['**/*.test.*', 'app/api/**'],
|
|
210
|
+
},
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
122
214
|
## Examples
|
|
123
215
|
|
|
124
216
|
- [Example repo](https://github.com/Dwlad90/nextjs-app-dir-stylex)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexswc/nextjs-plugin",
|
|
3
3
|
"description": "StyleX NextJS plugin with NAPI-RS compiler",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.2-rc.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@stylexswc/rs-compiler": "0.11.
|
|
22
|
-
"@stylexswc/webpack-plugin": "0.11.
|
|
21
|
+
"@stylexswc/rs-compiler": "0.11.2-rc.2",
|
|
22
|
+
"@stylexswc/webpack-plugin": "0.11.2-rc.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/types": "^7.28.
|
|
26
|
-
"@stylexswc/eslint-config": "0.11.
|
|
27
|
-
"@stylexswc/typescript-config": "0.11.
|
|
25
|
+
"@babel/types": "^7.28.4",
|
|
26
|
+
"@stylexswc/eslint-config": "0.11.2-rc.2",
|
|
27
|
+
"@stylexswc/typescript-config": "0.11.2-rc.2",
|
|
28
28
|
"@types/babel__core": "^7.20.5",
|
|
29
|
-
"@types/node": "^24.
|
|
30
|
-
"next": "^15.4
|
|
29
|
+
"@types/node": "^24.7.2",
|
|
30
|
+
"next": "^15.5.4",
|
|
31
31
|
"postcss": "^8.5.6",
|
|
32
32
|
"react": "^19.1.1",
|
|
33
33
|
"react-dom": "^19.1.1",
|
|
34
|
-
"webpack": "^5.
|
|
34
|
+
"webpack": "^5.102.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"next": ">=15.0.0"
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"precommit": "lint-staged",
|
|
56
56
|
"prepush": "lint-prepush",
|
|
57
57
|
"test": "echo \"Error: no test specified\" && exit 0",
|
|
58
|
-
"typecheck": "scripty"
|
|
58
|
+
"typecheck": "scripty --ts"
|
|
59
59
|
}
|
|
60
60
|
}
|