vatts 1.2.0-test.4 → 1.2.0-test.5

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 (2) hide show
  1. package/dist/builder.js +19 -17
  2. package/package.json +1 -1
package/dist/builder.js CHANGED
@@ -89,22 +89,25 @@ const markdownPlugin = () => {
89
89
  };
90
90
  };
91
91
  /**
92
- * NOVO: Plugin de DEBUG para arquivos Vue+TS Virtuais
93
- * Esse cara vai logar no console exatamente o que passando de um plugin pro outro.
92
+ * [CORREÇÃO] Plugin que injeta 'export default {}' se estiver faltando.
93
+ * Resolve o problema de rotas que exportam apenas 'config' mas não o componente.
94
94
  */
95
- const vueTsDebugPlugin = () => {
95
+ const vueScriptFixPlugin = () => {
96
96
  return {
97
- name: 'vatts-vue-ts-debug',
97
+ name: 'vatts-vue-script-fix',
98
98
  transform(code, id) {
99
- // Intercepta especificamente o arquivo virtual de script TS do Vue
100
- if (id.includes('?vue&type=script&lang.ts')) {
101
- Console.warn(`\n================= [DEBUG VUE TS] =================`);
102
- Console.warn(`Arquivo Virtual: ${id}`);
103
- Console.warn(`--- Código Original (Primeiras 10 linhas) ---`);
104
- Console.warn(code.split('\n').slice(0, 10).join('\n'));
105
- Console.warn(`==================================================\n`);
99
+ // Intercepta arquivos virtuais de script TS do Vue
100
+ if (id.includes('?vue&type=script') && id.includes('lang.ts')) {
101
+ // Se o código NÃO tem export default, a gente cria um objeto vazio
102
+ // Isso satisfaz o Rollup/Vue Plugin que espera um componente
103
+ if (!code.includes('export default')) {
104
+ return {
105
+ code: code + '\nexport default {};',
106
+ map: null // Sourcemap null pra simplificar
107
+ };
108
+ }
106
109
  }
107
- return null; // Não altera o código, só inspeciona
110
+ return null;
108
111
  }
109
112
  };
110
113
  };
@@ -294,7 +297,7 @@ const smartAssetPlugin = (isProduction) => {
294
297
  };
295
298
  };
296
299
  /**
297
- * Gera a configuração base do Rollup (Agora Async e Estrita)
300
+ * Gera a configuração base do Rollup
298
301
  */
299
302
  async function createRollupConfig(entryPoint, outdir, isProduction) {
300
303
  const framework = detectFramework();
@@ -338,10 +341,9 @@ async function createRollupConfig(entryPoint, outdir, isProduction) {
338
341
  if (hasVue) {
339
342
  extensions = ['.vue', ...extensions];
340
343
  }
341
- // CORREÇÃO CRÍTICA AQUI: O Regex precisa aceitar "?vue&type=script&lang.ts"
344
+ // REGEX ESSENCIAL: Permite que o ESBuild processe os arquivos virtuais do Vue
342
345
  let esbuildInclude;
343
346
  if (hasVue) {
344
- // Captura TS, TSX, JS, JSX E os scripts TS virtuais do Vue
345
347
  esbuildInclude = /\.[jt]sx?$|\.vue\?vue.*lang\.ts/;
346
348
  }
347
349
  else {
@@ -394,8 +396,8 @@ async function createRollupConfig(entryPoint, outdir, isProduction) {
394
396
  dedupe: hasReact ? ['react', 'react-dom'] : (hasVue ? ['vue'] : [])
395
397
  }),
396
398
  ...(hasVue && vuePlugin ? [vuePlugin] : []),
397
- // INSIRA O DEBUG AQUI: Logo depois do plugin do Vue e antes do ESBuild
398
- ...(hasVue ? [vueTsDebugPlugin()] : []),
399
+ // AQUI ESTÁ A MÁGICA: Plugin que corrige a falta do export default
400
+ ...(hasVue ? [vueScriptFixPlugin()] : []),
399
401
  commonjs({
400
402
  sourceMap: !isProduction,
401
403
  requireReturnsDefault: 'auto',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vatts",
3
- "version": "1.2.0-test.4",
3
+ "version": "1.2.0-test.5",
4
4
  "description": "Vatts.js is a high-level framework for building web applications with ease and speed. It provides a robust set of tools and features to streamline development and enhance productivity.",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "itsmuzin",