purgecss-webpack-plugin 4.0.1 → 4.1.1

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,45 +1,48 @@
1
- import { Compiler, Compilation } from "webpack";
1
+ import { Compilation, Compiler } from "webpack";
2
2
  type StringRegExpArray = Array<RegExp | string>;
3
3
  type ComplexSafelist = {
4
- standard?: StringRegExpArray;
5
- deep?: RegExp[];
6
- greedy?: RegExp[];
7
- variables?: StringRegExpArray;
8
- keyframes?: StringRegExpArray;
4
+ standard?: StringRegExpArray;
5
+ deep?: RegExp[];
6
+ greedy?: RegExp[];
7
+ variables?: StringRegExpArray;
8
+ keyframes?: StringRegExpArray;
9
9
  };
10
10
  type ExtractorFunction$0<T = string> = (content: T) => string[];
11
11
  interface Extractors$0 {
12
- extensions: string[];
13
- extractor: ExtractorFunction$0;
12
+ extensions: string[];
13
+ extractor: ExtractorFunction$0;
14
14
  }
15
15
  type PathFunction = () => string[];
16
16
  type SafelistFunction = () => ComplexSafelist;
17
+ type BlocklistFunction = () => StringRegExpArray;
17
18
  interface UserDefinedOptions$0 {
18
- paths: string[] | PathFunction;
19
- defaultExtractor?: ExtractorFunction$0;
20
- extractors?: Array<Extractors$0>;
21
- fontFace?: boolean;
22
- keyframes?: boolean;
23
- moduleExtensions?: string[];
24
- output?: string;
25
- rejected?: boolean;
26
- stdin?: boolean;
27
- stdout?: boolean;
28
- variables?: boolean;
29
- verbose?: boolean;
30
- safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
31
- blocklist?: StringRegExpArray;
32
- only?: string[];
19
+ paths: string[] | PathFunction;
20
+ defaultExtractor?: ExtractorFunction$0;
21
+ extractors?: Array<Extractors$0>;
22
+ fontFace?: boolean;
23
+ keyframes?: boolean;
24
+ moduleExtensions?: string[];
25
+ output?: string;
26
+ rejected?: boolean;
27
+ stdin?: boolean;
28
+ stdout?: boolean;
29
+ variables?: boolean;
30
+ verbose?: boolean;
31
+ safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
32
+ blocklist?: StringRegExpArray | BlocklistFunction;
33
+ skippedContentGlobs?: Array<string>;
34
+ dynamicAttributes?: string[];
35
+ only?: string[];
33
36
  }
34
37
  type PurgedStats = {
35
- [index: string]: string[];
38
+ [index: string]: string[];
36
39
  };
37
40
  declare class PurgeCSSPlugin {
38
- options: UserDefinedOptions$0;
39
- purgedStats: PurgedStats;
40
- constructor(options: UserDefinedOptions$0);
41
- apply(compiler: Compiler): void;
42
- initializePlugin(compilation: Compilation): void;
43
- runPluginHook(compilation: Compilation, entryPaths: string[]): Promise<void>;
41
+ options: UserDefinedOptions$0;
42
+ purgedStats: PurgedStats;
43
+ constructor(options: UserDefinedOptions$0);
44
+ apply(compiler: Compiler): void;
45
+ initializePlugin(compilation: Compilation): void;
46
+ runPluginHook(compilation: Compilation, entryPaths: string[]): Promise<void>;
44
47
  }
45
48
  export { PurgeCSSPlugin as default };
@@ -1,45 +1,48 @@
1
- import { Compiler, Compilation } from "webpack";
1
+ import { Compilation, Compiler } from "webpack";
2
2
  type StringRegExpArray = Array<RegExp | string>;
3
3
  type ComplexSafelist = {
4
- standard?: StringRegExpArray;
5
- deep?: RegExp[];
6
- greedy?: RegExp[];
7
- variables?: StringRegExpArray;
8
- keyframes?: StringRegExpArray;
4
+ standard?: StringRegExpArray;
5
+ deep?: RegExp[];
6
+ greedy?: RegExp[];
7
+ variables?: StringRegExpArray;
8
+ keyframes?: StringRegExpArray;
9
9
  };
10
10
  type ExtractorFunction$0<T = string> = (content: T) => string[];
11
11
  interface Extractors$0 {
12
- extensions: string[];
13
- extractor: ExtractorFunction$0;
12
+ extensions: string[];
13
+ extractor: ExtractorFunction$0;
14
14
  }
15
15
  type PathFunction = () => string[];
16
16
  type SafelistFunction = () => ComplexSafelist;
17
+ type BlocklistFunction = () => StringRegExpArray;
17
18
  interface UserDefinedOptions$0 {
18
- paths: string[] | PathFunction;
19
- defaultExtractor?: ExtractorFunction$0;
20
- extractors?: Array<Extractors$0>;
21
- fontFace?: boolean;
22
- keyframes?: boolean;
23
- moduleExtensions?: string[];
24
- output?: string;
25
- rejected?: boolean;
26
- stdin?: boolean;
27
- stdout?: boolean;
28
- variables?: boolean;
29
- verbose?: boolean;
30
- safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
31
- blocklist?: StringRegExpArray;
32
- only?: string[];
19
+ paths: string[] | PathFunction;
20
+ defaultExtractor?: ExtractorFunction$0;
21
+ extractors?: Array<Extractors$0>;
22
+ fontFace?: boolean;
23
+ keyframes?: boolean;
24
+ moduleExtensions?: string[];
25
+ output?: string;
26
+ rejected?: boolean;
27
+ stdin?: boolean;
28
+ stdout?: boolean;
29
+ variables?: boolean;
30
+ verbose?: boolean;
31
+ safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
32
+ blocklist?: StringRegExpArray | BlocklistFunction;
33
+ skippedContentGlobs?: Array<string>;
34
+ dynamicAttributes?: string[];
35
+ only?: string[];
33
36
  }
34
37
  type PurgedStats = {
35
- [index: string]: string[];
38
+ [index: string]: string[];
36
39
  };
37
40
  declare class PurgeCSSPlugin {
38
- options: UserDefinedOptions$0;
39
- purgedStats: PurgedStats;
40
- constructor(options: UserDefinedOptions$0);
41
- apply(compiler: Compiler): void;
42
- initializePlugin(compilation: Compilation): void;
43
- runPluginHook(compilation: Compilation, entryPaths: string[]): Promise<void>;
41
+ options: UserDefinedOptions$0;
42
+ purgedStats: PurgedStats;
43
+ constructor(options: UserDefinedOptions$0);
44
+ apply(compiler: Compiler): void;
45
+ initializePlugin(compilation: Compilation): void;
46
+ runPluginHook(compilation: Compilation, entryPaths: string[]): Promise<void>;
44
47
  }
45
48
  export { PurgeCSSPlugin as default };
@@ -1 +1 @@
1
- import{existsSync as s}from"fs";import t from"path";import e,{defaultOptions as o}from"purgecss";import{ConcatSource as i}from"webpack-sources";const n=[".css",".scss",".styl",".sass",".less"];export default class{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 e="function"==typeof this.options.paths?this.options.paths():this.options.paths;return e.forEach((t=>{if(!s(t))throw new Error(`Path ${t} does not exist.`)})),this.runPluginHook(t,e)}))}async runPluginHook(s,r){const a=Object.entries(s.assets).filter((([s])=>function(s,e){const o=t.extname((i=s).includes("?")?i.split("?").slice(0,-1).join(""):i);var i;return e.includes(o)}(s,[".css"])));for(const t of s.chunks){const c=a.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,a]of c){const c=r.filter((s=>!n.some((t=>s.endsWith(t))))),l={...o,...this.options,content:c,css:[{raw:a.source().toString()}]};"function"==typeof l.safelist&&(l.safelist=l.safelist());const f=(await(new e).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}))[0];f.rejected&&(this.purgedStats[t]=f.rejected),s.updateAsset(t,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 a=[".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 c=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 c){const c=s.filter((t=>!a.some((s=>t.endsWith(s))))),u={...e.defaultOptions,...this.options,content:c,css:[{raw:n.source().toString()}]};"function"==typeof u.safelist&&(u.safelist=u.safelist());const l=(await(new r.default).purge({content:u.content,css:u.css,defaultExtractor:u.defaultExtractor,extractors:u.extractors,fontFace:u.fontFace,keyframes:u.keyframes,output:u.output,rejected:u.rejected,variables:u.variables,safelist:u.safelist}))[0];l.rejected&&(this.purgedStats[i]=l.rejected),t.updateAsset(i,new o.ConcatSource(l.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.1",
3
+ "version": "4.1.1",
4
4
  "description": "PurgeCSS plugin for webpack - Remove unused css",
5
5
  "author": "Ffloriel",
6
6
  "homepage": "https://purgecss.com",
@@ -36,20 +36,24 @@
36
36
  "test": "echo \"Error: run tests from root\" && exit 1"
37
37
  },
38
38
  "dependencies": {
39
- "purgecss": "^4.0.1",
39
+ "purgecss": "^4.1.1",
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": "61a9f5345fe4c5aa9ea3fd7a8706d9492260274c"
54
+ "publishConfig": {
55
+ "access": "public",
56
+ "registry": "https://registry.npmjs.org/"
57
+ },
58
+ "gitHead": "e87bc559054526ab99db05de8a455bdfc0858101"
55
59
  }