Skip to content

Commit 37c14ee

Browse files
committed
docs(types): fix inaccurate jsdoc descriptions and defaults
1 parent 74074fc commit 37c14ee

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

src/types/config.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ export interface NitroOptions extends PresetOptions {
5656
*
5757
* Providers introduce new features that Nitro presets can leverage, but
5858
* some need to be explicitly opted into. Set to the latest tested date
59-
* in `YYYY-MM-DD` format. Defaults to `"latest"` behavior when unset.
59+
* in `YYYY-MM-DD` format.
6060
*
61+
* @default "latest"
6162
* @see https://nitro.build/config#compatibilitydate
6263
*/
6364
compatibilityDate: CompatibilityDates;
@@ -107,7 +108,8 @@ export interface NitroOptions extends PresetOptions {
107108
* Server runtime configuration accessible via `useRuntimeConfig()`.
108109
*
109110
* Values can be overridden at runtime using environment variables with
110-
* the `NITRO_` prefix (configurable via `nitro.envPrefix`).
111+
* the `NITRO_` prefix. An alternative prefix can be configured via
112+
* `runtimeConfig.nitro.envPrefix` or `NITRO_ENV_PREFIX`.
111113
*
112114
* **Note:** The `nitro` namespace is reserved for internal use.
113115
*
@@ -142,11 +144,12 @@ export interface NitroOptions extends PresetOptions {
142144

143145
/**
144146
* Server directory for scanning `api/`, `routes/`, `plugins/`, `utils/`,
145-
* `middleware/`, `assets/`, and `tasks/` folders.
147+
* `middleware/`, `modules/`, and `tasks/` folders.
146148
*
147149
* Set to `false` to disable automatic directory scanning, `"./"` to use
148150
* the root directory, or `"./server"` to use a `server/` subdirectory.
149151
*
152+
* @default false
150153
* @see https://nitro.build/config#serverdir
151154
*/
152155
serverDir: string | false;
@@ -380,7 +383,7 @@ export interface NitroOptions extends PresetOptions {
380383
* @see https://nitro.build/config#future
381384
*/
382385
future: {
383-
/** Use built-in SWR (caching layer + storage) instead of ISR on Netlify and Vercel. */
386+
/** Use built-in SWR (caching layer + storage) instead of ISR on Vercel. */
384387
nativeSWR?: boolean;
385388
};
386389

@@ -407,6 +410,7 @@ export interface NitroOptions extends PresetOptions {
407410
*
408411
* Set to `false` to disable auto-imports. Pass an object to customize.
409412
*
413+
* @default false
410414
* @see https://nitro.build/config#imports
411415
* @see https://github.com/unjs/unimport
412416
*/
@@ -634,7 +638,8 @@ export interface NitroOptions extends PresetOptions {
634638
/**
635639
* Path(s) to custom runtime error handler(s).
636640
*
637-
* Replaces Nitro's built-in error page.
641+
* Custom handlers run before the built-in error handler, which is
642+
* always added as a fallback.
638643
*
639644
* @see https://nitro.build/config#errorhandler
640645
*/
@@ -691,7 +696,9 @@ export interface NitroOptions extends PresetOptions {
691696
/**
692697
* Bundler to use for production builds.
693698
*
694-
* Auto-detected when not set.
699+
* When not set, defaults to `"vite"` if a `vite.config` with the
700+
* `nitro()` plugin is detected, otherwise `"rolldown"`. Can also be
701+
* set via the `NITRO_BUILDER` environment variable.
695702
*
696703
* @see https://nitro.build/config#builder
697704
*/
@@ -1071,7 +1078,8 @@ export interface NitroRuntimeConfigApp {
10711078
* Server runtime configuration accessible via `useRuntimeConfig()`.
10721079
*
10731080
* Values can be overridden at runtime using environment variables with
1074-
* the `NITRO_` prefix (configurable via `nitro.envPrefix`).
1081+
* the `NITRO_` prefix. An alternative prefix can be configured via
1082+
* `nitro.envPrefix` or `NITRO_ENV_PREFIX`.
10751083
*
10761084
* @see https://nitro.build/config#runtimeconfig
10771085
*/

src/types/nitro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export interface NitroFrameworkInfo {
7777

7878
/**
7979
* Build info written to `.output/nitro.json` (production) or
80-
* `.nitro/dev/nitro.json` (development).
80+
* `node_modules/.nitro/nitro.dev.json` (development).
8181
*
8282
* Contains preset, framework, version, and command information.
8383
*/

src/types/route-rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface NitroRouteConfig {
2222
* Server-side response caching options.
2323
*
2424
* When set to an options object, matching handlers are wrapped with
25-
* `defineCachedEventHandler`. Set to `false` to disable caching.
25+
* `defineCachedHandler`. Set to `false` to disable caching.
2626
*
2727
* @see https://nitro.build/docs/cache
2828
*/

src/types/runtime/nitro.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@ import type { H3Core, HTTPEvent } from "h3";
22
import type { HookableCore } from "hookable";
33
import type { ServerRequest } from "srvx";
44

5+
/**
6+
* The runtime Nitro application instance accessible via `useNitroApp()`.
7+
*
8+
* @see https://nitro.build/docs/plugins
9+
*/
510
export interface NitroApp {
611
fetch: (req: Request) => Response | Promise<Response>;
712
h3?: H3Core;
813
hooks?: HookableCore<NitroRuntimeHooks>;
914
captureError?: CaptureError;
1015
}
1116

17+
/**
18+
* A Nitro runtime plugin function.
19+
*
20+
* Receives the {@link NitroApp} instance (with `hooks` guaranteed to exist)
21+
* and can register runtime hooks or modify the app.
22+
*
23+
* @see https://nitro.build/docs/plugins
24+
*/
1225
export interface NitroAppPlugin {
1326
(
1427
nitro: NitroApp & {
@@ -38,11 +51,13 @@ export interface RenderContext {
3851
response?: Partial<RenderResponse>;
3952
}
4053

54+
/** Context provided when an error is captured at runtime. */
4155
export interface CapturedErrorContext {
4256
event?: HTTPEvent;
4357
tags?: string[];
4458
}
4559

60+
/** Error capture callback used by `nitroApp.captureError`. */
4661
export type CaptureError = (error: Error, context: CapturedErrorContext) => void;
4762

4863
/**

0 commit comments

Comments
 (0)