purgecss-webpack-plugin 4.0.3 → 4.1.0

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 CHANGED
@@ -1,14 +1,7 @@
1
1
  # purgecss-webpack-plugin
2
2
 
3
- [![Build Status](https://travis-ci.org/FullHuman/purgecss-webpack-plugin.svg?branch=master)](https://travis-ci.org/FullHuman/purgecss-webpack-plugin)
4
- [![CircleCi](https://circleci.com/gh/FullHuman/purgecss-webpack-plugin/tree/master.svg?style=shield)]()
5
- [![dependencies Status](https://david-dm.org/fullhuman/purgecss-webpack-plugin/status.svg)](https://david-dm.org/fullhuman/purgecss-webpack-plugin)
6
- [![devDependencies Status](https://david-dm.org/fullhuman/purgecss-webpack-plugin/dev-status.svg)](https://david-dm.org/fullhuman/purgecss-webpack-plugin?type=dev)
7
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/c23bd13d30104a7a89bed239166aaf69)](https://www.codacy.com/app/FullHuman/purgecss-webpack-plugin?utm_source=github.com&utm_medium=referral&utm_content=FullHuman/purgecss-webpack-plugin&utm_campaign=Badge_Grade)
8
- [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/c23bd13d30104a7a89bed239166aaf69)](https://www.codacy.com/app/FullHuman/purgecss-webpack-plugin?utm_source=github.com&utm_medium=referral&utm_content=FullHuman/purgecss-webpack-plugin&utm_campaign=Badge_Coverage)
9
- [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
10
3
  [![npm](https://img.shields.io/npm/v/purgecss-webpack-plugin.svg)](https://www.npmjs.com/package/purgecss-webpack-plugin)
11
- [![license](https://img.shields.io/github/license/fullhuman/purgecss-webpack-plugin.svg)]() [![Greenkeeper badge](https://badges.greenkeeper.io/FullHuman/purgecss-webpack-plugin.svg)](https://greenkeeper.io/)
4
+ [![license](https://img.shields.io/github/license/fullhuman/purgecss-webpack-plugin.svg)]()
12
5
 
13
6
  [Webpack](https://github.com/webpack/webpack) plugin to remove unused css.
14
7
 
@@ -1,4 +1,4 @@
1
- import { Compiler, Compilation } from "webpack";
1
+ import { Compilation, Compiler } from "webpack";
2
2
  type StringRegExpArray = Array<RegExp | string>;
3
3
  type ComplexSafelist = {
4
4
  standard?: StringRegExpArray;
@@ -31,6 +31,7 @@ interface UserDefinedOptions$0 {
31
31
  safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
32
32
  blocklist?: StringRegExpArray | BlocklistFunction;
33
33
  skippedContentGlobs?: Array<string>;
34
+ dynamicAttributes?: string[];
34
35
  only?: string[];
35
36
  }
36
37
  type PurgedStats = {
@@ -1,4 +1,4 @@
1
- import { Compiler, Compilation } from "webpack";
1
+ import { Compilation, Compiler } from "webpack";
2
2
  type StringRegExpArray = Array<RegExp | string>;
3
3
  type ComplexSafelist = {
4
4
  standard?: StringRegExpArray;
@@ -31,6 +31,7 @@ interface UserDefinedOptions$0 {
31
31
  safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
32
32
  blocklist?: StringRegExpArray | BlocklistFunction;
33
33
  skippedContentGlobs?: Array<string>;
34
+ dynamicAttributes?: string[];
34
35
  only?: string[];
35
36
  }
36
37
  type PurgedStats = {
@@ -1 +1 @@
1
- import{existsSync as t}from"fs";import s from"path";import o,{defaultOptions as e}from"purgecss";import{ConcatSource as i}from"webpack-sources";const n=[".css",".scss",".styl",".sass",".less"];export default class{constructor(t){this.purgedStats={},this.options=t}apply(t){t.hooks.compilation.tap("PurgeCSS",this.initializePlugin.bind(this))}initializePlugin(s){s.hooks.additionalAssets.tapPromise("PurgeCSS",(()=>{const o="function"==typeof this.options.paths?this.options.paths():this.options.paths;return o.forEach((s=>{if(!t(s))throw new Error(`Path ${s} does not exist.`)})),this.runPluginHook(s,o)}))}async runPluginHook(t,r){const c=Object.entries(t.assets).filter((([t])=>function(t,o){const e=s.extname((i=t).includes("?")?i.split("?").slice(0,-1).join(""):i);var i;return o.includes(e)}(t,[".css"])));for(const s of t.chunks){const a=c.filter((([t])=>this.options.only?this.options.only.some((s=>t.includes(s))):Array.isArray(s.files)?s.files.includes(t):s.files.has(t)));for(const[s,c]of a){const a=r.filter((t=>!n.some((s=>t.endsWith(s))))),l={...e,...this.options,content:a,css:[{raw:c.source().toString()}]};"function"==typeof l.safelist&&(l.safelist=l.safelist()),"function"==typeof l.blocklist&&(l.blocklist=l.blocklist());const f=(await(new o).purge({content:l.content,css:l.css,defaultExtractor:l.defaultExtractor,extractors:l.extractors,fontFace:l.fontFace,keyframes:l.keyframes,output:l.output,rejected:l.rejected,variables:l.variables,safelist:l.safelist,blocklist:l.blocklist}))[0];f.rejected&&(this.purgedStats[s]=f.rejected),t.updateAsset(s,new i(f.css))}}}}
1
+ import*as s from"fs";import t from"path";import o,{defaultOptions as e}from"purgecss";import{ConcatSource as i}from"webpack-sources";const n=[".css",".scss",".styl",".sass",".less"];class r{constructor(s){this.purgedStats={},this.options=s}apply(s){s.hooks.compilation.tap("PurgeCSS",this.initializePlugin.bind(this))}initializePlugin(t){t.hooks.additionalAssets.tapPromise("PurgeCSS",(()=>{const o="function"==typeof this.options.paths?this.options.paths():this.options.paths;return o.forEach((t=>{if(!s.existsSync(t))throw new Error(`Path ${t} does not exist.`)})),this.runPluginHook(t,o)}))}async runPluginHook(s,r){const c=Object.entries(s.assets).filter((([s])=>function(s,o){const e=t.extname((i=s).includes("?")?i.split("?").slice(0,-1).join(""):i);var i;return o.includes(e)}(s,[".css"])));for(const t of s.chunks){const a=c.filter((([s])=>this.options.only?this.options.only.some((t=>s.includes(t))):Array.isArray(t.files)?t.files.includes(s):t.files.has(s)));for(const[t,c]of a){const a=r.filter((s=>!n.some((t=>s.endsWith(t))))),l={...e,...this.options,content:a,css:[{raw:c.source().toString()}]};"function"==typeof l.safelist&&(l.safelist=l.safelist()),"function"==typeof l.blocklist&&(l.blocklist=l.blocklist());const f=(await(new o).purge({content:l.content,css:l.css,defaultExtractor:l.defaultExtractor,extractors:l.extractors,fontFace:l.fontFace,keyframes:l.keyframes,output:l.output,rejected:l.rejected,variables:l.variables,safelist:l.safelist,blocklist:l.blocklist}))[0];f.rejected&&(this.purgedStats[t]=f.rejected),s.updateAsset(t,new i(f.css))}}}}export{r as default};
@@ -1 +1 @@
1
- "use strict";var t=require("fs"),s=require("path"),e=require("purgecss"),o=require("webpack-sources");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=i(s),r=i(e);const c=[".css",".scss",".styl",".sass",".less"];module.exports=class{constructor(t){this.purgedStats={},this.options=t}apply(t){t.hooks.compilation.tap("PurgeCSS",this.initializePlugin.bind(this))}initializePlugin(s){s.hooks.additionalAssets.tapPromise("PurgeCSS",(()=>{const e="function"==typeof this.options.paths?this.options.paths():this.options.paths;return e.forEach((s=>{if(!t.existsSync(s))throw new Error(`Path ${s} does not exist.`)})),this.runPluginHook(s,e)}))}async runPluginHook(t,s){const i=Object.entries(t.assets).filter((([t])=>function(t,s){const e=n.default.extname((o=t).includes("?")?o.split("?").slice(0,-1).join(""):o);var o;return s.includes(e)}(t,[".css"])));for(const n of t.chunks){const a=i.filter((([t])=>this.options.only?this.options.only.some((s=>t.includes(s))):Array.isArray(n.files)?n.files.includes(t):n.files.has(t)));for(const[i,n]of a){const a=s.filter((t=>!c.some((s=>t.endsWith(s))))),l={...e.defaultOptions,...this.options,content:a,css:[{raw:n.source().toString()}]};"function"==typeof l.safelist&&(l.safelist=l.safelist()),"function"==typeof l.blocklist&&(l.blocklist=l.blocklist());const u=(await(new r.default).purge({content:l.content,css:l.css,defaultExtractor:l.defaultExtractor,extractors:l.extractors,fontFace:l.fontFace,keyframes:l.keyframes,output:l.output,rejected:l.rejected,variables:l.variables,safelist:l.safelist,blocklist:l.blocklist}))[0];u.rejected&&(this.purgedStats[i]=u.rejected),t.updateAsset(i,new o.ConcatSource(u.css))}}}};
1
+ "use strict";var t=require("fs"),e=require("path"),s=require("purgecss"),o=require("webpack-sources");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var n=r(t),c=i(e),a=i(s);const u=[".css",".scss",".styl",".sass",".less"];module.exports=class{constructor(t){this.purgedStats={},this.options=t}apply(t){t.hooks.compilation.tap("PurgeCSS",this.initializePlugin.bind(this))}initializePlugin(t){t.hooks.additionalAssets.tapPromise("PurgeCSS",(()=>{const e="function"==typeof this.options.paths?this.options.paths():this.options.paths;return e.forEach((t=>{if(!n.existsSync(t))throw new Error(`Path ${t} does not exist.`)})),this.runPluginHook(t,e)}))}async runPluginHook(t,e){const i=Object.entries(t.assets).filter((([t])=>function(t,e){const s=c.default.extname((o=t).includes("?")?o.split("?").slice(0,-1).join(""):o);var o;return e.includes(s)}(t,[".css"])));for(const r of t.chunks){const n=i.filter((([t])=>this.options.only?this.options.only.some((e=>t.includes(e))):Array.isArray(r.files)?r.files.includes(t):r.files.has(t)));for(const[i,r]of n){const n=e.filter((t=>!u.some((e=>t.endsWith(e))))),c={...s.defaultOptions,...this.options,content:n,css:[{raw:r.source().toString()}]};"function"==typeof c.safelist&&(c.safelist=c.safelist()),"function"==typeof c.blocklist&&(c.blocklist=c.blocklist());const l=(await(new a.default).purge({content:c.content,css:c.css,defaultExtractor:c.defaultExtractor,extractors:c.extractors,fontFace:c.fontFace,keyframes:c.keyframes,output:c.output,rejected:c.rejected,variables:c.variables,safelist:c.safelist,blocklist:c.blocklist}))[0];l.rejected&&(this.purgedStats[i]=l.rejected),t.updateAsset(i,new o.ConcatSource(l.css))}}}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purgecss-webpack-plugin",
3
- "version": "4.0.3",
3
+ "version": "4.1.0",
4
4
  "description": "PurgeCSS plugin for webpack - Remove unused css",
5
5
  "author": "Ffloriel",
6
6
  "homepage": "https://purgecss.com",
@@ -36,20 +36,23 @@
36
36
  "test": "echo \"Error: run tests from root\" && exit 1"
37
37
  },
38
38
  "dependencies": {
39
- "purgecss": "^4.0.3",
39
+ "purgecss": "^4.1.0",
40
40
  "webpack": "^5.4.0",
41
- "webpack-sources": "^2.0.0"
41
+ "webpack-sources": "^3.2.0"
42
42
  },
43
43
  "bugs": {
44
44
  "url": "https://github.com/FullHuman/purgecss/issues"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/webpack-sources": "^2.0.0",
48
- "css-loader": "^5.0.0",
49
- "mini-css-extract-plugin": "^1.2.0"
47
+ "@types/webpack-sources": "^3.2.0",
48
+ "css-loader": "^6.2.0",
49
+ "mini-css-extract-plugin": "^2.1.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "webpack": "*"
53
53
  },
54
- "gitHead": "ff1c5582383288e5300ecfb798a89e262d65c071"
54
+ "publishConfig": {
55
+ "access": "public",
56
+ "registry": "https://registry.npmjs.org/"
57
+ }
55
58
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Full Human
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.