Home / File/ context.ts — astro Source File

context.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 7 imports 7 functions

Entity Profile

Dependency Diagram

graph LR
  2b15052d_da7e_1068_8fc4_a995d3529aeb["context.ts"]
  a1711a94_f06c_214e_28b9_0d6031277c04["../../actions/runtime/types.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> a1711a94_f06c_214e_28b9_0d6031277c04
  5799bf2d_d18e_6c2e_364a_a825ef7f6e79["../../core/cookies/cookies.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> 5799bf2d_d18e_6c2e_364a_a825ef7f6e79
  d34ed003_355b_637d_1578_cba29babbd4c["../../core/csp/config.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> d34ed003_355b_637d_1578_cba29babbd4c
  6a3038d8_456e_d08b_2867_219c185af401["../../core/session/runtime.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> 6a3038d8_456e_d08b_2867_219c185af401
  9e624f62_bcfa_4352_e9a0_dd454823f706["../../runtime/server/index.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> 9e624f62_bcfa_4352_e9a0_dd454823f706
  135a8084_d596_67c2_9209_cca6693604e6["../types/public/common.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> 135a8084_d596_67c2_9209_cca6693604e6
  c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"]
  2b15052d_da7e_1068_8fc4_a995d3529aeb --> c32d12e2_d85e_28c0_eea7_9b29629857e0
  style 2b15052d_da7e_1068_8fc4_a995d3529aeb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ActionClient, ActionReturnType } from '../../actions/runtime/types.js';
import type { AstroCookies } from '../../core/cookies/cookies.js';
import type { CspDirective, CspHash } from '../../core/csp/config.js';
import type { AstroSession } from '../../core/session/runtime.js';
import type { AstroComponentFactory } from '../../runtime/server/index.js';
import type { RewritePayload } from './common.js';
import type { ValidRedirectStatus } from './config.js';

/**
 * Astro global available in all contexts in .astro files
 *
 * [Astro reference](https://docs.astro.build/en/reference/api-reference/)
 */
export interface AstroGlobal<
	Props extends Record<string, any> = Record<string, any>,
	Self = AstroComponentFactory,
	Params extends Record<string, string | undefined> = Record<string, string | undefined>,
> extends APIContext<Props, Params> {
	/**
	 * A standard [ResponseInit](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#init) object describing the outgoing response.
	 *
	 * ## Example
	 *
	 * You can change the status code by assigning a value to this property:
	 * ```typescript
	 * Astro.response.status = 404;
	 * ```
	 *
	 * [Astro reference](https://docs.astro.build/en/reference/api-reference/#response)
	 */
	response: ResponseInit & {
		readonly headers: Headers;
	};

	/**
	 * Allows a component to be recursively called.
	 *
	 * This is useful when you need to render an Astro component from within
	 * itself. `Astro.self` accepts the same properties as the component itself.
	 *
	 * ## Example
	 *
	 * ```astro
	 * ---
	 * const { items } = Astro.props;
	 * ---
	 * <ul>
	 *   {items.map((item) => (
	 *     <li>
	 *       {Array.isArray(item) ? (
	 *         <Astro.self items={item} />
	 *       ) : (
	 *         item
	 *       )}
	 *     </li>
	 *   ))}
	 * </ul>
	 * ```
	 *
	 * [Astro reference](https://docs.astro.build/en/reference/astro-syntax/#astroself)
// ... (521 more lines)

Domain

Subdomains

Dependencies

  • ../../actions/runtime/types.js
  • ../../core/cookies/cookies.js
  • ../../core/csp/config.js
  • ../../core/session/runtime.js
  • ../../runtime/server/index.js
  • ../types/public/common.js
  • ../types/public/config.js

Frequently Asked Questions

What does context.ts do?
context.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 context.ts?
context.ts defines 7 function(s): Response, action, directive, hash, payload, resource, rewritePayload.
What does context.ts depend on?
context.ts imports 7 module(s): ../../actions/runtime/types.js, ../../core/cookies/cookies.js, ../../core/csp/config.js, ../../core/session/runtime.js, ../../runtime/server/index.js, ../types/public/common.js, ../types/public/config.js.
Where is context.ts in the architecture?
context.ts is located at packages/astro/src/types/public/context.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/types/public).

Analyze Your Own Codebase

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

Try Supermodel Free