versacompiler 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/compiler/compile.js +2520 -25
- package/dist/compiler/error-reporter.js +467 -38
- package/dist/compiler/linter.js +72 -1
- package/dist/compiler/minify.js +272 -1
- package/dist/compiler/minifyTemplate.js +230 -1
- package/dist/compiler/module-resolution-optimizer.js +888 -1
- package/dist/compiler/parser.js +336 -1
- package/dist/compiler/performance-monitor.js +204 -56
- package/dist/compiler/tailwindcss.js +39 -1
- package/dist/compiler/transform-optimizer.js +392 -1
- package/dist/compiler/transformTStoJS.js +16 -1
- package/dist/compiler/transforms.js +554 -1
- package/dist/compiler/typescript-compiler.js +172 -2
- package/dist/compiler/typescript-error-parser.js +281 -10
- package/dist/compiler/typescript-manager.js +304 -2
- package/dist/compiler/typescript-sync-validator.js +295 -31
- package/dist/compiler/typescript-worker-pool.js +936 -1
- package/dist/compiler/typescript-worker-thread.cjs +466 -22
- package/dist/compiler/typescript-worker.js +339 -1
- package/dist/compiler/vuejs.js +396 -37
- package/dist/hrm/VueHRM.js +359 -1
- package/dist/hrm/errorScreen.js +83 -1
- package/dist/hrm/getInstanciaVue.js +313 -1
- package/dist/hrm/initHRM.js +586 -1
- package/dist/main.js +353 -7
- package/dist/servicios/browserSync.js +589 -2
- package/dist/servicios/file-watcher.js +425 -4
- package/dist/servicios/logger.js +63 -3
- package/dist/servicios/readConfig.js +399 -53
- package/dist/utils/excluded-modules.js +37 -1
- package/dist/utils/module-resolver.js +552 -1
- package/dist/utils/promptUser.js +48 -2
- package/dist/utils/proxyValidator.js +68 -1
- package/dist/utils/resolve-bin.js +58 -1
- package/dist/utils/utils.js +21 -1
- package/dist/utils/vue-types-setup.js +435 -241
- package/dist/wrappers/eslint-node.js +1 -1
- package/dist/wrappers/oxlint-node.js +122 -1
- package/dist/wrappers/tailwind-node.js +94 -1
- package/package.json +109 -104
|
@@ -1 +1,68 @@
|
|
|
1
|
-
import{get as
|
|
1
|
+
import { get as httpGet } from 'node:http';
|
|
2
|
+
import { get as httpsGet } from 'node:https';
|
|
3
|
+
import { URL } from 'node:url';
|
|
4
|
+
/**
|
|
5
|
+
* Valida si un servidor proxy está disponible
|
|
6
|
+
* @param proxyUrl URL del proxy a validar
|
|
7
|
+
* @param timeout Timeout en milisegundos (default: 5000)
|
|
8
|
+
* @returns Promise que resuelve a true si el proxy está disponible
|
|
9
|
+
*/
|
|
10
|
+
export async function validateProxyAvailability(proxyUrl, timeout = 5000) {
|
|
11
|
+
return new Promise(resolve => {
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(proxyUrl);
|
|
14
|
+
const isHttps = url.protocol === 'https:';
|
|
15
|
+
const requestMethod = isHttps ? httpsGet : httpGet;
|
|
16
|
+
const options = {
|
|
17
|
+
hostname: url.hostname,
|
|
18
|
+
port: url.port || (isHttps ? 443 : 80),
|
|
19
|
+
path: '/',
|
|
20
|
+
method: 'HEAD',
|
|
21
|
+
timeout: timeout,
|
|
22
|
+
headers: {
|
|
23
|
+
'User-Agent': 'VersaCompiler-ProxyValidator/1.0',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const req = requestMethod(options, (_res) => {
|
|
27
|
+
// Cualquier respuesta HTTP (incluso errores 4xx/5xx) indica que el servidor está arriba
|
|
28
|
+
resolve(true);
|
|
29
|
+
});
|
|
30
|
+
req.on('error', () => {
|
|
31
|
+
resolve(false);
|
|
32
|
+
});
|
|
33
|
+
req.on('timeout', () => {
|
|
34
|
+
req.destroy();
|
|
35
|
+
resolve(false);
|
|
36
|
+
});
|
|
37
|
+
req.setTimeout(timeout);
|
|
38
|
+
req.end();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Error al parsear URL o crear request
|
|
42
|
+
resolve(false);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Extrae información legible del proxy URL para mostrar al usuario
|
|
48
|
+
* @param proxyUrl URL del proxy
|
|
49
|
+
* @returns Objeto con información del proxy
|
|
50
|
+
*/
|
|
51
|
+
export function getProxyInfo(proxyUrl) {
|
|
52
|
+
try {
|
|
53
|
+
const url = new URL(proxyUrl);
|
|
54
|
+
return {
|
|
55
|
+
host: url.hostname,
|
|
56
|
+
port: url.port || (url.protocol === 'https:' ? '443' : '80'),
|
|
57
|
+
protocol: url.protocol.replace(':', ''),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return {
|
|
62
|
+
host: 'unknown',
|
|
63
|
+
port: 'unknown',
|
|
64
|
+
protocol: 'unknown',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=proxyValidator.js.map
|
|
@@ -1 +1,58 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as process from 'node:process';
|
|
3
|
+
import * as fs from 'fs-extra';
|
|
4
|
+
// Reimplementación simple de findRoot para evitar dependencias problemáticas
|
|
5
|
+
function findRoot(start) {
|
|
6
|
+
let current = start;
|
|
7
|
+
while (current !== path.dirname(current)) {
|
|
8
|
+
if (fs.existsSync(path.join(current, 'package.json'))) {
|
|
9
|
+
return current;
|
|
10
|
+
}
|
|
11
|
+
current = path.dirname(current);
|
|
12
|
+
}
|
|
13
|
+
throw new Error(`Cannot find package.json from ${start}`);
|
|
14
|
+
}
|
|
15
|
+
// Función helper para resolver módulos sin createRequire
|
|
16
|
+
function resolveModule(moduleName, paths) {
|
|
17
|
+
for (const searchPath of paths) {
|
|
18
|
+
try {
|
|
19
|
+
const nodeModulesPath = path.join(searchPath, 'node_modules', moduleName);
|
|
20
|
+
if (fs.existsSync(nodeModulesPath)) {
|
|
21
|
+
return nodeModulesPath;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Continuar con el siguiente path
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`Cannot resolve module ${moduleName} from paths: ${paths.join(', ')}`);
|
|
29
|
+
}
|
|
30
|
+
export function resolveBin(moduleName, { executable = moduleName, paths = [process.cwd()], } = {}) {
|
|
31
|
+
let rootDir;
|
|
32
|
+
try {
|
|
33
|
+
const resolved = resolveModule(moduleName, paths);
|
|
34
|
+
rootDir = findRoot(resolved);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Intentar resolver package.json directamente
|
|
38
|
+
const basePath = paths[0] || process.cwd();
|
|
39
|
+
const packagePath = path.join(basePath, 'node_modules', moduleName, 'package.json');
|
|
40
|
+
if (fs.existsSync(packagePath)) {
|
|
41
|
+
rootDir = path.dirname(packagePath);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
throw new Error(`Cannot resolve module ${moduleName}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const packageJsonPath = path.join(rootDir, 'package.json');
|
|
48
|
+
const packageJson = fs.readJsonSync(packageJsonPath);
|
|
49
|
+
if (!packageJson.bin) {
|
|
50
|
+
throw new Error(`no bin found in ${packageJson.name}@${packageJson.version} in path ${packageJsonPath}`);
|
|
51
|
+
}
|
|
52
|
+
const binProp = typeof packageJson.bin === 'string'
|
|
53
|
+
? packageJson.bin
|
|
54
|
+
: packageJson.bin[executable];
|
|
55
|
+
const binPath = path.join(rootDir, binProp);
|
|
56
|
+
return binPath;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=resolve-bin.js.map
|
package/dist/utils/utils.js
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Converts a 24-hour time string to a 12-hour time string with AM/PM.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} timing - The value of the timing en miliseconds.
|
|
5
|
+
* @returns {string} the timing in ms, seconds, minutes or hours.
|
|
6
|
+
*/
|
|
7
|
+
export const showTimingForHumans = (timing) => {
|
|
8
|
+
if (timing < 1000) {
|
|
9
|
+
return `${timing} ms`;
|
|
10
|
+
}
|
|
11
|
+
else if (timing < 60000) {
|
|
12
|
+
return `${timing / 1000} s`;
|
|
13
|
+
}
|
|
14
|
+
else if (timing < 3600000) {
|
|
15
|
+
return `${timing / 60000} min`;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return `${timing / 3600000} h`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=utils.js.map
|