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.
- package/README.md +70 -54
- package/dist/compiler/compile-worker-pool.js +12 -0
- package/dist/compiler/compile.js +102 -17
- package/dist/compiler/error-reporter.js +12 -0
- package/dist/compiler/integrity-validator.js +12 -0
- package/dist/compiler/linter.js +12 -0
- package/dist/compiler/minify.js +12 -0
- package/dist/compiler/minifyTemplate.js +12 -0
- package/dist/compiler/module-resolution-optimizer.js +13 -1
- package/dist/compiler/parser.js +12 -0
- package/dist/compiler/performance-monitor.js +12 -0
- package/dist/compiler/pipeline/build-pipeline.js +12 -0
- package/dist/compiler/pipeline/core-plugins.js +12 -0
- package/dist/compiler/pipeline/module-graph.js +12 -0
- package/dist/compiler/pipeline/plugin-driver.js +12 -0
- package/dist/compiler/pipeline/types.js +12 -0
- package/dist/compiler/tailwindcss.js +12 -0
- package/dist/compiler/transform-optimizer.js +12 -0
- package/dist/compiler/transformTStoJS.js +38 -5
- package/dist/compiler/transforms.js +12 -0
- package/dist/compiler/typescript-compiler.js +12 -0
- package/dist/compiler/typescript-error-parser.js +12 -0
- package/dist/compiler/typescript-manager.js +12 -0
- package/dist/compiler/typescript-sync-validator.js +12 -0
- package/dist/compiler/typescript-worker-pool.js +12 -0
- package/dist/compiler/typescript-worker.js +12 -0
- package/dist/compiler/vuejs.js +41 -15
- package/dist/config.js +12 -0
- package/dist/hrm/VueHRM.js +132 -7
- package/dist/hrm/errorScreen.js +12 -0
- package/dist/hrm/getInstanciaVue.js +12 -0
- package/dist/hrm/initHRM.js +117 -9
- package/dist/hrm/versaHMR.js +317 -0
- package/dist/main.js +9 -2
- package/dist/servicios/browserSync.js +119 -4
- package/dist/servicios/file-watcher.js +104 -15
- package/dist/servicios/logger.js +12 -0
- package/dist/servicios/readConfig.js +13 -1
- package/dist/servicios/versacompile.config.types.js +12 -0
- package/dist/utils/excluded-modules.js +12 -0
- package/dist/utils/module-resolver.js +12 -0
- package/dist/utils/promptUser.js +12 -0
- package/dist/utils/proxyValidator.js +12 -0
- package/dist/utils/resolve-bin.js +12 -0
- package/dist/utils/utils.js +12 -0
- package/dist/utils/vue-types-setup.js +14 -2
- package/dist/wrappers/eslint-node.js +12 -0
- package/dist/wrappers/oxlint-node.js +12 -0
- package/dist/wrappers/tailwind-node.js +12 -0
- package/package.json +4 -3
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
}
|
|
1
15
|
import { createHash } from 'node:crypto';
|
|
2
16
|
import { promises as fs } from 'node:fs';
|
|
3
17
|
import * as path from 'node:path';
|
|
@@ -315,6 +329,54 @@ class BrowserSyncFileCache {
|
|
|
315
329
|
}
|
|
316
330
|
// Instancia global del cache de archivos
|
|
317
331
|
const fileCache = BrowserSyncFileCache.getInstance();
|
|
332
|
+
// ─── HMR Import Rewriting ─────────────────────────────────────────────────────
|
|
333
|
+
// Cuando un módulo se re-compila en watch mode, registramos su path con timestamp.
|
|
334
|
+
// Al servir requests con ?t= (re-imports HMR), reescribimos los static imports de
|
|
335
|
+
// ese archivo para que también incluyan ?t=, forzando al browser a cargar la nueva
|
|
336
|
+
// versión en lugar de usar el módulo cacheado en su module registry.
|
|
337
|
+
/** Map de path normalizado → timestamp de la última compilación exitosa */
|
|
338
|
+
const recentHMRTimestamps = new Map();
|
|
339
|
+
/** TTL para limpiar entradas viejas del mapa (5 minutos) */
|
|
340
|
+
const HMR_TIMESTAMP_TTL = 5 * 60 * 1000;
|
|
341
|
+
/**
|
|
342
|
+
* Registra que un output file fue re-compilado en modo watch.
|
|
343
|
+
* Debe llamarse inmediatamente después de escribir el archivo a disco.
|
|
344
|
+
* @param outputPath - Path relativo del output compilado (ej: 'public/js/sampleFile.js')
|
|
345
|
+
*/
|
|
346
|
+
export function registerHMRUpdate(outputPath) {
|
|
347
|
+
// Normalizar a path absoluto con / inicial (como lo ve el browser)
|
|
348
|
+
const normalized = '/' + outputPath.replace(/\\/g, '/').replace(/^\.?\/+/, '');
|
|
349
|
+
recentHMRTimestamps.set(normalized, Date.now());
|
|
350
|
+
// Limpiar entradas viejas para evitar crecimiento ilimitado
|
|
351
|
+
const cutoff = Date.now() - HMR_TIMESTAMP_TTL;
|
|
352
|
+
for (const [key, ts] of recentHMRTimestamps) {
|
|
353
|
+
if (ts < cutoff)
|
|
354
|
+
recentHMRTimestamps.delete(key);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Reescribe los static imports de un archivo JS para agregar ?t=<timestamp>
|
|
359
|
+
* a cualquier módulo que haya sido recientemente re-compilado.
|
|
360
|
+
* Esto fuerza al browser a crear un nuevo module record (URL diferente)
|
|
361
|
+
* en lugar de reusar el módulo cacheado del registry.
|
|
362
|
+
*/
|
|
363
|
+
function rewriteImportsForHMR(content) {
|
|
364
|
+
if (recentHMRTimestamps.size === 0)
|
|
365
|
+
return content;
|
|
366
|
+
// Reescribir: from '/path/to/file.js' → from '/path/to/file.js?t=<ts>'
|
|
367
|
+
// Handles: import ... from '...', export ... from '...'
|
|
368
|
+
// Solo paths absolutos (con /) → son los compilados por VersaCompiler
|
|
369
|
+
return content.replace(/((?:from|import)\s+['"])(\/.+?\.js)(['""])/g, (_match, prefix, importPath, suffix) => {
|
|
370
|
+
// Quitar ?t= previo si ya existe
|
|
371
|
+
const cleanPath = importPath.split('?')[0];
|
|
372
|
+
const ts = recentHMRTimestamps.get(cleanPath);
|
|
373
|
+
if (ts) {
|
|
374
|
+
return `${prefix}${cleanPath}?t=${ts}${suffix}`;
|
|
375
|
+
}
|
|
376
|
+
return _match;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
318
380
|
// Lazy loading para chalk - pre-cargado para mejor rendimiento
|
|
319
381
|
let chalk;
|
|
320
382
|
let chalkPromise = null;
|
|
@@ -388,6 +450,9 @@ export async function browserSyncServer() {
|
|
|
388
450
|
fn: (snippet, match) => {
|
|
389
451
|
return `
|
|
390
452
|
${snippet}${match}
|
|
453
|
+
<script
|
|
454
|
+
type="module"
|
|
455
|
+
src="/__versa/versaHMR.js"></script>
|
|
391
456
|
<script
|
|
392
457
|
type="module"
|
|
393
458
|
src="/__versa/initHRM.js"></script>
|
|
@@ -447,8 +512,19 @@ export async function browserSyncServer() {
|
|
|
447
512
|
}
|
|
448
513
|
// Si la URL comienza con /__versa/hrm/, sirve los archivos de dist/hrm
|
|
449
514
|
if (req.url.startsWith('/__versa/')) {
|
|
450
|
-
// ✨
|
|
451
|
-
const
|
|
515
|
+
// ✨ SEGURIDAD: Prevenir path traversal normalizando y verificando el directorio
|
|
516
|
+
const requestedRelative = req.url
|
|
517
|
+
.replace('/__versa/', '')
|
|
518
|
+
.split('?')[0]; // strip query string
|
|
519
|
+
const resolvedFilePath = path.resolve(relativeHrmPath, requestedRelative);
|
|
520
|
+
const allowedBase = path.resolve(relativeHrmPath);
|
|
521
|
+
if (!resolvedFilePath.startsWith(allowedBase + path.sep) &&
|
|
522
|
+
resolvedFilePath !== allowedBase) {
|
|
523
|
+
res.statusCode = 403;
|
|
524
|
+
res.end('// Forbidden');
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const filePath = resolvedFilePath;
|
|
452
528
|
const cachedFile = await fileCache.getOrReadFile(filePath);
|
|
453
529
|
if (cachedFile) {
|
|
454
530
|
res.setHeader('Content-Type', cachedFile.contentType);
|
|
@@ -473,8 +549,19 @@ export async function browserSyncServer() {
|
|
|
473
549
|
}
|
|
474
550
|
// Si la URL comienza con /node_modules/, sirve los archivos de node_modules
|
|
475
551
|
if (req.url.startsWith('/node_modules/')) {
|
|
476
|
-
// ✨
|
|
477
|
-
|
|
552
|
+
// ✨ SEGURIDAD: Prevenir path traversal verificando que el path resuelto
|
|
553
|
+
// permanece dentro de node_modules del proyecto
|
|
554
|
+
const requestedRelative = req.url
|
|
555
|
+
.replace('/node_modules/', '')
|
|
556
|
+
.split('?')[0]; // strip query string
|
|
557
|
+
const nodeModulesBase = path.resolve(process.cwd(), 'node_modules');
|
|
558
|
+
const modulePath = path.resolve(nodeModulesBase, requestedRelative);
|
|
559
|
+
if (!modulePath.startsWith(nodeModulesBase + path.sep) &&
|
|
560
|
+
modulePath !== nodeModulesBase) {
|
|
561
|
+
res.statusCode = 403;
|
|
562
|
+
res.end('// Forbidden');
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
478
565
|
const cachedFile = await fileCache.getOrReadFile(modulePath);
|
|
479
566
|
if (cachedFile) {
|
|
480
567
|
res.setHeader('Content-Type', cachedFile.contentType);
|
|
@@ -497,6 +584,34 @@ export async function browserSyncServer() {
|
|
|
497
584
|
}
|
|
498
585
|
return;
|
|
499
586
|
}
|
|
587
|
+
// ── HMR re-import: reescribir imports para que el browser no use caché ──
|
|
588
|
+
// Cuando el cliente hace import('/public/js/foo.js?t=123'), el browser crea
|
|
589
|
+
// un nuevo module record para esa URL. Al evaluar el módulo, sus static imports
|
|
590
|
+
// (ej: import { x } from '/public/js/bar.js') SIN timestamp reusan el módulo
|
|
591
|
+
// cacheado del registry → se ve el código viejo.
|
|
592
|
+
// Solución: interceptar estas requests y reescribir los imports del archivo
|
|
593
|
+
// para que también lleven ?t= en los módulos recientemente modificados.
|
|
594
|
+
const isHMRReimport = req.method === 'GET' &&
|
|
595
|
+
req.url.includes('?t=') &&
|
|
596
|
+
/\.js\?/.test(req.url) &&
|
|
597
|
+
!req.url.startsWith('/__versa/') &&
|
|
598
|
+
!req.url.startsWith('/node_modules/');
|
|
599
|
+
if (isHMRReimport) {
|
|
600
|
+
const urlPath = req.url.split('?')[0];
|
|
601
|
+
const filePath = path.join(process.cwd(), urlPath);
|
|
602
|
+
try {
|
|
603
|
+
const rawContent = await fs.readFile(filePath, 'utf-8');
|
|
604
|
+
const rewritten = rewriteImportsForHMR(rawContent);
|
|
605
|
+
res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
|
|
606
|
+
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
607
|
+
res.end(rewritten);
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
catch {
|
|
611
|
+
// Archivo no encontrado, seguir al handler estático
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
500
615
|
// detectar si es un archivo estático, puede que contenga un . y alguna extensión o dashUsers.js?v=1746559083866
|
|
501
616
|
const isAssets = req.url.match(/\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|map|webp|avif|json|html|xml|txt|pdf|zip|mp4|mp3|wav|ogg)(\?.*)?$/i);
|
|
502
617
|
if (req.method === 'GET') {
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
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
|
+
import { readdir, readFile, rm, stat, unlink } from 'node:fs/promises';
|
|
2
14
|
import * as path from 'node:path';
|
|
3
15
|
import * as process from 'node:process';
|
|
4
16
|
const { env } = process;
|
|
@@ -6,7 +18,7 @@ import * as chokidar from 'chokidar';
|
|
|
6
18
|
import { minimatch } from 'minimatch';
|
|
7
19
|
import { clearCompilationState, getOutputPath, getPipelineModuleGraph, initCompile, normalizeRuta, runPipelineHotUpdate, } from '../compiler/compile.js';
|
|
8
20
|
import { promptUser } from '../utils/promptUser.js';
|
|
9
|
-
import { emitirCambios } from './browserSync.js';
|
|
21
|
+
import { emitirCambios, registerHMRUpdate } from './browserSync.js';
|
|
10
22
|
import { logger } from './logger.js';
|
|
11
23
|
// Lazy loading para chalk
|
|
12
24
|
let chalk;
|
|
@@ -16,6 +28,49 @@ async function loadChalk() {
|
|
|
16
28
|
}
|
|
17
29
|
return chalk;
|
|
18
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Analiza el contenido de un módulo JS compilado para determinar si es seguro
|
|
33
|
+
* hacer HMR sin full-reload. Un módulo es "simple" si:
|
|
34
|
+
* - Solo exporta funciones, constantes o valores (no clases con estado ni patrones singleton)
|
|
35
|
+
* - No usa new/class en el scope raíz (como estado global mutable)
|
|
36
|
+
*
|
|
37
|
+
* @param outputPath - Ruta del archivo compilado a analizar
|
|
38
|
+
* @returns 'propagate' si es seguro sin full-reload, 'full-reload' si no se puede determinar
|
|
39
|
+
*/
|
|
40
|
+
async function analyzeCompiledModuleStrategy(outputPath) {
|
|
41
|
+
try {
|
|
42
|
+
const content = await readFile(outputPath, 'utf8');
|
|
43
|
+
// Si el módulo fue compilado por VersaCompiler en modo dev, el shim HMR
|
|
44
|
+
// está inyectado y gestiona la estrategia de reemplazo vía versaHMR.
|
|
45
|
+
// No analizar el shim como side-effect — siempre es propagate.
|
|
46
|
+
if (content.startsWith('/* VersaCompiler HMR shim [dev] */')) {
|
|
47
|
+
return 'propagate';
|
|
48
|
+
}
|
|
49
|
+
// Si el módulo declara que acepta HMR, propagate es seguro
|
|
50
|
+
if (/import\.meta\.hot\.accept/.test(content)) {
|
|
51
|
+
return 'propagate';
|
|
52
|
+
}
|
|
53
|
+
// Heurística: módulos con solo exports de funciones/constantes son seguros
|
|
54
|
+
const hasExports = /export\s+(const|let|function|async function|class\b)/.test(content) || /export\s+default/.test(content);
|
|
55
|
+
if (!hasExports) {
|
|
56
|
+
return 'full-reload';
|
|
57
|
+
}
|
|
58
|
+
// Señales de estado global mutable o efectos secundarios al import:
|
|
59
|
+
// new ClassName() en scope raíz, módulos con side-effects de init
|
|
60
|
+
const hasRootLevelSideEffects =
|
|
61
|
+
// new en scope raíz (fuera de funciones/clases) — detectar heurísticamente
|
|
62
|
+
/^\s*(?:const|let|var)\s+\w+\s*=\s*new\s+\w+/m.test(content) ||
|
|
63
|
+
// Llamadas a funciones en scope raíz que sugieren init
|
|
64
|
+
/^\s*(?:init|setup|bootstrap|start|connect|register)\s*\(/m.test(content);
|
|
65
|
+
if (hasRootLevelSideEffects) {
|
|
66
|
+
return 'full-reload';
|
|
67
|
+
}
|
|
68
|
+
return 'propagate';
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return 'full-reload';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
19
74
|
class WatchDebouncer {
|
|
20
75
|
pendingChanges = new Map();
|
|
21
76
|
debounceTimer = null;
|
|
@@ -162,11 +217,23 @@ class WatchDebouncer {
|
|
|
162
217
|
for (const invalidatedPath of invalidated) {
|
|
163
218
|
if (expandedChanges.has(invalidatedPath))
|
|
164
219
|
continue;
|
|
220
|
+
// Usar la acción correcta según la extensión del archivo invalidado
|
|
221
|
+
// en lugar de forzar 'reloadFull' para todos los importers
|
|
222
|
+
const invalidatedExt = path
|
|
223
|
+
.extname(invalidatedPath)
|
|
224
|
+
.replace('.', '');
|
|
225
|
+
const invalidatedAction = {
|
|
226
|
+
vue: 'HRMVue',
|
|
227
|
+
ts: 'HRMHelper',
|
|
228
|
+
js: 'HRMHelper',
|
|
229
|
+
mjs: 'HRMHelper',
|
|
230
|
+
cjs: 'HRMHelper',
|
|
231
|
+
}[invalidatedExt] ?? 'reloadFull';
|
|
165
232
|
expandedChanges.set(invalidatedPath, {
|
|
166
233
|
filePath: invalidatedPath,
|
|
167
234
|
action: 'change',
|
|
168
235
|
timestamp: Date.now(),
|
|
169
|
-
extensionAction:
|
|
236
|
+
extensionAction: invalidatedAction,
|
|
170
237
|
isAdditionalFile: false,
|
|
171
238
|
});
|
|
172
239
|
}
|
|
@@ -203,6 +270,10 @@ class WatchDebouncer {
|
|
|
203
270
|
}
|
|
204
271
|
const result = await initCompile(change.filePath, true, 'watch');
|
|
205
272
|
if (result.success) {
|
|
273
|
+
// Registrar el output para que el middleware HMR reescriba imports dependientes
|
|
274
|
+
if (result.output) {
|
|
275
|
+
registerHMRUpdate(result.output);
|
|
276
|
+
}
|
|
206
277
|
let accion = result.action || change.extensionAction;
|
|
207
278
|
accion =
|
|
208
279
|
accion === 'extension' ? change.extensionAction : accion;
|
|
@@ -211,20 +282,38 @@ class WatchDebouncer {
|
|
|
211
282
|
if (pluginHmrReload === 'full') {
|
|
212
283
|
accion = 'reloadFull';
|
|
213
284
|
}
|
|
214
|
-
const graph = getPipelineModuleGraph();
|
|
215
|
-
const node = graph?.getNode(change.filePath);
|
|
216
|
-
const importers = node ? Array.from(node.importers) : [];
|
|
217
|
-
const strategy = importers.length > 0 ? 'propagate' : 'full-reload';
|
|
218
|
-
if (pluginHmrReload === 'module') {
|
|
219
|
-
payload.strategy = 'propagate';
|
|
220
|
-
}
|
|
221
285
|
else {
|
|
222
|
-
|
|
286
|
+
const graph = getPipelineModuleGraph();
|
|
287
|
+
const node = graph?.getNode(change.filePath);
|
|
288
|
+
const importers = node
|
|
289
|
+
? Array.from(node.importers)
|
|
290
|
+
: [];
|
|
291
|
+
// Determinar estrategia base:
|
|
292
|
+
// Si el plugin dice 'module' → propagate garantizado
|
|
293
|
+
// Si hay importers conocidos → propagate (los consumers actualizarán sus refs)
|
|
294
|
+
// Si no hay importers → analizar el módulo compilado para detectar si es "simple"
|
|
295
|
+
let strategy;
|
|
296
|
+
if (pluginHmrReload === 'module') {
|
|
297
|
+
strategy = 'propagate';
|
|
298
|
+
}
|
|
299
|
+
else if (importers.length > 0) {
|
|
300
|
+
strategy = 'propagate';
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
// Sin importers conocidos: analizar el output compilado
|
|
304
|
+
strategy = await analyzeCompiledModuleStrategy(result.output);
|
|
305
|
+
}
|
|
306
|
+
// moduleId: path del output relativo al proyecto para que el cliente
|
|
307
|
+
// pueda hacer lookup en VersaModuleRegistry
|
|
308
|
+
const moduleId = result.output.startsWith('/')
|
|
309
|
+
? result.output
|
|
310
|
+
: `/${result.output}`;
|
|
311
|
+
payload = {
|
|
312
|
+
moduleId,
|
|
313
|
+
importers,
|
|
314
|
+
strategy,
|
|
315
|
+
};
|
|
223
316
|
}
|
|
224
|
-
payload = {
|
|
225
|
-
importers,
|
|
226
|
-
...payload,
|
|
227
|
-
};
|
|
228
317
|
}
|
|
229
318
|
emitirCambios(this.browserSyncInstance, accion || 'reloadFull', result.output, payload);
|
|
230
319
|
}
|
package/dist/servicios/logger.js
CHANGED
|
@@ -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 process from 'node:process';
|
|
2
14
|
// Función para obtener ProgressManager (lazy import para evitar dependencias circulares)
|
|
3
15
|
let getProgressManager = null;
|
|
@@ -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 { normalize, relative, resolve } from 'node:path';
|
|
2
14
|
import * as process from 'node:process';
|
|
3
15
|
import { env } from 'node:process';
|
|
@@ -439,7 +451,7 @@ export default defineConfig({
|
|
|
439
451
|
},
|
|
440
452
|
resolve: {
|
|
441
453
|
alias: {
|
|
442
|
-
'/dist': 'src',
|
|
454
|
+
'/dist/public': 'src',
|
|
443
455
|
'/dist/public': 'public',
|
|
444
456
|
},
|
|
445
457
|
},
|
|
@@ -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 const defineConfig = (config) => config;
|
|
2
14
|
//# sourceMappingURL=versacompile.config.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
|
/**
|
|
2
14
|
* Lista centralizada de módulos excluidos de la resolución automática
|
|
3
15
|
* Estos módulos se mantienen con su importación original sin transformar
|
|
@@ -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
|
// Opción con librería 'resolve' (npm install resolve)
|
|
2
14
|
import fs, { readFileSync } from 'node:fs';
|
|
3
15
|
import { dirname, join, relative } from 'node:path';
|
package/dist/utils/promptUser.js
CHANGED
|
@@ -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 process, { stdin as input, stdout as output } from 'node:process';
|
|
2
14
|
import * as readline from 'node:readline/promises';
|
|
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 { get as httpGet } from 'node:http';
|
|
2
14
|
import { get as httpsGet } from 'node:https';
|
|
3
15
|
import { URL } from 'node:url';
|
|
@@ -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 path from 'node:path';
|
|
2
14
|
import * as process from 'node:process';
|
|
3
15
|
import * as fs from 'fs-extra';
|
package/dist/utils/utils.js
CHANGED
|
@@ -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
|
* Converts a 24-hour time string to a 12-hour time string with AM/PM.
|
|
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
|
/**
|
|
2
14
|
* Utilidad para configurar automáticamente los tipos de Vue en proyectos
|
|
3
15
|
* Facilita la integración de tipado robusto para archivos Vue
|
|
@@ -81,8 +93,8 @@ const createProjectTsConfig = async (projectRoot, options) => {
|
|
|
81
93
|
// Paths para tipos
|
|
82
94
|
baseUrl: '.',
|
|
83
95
|
paths: {
|
|
84
|
-
'/dist/*': ['src/*'],
|
|
85
|
-
'/dist/types/*': ['src/types/*'],
|
|
96
|
+
'/dist/public/*': ['src/*'],
|
|
97
|
+
'/dist/public/types/*': ['src/types/*'],
|
|
86
98
|
},
|
|
87
99
|
types: [
|
|
88
100
|
'node',
|
|
@@ -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 path from 'node:path';
|
|
2
14
|
import { cwd } from 'node:process'; // Añadir importación de cwd
|
|
3
15
|
import { execa } from 'execa';
|
|
@@ -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 { execa } from 'execa';
|
|
2
14
|
import { resolveBin } from '../utils/resolve-bin.js';
|
|
3
15
|
export class OxlintNode {
|
|
@@ -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 { execa } from 'execa';
|
|
2
14
|
import { resolveBin } from '../utils/resolve-bin.js';
|
|
3
15
|
export class TailwindNode {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "versacompiler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
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",
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
"test:ui": "vitest --ui",
|
|
62
62
|
"test:coverage": "vitest run --coverage",
|
|
63
63
|
"lint": "oxlint --fix --config .oxlintrc.json",
|
|
64
|
-
"lint:eslint": "eslint --ext .js,.ts,.vue src/ --fix"
|
|
64
|
+
"lint:eslint": "eslint --ext .js,.ts,.vue src/ --fix",
|
|
65
|
+
"fmt": "oxfmt --write --config .oxfmtrc.json ."
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
68
|
"@vue/compiler-dom": "^3.5.31",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
"eslint-plugin-promise": "^7.2.1",
|
|
115
116
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
116
117
|
"eslint-plugin-vue": "^10.8.0",
|
|
117
|
-
"oxfmt": "^0.
|
|
118
|
+
"oxfmt": "^0.43.0",
|
|
118
119
|
"oxlint": "^1.57.0",
|
|
119
120
|
"pinia": "^3.0.4",
|
|
120
121
|
"prettier": "3.8.1",
|