Home / Function/ create() — astro Function Reference

create() — astro Function Reference

Architecture documentation for the create() function in render-context.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0260702f_4c0c_b790_6509_b160f26390e8["create()"]
  b7425a46_8c1f_1122_7ae3_a00e52db1d90["RenderContext"]
  0260702f_4c0c_b790_6509_b160f26390e8 -->|defined in| b7425a46_8c1f_1122_7ae3_a00e52db1d90
  92ee7d0b_4309_452e_10ee_49559c26b54e["createAstro()"]
  92ee7d0b_4309_452e_10ee_49559c26b54e -->|calls| 0260702f_4c0c_b790_6509_b160f26390e8
  style 0260702f_4c0c_b790_6509_b160f26390e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/render-context.ts lines 116–171

	static async create({
		locals = {},
		pathname,
		pipeline,
		request,
		routeData,
		clientAddress,
		status = 200,
		props,
		partial = undefined,
		shouldInjectCspMetaTags,
		skipMiddleware = false,
	}: CreateRenderContext): Promise<RenderContext> {
		const pipelineMiddleware = await pipeline.getMiddleware();
		const pipelineActions = await pipeline.getActions();
		const pipelineSessionDriver = await pipeline.getSessionDriver();
		const serverIslands = await pipeline.getServerIslands();
		setOriginPathname(
			request,
			pathname,
			pipeline.manifest.trailingSlash,
			pipeline.manifest.buildFormat,
		);
		const cookies = new AstroCookies(request);
		const session =
			pipeline.manifest.sessionConfig && pipelineSessionDriver
				? new AstroSession({
						cookies,
						config: pipeline.manifest.sessionConfig,
						runtimeMode: pipeline.runtimeMode,
						driverFactory: pipelineSessionDriver,
						mockStorage: null,
					})
				: undefined;

		return new RenderContext(
			pipeline,
			locals,
			sequence(...pipeline.internalMiddleware, pipelineMiddleware),
			pipelineActions,
			serverIslands,
			pathname,
			request,
			routeData,
			status,
			clientAddress,
			cookies,
			undefined,
			undefined,
			props,
			partial,
			shouldInjectCspMetaTags ?? pipeline.manifest.shouldInjectCspMetaTags,
			session,
			skipMiddleware,
		);
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does create() do?
create() is a function in the astro codebase, defined in packages/astro/src/core/render-context.ts.
Where is create() defined?
create() is defined in packages/astro/src/core/render-context.ts at line 116.
What calls create()?
create() is called by 1 function(s): createAstro.

Analyze Your Own Codebase

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

Try Supermodel Free