Skip to content

Commit 79f4c8f

Browse files
refactor: webpack@4 dropped
1 parent ae98845 commit 79f4c8f

19 files changed

+747
-754
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
matrix:
5757
os: [ubuntu-latest, windows-latest, macos-latest]
5858
node-version: [10.x, 12.x, 14.x]
59-
webpack-version: [4, latest]
59+
webpack-version: [latest]
6060

6161
runs-on: ${{ matrix.os }}
6262

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"dist"
4040
],
4141
"peerDependencies": {
42-
"webpack": "^4.27.0 || ^5.0.0"
42+
"webpack": "^5.0.0"
4343
},
4444
"dependencies": {
4545
"icss-utils": "^5.1.0",
@@ -50,7 +50,6 @@
5050
"postcss-modules-scope": "^3.0.0",
5151
"postcss-modules-values": "^4.0.0",
5252
"postcss-value-parser": "^4.1.0",
53-
"schema-utils": "^3.0.0",
5453
"semver": "^7.3.5"
5554
},
5655
"devDependencies": {

src/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
import { getOptions, stringifyRequest } from "loader-utils";
5+
import { stringifyRequest } from "loader-utils";
66
import postcss from "postcss";
77
import postcssPkg from "postcss/package.json";
8-
import { validate } from "schema-utils";
98
import { satisfies } from "semver";
109

1110
import CssSyntaxError from "./CssSyntaxError";
@@ -30,13 +29,7 @@ import {
3029
} from "./utils";
3130

3231
export default async function loader(content, map, meta) {
33-
const rawOptions = getOptions(this);
34-
35-
validate(schema, rawOptions, {
36-
name: "CSS Loader",
37-
baseDataPath: "options",
38-
});
39-
32+
const rawOptions = this.getOptions(schema);
4033
const plugins = [];
4134
const callback = this.async();
4235

src/options.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"title": "CSS Loader options",
23
"additionalProperties": false,
34
"properties": {
45
"url": {

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`"esModule" option should work when not specified: errors 1`] = `Array [
55
exports[`"esModule" option should work when not specified: module 1`] = `
66
"// Imports
77
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
8-
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident]!./imported.css\\";
8+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
99
import ___CSS_LOADER_GET_URL_IMPORT___ from \\"../../../src/runtime/getUrl.js\\";
1010
import ___CSS_LOADER_URL_IMPORT_0___ from \\"./img.png\\";
1111
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
@@ -21,7 +21,7 @@ export default ___CSS_LOADER_EXPORT___;
2121
exports[`"esModule" option should work when not specified: result 1`] = `
2222
Array [
2323
Array [
24-
"../../src/index.js?[ident]!./es-module/imported.css",
24+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./es-module/imported.css",
2525
".foo {
2626
color: red;
2727
}
@@ -51,7 +51,7 @@ exports[`"esModule" option should work with a value equal to "false": errors 1`]
5151
exports[`"esModule" option should work with a value equal to "false": module 1`] = `
5252
"// Imports
5353
var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\");
54-
var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./imported.css\\");
54+
var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\");
5555
var ___CSS_LOADER_GET_URL_IMPORT___ = require(\\"../../../src/runtime/getUrl.js\\");
5656
var ___CSS_LOADER_URL_IMPORT_0___ = require(\\"./img.png\\");
5757
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
@@ -67,7 +67,7 @@ module.exports = ___CSS_LOADER_EXPORT___;
6767
exports[`"esModule" option should work with a value equal to "false": result 1`] = `
6868
Array [
6969
Array [
70-
"../../src/index.js?[ident]!./es-module/imported.css",
70+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./es-module/imported.css",
7171
".foo {
7272
color: red;
7373
}
@@ -97,7 +97,7 @@ exports[`"esModule" option should work with a value equal to "true" and the "mod
9797
exports[`"esModule" option should work with a value equal to "true" and the "mode" value equal to "global": module 1`] = `
9898
"// Imports
9999
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
100-
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident]!./imported.css\\";
100+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
101101
import ___CSS_LOADER_GET_URL_IMPORT___ from \\"../../../src/runtime/getUrl.js\\";
102102
import ___CSS_LOADER_URL_IMPORT_0___ from \\"./img.png\\";
103103
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
@@ -114,7 +114,7 @@ export default ___CSS_LOADER_EXPORT___;
114114
exports[`"esModule" option should work with a value equal to "true" and the "mode" value equal to "global": result 1`] = `
115115
Array [
116116
Array [
117-
"../../src/index.js?[ident]!./es-module/imported.css",
117+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./es-module/imported.css",
118118
".foo {
119119
color: red;
120120
}
@@ -144,7 +144,7 @@ exports[`"esModule" option should work with a value equal to "true" and the "mod
144144
exports[`"esModule" option should work with a value equal to "true" and the "mode" value equal to "local": module 1`] = `
145145
"// Imports
146146
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
147-
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident]!./imported.css\\";
147+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
148148
import ___CSS_LOADER_GET_URL_IMPORT___ from \\"../../../src/runtime/getUrl.js\\";
149149
import ___CSS_LOADER_URL_IMPORT_0___ from \\"./img.png\\";
150150
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
@@ -163,7 +163,7 @@ export default ___CSS_LOADER_EXPORT___;
163163
exports[`"esModule" option should work with a value equal to "true" and the "mode" value equal to "local": result 1`] = `
164164
Array [
165165
Array [
166-
"../../src/index.js?[ident]!./es-module/imported.css",
166+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./es-module/imported.css",
167167
"._2sn2s-Iv44Mnv3FmSmFVuI {
168168
color: red;
169169
}
@@ -193,7 +193,7 @@ exports[`"esModule" option should work with a value equal to "true" and the "mod
193193
exports[`"esModule" option should work with a value equal to "true" and the "mode" value equal to "pure": module 1`] = `
194194
"// Imports
195195
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
196-
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident]!./imported.css\\";
196+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
197197
import ___CSS_LOADER_GET_URL_IMPORT___ from \\"../../../src/runtime/getUrl.js\\";
198198
import ___CSS_LOADER_URL_IMPORT_0___ from \\"./img.png\\";
199199
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
@@ -212,7 +212,7 @@ export default ___CSS_LOADER_EXPORT___;
212212
exports[`"esModule" option should work with a value equal to "true" and the "mode" value equal to "pure": result 1`] = `
213213
Array [
214214
Array [
215-
"../../src/index.js?[ident]!./es-module/imported.css",
215+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./es-module/imported.css",
216216
"._2sn2s-Iv44Mnv3FmSmFVuI {
217217
color: red;
218218
}
@@ -242,7 +242,7 @@ exports[`"esModule" option should work with a value equal to "true": errors 1`]
242242
exports[`"esModule" option should work with a value equal to "true": module 1`] = `
243243
"// Imports
244244
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
245-
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident]!./imported.css\\";
245+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
246246
import ___CSS_LOADER_GET_URL_IMPORT___ from \\"../../../src/runtime/getUrl.js\\";
247247
import ___CSS_LOADER_URL_IMPORT_0___ from \\"./img.png\\";
248248
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
@@ -258,7 +258,7 @@ export default ___CSS_LOADER_EXPORT___;
258258
exports[`"esModule" option should work with a value equal to "true": result 1`] = `
259259
Array [
260260
Array [
261-
"../../src/index.js?[ident]!./es-module/imported.css",
261+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./es-module/imported.css",
262262
".foo {
263263
color: red;
264264
}

0 commit comments

Comments
 (0)