fix(types): add server.headers typing (#5635)

* fix(types): add `server.headers` typing

* fix: correct `@version` of `server.headers`

* Update changeset

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
SegaraRai 2022-12-28 01:07:49 +09:00 committed by GitHub
parent bfdfeb9c12
commit 376f67011d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Add `server.headers` typing

View file

@ -8,6 +8,7 @@ import type {
ShikiConfig,
} from '@astrojs/markdown-remark';
import type * as babel from '@babel/core';
import type { OutgoingHttpHeaders } from 'http';
import type { AddressInfo } from 'net';
import type { TsConfigJson } from 'tsconfig-resolver';
import type * as vite from 'vite';
@ -319,6 +320,16 @@ type ServerConfig = {
* If the given port is already in use, Astro will automatically try the next available port.
*/
port?: number;
/**
* @name server.headers
* @typeraw {OutgoingHttpHeaders}
* @default `{}`
* @version 1.7.0
* @description
* Set custom HTTP response headers to be sent in `astro dev` and `astro preview`.
*/
headers?: OutgoingHttpHeaders;
};
export interface ViteUserConfig extends vite.UserConfig {
@ -666,6 +677,16 @@ export interface AstroUserConfig {
* ```
*/
/**
* @docs
* @name server.headers
* @typeraw {OutgoingHttpHeaders}
* @default `{}`
* @version 1.7.0
* @description
* Set custom HTTP response headers to be sent in `astro dev` and `astro preview`.
*/
server?: ServerConfig | ((options: { command: 'dev' | 'preview' }) => ServerConfig);
/**