From 36865da0d32b876dce0abbd552d4b82bd807787c Mon Sep 17 00:00:00 2001 From: Ilya Golovin <74474615+ILScc@users.noreply.github.com> Date: Fri, 13 May 2022 16:34:31 +0300 Subject: [PATCH 1/4] fix: remove depcreated `postcss.plugin` usage --- src/postcss-clean.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/postcss-clean.ts b/src/postcss-clean.ts index ac1ff60..60c4991 100644 --- a/src/postcss-clean.ts +++ b/src/postcss-clean.ts @@ -3,12 +3,14 @@ import * as postcss from 'postcss' // https://github.com/vuejs/vue-component-compiler/pull/103#issuecomment-632676899 const CleanCSS = require('clean-css') -export default postcss.plugin('clean', (options: any) => { - const clean = new CleanCSS({ compatibility: 'ie9', ...options }) - - return (css: any, res: any) => { - const output = clean.minify(css.toString()) - - res.root = postcss.parse(output.styles) +exports.default = (options) => { + const clean = new CleanCSS(Object.assign({ compatibility: 'ie9' }, options)) + return { + postcssPlugin: 'clean', + Once(css, res) { + const output = clean.minify(css.toString()) + res.root = postcss.parse(output.styles) + }, } -}) +} +exports.postcss = true From fe875bacbd4c1c9a6bf22dc14650d1896564a21a Mon Sep 17 00:00:00 2001 From: Ilya Golovin <74474615+ILScc@users.noreply.github.com> Date: Fri, 13 May 2022 16:40:36 +0300 Subject: [PATCH 2/4] Fix: add missing type --- src/postcss-clean.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postcss-clean.ts b/src/postcss-clean.ts index 60c4991..15e07ab 100644 --- a/src/postcss-clean.ts +++ b/src/postcss-clean.ts @@ -3,7 +3,7 @@ import * as postcss from 'postcss' // https://github.com/vuejs/vue-component-compiler/pull/103#issuecomment-632676899 const CleanCSS = require('clean-css') -exports.default = (options) => { +exports.default = (options): postcss.Plugin => { const clean = new CleanCSS(Object.assign({ compatibility: 'ie9' }, options)) return { postcssPlugin: 'clean', From baa5ea451e03234930a2ae9746ac82234468961c Mon Sep 17 00:00:00 2001 From: Ilya Golovin <74474615+ILScc@users.noreply.github.com> Date: Sat, 14 May 2022 19:12:51 +0300 Subject: [PATCH 3/4] FIx: remove ts errors --- src/postcss-clean.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/postcss-clean.ts b/src/postcss-clean.ts index 15e07ab..610be9f 100644 --- a/src/postcss-clean.ts +++ b/src/postcss-clean.ts @@ -1,15 +1,16 @@ import * as postcss from 'postcss' + // ESM import of clean-css breaks test/runtime check this fix for reference: // https://github.com/vuejs/vue-component-compiler/pull/103#issuecomment-632676899 const CleanCSS = require('clean-css') -exports.default = (options): postcss.Plugin => { +exports.default = (options: any): postcss.Plugin => { const clean = new CleanCSS(Object.assign({ compatibility: 'ie9' }, options)) return { postcssPlugin: 'clean', Once(css, res) { const output = clean.minify(css.toString()) - res.root = postcss.parse(output.styles) + res.root = () => postcss.parse(output.styles) }, } } From 4d95df1b28fcffa68d2ab58b7803560d9ad2b540 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Mon, 16 May 2022 13:54:34 +0300 Subject: [PATCH 4/4] update postcss peer & typings --- package.json | 5 +++-- src/postcss-clean.ts | 9 +++++---- tsconfig.json | 3 ++- yarn.lock | 24 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 45d8540..bd56af4 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,8 @@ "typescript": "^3.2.4", "typescript-eslint-parser": "^15.0.0", "vue": "^2.5.16", - "vue-template-compiler": "^2.5.16" + "vue-template-compiler": "^2.5.16", + "postcss": "^8.4.13" }, "optionalDependencies": { "less": "^3.9.0", @@ -59,7 +60,7 @@ "stylus": "^0.54.5" }, "peerDependencies": { - "postcss": ">=6.0", + "postcss": ">=8.0", "vue-template-compiler": "*" }, "dependencies": { diff --git a/src/postcss-clean.ts b/src/postcss-clean.ts index 610be9f..637fa5a 100644 --- a/src/postcss-clean.ts +++ b/src/postcss-clean.ts @@ -1,17 +1,18 @@ -import * as postcss from 'postcss' +import {parse, Plugin} from 'postcss'; // ESM import of clean-css breaks test/runtime check this fix for reference: // https://github.com/vuejs/vue-component-compiler/pull/103#issuecomment-632676899 const CleanCSS = require('clean-css') -exports.default = (options: any): postcss.Plugin => { +export const postcss = true; + +export default (options: import('clean-css').Options = {}): Plugin => { const clean = new CleanCSS(Object.assign({ compatibility: 'ie9' }, options)) return { postcssPlugin: 'clean', Once(css, res) { const output = clean.minify(css.toString()) - res.root = () => postcss.parse(output.styles) + res.root = () => parse(output.styles) }, } } -exports.postcss = true diff --git a/tsconfig.json b/tsconfig.json index a74a79f..8db0feb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,8 @@ "noImplicitAny": true, "removeComments": false, "lib": ["es6", "es7"], - "types": ["@types/jest", "node"] + "types": ["@types/jest", "node"], + "skipLibCheck": true }, "include": ["src", "typings"] } diff --git a/yarn.lock b/yarn.lock index 9bee42a..705df57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3445,6 +3445,11 @@ nan@^2.9.2: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" +nanoid@^3.3.3: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== + nanomatch@^1.2.9: version "1.2.9" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" @@ -3795,6 +3800,11 @@ performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -3887,6 +3897,15 @@ postcss@^7.0.14: source-map "^0.6.1" supports-color "^6.1.0" +postcss@^8.4.13: + version "8.4.13" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.13.tgz#7c87bc268e79f7f86524235821dfdf9f73e5d575" + integrity sha512-jtL6eTBrza5MPzy8oJLFuUscHDXTV5KcLlqAWHl5q5WYRfnNRGSmOZmOZ1T6Gy7A99mOZfqungmZMpMmCVJ8ZA== + dependencies: + nanoid "^3.3.3" + picocolors "^1.0.0" + source-map-js "^1.0.2" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -4551,6 +4570,11 @@ sntp@2.x.x: dependencies: hoek "4.x.x" +source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + source-map-resolve@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a"