Home / File/ shared-dev-service.ts — astro Source File

shared-dev-service.ts — astro Source File

Architecture documentation for shared-dev-service.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript CoreAstro CoreMiddleware 3 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  d130dd7d_acd0_b298_caed_a45c298e8995["shared-dev-service.ts"]
  33ed95cd_96ff_f301_bc85_29b41d61d35b["./image/shared.js"]
  d130dd7d_acd0_b298_caed_a45c298e8995 --> 33ed95cd_96ff_f301_bc85_29b41d61d35b
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  d130dd7d_acd0_b298_caed_a45c298e8995 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  01c5fbc2_ddb6_180b_d98d_2ff488540314["assets"]
  d130dd7d_acd0_b298_caed_a45c298e8995 --> 01c5fbc2_ddb6_180b_d98d_2ff488540314
  style d130dd7d_acd0_b298_caed_a45c298e8995 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { LocalImageService } from 'astro';
import { baseService } from 'astro/assets';
import { sharedValidateOptions } from './shared.js';

export const baseDevService: Omit<LocalImageService, 'transform'> = {
	...baseService,
	validateOptions: (options, serviceOptions) =>
		sharedValidateOptions(options, serviceOptions.service.config, 'development'),
	getURL(options) {
		const fileSrc = typeof options.src === 'string' ? options.src : options.src.src;

		const searchParams = new URLSearchParams();
		searchParams.append('href', fileSrc);

		options.width && searchParams.append('w', options.width.toString());
		options.quality && searchParams.append('q', options.quality.toString());

		return '/_image?' + searchParams;
	},
	parseURL(url) {
		const params = url.searchParams;

		if (!params.has('href')) {
			return undefined;
		}

		const transform = {
			src: params.get('href')!,
			width: params.has('w') ? Number.parseInt(params.get('w')!) : undefined,
			quality: params.get('q'),
		};

		return transform;
	},
};

Domain

Subdomains

Dependencies

  • ./image/shared.js
  • assets
  • astro

Frequently Asked Questions

What does shared-dev-service.ts do?
shared-dev-service.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in shared-dev-service.ts?
shared-dev-service.ts defines 3 function(s): baseDevService.getURL, baseDevService.parseURL, baseDevService.validateOptions.
What does shared-dev-service.ts depend on?
shared-dev-service.ts imports 3 module(s): ./image/shared.js, assets, astro.
Where is shared-dev-service.ts in the architecture?
shared-dev-service.ts is located at packages/integrations/vercel/src/image/shared-dev-service.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/integrations/vercel/src/image).

Analyze Your Own Codebase

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

Try Supermodel Free