tryRewrite() — astro Function Reference
Architecture documentation for the tryRewrite() function in pipeline.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD d3c66bd3_1cd3_b12a_a18d_4f93dff5df0c["tryRewrite()"] 40ba2769_779c_63d9_4084_f451c2f62cd9["AppPipeline"] d3c66bd3_1cd3_b12a_a18d_4f93dff5df0c -->|defined in| 40ba2769_779c_63d9_4084_f451c2f62cd9 d52ff83d_4730_519f_5ab3_9c2089ed4d5d["getComponentByRoute()"] d3c66bd3_1cd3_b12a_a18d_4f93dff5df0c -->|calls| d52ff83d_4730_519f_5ab3_9c2089ed4d5d style d3c66bd3_1cd3_b12a_a18d_4f93dff5df0c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/app/pipeline.ts lines 123–136
async tryRewrite(payload: RewritePayload, request: Request): Promise<TryRewriteResult> {
const { newUrl, pathname, routeData } = findRouteToRewrite({
payload,
request,
routes: this.manifest?.routes.map((r) => r.routeData),
trailingSlash: this.manifest.trailingSlash,
buildFormat: this.manifest.buildFormat,
base: this.manifest.base,
outDir: this.manifest?.serverLike ? this.manifest.buildClientDir : this.manifest.outDir,
});
const componentInstance = await this.getComponentByRoute(routeData);
return { newUrl, pathname, componentInstance, routeData };
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does tryRewrite() do?
tryRewrite() is a function in the astro codebase, defined in packages/astro/src/core/app/pipeline.ts.
Where is tryRewrite() defined?
tryRewrite() is defined in packages/astro/src/core/app/pipeline.ts at line 123.
What does tryRewrite() call?
tryRewrite() calls 1 function(s): getComponentByRoute.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free