parts.ts — astro Source File
Architecture documentation for parts.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a187bc83_25df_e68d_7c2d_fcb621a152c2["parts.ts"] baa53824_73a3_1e03_2043_4d0c058ecca5["../types/public/index.js"] a187bc83_25df_e68d_7c2d_fcb621a152c2 --> baa53824_73a3_1e03_2043_4d0c058ecca5 style a187bc83_25df_e68d_7c2d_fcb621a152c2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { RoutePart } from '../../../types/public/index.js';
// Disable eslint as we're not sure how to improve this regex yet
// eslint-disable-next-line regexp/no-super-linear-backtracking
const ROUTE_DYNAMIC_SPLIT = /\[(.+?\(.+?\)|.+?)\]/;
const ROUTE_SPREAD = /^\.{3}.+$/;
export function getParts(part: string, file: string) {
const result: RoutePart[] = [];
part.split(ROUTE_DYNAMIC_SPLIT).map((str, i) => {
if (!str) return;
const dynamic = i % 2 === 1;
const [, content] = dynamic ? /([^(]+)$/.exec(str) || [null, null] : [null, str];
if (!content || (dynamic && !/^(?:\.\.\.)?[\w$]+$/.test(content))) {
throw new Error(`Invalid route ${file} — parameter name must match /^[a-zA-Z0-9_$]+$/`);
}
result.push({
content,
dynamic,
spread: dynamic && ROUTE_SPREAD.test(content),
});
});
return result;
}
Domain
Subdomains
Functions
Dependencies
- ../types/public/index.js
Source
Frequently Asked Questions
What does parts.ts do?
parts.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 parts.ts?
parts.ts defines 1 function(s): getParts.
What does parts.ts depend on?
parts.ts imports 1 module(s): ../types/public/index.js.
Where is parts.ts in the architecture?
parts.ts is located at packages/astro/src/core/routing/manifest/parts.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/routing/manifest).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free