diff options
author | 2022-12-28 01:07:49 +0900 | |
---|---|---|
committer | 2022-12-27 11:07:49 -0500 | |
commit | 376f67011d220de3bf05d3f39779a708992fffd7 (patch) | |
tree | 2725e6125a91d734f2e411119558e5f1a4cca0a6 | |
parent | bfdfeb9c12d2764a6b291850a7c3a228dee8ea1e (diff) | |
download | astro-376f67011d220de3bf05d3f39779a708992fffd7.tar.gz astro-376f67011d220de3bf05d3f39779a708992fffd7.tar.zst astro-376f67011d220de3bf05d3f39779a708992fffd7.zip |
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>
-rw-r--r-- | .changeset/slow-nails-retire.md | 5 | ||||
-rw-r--r-- | packages/astro/src/@types/astro.ts | 21 |
2 files changed, 26 insertions, 0 deletions
diff --git a/.changeset/slow-nails-retire.md b/.changeset/slow-nails-retire.md new file mode 100644 index 000000000..e8eaccbb4 --- /dev/null +++ b/.changeset/slow-nails-retire.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Add `server.headers` typing diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 9d1390ae1..c5839058a 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -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); /** |