versacompiler 2.1.0 → 2.2.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 +844 -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 +466 -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 +106 -103
@@ -1,248 +1,442 @@
1
- import*as e from"node:fs";import*as t from"node:path";export const setupVueTypes=async(n,o={})=>{try{let{targetDir:s=`src/types`,createTsConfig:c=!1,enableStrictMode:l=!1,includeRouterTypes:u=!0,includePiniaTypes:d=!0}=o,f=t.join(n,s);e.existsSync(f)||e.mkdirSync(f,{recursive:!0});let p=t.join(f,`vue-shims.d.ts`);if(!e.existsSync(p)){let t=a();e.writeFileSync(p,t)}c&&await r(n,{enableStrictMode:l,includeRouterTypes:u,includePiniaTypes:d});let m=t.join(f,`global.d.ts`),h=i({includeRouterTypes:u,includePiniaTypes:d});return e.writeFileSync(m,h),!0}catch(e){return console.error(`Error setting up Vue types:`,e),!1}};const r=async(n,r)=>{let i=t.join(n,`tsconfig.json`),a={compilerOptions:{target:`esnext`,module:`esnext`,lib:[`esnext`,`dom`,`dom.iterable`],allowJs:!0,checkJs:!1,jsx:`preserve`,declaration:!0,declarationMap:!0,sourceMap:!0,outDir:`./dist`,removeComments:!0,importHelpers:!0,isolatedModules:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,useDefineForClassFields:!0,resolveJsonModule:!0,skipLibCheck:!0,moduleResolution:`node`,strict:r.enableStrictMode,noImplicitAny:r.enableStrictMode,noImplicitReturns:r.enableStrictMode,noImplicitThis:r.enableStrictMode,strictNullChecks:r.enableStrictMode,strictFunctionTypes:r.enableStrictMode,baseUrl:`.`,paths:{"/dist/examples/*":[`src/*`],"/dist/examples/types/*":[`src/types/*`]},types:[`node`,`vue/ref-macros`,...r.includeRouterTypes?[`@vue/router`]:[],...r.includePiniaTypes?[`pinia`]:[]]},include:[`src/**/*.ts`,`src/**/*.tsx`,`src/**/*.vue`,`src/types/**/*.d.ts`],exclude:[`node_modules`,`dist`],"ts-node":{esm:!0}};if(e.existsSync(i))try{let t=JSON.parse(e.readFileSync(i,`utf-8`)),n={...t,compilerOptions:{...t.compilerOptions,...a.compilerOptions},include:Array.from(new Set([...t.include||[],...a.include]))};e.writeFileSync(i,JSON.stringify(n,null,2))}catch{e.writeFileSync(i,JSON.stringify(a,null,2))}else e.writeFileSync(i,JSON.stringify(a,null,2))},i=e=>{let t=`/**
2
- * Tipos globales adicionales para el proyecto
3
- * Generado automáticamente por VersaCompiler
1
+ /**
2
+ * Utilidad para configurar automáticamente los tipos de Vue en proyectos
3
+ * Facilita la integración de tipado robusto para archivos Vue
4
4
  */
5
-
6
- // Extensiones para window object si es necesario
7
- declare global {
8
- interface Window {
9
- // Agregar propiedades globales si es necesario
10
- [key: string]: any;
5
+ import * as fs from 'node:fs';
6
+ import * as path from 'node:path';
7
+ /**
8
+ * Instala los archivos de tipos Vue en el proyecto
9
+ * @param projectRoot - Directorio raíz del proyecto
10
+ * @param config - Configuración para la instalación
11
+ */
12
+ export const setupVueTypes = async (projectRoot, config = {}) => {
13
+ try {
14
+ const { targetDir = 'src/types', createTsConfig = false, enableStrictMode = false, includeRouterTypes = true, includePiniaTypes = true, } = config;
15
+ const typesDir = path.join(projectRoot, targetDir);
16
+ // Crear directorio de tipos si no existe
17
+ if (!fs.existsSync(typesDir)) {
18
+ fs.mkdirSync(typesDir, { recursive: true });
19
+ } // Crear vue-shims.d.ts si no existe
20
+ const vueShimsPath = path.join(typesDir, 'vue-shims.d.ts');
21
+ if (!fs.existsSync(vueShimsPath)) {
22
+ const shimsContent = generateVueShimsContent();
23
+ fs.writeFileSync(vueShimsPath, shimsContent);
24
+ }
25
+ // Crear archivo de configuración específico del proyecto si se solicita
26
+ if (createTsConfig) {
27
+ await createProjectTsConfig(projectRoot, {
28
+ enableStrictMode,
29
+ includeRouterTypes,
30
+ includePiniaTypes,
31
+ });
32
+ }
33
+ // Crear archivo de entorno global para tipos adicionales
34
+ const globalTypesPath = path.join(typesDir, 'global.d.ts');
35
+ const globalTypesContent = generateGlobalTypes({
36
+ includeRouterTypes,
37
+ includePiniaTypes,
38
+ });
39
+ fs.writeFileSync(globalTypesPath, globalTypesContent);
40
+ return true;
41
+ }
42
+ catch (error) {
43
+ console.error('Error setting up Vue types:', error);
44
+ return false;
11
45
  }
12
- }
13
-
14
- // Tipos para archivos de assets
15
- declare module '*.svg' {
16
- const src: string;
17
- export default src;
18
- }
19
-
20
- declare module '*.png' {
21
- const src: string;
22
- export default src;
23
- }
24
-
25
- declare module '*.jpg' {
26
- const src: string;
27
- export default src;
28
- }
29
-
30
- declare module '*.jpeg' {
31
- const src: string;
32
- export default src;
33
- }
34
-
35
- declare module '*.webp' {
36
- const src: string;
37
- export default src;
38
- }
39
-
40
- declare module '*.gif' {
41
- const src: string;
42
- export default src;
43
- }
44
-
45
- declare module '*.ico' {
46
- const src: string;
47
- export default src;
48
- }
49
- `;return e.includeRouterTypes&&(t+=`
50
- // Vue Router tipos adicionales
51
- declare module '@vue/runtime-core' {
52
- interface ComponentCustomProperties {
53
- $route: import('vue-router').RouteLocationNormalized;
54
- $router: import('vue-router').Router;
46
+ };
47
+ /**
48
+ * Crea o actualiza tsconfig.json con configuración optimizada para Vue
49
+ */
50
+ const createProjectTsConfig = async (projectRoot, options) => {
51
+ const tsconfigPath = path.join(projectRoot, 'tsconfig.json');
52
+ const tsconfigContent = {
53
+ compilerOptions: {
54
+ target: 'esnext',
55
+ module: 'esnext',
56
+ lib: ['esnext', 'dom', 'dom.iterable'],
57
+ allowJs: true,
58
+ checkJs: false,
59
+ jsx: 'preserve',
60
+ declaration: true,
61
+ declarationMap: true,
62
+ sourceMap: true,
63
+ outDir: './dist',
64
+ removeComments: true,
65
+ importHelpers: true,
66
+ isolatedModules: true,
67
+ allowSyntheticDefaultImports: true,
68
+ esModuleInterop: true,
69
+ forceConsistentCasingInFileNames: true,
70
+ useDefineForClassFields: true,
71
+ resolveJsonModule: true,
72
+ skipLibCheck: true,
73
+ moduleResolution: 'node',
74
+ // Configuraciones de strictness
75
+ strict: options.enableStrictMode,
76
+ noImplicitAny: options.enableStrictMode,
77
+ noImplicitReturns: options.enableStrictMode,
78
+ noImplicitThis: options.enableStrictMode,
79
+ strictNullChecks: options.enableStrictMode,
80
+ strictFunctionTypes: options.enableStrictMode,
81
+ // Paths para tipos
82
+ baseUrl: '.',
83
+ paths: {
84
+ '/dist/examples/*': ['src/*'],
85
+ '/dist/examples/types/*': ['src/types/*'],
86
+ },
87
+ types: [
88
+ 'node',
89
+ 'vue/ref-macros',
90
+ ...(options.includeRouterTypes ? ['@vue/router'] : []),
91
+ ...(options.includePiniaTypes ? ['pinia'] : []),
92
+ ],
93
+ },
94
+ include: [
95
+ 'src/**/*.ts',
96
+ 'src/**/*.tsx',
97
+ 'src/**/*.vue',
98
+ 'src/types/**/*.d.ts',
99
+ ],
100
+ exclude: ['node_modules', 'dist'],
101
+ 'ts-node': {
102
+ esm: true,
103
+ },
104
+ };
105
+ // Si ya existe tsconfig.json, hacer merge inteligente
106
+ if (fs.existsSync(tsconfigPath)) {
107
+ try {
108
+ const existingConfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf-8'));
109
+ const mergedConfig = {
110
+ ...existingConfig,
111
+ compilerOptions: {
112
+ ...existingConfig.compilerOptions,
113
+ ...tsconfigContent.compilerOptions,
114
+ },
115
+ include: Array.from(new Set([
116
+ ...(existingConfig.include || []),
117
+ ...tsconfigContent.include,
118
+ ])),
119
+ };
120
+ fs.writeFileSync(tsconfigPath, JSON.stringify(mergedConfig, null, 2));
121
+ }
122
+ catch {
123
+ // Si hay error parseando, crear nuevo archivo
124
+ fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfigContent, null, 2));
125
+ }
55
126
  }
56
- }
57
- `),e.includePiniaTypes&&(t+=`
58
- // Pinia tipos adicionales
59
- declare module '@vue/runtime-core' {
60
- interface ComponentCustomProperties {
61
- $pinia: import('pinia').Pinia;
127
+ else {
128
+ fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfigContent, null, 2));
62
129
  }
63
- }
64
- `),t+=`
65
- export {};`,t},a=()=>`/**
66
- * Declaraciones de tipos Vue para VersaCompiler
67
- * Proporciona tipado robusto para archivos Vue
130
+ };
131
+ /**
132
+ * Genera tipos globales adicionales basados en las opciones
68
133
  */
69
-
70
- /// <reference types="vue/ref-macros" />
71
- /// <reference types="vue/reactivity-transform/macros" />
72
-
73
- declare module '*.vue' {
74
- import type { DefineComponent } from 'vue';
75
- const component: DefineComponent<{}, {}, any>;
76
- export default component;
77
- }
78
-
79
- // Declaraciones globales para Composition API
80
- declare global {
81
- // Reactivity API
82
- function ref<T>(value: T): { value: T };
83
- function reactive<T extends object>(target: T): T;
84
- function computed<T>(getter: () => T): { value: T };
85
- function readonly<T>(target: T): T;
86
- function unref<T>(ref: T): T extends { value: infer V } ? V : T;
87
- function toRef<T, K extends keyof T>(object: T, key: K): { value: T[K] };
88
- function toRefs<T extends object>(
89
- object: T,
90
- ): { [K in keyof T]: { value: T[K] } };
91
- function isRef<T>(ref: any): ref is { value: T };
92
- function isReactive(value: any): boolean;
93
- function isReadonly(value: any): boolean;
94
- function isProxy(value: any): boolean;
95
- function shallowRef<T>(value: T): { value: T };
96
- function shallowReactive<T extends object>(target: T): T;
97
- function shallowReadonly<T>(target: T): T;
98
- function toRaw<T>(observed: T): T;
99
- function markRaw<T>(value: T): T;
100
- function triggerRef<T>(ref: { value: T }): void;
101
-
102
- // Component API
103
- function defineComponent<T extends Record<string, any>>(options: T): T;
104
- function defineAsyncComponent<T>(loader: () => Promise<T>): T;
105
-
106
- // Props & Emits
107
- function defineProps<T = {}>(): T;
108
- function defineEmits<T extends Record<string, any> = {}>(): T;
109
- function defineExpose<T = {}>(exposed: T): void;
110
- function defineModel<T>(modelName?: string): { value: T };
111
- function withDefaults<T, D>(props: T, defaults: D): T & D;
112
-
113
- // Lifecycle Hooks
114
- function onBeforeMount(hook: () => void): void;
115
- function onMounted(hook: () => void): void;
116
- function onBeforeUpdate(hook: () => void): void;
117
- function onUpdated(hook: () => void): void;
118
- function onBeforeUnmount(hook: () => void): void;
119
- function onUnmounted(hook: () => void): void;
120
- function onActivated(hook: () => void): void;
121
- function onDeactivated(hook: () => void): void;
122
- function onErrorCaptured(
123
- hook: (err: Error, instance: any, info: string) => boolean | void,
124
- ): void;
125
- function onRenderTracked(hook: (event: any) => void): void;
126
- function onRenderTriggered(hook: (event: any) => void): void;
127
- function onServerPrefetch(hook: () => Promise<any>): void;
128
-
129
- // Dependency Injection
130
- function provide<T>(key: string | symbol, value: T): void;
131
- function inject<T>(key: string | symbol, defaultValue?: T): T | undefined;
132
-
133
- // Template Refs
134
- function templateRef<T = any>(key?: string): { value: T | null };
135
-
136
- // Watchers
137
- type WatchCallback<T> = (newValue: T, oldValue: T) => void;
138
- type WatchStopHandle = () => void;
139
- function watch<T>(
140
- source: () => T,
141
- callback: WatchCallback<T>,
142
- options?: any,
143
- ): WatchStopHandle;
144
- function watchEffect(effect: () => void, options?: any): WatchStopHandle;
145
- function watchPostEffect(
146
- effect: () => void,
147
- options?: any,
148
- ): WatchStopHandle;
149
- function watchSyncEffect(
150
- effect: () => void,
151
- options?: any,
152
- ): WatchStopHandle;
153
-
154
- // Utilities
155
- function nextTick(callback?: () => void): Promise<void>;
156
- function useSlots(): { [key: string]: (...args: any[]) => any };
157
- function useAttrs(): { [key: string]: any };
158
- function useModel<T>(modelName?: string): { value: T };
159
- function useCssModule(name?: string): { [key: string]: string };
160
- function useCssVars(vars: Record<string, string>): void;
161
-
162
- // Advanced Reactivity
163
- function customRef<T>(
164
- factory: (
165
- track: () => void,
166
- trigger: () => void,
167
- ) => { get: () => T; set: (value: T) => void },
168
- ): { value: T };
169
- function effectScope(): any;
170
- function getCurrentScope(): any;
171
- function onScopeDispose(fn: () => void): void;
172
-
173
- // Component Instance
174
- function getCurrentInstance(): any;
175
- function hasInjectionContext(): boolean;
176
-
177
- // Vue Router (common imports)
178
- function useRouter(): any;
179
- function useRoute(): any;
180
-
181
- // Pinia (common imports)
182
- function useStore(): any;
183
- function defineStore(id: string, setup: () => any): any;
184
-
185
- // Legacy Options API support
186
- interface ComponentOptions {
187
- name?: string;
188
- props?: any;
189
- data?: () => any;
190
- computed?: any;
191
- methods?: any;
192
- watch?: any;
193
- emits?: any;
194
- setup?: any;
195
- [key: string]: any;
134
+ const generateGlobalTypes = (options) => {
135
+ let content = `/**
136
+ * Tipos globales adicionales para el proyecto
137
+ * Generado automáticamente por VersaCompiler
138
+ */
139
+
140
+ // Extensiones para window object si es necesario
141
+ declare global {
142
+ interface Window {
143
+ // Agregar propiedades globales si es necesario
144
+ [key: string]: any;
145
+ }
146
+ }
147
+
148
+ // Tipos para archivos de assets
149
+ declare module '*.svg' {
150
+ const src: string;
151
+ export default src;
152
+ }
153
+
154
+ declare module '*.png' {
155
+ const src: string;
156
+ export default src;
157
+ }
158
+
159
+ declare module '*.jpg' {
160
+ const src: string;
161
+ export default src;
162
+ }
163
+
164
+ declare module '*.jpeg' {
165
+ const src: string;
166
+ export default src;
167
+ }
168
+
169
+ declare module '*.webp' {
170
+ const src: string;
171
+ export default src;
172
+ }
173
+
174
+ declare module '*.gif' {
175
+ const src: string;
176
+ export default src;
177
+ }
178
+
179
+ declare module '*.ico' {
180
+ const src: string;
181
+ export default src;
182
+ }
183
+ `;
184
+ if (options.includeRouterTypes) {
185
+ content += `
186
+ // Vue Router tipos adicionales
187
+ declare module '@vue/runtime-core' {
188
+ interface ComponentCustomProperties {
189
+ $route: import('vue-router').RouteLocationNormalized;
190
+ $router: import('vue-router').Router;
191
+ }
192
+ }
193
+ `;
194
+ }
195
+ if (options.includePiniaTypes) {
196
+ content += `
197
+ // Pinia tipos adicionales
198
+ declare module '@vue/runtime-core' {
199
+ interface ComponentCustomProperties {
200
+ $pinia: import('pinia').Pinia;
201
+ }
202
+ }
203
+ `;
204
+ }
205
+ content += '\nexport {};';
206
+ return content;
207
+ };
208
+ /**
209
+ * Genera el contenido del archivo vue-shims.d.ts
210
+ * @returns El contenido completo del archivo de shims
211
+ */
212
+ const generateVueShimsContent = () => {
213
+ return `/**
214
+ * Declaraciones de tipos Vue para VersaCompiler
215
+ * Proporciona tipado robusto para archivos Vue
216
+ */
217
+
218
+ /// <reference types="vue/ref-macros" />
219
+ /// <reference types="vue/reactivity-transform/macros" />
220
+
221
+ declare module '*.vue' {
222
+ import type { DefineComponent } from 'vue';
223
+ const component: DefineComponent<{}, {}, any>;
224
+ export default component;
225
+ }
226
+
227
+ // Declaraciones globales para Composition API
228
+ declare global {
229
+ // Reactivity API
230
+ function ref<T>(value: T): { value: T };
231
+ function reactive<T extends object>(target: T): T;
232
+ function computed<T>(getter: () => T): { value: T };
233
+ function readonly<T>(target: T): T;
234
+ function unref<T>(ref: T): T extends { value: infer V } ? V : T;
235
+ function toRef<T, K extends keyof T>(object: T, key: K): { value: T[K] };
236
+ function toRefs<T extends object>(
237
+ object: T,
238
+ ): { [K in keyof T]: { value: T[K] } };
239
+ function isRef<T>(ref: any): ref is { value: T };
240
+ function isReactive(value: any): boolean;
241
+ function isReadonly(value: any): boolean;
242
+ function isProxy(value: any): boolean;
243
+ function shallowRef<T>(value: T): { value: T };
244
+ function shallowReactive<T extends object>(target: T): T;
245
+ function shallowReadonly<T>(target: T): T;
246
+ function toRaw<T>(observed: T): T;
247
+ function markRaw<T>(value: T): T;
248
+ function triggerRef<T>(ref: { value: T }): void;
249
+
250
+ // Component API
251
+ function defineComponent<T extends Record<string, any>>(options: T): T;
252
+ function defineAsyncComponent<T>(loader: () => Promise<T>): T;
253
+
254
+ // Props & Emits
255
+ function defineProps<T = {}>(): T;
256
+ function defineEmits<T extends Record<string, any> = {}>(): T;
257
+ function defineExpose<T = {}>(exposed: T): void;
258
+ function defineModel<T>(modelName?: string): { value: T };
259
+ function withDefaults<T, D>(props: T, defaults: D): T & D;
260
+
261
+ // Lifecycle Hooks
262
+ function onBeforeMount(hook: () => void): void;
263
+ function onMounted(hook: () => void): void;
264
+ function onBeforeUpdate(hook: () => void): void;
265
+ function onUpdated(hook: () => void): void;
266
+ function onBeforeUnmount(hook: () => void): void;
267
+ function onUnmounted(hook: () => void): void;
268
+ function onActivated(hook: () => void): void;
269
+ function onDeactivated(hook: () => void): void;
270
+ function onErrorCaptured(
271
+ hook: (err: Error, instance: any, info: string) => boolean | void,
272
+ ): void;
273
+ function onRenderTracked(hook: (event: any) => void): void;
274
+ function onRenderTriggered(hook: (event: any) => void): void;
275
+ function onServerPrefetch(hook: () => Promise<any>): void;
276
+
277
+ // Dependency Injection
278
+ function provide<T>(key: string | symbol, value: T): void;
279
+ function inject<T>(key: string | symbol, defaultValue?: T): T | undefined;
280
+
281
+ // Template Refs
282
+ function templateRef<T = any>(key?: string): { value: T | null };
283
+
284
+ // Watchers
285
+ type WatchCallback<T> = (newValue: T, oldValue: T) => void;
286
+ type WatchStopHandle = () => void;
287
+ function watch<T>(
288
+ source: () => T,
289
+ callback: WatchCallback<T>,
290
+ options?: any,
291
+ ): WatchStopHandle;
292
+ function watchEffect(effect: () => void, options?: any): WatchStopHandle;
293
+ function watchPostEffect(
294
+ effect: () => void,
295
+ options?: any,
296
+ ): WatchStopHandle;
297
+ function watchSyncEffect(
298
+ effect: () => void,
299
+ options?: any,
300
+ ): WatchStopHandle;
301
+
302
+ // Utilities
303
+ function nextTick(callback?: () => void): Promise<void>;
304
+ function useSlots(): { [key: string]: (...args: any[]) => any };
305
+ function useAttrs(): { [key: string]: any };
306
+ function useModel<T>(modelName?: string): { value: T };
307
+ function useCssModule(name?: string): { [key: string]: string };
308
+ function useCssVars(vars: Record<string, string>): void;
309
+
310
+ // Advanced Reactivity
311
+ function customRef<T>(
312
+ factory: (
313
+ track: () => void,
314
+ trigger: () => void,
315
+ ) => { get: () => T; set: (value: T) => void },
316
+ ): { value: T };
317
+ function effectScope(): any;
318
+ function getCurrentScope(): any;
319
+ function onScopeDispose(fn: () => void): void;
320
+
321
+ // Component Instance
322
+ function getCurrentInstance(): any;
323
+ function hasInjectionContext(): boolean;
324
+
325
+ // Vue Router (common imports)
326
+ function useRouter(): any;
327
+ function useRoute(): any;
328
+
329
+ // Pinia (common imports)
330
+ function useStore(): any;
331
+ function defineStore(id: string, setup: () => any): any;
332
+
333
+ // Legacy Options API support
334
+ interface ComponentOptions {
335
+ name?: string;
336
+ props?: any;
337
+ data?: () => any;
338
+ computed?: any;
339
+ methods?: any;
340
+ watch?: any;
341
+ emits?: any;
342
+ setup?: any;
343
+ [key: string]: any;
344
+ }
345
+
346
+ // Vue 3 specific APIs
347
+ function createApp(rootComponent: any, rootProps?: any): any;
348
+ function defineCustomElement(options: any): any;
349
+ function mergeModels<T>(models: T): T;
350
+ }
351
+
352
+ // Module augmentation for common Vue ecosystem types
353
+ declare module '@vue/runtime-core' {
354
+ interface ComponentCustomProperties {
355
+ $route: any;
356
+ $router: any;
357
+ $store: any;
358
+ [key: string]: any;
359
+ }
360
+ }
361
+
362
+ // Support for .vue files in TypeScript
363
+ declare module '*.vue' {
364
+ import type { DefineComponent } from 'vue';
365
+ const component: DefineComponent<{}, {}, any>;
366
+ export default component;
367
+ }
368
+
369
+ // CSS Modules support
370
+ declare module '*.module.css' {
371
+ const classes: { [key: string]: string };
372
+ export default classes;
373
+ }
374
+
375
+ declare module '*.module.scss' {
376
+ const classes: { [key: string]: string };
377
+ export default classes;
378
+ }
379
+
380
+ declare module '*.module.sass' {
381
+ const classes: { [key: string]: string };
382
+ export default classes;
383
+ }
384
+
385
+ declare module '*.module.less' {
386
+ const classes: { [key: string]: string };
387
+ export default classes;
388
+ }
389
+
390
+ declare module '*.module.styl' {
391
+ const classes: { [key: string]: string };
392
+ export default classes;
393
+ }
394
+
395
+ export {};
396
+ `;
397
+ };
398
+ /**
399
+ * Verifica si el proyecto ya tiene tipos Vue configurados
400
+ */
401
+ export const hasVueTypesSetup = (projectRoot) => {
402
+ const typesDir = path.join(projectRoot, 'src/types');
403
+ const vueShimsPath = path.join(typesDir, 'vue-shims.d.ts');
404
+ return fs.existsSync(vueShimsPath);
405
+ };
406
+ /**
407
+ * Configuración automática para proyectos Vue detectados
408
+ */
409
+ export const autoSetupVueTypes = async (projectRoot) => {
410
+ // Verificar si es un proyecto Vue
411
+ const packageJsonPath = path.join(projectRoot, 'package.json');
412
+ if (!fs.existsSync(packageJsonPath)) {
413
+ return false;
414
+ }
415
+ try {
416
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
417
+ const hasVue = packageJson.dependencies?.vue || packageJson.devDependencies?.vue;
418
+ if (!hasVue) {
419
+ return false;
420
+ }
421
+ // Si ya tiene tipos configurados, no hacer nada
422
+ if (hasVueTypesSetup(projectRoot)) {
423
+ return true;
424
+ }
425
+ // Detectar qué librerías adicionales usar
426
+ const hasRouter = packageJson.dependencies?.['vue-router'] ||
427
+ packageJson.devDependencies?.['vue-router'];
428
+ const hasPinia = packageJson.dependencies?.pinia ||
429
+ packageJson.devDependencies?.pinia;
430
+ // Configurar tipos automáticamente
431
+ return await setupVueTypes(projectRoot, {
432
+ createTsConfig: !fs.existsSync(path.join(projectRoot, 'tsconfig.json')),
433
+ includeRouterTypes: !!hasRouter,
434
+ includePiniaTypes: !!hasPinia,
435
+ });
196
436
  }
197
-
198
- // Vue 3 specific APIs
199
- function createApp(rootComponent: any, rootProps?: any): any;
200
- function defineCustomElement(options: any): any;
201
- function mergeModels<T>(models: T): T;
202
- }
203
-
204
- // Module augmentation for common Vue ecosystem types
205
- declare module '@vue/runtime-core' {
206
- interface ComponentCustomProperties {
207
- $route: any;
208
- $router: any;
209
- $store: any;
210
- [key: string]: any;
437
+ catch (error) {
438
+ console.error('Error in auto-setup Vue types:', error);
439
+ return false;
211
440
  }
212
- }
213
-
214
- // Support for .vue files in TypeScript
215
- declare module '*.vue' {
216
- import type { DefineComponent } from 'vue';
217
- const component: DefineComponent<{}, {}, any>;
218
- export default component;
219
- }
220
-
221
- // CSS Modules support
222
- declare module '*.module.css' {
223
- const classes: { [key: string]: string };
224
- export default classes;
225
- }
226
-
227
- declare module '*.module.scss' {
228
- const classes: { [key: string]: string };
229
- export default classes;
230
- }
231
-
232
- declare module '*.module.sass' {
233
- const classes: { [key: string]: string };
234
- export default classes;
235
- }
236
-
237
- declare module '*.module.less' {
238
- const classes: { [key: string]: string };
239
- export default classes;
240
- }
241
-
242
- declare module '*.module.styl' {
243
- const classes: { [key: string]: string };
244
- export default classes;
245
- }
246
-
247
- export {};
248
- `;export const hasVueTypesSetup=n=>{let r=t.join(n,`src/types`),i=t.join(r,`vue-shims.d.ts`);return e.existsSync(i)};export const autoSetupVueTypes=async r=>{let i=t.join(r,`package.json`);if(!e.existsSync(i))return!1;try{let a=JSON.parse(e.readFileSync(i,`utf-8`));if(!(a.dependencies?.vue||a.devDependencies?.vue))return!1;if(hasVueTypesSetup(r))return!0;let s=a.dependencies?.[`vue-router`]||a.devDependencies?.[`vue-router`],c=a.dependencies?.pinia||a.devDependencies?.pinia;return await setupVueTypes(r,{createTsConfig:!e.existsSync(t.join(r,`tsconfig.json`)),includeRouterTypes:!!s,includePiniaTypes:!!c})}catch(e){return console.error(`Error in auto-setup Vue types:`,e),!1}};
441
+ };
442
+ //# sourceMappingURL=vue-types-setup.js.map