vatts 1.1.4-alpha.6 → 1.1.4-alpha.7

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.
@@ -11,7 +11,16 @@ const Image = ({ src, width, height, quality = 75, priority = false, className,
11
11
  console.log(baseUrl);
12
12
  // Se a imagem for Base64 (pequena) ou externa (http), não otimizamos via backend local
13
13
  const isOptimizable = src && src.startsWith && !src.startsWith('data:') && ((baseUrl && src.startsWith(baseUrl)) || !src.startsWith('http'));
14
- let optimizedSrc = baseUrl ? (src.includes(baseUrl) ? src.replace(baseUrl, '/') : src) : src;
14
+ function optimizeSrc(src, baseUrl) {
15
+ if (!baseUrl)
16
+ return src;
17
+ if (src.startsWith(baseUrl)) {
18
+ return src.slice(baseUrl.length) || '/';
19
+ }
20
+ return src;
21
+ }
22
+ let optimizedSrc = optimizeSrc(src, baseUrl);
23
+ console.log(optimizedSrc);
15
24
  if (isOptimizable) {
16
25
  const params = new URLSearchParams();
17
26
  params.set('url', src);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vatts",
3
- "version": "1.1.4-alpha.6",
3
+ "version": "1.1.4-alpha.7",
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",