@lynx-js/css-extract-webpack-plugin 0.6.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lynx-js/css-extract-webpack-plugin
2
2
 
3
+ ## 0.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix "emit different content to the same filename" error ([#1482](https://github.com/lynx-family/lynx-stack/pull/1482))
8
+
9
+ ## 0.6.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Support Rspack v1.4.9. ([#1351](https://github.com/lynx-family/lynx-stack/pull/1351))
14
+
3
15
  ## 0.6.0
4
16
 
5
17
  ### Minor Changes
@@ -108,9 +108,13 @@ class CssExtractRspackPluginImpl {
108
108
  return acc;
109
109
  }, {});
110
110
  try {
111
+ const { compilerOptions: {
112
+ // remove the `templateDebugUrl` to avoid "emit different content to the same filename" error while chunk splitting is enabled, see #1481
113
+ templateDebugUrl, ...restCompilerOptions }, } = args.finalEncodeOptions;
111
114
  const { buffer } = await hooks.encode.promise({
112
115
  encodeOptions: {
113
116
  ...args.finalEncodeOptions,
117
+ compilerOptions: restCompilerOptions,
114
118
  css,
115
119
  lepusCode: {
116
120
  root: undefined,
package/lib/loader.js CHANGED
@@ -27,9 +27,7 @@ export async function load(request, addDependencies) {
27
27
  if (isNamedExports(moduleExports)) {
28
28
  Object.keys(moduleExports).forEach((key) => {
29
29
  if (key !== 'default') {
30
- if (!locals) {
31
- locals = {};
32
- }
30
+ locals ??= {};
33
31
  locals[key] = moduleExports[key];
34
32
  }
35
33
  });
@@ -9,6 +9,7 @@ export async function pitch(request,
9
9
  return;
10
10
  }
11
11
  const callback = this.async();
12
+ // @ts-expect-error compatible with rspack < 1.4.9
12
13
  // See: https://github.com/web-infra-dev/rspack/pull/7878
13
14
  const parseMeta = this.__internal__parseMeta;
14
15
  try {
@@ -25,13 +26,19 @@ export async function pitch(request,
25
26
  callback(error);
26
27
  }
27
28
  function addDependencies(dependencies) {
28
- parseMeta[this._compiler.webpack.CssExtractRspackPlugin.pluginName] = JSON
29
- .stringify(dependencies
30
- .map(dep => ({
29
+ const deps = JSON.stringify(dependencies.map(dep => ({
31
30
  ...dep,
32
31
  content: dep.content.toString('utf-8'),
33
32
  sourceMap: dep.sourceMap?.toString('utf-8'),
34
33
  })));
34
+ // `this.__internal__setParseMeta` has been added in rspack 1.4.9
35
+ // See: https://github.com/web-infra-dev/rspack/pull/11083
36
+ if (typeof this.__internal__setParseMeta === 'function') {
37
+ this.__internal__setParseMeta(this._compiler.webpack.CssExtractRspackPlugin.pluginName, deps);
38
+ }
39
+ else {
40
+ parseMeta[this._compiler.webpack.CssExtractRspackPlugin.pluginName] = deps;
41
+ }
35
42
  }
36
43
  }
37
44
  export default function loader(content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/css-extract-webpack-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "This plugin extracts CSS into separate files. It creates a CSS file per JS file which contains CSS.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -41,16 +41,16 @@
41
41
  "README.md"
42
42
  ],
43
43
  "dependencies": {
44
- "mini-css-extract-plugin": "^2.9.2"
44
+ "mini-css-extract-plugin": "^2.9.4"
45
45
  },
46
46
  "devDependencies": {
47
- "@microsoft/api-extractor": "7.52.8",
48
- "@rspack/core": "1.3.15",
47
+ "@microsoft/api-extractor": "7.52.10",
48
+ "@rspack/core": "1.4.11",
49
49
  "css-loader": "^7.1.2",
50
50
  "sass-loader": "^16.0.5",
51
- "webpack": "^5.99.9",
51
+ "webpack": "^5.101.2",
52
52
  "@lynx-js/css-serializer": "0.1.3",
53
- "@lynx-js/template-webpack-plugin": "0.8.0",
53
+ "@lynx-js/template-webpack-plugin": "0.8.4",
54
54
  "@lynx-js/test-tools": "0.0.0",
55
55
  "@lynx-js/vitest-setup": "0.0.0"
56
56
  },