Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-purgecss

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-purgecss - npm Package Compare versions

Comparing version 2.3.0 to 3.0.0

43

lib/gulp-purgecss.d.ts
import internal from "stream";
type ExtractorFunction<T = string> = (content: T) => string[];
interface RawContent<T = string> {
extension: string;
raw: T;
}
interface RawCSS {
raw: string;
}
interface ExtractorResultDetailed {
attributes: {
names: string[];
values: string[];
};
classes: string[];
ids: string[];
tags: string[];
undetermined: string[];
}
type ExtractorResult = ExtractorResultDetailed | string[];
type ExtractorFunction<T = string> = (content: T) => ExtractorResult;
interface Extractors {

@@ -7,4 +25,14 @@ extensions: string[];

}
type StringRegExpArray = Array<RegExp | string>;
type ComplexSafelist = {
standard?: StringRegExpArray;
deep?: RegExp[];
greedy?: RegExp[];
variables?: StringRegExpArray;
keyframes?: StringRegExpArray;
};
type UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
interface UserDefinedOptions {
content: Array<string>;
content: Array<string | RawContent>;
css: Array<string | RawCSS>;
defaultExtractor?: ExtractorFunction;

@@ -19,7 +47,10 @@ extractors?: Array<Extractors>;

variables?: boolean;
whitelist?: string[];
whitelistPatterns?: Array<RegExp>;
whitelistPatternsChildren?: Array<RegExp>;
safelist?: UserDefinedSafelist;
blocklist?: StringRegExpArray;
}
declare function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform;
type PurgeCSSUserDefinedOptions = UserDefinedOptions;
interface UserDefinedOptions$0 extends Omit<PurgeCSSUserDefinedOptions, "css" | "content"> {
content: string[];
}
declare function gulpPurgeCSS(options: UserDefinedOptions$0): internal.Transform;
export { gulpPurgeCSS as default };
import internal from "stream";
type ExtractorFunction<T = string> = (content: T) => string[];
interface RawContent<T = string> {
extension: string;
raw: T;
}
interface RawCSS {
raw: string;
}
interface ExtractorResultDetailed {
attributes: {
names: string[];
values: string[];
};
classes: string[];
ids: string[];
tags: string[];
undetermined: string[];
}
type ExtractorResult = ExtractorResultDetailed | string[];
type ExtractorFunction<T = string> = (content: T) => ExtractorResult;
interface Extractors {

@@ -7,4 +25,14 @@ extensions: string[];

}
type StringRegExpArray = Array<RegExp | string>;
type ComplexSafelist = {
standard?: StringRegExpArray;
deep?: RegExp[];
greedy?: RegExp[];
variables?: StringRegExpArray;
keyframes?: StringRegExpArray;
};
type UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
interface UserDefinedOptions {
content: Array<string>;
content: Array<string | RawContent>;
css: Array<string | RawCSS>;
defaultExtractor?: ExtractorFunction;

@@ -19,7 +47,10 @@ extractors?: Array<Extractors>;

variables?: boolean;
whitelist?: string[];
whitelistPatterns?: Array<RegExp>;
whitelistPatternsChildren?: Array<RegExp>;
safelist?: UserDefinedSafelist;
blocklist?: StringRegExpArray;
}
declare function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform;
type PurgeCSSUserDefinedOptions = UserDefinedOptions;
interface UserDefinedOptions$0 extends Omit<PurgeCSSUserDefinedOptions, "css" | "content"> {
content: string[];
}
declare function gulpPurgeCSS(options: UserDefinedOptions$0): internal.Transform;
export { gulpPurgeCSS as default };

2

lib/gulp-purgecss.esm.js

@@ -1,1 +0,1 @@

import e from"through2";import r from"plugin-error";import t from"glob";import n from"purgecss";export default function(o){return e.obj((async function(e,s,c){if(e.isNull())return c(null,e);if(e.isBuffer())try{const r={...o,content:(i=o.content,i.reduce((e,r)=>[...e,...t.sync(r)],[])),css:[{raw:e.contents.toString()}],stdin:!0},s=(await(new n).purge(r))[0],u=r.rejected&&s.rejected?s.rejected.join(" {}\n")+" {}":s.css;e.contents=Buffer.from(u,"utf-8"),c(null,e)}catch(e){this.emit("error",new r("gulp-purgecss",e.message))}var i;if(e.isStream()){const t=e;let s="";t.on("readable",e=>{s+=e.read().toString()}).on("end",async()=>{try{const r={...o,css:[s]},i=(await(new n).purge(r))[0],u=r.rejected&&i.rejected?i.rejected.join(" {}\n")+" {}":i.css;t.contents=Buffer.from(u,"utf-8"),c(null,e)}catch(e){this.emit("error",new r("gulp-purgecss",e.message))}})}}))}
import e from"through2";import r from"plugin-error";import t from"glob";import n from"purgecss";function o(o){return e.obj((async function(e,s,c){if(e.isNull())return c(null,e);if(e.isBuffer())try{const r={...o,content:(i=o.content,i.reduce((e,r)=>[...e,...t.sync(r)],[])),css:[{raw:e.contents.toString()}],stdin:!0},s=(await(new n).purge(r))[0],u=r.rejected&&s.rejected?s.rejected.join(" {}\n")+" {}":s.css;e.contents=Buffer.from(u,"utf-8"),c(null,e)}catch(e){this.emit("error",new r("gulp-purgecss",e.message))}var i;if(e.isStream()){const t=e;let s="";t.on("readable",e=>{s+=e.read().toString()}).on("end",async()=>{try{const r={...o,css:[s]},i=(await(new n).purge(r))[0],u=r.rejected&&i.rejected?i.rejected.join(" {}\n")+" {}":i.css;t.contents=Buffer.from(u,"utf-8"),c(null,e)}catch(e){this.emit("error",new r("gulp-purgecss",e.message))}})}}))}export default o;

@@ -1,1 +0,1 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=e(require("through2")),t=e(require("plugin-error")),n=e(require("glob")),s=e(require("purgecss"));module.exports=function(e){return r.obj((async function(r,c,u){if(r.isNull())return u(null,r);if(r.isBuffer())try{const t={...e,content:(o=e.content,o.reduce((e,r)=>[...e,...n.sync(r)],[])),css:[{raw:r.contents.toString()}],stdin:!0},c=(await(new s).purge(t))[0],i=t.rejected&&c.rejected?c.rejected.join(" {}\n")+" {}":c.css;r.contents=Buffer.from(i,"utf-8"),u(null,r)}catch(e){this.emit("error",new t("gulp-purgecss",e.message))}var o;if(r.isStream()){const n=r;let c="";n.on("readable",e=>{c+=e.read().toString()}).on("end",async()=>{try{const t={...e,css:[c]},o=(await(new s).purge(t))[0],i=t.rejected&&o.rejected?o.rejected.join(" {}\n")+" {}":o.css;n.contents=Buffer.from(i,"utf-8"),u(null,r)}catch(e){this.emit("error",new t("gulp-purgecss",e.message))}})}}))};
"use strict";var e=require("through2"),t=require("plugin-error"),r=require("glob"),n=require("purgecss");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(e),c=u(t),o=u(r),i=u(n);module.exports=function(e){return s.default.obj((async function(t,r,n){if(t.isNull())return n(null,t);if(t.isBuffer())try{const r={...e,content:(u=e.content,u.reduce((e,t)=>[...e,...o.default.sync(t)],[])),css:[{raw:t.contents.toString()}],stdin:!0},s=(await(new i.default).purge(r))[0],c=r.rejected&&s.rejected?s.rejected.join(" {}\n")+" {}":s.css;t.contents=Buffer.from(c,"utf-8"),n(null,t)}catch(e){this.emit("error",new c.default("gulp-purgecss",e.message))}var u;if(t.isStream()){const r=t;let u="";r.on("readable",e=>{u+=e.read().toString()}).on("end",async()=>{try{const s={...e,css:[u]},c=(await(new i.default).purge(s))[0],o=s.rejected&&c.rejected?c.rejected.join(" {}\n")+" {}":c.css;r.contents=Buffer.from(o,"utf-8"),n(null,t)}catch(e){this.emit("error",new c.default("gulp-purgecss",e.message))}})}}))};
{
"name": "gulp-purgecss",
"version": "2.3.0",
"version": "3.0.0",
"description": "Gulp plugin for purgecss",

@@ -40,4 +40,4 @@ "author": "Ffloriel",

"plugin-error": "^1.0.1",
"purgecss": "^2.3.0",
"through2": "^3.0.1"
"purgecss": "^3.0.0",
"through2": "^4.0.1"
},

@@ -52,3 +52,3 @@ "devDependencies": {

},
"gitHead": "5314e41edf328e2ad2639549e1587b82a964a42e"
"gitHead": "4a2a9504a41fe361f5aa36f3a2e50eabee84aec0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc