Home / Function/ hashTransform() — astro Function Reference

hashTransform() — astro Function Reference

Architecture documentation for the hashTransform() function in node.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0b2c9631_129e_2a7c_f6cb_41413ad72cd8["hashTransform()"]
  cb45fbc5_a108_7969_b027_ddb8eab65943["node.ts"]
  0b2c9631_129e_2a7c_f6cb_41413ad72cd8 -->|defined in| cb45fbc5_a108_7969_b027_ddb8eab65943
  style 0b2c9631_129e_2a7c_f6cb_41413ad72cd8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/assets/utils/node.ts lines 195–211

export function hashTransform(
	transform: ImageTransform,
	imageService: string,
	propertiesToHash: string[],
): string {
	// Extract the fields we want to hash
	const hashFields = propertiesToHash.reduce(
		(acc, prop) => {
			// It's possible for `transform[prop]` here to be undefined, or null, but that's fine because it's still consistent
			// between different transforms. (ex: every transform without a height will explicitly have a `height: undefined` property)
			acc[prop] = transform[prop];
			return acc;
		},
		{ imageService } as Record<string, unknown>,
	);
	return shorthash(deterministicString(hashFields));
}

Domain

Subdomains

Frequently Asked Questions

What does hashTransform() do?
hashTransform() is a function in the astro codebase, defined in packages/astro/src/assets/utils/node.ts.
Where is hashTransform() defined?
hashTransform() is defined in packages/astro/src/assets/utils/node.ts at line 195.

Analyze Your Own Codebase

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

Try Supermodel Free