@nuasite/components 0.41.0 → 0.42.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nuasite/components",
3
3
  "description": "Nua Site astro components.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.41.0",
5
+ "version": "0.42.1",
6
6
  "files": [
7
7
  "dist/**",
8
8
  "src/**",
@@ -51,7 +51,13 @@ const buildUrl = (width: number) => {
51
51
  }
52
52
 
53
53
  const effectiveWidths = widths.length ? widths : [1400]
54
- const shouldTransform = Boolean(src) && isDomainAllowed
54
+ // The /cdn-cgi/image endpoint only exists in environments that proxy through
55
+ // Cloudflare (production) or the pletivo runtime, which serves the transform
56
+ // endpoint itself. Under plain `astro dev` nothing serves those URLs, so fall
57
+ // back to the raw <img>. pletivo sets `globalThis.__PLETIVO__` when active.
58
+ const isPletivoRuntime = Boolean((globalThis as Record<string, unknown>).__PLETIVO__)
59
+ const transformEndpointAvailable = !import.meta.env.DEV || isPletivoRuntime
60
+ const shouldTransform = Boolean(src) && isDomainAllowed && transformEndpointAvailable
55
61
  const srcset = shouldTransform ? effectiveWidths.map((width) => `${buildUrl(width)} ${width}w`).join(', ') : undefined
56
62
  const fallbackSrc = shouldTransform ? buildUrl(effectiveWidths[effectiveWidths.length - 1]!) : src
57
63
  ---