purgecss-webpack-plugin 4.0.3 → 4.1.3

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,47 +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
17
  type BlocklistFunction = () => StringRegExpArray;
18
18
  interface UserDefinedOptions$0 {
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
- 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[];
35
36
  }
36
37
  type PurgedStats = {
37
- [index: string]: string[];
38
+ [index: string]: string[];
38
39
  };
39
40
  declare class PurgeCSSPlugin {
40
- options: UserDefinedOptions$0;
41
- purgedStats: PurgedStats;
42
- constructor(options: UserDefinedOptions$0);
43
- apply(compiler: Compiler): void;
44
- initializePlugin(compilation: Compilation): void;
45
- 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>;
46
47
  }
47
48
  export { PurgeCSSPlugin as default };
@@ -1,47 +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
17
  type BlocklistFunction = () => StringRegExpArray;
18
18
  interface UserDefinedOptions$0 {
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
- 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[];
35
36
  }
36
37
  type PurgedStats = {
37
- [index: string]: string[];
38
+ [index: string]: string[];
38
39
  };
39
40
  declare class PurgeCSSPlugin {
40
- options: UserDefinedOptions$0;
41
- purgedStats: PurgedStats;
42
- constructor(options: UserDefinedOptions$0);
43
- apply(compiler: Compiler): void;
44
- initializePlugin(compilation: Compilation): void;
45
- 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>;
46
47
  }
47
48
  export { PurgeCSSPlugin as default };
@@ -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.3",
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.3",
39
+ "purgecss": "^4.1.3",
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
+ },
58
+ "gitHead": "37e5053a446880d12fd2f55abfc362c3dac9c49c"
55
59
  }