@stylexswc/webpack-plugin 0.15.1-rc.2 → 0.15.2-rc.1
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 +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Webpack plugin with NAPI-RS StyleX compiler integration
|
|
2
2
|
|
|
3
|
+
> Part of the [StyleX SWC Plugin](https://github.com/Dwlad90/stylex-swc-plugin#readme) workspace
|
|
4
|
+
|
|
3
5
|
`Webpack plugin` for an unofficial
|
|
4
6
|
[`napi-rs`](https://github.com/dwlad90/stylex-swc-plugin/tree/develop/crates/stylex-rs-compiler)
|
|
5
7
|
compiler that includes the StyleX SWC code transformation under the hood.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { STYLEX_CHUNK_NAME, VIRTUAL_CSS_PATTERN } from './constants';
|
|
2
|
+
import type { TransformedOptions } from '@stylexswc/rs-compiler';
|
|
2
3
|
import type webpack from 'webpack';
|
|
3
4
|
import type { Rule as StyleXRule } from '@stylexjs/babel-plugin';
|
|
4
5
|
import type { CSSTransformer, StyleXPluginOption, StyleXWebpackLoaderOptions, CacheGroupOptions } from './types';
|
|
5
6
|
export type RegisterStyleXRules = (_resourcePath: string, _stylexRules: StyleXRule[]) => void;
|
|
6
7
|
export default class StyleXPlugin {
|
|
7
8
|
stylexRules: Map<string, readonly StyleXRule[]>;
|
|
8
|
-
|
|
9
|
+
transformedOptions: TransformedOptions;
|
|
9
10
|
loaderOption: StyleXWebpackLoaderOptions;
|
|
10
11
|
cacheGroup?: CacheGroupOptions;
|
|
11
12
|
transformCss: CSSTransformer;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,iBAAiB,EAEjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAE1B,iBAAiB,EAClB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,iBAAiB,EAEjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAE1B,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAqBjB,MAAM,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;AAE9F,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,WAAW,qCAA4C;IACvD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,YAAY,EAAE,0BAA0B,CAAC;IACzC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,cAAc,CAAC;IAC7B,WAAW,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;gBACnC,EACV,aAA8C,EAC9C,YAAoB,EACpB,SAAc,EACd,UAAkB,EAClB,YAAgC,EAChC,UAAiB,EACjB,WAAqB,EACrB,UAAU,GACX,GAAE,kBAAuB;IAyB1B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ;CAuKjC;AAED,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;AAElD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,24 +12,28 @@ Object.defineProperty(exports, "VIRTUAL_CSS_PATTERN", { enumerable: true, get: f
|
|
|
12
12
|
const rs_compiler_1 = require("@stylexswc/rs-compiler");
|
|
13
13
|
const stylexLoaderPath = require.resolve('./stylex-loader');
|
|
14
14
|
const stylexVirtualLoaderPath = require.resolve('./stylex-virtual-css-loader');
|
|
15
|
-
const getStyleXRules = (stylexRules,
|
|
15
|
+
const getStyleXRules = (stylexRules, transformedOptions) => {
|
|
16
16
|
if (stylexRules.size === 0) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
19
|
// Take styles for the modules that were included in the last compilation.
|
|
20
20
|
const allRules = Array.from(stylexRules.values()).flat();
|
|
21
|
-
return babel_plugin_1.default.processStylexRules(allRules,
|
|
21
|
+
return babel_plugin_1.default.processStylexRules(allRules, transformedOptions);
|
|
22
22
|
};
|
|
23
23
|
const identityTransfrom = css => css;
|
|
24
24
|
class StyleXPlugin {
|
|
25
25
|
stylexRules = new Map();
|
|
26
|
-
|
|
26
|
+
transformedOptions;
|
|
27
27
|
loaderOption;
|
|
28
28
|
cacheGroup;
|
|
29
29
|
transformCss;
|
|
30
30
|
loaderOrder;
|
|
31
31
|
constructor({ stylexImports = ['stylex', '@stylexjs/stylex'], useCSSLayers = false, rsOptions = {}, nextjsMode = false, transformCss = identityTransfrom, extractCSS = true, loaderOrder = 'first', cacheGroup, } = {}) {
|
|
32
|
-
this.
|
|
32
|
+
this.transformedOptions = {
|
|
33
|
+
useLayers: useCSSLayers,
|
|
34
|
+
legacyDisableLayers: rsOptions.legacyDisableLayers,
|
|
35
|
+
enableLTRRTLComments: rsOptions.enableLTRRTLComments,
|
|
36
|
+
};
|
|
33
37
|
this.loaderOption = {
|
|
34
38
|
stylexImports,
|
|
35
39
|
rsOptions: {
|
|
@@ -157,7 +161,7 @@ class StyleXPlugin {
|
|
|
157
161
|
console.warn('[stylex-webpack] Multiple CSS assets found for the stylex chunk. This should not happen. Please report this issue.');
|
|
158
162
|
}
|
|
159
163
|
const stylexAsset = cssAssetDetails[0];
|
|
160
|
-
const stylexCSS = getStyleXRules(this.stylexRules, this.
|
|
164
|
+
const stylexCSS = getStyleXRules(this.stylexRules, this.transformedOptions);
|
|
161
165
|
if (stylexCSS == null) {
|
|
162
166
|
return;
|
|
163
167
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StyleXOptions } from '@stylexswc/rs-compiler';
|
|
1
|
+
import type { StyleXOptions, UseLayersType } from '@stylexswc/rs-compiler';
|
|
2
2
|
import type { LoaderContext } from 'webpack';
|
|
3
3
|
import type webpack from 'webpack';
|
|
4
4
|
import type { RegisterStyleXRules } from '.';
|
|
@@ -25,7 +25,7 @@ export interface StyleXPluginOption {
|
|
|
25
25
|
*
|
|
26
26
|
* @default false
|
|
27
27
|
*/
|
|
28
|
-
useCSSLayers?:
|
|
28
|
+
useCSSLayers?: UseLayersType;
|
|
29
29
|
/**
|
|
30
30
|
* Next.js Mode
|
|
31
31
|
*
|
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;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KA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AG;IACvC,aAAa,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC9C,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,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.15.
|
|
4
|
+
"version": "0.15.2-rc.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@stylexjs/babel-plugin": "^0.18.
|
|
22
|
-
"@stylexswc/rs-compiler": "0.15.
|
|
21
|
+
"@stylexjs/babel-plugin": "^0.18.2",
|
|
22
|
+
"@stylexswc/rs-compiler": "0.15.2-rc.1",
|
|
23
23
|
"loader-utils": "^3.3.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@babel/types": "^7.29.0",
|
|
27
|
-
"@stylexswc/eslint-config": "0.15.
|
|
28
|
-
"@stylexswc/typescript-config": "0.15.
|
|
27
|
+
"@stylexswc/eslint-config": "0.15.2-rc.1",
|
|
28
|
+
"@stylexswc/typescript-config": "0.15.2-rc.1",
|
|
29
29
|
"@types/babel__core": "^7.20.5",
|
|
30
30
|
"@types/loader-utils": "^3.0.0",
|
|
31
31
|
"@types/node": "^25.3.3",
|