Repository: maizzle/framework
Pull request #308 (2020-09-21 20:06:57)

build(deps): bump @fullhuman/postcss-purgecss from 2.3.0 to 3.0.0
Bumps [@fullhuman/postcss-purgecss](https://github.com/FullHuman/purgecss) from 2.3.0 to 3.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/FullHuman/purgecss/releases">@fullhuman/postcss-purgecss's releases</a>.</em></p>
<blockquote>
<h2>v3.0.0</h2>
<h2>3.0.0</h2>
<h3>Simplifying whitelist option</h3>
<p>Whitelist started as a simple option named <code>whitelist</code> but grew up with the different use-cases and needs that appear with time. Another option called <code>whitelistPatterns</code> appeared, then <code>whitelistPatternsChildren</code>, …
It is now more complex and complicated, and somewhat difficult to remember how to use it with different options.</p>
<p>To summarize the changes, the whitelist options are now grouped in one option called safelist. And the most used options can be defined in one array.</p>
<p>Two forms are available. The simple form is:</p>
<pre lang="ts"><code>safelist: ['invisibleClass', /^nav-/]
</code></pre>
<p>In this form, safelist is an array that can take a string or a regex.</p>
<p>The complex form is:</p>
<pre lang="ts"><code>safelist: {
 standard: ['invisibleClass', /^nav-/],
 deep: [],
 greedy: [],
 keyframes: [],
 variables: []
}
</code></pre>
<p>In this form, safelist is an object taking optional properties:
standard is the same as the simple form and replaces <code>whitelist</code> and whitelistPatterns
deep replaces whitelistPatternsChildren
greedy is a new option coming from <a href="https://github-redirect.dependabot.com/FullHuman/purgecss/pull/424">FullHuman/purgecss#424</a>
keyframes can be used to add keyframes to the safelist, when using keyframes: true (<a href="https://github-redirect.dependabot.com/FullHuman/purgecss/issues/418">FullHuman/purgecss#418</a>)
variables can be used to add CSS variables to the safelist, when using variables: true</p>
<h4>New Option: Blocklist</h4>
<p>Blocklist will block the CSS selectors from appearing in the final output CSS. The selectors will be removed even when they are seen as used by PurgeCSS.</p>
<pre><code>blocklist: ['usedClass', /^nav-/]
</code></pre>
<p>Even if <code>nav-links</code> and <code>usedClass</code> are found in your content files (HTML, Javascript), they will be removed.</p>
<h3>CLI</h3>
<p>PurgeCSS is using commander.js for its CLI. The recent version of commander.js introduced the possibility of making an option variadic. This means when specifying multiple option arguments, the parsed option value will be an array.
A few options are now taking advantage of this new feature: content, css, and the newly introduced option safelist and blocklist. It is no longer necessary to separate the list items with a comma.</p>
<h3>From changelog:</h3>
<!-- raw HTML omitted -->
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/FullHuman/purgecss/commit/4a2a9504a41fe361f5aa36f3a2e50eabee84aec0"><code>4a2a950</code></a> build: 3.0.0</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/10315a80a2b0bf5ea7a93c74e74cf9590ada328e"><code>10315a8</code></a> build: changelog 3.0</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/7af721599cd28a66d84732d2ade8ffc15996b423"><code>7af7215</code></a> build: add exports auto to rollup build script</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/0f177056c14fe43a7b83c6b03deeabddab25ce5b"><code>0f17705</code></a> docs: add sponsor</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/761eed87c623ee87338ef999ea755099b36bd7ae"><code>761eed8</code></a> fix(CLI): exit process on error with code 1</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/c871293af8f219d48f88b9657ddd28733554c695"><code>c871293</code></a> build: fix build errors</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/1f192e8f8d772db1a980a0d669fa79a7f2f81020"><code>1f192e8</code></a> build: fix eslint errors</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/9cb763edbbaa3c4953733cfa4bc0261c0d8c0ca9"><code>9cb763e</code></a> refactor: remove unused file cmd.ts</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/d60f7e092b125115efbe73e4bc87f4144602b675"><code>d60f7e0</code></a> docs: change CLI option no longer require to be comma separated</li>
<li><a href="https://github.com/FullHuman/purgecss/commit/35e5c45f1f0954696457792fa2e58930977fe385"><code>35e5c45</code></a> feat(CLI): use variadic options for css, content</li>
<li>Additional commits viewable in <a href="https://github.com/FullHuman/purgecss/compare/v2.3.0...v3.0.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=@fullhuman/postcss-purgecss&package-manager=npm_and_yarn&previous-version=2.3.0&new-version=3.0.0)](https://dependabot.com/compatibility-score/?dependency-name=@fullhuman/postcss-purgecss&package-manager=npm_and_yarn&previous-version=2.3.0&new-version=3.0.0)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)



</details>

cossssmin: @dependabot rebase

Patch:
diff --git a/package-lock.json b/package-lock.json
index 7089869..29372e8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -350,12 +350,12 @@
       }
     },
     "@fullhuman/postcss-purgecss": {
-      "version": "2.3.0",
-      "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-2.3.0.tgz",
-      "integrity": "sha512-qnKm5dIOyPGJ70kPZ5jiz0I9foVOic0j+cOzNDoo8KoCf6HjicIZ99UfO2OmE7vCYSKAAepEwJtNzpiiZAh9xw==",
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-3.0.0.tgz",
+      "integrity": "sha512-cvuOgMwIVlfgWcUMqg5p33NbGUxLwMrKtDKkm3QRfOo4PRVNR6+y/xd9OyXTVZiB1bIpKNJ0ZObYPWD3DRQDtw==",
       "requires": {
         "postcss": "7.0.32",
-        "purgecss": "^2.3.0"
+        "purgecss": "^3.0.0"
       }
     },
     "@istanbuljs/load-nyc-config": {
@@ -9502,20 +9502,20 @@
       }
     },
     "purgecss": {
-      "version": "2.3.0",
-      "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-2.3.0.tgz",
-      "integrity": "sha512-BE5CROfVGsx2XIhxGuZAT7rTH9lLeQx/6M0P7DTXQH4IUc3BBzs9JUzt4yzGf3JrH9enkeq6YJBe9CTtkm1WmQ==",
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-3.0.0.tgz",
+      "integrity": "sha512-t3FGCwyX9XWV3ffvnAXTw6Y3Z9kNlcgm14VImNK66xKi5sdqxSA2I0SFYxtmZbAKuIZVckPdazw5iKL/oY/2TA==",
       "requires": {
-        "commander": "^5.0.0",
+        "commander": "^6.0.0",
         "glob": "^7.0.0",
         "postcss": "7.0.32",
         "postcss-selector-parser": "^6.0.2"
       },
       "dependencies": {
         "commander": {
-          "version": "5.1.0",
-          "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
-          "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg=="
+          "version": "6.1.0",
+          "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz",
+          "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA=="
         }
       }
     },
@@ -11098,6 +11098,15 @@
         "resolve": "^1.14.2"
       },
       "dependencies": {
+        "@fullhuman/postcss-purgecss": {
+          "version": "2.3.0",
+          "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-2.3.0.tgz",
+          "integrity": "sha512-qnKm5dIOyPGJ70kPZ5jiz0I9foVOic0j+cOzNDoo8KoCf6HjicIZ99UfO2OmE7vCYSKAAepEwJtNzpiiZAh9xw==",
+          "requires": {
+            "postcss": "7.0.32",
+            "purgecss": "^2.3.0"
+          }
+        },
         "ansi-styles": {
           "version": "4.2.1",
           "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
@@ -11145,6 +11154,11 @@
           "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
           "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
         },
+        "commander": {
+          "version": "5.1.0",
+          "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
+          "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg=="
+        },
         "electron-to-chromium": {
           "version": "1.3.567",
           "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.567.tgz",
@@ -11193,6 +11207,17 @@
           "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
           "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ=="
         },
+        "purgecss": {
+          "version": "2.3.0",
+          "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-2.3.0.tgz",
+          "integrity": "sha512-BE5CROfVGsx2XIhxGuZAT7rTH9lLeQx/6M0P7DTXQH4IUc3BBzs9JUzt4yzGf3JrH9enkeq6YJBe9CTtkm1WmQ==",
+          "requires": {
+            "commander": "^5.0.0",
+            "glob": "^7.0.0",
+            "postcss": "7.0.32",
+            "postcss-selector-parser": "^6.0.2"
+          }
+        },
         "resolve": {
           "version": "1.17.0",
           "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
diff --git a/package.json b/package.json
index 936c1b8..a2d4008 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
     "release": "np"
   },
   "dependencies": {
-    "@fullhuman/postcss-purgecss": "^2.3.0",
+    "@fullhuman/postcss-purgecss": "^3.0.0",
     "browser-sync": "^2.26.12",
     "color-shorthand-hex-to-six-digit": "^2.10.65",
     "deepmerge": "^4.2.2",
diff --git a/src/generators/tailwind.js b/src/generators/tailwind.js
index 7b1d030..b190cf1 100644
--- a/src/generators/tailwind.js
+++ b/src/generators/tailwind.js
@@ -34,14 +34,14 @@ module.exports = {
     ]
 
     const extractor = getPropValue(tailwindConfigObject, 'purge.options.extractor') || purgeCSSOptions.extractor || defaultPurgeCSSExtractor
-    const purgeWhitelist = getPropValue(tailwindConfigObject, 'purge.options.whitelist') || purgeCSSOptions.whitelist || []
-    const purgewhitelistPatterns = getPropValue(tailwindConfigObject, 'purge.options.whitelistPatterns') || purgeCSSOptions.whitelistPatterns || []
+    const purgeSafeList = getPropValue(tailwindConfigObject, 'purge.options.safelist') || purgeCSSOptions.safelist || {}
+    const purgeBlockList = getPropValue(tailwindConfigObject, 'purge.options.blocklist') || purgeCSSOptions.blocklist || []
 
     const purgeCssPlugin = maizzleConfig.env === 'local' ? () => {} : purgecss({
       content: purgeSources,
       defaultExtractor: content => content.match(extractor) || [],
-      whitelist: purgeWhitelist,
-      whitelistPatterns: purgewhitelistPatterns
+      safelist: purgeSafeList,
+      blocklist: [...purgeBlockList]
     })
 
     const mergeLonghandPlugin = maizzleConfig.env === 'local' ? () => {} : mergeLonghand()


Test patch:
diff --git a/test/test-tailwind.js b/test/test-tailwind.js
index 03f4d34..f314b54 100644
--- a/test/test-tailwind.js
+++ b/test/test-tailwind.js
@@ -34,16 +34,31 @@ test('uses CSS file provided in environment config', async t => {
 })
 
 test('uses purgeCSS options provided in the config', async t => {
-  const config = {
+  const html = '<div class="z-0 text-center"></div>'
+
+  const arrayConfig = {
+    purgeCSS: {
+      content: [{raw: html}],
+      safelist: ['z-10'],
+      blocklist: ['text-center']
+    }
+  }
+
+  const objectConfig = {
     purgeCSS: {
-      content: [{raw: '<div class="z-0"></div>'}],
-      whitelist: ['z-10']
+      content: [{raw: html}],
+      safelist: {
+        standard: ['z-10']
+      },
+      blocklist: ['text-center']
     }
   }
 
-  const css = await Tailwind.compile('', '', {corePlugins: {animation: false}}, config)
+  const css1 = await Tailwind.compile('', '', {corePlugins: {animation: false}}, arrayConfig)
+  const css2 = await Tailwind.compile('', '', {corePlugins: {animation: false}}, objectConfig)
 
-  t.is(css.trim(), '.z-0 {\n  z-index: 0 !important\n}\n\n.z-10 {\n  z-index: 10 !important\n}')
+  t.is(css1.trim(), '.z-0 {\n  z-index: 0 !important\n}\n\n.z-10 {\n  z-index: 10 !important\n}')
+  t.is(css2.trim(), '.z-0 {\n  z-index: 0 !important\n}\n\n.z-10 {\n  z-index: 10 !important\n}')
 })
 
 test('uses postcss plugins from the config when compiling from string', async t => {