Home / File/ types.ts — astro Source File

types.ts — astro Source File

Architecture documentation for types.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 3 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  a061abff_b26a_1eda_52cf_ff7a2af40052["types.ts"]
  aa7ecf5d_ecc0_6ab7_c8df_09c64e200c44["../../type-utils.js"]
  a061abff_b26a_1eda_52cf_ff7a2af40052 --> aa7ecf5d_ecc0_6ab7_c8df_09c64e200c44
  a19b6b68_b1f2_2d3e_2481_283031d370ff["./consts.js"]
  a061abff_b26a_1eda_52cf_ff7a2af40052 --> a19b6b68_b1f2_2d3e_2481_283031d370ff
  af2a1f33_901c_456d_9c42_3a41fec45451["./services/service.js"]
  a061abff_b26a_1eda_52cf_ff7a2af40052 --> af2a1f33_901c_456d_9c42_3a41fec45451
  style a061abff_b26a_1eda_52cf_ff7a2af40052 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { OmitPreservingIndexSignature, Simplify, WithRequired } from '../type-utils.js';
import type { VALID_INPUT_FORMATS, VALID_OUTPUT_FORMATS } from './consts.js';
import type { ImageService } from './services/service.js';

export type ImageQualityPreset = 'low' | 'mid' | 'high' | 'max' | (string & {});
export type ImageQuality = ImageQualityPreset | number;
export type ImageInputFormat = (typeof VALID_INPUT_FORMATS)[number];
export type ImageOutputFormat = (typeof VALID_OUTPUT_FORMATS)[number] | (string & {});
export type ImageLayout = 'constrained' | 'fixed' | 'full-width' | 'none';
export type ImageFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down' | (string & {});

export type AssetsGlobalStaticImagesList = Map<
	string,
	{
		originalSrcPath: string | undefined;
		transforms: Map<string, { finalPath: string; transform: ImageTransform }>;
	}
>;

declare global {
	var astroAsset: {
		imageService?: ImageService;
		addStaticImage?:
			| ((options: ImageTransform, hashProperties: string[], fsPath: string | undefined) => string)
			| undefined;
		staticImages?: AssetsGlobalStaticImagesList;
		referencedImages?: Set<string>;
	};
}

const isESMImport = Symbol('#isESM');

export type OmitBrand<T> = Omit<T, typeof isESMImport>;

/**
 * Type returned by ESM imports of images
 */
export type ImageMetadata = {
	src: string;
	width: number;
	height: number;
	format: ImageInputFormat;
	orientation?: number;
	/** @internal */
	fsPath: string;
	[isESMImport]?: true;
};

export function isImageMetadata(src: any): src is ImageMetadata {
	// For ESM-imported images the fsPath property is set but not enumerable
	return src.fsPath && !('fsPath' in src);
}

/**
 * A yet to be completed with an url `SrcSetValue`. Other hooks will only see a resolved value, where the URL of the image has been added.
 */
export type UnresolvedSrcSetValue = {
	transform: ImageTransform;
	descriptor?: string;
	attributes?: Record<string, any>;
// ... (229 more lines)

Domain

Subdomains

Functions

Classes

Dependencies

  • ../../type-utils.js
  • ./consts.js
  • ./services/service.js

Frequently Asked Questions

What does types.ts do?
types.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in types.ts?
types.ts defines 1 function(s): isImageMetadata.
What does types.ts depend on?
types.ts imports 3 module(s): ../../type-utils.js, ./consts.js, ./services/service.js.
Where is types.ts in the architecture?
types.ts is located at packages/astro/src/assets/types.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/assets).

Analyze Your Own Codebase

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

Try Supermodel Free