Home / File/ params.ts — astro Source File

params.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 6 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  00c121f1_0bde_b84d_5b28_5500b9c5b967["params.ts"]
  135a8084_d596_67c2_9209_cca6693604e6["../types/public/common.js"]
  00c121f1_0bde_b84d_5b28_5500b9c5b967 --> 135a8084_d596_67c2_9209_cca6693604e6
  baa53824_73a3_1e03_2043_4d0c058ecca5["../types/public/index.js"]
  00c121f1_0bde_b84d_5b28_5500b9c5b967 --> baa53824_73a3_1e03_2043_4d0c058ecca5
  10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"]
  00c121f1_0bde_b84d_5b28_5500b9c5b967 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05
  7e4494c0_5563_4329_1bff_a84be66e1bc2["../core/path.js"]
  00c121f1_0bde_b84d_5b28_5500b9c5b967 --> 7e4494c0_5563_4329_1bff_a84be66e1bc2
  162316ad_87a9_ee43_993e_48696ea31a8d["../core/routing/manifest/generator.js"]
  00c121f1_0bde_b84d_5b28_5500b9c5b967 --> 162316ad_87a9_ee43_993e_48696ea31a8d
  da1a3b3b_edd7_26bf_8041_c6e9bb29705c["./validation.js"]
  00c121f1_0bde_b84d_5b28_5500b9c5b967 --> da1a3b3b_edd7_26bf_8041_c6e9bb29705c
  style 00c121f1_0bde_b84d_5b28_5500b9c5b967 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { GetStaticPathsItem } from '../../types/public/common.js';
import type { AstroConfig } from '../../types/public/index.js';
import type { RouteData } from '../../types/public/internal.js';
import { trimSlashes } from '../path.js';
import { getRouteGenerator } from './manifest/generator.js';
import { validateGetStaticPathsParameter } from './validation.js';

/**
 * given a route's Params object, validate parameter
 * values and create a stringified key for the route
 * that can be used to match request routes
 */
export function stringifyParams(
	params: GetStaticPathsItem['params'],
	route: RouteData,
	trailingSlash: AstroConfig['trailingSlash'],
) {
	// validate parameter values then stringify each value
	const validatedParams: Record<string, string> = {};
	for (const [key, value] of Object.entries(params)) {
		validateGetStaticPathsParameter([key, value], route.component);
		if (value !== undefined) {
			validatedParams[key] = trimSlashes(value);
		}
	}

	return getRouteGenerator(route.segments, trailingSlash)(validatedParams);
}

Domain

Subdomains

Functions

Dependencies

  • ../core/path.js
  • ../core/routing/manifest/generator.js
  • ../types/public/common.js
  • ../types/public/index.js
  • ../types/public/internal.js
  • ./validation.js

Frequently Asked Questions

What does params.ts do?
params.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 params.ts?
params.ts defines 1 function(s): stringifyParams.
What does params.ts depend on?
params.ts imports 6 module(s): ../core/path.js, ../core/routing/manifest/generator.js, ../types/public/common.js, ../types/public/index.js, ../types/public/internal.js, ./validation.js.
Where is params.ts in the architecture?
params.ts is located at packages/astro/src/core/routing/params.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/routing).

Analyze Your Own Codebase

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

Try Supermodel Free