vatts 2.2.0-canary.0.9.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.
- package/dist/vue/image/Image.vue +5 -3
- package/package.json +1 -1
package/dist/vue/image/Image.vue
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
<script setup>
|
|
19
19
|
import { computed } from 'vue';
|
|
20
|
-
import React from "react";
|
|
21
20
|
|
|
22
21
|
const props = defineProps({
|
|
23
22
|
src: {
|
|
@@ -48,11 +47,14 @@ const getBaseUrl = () => {
|
|
|
48
47
|
const optimizedSrc = computed(() => {
|
|
49
48
|
const baseUrl = getBaseUrl();
|
|
50
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
|
|
51
55
|
if(!src || (typeof src === "object" && src && (src.length === 0 || Object.keys(src).length === 0))) {
|
|
52
56
|
return null;
|
|
53
57
|
}
|
|
54
|
-
// Normaliza o prop `src` caso venha como um objeto (ex: import de asset que retorna { src, width, height })
|
|
55
|
-
const src = (rawSrc && typeof rawSrc === 'string') ? rawSrc : (rawSrc && typeof rawSrc === 'object' ? (rawSrc.src || rawSrc.default || String(rawSrc)) : rawSrc);
|
|
56
58
|
|
|
57
59
|
// Detecta se estamos em modo de export estático (SSG). Neste caso o endpoint de otimização não estará disponível
|
|
58
60
|
const isExportMode =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vatts",
|
|
3
|
-
"version": "2.2.0
|
|
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",
|