Skip to content

Commit 289192e

Browse files
committed
chore: resolve conflicts from merge with master
2 parents fd3fce8 + 95cf5c5 commit 289192e

12 files changed

+228
-27
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [6.11.0](https://github.com/webpack-contrib/css-loader/compare/v6.10.0...v6.11.0) (2024-04-03)
6+
7+
8+
### Features
9+
10+
* supports multiple composes ([#1582](https://github.com/webpack-contrib/css-loader/issues/1582)) ([bbca614](https://github.com/webpack-contrib/css-loader/commit/bbca61411dc5f82964653a6d1aa27854519b743d))
11+
12+
13+
### Bug Fixes
14+
15+
* do not break `@scope` at-rule without params ([#1581](https://github.com/webpack-contrib/css-loader/issues/1581)) ([e022e3b](https://github.com/webpack-contrib/css-loader/commit/e022e3bb405472ac7d51ff1114783fc2811dfe04))
16+
517
## [6.10.0](https://github.com/webpack-contrib/css-loader/compare/v6.9.1...v6.10.0) (2024-01-30)
618

719

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,15 @@ To import a local classname from another module.
498498

499499
To import from multiple modules use multiple `composes:` rules.
500500

501+
```css
502+
:local(.className) {
503+
composes: edit highlight from "./edit.css", button from "module/button.css", classFromThisModule;
504+
background: red;
505+
}
506+
```
507+
508+
or
509+
501510
```css
502511
:local(.className) {
503512
composes: edit highlight from "./edit.css";

package-lock.json

+32-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-loader",
3-
"version": "6.10.0",
3+
"version": "6.11.0",
44
"description": "css loader module for webpack",
55
"license": "MIT",
66
"repository": "webpack-contrib/css-loader",
@@ -57,9 +57,9 @@
5757
"dependencies": {
5858
"icss-utils": "^5.1.0",
5959
"postcss": "^8.4.33",
60-
"postcss-modules-extract-imports": "^3.0.0",
61-
"postcss-modules-local-by-default": "^4.0.4",
62-
"postcss-modules-scope": "^3.1.1",
60+
"postcss-modules-extract-imports": "^3.1.0",
61+
"postcss-modules-local-by-default": "^4.0.5",
62+
"postcss-modules-scope": "^3.2.0",
6363
"postcss-modules-values": "^4.0.0",
6464
"postcss-value-parser": "^4.2.0",
6565
"semver": "^7.5.4"

test/__snapshots__/modules-option.test.js.snap

+65
Original file line numberDiff line numberDiff line change
@@ -10468,6 +10468,12 @@ ___CSS_LOADER_EXPORT___.push([module.id, \`@scope (.kthHR5ALtmYK9QgapjA3) {
1046810468
color: plum;
1046910469
}
1047010470
}
10471+
10472+
@scope() {
10473+
:scope {
10474+
color: red;
10475+
}
10476+
}
1047110477
\`, \\"\\"]);
1047210478
// Exports
1047310479
___CSS_LOADER_EXPORT___.locals = {
@@ -10502,6 +10508,12 @@ Array [
1050210508
color: plum;
1050310509
}
1050410510
}
10511+
10512+
@scope() {
10513+
:scope {
10514+
color: red;
10515+
}
10516+
}
1050510517
",
1050610518
"",
1050710519
],
@@ -21104,6 +21116,59 @@ Array [
2110421116

2110521117
exports[`"modules" option should work with composes when the "namedExport" is enabled and "exportLocalsConvention" options has "dashesOnly" value: warnings 1`] = `Array []`;
2110621118

21119+
exports[`"modules" option should work with global compose: errors 1`] = `Array []`;
21120+
21121+
exports[`"modules" option should work with global compose: module 1`] = `
21122+
"// Imports
21123+
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../../../src/runtime/noSourceMaps.js\\";
21124+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../../src/runtime/api.js\\";
21125+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
21126+
// Module
21127+
___CSS_LOADER_EXPORT___.push([module.id, \`.global-class {
21128+
color: red;
21129+
}
21130+
21131+
.other-global-class {
21132+
color: red;
21133+
}
21134+
21135+
.oNDnA1BRHWFMyAdR4iF1 {
21136+
color: blue;
21137+
}
21138+
\`, \\"\\"]);
21139+
// Exports
21140+
___CSS_LOADER_EXPORT___.locals = {
21141+
\\"otherClassName\\": \`oNDnA1BRHWFMyAdR4iF1 global-class other-global-class\`
21142+
};
21143+
export default ___CSS_LOADER_EXPORT___;
21144+
"
21145+
`;
21146+
21147+
exports[`"modules" option should work with global compose: result 1`] = `
21148+
Array [
21149+
Array [
21150+
"./modules/composes/global.css",
21151+
".global-class {
21152+
color: red;
21153+
}
21154+
21155+
.other-global-class {
21156+
color: red;
21157+
}
21158+
21159+
.oNDnA1BRHWFMyAdR4iF1 {
21160+
color: blue;
21161+
}
21162+
",
21163+
"",
21164+
],
21165+
]
21166+
`;
21167+
21168+
exports[`"modules" option should work with global compose: warnings 1`] = `Array []`;
21169+
21170+
exports[`"modules" option should work with multiple compose: module 1`] = `undefined`;
21171+
2110721172
exports[`"modules" option should work with the "[local]" placeholder for the "localIdentName" option: errors 1`] = `Array []`;
2110821173

2110921174
exports[`"modules" option should work with the "[local]" placeholder for the "localIdentName" option: module 1`] = `
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.imported-alias-2 {
2+
background: red;
3+
}
4+
5+
.imported-alias-3 {
6+
background: red;
7+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:global(.global-class) {
2+
color: red;
3+
}
4+
5+
:global(.other-global-class) {
6+
color: red;
7+
}
8+
9+
.otherClassName {
10+
composes: global-class from global;
11+
composes: other-global-class from global;
12+
color: blue;
13+
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import css from './global.css';
2+
3+
__export__ = css;
4+
5+
export default css;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.other-class {
2+
color: red;
3+
}
4+
5+
.class-1 {
6+
color: blue;
7+
}
8+
9+
.class-2 {
10+
color: blue;
11+
}
12+
13+
:global(.global-class) {
14+
padding: 10px;
15+
}
16+
17+
:global(.global-class-1) {
18+
padding: 10px;
19+
}
20+
21+
:global(.global-class-2) {
22+
padding: 10px;
23+
}
24+
25+
.class {
26+
composes:
27+
other-class,
28+
class-1 class-2,
29+
imported-alias from './alias.css',
30+
imported-alias-2 imported-alias-3 from './alias-1.css',
31+
global-class from global,
32+
global-class-1 global-class-2 from global;
33+
color: gainsboro;
34+
}
35+
36+
.class-other {
37+
composes: other-class class-1;
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import css from './multiple.css';
2+
3+
__export__ = css;
4+
5+
export default css;

test/fixtures/modules/scope/css.css

+6
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@
1818
color: plum;
1919
}
2020
}
21+
22+
@scope {
23+
:scope {
24+
color: red;
25+
}
26+
}

test/modules-option.test.js

+32
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,38 @@ describe('"modules" option', () => {
24202420
expect(getErrors(stats)).toMatchSnapshot("errors");
24212421
});
24222422

2423+
it("should work with global compose", async () => {
2424+
const compiler = getCompiler("./modules/composes/global.js", {
2425+
modules: true,
2426+
});
2427+
const stats = await compile(compiler);
2428+
2429+
expect(
2430+
getModuleSource("./modules/composes/global.css", stats)
2431+
).toMatchSnapshot("module");
2432+
expect(getExecutedCode("main.bundle.js", compiler, stats)).toMatchSnapshot(
2433+
"result"
2434+
);
2435+
expect(getWarnings(stats)).toMatchSnapshot("warnings");
2436+
expect(getErrors(stats)).toMatchSnapshot("errors");
2437+
});
2438+
2439+
it("should work with multiple compose", async () => {
2440+
const compiler = getCompiler("./modules/composes/multiple.js", {
2441+
modules: true,
2442+
});
2443+
const stats = await compile(compiler);
2444+
2445+
expect(
2446+
getModuleSource("./modules/composes/multiple.css", stats)
2447+
).toMatchSnapshot("module");
2448+
expect(getExecutedCode("main.bundle.js", compiler, stats)).toMatchSnapshot(
2449+
"result"
2450+
);
2451+
expect(getWarnings(stats)).toMatchSnapshot("warnings");
2452+
expect(getErrors(stats)).toMatchSnapshot("errors");
2453+
});
2454+
24232455
it("should invoke the custom getJSON function if provided", async () => {
24242456
const getJSONSpy = jest.fn();
24252457
const compiler = getCompiler("./modules/getJSON/source.js", {

0 commit comments

Comments
 (0)