purgecss-webpack-plugin 4.1.3 → 6.0.0-alpha.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
@@ -6,6 +6,7 @@
6
6
  [Webpack](https://github.com/webpack/webpack) plugin to remove unused css.
7
7
 
8
8
  ## Install
9
+
9
10
  ```sh
10
11
  npm i purgecss-webpack-plugin -D
11
12
  ```
@@ -15,56 +16,56 @@ npm i purgecss-webpack-plugin -D
15
16
  ### With mini-css-extract-plugin
16
17
 
17
18
  ```js
18
- const path = require('path')
19
- const glob = require('glob')
20
- const MiniCssExtractPlugin = require('mini-css-extract-plugin')
21
- const PurgeCSSPlugin = require('purgecss-webpack-plugin')
19
+ const path = require("path");
20
+ const glob = require("glob");
21
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
22
+ const { PurgeCSSPlugin } = require("purgecss-webpack-plugin");
22
23
 
23
24
  const PATHS = {
24
- src: path.join(__dirname, 'src')
25
- }
25
+ src: path.join(__dirname, "src"),
26
+ };
26
27
 
27
28
  module.exports = {
28
- entry: './src/index.js',
29
+ entry: "./src/index.js",
29
30
  output: {
30
- filename: 'bundle.js',
31
- path: path.join(__dirname, 'dist')
31
+ filename: "bundle.js",
32
+ path: path.join(__dirname, "dist"),
32
33
  },
33
34
  optimization: {
34
35
  splitChunks: {
35
36
  cacheGroups: {
36
37
  styles: {
37
- name: 'styles',
38
+ name: "styles",
38
39
  test: /\.css$/,
39
- chunks: 'all',
40
- enforce: true
41
- }
42
- }
43
- }
40
+ chunks: "all",
41
+ enforce: true,
42
+ },
43
+ },
44
+ },
44
45
  },
45
46
  module: {
46
47
  rules: [
47
48
  {
48
49
  test: /\.css$/,
49
- use: [
50
- MiniCssExtractPlugin.loader,
51
- "css-loader"
52
- ]
53
- }
54
- ]
50
+ use: [MiniCssExtractPlugin.loader, "css-loader"],
51
+ },
52
+ ],
55
53
  },
56
54
  plugins: [
57
55
  new MiniCssExtractPlugin({
58
56
  filename: "[name].css",
59
57
  }),
60
58
  new PurgeCSSPlugin({
61
- paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),
59
+ paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),
62
60
  }),
63
- ]
64
- }
61
+ ],
62
+ };
65
63
  ```
64
+
66
65
  ### Multiple paths
66
+
67
67
  If you need multiple paths use the npm package `glob-all` instead of `glob`, then you can use this syntax:
68
+
68
69
  ```javascript
69
70
  new PurgeCSSPlugin({
70
71
  paths: glob.sync([
@@ -72,67 +73,69 @@ new PurgeCSSPlugin({
72
73
  ])
73
74
  }),
74
75
  ```
76
+
75
77
  to filter out directories see the glob-all documentation [here](https://www.npmjs.com/package/glob-all#filtering-out-directories).
76
78
 
77
79
  ### Options
78
80
 
79
81
  The options available in purgecss [Configuration](https://www.purgecss.com/configuration.html) are also available in the webpack plugin with the exception of css and content.
80
82
 
81
- * #### paths
83
+ - #### paths
82
84
 
83
85
  With the webpack plugin, you can specify the content that should be analyzed by purgecss with an array of filename. It can be html, pug, blade, ... files. You can use a module like `glob` or `glob-all` to easily get a list of files.
84
86
 
85
87
  ```js
86
- const PurgeCSSPlugin = require('purgecss-webpack-plugin')
87
- const glob = require('glob')
88
+ const { PurgeCSSPlugin } = require("purgecss-webpack-plugin");
89
+ const glob = require("glob");
88
90
  const PATHS = {
89
- src: path.join(__dirname, 'src')
90
- }
91
+ src: path.join(__dirname, "src"),
92
+ };
91
93
 
92
94
  // In the webpack configuration
93
95
  new PurgeCSSPlugin({
94
- paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true })
95
- })
96
+ paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),
97
+ });
96
98
  ```
97
99
 
98
100
  If you want to regenerate the paths list on every compilation (e.g. with `--watch`), then you can also pass a function:
101
+
99
102
  ```js
100
103
  new PurgeCSSPlugin({
101
- paths: () => glob.sync(`${PATHS.src}/**/*`, { nodir: true })
102
- })
104
+ paths: () => glob.sync(`${PATHS.src}/**/*`, { nodir: true }),
105
+ });
103
106
  ```
104
107
 
105
- * #### only
108
+ - #### only
106
109
 
107
110
  You can specify entrypoints to the purgecss-webpack-plugin with the option only:
108
111
 
109
112
  ```js
110
113
  new PurgeCSSPlugin({
111
114
  paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),
112
- only: ['bundle', 'vendor']
113
- })
115
+ only: ["bundle", "vendor"],
116
+ });
114
117
  ```
115
118
 
116
- * #### safelist
119
+ - #### safelist
117
120
 
118
121
  Similar as for the `paths` option, you also can define a function for this option:
119
122
 
120
123
  ```js
121
124
  function collectSafelist() {
122
125
  return {
123
- standard: ['safelisted', /^safelisted-/],
126
+ standard: ["safelisted", /^safelisted-/],
124
127
  deep: [/^safelisted-deep-/],
125
- greedy: [/^safelisted-greedy/]
126
- }
128
+ greedy: [/^safelisted-greedy/],
129
+ };
127
130
  }
128
131
 
129
132
  // In the webpack configuration
130
133
  new PurgeCSSPlugin({
131
- safelist: collectSafelist
132
- })
134
+ safelist: collectSafelist,
135
+ });
133
136
  ```
134
137
 
135
- * #### rejected
138
+ - #### rejected
136
139
 
137
140
  If `true` all removed selectors are added to the [Stats Data](https://webpack.js.org/api/stats/) as `purged`.
138
141
 
@@ -1,48 +1,182 @@
1
- import { Compilation, Compiler } from "webpack";
2
- type StringRegExpArray = Array<RegExp | string>;
3
- type ComplexSafelist = {
4
- standard?: StringRegExpArray;
5
- deep?: RegExp[];
6
- greedy?: RegExp[];
7
- variables?: StringRegExpArray;
8
- keyframes?: StringRegExpArray;
9
- };
10
- type ExtractorFunction$0<T = string> = (content: T) => string[];
11
- interface Extractors$0 {
12
- extensions: string[];
13
- extractor: ExtractorFunction$0;
14
- }
15
- type PathFunction = () => string[];
16
- type SafelistFunction = () => ComplexSafelist;
17
- type BlocklistFunction = () => StringRegExpArray;
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
- dynamicAttributes?: string[];
35
- only?: string[];
36
- }
37
- type PurgedStats = {
38
- [index: string]: string[];
39
- };
40
- declare class PurgeCSSPlugin {
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>;
47
- }
48
- export { PurgeCSSPlugin as default };
1
+ import { Compilation } from 'webpack';
2
+ import { Compiler } from 'webpack';
3
+ import * as postcss from 'postcss';
4
+
5
+ /**
6
+ * @public
7
+ */
8
+ export declare type BlocklistFunction = () => StringRegExpArray;
9
+
10
+ /**
11
+ * @public
12
+ */
13
+ export declare type ComplexSafelist = {
14
+ standard?: StringRegExpArray;
15
+ /**
16
+ * You can safelist selectors and their children based on a regular
17
+ * expression with `safelist.deep`
18
+ *
19
+ * @example
20
+ *
21
+ * ```ts
22
+ * const purgecss = await new PurgeCSS().purge({
23
+ * content: [],
24
+ * css: [],
25
+ * safelist: {
26
+ * deep: [/red$/]
27
+ * }
28
+ * })
29
+ * ```
30
+ *
31
+ * In this example, selectors such as `.bg-red .child-of-bg` will be left
32
+ * in the final CSS, even if `child-of-bg` is not found.
33
+ *
34
+ */
35
+ deep?: RegExp[];
36
+ greedy?: RegExp[];
37
+ variables?: StringRegExpArray;
38
+ keyframes?: StringRegExpArray;
39
+ };
40
+
41
+ /**
42
+ * @public
43
+ */
44
+ export declare type ExtractorFunction<T = string> = (content: T) => ExtractorResult;
45
+
46
+ /**
47
+ * @public
48
+ */
49
+ export declare type ExtractorResult = ExtractorResultDetailed | string[];
50
+
51
+ /**
52
+ * @public
53
+ */
54
+ export declare interface ExtractorResultDetailed {
55
+ attributes: {
56
+ names: string[];
57
+ values: string[];
58
+ };
59
+ classes: string[];
60
+ ids: string[];
61
+ tags: string[];
62
+ undetermined: string[];
63
+ }
64
+
65
+ /**
66
+ * @public
67
+ */
68
+ export declare interface Extractors {
69
+ extensions: string[];
70
+ extractor: ExtractorFunction;
71
+ }
72
+
73
+ /**
74
+ * @public
75
+ */
76
+ export declare type PathFunction = () => string[];
77
+
78
+ /**
79
+ * @public
80
+ */
81
+ export declare class PurgeCSSPlugin {
82
+ options: UserDefinedOptions;
83
+ purgedStats: PurgedStats;
84
+ constructor(options: UserDefinedOptions);
85
+ apply(compiler: Compiler): void;
86
+ initializePlugin(compilation: Compilation): void;
87
+ runPluginHook(compilation: Compilation, entryPaths: string[]): Promise<void>;
88
+ }
89
+
90
+ /**
91
+ * Options used by PurgeCSS to remove unused CSS
92
+ *
93
+ * @public
94
+ */
95
+ export declare interface PurgeCSSUserDefinedOptions {
96
+ /** {@inheritDoc purgecss#Options.content} */
97
+ content: Array<string | RawContent>;
98
+ /** {@inheritDoc purgecss#Options.css} */
99
+ css: Array<string | RawCSS>;
100
+ /** {@inheritDoc purgecss#Options.defaultExtractor} */
101
+ defaultExtractor?: ExtractorFunction;
102
+ /** {@inheritDoc purgecss#Options.extractors} */
103
+ extractors?: Array<Extractors>;
104
+ /** {@inheritDoc purgecss#Options.fontFace} */
105
+ fontFace?: boolean;
106
+ /** {@inheritDoc purgecss#Options.keyframes} */
107
+ keyframes?: boolean;
108
+ /** {@inheritDoc purgecss#Options.output} */
109
+ output?: string;
110
+ /** {@inheritDoc purgecss#Options.rejected} */
111
+ rejected?: boolean;
112
+ /** {@inheritDoc purgecss#Options.rejectedCss} */
113
+ rejectedCss?: boolean;
114
+ /** {@inheritDoc purgecss#Options.sourceMap } */
115
+ sourceMap?: boolean | (postcss.SourceMapOptions & { to?: string });
116
+ /** {@inheritDoc purgecss#Options.stdin} */
117
+ stdin?: boolean;
118
+ /** {@inheritDoc purgecss#Options.stdout} */
119
+ stdout?: boolean;
120
+ /** {@inheritDoc purgecss#Options.variables} */
121
+ variables?: boolean;
122
+ /** {@inheritDoc purgecss#Options.safelist} */
123
+ safelist?: UserDefinedSafelist;
124
+ /** {@inheritDoc purgecss#Options.blocklist} */
125
+ blocklist?: StringRegExpArray;
126
+ /** {@inheritDoc purgecss#Options.skippedContentGlobs} */
127
+ skippedContentGlobs?: Array<string>;
128
+ /** {@inheritDoc purgecss#Options.dynamicAttributes} */
129
+ dynamicAttributes?: string[];
130
+ }
131
+
132
+ /**
133
+ * @public
134
+ */
135
+ export declare type PurgedStats = {
136
+ [index: string]: string[];
137
+ };
138
+
139
+ /**
140
+ * @public
141
+ */
142
+ export declare interface RawContent<T = string> {
143
+ extension: string;
144
+ raw: T;
145
+ }
146
+
147
+ /**
148
+ * @public
149
+ */
150
+ export declare interface RawCSS {
151
+ raw: string;
152
+ name?: string;
153
+ }
154
+
155
+ /**
156
+ * @public
157
+ */
158
+ export declare type SafelistFunction = () => ComplexSafelist;
159
+
160
+ /**
161
+ * @public
162
+ */
163
+ export declare type StringRegExpArray = Array<RegExp | string>;
164
+
165
+ /**
166
+ * @public
167
+ */
168
+ export declare type UserDefinedOptions = Omit<PurgeCSSUserDefinedOptions, "css" | "content" | "safelist" | "blocklist" | "sourceMap"> & {
169
+ paths: string[] | PathFunction;
170
+ moduleExtensions?: string[];
171
+ verbose?: boolean;
172
+ safelist: PurgeCSSUserDefinedOptions["safelist"] | SafelistFunction;
173
+ blocklist: PurgeCSSUserDefinedOptions["blocklist"] | BlocklistFunction;
174
+ only?: string[];
175
+ };
176
+
177
+ /**
178
+ * @public
179
+ */
180
+ export declare type UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
181
+
182
+ export { }
@@ -1 +1 @@
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
+ import*as t from"fs";import*as s from"path";import{PurgeCSS as o,defaultOptions as e}from"purgecss";import{sources as i}from"webpack";const n=[".css",".scss",".styl",".sass",".less"];function r(t,s,o,i,n){const r={...e,...t,content:s,css:[{raw:o.source().toString()}]};return"function"==typeof r.safelist&&(r.safelist=r.safelist()),"function"==typeof r.blocklist&&(r.blocklist=r.blocklist()),{content:r.content,css:r.css,defaultExtractor:r.defaultExtractor,extractors:r.extractors,fontFace:r.fontFace,keyframes:r.keyframes,output:r.output,rejected:r.rejected,variables:r.variables,safelist:r.safelist,blocklist:r.blocklist,sourceMap:!!n&&{inline:!1,to:i}}}function c(t,s,o,e){if(!e||!o.sourceMap)return new i.RawSource(o.css);const{source:n,map:r}=s.sourceAndMap();return new i.SourceMapSource(o.css,t,o.sourceMap,n.toString(),r,!1)}class PurgeCSSPlugin{constructor(t){this.purgedStats={},this.options=t}apply(t){t.hooks.compilation.tap("PurgeCSS",this.initializePlugin.bind(this))}initializePlugin(o){o.hooks.additionalAssets.tapPromise("PurgeCSS",(async()=>{let e;try{const t=s.resolve(process.cwd(),"purgecss.config.js");e=await import(t)}catch{}this.options={...e||{},...this.options};const i="function"==typeof this.options.paths?this.options.paths():this.options.paths;return i.forEach((s=>{if(!t.existsSync(s))throw new Error(`Path ${s} does not exist.`)})),this.runPluginHook(o,i)}))}async runPluginHook(t,e){const i=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=i.filter((([t])=>!(this.options.only&&!this.options.only.some((s=>t.includes(s))))&&s.files.has(t)));for(const[s,i]of a){const a=e.filter((t=>!n.some((s=>t.endsWith(s))))),l=!!t.compiler.options.devtool,u=r(this.options,a,i,s,l),p=(await(new o).purge(u))[0];p.rejected&&(this.purgedStats[s]=p.rejected),t.updateAsset(s,c(s,i,p,l))}}}}export{PurgeCSSPlugin};
@@ -1 +1 @@
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))}}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("fs"),e=require("path"),s=require("purgecss"),o=require("webpack");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),i=r(e);const c=[".css",".scss",".styl",".sass",".less"];function u(t,e,o,r,n){const i={...s.defaultOptions,...t,content:e,css:[{raw:o.source().toString()}]};return"function"==typeof i.safelist&&(i.safelist=i.safelist()),"function"==typeof i.blocklist&&(i.blocklist=i.blocklist()),{content:i.content,css:i.css,defaultExtractor:i.defaultExtractor,extractors:i.extractors,fontFace:i.fontFace,keyframes:i.keyframes,output:i.output,rejected:i.rejected,variables:i.variables,safelist:i.safelist,blocklist:i.blocklist,sourceMap:!!n&&{inline:!1,to:r}}}function a(t,e,s,r){if(!r||!s.sourceMap)return new o.sources.RawSource(s.css);const{source:n,map:i}=e.sourceAndMap();return new o.sources.SourceMapSource(s.css,t,s.sourceMap,n.toString(),i,!1)}exports.PurgeCSSPlugin=class PurgeCSSPlugin{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",(async()=>{let e;try{const t=i.resolve(process.cwd(),"purgecss.config.js");e=await function(t){return Promise.resolve().then((function(){return r(require(t))}))}(t)}catch{}this.options={...e||{},...this.options};const s="function"==typeof this.options.paths?this.options.paths():this.options.paths;return s.forEach((t=>{if(!n.existsSync(t))throw new Error(`Path ${t} does not exist.`)})),this.runPluginHook(t,s)}))}async runPluginHook(t,e){const o=Object.entries(t.assets).filter((([t])=>function(t,e){const s=i.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=o.filter((([t])=>!(this.options.only&&!this.options.only.some((e=>t.includes(e))))&&r.files.has(t)));for(const[o,r]of n){const n=e.filter((t=>!c.some((e=>t.endsWith(e))))),i=!!t.compiler.options.devtool,l=u(this.options,n,r,o,i),f=(await(new s.PurgeCSS).purge(l))[0];f.rejected&&(this.purgedStats[o]=f.rejected),t.updateAsset(o,a(o,r,f,i))}}}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purgecss-webpack-plugin",
3
- "version": "4.1.3",
3
+ "version": "6.0.0-alpha.0",
4
4
  "description": "PurgeCSS plugin for webpack - Remove unused css",
5
5
  "author": "Ffloriel",
6
6
  "homepage": "https://purgecss.com",
@@ -33,27 +33,27 @@
33
33
  "url": "git+https://github.com/FullHuman/purgecss.git"
34
34
  },
35
35
  "scripts": {
36
- "test": "echo \"Error: run tests from root\" && exit 1"
36
+ "build": "ts-node build.ts",
37
+ "test": "jest"
37
38
  },
38
39
  "dependencies": {
39
- "purgecss": "^4.1.3",
40
- "webpack": "^5.4.0",
41
- "webpack-sources": "^3.2.0"
40
+ "purgecss": "^6.0.0-alpha.0",
41
+ "webpack": ">=5.0.0"
42
42
  },
43
43
  "bugs": {
44
44
  "url": "https://github.com/FullHuman/purgecss/issues"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/webpack-sources": "^3.2.0",
48
- "css-loader": "^6.2.0",
49
- "mini-css-extract-plugin": "^2.1.0"
48
+ "css-loader": "^6.6.0",
49
+ "mini-css-extract-plugin": "^2.5.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "webpack": "*"
52
+ "webpack": ">=5.0.0"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public",
56
56
  "registry": "https://registry.npmjs.org/"
57
57
  },
58
- "gitHead": "37e5053a446880d12fd2f55abfc362c3dac9c49c"
58
+ "gitHead": "152ccba46e781902f302b7adca1788a6909e9569"
59
59
  }
@@ -1,48 +0,0 @@
1
- import { Compilation, Compiler } from "webpack";
2
- type StringRegExpArray = Array<RegExp | string>;
3
- type ComplexSafelist = {
4
- standard?: StringRegExpArray;
5
- deep?: RegExp[];
6
- greedy?: RegExp[];
7
- variables?: StringRegExpArray;
8
- keyframes?: StringRegExpArray;
9
- };
10
- type ExtractorFunction$0<T = string> = (content: T) => string[];
11
- interface Extractors$0 {
12
- extensions: string[];
13
- extractor: ExtractorFunction$0;
14
- }
15
- type PathFunction = () => string[];
16
- type SafelistFunction = () => ComplexSafelist;
17
- type BlocklistFunction = () => StringRegExpArray;
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
- dynamicAttributes?: string[];
35
- only?: string[];
36
- }
37
- type PurgedStats = {
38
- [index: string]: string[];
39
- };
40
- declare class PurgeCSSPlugin {
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>;
47
- }
48
- export { PurgeCSSPlugin as default };