@stylexswc/webpack-plugin 0.6.5 → 0.6.6-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 +11 -6
- package/dist/index.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -37,11 +37,16 @@ const config = (env, argv) => ({
|
|
|
37
37
|
plugins: [
|
|
38
38
|
new StylexPlugin({
|
|
39
39
|
// ... Other StyleX options
|
|
40
|
-
transformCss: css => {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
transformCss: async (css, filePath) => {
|
|
41
|
+
const postcss = require('postcss');
|
|
42
|
+
const result = await postcss([require('autoprefixer')]).process(css, {
|
|
43
|
+
from: filePath,
|
|
44
|
+
map: {
|
|
45
|
+
inline: false,
|
|
46
|
+
annotation: false,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
return result.css;
|
|
45
50
|
},
|
|
46
51
|
}),
|
|
47
52
|
],
|
|
@@ -95,7 +100,7 @@ module.exports = config;
|
|
|
95
100
|
|
|
96
101
|
#### `transformCss`
|
|
97
102
|
|
|
98
|
-
- Type: `(css: string) => string | Buffer | Promise<string | Buffer>`
|
|
103
|
+
- Type: `(css: string, filePath: string | undefined) => string | Buffer | Promise<string | Buffer>`
|
|
99
104
|
- Optional
|
|
100
105
|
- Description: Custom CSS transformation function. Since the plugin injects CSS
|
|
101
106
|
after all loaders, use this to apply PostCSS or other CSS transformations.
|
package/dist/index.js
CHANGED
|
@@ -149,8 +149,8 @@ class StyleXPlugin {
|
|
|
149
149
|
if (stylexCSS == null) {
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
const finalCss = await this.transformCss(stylexCSS);
|
|
153
152
|
const cssAsset = stylexAsset?.[0];
|
|
153
|
+
const finalCss = await this.transformCss(stylexCSS, cssAsset);
|
|
154
154
|
if (cssAsset) {
|
|
155
155
|
compilation.updateAsset(cssAsset, source => new ConcatSource(source, new RawSource(finalCss)));
|
|
156
156
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { RegisterStyleXRules } from '.';
|
|
|
5
5
|
type AsyncFnParams = Parameters<ReturnType<LoaderContext<unknown>['async']>>;
|
|
6
6
|
export type InputCode = AsyncFnParams['1'];
|
|
7
7
|
export type SourceMap = AsyncFnParams['2'];
|
|
8
|
-
export type CSSTransformer = (_css: string) => string | Buffer | Promise<string | Buffer>;
|
|
8
|
+
export type CSSTransformer = (_css: string, _filePath: string | undefined) => string | Buffer | Promise<string | Buffer>;
|
|
9
9
|
export interface StyleXPluginOption extends Pick<StyleXWebpackLoaderOptions, 'transformer'> {
|
|
10
10
|
/**
|
|
11
11
|
* stylex options passed to stylex babel plugin
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,GAAG,CAAC;AAE7C,KAAK,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7E,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG;IAC1F,uBAAuB,EAAE;QACvB,mBAAmB,EAAE,mBAAmB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexswc/webpack-plugin",
|
|
3
3
|
"description": "StyleX webpack plugin with NAPI-RS compiler",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.6-rc.2",
|
|
5
5
|
"config": {
|
|
6
6
|
"scripty": {
|
|
7
7
|
"path": "../../scripts/packages"
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@stylexjs/babel-plugin": "^0.10.1",
|
|
12
|
-
"@stylexswc/rs-compiler": "0.6.
|
|
12
|
+
"@stylexswc/rs-compiler": "0.6.6-rc.2",
|
|
13
13
|
"loader-utils": "^3.3.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@babel/types": "^7.23.9",
|
|
17
|
-
"@stylexswc/eslint-config": "0.6.
|
|
18
|
-
"@stylexswc/typescript-config": "0.6.
|
|
17
|
+
"@stylexswc/eslint-config": "0.6.6-rc.2",
|
|
18
|
+
"@stylexswc/typescript-config": "0.6.6-rc.2",
|
|
19
19
|
"@types/babel__core": "^7.20.5",
|
|
20
20
|
"@types/loader-utils": "^2.0.6",
|
|
21
21
|
"@types/node": "^22.5.1",
|