Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,2 @@ | ||
import { setParamIfDefined, toRelativeUrl } from "../utils.js"; | ||
import { setParamIfDefined, setParamIfUndefined, toRelativeUrl, } from "../utils.js"; | ||
import { getTransformerForCdn } from "../transform.js"; | ||
@@ -15,3 +15,3 @@ import { getImageCdnForUrl } from "../detect.js"; | ||
}; | ||
export const generate = ({ base, width, params: { quality, root = "_vercel" } = {} }) => { | ||
export const generate = ({ base, width, params: { quality = 75, root = "_vercel" } = {} }) => { | ||
// If the base is a relative URL, we need to add a dummy host to the URL | ||
@@ -22,3 +22,3 @@ const url = new URL("http://n"); | ||
setParamIfDefined(url, "w", width, false, true); | ||
setParamIfDefined(url, "q", quality, false, true); | ||
setParamIfUndefined(url, "q", quality); | ||
return toRelativeUrl(url); | ||
@@ -25,0 +25,0 @@ }; |
@@ -6,3 +6,3 @@ { | ||
"name": "unpic", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Universal image CDN translator", | ||
@@ -9,0 +9,0 @@ "license": "MIT", |
@@ -100,21 +100,22 @@ # 🖼 Unpic | ||
- Imgix, including Unsplash, DatoCMS, Sanity and Prismic | ||
- Builder.io | ||
- Bunny.net | ||
- Cloudflare | ||
- Contentful | ||
- Builder.io | ||
- Cloudinary | ||
- Imgix, including Unsplash, DatoCMS, Sanity and Prismic | ||
- Kontent.ai | ||
- Shopify | ||
- Storyblok | ||
- Vercel / Next.js | ||
- WordPress.com and Jetpack Site Accelerator | ||
- Bunny.net | ||
- Storyblok | ||
- Cloudflare | ||
- Kontent.ai | ||
- Next.js/Vercel | ||
## Usage with Next.js | ||
## Usage with Vercel / Next.js | ||
Unpic has special handling for Next.js image URLs. It detects supported image | ||
CDNs, and falls back to `/_next/image` for local and unsupported remote images. | ||
Unpic has special handling for Vercel and Next.js image URLs. It detects supported | ||
image CDNs, and falls back to `/_vercel/image` or `/_next/image` for local and | ||
unsupported remote images. | ||
For more information, see the | ||
[Unpic Next.js](https://github.com/ascorbic/unpic/blob/main/nextjs.md) | ||
[Unpic Vercel / Next.js](https://github.com/ascorbic/unpic/blob/main/vercel.md) | ||
documentation. | ||
@@ -121,0 +122,0 @@ |
@@ -19,3 +19,3 @@ "use strict"; | ||
exports.parse = parse; | ||
const generate = ({ base, width, params: { quality, root = "_vercel" } = {} }) => { | ||
const generate = ({ base, width, params: { quality = 75, root = "_vercel" } = {} }) => { | ||
// If the base is a relative URL, we need to add a dummy host to the URL | ||
@@ -26,3 +26,3 @@ const url = new URL("http://n"); | ||
(0, utils_js_1.setParamIfDefined)(url, "w", width, false, true); | ||
(0, utils_js_1.setParamIfDefined)(url, "q", quality, false, true); | ||
(0, utils_js_1.setParamIfUndefined)(url, "q", quality); | ||
return (0, utils_js_1.toRelativeUrl)(url); | ||
@@ -29,0 +29,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69975
184