Skip to content

Commit 729b400

Browse files
committed
Upgrade to PostCSS 8
1 parent 042e259 commit 729b400

File tree

3 files changed

+88
-67
lines changed

3 files changed

+88
-67
lines changed

package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,23 @@
3838
"@babel/core": "^7.12.3",
3939
"@babel/node": "^7.0.0",
4040
"@babel/preset-env": "^7.0.0",
41+
"autoprefixer": "^10.0.2",
4142
"babel-jest": "^26.6.3",
4243
"clean-css": "^4.1.9",
4344
"eslint": "^7.12.1",
4445
"eslint-config-prettier": "^6.15.0",
4546
"eslint-plugin-prettier": "^3.1.4",
4647
"jest": "^26.6.3",
48+
"postcss": "^8.0.9",
4749
"prettier": "^2.1.2",
4850
"rimraf": "^3.0.0"
4951
},
50-
"peerDependencies": {},
52+
"peerDependencies": {
53+
"autoprefixer": "^10.0.2",
54+
"postcss": "^8.0.9"
55+
},
5156
"dependencies": {
5257
"@fullhuman/postcss-purgecss": "^3.0.0",
53-
"autoprefixer": "^9.8.6",
5458
"bytes": "^3.0.0",
5559
"chalk": "^4.1.0",
5660
"color": "^3.1.3",
@@ -62,10 +66,9 @@
6266
"modern-normalize": "^1.0.0",
6367
"node-emoji": "^1.8.1",
6468
"object-hash": "^2.0.3",
65-
"postcss": "^7",
66-
"postcss-functions": "^3.0.0",
67-
"postcss-js": "^2.0.3",
68-
"postcss-nested": "^4.2.3",
69+
"postcss-functions": "^3",
70+
"postcss-js": "^3.0.3",
71+
"postcss-nested": "^5.0.1",
6972
"postcss-selector-parser": "^6.0.4",
7073
"postcss-value-parser": "^4.1.0",
7174
"pretty-hrtime": "^1.0.3",

src/index.js

+11-31
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import resolveConfig from './util/resolveConfig'
1111
import getAllConfigs from './util/getAllConfigs'
1212
import { defaultConfigFile } from './constants'
1313
import defaultConfig from '../stubs/defaultConfig.stub.js'
14-
import postcss from 'postcss'
1514

1615
function resolveConfigPath(filePath) {
1716
// require('tailwindcss')({ theme: ..., variants: ... })
@@ -63,41 +62,22 @@ const getConfigFunction = (config) => () => {
6362
return resolveConfig([...getAllConfigs(configObject)])
6463
}
6564

66-
const plugin = postcss.plugin('tailwind', (config) => {
65+
module.exports = function (config) {
6766
const plugins = []
6867
const resolvedConfigPath = resolveConfigPath(config)
6968

7069
if (!_.isUndefined(resolvedConfigPath)) {
7170
plugins.push(registerConfigAsDependency(resolvedConfigPath))
7271
}
7372

74-
return postcss([
75-
...plugins,
76-
processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
77-
formatCSS,
78-
])
79-
})
80-
81-
module.exports = plugin
82-
83-
// PostCSS 8
84-
// module.exports = function (config) {
85-
// console.log(arguments)
86-
// const plugins = []
87-
// const resolvedConfigPath = resolveConfigPath(config)
88-
89-
// if (!_.isUndefined(resolvedConfigPath)) {
90-
// plugins.push(registerConfigAsDependency(resolvedConfigPath))
91-
// }
92-
93-
// return {
94-
// postcssPlugin: 'tailwindcss',
95-
// plugins: [
96-
// ...plugins,
97-
// processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
98-
// formatCSS,
99-
// ],
100-
// }
101-
// }
73+
return {
74+
postcssPlugin: 'tailwindcss',
75+
plugins: [
76+
...plugins,
77+
processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
78+
formatCSS,
79+
],
80+
}
81+
}
10282

103-
// module.exports.postcss = true
83+
module.exports.postcss = true

yarn.lock

+68-30
Original file line numberDiff line numberDiff line change
@@ -1541,17 +1541,16 @@ atob@^2.1.1:
15411541
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
15421542
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
15431543

1544-
autoprefixer@^9.8.6:
1545-
version "9.8.6"
1546-
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.6.tgz#3b73594ca1bf9266320c5acf1588d74dea74210f"
1547-
integrity sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg==
1544+
autoprefixer@^10.0.2:
1545+
version "10.0.2"
1546+
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.0.2.tgz#a79f9a02bfb95c621998776ac0d85f8f855b367e"
1547+
integrity sha512-okBmu9OMdt6DNEcZmnl0IYVv8Xl/xYWRSnc2OJ9UJEOt1u30opG1B8aLsViqKryBaYv1SKB4f85fOGZs5zYxHQ==
15481548
dependencies:
1549-
browserslist "^4.12.0"
1550-
caniuse-lite "^1.0.30001109"
1549+
browserslist "^4.14.7"
1550+
caniuse-lite "^1.0.30001157"
15511551
colorette "^1.2.1"
15521552
normalize-range "^0.1.2"
15531553
num2fraction "^1.2.2"
1554-
postcss "^7.0.32"
15551554
postcss-value-parser "^4.1.0"
15561555

15571556
aws-sign2@~0.7.0:
@@ -1708,6 +1707,17 @@ browserslist@^4.12.0, browserslist@^4.8.3:
17081707
escalade "^3.0.1"
17091708
node-releases "^1.1.58"
17101709

1710+
browserslist@^4.14.7:
1711+
version "4.14.7"
1712+
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.14.7.tgz#c071c1b3622c1c2e790799a37bb09473a4351cb6"
1713+
integrity sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==
1714+
dependencies:
1715+
caniuse-lite "^1.0.30001157"
1716+
colorette "^1.2.1"
1717+
electron-to-chromium "^1.3.591"
1718+
escalade "^3.1.1"
1719+
node-releases "^1.1.66"
1720+
17111721
bser@^2.0.0:
17121722
version "2.1.0"
17131723
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5"
@@ -1765,10 +1775,10 @@ caniuse-lite@^1.0.30001093:
17651775
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001094.tgz#0b11d02e1cdc201348dbd8e3e57bd9b6ce82b175"
17661776
integrity sha512-ufHZNtMaDEuRBpTbqD93tIQnngmJ+oBknjvr0IbFympSdtFpAUFmNv4mVKbb53qltxFx0nK3iy32S9AqkLzUNA==
17671777

1768-
caniuse-lite@^1.0.30001109:
1769-
version "1.0.30001148"
1770-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001148.tgz#dc97c7ed918ab33bf8706ddd5e387287e015d637"
1771-
integrity sha512-E66qcd0KMKZHNJQt9hiLZGE3J4zuTqE1OnU53miEVtylFbwOEmeA5OsRu90noZful+XGSQOni1aT2tiqu/9yYw==
1778+
caniuse-lite@^1.0.30001157:
1779+
version "1.0.30001158"
1780+
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001158.tgz#fce86d321369603c2bc855ee0e901a7f49f8310b"
1781+
integrity sha512-s5loVYY+yKpuVA3HyW8BarzrtJvwHReuzugQXlv1iR3LKSReoFXRm86mT6hT7PEF5RxW+XQZg+6nYjlywYzQ+g==
17721782

17731783
capture-exit@^2.0.0:
17741784
version "2.0.0"
@@ -2213,6 +2223,11 @@ electron-to-chromium@^1.3.488:
22132223
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.488.tgz#9226229f5fbc825959210e81e0bb3e63035d1c06"
22142224
integrity sha512-NReBdOugu1yl8ly+0VDtiQ6Yw/1sLjnvflWq0gvY1nfUXU2PbA+1XAVuEb7ModnwL/MfUPjby7e4pAFnSHiy6Q==
22152225

2226+
electron-to-chromium@^1.3.591:
2227+
version "1.3.596"
2228+
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.596.tgz#c7ed98512c7ff36ddcbfed9e54e6355335c35257"
2229+
integrity sha512-nLO2Wd2yU42eSoNJVQKNf89CcEGqeFZd++QsnN2XIgje1s/19AgctfjLIbPORlvcCO8sYjLwX4iUgDdusOY8Sg==
2230+
22162231
emittery@^0.7.1:
22172232
version "0.7.1"
22182233
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.1.tgz#c02375a927a40948c0345cc903072597f5270451"
@@ -2275,6 +2290,11 @@ escalade@^3.0.1:
22752290
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.0.1.tgz#52568a77443f6927cd0ab9c73129137533c965ed"
22762291
integrity sha512-DR6NO3h9niOT+MZs7bjxlj2a1k+POu5RN8CLTPX2+i78bRi9eLe7+0zXgUHMnGXWybYcL61E9hGhPKqedy8tQA==
22772292

2293+
escalade@^3.1.1:
2294+
version "3.1.1"
2295+
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
2296+
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
2297+
22782298
escape-string-regexp@^1.0.5:
22792299
version "1.0.5"
22802300
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -3220,7 +3240,7 @@ is-wsl@^2.2.0:
32203240
dependencies:
32213241
is-docker "^2.0.0"
32223242

3223-
[email protected], isarray@~1.0.0:
3243+
[email protected], isarray@^1.0.0, isarray@~1.0.0:
32243244
version "1.0.0"
32253245
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
32263246
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
@@ -3842,6 +3862,14 @@ levn@~0.3.0:
38423862
prelude-ls "~1.1.2"
38433863
type-check "~0.3.2"
38443864

3865+
line-column@^1.0.2:
3866+
version "1.0.2"
3867+
resolved "https://registry.yarnpkg.com/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2"
3868+
integrity sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI=
3869+
dependencies:
3870+
isarray "^1.0.0"
3871+
isobject "^2.0.0"
3872+
38453873
lines-and-columns@^1.1.6:
38463874
version "1.1.6"
38473875
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
@@ -4044,6 +4072,11 @@ nan@^2.12.1:
40444072
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
40454073
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
40464074

4075+
nanoid@^3.1.16:
4076+
version "3.1.16"
4077+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.16.tgz#b21f0a7d031196faf75314d7c65d36352beeef64"
4078+
integrity sha512-+AK8MN0WHji40lj8AEuwLOvLSbWYApQpre/aFJZD71r43wVRLrOYS4FmJOPQYon1TqB462RzrrxlfA74XRES8w==
4079+
40474080
nanomatch@^1.2.9:
40484081
version "1.2.13"
40494082
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
@@ -4138,6 +4171,11 @@ node-releases@^1.1.58:
41384171
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.58.tgz#8ee20eef30fa60e52755fcc0942def5a734fe935"
41394172
integrity sha512-NxBudgVKiRh/2aPWMgPR7bPTX0VPmGx5QBwCtdHitnqFE5/O8DeBXuIMH1nwNnw/aMo6AjOrpsHzfY3UbUJ7yg==
41404173

4174+
node-releases@^1.1.66:
4175+
version "1.1.66"
4176+
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.66.tgz#609bd0dc069381015cd982300bae51ab4f1b1814"
4177+
integrity sha512-JHEQ1iWPGK+38VLB2H9ef2otU4l8s3yAMt9Xf934r6+ojCYDMHPMqvCc9TnzfeFSP1QEOeU6YZEd3+De0LTCgg==
4178+
41414179
nopt@^4.0.1:
41424180
version "4.0.1"
41434181
resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
@@ -4493,7 +4531,7 @@ posix-character-classes@^0.1.0:
44934531
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
44944532
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
44954533

4496-
postcss-functions@^3.0.0:
4534+
postcss-functions@^3:
44974535
version "3.0.0"
44984536
resolved "https://registry.yarnpkg.com/postcss-functions/-/postcss-functions-3.0.0.tgz#0e94d01444700a481de20de4d55fb2640564250e"
44994537
integrity sha1-DpTQFERwCkgd4g3k1V+yZAVkJQ4=
@@ -4503,21 +4541,20 @@ postcss-functions@^3.0.0:
45034541
postcss "^6.0.9"
45044542
postcss-value-parser "^3.3.0"
45054543

4506-
postcss-js@^2.0.3:
4507-
version "2.0.3"
4508-
resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-2.0.3.tgz#a96f0f23ff3d08cec7dc5b11bf11c5f8077cdab9"
4509-
integrity sha512-zS59pAk3deu6dVHyrGqmC3oDXBdNdajk4k1RyxeVXCrcEDBUBHoIhE4QTsmhxgzXxsaqFDAkUZfmMa5f/N/79w==
4544+
postcss-js@^3.0.3:
4545+
version "3.0.3"
4546+
resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-3.0.3.tgz#2f0bd370a2e8599d45439f6970403b5873abda33"
4547+
integrity sha512-gWnoWQXKFw65Hk/mi2+WTQTHdPD5UJdDXZmX073EY/B3BWnYjO4F4t0VneTCnCGQ5E5GsCdMkzPaTXwl3r5dJw==
45104548
dependencies:
45114549
camelcase-css "^2.0.1"
4512-
postcss "^7.0.18"
4550+
postcss "^8.1.6"
45134551

4514-
postcss-nested@^4.2.3:
4515-
version "4.2.3"
4516-
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-4.2.3.tgz#c6f255b0a720549776d220d00c4b70cd244136f6"
4517-
integrity sha512-rOv0W1HquRCamWy2kFl3QazJMMe1ku6rCFoAAH+9AcxdbpDeBr6k968MLWuLjvjMcGEip01ak09hKOEgpK9hvw==
4552+
postcss-nested@^5.0.1:
4553+
version "5.0.1"
4554+
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-5.0.1.tgz#e7a77f7a806a09c8de0f2c163d8e3d09f00f3139"
4555+
integrity sha512-ZHNSAoHrMtbEzjq+Qs4R0gHijpXc6F1YUv4TGmGaz7rtfMvVJBbu5hMOH+CrhEaljQpEmx5N/P8i1pXTkbVAmg==
45184556
dependencies:
4519-
postcss "^7.0.32"
4520-
postcss-selector-parser "^6.0.2"
4557+
postcss-selector-parser "^6.0.4"
45214558

45224559
postcss-selector-parser@^6.0.2:
45234560
version "6.0.2"
@@ -4566,14 +4603,15 @@ postcss@^6.0.9:
45664603
source-map "^0.6.1"
45674604
supports-color "^5.4.0"
45684605

4569-
postcss@^7, postcss@^7.0.18, postcss@^7.0.32:
4570-
version "7.0.35"
4571-
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.35.tgz#d2be00b998f7f211d8a276974079f2e92b970e24"
4572-
integrity sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==
4606+
postcss@^8.0.9, postcss@^8.1.6:
4607+
version "8.1.7"
4608+
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.1.7.tgz#ff6a82691bd861f3354fd9b17b2332f88171233f"
4609+
integrity sha512-llCQW1Pz4MOPwbZLmOddGM9eIJ8Bh7SZ2Oj5sxZva77uVaotYDsYTch1WBTNu7fUY0fpWp0fdt7uW40D4sRiiQ==
45734610
dependencies:
4574-
chalk "^2.4.2"
4611+
colorette "^1.2.1"
4612+
line-column "^1.0.2"
4613+
nanoid "^3.1.16"
45754614
source-map "^0.6.1"
4576-
supports-color "^6.1.0"
45774615

45784616
prelude-ls@^1.2.1:
45794617
version "1.2.1"

0 commit comments

Comments
 (0)