@stylexswc/webpack-plugin 0.17.2-dev.1 → 0.18.0-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 +32 -14
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -8
- package/dist/stylex.css +2 -2
- package/package.json +4 -9
- package/dist/shared.d.ts +0 -7
- package/dist/shared.d.ts.map +0 -1
- package/dist/shared.js +0 -10
package/README.md
CHANGED
|
@@ -71,19 +71,30 @@ Then import the carrier stylesheet **once** at the entry point of your app (e.g.
|
|
|
71
71
|
import '@stylexswc/webpack-plugin/stylex.css';
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
The plugin
|
|
74
|
+
The plugin appends the extracted StyleX CSS to this asset during
|
|
75
75
|
the build. Like a regular CSS file, it must flow through your CSS pipeline, so a
|
|
76
76
|
`css-loader` + `MiniCssExtractPlugin.loader` rule (or webpack's built-in CSS
|
|
77
77
|
support) has to cover `.css` files.
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
The carrier import is a **recommendation, not a hard requirement**. The plugin
|
|
80
|
+
also appends tiny per-module CSS imports to every StyleX module, so any part of
|
|
81
|
+
the bundle that renders a StyleX component pulls the stylesheet in on its own —
|
|
82
|
+
most builds emit correct CSS even without the carrier. What the carrier adds is
|
|
83
|
+
a guarantee that doesn't depend on your module graph: the stylesheet is always
|
|
84
|
+
present and loaded with the entrypoint. That matters when something consumes
|
|
85
|
+
StyleX **output** without rendering a StyleX **component** — plain CSS reading
|
|
86
|
+
`defineVars` custom properties (`var(--x…)`), or injected markup carrying
|
|
87
|
+
StyleX class names. If styles would actually be lost (no CSS asset exists to
|
|
88
|
+
receive them at all), the plugin raises a compilation warning; it stays silent
|
|
89
|
+
as long as the output is correct, carrier or not.
|
|
90
|
+
|
|
91
|
+
> [!IMPORTANT] **Migrating from 0.17.x**: version 0.18.0 reworks the CSS
|
|
92
|
+
> extraction architecture. The CSS is no longer injected through
|
|
93
|
+
> auto-generated `stylex.virtual.css` imports — add the
|
|
83
94
|
> `import '@stylexswc/webpack-plugin/stylex.css';` carrier import to your app
|
|
84
|
-
> entrypoint
|
|
85
|
-
> identifiers are now relative to `compiler.context`, which changes
|
|
86
|
-
> once and makes builds reproducible across machines.
|
|
95
|
+
> entrypoint (recommended; see above for when you can skip it). Paths embedded
|
|
96
|
+
> in module identifiers are now relative to `compiler.context`, which changes
|
|
97
|
+
> chunk hashes once and makes builds reproducible across machines.
|
|
87
98
|
|
|
88
99
|
## Plugin Options
|
|
89
100
|
|
|
@@ -216,9 +227,9 @@ new StylexPlugin({
|
|
|
216
227
|
import './styles/stylex-carrier.css';
|
|
217
228
|
```
|
|
218
229
|
|
|
219
|
-
If styles get extracted but no
|
|
220
|
-
|
|
221
|
-
silently dropping the CSS.
|
|
230
|
+
If styles get extracted but no CSS asset is emitted to receive them (e.g. a
|
|
231
|
+
custom `cacheGroup` renamed the chunk), the plugin raises a compilation
|
|
232
|
+
warning instead of silently dropping the CSS.
|
|
222
233
|
|
|
223
234
|
### Advanced Options
|
|
224
235
|
|
|
@@ -247,10 +258,17 @@ new StylexPlugin({
|
|
|
247
258
|
|
|
248
259
|
- Type: `CacheGroupOptions` (webpack cache group configuration)
|
|
249
260
|
- Optional
|
|
250
|
-
- Description:
|
|
261
|
+
- Description: Replaces the default webpack cache group used for StyleX CSS
|
|
251
262
|
extraction. By default the plugin creates a dedicated cache group named
|
|
252
|
-
`_stylex-webpack-generated`.
|
|
253
|
-
|
|
263
|
+
`_stylex-webpack-generated`. A custom cache group replaces the defaults with
|
|
264
|
+
standard `splitChunks` semantics — e.g. omitting `test` matches every
|
|
265
|
+
module, which funnels all extracted CSS into the StyleX chunk. `name` must be
|
|
266
|
+
a static string and falls back to the default chunk name. String and RegExp
|
|
267
|
+
shorthand values are treated as `test`. `false` disables the plugin's cache
|
|
268
|
+
group entirely — extracted styles then have no CSS asset to land in and the
|
|
269
|
+
build warns; to turn off extraction, use `extractCSS: false` instead.
|
|
270
|
+
Include `type: 'css/mini-extract'`, `chunks` and `enforce` yourself when you
|
|
271
|
+
need them.
|
|
254
272
|
|
|
255
273
|
Default cache group configuration:
|
|
256
274
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export default class StyleXPlugin extends StyleXPluginCore {
|
|
|
5
5
|
apply(compiler: webpack.Compiler): void;
|
|
6
6
|
}
|
|
7
7
|
export { StyleXPlugin, VIRTUAL_CSS_PATTERN, DEFAULT_STYLEX_PACKAGES, buildVirtualCssPattern };
|
|
8
|
-
export { isAllowlistedPackage } from '@stylexswc/plugin-shared';
|
|
9
8
|
export { stylexLoaderPath as loader, stylexVirtualCssLoaderPath as virtualLoader };
|
|
10
9
|
export type { CacheGroupOptions, RegisterStyleXRules, StyleXPluginOption, } from '@stylexswc/plugin-shared';
|
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
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,EACL,uBAAuB,EAGvB,gBAAgB,EAChB,mBAAmB,EAEnB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAK7D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IACxD,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EAGvB,gBAAgB,EAChB,mBAAmB,EAEnB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAK7D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IACxD,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ;CA4GjC;AAED,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;AAI9F,OAAO,EAAE,gBAAgB,IAAI,MAAM,EAAE,0BAA0B,IAAI,aAAa,EAAE,CAAC;AAEnF,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.virtualLoader = exports.loader = exports.
|
|
6
|
+
exports.virtualLoader = exports.loader = exports.buildVirtualCssPattern = exports.DEFAULT_STYLEX_PACKAGES = exports.VIRTUAL_CSS_PATTERN = exports.StyleXPlugin = exports.STYLEX_CHUNK_NAME = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const plugin_shared_1 = require("@stylexswc/plugin-shared");
|
|
9
9
|
Object.defineProperty(exports, "DEFAULT_STYLEX_PACKAGES", { enumerable: true, get: function () { return plugin_shared_1.DEFAULT_STYLEX_PACKAGES; } });
|
|
@@ -33,7 +33,7 @@ class StyleXPlugin extends plugin_shared_1.StyleXPluginCore {
|
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
const { Compilation, NormalModule, sources } = compiler.webpack;
|
|
36
|
-
const { RawSource } = sources;
|
|
36
|
+
const { ConcatSource, RawSource } = sources;
|
|
37
37
|
compiler.hooks.make.tap(plugin_shared_1.PLUGIN_NAME, compilation => {
|
|
38
38
|
// Plugin options change the generated CSS without any module changing;
|
|
39
39
|
// mix them into chunk hashes so long-term caching notices.
|
|
@@ -90,10 +90,7 @@ class StyleXPlugin extends plugin_shared_1.StyleXPluginCore {
|
|
|
90
90
|
? `import '${this.carrierCss}'`
|
|
91
91
|
: `import '${PACKAGE_NAME}/stylex.css'`,
|
|
92
92
|
getNamedChunk: name => compilation.namedChunks.get(name),
|
|
93
|
-
|
|
94
|
-
updateAsset: (name, source) => compilation.updateAsset(name, () => source, {
|
|
95
|
-
minimized: false,
|
|
96
|
-
}),
|
|
93
|
+
appendCssToAsset: (name, css) => compilation.updateAsset(name, source => new ConcatSource(source, '\n', new RawSource(css)), { minimized: false }),
|
|
97
94
|
// compilation warnings surface in stats and the dev overlay,
|
|
98
95
|
// unlike the infrastructure logger
|
|
99
96
|
warn: message => compilation.warnings.push(new compiler.webpack.WebpackError(`${PACKAGE_NAME}: ${message}`)),
|
|
@@ -104,8 +101,6 @@ class StyleXPlugin extends plugin_shared_1.StyleXPluginCore {
|
|
|
104
101
|
}
|
|
105
102
|
exports.default = StyleXPlugin;
|
|
106
103
|
exports.StyleXPlugin = StyleXPlugin;
|
|
107
|
-
var plugin_shared_2 = require("@stylexswc/plugin-shared");
|
|
108
|
-
Object.defineProperty(exports, "isAllowlistedPackage", { enumerable: true, get: function () { return plugin_shared_2.isAllowlistedPackage; } });
|
|
109
104
|
// Skipped when `module.exports` is an ES module namespace (frozen, cannot be
|
|
110
105
|
// reassigned) — the ESM exports above provide the same surface there
|
|
111
106
|
if (typeof module !== 'undefined' &&
|
package/dist/stylex.css
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*
|
|
6
6
|
* import '@stylexswc/webpack-plugin/stylex.css';
|
|
7
7
|
*
|
|
8
|
-
* During the build the plugin
|
|
9
|
-
*
|
|
8
|
+
* During the build the plugin appends the extracted StyleX CSS to the
|
|
9
|
+
* emitted asset (other CSS funneled into the chunk is preserved).
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexswc/webpack-plugin",
|
|
3
3
|
"description": "StyleX plugin for webpack powered by a Rust NAPI-RS/SWC compiler. Fast StyleX transforms and CSS extraction without Babel.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.18.0-rc.2",
|
|
5
5
|
"bugs": "https://github.com/Dwlad90/stylex-swc-plugin/issues",
|
|
6
6
|
"config": {
|
|
7
7
|
"scripty": {
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@stylexswc/plugin-shared": "0.
|
|
12
|
+
"@stylexswc/plugin-shared": "0.18.0-rc.2"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@stylexjs/babel-plugin": "^0.19.0",
|
|
16
16
|
"@stylexjs/stylex": "^0.19.0",
|
|
17
|
-
"@stylexswc/eslint-config": "0.
|
|
18
|
-
"@stylexswc/typescript-config": "0.
|
|
17
|
+
"@stylexswc/eslint-config": "0.18.0-rc.2",
|
|
18
|
+
"@stylexswc/typescript-config": "0.18.0-rc.2",
|
|
19
19
|
"@types/node": "^26.1.0",
|
|
20
20
|
"css-loader": "^7.1.2",
|
|
21
21
|
"memfs": "^4.17.0",
|
|
@@ -29,11 +29,6 @@
|
|
|
29
29
|
"import": "./dist/index.js",
|
|
30
30
|
"require": "./dist/index.js"
|
|
31
31
|
},
|
|
32
|
-
"./shared": {
|
|
33
|
-
"types": "./dist/shared.d.ts",
|
|
34
|
-
"import": "./dist/shared.js",
|
|
35
|
-
"require": "./dist/shared.js"
|
|
36
|
-
},
|
|
37
32
|
"./stylex.css": "./dist/stylex.css",
|
|
38
33
|
"./package.json": "./package.json"
|
|
39
34
|
},
|
package/dist/shared.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Import from `@stylexswc/plugin-shared` instead. This subpath
|
|
3
|
-
* re-export is kept for backwards compatibility and will be removed in a
|
|
4
|
-
* future release.
|
|
5
|
-
*/
|
|
6
|
-
export { isAllowlistedPackage } from '@stylexswc/plugin-shared';
|
|
7
|
-
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/shared.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAllowlistedPackage = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Import from `@stylexswc/plugin-shared` instead. This subpath
|
|
6
|
-
* re-export is kept for backwards compatibility and will be removed in a
|
|
7
|
-
* future release.
|
|
8
|
-
*/
|
|
9
|
-
var plugin_shared_1 = require("@stylexswc/plugin-shared");
|
|
10
|
-
Object.defineProperty(exports, "isAllowlistedPackage", { enumerable: true, get: function () { return plugin_shared_1.isAllowlistedPackage; } });
|