⚝
One Hat Cyber Team
⚝
Your IP:
172.22.0.1
Server IP:
151.80.20.34
Server:
Linux 794f04d97d5e 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
Server Software:
Apache/2.4.62 (Debian)
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
node_modules
/
icss-utils
/
src
/
View File Name :
extractICSS.js
const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/; const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/; const getDeclsObject = (rule) => { const object = {}; rule.walkDecls((decl) => { const before = decl.raws.before ? decl.raws.before.trim() : ""; object[before + decl.prop] = decl.value; }); return object; }; /** * * @param {string} css * @param {boolean} removeRules * @param {'auto' | 'rule' | 'at-rule'} mode */ const extractICSS = (css, removeRules = true, mode = "auto") => { const icssImports = {}; const icssExports = {}; function addImports(node, path) { const unquoted = path.replace(/'|"/g, ""); icssImports[unquoted] = Object.assign( icssImports[unquoted] || {}, getDeclsObject(node) ); if (removeRules) { node.remove(); } } function addExports(node) { Object.assign(icssExports, getDeclsObject(node)); if (removeRules) { node.remove(); } } css.each((node) => { if (node.type === "rule" && mode !== "at-rule") { if (node.selector.slice(0, 7) === ":import") { const matches = importPattern.exec(node.selector); if (matches) { addImports(node, matches[1]); } } if (node.selector === ":export") { addExports(node); } } if (node.type === "atrule" && mode !== "rule") { if (node.name === "icss-import") { const matches = balancedQuotes.exec(node.params); if (matches) { addImports(node, matches[1]); } } if (node.name === "icss-export") { addExports(node); } } }); return { icssImports, icssExports }; }; module.exports = extractICSS;