versacompiler 2.0.7 → 2.1.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.
Files changed (40) hide show
  1. package/dist/compiler/compile.js +25 -2332
  2. package/dist/compiler/error-reporter.js +38 -467
  3. package/dist/compiler/linter.js +1 -72
  4. package/dist/compiler/minify.js +1 -229
  5. package/dist/compiler/minifyTemplate.js +1 -0
  6. package/dist/compiler/module-resolution-optimizer.js +1 -821
  7. package/dist/compiler/parser.js +1 -203
  8. package/dist/compiler/performance-monitor.js +56 -192
  9. package/dist/compiler/tailwindcss.js +1 -39
  10. package/dist/compiler/transform-optimizer.js +1 -392
  11. package/dist/compiler/transformTStoJS.js +1 -16
  12. package/dist/compiler/transforms.js +1 -550
  13. package/dist/compiler/typescript-compiler.js +2 -172
  14. package/dist/compiler/typescript-error-parser.js +10 -281
  15. package/dist/compiler/typescript-manager.js +2 -273
  16. package/dist/compiler/typescript-sync-validator.js +31 -295
  17. package/dist/compiler/typescript-worker-pool.js +1 -842
  18. package/dist/compiler/typescript-worker-thread.cjs +22 -466
  19. package/dist/compiler/typescript-worker.js +1 -339
  20. package/dist/compiler/vuejs.js +37 -392
  21. package/dist/hrm/VueHRM.js +1 -353
  22. package/dist/hrm/errorScreen.js +1 -83
  23. package/dist/hrm/getInstanciaVue.js +1 -313
  24. package/dist/hrm/initHRM.js +1 -141
  25. package/dist/main.js +7 -347
  26. package/dist/servicios/browserSync.js +2 -503
  27. package/dist/servicios/file-watcher.js +4 -379
  28. package/dist/servicios/logger.js +3 -63
  29. package/dist/servicios/readConfig.js +53 -430
  30. package/dist/utils/excluded-modules.js +1 -36
  31. package/dist/utils/module-resolver.js +1 -466
  32. package/dist/utils/promptUser.js +2 -48
  33. package/dist/utils/proxyValidator.js +1 -68
  34. package/dist/utils/resolve-bin.js +1 -48
  35. package/dist/utils/utils.js +1 -21
  36. package/dist/utils/vue-types-setup.js +241 -435
  37. package/dist/wrappers/eslint-node.js +3 -1
  38. package/dist/wrappers/oxlint-node.js +1 -120
  39. package/dist/wrappers/tailwind-node.js +1 -92
  40. package/package.json +103 -108
@@ -33,7 +33,9 @@ export class ESLintNode {
33
33
  }
34
34
  catch (error) {
35
35
  console.error("Error al resolver el binario de ESLint. Asegúrate de que 'eslint' esté instalado y en el PATH, o provee la opción 'binPath'.", error);
36
- throw new Error('Error al resolver el binario de ESLint.');
36
+ throw new Error('Error al resolver el binario de ESLint.', {
37
+ cause: error,
38
+ });
37
39
  }
38
40
  }
39
41
  async version() {
@@ -1,120 +1 @@
1
- import { execa } from 'execa';
2
- import { resolveBin } from '../utils/resolve-bin.js';
3
- export class OxlintNode {
4
- binPath;
5
- fix;
6
- configFile;
7
- tsconfigPath;
8
- quiet;
9
- deny;
10
- allow;
11
- noIgnore;
12
- ignorePath;
13
- ignorePattern;
14
- formats;
15
- additionalArgs;
16
- constructor(options = {}) {
17
- this.binPath = options.binPath || OxlintNode.getDefaultBinPath();
18
- this.fix = options.fix || false;
19
- this.configFile = options.configFile;
20
- this.tsconfigPath = options.tsconfigPath;
21
- this.quiet = options.quiet || false;
22
- this.deny = options.deny;
23
- this.allow = options.allow;
24
- this.noIgnore = options.noIgnore || false;
25
- this.ignorePath = options.ignorePath;
26
- this.ignorePattern = options.ignorePattern;
27
- this.formats = options.formats || ['json']; // Por defecto, solo 'json'
28
- this.additionalArgs = options.additionalArgs;
29
- }
30
- static getDefaultBinPath() {
31
- try {
32
- return resolveBin('oxlint', { executable: 'oxlint' });
33
- }
34
- catch (error) {
35
- console.error("Error al resolver el binario de Oxlint. Asegúrate de que 'oxlint' esté instalado y en el PATH, o provee la opción 'binPath'.", error);
36
- throw new Error('Error al resolver el binario de Oxlint.');
37
- }
38
- }
39
- async version() {
40
- const { stdout: version } = await execa(this.binPath, ['--version']);
41
- return version;
42
- }
43
- /**
44
- * Ejecuta Oxlint para los formatos configurados y devuelve los resultados.
45
- * @param paths Rutas o patrones glob para los archivos a lint.
46
- * @returns Un objeto donde cada clave es un formato y el valor es el resultado (parseado si es JSON).
47
- */
48
- async run(paths = []) {
49
- const results = {};
50
- const targetPaths = paths.length > 0 ? paths : ['.'];
51
- await Promise.all(this.formats.map(async (format) => {
52
- const cliArgs = this.toCliArgs(format, targetPaths);
53
- try {
54
- const { stdout, stderr, exitCode } = await execa(this.binPath, cliArgs, { reject: false });
55
- if (exitCode !== 0 &&
56
- format !== 'json' &&
57
- format !== 'sarif') {
58
- if (stderr && !stdout) {
59
- console.warn(`Oxlint para formato '${format}' finalizó con código ${exitCode} y stderr: ${stderr}`);
60
- }
61
- }
62
- results[format] =
63
- format === 'json' || format === 'sarif'
64
- ? JSON.parse(stdout || '{}')
65
- : stdout;
66
- }
67
- catch (error) {
68
- console.error(`Error ejecutando Oxlint para formato '${format}':`, error.shortMessage || error.message);
69
- results[format] = {
70
- error: error.shortMessage || error.message,
71
- details: error,
72
- };
73
- }
74
- }));
75
- return results;
76
- }
77
- /**
78
- * Construye el array de argumentos para pasar al CLI de Oxlint para un formato específico.
79
- */
80
- toCliArgs(format, paths) {
81
- const args = [];
82
- // Opciones directas
83
- if (this.fix)
84
- args.push('--fix');
85
- if (this.configFile)
86
- args.push('--config', this.configFile);
87
- if (this.tsconfigPath)
88
- args.push('--tsconfig', this.tsconfigPath); // Añadido
89
- if (this.quiet)
90
- args.push('--quiet');
91
- if (this.noIgnore)
92
- args.push('--no-ignore');
93
- if (this.ignorePath)
94
- args.push('--ignore-path', this.ignorePath);
95
- if (this.deny)
96
- this.deny.forEach(rule => args.push('--deny', rule));
97
- if (this.allow)
98
- this.allow.forEach(rule => args.push('--allow', rule));
99
- if (this.ignorePattern)
100
- this.ignorePattern.forEach(pattern => args.push('--ignore-pattern', pattern));
101
- // Formato
102
- if (format !== 'default') {
103
- args.push('--format', format);
104
- }
105
- // Argumentos adicionales
106
- if (this.additionalArgs)
107
- args.push(...this.additionalArgs);
108
- // Rutas/patrones
109
- args.push(...paths);
110
- return args;
111
- }
112
- /**
113
- * Método estático para crear una instancia de OxlintNode, similar al código de referencia.
114
- * @param options Opciones de configuración.
115
- */
116
- static create(options) {
117
- return new OxlintNode(options);
118
- }
119
- }
120
- //# sourceMappingURL=oxlint-node.js.map
1
+ import{execa as e}from"execa";import{resolveBin as t}from"../utils/resolve-bin.js";export class OxlintNode{binPath;fix;configFile;tsconfigPath;quiet;deny;allow;noIgnore;ignorePath;ignorePattern;formats;additionalArgs;constructor(e={}){this.binPath=e.binPath||OxlintNode.getDefaultBinPath(),this.fix=e.fix||!1,this.configFile=e.configFile,this.tsconfigPath=e.tsconfigPath,this.quiet=e.quiet||!1,this.deny=e.deny,this.allow=e.allow,this.noIgnore=e.noIgnore||!1,this.ignorePath=e.ignorePath,this.ignorePattern=e.ignorePattern,this.formats=e.formats||[`json`],this.additionalArgs=e.additionalArgs}static getDefaultBinPath(){try{return t(`oxlint`,{executable:`oxlint`})}catch(e){throw console.error(`Error al resolver el binario de Oxlint. Asegúrate de que 'oxlint' esté instalado y en el PATH, o provee la opción 'binPath'.`,e),Error(`Error al resolver el binario de Oxlint.`,{cause:e})}}async version(){let{stdout:t}=await e(this.binPath,[`--version`]);return t}async run(t=[]){let n={},r=t.length>0?t:[`.`];return await Promise.all(this.formats.map(async t=>{let i=this.toCliArgs(t,r);try{let{stdout:r,stderr:a,exitCode:o}=await e(this.binPath,i,{reject:!1});o!==0&&t!==`json`&&t!==`sarif`&&a&&!r&&console.warn(`Oxlint para formato '${t}' finalizó con código ${o} y stderr: ${a}`),n[t]=t===`json`||t===`sarif`?JSON.parse(r||`{}`):r}catch(e){console.error(`Error ejecutando Oxlint para formato '${t}':`,e.shortMessage||e.message),n[t]={error:e.shortMessage||e.message,details:e}}})),n}toCliArgs(e,t){let n=[];return this.fix&&n.push(`--fix`),this.configFile&&n.push(`--config`,this.configFile),this.tsconfigPath&&n.push(`--tsconfig`,this.tsconfigPath),this.quiet&&n.push(`--quiet`),this.noIgnore&&n.push(`--no-ignore`),this.ignorePath&&n.push(`--ignore-path`,this.ignorePath),this.deny&&this.deny.forEach(e=>n.push(`--deny`,e)),this.allow&&this.allow.forEach(e=>n.push(`--allow`,e)),this.ignorePattern&&this.ignorePattern.forEach(e=>n.push(`--ignore-pattern`,e)),e!==`default`&&n.push(`--format`,e),this.additionalArgs&&n.push(...this.additionalArgs),n.push(...t),n}static create(e){return new OxlintNode(e)}}
@@ -1,92 +1 @@
1
- import { execa } from 'execa';
2
- import { resolveBin } from '../utils/resolve-bin.js';
3
- export class TailwindNode {
4
- binPath;
5
- input;
6
- output;
7
- content;
8
- minify;
9
- additionalArgs;
10
- configFile;
11
- /**
12
- * Crea una instancia de TailwindNode.
13
- * @param options Opciones para la compilación.
14
- */
15
- constructor(options) {
16
- if (!options.input) {
17
- throw new Error('La opción "input" es requerida.');
18
- }
19
- if (!options.output) {
20
- throw new Error('La opción "output" es requerida.');
21
- }
22
- this.binPath = options.binPath || TailwindNode.getDefaultBinPath();
23
- this.input = options.input;
24
- this.output = options.output;
25
- this.content = options.content;
26
- this.minify = options.minify || false;
27
- this.additionalArgs = options.additionalArgs;
28
- this.configFile = options.configFile;
29
- }
30
- /**
31
- * Intenta resolver la ruta al ejecutable de Tailwind CSS.
32
- */
33
- static getDefaultBinPath() {
34
- try {
35
- return resolveBin('tailwindcss', {
36
- executable: 'tailwindcss',
37
- });
38
- }
39
- catch (error) {
40
- console.error("Error al resolver el binario de Tailwind CSS. Asegúrate de que esté instalado y en el PATH, o provee la opción 'binPath'.", error);
41
- throw new Error('Error al resolver el binario de Tailwind CSS.');
42
- }
43
- }
44
- /**
45
- * Ejecuta el proceso de compilación de Tailwind CSS.
46
- * @returns Una promesa que resuelve con el resultado de la compilación.
47
- */
48
- async run() {
49
- const cliArgs = this.toCliArgs();
50
- try {
51
- const result = await execa(this.binPath, cliArgs);
52
- return {
53
- success: true,
54
- message: `Tailwind CSS compilado exitosamente desde ${this.input} a ${this.output}`,
55
- details: result,
56
- };
57
- }
58
- catch (error) {
59
- const execaError = error; // error de execa
60
- console.error(`Error en la compilación de Tailwind CSS: ${execaError.message}`);
61
- if (execaError.stderr) {
62
- console.error(`Stderr: ${execaError.stderr}`);
63
- }
64
- return {
65
- success: false,
66
- message: `Error en la compilación de Tailwind CSS: ${execaError.shortMessage || execaError.message}`,
67
- details: execaError,
68
- };
69
- }
70
- }
71
- /**
72
- * Construye el array de argumentos para pasar al CLI de Tailwind CSS.
73
- */
74
- toCliArgs() {
75
- const args = ['-i', this.input, '-o', this.output];
76
- if (this.configFile) {
77
- args.push('--config', this.configFile);
78
- }
79
- if (this.content && this.content.length > 0) {
80
- args.push('--content');
81
- args.push(...this.content);
82
- }
83
- if (this.minify) {
84
- args.push('--minify');
85
- }
86
- if (this.additionalArgs && this.additionalArgs.length > 0) {
87
- args.push(...this.additionalArgs);
88
- }
89
- return args;
90
- }
91
- }
92
- //# sourceMappingURL=tailwind-node.js.map
1
+ import{execa as e}from"execa";import{resolveBin as t}from"../utils/resolve-bin.js";export class TailwindNode{binPath;input;output;content;minify;additionalArgs;configFile;constructor(e){if(!e.input)throw Error(`La opción "input" es requerida.`);if(!e.output)throw Error(`La opción "output" es requerida.`);this.binPath=e.binPath||TailwindNode.getDefaultBinPath(),this.input=e.input,this.output=e.output,this.content=e.content,this.minify=e.minify||!1,this.additionalArgs=e.additionalArgs,this.configFile=e.configFile}static getDefaultBinPath(){try{return t(`tailwindcss`,{executable:`tailwindcss`})}catch(e){throw console.error(`Error al resolver el binario de Tailwind CSS. Asegúrate de que esté instalado y en el PATH, o provee la opción 'binPath'.`,e),Error(`Error al resolver el binario de Tailwind CSS.`,{cause:e})}}async run(){let t=this.toCliArgs();try{let n=await e(this.binPath,t);return{success:!0,message:`Tailwind CSS compilado exitosamente desde ${this.input} a ${this.output}`,details:n}}catch(e){let t=e;return console.error(`Error en la compilación de Tailwind CSS: ${t.message}`),t.stderr&&console.error(`Stderr: ${t.stderr}`),{success:!1,message:`Error en la compilación de Tailwind CSS: ${t.shortMessage||t.message}`,details:t}}}toCliArgs(){let e=[`-i`,this.input,`-o`,this.output];return this.configFile&&e.push(`--config`,this.configFile),this.content&&this.content.length>0&&(e.push(`--content`),e.push(...this.content)),this.minify&&e.push(`--minify`),this.additionalArgs&&this.additionalArgs.length>0&&e.push(...this.additionalArgs),e}}
package/package.json CHANGED
@@ -1,109 +1,104 @@
1
1
  {
2
- "name": "versacompiler",
3
- "version": "2.0.7",
4
- "description": "Una herramienta para compilar y minificar archivos .vue, .js y .ts para proyectos de Vue 3 con soporte para TypeScript.",
5
- "main": "dist/main.js",
6
- "bin": {
7
- "versacompiler": "dist/main.js"
8
- },
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "files": [
13
- "dist",
14
- "LICENSE",
15
- "README.md"
16
- ],
17
- "type": "module",
18
- "scripts": {
19
- "dev": "tsx --watch src/main.ts --watch --verbose --tailwind",
20
- "file": "tsx src/main.ts ",
21
- "compile": "tsx src/main.ts --all",
22
- "test": "jest --config jest.config.js",
23
- "build": "tsx src/main.ts --all -t --cc --co -y --verbose",
24
- "lint": "oxlint --fix --config .oxlintrc.json",
25
- "lint:eslint": "eslint --ext .js,.ts,.vue src/ --fix",
26
- "perf": "scripts\\run-performance.bat",
27
- "perf:test": "jest tests/performance.test.ts --config jest.config.js --testTimeout=300000",
28
- "perf:report": "node scripts/generate-performance-report.js",
29
- "perf:open": "start performance-results/dashboard.html",
30
- "perf:clean": "rmdir /s /q performance-results 2>nul || echo 'Performance results cleaned'"
31
- },
32
- "keywords": [
33
- "vue",
34
- "compiler",
35
- "minifier",
36
- "vue3",
37
- "versacompiler",
38
- "typescript",
39
- "linter"
40
- ],
41
- "author": "Jorge Jara H (kriollone@gmail.com)",
42
- "license": "MIT",
43
- "repository": {
44
- "type": "git",
45
- "url": "git+https://github.com/kriollo/versaCompiler.git"
46
- },
47
- "bugs": {
48
- "url": "https://github.com/kriollo/versaCompiler/issues"
49
- },
50
- "homepage": "https://github.com/kriollo/versaCompiler#readme",
51
- "dependencies": {
52
- "@vue/compiler-dom": "^3.5.17",
53
- "@vue/reactivity": "^3.5.17",
54
- "@vue/runtime-core": "^3.5.17",
55
- "@vue/runtime-dom": "^3.5.17",
56
- "browser-sync": "^3.0.4",
57
- "chalk": "5.4.1",
58
- "chokidar": "^4.0.3",
59
- "enhanced-resolve": "^5.18.1",
60
- "execa": "^9.6.0",
61
- "find-root": "^1.1.0",
62
- "fs-extra": "^11.3.0",
63
- "get-port": "^7.1.0",
64
- "minimatch": "^10.0.1",
65
- "oxc-minify": "^0.75.0",
66
- "oxc-parser": "^0.75.0",
67
- "oxc-transform": "^0.75.0",
68
- "resolve": "^1.22.10",
69
- "tsx": "^4.19.4",
70
- "typescript": "^5.8.3",
71
- "vue": "3.5.17",
72
- "yargs": "^18.0.0"
73
- },
74
- "devDependencies": {
75
- "@eslint/eslintrc": "^3.3.1",
76
- "@tailwindcss/cli": "^4.1.8",
77
- "@types/browser-sync": "^2.29.0",
78
- "@types/find-root": "^1.1.4",
79
- "@types/fs-extra": "^11.0.4",
80
- "@types/jest": "^30.0.0",
81
- "@types/mocha": "^10.0.10",
82
- "@types/node": "^24.0.0",
83
- "@types/resolve": "^1.20.6",
84
- "@types/yargs": "^17.0.33",
85
- "@typescript-eslint/eslint-plugin": "^8.34.0",
86
- "@typescript-eslint/parser": "^8.34.0",
87
- "@vue/eslint-config-typescript": "^14.5.0",
88
- "@vue/test-utils": "^2.4.6",
89
- "code-tag": "^1.2.0",
90
- "eslint": "^9.28.0",
91
- "eslint-import-resolver-typescript": "^4.4.3",
92
- "eslint-plugin-import": "^2.31.0",
93
- "eslint-plugin-oxlint": "^1.0.0",
94
- "eslint-plugin-promise": "^7.2.1",
95
- "eslint-plugin-unicorn": "^59.0.1",
96
- "eslint-plugin-vue": "^10.2.0",
97
- "happy-dom": "^18.0.1",
98
- "jest": "^30.0.0",
99
- "jest-environment-jsdom": "30.0.2",
100
- "jest-environment-node": "30.0.2",
101
- "oxlint": "^1.0.0",
102
- "prettier": "3.6.2",
103
- "rimraf": "^6.0.1",
104
- "sweetalert2": "^11.22.0",
105
- "tailwindcss": "^4.1.8",
106
- "ts-jest": "^29.3.4",
107
- "vue-eslint-parser": "^10.1.3"
108
- }
109
- }
2
+ "name": "versacompiler",
3
+ "version": "2.1.0",
4
+ "description": "Una herramienta para compilar y minificar archivos .vue, .js y .ts para proyectos de Vue 3 con soporte para TypeScript.",
5
+ "main": "dist/main.js",
6
+ "bin": {
7
+ "versacompiler": "dist/main.js"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "LICENSE",
15
+ "README.md"
16
+ ],
17
+ "type": "module",
18
+ "keywords": [
19
+ "vue",
20
+ "compiler",
21
+ "minifier",
22
+ "vue3",
23
+ "versacompiler",
24
+ "typescript",
25
+ "linter"
26
+ ],
27
+ "author": "Jorge Jara H (kriollone@gmail.com)",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/kriollo/versaCompiler.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/kriollo/versaCompiler/issues"
35
+ },
36
+ "homepage": "https://github.com/kriollo/versaCompiler#readme",
37
+ "dependencies": {
38
+ "@vue/compiler-dom": "^3.5.24",
39
+ "@vue/reactivity": "^3.5.24",
40
+ "@vue/runtime-core": "^3.5.24",
41
+ "@vue/runtime-dom": "^3.5.24",
42
+ "browser-sync": "^3.0.4",
43
+ "chalk": "5.6.2",
44
+ "chokidar": "^4.0.3",
45
+ "enhanced-resolve": "^5.18.3",
46
+ "execa": "^9.6.0",
47
+ "find-root": "^1.1.0",
48
+ "fs-extra": "^11.3.2",
49
+ "get-port": "^7.1.0",
50
+ "minify-html-literals": "^1.3.5",
51
+ "minimatch": "^10.1.1",
52
+ "oxc-minify": "^0.97.0",
53
+ "oxc-parser": "^0.97.0",
54
+ "oxc-transform": "^0.97.0",
55
+ "resolve": "^1.22.11",
56
+ "tsx": "^4.20.6",
57
+ "typescript": "^5.9.3",
58
+ "vue": "3.5.24",
59
+ "yargs": "^18.0.0"
60
+ },
61
+ "devDependencies": {
62
+ "@eslint/eslintrc": "^3.3.1",
63
+ "@tailwindcss/cli": "^4.1.17",
64
+ "@types/browser-sync": "^2.29.1",
65
+ "@types/find-root": "^1.1.4",
66
+ "@types/fs-extra": "^11.0.4",
67
+ "@types/jest": "^30.0.0",
68
+ "@types/mocha": "^10.0.10",
69
+ "@types/node": "^24.10.1",
70
+ "@types/resolve": "^1.20.6",
71
+ "@types/yargs": "^17.0.34",
72
+ "@typescript-eslint/eslint-plugin": "^8.46.4",
73
+ "@typescript-eslint/parser": "^8.46.4",
74
+ "@vue/eslint-config-typescript": "^14.6.0",
75
+ "@vue/test-utils": "^2.4.6",
76
+ "code-tag": "^1.2.0",
77
+ "eslint": "^9.39.1",
78
+ "eslint-import-resolver-typescript": "^4.4.4",
79
+ "eslint-plugin-import": "^2.32.0",
80
+ "eslint-plugin-oxlint": "^1.28.0",
81
+ "eslint-plugin-promise": "^7.2.1",
82
+ "eslint-plugin-unicorn": "^62.0.0",
83
+ "eslint-plugin-vue": "^10.5.1",
84
+ "jest": "^30.2.0",
85
+ "jest-environment-jsdom": "30.1.2",
86
+ "jest-environment-node": "30.1.2",
87
+ "oxlint": "^1.28.0",
88
+ "prettier": "3.6.2",
89
+ "rimraf": "^6.1.0",
90
+ "sweetalert2": "^11.26.3",
91
+ "tailwindcss": "^4.1.17",
92
+ "ts-jest": "^29.4.5",
93
+ "vue-eslint-parser": "^10.2.0"
94
+ },
95
+ "scripts": {
96
+ "dev": "tsx --watch src/main.ts --watch --verbose --tailwind",
97
+ "file": "tsx src/main.ts ",
98
+ "compile": "tsx src/main.ts --all",
99
+ "test": "jest --config jest.config.js",
100
+ "build": "tsx src/main.ts --all -t --cc --co -y --verbose",
101
+ "lint": "oxlint --fix --config .oxlintrc.json",
102
+ "lint:eslint": "eslint --ext .js,.ts,.vue src/ --fix"
103
+ }
104
+ }