vatts 2.2.0-canary.0.9.1 → 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.
@@ -47,11 +47,14 @@ const getBaseUrl = () => {
47
47
  const optimizedSrc = computed(() => {
48
48
  const baseUrl = getBaseUrl();
49
49
  const { src: rawSrc, quality, width, height } = props;
50
+
51
+ // Normaliza o prop `src` primeiro para evitar o erro de inicialização
52
+ const src = (rawSrc && typeof rawSrc === 'string') ? rawSrc : (rawSrc && typeof rawSrc === 'object' ? (rawSrc.src || rawSrc.default || String(rawSrc)) : rawSrc);
53
+
54
+ // Agora a verificação do valor normalizado funciona perfeitamente
50
55
  if(!src || (typeof src === "object" && src && (src.length === 0 || Object.keys(src).length === 0))) {
51
56
  return null;
52
57
  }
53
- // Normaliza o prop `src` caso venha como um objeto (ex: import de asset que retorna { src, width, height })
54
- const src = (rawSrc && typeof rawSrc === 'string') ? rawSrc : (rawSrc && typeof rawSrc === 'object' ? (rawSrc.src || rawSrc.default || String(rawSrc)) : rawSrc);
55
58
 
56
59
  // Detecta se estamos em modo de export estático (SSG). Neste caso o endpoint de otimização não estará disponível
57
60
  const isExportMode =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vatts",
3
- "version": "2.2.0-canary.0.9.1",
3
+ "version": "2.2.0",
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": "mfraz",