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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/compiler/compile.js +2520 -25
  3. package/dist/compiler/error-reporter.js +467 -38
  4. package/dist/compiler/linter.js +72 -1
  5. package/dist/compiler/minify.js +272 -1
  6. package/dist/compiler/minifyTemplate.js +230 -1
  7. package/dist/compiler/module-resolution-optimizer.js +888 -1
  8. package/dist/compiler/parser.js +336 -1
  9. package/dist/compiler/performance-monitor.js +204 -56
  10. package/dist/compiler/tailwindcss.js +39 -1
  11. package/dist/compiler/transform-optimizer.js +392 -1
  12. package/dist/compiler/transformTStoJS.js +16 -1
  13. package/dist/compiler/transforms.js +554 -1
  14. package/dist/compiler/typescript-compiler.js +172 -2
  15. package/dist/compiler/typescript-error-parser.js +281 -10
  16. package/dist/compiler/typescript-manager.js +304 -2
  17. package/dist/compiler/typescript-sync-validator.js +295 -31
  18. package/dist/compiler/typescript-worker-pool.js +936 -1
  19. package/dist/compiler/typescript-worker-thread.cjs +466 -22
  20. package/dist/compiler/typescript-worker.js +339 -1
  21. package/dist/compiler/vuejs.js +396 -37
  22. package/dist/hrm/VueHRM.js +359 -1
  23. package/dist/hrm/errorScreen.js +83 -1
  24. package/dist/hrm/getInstanciaVue.js +313 -1
  25. package/dist/hrm/initHRM.js +586 -1
  26. package/dist/main.js +353 -7
  27. package/dist/servicios/browserSync.js +589 -2
  28. package/dist/servicios/file-watcher.js +425 -4
  29. package/dist/servicios/logger.js +63 -3
  30. package/dist/servicios/readConfig.js +399 -53
  31. package/dist/utils/excluded-modules.js +37 -1
  32. package/dist/utils/module-resolver.js +552 -1
  33. package/dist/utils/promptUser.js +48 -2
  34. package/dist/utils/proxyValidator.js +68 -1
  35. package/dist/utils/resolve-bin.js +58 -1
  36. package/dist/utils/utils.js +21 -1
  37. package/dist/utils/vue-types-setup.js +435 -241
  38. package/dist/wrappers/eslint-node.js +1 -1
  39. package/dist/wrappers/oxlint-node.js +122 -1
  40. package/dist/wrappers/tailwind-node.js +94 -1
  41. package/package.json +109 -104
@@ -1 +1,68 @@
1
- import{get as e}from"node:http";import{get as t}from"node:https";import{URL as n}from"node:url";export async function validateProxyAvailability(r,i=5e3){return new Promise(a=>{try{let o=new n(r),s=o.protocol===`https:`,c=(s?t:e)({hostname:o.hostname,port:o.port||(s?443:80),path:`/`,method:`HEAD`,timeout:i,headers:{"User-Agent":`VersaCompiler-ProxyValidator/1.0`}},e=>{a(!0)});c.on(`error`,()=>{a(!1)}),c.on(`timeout`,()=>{c.destroy(),a(!1)}),c.setTimeout(i),c.end()}catch{a(!1)}})}export function getProxyInfo(e){try{let t=new n(e);return{host:t.hostname,port:t.port||(t.protocol===`https:`?`443`:`80`),protocol:t.protocol.replace(`:`,``)}}catch{return{host:`unknown`,port:`unknown`,protocol:`unknown`}}}
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 e from"node:path";import*as t from"node:process";import n from"find-root";import r from"fs-extra";function i(t,n){for(let i of n)try{let n=e.join(i,`node_modules`,t);if(r.existsSync(n))return n}catch{}throw Error(`Cannot resolve module ${t} from paths: ${n.join(`, `)}`)}export function resolveBin(a,{executable:o=a,paths:s=[t.cwd()]}={}){let c;try{c=n(i(a,s))}catch{let n=s[0]||t.cwd(),i=e.join(n,`node_modules`,a,`package.json`);if(r.existsSync(i))c=e.dirname(i);else throw Error(`Cannot resolve module ${a}`)}let l=e.join(c,`package.json`),u=r.readJsonSync(l);if(!u.bin)throw Error(`no bin found in ${u.name}@${u.version} in path ${l}`);let d=typeof u.bin==`string`?u.bin:u.bin[o];return e.join(c,d)}
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
@@ -1 +1,21 @@
1
- export const showTimingForHumans=e=>e<1e3?`${e} ms`:e<6e4?`${e/1e3} s`:e<36e5?`${e/6e4} min`:`${e/36e5} h`;
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