@fullhuman/postcss-purgecss 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
@@ -94,6 +94,15 @@ blocklist: ['usedClass', /^nav-/]
94
94
  ```
95
95
  Even if nav-links and usedClass are found by an extractor, they will be removed.
96
96
 
97
+ ### `skippedContentGlobs`
98
+
99
+ If you provide globs for the `content` parameter, you can use this option to exclude certain files or folders that would otherwise be scanned. Pass an array of globs matching items that should be excluded. (Note: this option has no effect if `content` is not globs.)
100
+
101
+ ```ts
102
+ skippedContentGlobs: ['node_modules/**', 'components/**']
103
+ ```
104
+ Here, PurgeCSS will not scan anything in the "node_modules" and "components" folders.
105
+
97
106
 
98
107
  ### `rejected`
99
108
  Type: `boolean`
@@ -1,36 +1,38 @@
1
1
  import * as postcss from "postcss";
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 UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
11
11
  interface RawContent$0<T = string> {
12
- extension: string;
13
- raw: T;
12
+ extension: string;
13
+ raw: T;
14
14
  }
15
15
  type ExtractorFunction$0<T = string> = (content: T) => string[];
16
16
  interface Extractors$0 {
17
- extensions: string[];
18
- extractor: ExtractorFunction$0;
17
+ extensions: string[];
18
+ extractor: ExtractorFunction$0;
19
19
  }
20
20
  interface UserDefinedOptions$0 {
21
- content?: Array<string | RawContent$0>;
22
- contentFunction?: (sourceFile: string) => Array<string | RawContent$0>;
23
- defaultExtractor?: ExtractorFunction$0;
24
- extractors?: Array<Extractors$0>;
25
- fontFace?: boolean;
26
- keyframes?: boolean;
27
- output?: string;
28
- rejected?: boolean;
29
- stdin?: boolean;
30
- stdout?: boolean;
31
- variables?: boolean;
32
- safelist?: UserDefinedSafelist;
33
- blocklist?: StringRegExpArray;
21
+ content?: Array<string | RawContent$0>;
22
+ contentFunction?: (sourceFile: string) => Array<string | RawContent$0>;
23
+ defaultExtractor?: ExtractorFunction$0;
24
+ extractors?: Array<Extractors$0>;
25
+ fontFace?: boolean;
26
+ keyframes?: boolean;
27
+ output?: string;
28
+ rejected?: boolean;
29
+ stdin?: boolean;
30
+ stdout?: boolean;
31
+ variables?: boolean;
32
+ safelist?: UserDefinedSafelist;
33
+ blocklist?: StringRegExpArray;
34
+ skippedContentGlobs?: Array<string>;
35
+ dynamicAttributes?: string[];
34
36
  }
35
37
  declare const purgeCSSPlugin: postcss.PluginCreator<UserDefinedOptions$0>;
36
38
  export { purgeCSSPlugin as default };
@@ -1,36 +1,38 @@
1
1
  import * as postcss from "postcss";
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 UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
11
11
  interface RawContent$0<T = string> {
12
- extension: string;
13
- raw: T;
12
+ extension: string;
13
+ raw: T;
14
14
  }
15
15
  type ExtractorFunction$0<T = string> = (content: T) => string[];
16
16
  interface Extractors$0 {
17
- extensions: string[];
18
- extractor: ExtractorFunction$0;
17
+ extensions: string[];
18
+ extractor: ExtractorFunction$0;
19
19
  }
20
20
  interface UserDefinedOptions$0 {
21
- content?: Array<string | RawContent$0>;
22
- contentFunction?: (sourceFile: string) => Array<string | RawContent$0>;
23
- defaultExtractor?: ExtractorFunction$0;
24
- extractors?: Array<Extractors$0>;
25
- fontFace?: boolean;
26
- keyframes?: boolean;
27
- output?: string;
28
- rejected?: boolean;
29
- stdin?: boolean;
30
- stdout?: boolean;
31
- variables?: boolean;
32
- safelist?: UserDefinedSafelist;
33
- blocklist?: StringRegExpArray;
21
+ content?: Array<string | RawContent$0>;
22
+ contentFunction?: (sourceFile: string) => Array<string | RawContent$0>;
23
+ defaultExtractor?: ExtractorFunction$0;
24
+ extractors?: Array<Extractors$0>;
25
+ fontFace?: boolean;
26
+ keyframes?: boolean;
27
+ output?: string;
28
+ rejected?: boolean;
29
+ stdin?: boolean;
30
+ stdout?: boolean;
31
+ variables?: boolean;
32
+ safelist?: UserDefinedSafelist;
33
+ blocklist?: StringRegExpArray;
34
+ skippedContentGlobs?: Array<string>;
35
+ dynamicAttributes?: string[];
34
36
  }
35
37
  declare const purgeCSSPlugin: postcss.PluginCreator<UserDefinedOptions$0>;
36
38
  export { purgeCSSPlugin as default };
@@ -1 +1 @@
1
- import e,{defaultOptions as t,standardizeSafelist as s,mergeExtractorSelectors as o}from"purgecss";const r=function(r){if(void 0===r)throw new Error("PurgeCSS plugin does not have the correct options");return{postcssPlugin:"postcss-purgecss",Once:(n,c)=>async function(r,n,{result:c}){const i=new e,p={...t,...r,safelist:s(null==r?void 0:r.safelist)};r&&"function"==typeof r.contentFunction&&(p.content=r.contentFunction(n.source&&n.source.input.file||"")),i.options=p;const{content:u,extractors:a}=p,l=u.filter((e=>"string"==typeof e)),f=u.filter((e=>"object"==typeof e)),m=await i.extractSelectorsFromFiles(l,a),g=await i.extractSelectorsFromString(f,a),d=o(m,g);i.walkThroughCSS(n,d),i.options.fontFace&&i.removeUnusedFontFaces(),i.options.keyframes&&i.removeUnusedKeyframes(),i.options.variables&&i.removeUnusedCSSVariables(),i.options.rejected&&i.selectorsRemoved.size>0&&(c.messages.push({type:"purgecss",plugin:"postcss-purgecss",text:`purging ${i.selectorsRemoved.size} selectors:\n ${Array.from(i.selectorsRemoved).map((e=>e.trim())).join("\n ")}`}),i.selectorsRemoved.clear())}(r,n,c)}};r.postcss=!0;export default r;
1
+ import e,{defaultOptions as t,standardizeSafelist as s,mergeExtractorSelectors as o}from"purgecss";const r=function(r){if(void 0===r)throw new Error("PurgeCSS plugin does not have the correct options");return{postcssPlugin:"postcss-purgecss",OnceExit:(n,c)=>async function(r,n,{result:c}){const i=new e,a={...t,...r,safelist:s(null==r?void 0:r.safelist)};r&&"function"==typeof r.contentFunction&&(a.content=r.contentFunction(n.source&&n.source.input.file||"")),i.options=a;const{content:p,extractors:u}=a,l=p.filter((e=>"string"==typeof e)),f=p.filter((e=>"object"==typeof e)),m=await i.extractSelectorsFromFiles(l,u),g=await i.extractSelectorsFromString(f,u),d=o(m,g);i.walkThroughCSS(n,d),i.options.fontFace&&i.removeUnusedFontFaces(),i.options.keyframes&&i.removeUnusedKeyframes(),i.options.variables&&i.removeUnusedCSSVariables(),i.options.rejected&&i.selectorsRemoved.size>0&&(c.messages.push({type:"purgecss",plugin:"postcss-purgecss",text:`purging ${i.selectorsRemoved.size} selectors:\n ${Array.from(i.selectorsRemoved).map((e=>e.trim())).join("\n ")}`}),i.selectorsRemoved.clear())}(r,n,c)}};r.postcss=!0;export{r as default};
@@ -1 +1 @@
1
- "use strict";var e=require("purgecss");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=t(e);const o=function(t){if(void 0===t)throw new Error("PurgeCSS plugin does not have the correct options");return{postcssPlugin:"postcss-purgecss",Once:(o,r)=>async function(t,o,{result:r}){const n=new s.default,c={...e.defaultOptions,...t,safelist:e.standardizeSafelist(null==t?void 0:t.safelist)};t&&"function"==typeof t.contentFunction&&(c.content=t.contentFunction(o.source&&o.source.input.file||"")),n.options=c;const{content:i,extractors:a}=c,u=i.filter((e=>"string"==typeof e)),l=i.filter((e=>"object"==typeof e)),p=await n.extractSelectorsFromFiles(u,a),f=await n.extractSelectorsFromString(l,a),d=e.mergeExtractorSelectors(p,f);n.walkThroughCSS(o,d),n.options.fontFace&&n.removeUnusedFontFaces(),n.options.keyframes&&n.removeUnusedKeyframes(),n.options.variables&&n.removeUnusedCSSVariables(),n.options.rejected&&n.selectorsRemoved.size>0&&(r.messages.push({type:"purgecss",plugin:"postcss-purgecss",text:`purging ${n.selectorsRemoved.size} selectors:\n ${Array.from(n.selectorsRemoved).map((e=>e.trim())).join("\n ")}`}),n.selectorsRemoved.clear())}(t,o,r)}};o.postcss=!0,module.exports=o;
1
+ "use strict";var e=require("purgecss");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=t(e);const o=function(t){if(void 0===t)throw new Error("PurgeCSS plugin does not have the correct options");return{postcssPlugin:"postcss-purgecss",OnceExit:(o,r)=>async function(t,o,{result:r}){const n=new s.default,c={...e.defaultOptions,...t,safelist:e.standardizeSafelist(null==t?void 0:t.safelist)};t&&"function"==typeof t.contentFunction&&(c.content=t.contentFunction(o.source&&o.source.input.file||"")),n.options=c;const{content:i,extractors:a}=c,u=i.filter((e=>"string"==typeof e)),l=i.filter((e=>"object"==typeof e)),p=await n.extractSelectorsFromFiles(u,a),f=await n.extractSelectorsFromString(l,a),d=e.mergeExtractorSelectors(p,f);n.walkThroughCSS(o,d),n.options.fontFace&&n.removeUnusedFontFaces(),n.options.keyframes&&n.removeUnusedKeyframes(),n.options.variables&&n.removeUnusedCSSVariables(),n.options.rejected&&n.selectorsRemoved.size>0&&(r.messages.push({type:"purgecss",plugin:"postcss-purgecss",text:`purging ${n.selectorsRemoved.size} selectors:\n ${Array.from(n.selectorsRemoved).map((e=>e.trim())).join("\n ")}`}),n.selectorsRemoved.clear())}(t,o,r)}};o.postcss=!0,module.exports=o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullhuman/postcss-purgecss",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "description": "PostCSS plugin for PurgeCSS",
5
5
  "author": "FoundrySH <no-reply@foundry.sh>",
6
6
  "homepage": "https://purgecss.com",
@@ -26,13 +26,17 @@
26
26
  "url": "https://github.com/FullHuman/purgecss/issues"
27
27
  },
28
28
  "dependencies": {
29
- "purgecss": "^4.0.1"
29
+ "purgecss": "^4.1.1"
30
30
  },
31
31
  "devDependencies": {
32
- "postcss": "^8.2.1"
32
+ "postcss": "^8.3.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "postcss": "^8.0.0"
36
36
  },
37
- "gitHead": "61a9f5345fe4c5aa9ea3fd7a8706d9492260274c"
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "gitHead": "e87bc559054526ab99db05de8a455bdfc0858101"
38
42
  }