astro-hotspot 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.2.1 - 2026-07-31
6
+
7
+ - Fixed `hotspot` being forwarded to the rendered `<img>`, where it showed up as `hotspot="70% 34%"` (or `hotspot="[object Object]"` for the coordinate form)
8
+
5
9
  ## 0.2.0 - 2026-07-31
6
10
 
7
11
  - Added Astro 7 support — `astro` peer range is now `>=5.0.0 <8.0.0`
package/dist/service.js CHANGED
@@ -44,6 +44,12 @@ const parseURL = (url, imageConfig) => {
44
44
  }
45
45
  return transform;
46
46
  };
47
+ // The base service forwards every prop it doesn't recognise onto the element,
48
+ // so `hotspot` has to be removed before delegating or it renders as an attribute.
49
+ const getHTMLAttributes = (options, imageConfig) => {
50
+ const { hotspot: _hotspot, ...rest } = options;
51
+ return baseSharpService.getHTMLAttributes?.(rest, imageConfig) ?? {};
52
+ };
47
53
  const transform = async (inputBuffer, transformOptions, config) => {
48
54
  const hotspot = parseHotspot(transformOptions.hotspot);
49
55
  if (!hotspot || !transformOptions.width || !transformOptions.height) {
@@ -104,6 +110,7 @@ const hotspotImageService = {
104
110
  ],
105
111
  getURL,
106
112
  parseURL,
113
+ getHTMLAttributes,
107
114
  transform,
108
115
  };
109
116
  export default hotspotImageService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-hotspot",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Astro image service: hotspot cropping (x/y or '70% 34%') via Sharp's extract+resize",
5
5
  "type": "module",
6
6
  "license": "MIT",