@netlify/ipx
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -7,8 +7,10 @@ import type { HandlerResponse } from '@netlify/functions'; | ||
} | ||
export declare function loadSourceImage({ cacheDir, url, requestEtag, modifiers, isLocal }: { | ||
cacheDir: any; | ||
url: any; | ||
requestEtag: any; | ||
modifiers: any; | ||
isLocal: any; | ||
}): Promise<SourceImageResult>; | ||
export interface SourceImageOptions { | ||
cacheDir: string; | ||
url: string; | ||
requestHeaders?: Record<string, string>; | ||
modifiers: string; | ||
isLocal?: boolean; | ||
requestEtag?: string; | ||
} | ||
export declare function loadSourceImage({ cacheDir, url, requestEtag, modifiers, isLocal, requestHeaders }: SourceImageOptions): Promise<SourceImageResult>; |
@@ -35,3 +35,3 @@ "use strict"; | ||
const GATEWAY_ERROR = 502; | ||
async function loadSourceImage({ cacheDir, url, requestEtag, modifiers, isLocal }) { | ||
async function loadSourceImage({ cacheDir, url, requestEtag, modifiers, isLocal, requestHeaders = {} }) { | ||
const fileCache = (0, path_1.join)(cacheDir, 'cache'); | ||
@@ -46,3 +46,3 @@ const metadataCache = (0, path_1.join)(cacheDir, 'metadata'); | ||
const inputCacheFile = (0, path_1.join)(fileCache, cacheKey); | ||
const headers = new node_fetch_1.Headers(); | ||
const headers = new node_fetch_1.Headers(requestHeaders); | ||
let sourceMetadata; | ||
@@ -49,0 +49,0 @@ if ((0, fs_extra_1.existsSync)(inputCacheFile)) { |
@@ -24,2 +24,3 @@ "use strict"; | ||
let id = decodeURIComponent(segments.join('/')); | ||
const requestHeaders = {}; | ||
const isLocal = !id.startsWith('http'); | ||
@@ -30,2 +31,8 @@ if (isLocal) { | ||
else { | ||
if (event.headers.cookie) { | ||
requestHeaders.cookie = event.headers.cookie; | ||
} | ||
if (event.headers.authorization) { | ||
requestHeaders.authorization = event.headers.authorization; | ||
} | ||
if (typeof domains === 'string') { | ||
@@ -56,3 +63,4 @@ domains = domains.split(',').map(s => s.trim()); | ||
modifiers, | ||
isLocal | ||
isLocal, | ||
requestHeaders | ||
}); | ||
@@ -59,0 +67,0 @@ if (response) { |
{ | ||
"name": "@netlify/ipx", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "on-demand image optimization for Netlify", | ||
@@ -36,2 +36,3 @@ "repository": "netlify/netlify-ipx", | ||
"@types/fs-extra": "^9.0.12", | ||
"@types/node-fetch": "^2.0.0", | ||
"eslint": "^7.29.0", | ||
@@ -38,0 +39,0 @@ "jiti": "^1.10.1", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12298
228
0
9