purgecss-from-html 4.1.1 → 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.
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export declare type ExtractorResultDetailed = {
|
|
5
|
+
attributes: {
|
|
6
|
+
names: string[];
|
|
7
|
+
values: string[];
|
|
8
|
+
};
|
|
9
|
+
classes: string[];
|
|
10
|
+
ids: string[];
|
|
11
|
+
tags: string[];
|
|
12
|
+
undetermined: string[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get the potential selectors from HTML code
|
|
17
|
+
*
|
|
18
|
+
* @param content - HTML code
|
|
19
|
+
* @returns the attributes, classes, ids, and tags from the HTML code
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
declare const purgecssFromHtml: (content: string) => ExtractorResultDetailed;
|
|
24
|
+
export default purgecssFromHtml;
|
|
25
|
+
|
|
26
|
+
export { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"parse5";import*as t from"parse5-htmlparser2-tree-adapter";const e=(s,t)=>({attributes:{names:[...s.attributes.names,...t.attributes.names],values:[...s.attributes.values,...t.attributes.values]},classes:[...s.classes,...t.classes],ids:[...s.ids,...t.ids],tags:[...s.tags,...t.tags],undetermined:[]}),a=s=>{const t={attributes:{names:[],values:[]},classes:[],ids:[],tags:[s.name],undetermined:[]};for(const[e,a]of Object.entries(s.attribs))"class"===e?t.classes.push(...a.split(" ")):"id"===e?t.ids.push(...a.split(" ")):(t.attributes.names.push(e),t.attributes.values.push(...a.split(" ")));return e(r(s),t)},r=s=>{let t={attributes:{names:[],values:[]},classes:[],ids:[],tags:[],undetermined:[]};for(const i of s.
|
|
1
|
+
import*as s from"parse5";import*as t from"parse5-htmlparser2-tree-adapter";const e=(s,t)=>({attributes:{names:[...s.attributes.names,...t.attributes.names],values:[...s.attributes.values,...t.attributes.values]},classes:[...s.classes,...t.classes],ids:[...s.ids,...t.ids],tags:[...s.tags,...t.tags],undetermined:[]}),a=s=>{const t={attributes:{names:[],values:[]},classes:[],ids:[],tags:[s.name],undetermined:[]};for(const[e,a]of Object.entries(s.attribs))"class"===e?t.classes.push(...a.split(" ")):"id"===e?t.ids.push(...a.split(" ")):(t.attributes.names.push(e),t.attributes.values.push(...a.split(" ")));return e(r(s),t)},r=s=>{let t={attributes:{names:[],values:[]},classes:[],ids:[],tags:[],undetermined:[]};for(const i of s.childNodes){const s=i;switch(s.type){case"tag":t=e(t,a(s));break;case"root":t=e(t,r(s))}}return t},i=e=>{const a=s.parse(e,{treeAdapter:t.adapter});return r(a)};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("parse5"),t=require("parse5-htmlparser2-tree-adapter");function s(e){
|
|
1
|
+
"use strict";var e=require("parse5"),t=require("parse5-htmlparser2-tree-adapter");function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var r=s(e),a=s(t);const u=(e,t)=>({attributes:{names:[...e.attributes.names,...t.attributes.names],values:[...e.attributes.values,...t.attributes.values]},classes:[...e.classes,...t.classes],ids:[...e.ids,...t.ids],tags:[...e.tags,...t.tags],undetermined:[]}),i=e=>{const t={attributes:{names:[],values:[]},classes:[],ids:[],tags:[e.name],undetermined:[]};for(const[s,r]of Object.entries(e.attribs))"class"===s?t.classes.push(...r.split(" ")):"id"===s?t.ids.push(...r.split(" ")):(t.attributes.names.push(s),t.attributes.values.push(...r.split(" ")));return u(n(e),t)},n=e=>{let t={attributes:{names:[],values:[]},classes:[],ids:[],tags:[],undetermined:[]};for(const s of e.childNodes){const e=s;switch(e.type){case"tag":t=u(t,i(e));break;case"root":t=u(t,n(e))}}return t};module.exports=e=>{const t=r.parse(e,{treeAdapter:a.adapter});return n(t)};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "purgecss-from-html",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"description": "HTML extractor for PurgeCSS",
|
|
5
5
|
"author": "Ffloriel",
|
|
6
6
|
"homepage": "https://github.com/FullHuman/purgecss#readme",
|
|
@@ -18,18 +18,19 @@
|
|
|
18
18
|
"url": "git+https://github.com/FullHuman/purgecss.git"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"
|
|
21
|
+
"build": "ts-node build.ts",
|
|
22
|
+
"test": "jest"
|
|
22
23
|
},
|
|
23
24
|
"bugs": {
|
|
24
25
|
"url": "https://github.com/FullHuman/purgecss/issues"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"parse5": "^
|
|
28
|
-
"parse5-htmlparser2-tree-adapter": "^
|
|
28
|
+
"parse5": "^7.1.2",
|
|
29
|
+
"parse5-htmlparser2-tree-adapter": "^7.0.0"
|
|
29
30
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "152ccba46e781902f302b7adca1788a6909e9569"
|
|
35
36
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type ExtractorResultDetailed = {
|
|
2
|
-
attributes: {
|
|
3
|
-
names: string[];
|
|
4
|
-
values: string[];
|
|
5
|
-
};
|
|
6
|
-
classes: string[];
|
|
7
|
-
ids: string[];
|
|
8
|
-
tags: string[];
|
|
9
|
-
undetermined: string[];
|
|
10
|
-
};
|
|
11
|
-
declare const purgecssFromHtml: (content: string) => ExtractorResultDetailed;
|
|
12
|
-
export { purgecssFromHtml as default };
|