@ingcrea/aumic-tailwind-killer 4.1.4 → 4.1.5
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.es.md +175 -165
- package/README.md +127 -119
- package/dist/1_atoms/constants.js +26 -0
- package/dist/1_atoms/hash.js +22 -0
- package/dist/1_atoms/types.js +6 -0
- package/dist/2_molecules/classifier.js +38 -0
- package/dist/2_molecules/concurrency.js +18 -0
- package/dist/3_cells/AiEngine.js +103 -0
- package/dist/3_cells/DuckDbCache.js +24 -0
- package/dist/3_cells/WebCloner.js +61 -0
- package/dist/4_organisms/AstParser.js +116 -0
- package/dist/5_ecosystems/RestoreEcosystem.js +85 -0
- package/dist/5_ecosystems/TransmutationEcosystem.js +552 -0
- package/dist/5_ecosystems/index.js +17 -0
- package/dist/6_galaxies/index.js +131 -0
- package/dist/index.js +5 -1629
- package/dist/worker.js +26 -14
- package/package.json +52 -51
- package/.npmrc.bak +0 -1
- package/bin/aumic-killer.js +0 -100
package/dist/worker.js
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = processFile;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* [EN] Piscina worker — runs in a separate thread for each file.
|
|
6
|
+
* Two modes:
|
|
7
|
+
* - 'scan': extracts Tailwind class strings and returns their frequency map
|
|
8
|
+
* - 'mutate': applies the pre-computed class mapping and returns mutated source code
|
|
9
|
+
* [ES] Worker de Piscina — se ejecuta en un hilo separado por cada archivo.
|
|
10
|
+
* Dos modos:
|
|
11
|
+
* - 'scan': extrae strings de clase Tailwind y devuelve su mapa de frecuencias
|
|
12
|
+
* - 'mutate': aplica el mapeo de clases pre-computado y devuelve el código fuente mutado
|
|
13
|
+
*/
|
|
14
|
+
const AstParser_1 = require("./4_organisms/AstParser");
|
|
15
|
+
// [EN] Single shared instance per worker thread — instantiation is cheap and stateless.
|
|
16
|
+
// [ES] Instancia compartida única por hilo worker — la instanciación es barata y sin estado.
|
|
17
|
+
const astEngine = new AstParser_1.AstInterceptor();
|
|
6
18
|
async function processFile(data) {
|
|
7
19
|
if (data.mode === 'scan') {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
// [EN] Scan pass: count occurrences of each unique class string.
|
|
21
|
+
// [ES] Pase de escaneo: contar las ocurrencias de cada string de clase único.
|
|
22
|
+
const freq = new Map();
|
|
23
|
+
astEngine.processFrameworkFile(data.content, data.filePath, (cls) => {
|
|
24
|
+
freq.set(cls, (freq.get(cls) || 0) + 1);
|
|
25
|
+
return cls; // [EN] No mutation in scan mode. [ES] Sin mutación en modo escaneo.
|
|
12
26
|
});
|
|
13
|
-
|
|
14
|
-
return Array.from(extracted.entries());
|
|
27
|
+
return Array.from(freq.entries());
|
|
15
28
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return twClass;
|
|
29
|
+
if (data.mode === 'mutate') {
|
|
30
|
+
// [EN] Mutate pass: replace each matched class with its AUM-IC counterpart.
|
|
31
|
+
// [ES] Pase de mutación: reemplazar cada clase coincidente con su contraparte AUM-IC.
|
|
32
|
+
const { newCode } = astEngine.processFrameworkFile(data.content, data.filePath, (cls) => {
|
|
33
|
+
return data.map?.[cls]?.replacementString ?? data.map?.[cls]?.aumicClass ?? cls;
|
|
22
34
|
});
|
|
23
35
|
return newCode;
|
|
24
36
|
}
|
package/package.json
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ingcrea/aumic-tailwind-killer",
|
|
3
|
-
"version": "4.1.
|
|
4
|
-
"description": "Transpilador de Tailwind a CSS3 puro bajo
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"aumic-tailwind-killer": "
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"bump": "node scripts/bump.js",
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"start": "node dist/index.js",
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"@babel/
|
|
18
|
-
"@babel/
|
|
19
|
-
"@
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"@types/
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ingcrea/aumic-tailwind-killer",
|
|
3
|
+
"version": "4.1.5",
|
|
4
|
+
"description": "Transpilador de Tailwind a CSS3 puro bajo estándar AUM-IC",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"aumic-tailwind-killer": "dist/6_galaxies/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"bump": "node scripts/bump.js",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"start": "node dist/index.js",
|
|
13
|
+
"test": "npx tsx --test tests/**/*.test.ts",
|
|
14
|
+
"publish-public": "npm publish --access public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@babel/generator": "^8.0.6",
|
|
18
|
+
"@babel/parser": "^8.0.6",
|
|
19
|
+
"@babel/traverse": "^8.0.6",
|
|
20
|
+
"@tailwindcss/postcss": "^4.0.0",
|
|
21
|
+
"cheerio": "^1.2.0",
|
|
22
|
+
"commander": "^11.0.0",
|
|
23
|
+
"dotenv": "^16.6.1",
|
|
24
|
+
"duckdb": "^1.4.4",
|
|
25
|
+
"fs-extra": "^11.2.0",
|
|
26
|
+
"glob": "^10.3.10",
|
|
27
|
+
"inquirer": "^9.3.8",
|
|
28
|
+
"ora": "^5.4.1",
|
|
29
|
+
"picocolors": "^1.0.0",
|
|
30
|
+
"piscina": "^4.4.0",
|
|
31
|
+
"tailwindcss": "^3.4.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/fs-extra": "^11.0.4",
|
|
35
|
+
"@types/node": "^20.11.20",
|
|
36
|
+
"typescript": "^5.3.3"
|
|
37
|
+
},
|
|
38
|
+
"author": "IngenierÃa Creativa <soporte@ingcrea.com> (https://ingcrea.com)",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/ingcrea/aumic-tailwind-killer.git"
|
|
42
|
+
},
|
|
43
|
+
"license": "AGPL-3.0-or-later",
|
|
44
|
+
"keywords": [
|
|
45
|
+
"tailwind",
|
|
46
|
+
"css",
|
|
47
|
+
"aum-ic",
|
|
48
|
+
"transpiler",
|
|
49
|
+
"ast",
|
|
50
|
+
"cli"
|
|
51
|
+
]
|
|
52
|
+
}
|
package/.npmrc.bak
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
package/bin/aumic-killer.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const os = require('os');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const https = require('https');
|
|
7
|
-
const { spawnSync } = require('child_process');
|
|
8
|
-
|
|
9
|
-
// ==========================================
|
|
10
|
-
// AUM-IC NATIVE WRAPPER
|
|
11
|
-
// ==========================================
|
|
12
|
-
const VERSION = require('../package.json').version;
|
|
13
|
-
const GITHUB_REPO = 'ingcrea/aumic-tailwind-killer'; // <-- AJUSTA EL REPOSITORIO AQUÍ SI ES NECESARIO
|
|
14
|
-
|
|
15
|
-
const PLATFORM_MAP = {
|
|
16
|
-
win32: 'win',
|
|
17
|
-
linux: 'linux',
|
|
18
|
-
darwin: 'macos'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const ARCH_MAP = {
|
|
22
|
-
x64: 'x64',
|
|
23
|
-
arm64: 'arm64'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const osName = PLATFORM_MAP[os.platform()];
|
|
27
|
-
const osArch = ARCH_MAP[os.arch()];
|
|
28
|
-
|
|
29
|
-
if (!osName || !osArch) {
|
|
30
|
-
console.error(`❌ [AUM-IC] Arquitectura no soportada: ${os.platform()}-${os.arch()}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const ext = osName === 'win' ? '.exe' : '';
|
|
35
|
-
const binName = `aumic-tailwind-killer-v${VERSION}-${osName}-${osArch}${ext}`;
|
|
36
|
-
const binDir = path.join(__dirname, '..', 'vendor');
|
|
37
|
-
const binPath = path.join(binDir, binName);
|
|
38
|
-
|
|
39
|
-
const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${binName}`;
|
|
40
|
-
|
|
41
|
-
function downloadBinary(url, dest) {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
https.get(url, (res) => {
|
|
44
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
45
|
-
return downloadBinary(res.headers.location, dest).then(resolve).catch(reject);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (res.statusCode !== 200) {
|
|
49
|
-
return reject(new Error(`Error HTTP ${res.statusCode} al descargar el binario nativo.`));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const file = fs.createWriteStream(dest);
|
|
53
|
-
res.pipe(file);
|
|
54
|
-
file.on('finish', () => {
|
|
55
|
-
file.close(resolve);
|
|
56
|
-
});
|
|
57
|
-
file.on('error', (err) => {
|
|
58
|
-
fs.unlink(dest, () => reject(err));
|
|
59
|
-
});
|
|
60
|
-
}).on('error', reject);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function main() {
|
|
65
|
-
if (!fs.existsSync(binPath)) {
|
|
66
|
-
if (!fs.existsSync(binDir)) {
|
|
67
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
console.log(`\x1b[36m[AUM-IC]\x1b[0m Descargando motor nativo (v${VERSION}) para ${osName}-${osArch}...`);
|
|
71
|
-
console.log(`\x1b[90mDescargando desde: ${downloadUrl}\x1b[0m`);
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
await downloadBinary(downloadUrl, binPath);
|
|
75
|
-
if (osName !== 'win') {
|
|
76
|
-
fs.chmodSync(binPath, 0o755); // Hacer ejecutable en Linux/Mac
|
|
77
|
-
}
|
|
78
|
-
console.log(`\x1b[32m✔ Motor nativo instalado con éxito.\x1b[0m\n`);
|
|
79
|
-
} catch (err) {
|
|
80
|
-
console.error(`\x1b[33m⚠️ No se pudo descargar el binario nativo: ${err.message}\x1b[0m`);
|
|
81
|
-
console.log(`\x1b[36m[AUM-IC]\x1b[0m Iniciando modo Fallback (Ejecutando motor de Node/TypeScript)...\n`);
|
|
82
|
-
require('../dist/index.js');
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Ejecutar el binario y pasar todos los argumentos del CLI
|
|
88
|
-
const args = process.argv.slice(2);
|
|
89
|
-
const result = spawnSync(binPath, args, { stdio: 'inherit' });
|
|
90
|
-
|
|
91
|
-
if (result.error) {
|
|
92
|
-
console.error(`\x1b[33m⚠️ Falló la ejecución nativa. Iniciando modo Fallback...\x1b[0m\n`);
|
|
93
|
-
require('../dist/index.js');
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
process.exit(result.status || 0);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
main();
|