vatts 1.2.0-test.1 → 1.2.0-test.3

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/loaders.js +8 -5
  2. package/package.json +1 -1
package/dist/loaders.js CHANGED
@@ -123,14 +123,17 @@ function registerLoaders(options = {}) {
123
123
  isProd: false,
124
124
  inlineTemplate: false
125
125
  });
126
- // Lógica de substituição do export default
127
- // 1. Procura por "export default" (com ou sem espaços extras)
128
- if (compiledScript.content.match(/export\s+default/)) {
126
+ // Lógica de substituição corrigida para evitar dupla declaração
127
+ if (compiledScript.content.includes('const _sfc_main =')) {
128
+ // O compilador do Vue já declarou o _sfc_main (comum no script setup)
129
+ scriptContent = compiledScript.content;
130
+ }
131
+ else if (compiledScript.content.match(/export\s+default/)) {
132
+ // Substitui export default tradicional
129
133
  scriptContent = compiledScript.content.replace(/export\s+default/, 'const _sfc_main =');
130
134
  }
131
135
  else {
132
- // 2. Se não achou export default (ex: arquivo tem "export const config"),
133
- // mantemos o conteúdo original e ADICIONAMOS a definição do _sfc_main manualmente.
136
+ // Se não achou export default e o Vue não declarou o _sfc_main, nós criamos um vazio
134
137
  scriptContent = compiledScript.content + '\nconst _sfc_main = {};';
135
138
  }
136
139
  bindings = compiledScript.bindings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vatts",
3
- "version": "1.2.0-test.1",
3
+ "version": "1.2.0-test.3",
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",