@best-shot/preset-style 0.13.0 → 0.13.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/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { applyScssLess } from './lib/apply-scss-less.mjs';
2
2
  import { applyStylesheet } from './lib/apply-stylesheet.mjs';
3
3
 
4
- export function apply({ config: { css: { extname, extract } = {} } }) {
4
+ export function apply({ config: { css: { extract } = {} } }) {
5
5
  return async (chain) => {
6
- await applyStylesheet({ extname, extract })(chain);
6
+ await applyStylesheet({ extract })(chain);
7
7
 
8
8
  applyScssLess()(chain);
9
9
  };
@@ -16,14 +16,19 @@ export const schema = {
16
16
  type: 'object',
17
17
  default: {},
18
18
  properties: {
19
- extname: {
20
- type: 'string',
21
- default: '.css',
22
- },
23
19
  extract: {
24
20
  type: 'boolean',
25
21
  default: false,
26
22
  },
27
23
  },
28
24
  },
25
+ output: {
26
+ type: 'object',
27
+ default: {},
28
+ properties: {
29
+ cssFilename: {
30
+ default: '.css',
31
+ },
32
+ },
33
+ },
29
34
  };
@@ -8,7 +8,7 @@ const auto = (resourcePath, resourceQuery) =>
8
8
  /\.module\.\w+$/i.test(resourcePath) ||
9
9
  new URLSearchParams(resourceQuery).get('module');
10
10
 
11
- export function applyStylesheet({ extname, extract }) {
11
+ export function applyStylesheet({ extract }) {
12
12
  return async (chain) => {
13
13
  const minimize = chain.optimization.get('minimize');
14
14
 
@@ -32,12 +32,14 @@ export function applyStylesheet({ extname, extract }) {
32
32
 
33
33
  const assetModuleFilename = chain.output.get('assetModuleFilename');
34
34
 
35
+ const cssFilename = chain.output.get('cssFilename');
36
+
35
37
  rule
36
38
  .rule('all')
37
39
  .oneOf('url')
38
40
  .before('not-url')
39
41
  .dependency('url')
40
- .generator.filename(assetModuleFilename.replace('[ext]', extname));
42
+ .generator.filename(assetModuleFilename.replace('[ext]', cssFilename));
41
43
 
42
44
  const { default: MiniCssExtractPlugin } = await import(
43
45
  'mini-css-extract-plugin'
@@ -51,7 +53,7 @@ export function applyStylesheet({ extname, extract }) {
51
53
  if (needExtract) {
52
54
  chain.plugin('extract-css').use(MiniCssExtractPlugin, [
53
55
  {
54
- filename: `[name]${extname}`,
56
+ filename: `[name]${cssFilename}`,
55
57
  // chunkFilename: '[id].css',
56
58
  ignoreOrder: true,
57
59
  experimentalUseImportModule: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@best-shot/preset-style",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "A `best-shot` preset for stylesheet",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -37,12 +37,12 @@
37
37
  "dependencies": {
38
38
  "css-loader": "^7.1.2",
39
39
  "css-minimizer-webpack-plugin": "^7.0.0",
40
- "cssnano": "^7.0.4",
40
+ "cssnano": "^7.0.5",
41
41
  "ext-to-regexp": "^0.1.0",
42
42
  "less": "^4.2.0",
43
43
  "less-loader": "^12.2.0",
44
44
  "mini-css-extract-plugin": "^2.9.0",
45
- "postcss": "^8.4.40",
45
+ "postcss": "^8.4.41",
46
46
  "postcss-loader": "^8.1.1",
47
47
  "postcss-preset-evergreen": "^0.6.0",
48
48
  "resolve-url-loader": "^5.0.0",
@@ -53,10 +53,10 @@
53
53
  "style-loader": "^4.0.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@best-shot/core": "~0.10.0"
56
+ "@best-shot/core": "~0.10.1"
57
57
  },
58
58
  "engines": {
59
- "node": ">=20.6.0 || ^18.19.0"
59
+ "node": ">=22.0.0 || ^18.20.4 || ^20.16.0"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public",