@ingcrea/aumic-tailwind-killer 3.1.7 → 4.1.3
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 +116 -102
- package/aumic-lexicon.duckdb +0 -0
- package/dist/index.js +848 -683
- package/package.json +50 -48
- package/patch.js +0 -80
package/package.json
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ingcrea/aumic-tailwind-killer",
|
|
3
|
+
"version": "4.1.3",
|
|
4
|
+
"description": "Transpilador de Tailwind a CSS3 puro bajo estándar AUM-IC",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"aumic-tailwind-killer": "bin/aumic-killer.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"bump": "node scripts/bump.js",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"start": "node dist/index.js",
|
|
13
|
+
"publish-public": "npm publish --access public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@babel/generator": "^8.0.6",
|
|
17
|
+
"@babel/parser": "^8.0.6",
|
|
18
|
+
"@babel/traverse": "^8.0.6",
|
|
19
|
+
"@tailwindcss/postcss": "^4.0.0",
|
|
20
|
+
"cheerio": "^1.2.0",
|
|
21
|
+
"commander": "^11.0.0",
|
|
22
|
+
"dotenv": "^16.6.1",
|
|
23
|
+
"duckdb": "^1.4.4",
|
|
24
|
+
"fs-extra": "^11.2.0",
|
|
25
|
+
"glob": "^10.3.10",
|
|
26
|
+
"inquirer": "^9.3.8",
|
|
27
|
+
"ora": "^5.4.1",
|
|
28
|
+
"picocolors": "^1.0.0",
|
|
29
|
+
"piscina": "^4.4.0",
|
|
30
|
+
"tailwindcss": "^3.4.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/fs-extra": "^11.0.4",
|
|
34
|
+
"@types/node": "^20.11.20",
|
|
35
|
+
"typescript": "^5.3.3"
|
|
36
|
+
},
|
|
37
|
+
"author": "IngenierÃa Creativa <soporte@ingcrea.com> (https://ingcrea.com)",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/ingcrea/aumic-tailwind-killer.git"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"tailwind",
|
|
44
|
+
"css",
|
|
45
|
+
"aum-ic",
|
|
46
|
+
"transpiler",
|
|
47
|
+
"ast",
|
|
48
|
+
"cli"
|
|
49
|
+
]
|
|
50
|
+
}
|
package/patch.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
let content = fs.readFileSync('src-typescript/index.ts', 'utf8');
|
|
3
|
-
|
|
4
|
-
const classMapRegex = /const classMapping = new Map<string, \{ original: string, array: string\[\], aumicClass: string, category: string, component: string, occurrences: number \}>\(\);/;
|
|
5
|
-
const classMapReplacement = 'const classMapping = new Map<string, { original: string, array: string[], tailwindOnlyArray: string[], customArray: string[], aumicClass: string, replacementString: string, category: string, component: string, occurrences: number }>();';
|
|
6
|
-
content = content.replace(classMapRegex, classMapReplacement);
|
|
7
|
-
|
|
8
|
-
const memoryInjectRegex = /classMapping\.set\(orig, \{ original: orig, array: orig\.split\(' '\), aumicClass: cleanAumic, category, component, occurrences \}\);/g;
|
|
9
|
-
const memoryInjectReplacement = `
|
|
10
|
-
const fullArray = orig.split(' ');
|
|
11
|
-
const twArray = fullArray.filter(c => validTwClasses.has(c));
|
|
12
|
-
const customArray = fullArray.filter(c => !validTwClasses.has(c));
|
|
13
|
-
const repString = customArray.length > 0 ? (twArray.length > 0 ? cleanAumic + ' ' + customArray.join(' ') : customArray.join(' ')) : cleanAumic;
|
|
14
|
-
if (twArray.length > 0) {
|
|
15
|
-
classMapping.set(orig, { original: orig, array: fullArray, tailwindOnlyArray: twArray, customArray, aumicClass: cleanAumic, replacementString: repString, category, component, occurrences });
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
content = content.replace(memoryInjectRegex, memoryInjectReplacement);
|
|
19
|
-
|
|
20
|
-
const hashInjectRegex = /classMapping\.set\(orig, \{ original: orig, array: orig\.split\(' '\), aumicClass: `aumic-\${prefix}-\${component}-\${getHash\(orig\)}`, category, component, occurrences \}\);/g;
|
|
21
|
-
const hashInjectReplacement = `
|
|
22
|
-
const fullArray = orig.split(' ');
|
|
23
|
-
const twArray = fullArray.filter(c => validTwClasses.has(c));
|
|
24
|
-
const customArray = fullArray.filter(c => !validTwClasses.has(c));
|
|
25
|
-
const hashAumic = \`aumic-\${prefix}-\${component}-\${getHash(orig)}\`;
|
|
26
|
-
const repString = customArray.length > 0 ? (twArray.length > 0 ? hashAumic + ' ' + customArray.join(' ') : customArray.join(' ')) : hashAumic;
|
|
27
|
-
if (twArray.length > 0) {
|
|
28
|
-
classMapping.set(orig, { original: orig, array: fullArray, tailwindOnlyArray: twArray, customArray, aumicClass: hashAumic, replacementString: repString, category, component, occurrences });
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
content = content.replace(hashInjectRegex, hashInjectReplacement);
|
|
32
|
-
|
|
33
|
-
const extractSuccessSplit = content.split("globalExtracted.size} bloques");
|
|
34
|
-
if(extractSuccessSplit.length > 1) {
|
|
35
|
-
const after = extractSuccessSplit[1];
|
|
36
|
-
const rest = after.substring(after.indexOf(");") + 2);
|
|
37
|
-
const before = extractSuccessSplit[0] + "globalExtracted.size} bloques" + after.substring(0, after.indexOf(");") + 2);
|
|
38
|
-
|
|
39
|
-
const jitValidationBlock = `
|
|
40
|
-
// --- NUEVO: JIT VALIDATOR PASS (Zero-Bloat Seguro) ---
|
|
41
|
-
spinner.start('Verificando clases nativas de Tailwind vs Custom CSS (JIT Validator)...');
|
|
42
|
-
const allUniqueTokens = new Set<string>();
|
|
43
|
-
for (const orig of globalExtracted.keys()) {
|
|
44
|
-
orig.split(' ').forEach(t => { if (t.trim() && !t.includes('aumic-')) allUniqueTokens.add(t.trim()); });
|
|
45
|
-
}
|
|
46
|
-
const testHtml = Array.from(allUniqueTokens).map(t => \`<div class="\${t}"></div>\`).join('\\n');
|
|
47
|
-
let testPlugin;
|
|
48
|
-
try {
|
|
49
|
-
testPlugin = require('tailwindcss')({ content: [{ raw: testHtml, extension: 'html' }], corePlugins: { preflight: false } });
|
|
50
|
-
} catch(e) {
|
|
51
|
-
testPlugin = require('tailwindcss');
|
|
52
|
-
}
|
|
53
|
-
const testJit = await postcss([testPlugin]).process(\`@tailwind utilities;\`, { from: undefined });
|
|
54
|
-
const testRoot = postcss.parse(testJit.css);
|
|
55
|
-
const validTwClasses = new Set<string>();
|
|
56
|
-
testRoot.walkRules((rule) => {
|
|
57
|
-
const allTokensArr = Array.from(allUniqueTokens);
|
|
58
|
-
for (const token of allTokensArr) {
|
|
59
|
-
const escaped = '.' + escapeCssSelector(token);
|
|
60
|
-
if (rule.selector.includes(escaped)) {
|
|
61
|
-
validTwClasses.add(token);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
spinner.succeed(\`Filtro JIT completado: \${validTwClasses.size} utilidades nativas reconocidas.\`);
|
|
66
|
-
`;
|
|
67
|
-
content = before + "\n" + jitValidationBlock + "\n" + rest;
|
|
68
|
-
} else {
|
|
69
|
-
console.log("Could not find globalExtracted block!");
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const virtualHtmlReplacement = "const virtualHtml = Array.from(classMapping.values()).map(map => `<div class=\"${map.tailwindOnlyArray.join(' ')}\"></div>`).join('\\n');";
|
|
73
|
-
content = content.replace("const virtualHtml = Array.from(classMapping.values()).map(map => `<div class=\"${map.original}\"></div>`).join('\\n');", virtualHtmlReplacement);
|
|
74
|
-
|
|
75
|
-
const mapArrayRegex = /for \(const util of mapping\.array\) \{/g;
|
|
76
|
-
const mapArrayReplacement = 'for (const util of mapping.tailwindOnlyArray) {';
|
|
77
|
-
content = content.replace(mapArrayRegex, mapArrayReplacement);
|
|
78
|
-
|
|
79
|
-
fs.writeFileSync('src-typescript/index.ts', content, 'utf8');
|
|
80
|
-
console.log("Patched successfully!");
|