diff --git a/package.json b/package.json index 17eb99f5a037..18151343193a 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,13 @@ "eslint-config-prettier": "^6.12.0", "eslint-plugin-prettier": "^3.0.1", "jest": "^26.5.2", + "postcss": "^8.0.9", "prettier": "^2.1.2", "rimraf": "^3.0.0" }, + "peerDependencies": { + "postcss": "^8.0.9" + }, "dependencies": { "@fullhuman/postcss-purgecss": "^3.0.0", "autoprefixer": "^9.8.6", @@ -61,7 +65,6 @@ "modern-normalize": "^1.0.0", "node-emoji": "^1.8.1", "object-hash": "^2.0.3", - "postcss": "^7.0.11", "postcss-functions": "^3.0.0", "postcss-js": "^2.0.0", "postcss-nested": "^4.1.1", diff --git a/src/index.js b/src/index.js index 6b273d029b0e..1393f8af708d 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,6 @@ import path from 'path' import fs from 'fs' import _ from 'lodash' -import postcss from 'postcss' import getModuleDependencies from './lib/getModuleDependencies' import registerConfigAsDependency from './lib/registerConfigAsDependency' @@ -63,7 +62,7 @@ const getConfigFunction = (config) => () => { return resolveConfig([...getAllConfigs(configObject)]) } -const plugin = postcss.plugin('tailwind', (config) => { +module.exports = function (config) { const plugins = [] const resolvedConfigPath = resolveConfigPath(config) @@ -71,11 +70,14 @@ const plugin = postcss.plugin('tailwind', (config) => { plugins.push(registerConfigAsDependency(resolvedConfigPath)) } - return postcss([ - ...plugins, - processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)), - formatCSS, - ]) -}) + return { + postcssPlugin: 'tailwindcss', + plugins: [ + ...plugins, + processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)), + formatCSS, + ], + } +} -module.exports = plugin +module.exports.postcss = true diff --git a/yarn.lock b/yarn.lock index 65e8c814150e..94fb5364f1e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3181,7 +3181,7 @@ is-wsl@^2.2.0: dependencies: is-docker "^2.0.0" -isarray@1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= @@ -3801,6 +3801,14 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +line-column@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2" + integrity sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI= + dependencies: + isarray "^1.0.0" + isobject "^2.0.0" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -4003,6 +4011,11 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== +nanoid@^3.1.12: + version "3.1.12" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.12.tgz#6f7736c62e8d39421601e4a0c77623a97ea69654" + integrity sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -4507,7 +4520,7 @@ postcss-value-parser@^4.1.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb" integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ== -postcss@7.0.32, postcss@^7.0.11, postcss@^7.0.18, postcss@^7.0.32: +postcss@7.0.32, postcss@^7.0.18, postcss@^7.0.32: version "7.0.32" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.32.tgz#4310d6ee347053da3433db2be492883d62cec59d" integrity sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw== @@ -4525,6 +4538,16 @@ postcss@^6.0.9: source-map "^0.6.1" supports-color "^5.4.0" +postcss@^8.0.9: + version "8.1.1" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.1.1.tgz#c3a287dd10e4f6c84cb3791052b96a5d859c9389" + integrity sha512-9DGLSsjooH3kSNjTZUOt2eIj2ZTW0VI2PZ/3My+8TC7KIbH2OKwUlISfDsf63EP4aiRUt3XkEWMWvyJHvJelEg== + dependencies: + colorette "^1.2.1" + line-column "^1.0.2" + nanoid "^3.1.12" + source-map "^0.6.1" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"