also looking at this
feat: imgx integration — on-the-fly image transforms from query params
#2264
15 files
+1118
-16
| @@ -404,6 +404,34 @@ export interface LocalCaConfig { | ||
| 404 | 404 | renewBeforeDays?: number |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | /** | |
| 408 | * imgx integration: serve on-the-fly image transforms driven by | |
| 409 | * imgix/meema-style query params (`?w=200&h=1200&q=80&format=webp`), powered by | |
| 410 | * the pure-TypeScript `ts-images` pipeline. `true` enables the defaults; an | |
| 411 | * object tunes them. Enabled globally or per proxy; transformed variants are | |
| 412 | * cached in memory keyed by the upstream bytes, so an unchanged image is never | |
| 413 | * re-encoded twice. | |
| 414 | */ | |
| 415 | export interface ImgxOptions { | |
| 416 | /** Encode quality used when the request has no `q` param. @default 80 */ | |
| 417 | quality?: number | |
| 418 | /** Upper clamp for the requested output width. @default 8192 */ | |
| 419 | maxWidth?: number | |
| 420 | /** Upper clamp for the requested output height. @default 8192 */ | |
| 421 | maxHeight?: number | |
| 422 | /** | |
| 423 | * Responses larger than this many bytes pass through untransformed (they | |
| 424 | * keep streaming; nothing is buffered past the cap). @default 33554432 (32 MiB) | |
| 425 | */ | |
| 426 | maxInputBytes?: number | |
| 427 | /** Cache transformed variants in memory. @default true */ | |
| 428 | cache?: boolean | |
| 429 | /** Total byte budget for the transform cache. @default 67108864 (64 MiB) */ | |
| 430 | cacheMaxBytes?: number | |
| 431 | /** Max entries in the transform cache. @default 500 */ | |
| 432 | cacheMaxEntries?: number | |
| 433 | } | |
| 434 | ||
| 407 | 435 | export interface SharedProxyConfig { |
| 408 | 436 | /** |
| 409 | 437 | * `true` mints and trusts a local dev certificate, a {@link TlsOption} points |
| @@ -419,6 +447,12 @@ export interface SharedProxyConfig { | ||
| 419 | 447 | start?: StartOptions |
| 420 | 448 | cleanUrls: boolean |
| 421 | 449 | changeOrigin?: boolean // default: false - changes the origin of the host header to the target URL |
| 450 | /** | |
| 451 | * Transform image responses on the fly from imgix/meema-style query params | |
| 452 | * (`?w=200&h=1200&q=80`) via the imgx (ts-images) pipeline — see {@link ImgxOptions}. | |
| 453 | * Default: `false`. Overridable per proxy in multi-proxy configs. | |
| 454 | */ | |
| 455 | imgx?: boolean | ImgxOptions | |
| 422 | 456 | regenerateUntrustedCerts?: boolean // If true, will regenerate and re-trust certs that exist but are not trusted by the system. |
| 423 | 457 | /** |
| 424 | 458 | * Route every proxy through a single shared listener instead of binding a |
| @@ -512,7 +546,7 @@ export type SharedProxyOptions = Partial<SharedProxyConfig> | ||
| 512 | 546 | export interface SingleProxyConfig extends BaseProxyConfig, SharedProxyConfig {} |
| 513 | 547 | |
| 514 | 548 | export interface MultiProxyConfig extends SharedProxyConfig { |
| 515 | proxies: Array<BaseProxyConfig & { cleanUrls: boolean, pathRewrites?: PathRewrite[] }> | |
| 549 | proxies: Array<BaseProxyConfig & { cleanUrls: boolean, pathRewrites?: PathRewrite[], imgx?: boolean | ImgxOptions }> | |
| 516 | 550 | } |
| 517 | 551 | |
| 518 | 552 | export type ProxyConfig = SingleProxyConfig |
| @@ -530,7 +564,7 @@ export type ProxyOptions = Partial<SingleProxyConfig> | Partial<MultiProxyConfig | ||
| 530 | 564 | * single and multi shapes without falling back to `any`. |
| 531 | 565 | */ |
| 532 | 566 | export type ResolvedProxyOptions = Partial<SingleProxyConfig> & { |
| 533 | proxies?: Array<BaseProxyConfig & { cleanUrls?: boolean, changeOrigin?: boolean, pathRewrites?: PathRewrite[] }> | |
| 567 | proxies?: Array<BaseProxyConfig & { cleanUrls?: boolean, changeOrigin?: boolean, pathRewrites?: PathRewrite[], imgx?: boolean | ImgxOptions }> | |
| 534 | 568 | } |
| 535 | 569 | |
| 536 | 570 | export interface SSLConfig { |