@vituum/vite-plugin-postcss 1.0.0 → 2.0.0-next.1
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/README.md +2 -2
- package/index.js +27 -26
- package/package.json +22 -18
package/README.md
CHANGED
|
@@ -27,5 +27,5 @@ Read the [docs](https://vituum.dev/plugins/postcss.html) to learn more about plu
|
|
|
27
27
|
|
|
28
28
|
### Requirements
|
|
29
29
|
|
|
30
|
-
- [Node.js LTS (
|
|
31
|
-
- [Vite](https://vitejs.dev/)
|
|
30
|
+
- [Node.js LTS (24.x)](https://nodejs.org/en/download/)
|
|
31
|
+
- [Vite (8.x)](https://vitejs.dev/)
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import postcssImport from 'postcss-import'
|
|
|
2
2
|
import postcssNesting from 'postcss-nesting'
|
|
3
3
|
import postcssCustomMedia from 'postcss-custom-media'
|
|
4
4
|
import autoprefixer from 'autoprefixer'
|
|
5
|
-
import { getPackageInfo,
|
|
5
|
+
import { getPackageInfo, deepMergeWith } from 'vituum/utils/common.js'
|
|
6
6
|
|
|
7
7
|
const { name } = getPackageInfo(import.meta.url)
|
|
8
8
|
|
|
@@ -10,10 +10,10 @@ const { name } = getPackageInfo(import.meta.url)
|
|
|
10
10
|
* @type {import('@vituum/vite-plugin-postcss/types/index').PluginUserConfig}
|
|
11
11
|
*/
|
|
12
12
|
const defaultOptions = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import: {},
|
|
14
|
+
nesting: {},
|
|
15
|
+
customMedia: {},
|
|
16
|
+
autoprefixer: {},
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -21,29 +21,30 @@ const defaultOptions = {
|
|
|
21
21
|
* @returns {import('vite').Plugin}
|
|
22
22
|
*/
|
|
23
23
|
const plugin = (options = {}) => {
|
|
24
|
-
|
|
24
|
+
options = deepMergeWith(defaultOptions, options)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const postcssPlugins = [
|
|
27
|
+
postcssImport(options.import),
|
|
28
|
+
postcssNesting(options.nesting),
|
|
29
|
+
postcssCustomMedia(options.customMedia),
|
|
30
|
+
autoprefixer(options.autoprefixer),
|
|
31
|
+
]
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
33
|
+
return {
|
|
34
|
+
name,
|
|
35
|
+
enforce: 'pre',
|
|
36
|
+
/** @param {import('@vituum/vite-plugin-postcss/types/viteUserConfig').ViteUserConfig} userConfig */
|
|
37
|
+
config(userConfig) {
|
|
38
|
+
if (!userConfig?.css?.postcss && !userConfig?.css?.postcss?.plugins) {
|
|
39
|
+
userConfig.css = userConfig.css || {}
|
|
40
|
+
userConfig.css.postcss = userConfig.css.postcss || {}
|
|
41
|
+
userConfig.css.postcss.plugins = postcssPlugins
|
|
42
|
+
}
|
|
43
|
+
else if (userConfig.css.postcss.plugins) {
|
|
44
|
+
userConfig.css.postcss.plugins = postcssPlugins.concat(...userConfig.css.postcss.plugins)
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export default plugin
|
package/package.json
CHANGED
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vituum/vite-plugin-postcss",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"lint": "npm run eslint && npm run tsc",
|
|
8
9
|
"tsc": "tsc",
|
|
9
|
-
"eslint": "eslint '**/*.js' --fix"
|
|
10
|
+
"eslint": "eslint '**/*.js' --fix",
|
|
11
|
+
"publish-next": "npm publish --tag next"
|
|
10
12
|
},
|
|
11
13
|
"dependencies": {
|
|
12
|
-
"vituum": "^
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"postcss": "^
|
|
16
|
-
"postcss-
|
|
17
|
-
"postcss-
|
|
18
|
-
"postcss-custom-media": "^9.1.5"
|
|
14
|
+
"vituum": "^2.0.0-next.9",
|
|
15
|
+
"autoprefixer": "^10.4",
|
|
16
|
+
"postcss": "^8.5",
|
|
17
|
+
"postcss-import": "^16.1",
|
|
18
|
+
"postcss-nesting": "^14.0",
|
|
19
|
+
"postcss-custom-media": "^12.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"eslint
|
|
25
|
-
"
|
|
22
|
+
"@eslint/js": "^9.39",
|
|
23
|
+
"@stylistic/eslint-plugin": "^5.7",
|
|
24
|
+
"@types/node": "^25.0",
|
|
25
|
+
"eslint": "^9.39",
|
|
26
|
+
"globals": "^17.0",
|
|
27
|
+
"typescript": "^5.9",
|
|
28
|
+
"vite": "^8.0.0-beta.8"
|
|
26
29
|
},
|
|
27
30
|
"files": [
|
|
28
31
|
"index.js",
|
|
29
32
|
"types"
|
|
30
33
|
],
|
|
31
34
|
"exports": {
|
|
32
|
-
".":
|
|
33
|
-
|
|
35
|
+
".": {
|
|
36
|
+
"default": "./index.js",
|
|
37
|
+
"types": "./types/index.d.ts"
|
|
38
|
+
}
|
|
34
39
|
},
|
|
35
40
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
37
|
-
"npm": ">=9.0.0"
|
|
41
|
+
"node": "^24.0.0 || >=25.0.0"
|
|
38
42
|
},
|
|
39
43
|
"repository": {
|
|
40
44
|
"type": "git",
|