0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
Arsh 2024-04-01 22:10:49 +00:00 committed by astrobot-houston
parent e9afd67139
commit f226cb65d1
4 changed files with 19 additions and 17 deletions

View file

@ -2353,7 +2353,7 @@ interface AstroSharedContext<
> {
/**
* The address (usually IP address) of the user.
*
*
* Throws an error if used within a static site, or within a prerendered page.
*/
clientAddress: string;
@ -2407,7 +2407,7 @@ interface AstroSharedContext<
/**
* The `APIContext` is the object made available to endpoints and middleware.
* It is a subset of the `Astro` global object available in pages.
*
*
* [Reference](https://docs.astro.build/en/reference/api-reference/#endpoint-context)
*/
export interface APIContext<
@ -2426,7 +2426,7 @@ export interface APIContext<
generator: string;
/**
* The url of the current request, parsed as an instance of `URL`.
*
*
* Equivalent to:
* ```ts
* new URL(context.request.url)
@ -2441,7 +2441,7 @@ export interface APIContext<
* Example usage:
* ```ts
* import type { APIContext } from "astro"
*
*
* export function getStaticPaths() {
* return [
* { params: { id: '0' }, props: { name: 'Sarah' } },
@ -2463,8 +2463,8 @@ export interface APIContext<
*
* Example usage:
* ```ts
* import type { APIContext } from "astro"
*
* import type { APIContext } from "astro"
*
* export function getStaticPaths() {
* return [
* { params: { id: '0' }, props: { name: 'Sarah' } },
@ -2477,13 +2477,13 @@ export interface APIContext<
* return new Response(`Hello ${props.name}!`);
* }
* ```
*
*
* [Reference](https://docs.astro.build/en/guides/api-reference/#contextprops)
*/
props: AstroSharedContext<Props, APIParams>['props'];
/**
* Create a response that redirects to another page.
*
*
* Example usage:
* ```ts
* // src/pages/secret.ts
@ -2498,11 +2498,11 @@ export interface APIContext<
/**
* An object that middlewares can use to store extra information related to the request.
*
*
* It will be made available to pages as `Astro.locals`, and to endpoints as `context.locals`.
*
*
* Example usage:
*
*
* ```ts
* // src/middleware.ts
* import { defineMiddleware } from "astro:middleware";
@ -2520,7 +2520,7 @@ export interface APIContext<
* ---
* <h1>{greeting}</h1>
* ```
*
*
* [Reference](https://docs.astro.build/en/reference/api-reference/#contextlocals)
*/
locals: App.Locals;

View file

@ -3,6 +3,7 @@
Code that executes directly on Node (not processed by vite). Contains the main Astro logic for the `build`, `dev`, `preview`, and `sync` commands, and also manages the lifecycle of the Vite server.
The `core/index.ts` module exports the CLI commands as functions and is the main entrypoint of the `astro` package.
```ts
import { dev, build, preview, sync } from 'astro';
```
@ -40,6 +41,7 @@ vite-plugin-astro-server --------- DevPipeline ------ Pipeline ------------- Ren
The pipeline is an interface representing data that stays unchanged throughout the duration of the server or build. For example: the user configuration, the list of pages and endpoints in the project, and environment-specific way of gathering scripts and styles.
There are 3 implementations of the pipeline:
- `DevPipeline`: in-use during the `astro dev` CLI command. Created and used by `vite-plugin-astro-server`, and then forwarded to other internals.
- `BuildPipeline`: in-use during the `astro build` command in `"static"` mode, and for prerendering in `"server"` and `"hybrid"` output modes. See `core/build/`.
- `AppPipeline`: in-use during production server(less) deployments. Created and used by `App` (see `core/app/`), and then forwarded to other internals.

View file

@ -4,7 +4,7 @@ export const ASTRO_VERSION = process.env.PACKAGE_VERSION ?? 'development';
/**
* The name for the header used to help rerouting behavior.
* When set to "no", astro will NOT try to reroute an error response to the corresponding error page, which is the default behavior that can sometimes lead to loops.
*
*
* ```ts
* const response = new Response("keep this content as-is", {
* status: 404,
@ -52,9 +52,9 @@ export const clientLocalsSymbol = Symbol.for('astro.locals');
/**
* The symbol used as a field on the response object to keep track of streaming.
*
*
* It is set when the `<head>` element has been completely generated, rendered, and the response object has been passed onto the adapter.
*
*
* Used to provide helpful errors and warnings when headers or cookies are added during streaming, after the response has already been sent.
*/
export const responseSentSymbol = Symbol.for('astro.responseSent');

View file

@ -29,9 +29,9 @@ const clientLocalsSymbol = Symbol.for('astro.locals');
/**
* Used by astro internals to create a web standard request object.
*
*
* The user of this function may provide the data in a runtime-agnostic way.
*
*
* This is used by the static build to create fake requests for prerendering, and by the dev server to convert node requests into the standard request object.
*/
export function createRequest({