Comparing version 3.20.0 to 3.21.0
@@ -42,3 +42,3 @@ import { getNumericParam, setParamIfDefined, toCanonicalUrlString, toUrl, } from "../utils.js"; | ||
}; | ||
export const transform = ({ url: originalUrl, width, height, format }) => { | ||
export const transform = ({ url: originalUrl, width, height, format, cdnOptions }) => { | ||
const parsedUrl = toUrl(originalUrl); | ||
@@ -51,3 +51,4 @@ const href = toCanonicalUrlString(new URL(parsedUrl.pathname, parsedUrl.origin)); | ||
setParamIfDefined(url, "f", format); | ||
return `/_image?${url.searchParams.toString()}`; | ||
const endpoint = cdnOptions?.astro?.endpoint ?? "/_image"; | ||
return `${endpoint}?${url.searchParams.toString()}`; | ||
}; |
{ | ||
"name": "unpic", | ||
"version": "3.20.0", | ||
"version": "3.21.0", | ||
"description": "Universal image CDN translator", | ||
@@ -5,0 +5,0 @@ "homepage": "https://unpic.pics/lib", |
@@ -47,3 +47,3 @@ "use strict"; | ||
exports.parse = parse; | ||
const transform = ({ url: originalUrl, width, height, format }) => { | ||
const transform = ({ url: originalUrl, width, height, format, cdnOptions }) => { | ||
const parsedUrl = (0, utils_js_1.toUrl)(originalUrl); | ||
@@ -56,4 +56,5 @@ const href = (0, utils_js_1.toCanonicalUrlString)(new URL(parsedUrl.pathname, parsedUrl.origin)); | ||
(0, utils_js_1.setParamIfDefined)(url, "f", format); | ||
return `/_image?${url.searchParams.toString()}`; | ||
const endpoint = cdnOptions?.astro?.endpoint ?? "/_image"; | ||
return `${endpoint}?${url.searchParams.toString()}`; | ||
}; | ||
exports.transform = transform; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
282782
5310