versacompiler 2.6.1 → 2.6.7

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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/compiler/compile-worker-pool.js +0 -12
  3. package/dist/compiler/compile.js +18 -15
  4. package/dist/compiler/error-reporter.js +0 -12
  5. package/dist/compiler/integrity-validator.js +0 -12
  6. package/dist/compiler/linter.js +0 -12
  7. package/dist/compiler/minify.js +0 -12
  8. package/dist/compiler/minifyTemplate.js +0 -12
  9. package/dist/compiler/module-resolution-optimizer.js +0 -12
  10. package/dist/compiler/parser.js +0 -12
  11. package/dist/compiler/performance-monitor.js +0 -12
  12. package/dist/compiler/pipeline/build-pipeline.js +0 -12
  13. package/dist/compiler/pipeline/core-plugins.js +0 -12
  14. package/dist/compiler/pipeline/module-graph.js +0 -12
  15. package/dist/compiler/pipeline/plugin-driver.js +0 -12
  16. package/dist/compiler/pipeline/types.js +0 -12
  17. package/dist/compiler/tailwindcss.js +0 -12
  18. package/dist/compiler/transform-optimizer.js +0 -12
  19. package/dist/compiler/transformTStoJS.js +0 -12
  20. package/dist/compiler/transforms.js +32 -12
  21. package/dist/compiler/typescript-compiler.js +0 -12
  22. package/dist/compiler/typescript-error-parser.js +0 -12
  23. package/dist/compiler/typescript-manager.js +0 -12
  24. package/dist/compiler/typescript-sync-validator.js +0 -12
  25. package/dist/compiler/typescript-worker-pool.js +0 -12
  26. package/dist/compiler/typescript-worker.js +0 -12
  27. package/dist/compiler/vuejs.js +0 -12
  28. package/dist/config.d.ts +1 -0
  29. package/dist/config.js +1 -13
  30. package/dist/hrm/VueHRM.js +0 -12
  31. package/dist/hrm/errorScreen.js +0 -12
  32. package/dist/hrm/getInstanciaVue.js +0 -12
  33. package/dist/hrm/initHRM.js +0 -12
  34. package/dist/hrm/versaHMR.js +0 -12
  35. package/dist/main.js +2 -2
  36. package/dist/servicios/browserSync.js +0 -14
  37. package/dist/servicios/file-watcher.js +0 -12
  38. package/dist/servicios/logger.js +0 -12
  39. package/dist/servicios/readConfig.js +25 -12
  40. package/dist/servicios/versacompile.config.types.d.ts +65 -0
  41. package/dist/servicios/versacompile.config.types.js +0 -12
  42. package/dist/utils/excluded-modules.js +0 -12
  43. package/dist/utils/module-resolver.js +0 -12
  44. package/dist/utils/promptUser.js +0 -12
  45. package/dist/utils/proxyValidator.js +0 -12
  46. package/dist/utils/resolve-bin.js +0 -12
  47. package/dist/utils/utils.js +0 -12
  48. package/dist/utils/vue-types-setup.js +0 -12
  49. package/dist/wrappers/eslint-node.js +0 -12
  50. package/dist/wrappers/oxlint-node.js +22 -16
  51. package/dist/wrappers/tailwind-node.js +0 -12
  52. package/package.json +2 -1
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
  [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
5
5
  [![Vue.js](https://img.shields.io/badge/Vue.js-35495E?style=flat&logo=vuedotjs&logoColor=4FC08D)](https://vuejs.org/)
6
- [![Version](https://img.shields.io/badge/version-2.6.1-blue.svg)](https://github.com/kriollo/versaCompiler/releases/tag/v2.6.1)
6
+ [![Version](https://img.shields.io/badge/version-2.6.3-blue.svg)](https://github.com/kriollo/versaCompiler/releases/tag/v2.6.5)
7
7
 
8
8
  > **🎯 Compilador rápido y eficiente para Vue.js, TypeScript y JavaScript con Hot Module Replacement (HMR) completo.**
9
9
 
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import * as os from 'node:os';
14
2
  import * as path from 'node:path';
15
3
  import * as process from 'node:process';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { createHash } from 'node:crypto';
14
2
  import { glob, mkdir, readFile, stat, unlink, writeFile, } from 'node:fs/promises';
15
3
  import * as os from 'node:os';
@@ -24,6 +12,7 @@ import { showTimingForHumans } from '../utils/utils.js';
24
12
  import { integrityValidator } from './integrity-validator.js';
25
13
  import { BuildPipeline } from './pipeline/build-pipeline.js';
26
14
  import { createCorePlugins } from './pipeline/core-plugins.js';
15
+ import { isHmrExcluded } from './transforms.js';
27
16
  // Configurar el getter del ProgressManager para el logger
28
17
  setProgressManagerGetter(() => ProgressManager.getInstance());
29
18
  /**
@@ -1703,7 +1692,10 @@ async function compileWithPipeline(inPath, outPath, mode = 'individual') {
1703
1692
  const destinationDir = path.dirname(outPath);
1704
1693
  await mkdir(destinationDir, { recursive: true });
1705
1694
  let pipelineCode = result.code;
1706
- if (env.isPROD !== 'true' && outPath.endsWith('.js')) {
1695
+ if (env.isPROD !== 'true' &&
1696
+ env.HMR !== 'false' &&
1697
+ outPath.endsWith('.js') &&
1698
+ !isHmrExcluded(outPath)) {
1707
1699
  pipelineCode = injectHmrShim(pipelineCode);
1708
1700
  }
1709
1701
  await writeFile(outPath, pipelineCode, 'utf-8');
@@ -1885,7 +1877,10 @@ async function compileJS(inPath, outPath, mode = 'individual') {
1885
1877
  } // Escribir archivo final
1886
1878
  const destinationDir = path.dirname(outPath);
1887
1879
  await mkdir(destinationDir, { recursive: true });
1888
- if (env.isPROD !== 'true' && outPath.endsWith('.js')) {
1880
+ if (env.isPROD !== 'true' &&
1881
+ env.HMR !== 'false' &&
1882
+ outPath.endsWith('.js') &&
1883
+ !isHmrExcluded(outPath)) {
1889
1884
  code = injectHmrShim(code);
1890
1885
  }
1891
1886
  await writeFile(outPath, code, 'utf-8');
@@ -2257,7 +2252,15 @@ export async function runLinter(showResult = false) {
2257
2252
  logger.info(`🔧 Ejecutando OxLint con config: ${item.configFile || 'por defecto'}`);
2258
2253
  const oxlintPromise = OxLintLib(item)
2259
2254
  .then((oxlintResult) => {
2260
- if (oxlintResult &&
2255
+ if (oxlintResult?.['json']?.error) {
2256
+ // OxLint falló antes de generar JSON válido (ej. tsconfig inválido)
2257
+ linterErrors.push({
2258
+ file: item.configFile || 'OxLint Config',
2259
+ message: `OxLint no pudo ejecutarse: ${oxlintResult['json'].error}`,
2260
+ severity: 'error',
2261
+ });
2262
+ }
2263
+ else if (oxlintResult &&
2261
2264
  oxlintResult['json'] &&
2262
2265
  Array.isArray(oxlintResult['json']['diagnostics'])) {
2263
2266
  oxlintResult['json']['diagnostics'].forEach((result) => {
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  // Lazy loading optimizations - Only import lightweight modules synchronously
14
2
  // Heavy dependencies will be loaded dynamically when needed
15
3
  let chalk;
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { parseSync } from 'oxc-parser';
14
2
  import { logger } from '../servicios/logger.js';
15
3
  /**
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { env } from 'node:process';
14
2
  import { logger } from '../servicios/logger.js';
15
3
  import { ESLintNode, } from './../wrappers/eslint-node.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { createHash } from 'node:crypto';
14
2
  import { minifySync } from 'oxc-minify';
15
3
  import { logger } from '../servicios/logger.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { minifyHTMLLiterals } from 'minify-html-literals';
14
2
  import { logger } from '../servicios/logger.js';
15
3
  import { integrityValidator } from './integrity-validator.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Module Resolution Optimizer
15
3
  *
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { createHash } from 'node:crypto';
14
2
  import { statSync } from 'node:fs';
15
3
  import { open, readFile } from 'node:fs/promises';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Performance Monitor - Sistema centralizado de monitoreo de optimizaciones
15
3
  * Reúne todas las métricas de cache y performance del VersaCompiler
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { stat } from 'node:fs/promises';
14
2
  import path from 'node:path';
15
3
  import { parser } from '../parser.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import path from 'node:path';
14
2
  import { env } from 'node:process';
15
3
  import { logger } from '../../servicios/logger.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  export class ModuleGraph {
14
2
  nodes = new Map();
15
3
  getNode(id) {
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  export class PluginDriver {
14
2
  plugins;
15
3
  constructor(plugins) {
@@ -1,14 +1,2 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  export {};
14
2
  //# sourceMappingURL=types.js.map
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { env } from 'node:process';
14
2
  import { logger } from '../servicios/logger.js';
15
3
  import { TailwindNode } from '../wrappers/tailwind-node.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Transform Optimizer - Sistema de optimización de transformaciones AST
15
3
  * Implementa procesamiento paralelo y caching inteligente para transformaciones
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { transform } from '/node_modules/oxc-transform/browser.js';
14
2
  export async function transpileTStoJS(filePath, sourceCode) {
15
3
  try {
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import path from 'node:path';
14
2
  import { env } from 'node:process';
15
3
  import { logger } from '../servicios/logger.js';
@@ -751,6 +739,38 @@ const removeCodeTagImport = async (data) => {
751
739
  data = data.replace(codeTagRegExp, '');
752
740
  return data;
753
741
  };
742
+ /**
743
+ * Comprueba si un archivo de salida está excluido de la inyección HMR
744
+ * según los patrones definidos en `hmrExclude` de la configuración (`env.HMR_EXCLUDE`).
745
+ *
746
+ * Acepta:
747
+ * - Nombres de archivo exactos: `'early-init.js'`
748
+ * - Sufijos de ruta: `'js/early-init.js'`
749
+ * - Globs simples con `*`: `'*.legacy.js'`
750
+ */
751
+ export function isHmrExcluded(outPath) {
752
+ const excludeList = JSON.parse(env.HMR_EXCLUDE || '[]');
753
+ if (excludeList.length === 0)
754
+ return false;
755
+ const normalized = outPath.replace(/\\/g, '/');
756
+ const basename = path.posix.basename(normalized);
757
+ if (env.VERBOSE === 'true') {
758
+ logger.info(`[HMR] isHmrExcluded check — basename: "${basename}" outPath: "${normalized}" excludeList: ${JSON.stringify(excludeList)}`);
759
+ }
760
+ const excluded = excludeList.some(pattern => {
761
+ if (pattern.includes('*')) {
762
+ const regex = new RegExp('^' +
763
+ pattern.replace(/\./g, '\\.').replace(/\*/g, '[^/]*') +
764
+ '$');
765
+ return regex.test(basename) || regex.test(normalized);
766
+ }
767
+ return basename === pattern || normalized.endsWith('/' + pattern);
768
+ });
769
+ if (env.VERBOSE === 'true' && excluded) {
770
+ logger.info(`[HMR] Shim omitido para: "${basename}"`);
771
+ }
772
+ return excluded;
773
+ }
754
774
  export async function estandarizaCode(code, file) {
755
775
  const originalCode = code; // Guardar código original para validación
756
776
  try {
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import fs from 'node:fs';
14
2
  import path from 'node:path';
15
3
  import * as process from 'node:process';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { readFileSync } from 'node:fs';
14
2
  import * as typescript from 'typescript';
15
3
  /**
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import fs from 'node:fs';
14
2
  import path from 'node:path';
15
3
  import * as process from 'node:process';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * TypeScript Sync Validator - Validación síncrona de tipos como fallback
15
3
  * Contiene la lógica extraída del módulo principal para cuando el worker no está disponible
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * TypeScript Worker Pool - Pool de workers para compilación paralela
15
3
  * Reemplaza el worker único con múltiples workers para aprovecha la concurrencia real
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * TypeScript Worker Manager - Gestiona workers dedicados para type checking asíncrono
15
3
  * Implementa el patrón Singleton para reutilizar workers entre compilaciones
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { createHash } from 'node:crypto';
14
2
  import path from 'node:path';
15
3
  import * as vCompiler from 'vue/compiler-sfc';
@@ -0,0 +1 @@
1
+ export { defineConfig, type BundlerEntry, type LinterConfig, type VersaConfig, } from './servicios/versacompile.config.types.js';
package/dist/config.js CHANGED
@@ -1,14 +1,2 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
- export { defineConfig, } from './servicios/versacompile.config.types';
1
+ export { defineConfig, } from './servicios/versacompile.config.types.js';
14
2
  //# sourceMappingURL=config.js.map
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * @typedef {Object} TreeNode
15
3
  * @property {string} name - Nombre del componente
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Variable global que mantiene la referencia al overlay de error actual
15
3
  * @type {HTMLElement|null}
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Script para obtener la instancia de Vue usando solo JavaScript
15
3
  * Compatible con Vue 2 y Vue 3
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * @fileoverview Inicialización del sistema Hot Module Replacement (HMR) para VersaCompiler
15
3
  * Este archivo maneja la conexión con BrowserSync y configura los listeners para HMR de Vue
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * @fileoverview VersaHMR — Registry de módulos para Hot Module Replacement
15
3
  *
package/dist/main.js CHANGED
@@ -316,8 +316,8 @@ async function main() {
316
316
  if (!argv.watch) {
317
317
  if (env.ENABLE_LINTER === 'true') {
318
318
  const { runLinter } = await loadCompilerModule();
319
- await runLinter(true);
320
- globalProcess.exit(1);
319
+ const linterPassed = await runLinter(true);
320
+ globalProcess.exit(linterPassed ? 0 : 1);
321
321
  }
322
322
  }
323
323
  if (env.TAILWIND === 'true') {
@@ -1,17 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- window.__versaHMR.accept("/path/to/file.js", () => { import(_id + '?t=' + Date.now()); });
12
- window.__versaHMR.accept("/public/js/bar.js", () => { import(_id + '?t=' + Date.now()); });
13
- })();
14
- }
15
1
  import { createHash } from 'node:crypto';
16
2
  import { promises as fs } from 'node:fs';
17
3
  import * as path from 'node:path';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { readdir, readFile, rm, stat, unlink } from 'node:fs/promises';
14
2
  import * as path from 'node:path';
15
3
  import * as process from 'node:process';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import * as process from 'node:process';
14
2
  // Función para obtener ProgressManager (lazy import para evitar dependencias circulares)
15
3
  let getProgressManager = null;
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { normalize, relative, resolve } from 'node:path';
14
2
  import * as process from 'node:process';
15
3
  import { env } from 'node:process';
@@ -169,6 +157,24 @@ export function validateConfigStructure(config) {
169
157
  }
170
158
  }
171
159
  }
160
+ // Validar hmr si existe
161
+ if (config.hmr !== undefined && typeof config.hmr !== 'boolean') {
162
+ logger.error('hmr debe ser un booleano');
163
+ return false;
164
+ }
165
+ // Validar hmrExclude si existe
166
+ if (config.hmrExclude !== undefined) {
167
+ if (!Array.isArray(config.hmrExclude)) {
168
+ logger.error('hmrExclude debe ser un array');
169
+ return false;
170
+ }
171
+ for (const pattern of config.hmrExclude) {
172
+ if (typeof pattern !== 'string') {
173
+ logger.error('Cada patrón en hmrExclude debe ser un string');
174
+ return false;
175
+ }
176
+ }
177
+ }
172
178
  return true;
173
179
  }
174
180
  export function validateLinter(linter) {
@@ -318,6 +324,8 @@ function normalizeConfig(input) {
318
324
  linter: viteConfig?.linter,
319
325
  bundlers: viteConfig?.build?.bundlers,
320
326
  typeCheckOptions: viteConfig?.typeCheckOptions,
327
+ hmr: viteConfig?.hmr,
328
+ hmrExclude: viteConfig?.hmrExclude,
321
329
  };
322
330
  }
323
331
  let loadedConfig = null;
@@ -387,6 +395,11 @@ export async function readConfig() {
387
395
  env.proxyUrl = String(tsConfig?.proxyConfig?.proxyUrl || '');
388
396
  env.AssetsOmit = String(tsConfig?.proxyConfig?.assetsOmit || false);
389
397
  env.linter = safeJsonStringify(tsConfig?.linter, 'false');
398
+ env.HMR = tsConfig?.hmr === false ? 'false' : 'true';
399
+ env.HMR_EXCLUDE = JSON.stringify(tsConfig?.hmrExclude ?? []);
400
+ if (tsConfig?.hmrExclude && tsConfig.hmrExclude.length > 0) {
401
+ logger.info(`[HMR] Exclusiones activas: ${JSON.stringify(tsConfig.hmrExclude)}`);
402
+ }
390
403
  env.tsconfigFile = tsConfig?.tsconfig || './tsconfig.json';
391
404
  // Validar y limpiar rutas
392
405
  const sourceRoot = cleanPath(tsConfig?.compilerOptions?.sourceRoot || './src');
@@ -0,0 +1,65 @@
1
+ export type LinterConfig = {
2
+ name: string;
3
+ bin: string;
4
+ configFile: string;
5
+ fix?: boolean;
6
+ paths?: string[];
7
+ };
8
+ export type BundlerEntry = {
9
+ name: string;
10
+ fileInput: string;
11
+ fileOutput: string;
12
+ };
13
+ export type VersaConfig = {
14
+ root: string;
15
+ build: {
16
+ outDir: string;
17
+ bundlers?: BundlerEntry[] | false;
18
+ };
19
+ resolve: {
20
+ alias: Record<string, string | string[]>;
21
+ };
22
+ server?: {
23
+ proxyUrl?: string;
24
+ assetsOmit?: boolean;
25
+ watch?: {
26
+ additional?: string[];
27
+ };
28
+ };
29
+ watch?: {
30
+ additional?: string[];
31
+ };
32
+ plugins?: unknown[];
33
+ tsconfig?: string;
34
+ tailwindConfig?: {
35
+ bin: string;
36
+ input: string;
37
+ output: string;
38
+ } | false;
39
+ linter?: LinterConfig[] | false;
40
+ typeCheckOptions?: {
41
+ maxWorkers?: number;
42
+ };
43
+ /**
44
+ * Controla la inyección del shim HMR en archivos compilados.
45
+ * Establecer en `false` para deshabilitar globalmente (ej. builds de librería Node.js).
46
+ * Para excluir archivos individuales usa `hmrExclude`.
47
+ * @default true
48
+ */
49
+ hmr?: boolean;
50
+ /**
51
+ * Lista de patrones de archivos de **salida** que no recibirán el shim HMR.
52
+ * Útil cuando un archivo compilado se carga con `<script src="...">` en lugar
53
+ * de `<script type="module" src="...">`, evitando el error:
54
+ * `SyntaxError: Cannot use 'import.meta' outside a module`
55
+ *
56
+ * El resto de archivos sigue recibiendo HMR normalmente.
57
+ *
58
+ * Acepta nombres de archivo (`'early-init.js'`), sufijos de ruta
59
+ * (`'js/early-init.js'`) o patrones glob simples (`'*.legacy.js'`).
60
+ * @example ['early-init.js', 'vendor.js']
61
+ * @default []
62
+ */
63
+ hmrExclude?: string[];
64
+ };
65
+ export declare const defineConfig: (config: VersaConfig) => VersaConfig;
@@ -1,14 +1,2 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  export const defineConfig = (config) => config;
14
2
  //# sourceMappingURL=versacompile.config.types.js.map
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Lista centralizada de módulos excluidos de la resolución automática
15
3
  * Estos módulos se mantienen con su importación original sin transformar
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  // Opción con librería 'resolve' (npm install resolve)
14
2
  import fs, { readFileSync } from 'node:fs';
15
3
  import { dirname, join, relative } from 'node:path';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import process, { stdin as input, stdout as output } from 'node:process';
14
2
  import * as readline from 'node:readline/promises';
15
3
  import { logger } from '../servicios/logger.js';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { get as httpGet } from 'node:http';
14
2
  import { get as httpsGet } from 'node:https';
15
3
  import { URL } from 'node:url';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import * as path from 'node:path';
14
2
  import * as process from 'node:process';
15
3
  import * as fs from 'fs-extra';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Converts a 24-hour time string to a 12-hour time string with AM/PM.
15
3
  *
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  /**
14
2
  * Utilidad para configurar automáticamente los tipos de Vue en proyectos
15
3
  * Facilita la integración de tipado robusto para archivos Vue
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import * as path from 'node:path';
14
2
  import { cwd } from 'node:process'; // Añadir importación de cwd
15
3
  import { execa } from 'execa';
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { execa } from 'execa';
14
2
  import { resolveBin } from '../utils/resolve-bin.js';
15
3
  export class OxlintNode {
@@ -75,10 +63,28 @@ export class OxlintNode {
75
63
  console.warn(`Oxlint para formato '${format}' finalizó con código ${exitCode} y stderr: ${stderr}`);
76
64
  }
77
65
  }
78
- results[format] =
79
- format === 'json' || format === 'sarif'
80
- ? JSON.parse(stdout || '{}')
81
- : stdout;
66
+ if (format === 'json' || format === 'sarif') {
67
+ const raw = stdout || '';
68
+ const looksLikeJson = raw.trimStart().startsWith('{') ||
69
+ raw.trimStart().startsWith('[');
70
+ if (!looksLikeJson) {
71
+ // OxLint falló antes de producir JSON (ej. config inválida, tsconfig ausente)
72
+ const errMsg = (stderr ||
73
+ raw ||
74
+ 'Salida vacía').trim();
75
+ console.error(`OxLint no produjo JSON válido (formato '${format}'). Salida: ${errMsg}`);
76
+ results[format] = {
77
+ error: errMsg,
78
+ exitCode,
79
+ };
80
+ }
81
+ else {
82
+ results[format] = JSON.parse(raw);
83
+ }
84
+ }
85
+ else {
86
+ results[format] = stdout;
87
+ }
82
88
  }
83
89
  catch (error) {
84
90
  console.error(`Error ejecutando Oxlint para formato '${format}':`, error.shortMessage || error.message);
@@ -1,15 +1,3 @@
1
- /* VersaCompiler HMR shim [dev] */
2
- if (typeof window !== 'undefined' && window.__versaHMR) {
3
- (() => {
4
- const _id = new URL(import.meta.url).pathname;
5
- import.meta.hot = {
6
- accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
7
- invalidate() { window.__versaHMR._invalidate?.(_id); },
8
- dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
9
- get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
10
- };
11
- })();
12
- }
13
1
  import { execa } from 'execa';
14
2
  import { resolveBin } from '../utils/resolve-bin.js';
15
3
  export class TailwindNode {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "versacompiler",
3
- "version": "2.6.1",
3
+ "version": "2.6.7",
4
4
  "description": "Una herramienta para compilar y minificar archivos .vue, .js y .ts para proyectos de Vue 3 con soporte para TypeScript.",
5
5
  "keywords": [
6
6
  "compiler",
@@ -50,6 +50,7 @@
50
50
  "file": "tsx src/main.ts ",
51
51
  "build": "tsx src/main.ts --all --cc --co -y && pnpm build:types",
52
52
  "build:types": "tsc -p tsconfig.declarations.json",
53
+ "prepublishOnly": "pnpm build",
53
54
  "compileDev": "tsx src/main.ts --all --ci --cc -y -t --linter --verbose",
54
55
  "vlint": "tsx src/main.ts --all --cc --co -y --linter",
55
56
  "vtlint": "tsx src/main.ts --all --cc --co -y -t --verbose",