@stylexswc/webpack-plugin 0.18.0-rc.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 CHANGED
@@ -71,7 +71,7 @@ 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 replaces this asset's content with the extracted StyleX CSS during
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.
@@ -258,10 +258,17 @@ new StylexPlugin({
258
258
 
259
259
  - Type: `CacheGroupOptions` (webpack cache group configuration)
260
260
  - Optional
261
- - Description: Extends the default webpack cache group used for StyleX CSS
261
+ - Description: Replaces the default webpack cache group used for StyleX CSS
262
262
  extraction. By default the plugin creates a dedicated cache group named
263
- `_stylex-webpack-generated`. Use this to customize chunk naming, priority, or
264
- other split chunks options. Omitted fields retain the required defaults.
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.
265
272
 
266
273
  Default cache group configuration:
267
274
 
@@ -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;CA2GjC;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"}
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
@@ -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
- createSource: css => new RawSource(css),
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}`)),
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 replaces the emitted asset content with the
9
- * extracted StyleX CSS.
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.18.0-rc.1",
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.18.0-rc.1"
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.0-rc.1",
18
- "@stylexswc/typescript-config": "0.18.0-rc.1",
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",