params-and-props.ts — astro Source File
Architecture documentation for params-and-props.ts, a typescript file in the astro codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2b2f7826_50bd_a387_80cc_9a3b7ef783f7["params-and-props.ts"] e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 135a8084_d596_67c2_9209_cca6693604e6["../types/public/common.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> 135a8084_d596_67c2_9209_cca6693604e6 baa53824_73a3_1e03_2043_4d0c058ecca5["../types/public/index.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> baa53824_73a3_1e03_2043_4d0c058ecca5 10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05 7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> d3861967_b647_84d2_ff48_15013353bd56 b3e8a9be_d20e_da21_abaa_3cb61c3f5a15["../core/routing/helpers.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> b3e8a9be_d20e_da21_abaa_3cb61c3f5a15 e4f1ecf5_7afe_e6c1_d3cd_7cbd7918b5e3["../../core/render/route-cache.js"] 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 --> e4f1ecf5_7afe_e6c1_d3cd_7cbd7918b5e3 style 2b2f7826_50bd_a387_80cc_9a3b7ef783f7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ComponentInstance } from '../../types/astro.js';
import type { Params, Props } from '../../types/public/common.js';
import type { AstroConfig } from '../../types/public/index.js';
import type { RouteData } from '../../types/public/internal.js';
import { DEFAULT_404_COMPONENT } from '../constants.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import type { Logger } from '../logger/core.js';
import { routeIsFallback, routeIsRedirect } from '../routing/helpers.js';
import type { RouteCache } from './route-cache.js';
import { callGetStaticPaths, findPathItemByKey } from './route-cache.js';
interface GetParamsAndPropsOptions {
mod: ComponentInstance | undefined;
routeData?: RouteData | undefined;
routeCache: RouteCache;
pathname: string;
logger: Logger;
serverLike: boolean;
base: string;
trailingSlash: AstroConfig['trailingSlash'];
}
export async function getProps(opts: GetParamsAndPropsOptions): Promise<Props> {
const {
logger,
mod,
routeData: route,
routeCache,
pathname,
serverLike,
base,
trailingSlash,
} = opts;
// If there's no route, or if there's a pathname (e.g. a static `src/pages/normal.astro` file),
// then we know for sure they don't have params and props, return a fallback value.
if (!route || route.pathname) {
return {};
}
if (
routeIsRedirect(route) ||
routeIsFallback(route) ||
route.component === DEFAULT_404_COMPONENT
) {
return {};
}
// During build, the route cache should already be populated.
// During development, the route cache is filled on-demand and may be empty.
const staticPaths = await callGetStaticPaths({
mod,
route,
routeCache,
ssr: serverLike,
base,
trailingSlash,
});
// The pathname used here comes from the server, which already encoded.
// ... (80 more lines)
Domain
Subdomains
Types
Dependencies
- ../../core/render/route-cache.js
- ../core/constants.js
- ../core/errors/index.js
- ../core/logger/core.js
- ../core/routing/helpers.js
- ../types/astro.js
- ../types/public/common.js
- ../types/public/index.js
- ../types/public/internal.js
Source
Frequently Asked Questions
What does params-and-props.ts do?
params-and-props.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-and-props.ts?
params-and-props.ts defines 3 function(s): getParams, getProps, validatePrerenderEndpointCollision.
What does params-and-props.ts depend on?
params-and-props.ts imports 9 module(s): ../../core/render/route-cache.js, ../core/constants.js, ../core/errors/index.js, ../core/logger/core.js, ../core/routing/helpers.js, ../types/astro.js, ../types/public/common.js, ../types/public/index.js, and 1 more.
Where is params-and-props.ts in the architecture?
params-and-props.ts is located at packages/astro/src/core/render/params-and-props.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/render).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free