@best-shot/preset-style 0.12.4 → 0.12.6
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/lib/apply-stylesheet.mjs +19 -26
- package/package.json +5 -5
package/lib/apply-stylesheet.mjs
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import extToRegexp from 'ext-to-regexp';
|
|
2
2
|
import slashToRegexp from 'slash-to-regexp';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.use('css-loader')
|
|
8
|
-
.loader('css-loader')
|
|
9
|
-
.options({
|
|
10
|
-
importLoaders: 3,
|
|
11
|
-
modules: {
|
|
12
|
-
...(auto ? { auto } : undefined),
|
|
13
|
-
exportLocalsConvention: 'camel-case-only',
|
|
14
|
-
localIdentName: {
|
|
15
|
-
development: '[name]_[local]-[hash]',
|
|
16
|
-
production: '[local]-[hash]',
|
|
17
|
-
}[mode],
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
}
|
|
4
|
+
const auto = (resourcePath, resourceQuery) =>
|
|
5
|
+
/\.module\.\w+$/i.test(resourcePath) ||
|
|
6
|
+
new URLSearchParams(resourceQuery).get('module');
|
|
22
7
|
|
|
23
8
|
export async function applyStylesheet(chain) {
|
|
24
9
|
const minimize = chain.optimization.get('minimize');
|
|
@@ -58,13 +43,19 @@ export async function applyStylesheet(chain) {
|
|
|
58
43
|
const parent = chain.module.rule('style').rule('all').oneOf('not-url');
|
|
59
44
|
|
|
60
45
|
parent
|
|
61
|
-
.
|
|
62
|
-
.
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
.use('css-loader')
|
|
47
|
+
.loader('css-loader')
|
|
48
|
+
.options({
|
|
49
|
+
importLoaders: 3,
|
|
50
|
+
modules: {
|
|
51
|
+
auto,
|
|
52
|
+
exportLocalsConvention: 'camel-case-only',
|
|
53
|
+
localIdentName: {
|
|
54
|
+
development: '[name]_[local]-[hash]',
|
|
55
|
+
production: '[local]-[hash]',
|
|
56
|
+
}[mode],
|
|
57
|
+
},
|
|
58
|
+
});
|
|
68
59
|
|
|
69
60
|
chain.module
|
|
70
61
|
.rule('style')
|
|
@@ -84,7 +75,9 @@ export async function applyStylesheet(chain) {
|
|
|
84
75
|
'mini-css-extract-plugin'
|
|
85
76
|
);
|
|
86
77
|
|
|
87
|
-
parent.use('extract-css').loader(MiniCssExtractPlugin.loader)
|
|
78
|
+
parent.use('extract-css').loader(MiniCssExtractPlugin.loader).options({
|
|
79
|
+
defaultExport: true,
|
|
80
|
+
});
|
|
88
81
|
|
|
89
82
|
chain.plugin('extract-css').use(MiniCssExtractPlugin, [
|
|
90
83
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@best-shot/preset-style",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.6",
|
|
4
4
|
"description": "A `best-shot` preset for stylesheet",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"ext-to-regexp": "^0.1.0",
|
|
42
42
|
"less": "^4.2.0",
|
|
43
43
|
"less-loader": "^12.2.0",
|
|
44
|
-
"mini-css-extract-plugin": "^2.
|
|
44
|
+
"mini-css-extract-plugin": "^2.9.0",
|
|
45
45
|
"postcss": "^8.4.38",
|
|
46
46
|
"postcss-loader": "^8.1.1",
|
|
47
47
|
"postcss-preset-evergreen": "^0.5.9",
|
|
48
48
|
"resolve-url-loader": "^5.0.0",
|
|
49
49
|
"sass": "^1.75.0",
|
|
50
|
-
"sass-loader": "^14.2.
|
|
50
|
+
"sass-loader": "^14.2.1",
|
|
51
51
|
"slash-to-regexp": "^0.0.4",
|
|
52
52
|
"style-loader": "^4.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@best-shot/core": "^0.9.
|
|
55
|
+
"@best-shot/core": "^0.9.8"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
|
-
"node": "
|
|
58
|
+
"node": ">=20.0.0 || ^18.12.0"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public",
|