cloudflare-next-intl 0.9.2 → 0.9.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.
@@ -49,14 +49,35 @@ function findEntry(srcVal) {
49
49
  }
50
50
  return undefined;
51
51
  }
52
- function retargetSrcSet(srcSet, fromSrc, toSrc) {
53
- if (!srcSet)
54
- return srcSet;
55
- const fromEncoded = encodeURIComponent(fromSrc);
56
- const toEncoded = encodeURIComponent(toSrc);
57
- return srcSet
58
- .split(fromEncoded).join(toEncoded)
59
- .split(fromSrc).join(toSrc);
52
+ function toPlainImgAttrs(resolved, src) {
53
+ const { src: _src, alt, width, height, fill: _fill, loader: _loader, quality: _quality, preload: _preload, priority, placeholder: _placeholder, blurDataURL: _blurDataURL, unoptimized: _unoptimized, overrideSrc: _overrideSrc, onLoadingComplete: _onLoadingComplete, layout: _layout, objectFit: _objectFit, objectPosition: _objectPosition, lazyBoundary: _lazyBoundary, lazyRoot: _lazyRoot, loading, style, className, sizes, ...rest } = resolved;
54
+ void _src;
55
+ void _fill;
56
+ void _loader;
57
+ void _quality;
58
+ void _preload;
59
+ void _placeholder;
60
+ void _blurDataURL;
61
+ void _unoptimized;
62
+ void _overrideSrc;
63
+ void _onLoadingComplete;
64
+ void _layout;
65
+ void _objectFit;
66
+ void _objectPosition;
67
+ void _lazyBoundary;
68
+ void _lazyRoot;
69
+ return {
70
+ ...rest,
71
+ src,
72
+ alt: alt ?? "",
73
+ width: width,
74
+ height: height,
75
+ className: className,
76
+ style: style,
77
+ sizes: sizes,
78
+ loading: priority ? "eager" : (loading ?? "lazy"),
79
+ fetchPriority: priority ? "high" : "auto",
80
+ };
60
81
  }
61
82
  function resolveProps(props) {
62
83
  let src = props.src;
@@ -108,12 +129,10 @@ export default function Image(props) {
108
129
  if (alternates.length === 0) {
109
130
  return _jsx(NextImage, { ...resolved });
110
131
  }
111
- const { props: imgProps } = nextGetImageProps(resolved);
112
- const primarySrc = variant?.src ?? String(imgProps.src);
132
+ const primarySrc = variant?.src ?? String(resolved.src);
113
133
  const originalSrc = entry?.originalSrc;
114
- return (_jsxs("picture", { children: [alternates.map((source) => (_jsx("source", { type: source.type, sizes: imgProps.sizes, srcSet: imgProps.srcSet
115
- ? retargetSrcSet(imgProps.srcSet, primarySrc, source.src)
116
- : source.src }, source.src))), _jsx(ImgWithFallback, { ...imgProps, alt: imgProps.alt ?? "", originalSrc: originalSrc })] }));
134
+ const imgProps = toPlainImgAttrs(resolved, primarySrc);
135
+ return (_jsxs("picture", { children: [alternates.map((source) => (_jsx("source", { type: source.type, sizes: imgProps.sizes, srcSet: source.src }, source.src))), _jsx(ImgWithFallback, { ...imgProps, originalSrc: originalSrc })] }));
117
136
  }
118
137
  export function getImageProps(props) {
119
138
  const resolved = resolveProps(props);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",