versacompiler 2.5.0 → 2.6.1

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 (50) hide show
  1. package/README.md +70 -54
  2. package/dist/compiler/compile-worker-pool.js +12 -0
  3. package/dist/compiler/compile.js +102 -17
  4. package/dist/compiler/error-reporter.js +12 -0
  5. package/dist/compiler/integrity-validator.js +12 -0
  6. package/dist/compiler/linter.js +12 -0
  7. package/dist/compiler/minify.js +12 -0
  8. package/dist/compiler/minifyTemplate.js +12 -0
  9. package/dist/compiler/module-resolution-optimizer.js +13 -1
  10. package/dist/compiler/parser.js +12 -0
  11. package/dist/compiler/performance-monitor.js +12 -0
  12. package/dist/compiler/pipeline/build-pipeline.js +12 -0
  13. package/dist/compiler/pipeline/core-plugins.js +12 -0
  14. package/dist/compiler/pipeline/module-graph.js +12 -0
  15. package/dist/compiler/pipeline/plugin-driver.js +12 -0
  16. package/dist/compiler/pipeline/types.js +12 -0
  17. package/dist/compiler/tailwindcss.js +12 -0
  18. package/dist/compiler/transform-optimizer.js +12 -0
  19. package/dist/compiler/transformTStoJS.js +38 -5
  20. package/dist/compiler/transforms.js +12 -0
  21. package/dist/compiler/typescript-compiler.js +12 -0
  22. package/dist/compiler/typescript-error-parser.js +12 -0
  23. package/dist/compiler/typescript-manager.js +12 -0
  24. package/dist/compiler/typescript-sync-validator.js +12 -0
  25. package/dist/compiler/typescript-worker-pool.js +12 -0
  26. package/dist/compiler/typescript-worker.js +12 -0
  27. package/dist/compiler/vuejs.js +41 -15
  28. package/dist/config.js +12 -0
  29. package/dist/hrm/VueHRM.js +132 -7
  30. package/dist/hrm/errorScreen.js +12 -0
  31. package/dist/hrm/getInstanciaVue.js +12 -0
  32. package/dist/hrm/initHRM.js +117 -9
  33. package/dist/hrm/versaHMR.js +317 -0
  34. package/dist/main.js +9 -2
  35. package/dist/servicios/browserSync.js +119 -4
  36. package/dist/servicios/file-watcher.js +104 -15
  37. package/dist/servicios/logger.js +12 -0
  38. package/dist/servicios/readConfig.js +13 -1
  39. package/dist/servicios/versacompile.config.types.js +12 -0
  40. package/dist/utils/excluded-modules.js +12 -0
  41. package/dist/utils/module-resolver.js +12 -0
  42. package/dist/utils/promptUser.js +12 -0
  43. package/dist/utils/proxyValidator.js +12 -0
  44. package/dist/utils/resolve-bin.js +12 -0
  45. package/dist/utils/utils.js +12 -0
  46. package/dist/utils/vue-types-setup.js +14 -2
  47. package/dist/wrappers/eslint-node.js +12 -0
  48. package/dist/wrappers/oxlint-node.js +12 -0
  49. package/dist/wrappers/tailwind-node.js +12 -0
  50. package/package.json +4 -3
package/README.md CHANGED
@@ -3,15 +3,16 @@
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
7
 
7
- > **🎯 Compilador rápido y eficiente para Vue.js, TypeScript y JavaScript con Hot Module Replacement (HMR) integrado.**
8
+ > **🎯 Compilador rápido y eficiente para Vue.js, TypeScript y JavaScript con Hot Module Replacement (HMR) completo.**
8
9
 
9
10
  **VersaCompiler** es una herramienta de compilación diseñada para proyectos Vue 3 con soporte completo para TypeScript, JavaScript y todas las funcionalidades modernas que necesitas para desarrollo web.
10
11
 
11
12
  ## 🌟 Características Principales
12
13
 
13
14
  - ⚡ **Compilación ultra-rápida** - Workers paralelos y cache inteligente
14
- - 🔥 **HMR Automático (como Vite)** - Detección inteligente sin configuración manual, igual que Vite y esbuild
15
+ - 🔥 **HMR Completo (como Vite)** - Vue SFCs, librerías JS/TS y propagación en cascada sin recarga de página
15
16
  - 🧩 **Soporte completo para Vue 3** - SFC, Composition API, script setup
16
17
  - 📝 **TypeScript avanzado** - Language Service, decorators, validación de tipos
17
18
  - 🔍 **Sistema de linting dual** - ESLint + OxLint con auto-fix
@@ -125,25 +126,37 @@ versacompiler --typeCheck --file src/types.ts
125
126
 
126
127
  ### 🔧 Archivo de configuración
127
128
 
128
- Crea un archivo `versacompile.config.ts` en la raíz de tu proyecto:
129
+ Crea un archivo `versacompile.config.ts` en la raíz de tu proyecto usando `defineConfig` para autocompletado TypeScript:
129
130
 
130
131
  ```typescript
131
- // Archivo de configuración de VersaCompiler
132
- export default {
133
- tsconfig: './tsconfig.json',
134
- compilerOptions: {
135
- sourceRoot: './src',
132
+ import { defineConfig } from 'versacompiler/config';
133
+
134
+ export default defineConfig({
135
+ root: './src',
136
+ build: {
136
137
  outDir: './dist',
137
- pathsAlias: {
138
- '@/*': ['src/*'],
139
- 'P@/*': ['public/*'],
138
+ bundlers: [
139
+ {
140
+ name: 'appLoader',
141
+ fileInput: './public/module/appLoader.js',
142
+ fileOutput: './public/module/appLoader.prod.js',
143
+ },
144
+ ],
145
+ },
146
+ resolve: {
147
+ alias: {
148
+ '@': 'src',
149
+ 'P@': 'public',
140
150
  },
141
151
  },
142
- proxyConfig: {
152
+ server: {
143
153
  proxyUrl: '',
144
154
  assetsOmit: true,
155
+ watch: {
156
+ additional: ['./app/templates/**/*.twig'],
157
+ },
145
158
  },
146
- aditionalWatch: ['./app/templates/**/*.twig'],
159
+ tsconfig: './tsconfig.json',
147
160
  tailwindConfig: {
148
161
  bin: './node_modules/.bin/tailwindcss',
149
162
  input: './src/css/input.css',
@@ -165,62 +178,60 @@ export default {
165
178
  paths: ['src/'],
166
179
  },
167
180
  ],
168
- bundlers: [
169
- {
170
- name: 'appLoader',
171
- fileInput: './public/module/appLoader.js',
172
- fileOutput: './public/module/appLoader.prod.js',
173
- },
174
- ],
175
- };
181
+ typeCheckOptions: {
182
+ maxWorkers: 2,
183
+ },
184
+ });
176
185
  ```
177
186
 
178
187
  ### 📝 Opciones de configuración
179
188
 
180
- #### `compilerOptions`
189
+ #### `root` _(requerido)_
181
190
 
182
- - `sourceRoot`: Directorio de archivos fuente (por defecto: `'./src'`)
183
- - `outDir`: Directorio de salida (por defecto: `'./dist'`)
184
- - `pathsAlias`: Aliases para imports (ej: `'@/*': ['src/*']`)
191
+ - Directorio raíz de los archivos fuente (ej: `'./src'`)
185
192
 
186
- #### `proxyConfig`
193
+ #### `build` _(requerido)_
187
194
 
188
- - `proxyUrl`: URL del proxy para desarrollo
189
- - `assetsOmit`: Omitir assets en el proxy
195
+ - `outDir`: Directorio de salida de los archivos compilados (ej: `'./dist'`)
196
+ - `bundlers`: Array de entradas de bundling post-compilación (opcional, `false` para deshabilitar)
197
+ - `name`: Nombre del bundle
198
+ - `fileInput`: Archivo de entrada
199
+ - `fileOutput`: Archivo de salida
200
+
201
+ #### `resolve`
202
+
203
+ - `alias`: Mapa de alias de imports. La clave es el prefijo del alias y el valor es la ruta que reemplaza (ej: `{ '@': 'src', 'P@': 'public' }`)
204
+
205
+ #### `server`
206
+
207
+ - `proxyUrl`: URL del proxy para desarrollo (ej: `'http://localhost:8000'`)
208
+ - `assetsOmit`: Omitir assets estáticos del proxy (`true`/`false`)
209
+ - `watch.additional`: Globs adicionales a vigilar que disparan recarga completa (ej: plantillas Twig, HTML)
210
+
211
+ #### `tsconfig`
212
+
213
+ - Ruta al `tsconfig.json` del proyecto (ej: `'./tsconfig.json'`)
190
214
 
191
215
  #### `tailwindConfig`
192
216
 
193
217
  - `bin`: Ruta al binario de TailwindCSS
194
- - `input`: Archivo CSS de entrada
195
- - `output`: Archivo CSS de salida
218
+ - `input`: Archivo CSS de entrada con directivas Tailwind
219
+ - `output`: Archivo CSS de salida compilado
220
+ - Usar `false` para deshabilitar completamente
196
221
 
197
222
  #### `linter`
198
223
 
199
- Array de configuraciones de linters avanzadas:
224
+ Array de configuraciones de linters. Usar `false` para deshabilitar todos:
200
225
 
201
226
  - `name`: Nombre del linter (`'eslint'` o `'oxlint'`)
202
227
  - `bin`: Ruta al binario del linter
203
228
  - `configFile`: Archivo de configuración del linter
204
- - `fix`: Auto-fix de errores detectados
205
- - `paths`: Rutas específicas a analizar
206
- - `eslintConfig`: Configuración específica de ESLint
207
- - `cache`: Habilitar cache de ESLint
208
- - `maxWarnings`: Máximo número de warnings
209
- - `quiet`: Mostrar solo errores
210
- - `formats`: Formatos de salida (`'json'`, `'stylish'`, `'compact'`)
211
- - `oxlintConfig`: Configuración específica de OxLint
212
- - `rules`: Reglas personalizadas
213
- - `plugins`: Plugins de OxLint
214
- - `deny`: Reglas a denegar
215
- - `allow`: Reglas a permitir
216
-
217
- #### `bundlers`
218
-
219
- Array de configuraciones de bundling:
220
-
221
- - `name`: Nombre del bundle
222
- - `fileInput`: Archivo de entrada
223
- - `fileOutput`: Archivo de salida
229
+ - `fix`: Auto-fix de errores detectados (`true`/`false`)
230
+ - `paths`: Rutas específicas a analizar (ej: `['src/']`)
231
+
232
+ #### `typeCheckOptions`
233
+
234
+ - `maxWorkers`: Máximo número de worker threads para verificación de tipos (por defecto: depende del número de CPUs)
224
235
 
225
236
  ## 🎯 Ejemplos de Uso
226
237
 
@@ -514,12 +525,17 @@ cat tsconfig.json | grep -A 10 "paths"
514
525
 
515
526
  ```typescript
516
527
  // Verificar configuración en versacompile.config.ts
517
- export default {
518
- proxyConfig: {
528
+ import { defineConfig } from 'versacompiler/config';
529
+
530
+ export default defineConfig({
531
+ root: './src',
532
+ build: { outDir: './dist' },
533
+ resolve: { alias: { '@': 'src' } },
534
+ server: {
519
535
  proxyUrl: '', // Vacío si no usas proxy backend
520
536
  assetsOmit: true,
521
537
  },
522
- };
538
+ });
523
539
  ```
524
540
 
525
541
  ```bash
@@ -1,3 +1,15 @@
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
+ }
1
13
  import * as os from 'node:os';
2
14
  import * as path from 'node:path';
3
15
  import * as process from 'node:process';
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { createHash } from 'node:crypto';
2
14
  import { glob, mkdir, readFile, stat, unlink, writeFile, } from 'node:fs/promises';
3
15
  import * as os from 'node:os';
@@ -74,18 +86,22 @@ class OptimizedModuleManager {
74
86
  }
75
87
  /**
76
88
  * ✨ NUEVO: Precarga módulos críticos en background
89
+ * Cada módulo se precarga de forma independiente con su propio try-catch
90
+ * para que un fallo individual no rechace toda la Promise raíz.
77
91
  */
78
92
  async preloadCriticalModules() {
79
- try {
80
- // Precargar módulos críticos de forma asíncrona
81
- const preloadPromises = this.HOT_MODULES.map(moduleName => this.ensureModuleLoaded(moduleName).catch(() => {
82
- // Silenciar errores de precarga, se intentará cargar después
83
- }));
84
- await Promise.allSettled(preloadPromises);
85
- }
86
- catch {
87
- // Fallos en precarga no deben afectar la funcionalidad principal
88
- }
93
+ const preloadPromises = this.HOT_MODULES.map(async (moduleName) => {
94
+ try {
95
+ await this.ensureModuleLoaded(moduleName);
96
+ }
97
+ catch {
98
+ // Fallo individual no debe afectar otros módulos ni la Promise raíz
99
+ if (env.VERBOSE === 'true') {
100
+ console.warn(`[ModuleManager] Precarga fallida para '${moduleName}', se intentará al primer uso`);
101
+ }
102
+ }
103
+ });
104
+ await Promise.all(preloadPromises);
89
105
  }
90
106
  /**
91
107
  * ✨ MEJORADO: Precarga contextual basada en tipos de archivo con lock para prevenir cargas concurrentes
@@ -352,21 +368,25 @@ class OptimizedModuleManager {
352
368
  if (currentMemory > this.MAX_POOL_MEMORY ||
353
369
  currentSize > this.MAX_POOL_SIZE) {
354
370
  // LRU: Ordenar por menos usado
355
- const sortedModules = Array.from(this.usageStats.entries())
356
- .sort((a, b) => a[1] - b[1]) // Ascendente por uso
357
- .filter(([name]) => !this.HOT_MODULES.includes(name)); // No eliminar HOT_MODULES
371
+ const sortedModules = Array.from(this.usageStats.entries()).sort((a, b) => a[1] - b[1]); // Ascendente por uso
358
372
  // Eliminar módulos hasta estar por debajo del 70% del límite
359
373
  const targetMemory = this.MAX_POOL_MEMORY * 0.7;
360
374
  const targetSize = this.MAX_POOL_SIZE * 0.7;
375
+ const criticalPressure = currentMemory > this.MAX_POOL_MEMORY * 0.9;
361
376
  for (const [moduleName] of sortedModules) {
362
- this.modulePool.delete(moduleName);
363
- this.loadedModules.delete(moduleName);
364
- this.usageStats.delete(moduleName);
365
377
  const newMemory = this.getPoolMemoryUsage();
366
378
  const newSize = this.modulePool.size;
367
379
  if (newMemory <= targetMemory && newSize <= targetSize) {
368
380
  break;
369
381
  }
382
+ // HOT_MODULES solo se desalojan si la presión de memoria es crítica (>90%)
383
+ if (this.HOT_MODULES.includes(moduleName) &&
384
+ !criticalPressure) {
385
+ continue;
386
+ }
387
+ this.modulePool.delete(moduleName);
388
+ this.loadedModules.delete(moduleName);
389
+ this.usageStats.delete(moduleName);
370
390
  }
371
391
  if (env.VERBOSE === 'true') {
372
392
  console.log(`[ModuleManager] Limpieza: ${currentSize} → ${this.modulePool.size} módulos, ` +
@@ -1609,6 +1629,64 @@ export async function runPipelineHotUpdate(filePath, type) {
1609
1629
  }
1610
1630
  return getBuildPipeline().hotUpdate({ path: filePath, type });
1611
1631
  }
1632
+ /**
1633
+ * Extrae los imports locales (rutas absolutas con /) del código compilado.
1634
+ * Solo imports estáticos de rutas absolutas del proyecto (excluye /node_modules/).
1635
+ */
1636
+ function extractLocalImports(code) {
1637
+ const imports = [];
1638
+ const importRegex = /(?:from|import)\s+['"](\/((?!node_modules)[^'"?#]+\.js))['"]/g;
1639
+ let match;
1640
+ while ((match = importRegex.exec(code)) !== null) {
1641
+ const importPath = match[1];
1642
+ if (importPath && !imports.includes(importPath)) {
1643
+ imports.push(importPath);
1644
+ }
1645
+ }
1646
+ return imports;
1647
+ }
1648
+ /**
1649
+ * Inyecta el shim de import.meta.hot al inicio de archivos JS compilados en modo dev.
1650
+ * Adicionalmente registra accept() para cada dependencia local: cuando una dependencia
1651
+ * se actualiza en versaHMR, el módulo actual se re-importa con timestamp nuevo,
1652
+ * forzando al browser a crear un nuevo module record con la dependencia actualizada.
1653
+ * Solo se llama cuando env.isPROD !== 'true' y la salida es un archivo .js.
1654
+ */
1655
+ function injectHmrShim(code) {
1656
+ // Los scripts CLI con shebang no se ejecutan en browser: omitir el shim HMR
1657
+ // para evitar que el shebang quede desplazado y cause SyntaxError en Node.js
1658
+ if (code.startsWith('#!')) {
1659
+ return code;
1660
+ }
1661
+ const localImports = extractLocalImports(code);
1662
+ // Detecta si es un Vue SFC (el compilador Vue inyecta 'data-versa-hmr-component')
1663
+ const isVueComponent = code.includes('data-versa-hmr-component');
1664
+ const depsAccept = localImports.length > 0
1665
+ ? localImports
1666
+ .map(dep => {
1667
+ if (isVueComponent) {
1668
+ // Vue SFC: tras actualizar dependencia, re-cargar instancia Vue en DOM
1669
+ return ` window.__versaHMR.accept(${JSON.stringify(dep)}, async () => { await window.__versaHMR._reloadVueByPath?.(_id); });`;
1670
+ }
1671
+ // Módulo JS/TS plano: re-importar con nuevo timestamp para actualizar module record
1672
+ return ` window.__versaHMR.accept(${JSON.stringify(dep)}, () => { import(_id + '?t=' + Date.now()); });`;
1673
+ })
1674
+ .join('\n') + '\n'
1675
+ : '';
1676
+ const shim = `/* VersaCompiler HMR shim [dev] */
1677
+ if (typeof window !== 'undefined' && window.__versaHMR) {
1678
+ (() => {
1679
+ const _id = new URL(import.meta.url).pathname;
1680
+ import.meta.hot = {
1681
+ accept(cb) { window.__versaHMR.accept(_id, typeof cb === 'function' ? cb : () => {}); },
1682
+ invalidate() { window.__versaHMR._invalidate?.(_id); },
1683
+ dispose(cb) { window.__versaHMR._onDispose?.(_id, cb); },
1684
+ get data() { return window.__versaHMR._getHotData?.(_id) ?? {}; },
1685
+ };
1686
+ ${depsAccept} })();
1687
+ }\n`;
1688
+ return shim + code;
1689
+ }
1612
1690
  async function compileWithPipeline(inPath, outPath, mode = 'individual') {
1613
1691
  const pipeline = getBuildPipeline();
1614
1692
  const result = await pipeline.compileFile(inPath);
@@ -1624,7 +1702,11 @@ async function compileWithPipeline(inPath, outPath, mode = 'individual') {
1624
1702
  }
1625
1703
  const destinationDir = path.dirname(outPath);
1626
1704
  await mkdir(destinationDir, { recursive: true });
1627
- await writeFile(outPath, result.code, 'utf-8');
1705
+ let pipelineCode = result.code;
1706
+ if (env.isPROD !== 'true' && outPath.endsWith('.js')) {
1707
+ pipelineCode = injectHmrShim(pipelineCode);
1708
+ }
1709
+ await writeFile(outPath, pipelineCode, 'utf-8');
1628
1710
  if (result.dependencies.length > 0) {
1629
1711
  smartCache.registerDependencies(inPath, result.dependencies);
1630
1712
  }
@@ -1803,6 +1885,9 @@ async function compileJS(inPath, outPath, mode = 'individual') {
1803
1885
  } // Escribir archivo final
1804
1886
  const destinationDir = path.dirname(outPath);
1805
1887
  await mkdir(destinationDir, { recursive: true });
1888
+ if (env.isPROD !== 'true' && outPath.endsWith('.js')) {
1889
+ code = injectHmrShim(code);
1890
+ }
1806
1891
  await writeFile(outPath, code, 'utf-8');
1807
1892
  // Logs de timing detallados en modo verbose
1808
1893
  if (shouldShowDetailedLogs) {
@@ -1,3 +1,15 @@
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
+ }
1
13
  // Lazy loading optimizations - Only import lightweight modules synchronously
2
14
  // Heavy dependencies will be loaded dynamically when needed
3
15
  let chalk;
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { parseSync } from 'oxc-parser';
2
14
  import { logger } from '../servicios/logger.js';
3
15
  /**
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { env } from 'node:process';
2
14
  import { logger } from '../servicios/logger.js';
3
15
  import { ESLintNode, } from './../wrappers/eslint-node.js';
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { createHash } from 'node:crypto';
2
14
  import { minifySync } from 'oxc-minify';
3
15
  import { logger } from '../servicios/logger.js';
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { minifyHTMLLiterals } from 'minify-html-literals';
2
14
  import { logger } from '../servicios/logger.js';
3
15
  import { integrityValidator } from './integrity-validator.js';
@@ -1,3 +1,15 @@
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
+ }
1
13
  /**
2
14
  * Module Resolution Optimizer
3
15
  *
@@ -123,7 +135,7 @@ export class ModuleResolutionOptimizer {
123
135
  for (const entry of entries) {
124
136
  const modulePath = join(nodeModulesPath, entry);
125
137
  try {
126
- if (entry.startsWith('/dist')) {
138
+ if (entry.startsWith('/dist/public')) {
127
139
  // Scoped packages
128
140
  const scopedModules = readdirSync(modulePath);
129
141
  this.metrics.filesystemAccess++;
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { createHash } from 'node:crypto';
2
14
  import { statSync } from 'node:fs';
3
15
  import { open, readFile } from 'node:fs/promises';
@@ -1,3 +1,15 @@
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
+ }
1
13
  /**
2
14
  * Performance Monitor - Sistema centralizado de monitoreo de optimizaciones
3
15
  * Reúne todas las métricas de cache y performance del VersaCompiler
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { stat } from 'node:fs/promises';
2
14
  import path from 'node:path';
3
15
  import { parser } from '../parser.js';
@@ -1,3 +1,15 @@
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
+ }
1
13
  import path from 'node:path';
2
14
  import { env } from 'node:process';
3
15
  import { logger } from '../../servicios/logger.js';
@@ -1,3 +1,15 @@
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
+ }
1
13
  export class ModuleGraph {
2
14
  nodes = new Map();
3
15
  getNode(id) {
@@ -1,3 +1,15 @@
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
+ }
1
13
  export class PluginDriver {
2
14
  plugins;
3
15
  constructor(plugins) {
@@ -1,2 +1,14 @@
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
+ }
1
13
  export {};
2
14
  //# sourceMappingURL=types.js.map
@@ -1,3 +1,15 @@
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
+ }
1
13
  import { env } from 'node:process';
2
14
  import { logger } from '../servicios/logger.js';
3
15
  import { TailwindNode } from '../wrappers/tailwind-node.js';
@@ -1,3 +1,15 @@
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
+ }
1
13
  /**
2
14
  * Transform Optimizer - Sistema de optimización de transformaciones AST
3
15
  * Implementa procesamiento paralelo y caching inteligente para transformaciones