Home / Function/ service.transform() — astro Function Reference

service.transform() — astro Function Reference

Architecture documentation for the service.transform() function in dev-service.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  d7ca0924_074d_6280_dc2a_b98a9723698d["service.transform()"]
  17912ece_5add_1411_7656_29ddd31d5757["dev-service.ts"]
  d7ca0924_074d_6280_dc2a_b98a9723698d -->|defined in| 17912ece_5add_1411_7656_29ddd31d5757
  style d7ca0924_074d_6280_dc2a_b98a9723698d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/vercel/src/image/dev-service.ts lines 19–28

	transform(inputBuffer, transform, serviceOptions) {
		// NOTE: Hardcoding webp here isn't accurate to how the Vercel Image Optimization API works, normally what we should
		// do is setup a custom endpoint that sniff the user's accept-content header and serve the proper format based on the
		// user's Vercel config. However, that's: a lot of work for: not much. The dev service is inaccurate to the prod service
		// in many more ways, this is one of the less offending cases and is, imo, okay, erika - 2023-04-27
		transform.format = transform.src.endsWith('svg') ? 'svg' : 'webp';

		// The base sharp service works the same way as the Vercel Image Optimization API, so it's a safe fallback in local
		return sharpService.transform(inputBuffer, transform, serviceOptions);
	},

Domain

Subdomains

Frequently Asked Questions

What does service.transform() do?
service.transform() is a function in the astro codebase, defined in packages/integrations/vercel/src/image/dev-service.ts.
Where is service.transform() defined?
service.transform() is defined in packages/integrations/vercel/src/image/dev-service.ts at line 19.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free