nitro 3.0.260415-beta → 3.0.260429-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD-PARTY-LICENSES.md +32 -2
- package/dist/_build/common.mjs +43 -29
- package/dist/_build/rolldown.mjs +1 -1
- package/dist/_build/rollup.mjs +2 -2
- package/dist/_build/vite.build.mjs +1 -1
- package/dist/_chunks/nitro.mjs +5 -5
- package/dist/_chunks/nitro2.mjs +1 -1
- package/dist/_chunks/nitro3.mjs +1 -1
- package/dist/_chunks/nitro4.mjs +2 -2
- package/dist/_chunks/utils.mjs +2 -2
- package/dist/_common.mjs +1 -1
- package/dist/_dev.mjs +3 -2
- package/dist/_libs/c12+rc9.mjs +21 -9
- package/dist/_libs/hasown+resolve+deepmerge.mjs +47 -34
- package/dist/_libs/httpxy.d.mts +1 -3
- package/dist/_libs/httpxy.mjs +5 -5
- package/dist/_libs/nypm+tinyexec.mjs +129 -98
- package/dist/_libs/pkg-types.d.mts +7 -4
- package/dist/_libs/plugin-inject.mjs +3 -1
- package/dist/_libs/pluginutils.mjs +4 -2
- package/dist/_libs/readdirp+chokidar.mjs +2 -1
- package/dist/_libs/{unimport+unplugin.mjs → unimport+unplugin+oxc-parser.mjs} +49 -37
- package/dist/_libs/unplugin+unimport.d.mts +1 -1
- package/dist/_presets.mjs +2 -1
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/deploy.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +1 -1
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/preview.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/docs/0.docs/5.cache.md +53 -9
- package/dist/node_modules/ufo/dist/index.mjs +2 -2
- package/dist/node_modules/ufo/package.json +9 -9
- package/dist/presets/azure/runtime/azure-swa.mjs +2 -0
- package/dist/runtime/internal/route-rules.d.mts +1 -0
- package/dist/runtime/internal/route-rules.mjs +29 -1
- package/dist/runtime/internal/routes/scalar.mjs +1 -0
- package/dist/types/index.d.mts +922 -64
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +11 -5
- package/package.json +28 -27
- package/dist/_libs/_.mjs +0 -2
- package/dist/_libs/_2.mjs +0 -2
- package/dist/_libs/_3.mjs +0 -2
- package/dist/_libs/_4.mjs +0 -2
- package/dist/_libs/_5.mjs +0 -2
- package/dist/_libs/_6.mjs +0 -2
- package/dist/_libs/_7.mjs +0 -2
- package/dist/_libs/escape-string-regexp.mjs +0 -5
package/dist/types/index.d.mts
CHANGED
|
@@ -99,13 +99,31 @@ interface AssetMeta {
|
|
|
99
99
|
etag?: string;
|
|
100
100
|
mtime?: string;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Options for `defineCachedHandler`.
|
|
104
|
+
*
|
|
105
|
+
* @see https://nitro.build/docs/cache
|
|
106
|
+
*/
|
|
102
107
|
interface CachedEventHandlerOptions extends Omit<_$ocache.CachedEventHandlerOptions<HTTPEvent & _$ocache.HTTPEvent>, "toResponse" | "createResponse" | "handleCacheHeaders"> {}
|
|
108
|
+
/**
|
|
109
|
+
* The runtime Nitro application instance accessible via `useNitroApp()`.
|
|
110
|
+
*
|
|
111
|
+
* @see https://nitro.build/docs/plugins
|
|
112
|
+
*/
|
|
103
113
|
interface NitroApp {
|
|
104
114
|
fetch: (req: Request) => Response | Promise<Response>;
|
|
105
115
|
h3?: H3Core;
|
|
106
116
|
hooks?: HookableCore<NitroRuntimeHooks>;
|
|
107
117
|
captureError?: CaptureError;
|
|
108
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* A Nitro runtime plugin function.
|
|
121
|
+
*
|
|
122
|
+
* Receives the {@link NitroApp} instance (with `hooks` guaranteed to exist)
|
|
123
|
+
* and can register runtime hooks or modify the app.
|
|
124
|
+
*
|
|
125
|
+
* @see https://nitro.build/docs/plugins
|
|
126
|
+
*/
|
|
109
127
|
interface NitroAppPlugin {
|
|
110
128
|
(nitro: NitroApp & {
|
|
111
129
|
hooks: NonNullable<NitroApp["hooks"]>;
|
|
@@ -126,11 +144,19 @@ interface RenderContext {
|
|
|
126
144
|
render: RenderHandler;
|
|
127
145
|
response?: Partial<RenderResponse>;
|
|
128
146
|
}
|
|
147
|
+
/** Context provided when an error is captured at runtime. */
|
|
129
148
|
interface CapturedErrorContext {
|
|
130
149
|
event?: HTTPEvent;
|
|
131
150
|
tags?: string[];
|
|
132
151
|
}
|
|
152
|
+
/** Error capture callback used by `nitroApp.captureError`. */
|
|
133
153
|
type CaptureError = (error: Error, context: CapturedErrorContext) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Runtime hooks available in Nitro plugins.
|
|
156
|
+
*
|
|
157
|
+
* @see https://nitro.build/docs/plugins
|
|
158
|
+
* @see https://nitro.build/docs/lifecycle
|
|
159
|
+
*/
|
|
134
160
|
interface NitroRuntimeHooks {
|
|
135
161
|
close: () => void;
|
|
136
162
|
error: CaptureError;
|
|
@@ -1151,6 +1177,10 @@ interface Observability {
|
|
|
1151
1177
|
head_sampling_rate?: number; /** Set to false to disable invocation logs */
|
|
1152
1178
|
invocation_logs?: boolean;
|
|
1153
1179
|
};
|
|
1180
|
+
traces?: {
|
|
1181
|
+
enabled?: boolean; /** The sampling rate */
|
|
1182
|
+
head_sampling_rate?: number;
|
|
1183
|
+
};
|
|
1154
1184
|
}
|
|
1155
1185
|
/**
|
|
1156
1186
|
* This is the static type definition for the configuration object.
|
|
@@ -2352,7 +2382,12 @@ interface OAuthFlowObject extends Extensable {
|
|
|
2352
2382
|
type SecurityRequirementObject = { [P in keyof ComponentsObject["securitySchemes"]]?: string[] };
|
|
2353
2383
|
type $defs = Record<string, SchemaObject>;
|
|
2354
2384
|
type MaybeArray$1<T> = T | T[];
|
|
2355
|
-
/**
|
|
2385
|
+
/**
|
|
2386
|
+
* Route-level metadata attached to event handlers.
|
|
2387
|
+
*
|
|
2388
|
+
* @experimental
|
|
2389
|
+
* @see https://nitro.build/docs/routing
|
|
2390
|
+
*/
|
|
2356
2391
|
interface NitroRouteMeta {
|
|
2357
2392
|
openAPI?: OperationObject & {
|
|
2358
2393
|
$global?: Pick<OpenAPI3, "components"> & Extensable;
|
|
@@ -2360,32 +2395,47 @@ interface NitroRouteMeta {
|
|
|
2360
2395
|
}
|
|
2361
2396
|
interface NitroHandlerCommon {
|
|
2362
2397
|
/**
|
|
2363
|
-
* HTTP pathname pattern to match
|
|
2398
|
+
* HTTP pathname pattern to match.
|
|
2364
2399
|
*
|
|
2365
|
-
*
|
|
2400
|
+
* @example "/test", "/api/:id", "/blog/**"
|
|
2366
2401
|
*/
|
|
2367
2402
|
route: string;
|
|
2368
2403
|
/**
|
|
2369
|
-
* HTTP method to match
|
|
2404
|
+
* HTTP method to match.
|
|
2370
2405
|
*/
|
|
2371
2406
|
method?: HTTPMethod;
|
|
2372
2407
|
/**
|
|
2373
|
-
* Run handler as a middleware before other route
|
|
2408
|
+
* Run handler as a middleware before other route handlers.
|
|
2374
2409
|
*/
|
|
2375
2410
|
middleware?: boolean;
|
|
2376
2411
|
/**
|
|
2377
|
-
*
|
|
2412
|
+
* Route metadata (e.g. OpenAPI operation info).
|
|
2378
2413
|
*/
|
|
2379
2414
|
meta?: NitroRouteMeta;
|
|
2380
2415
|
}
|
|
2416
|
+
/**
|
|
2417
|
+
* Handler module format.
|
|
2418
|
+
*
|
|
2419
|
+
* - `"web"` — standard Web API handler (default).
|
|
2420
|
+
* - `"node"` — Node.js-style handler, automatically converted to web-compatible.
|
|
2421
|
+
*/
|
|
2381
2422
|
type EventHandlerFormat = "web" | "node";
|
|
2423
|
+
/**
|
|
2424
|
+
* Event handler registration for build-time bundling.
|
|
2425
|
+
*
|
|
2426
|
+
* Handlers are file references that the bundler imports and transforms.
|
|
2427
|
+
* For runtime-only handlers in development, use {@link NitroDevEventHandler}.
|
|
2428
|
+
*
|
|
2429
|
+
* @see https://nitro.build/config#handlers
|
|
2430
|
+
* @see https://nitro.build/docs/routing
|
|
2431
|
+
*/
|
|
2382
2432
|
interface NitroEventHandler extends NitroHandlerCommon {
|
|
2383
2433
|
/**
|
|
2384
|
-
* Use lazy loading to import handler
|
|
2434
|
+
* Use lazy loading to import handler.
|
|
2385
2435
|
*/
|
|
2386
2436
|
lazy?: boolean;
|
|
2387
2437
|
/**
|
|
2388
|
-
* Path to event handler
|
|
2438
|
+
* Path to event handler.
|
|
2389
2439
|
*/
|
|
2390
2440
|
handler: string;
|
|
2391
2441
|
/**
|
|
@@ -2394,15 +2444,40 @@ interface NitroEventHandler extends NitroHandlerCommon {
|
|
|
2394
2444
|
* Default is `"web"`. If set to `"node"`, the handler will be converted into a web compatible handler.
|
|
2395
2445
|
*/
|
|
2396
2446
|
format?: EventHandlerFormat;
|
|
2447
|
+
/**
|
|
2448
|
+
* Environments to include and bundle this handler.
|
|
2449
|
+
*
|
|
2450
|
+
* @example
|
|
2451
|
+
* ```ts
|
|
2452
|
+
* env: ["dev", "prod"]
|
|
2453
|
+
* env: "prerender"
|
|
2454
|
+
* ```
|
|
2455
|
+
*/
|
|
2397
2456
|
env?: MaybeArray$1<"dev" | "prod" | "prerender" | PresetName | (string & {})>;
|
|
2398
2457
|
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Development-only event handler with an inline handler function.
|
|
2460
|
+
*
|
|
2461
|
+
* These handlers are available only during `nitro dev` and are not
|
|
2462
|
+
* included in production builds.
|
|
2463
|
+
*
|
|
2464
|
+
* @see https://nitro.build/config#devhandlers
|
|
2465
|
+
*/
|
|
2399
2466
|
interface NitroDevEventHandler extends NitroHandlerCommon {
|
|
2400
2467
|
/**
|
|
2401
|
-
* Event handler function
|
|
2468
|
+
* Event handler function.
|
|
2402
2469
|
*/
|
|
2403
2470
|
handler: HTTPHandler;
|
|
2404
2471
|
}
|
|
2405
2472
|
type MaybePromise<T> = T | Promise<T>;
|
|
2473
|
+
/**
|
|
2474
|
+
* Custom error handler function signature.
|
|
2475
|
+
*
|
|
2476
|
+
* Receives the error, the H3 event, and a helper object containing the
|
|
2477
|
+
* `defaultHandler` for fallback rendering.
|
|
2478
|
+
*
|
|
2479
|
+
* @see https://nitro.build/config#errorhandler
|
|
2480
|
+
*/
|
|
2406
2481
|
type NitroErrorHandler = (error: HTTPError, event: HTTPEvent, _: {
|
|
2407
2482
|
defaultHandler: (error: HTTPError, event: HTTPEvent, opts?: {
|
|
2408
2483
|
silent?: boolean;
|
|
@@ -2449,24 +2524,128 @@ declare class Router<T> {
|
|
|
2449
2524
|
type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc["length"]]>;
|
|
2450
2525
|
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
2451
2526
|
type ExcludeFunctions<G extends Record<string, any>> = Pick<G, { [P in keyof G]: NonNullable<G[P]> extends Function ? never : P }[keyof G]>;
|
|
2452
|
-
|
|
2527
|
+
/** Valid HTTP status code range (100–599). */
|
|
2528
|
+
type HTTPstatus = IntRange<100, 599>;
|
|
2529
|
+
/**
|
|
2530
|
+
* Route rule options that can be applied to matching route patterns.
|
|
2531
|
+
*
|
|
2532
|
+
* Rules are matched against the request path (without query string or
|
|
2533
|
+
* `app.baseURL`) using rou3 pattern matching. When multiple patterns match,
|
|
2534
|
+
* their options are deep-merged with more-specific patterns taking precedence.
|
|
2535
|
+
*
|
|
2536
|
+
*
|
|
2537
|
+
* @see https://nitro.build/docs/routing#route-rules
|
|
2538
|
+
*/
|
|
2453
2539
|
interface NitroRouteConfig {
|
|
2540
|
+
/**
|
|
2541
|
+
* Enables runtime caching.
|
|
2542
|
+
*
|
|
2543
|
+
* When set to an options object, matching handlers are wrapped with
|
|
2544
|
+
* `defineCachedHandler`. Set to `false` to disable caching.
|
|
2545
|
+
*
|
|
2546
|
+
* @see https://nitro.build/docs/cache
|
|
2547
|
+
*/
|
|
2454
2548
|
cache?: ExcludeFunctions<CachedEventHandlerOptions> | false;
|
|
2549
|
+
/**
|
|
2550
|
+
* Response headers to set for matching routes.
|
|
2551
|
+
*
|
|
2552
|
+
* @example
|
|
2553
|
+
* ```ts
|
|
2554
|
+
* headers: { 'cache-control': 's-maxage=60' }
|
|
2555
|
+
* ```
|
|
2556
|
+
*
|
|
2557
|
+
* @see https://nitro.build/docs/routing#headers
|
|
2558
|
+
*/
|
|
2455
2559
|
headers?: Record<string, string>;
|
|
2560
|
+
/**
|
|
2561
|
+
* Server-side redirect for matching routes.
|
|
2562
|
+
*
|
|
2563
|
+
* A plain string defaults to status `307`. Use an object to specify a
|
|
2564
|
+
* custom status code. When the rule key ends with `/**` and `to` also
|
|
2565
|
+
* ends with `/**`, the matched path tail is appended to the destination.
|
|
2566
|
+
*
|
|
2567
|
+
* @example
|
|
2568
|
+
* ```ts
|
|
2569
|
+
* redirect: '/new-page'
|
|
2570
|
+
* redirect: { to: '/new-page', status: 301 }
|
|
2571
|
+
* ```
|
|
2572
|
+
*
|
|
2573
|
+
* @see https://nitro.build/docs/routing#redirect
|
|
2574
|
+
*/
|
|
2456
2575
|
redirect?: string | {
|
|
2457
2576
|
to: string;
|
|
2458
2577
|
status?: HTTPstatus;
|
|
2459
2578
|
};
|
|
2579
|
+
/**
|
|
2580
|
+
* Add this route to the prerender queue at build time.
|
|
2581
|
+
*
|
|
2582
|
+
* Only exact paths are collected; wildcard rules apply at runtime but are
|
|
2583
|
+
* not auto-added to the queue. Set to `false` to explicitly exclude a
|
|
2584
|
+
* route from prerendering.
|
|
2585
|
+
*
|
|
2586
|
+
* @see https://nitro.build/docs/routing#prerender
|
|
2587
|
+
*/
|
|
2460
2588
|
prerender?: boolean;
|
|
2589
|
+
/**
|
|
2590
|
+
* Proxy matching requests to another origin or internal path.
|
|
2591
|
+
*
|
|
2592
|
+
* A plain string specifies the destination. Use an object for additional
|
|
2593
|
+
* H3 {@link ProxyOptions}. Wildcard `/**` tail behavior works the same
|
|
2594
|
+
* as {@link NitroRouteConfig.redirect | redirect}.
|
|
2595
|
+
*
|
|
2596
|
+
* **IMPORTANT:** Proxy target should be a trusted and safe origin.
|
|
2597
|
+
*
|
|
2598
|
+
* @see https://nitro.build/docs/routing#proxy
|
|
2599
|
+
*/
|
|
2461
2600
|
proxy?: string | ({
|
|
2462
2601
|
to: string;
|
|
2463
2602
|
} & ProxyOptions);
|
|
2603
|
+
/**
|
|
2604
|
+
* Incremental Static Regeneration on supported platforms.
|
|
2605
|
+
*
|
|
2606
|
+
* - `number` — revalidation time in seconds.
|
|
2607
|
+
* - `true` — never expires until the next deployment.
|
|
2608
|
+
* - `false` — disable ISR for this route.
|
|
2609
|
+
*
|
|
2610
|
+
* Only handled by presets with native support (e.g. Vercel, Netlify).
|
|
2611
|
+
* Ignored on platforms without ISR support.
|
|
2612
|
+
*
|
|
2613
|
+
* @see https://nitro.build/docs/routing#isr-vercel
|
|
2614
|
+
*/
|
|
2464
2615
|
isr?: number | boolean | VercelISRConfig;
|
|
2616
|
+
/**
|
|
2617
|
+
* Protect matching routes with HTTP Basic Authentication.
|
|
2618
|
+
*
|
|
2619
|
+
* **IMPORTANT:** Depending on the deployment platform, this might not apply to public assets.
|
|
2620
|
+
*
|
|
2621
|
+
* Set to `false` to disable auth inherited from a less-specific pattern.
|
|
2622
|
+
*
|
|
2623
|
+
* @see https://nitro.build/docs/routing#basic-auth
|
|
2624
|
+
*/
|
|
2465
2625
|
basicAuth?: Pick<BasicAuthOptions, "password" | "username" | "realm"> | false;
|
|
2626
|
+
/**
|
|
2627
|
+
* Shortcut to add permissive CORS headers (`access-control-allow-origin: *`,
|
|
2628
|
+
* `access-control-allow-methods: *`, `access-control-allow-headers: *`,
|
|
2629
|
+
* `access-control-max-age: 0`). Override individual headers via
|
|
2630
|
+
* {@link NitroRouteConfig.headers | headers}.
|
|
2631
|
+
*
|
|
2632
|
+
* @see https://nitro.build/docs/routing#cors
|
|
2633
|
+
*/
|
|
2466
2634
|
cors?: boolean;
|
|
2635
|
+
/**
|
|
2636
|
+
* Shortcut for `cache: { swr: true, maxAge?: number }`.
|
|
2637
|
+
*
|
|
2638
|
+
* - `true` — enable SWR with no explicit `maxAge`.
|
|
2639
|
+
* - `number` — enable SWR with the given `maxAge` in seconds.
|
|
2640
|
+
*
|
|
2641
|
+
* @see https://nitro.build/docs/routing#caching-swr-static
|
|
2642
|
+
*/
|
|
2467
2643
|
swr?: boolean | number;
|
|
2468
2644
|
static?: boolean | number;
|
|
2469
2645
|
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Normalized route rules used at runtime after shortcut resolution.
|
|
2648
|
+
*/
|
|
2470
2649
|
interface NitroRouteRules extends Omit<NitroRouteConfig, "redirect" | "cors" | "swr" | "static"> {
|
|
2471
2650
|
redirect?: {
|
|
2472
2651
|
to: string;
|
|
@@ -2525,11 +2704,17 @@ interface VercelISRConfig {
|
|
|
2525
2704
|
exposeErrBody?: boolean;
|
|
2526
2705
|
}
|
|
2527
2706
|
type MaybeArray<T> = T | T[];
|
|
2707
|
+
/** Nitro package metadata including version information. */
|
|
2528
2708
|
interface NitroMeta {
|
|
2529
2709
|
version: string;
|
|
2530
2710
|
majorVersion: number;
|
|
2531
|
-
[key: string]: unknown;
|
|
2532
2711
|
}
|
|
2712
|
+
/**
|
|
2713
|
+
* The core Nitro instance available throughout the build lifecycle.
|
|
2714
|
+
*
|
|
2715
|
+
* Provides access to resolved options, hooks, the virtual file system,
|
|
2716
|
+
* scanned handlers, and utility methods.
|
|
2717
|
+
*/
|
|
2533
2718
|
interface Nitro {
|
|
2534
2719
|
meta: NitroMeta;
|
|
2535
2720
|
options: NitroOptions;
|
|
@@ -2563,16 +2748,31 @@ interface Nitro {
|
|
|
2563
2748
|
contentType?: string;
|
|
2564
2749
|
}>;
|
|
2565
2750
|
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Subset of {@link NitroConfig} that can be updated at runtime via
|
|
2753
|
+
* `nitro.updateConfig()`.
|
|
2754
|
+
*/
|
|
2566
2755
|
type NitroDynamicConfig = Pick<NitroConfig, "runtimeConfig" | "routeRules">;
|
|
2567
2756
|
type NitroTypes = {
|
|
2568
2757
|
routes: Record<string, Partial<Record<HTTPMethod | "default", string[]>>>;
|
|
2569
2758
|
tsConfig?: TSConfig;
|
|
2570
2759
|
};
|
|
2760
|
+
/**
|
|
2761
|
+
* Metadata about the framework using Nitro.
|
|
2762
|
+
*
|
|
2763
|
+
* @see https://nitro.build/config#framework
|
|
2764
|
+
*/
|
|
2571
2765
|
interface NitroFrameworkInfo {
|
|
2572
2766
|
name?: "nitro" | (string & {});
|
|
2573
2767
|
version?: string;
|
|
2574
2768
|
}
|
|
2575
|
-
/**
|
|
2769
|
+
/**
|
|
2770
|
+
* Build info written to `<output.dir>/nitro.json` (production, default
|
|
2771
|
+
* `.output/nitro.json`) or `<rootDir>/node_modules/.nitro/nitro.dev.json`
|
|
2772
|
+
* (development).
|
|
2773
|
+
*
|
|
2774
|
+
* Contains preset, framework, version, and command information.
|
|
2775
|
+
*/
|
|
2576
2776
|
interface NitroBuildInfo {
|
|
2577
2777
|
date: string;
|
|
2578
2778
|
preset: PresetName;
|
|
@@ -2630,15 +2830,45 @@ interface NitroHooks {
|
|
|
2630
2830
|
failedRoutes: PrerenderRoute[];
|
|
2631
2831
|
}) => HookResult;
|
|
2632
2832
|
}
|
|
2833
|
+
/**
|
|
2834
|
+
* Accepted input formats for Nitro modules.
|
|
2835
|
+
*
|
|
2836
|
+
* Can be a module path string, a {@link NitroModule} object, a bare setup
|
|
2837
|
+
* function, or an object with a `nitro` key containing a {@link NitroModule}.
|
|
2838
|
+
*
|
|
2839
|
+
* @see https://nitro.build/config#modules
|
|
2840
|
+
*/
|
|
2633
2841
|
type NitroModuleInput = string | NitroModule | NitroModule["setup"] | {
|
|
2634
2842
|
nitro: NitroModule;
|
|
2635
2843
|
};
|
|
2844
|
+
/**
|
|
2845
|
+
* A Nitro module that extends behavior during initialization.
|
|
2846
|
+
*
|
|
2847
|
+
* Modules receive the {@link Nitro} instance and can register hooks,
|
|
2848
|
+
* add handlers, modify options, or perform other setup tasks.
|
|
2849
|
+
*
|
|
2850
|
+
* @example
|
|
2851
|
+
* ```ts
|
|
2852
|
+
* export default {
|
|
2853
|
+
* name: "my-module",
|
|
2854
|
+
* nitro: {
|
|
2855
|
+
* setup(nitro) {
|
|
2856
|
+
* nitro.hooks.hook("compiled", () => {
|
|
2857
|
+
* console.log("Build complete!");
|
|
2858
|
+
* });
|
|
2859
|
+
* },
|
|
2860
|
+
* },
|
|
2861
|
+
* };
|
|
2862
|
+
* ```
|
|
2863
|
+
*
|
|
2864
|
+
* @see https://nitro.build/config#modules
|
|
2865
|
+
*/
|
|
2636
2866
|
interface NitroModule {
|
|
2637
2867
|
name?: string;
|
|
2638
2868
|
setup: (this: void, nitro: Nitro) => void | Promise<void>;
|
|
2639
2869
|
}
|
|
2640
2870
|
/**
|
|
2641
|
-
* Swagger UI configuration options
|
|
2871
|
+
* Swagger UI configuration options.
|
|
2642
2872
|
*
|
|
2643
2873
|
* @see https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/
|
|
2644
2874
|
*/
|
|
@@ -2668,13 +2898,14 @@ interface SwaggerUIConfig {
|
|
|
2668
2898
|
[key: string]: unknown;
|
|
2669
2899
|
}
|
|
2670
2900
|
/**
|
|
2671
|
-
* Nitro OpenAPI configuration
|
|
2901
|
+
* Nitro OpenAPI configuration.
|
|
2672
2902
|
*
|
|
2903
|
+
* @see https://nitro.build/config#openapi
|
|
2673
2904
|
* @see https://nitro.build/docs/openapi
|
|
2674
2905
|
*/
|
|
2675
2906
|
interface NitroOpenAPIConfig {
|
|
2676
2907
|
/**
|
|
2677
|
-
* OpenAPI
|
|
2908
|
+
* OpenAPI document metadata.
|
|
2678
2909
|
*/
|
|
2679
2910
|
meta?: {
|
|
2680
2911
|
title?: string;
|
|
@@ -2682,40 +2913,50 @@ interface NitroOpenAPIConfig {
|
|
|
2682
2913
|
version?: string;
|
|
2683
2914
|
};
|
|
2684
2915
|
/**
|
|
2685
|
-
* OpenAPI
|
|
2916
|
+
* Route for the OpenAPI JSON endpoint.
|
|
2686
2917
|
*
|
|
2687
|
-
*
|
|
2918
|
+
* @default "/_openapi.json"
|
|
2688
2919
|
*/
|
|
2689
2920
|
route?: string;
|
|
2690
2921
|
/**
|
|
2691
|
-
* Enable OpenAPI generation for production builds
|
|
2922
|
+
* Enable OpenAPI generation for production builds.
|
|
2923
|
+
*
|
|
2924
|
+
* - `"runtime"` — generate at runtime (allows middleware usage).
|
|
2925
|
+
* - `"prerender"` — prerender the JSON response at build time (most efficient).
|
|
2926
|
+
* - `false` — disable in production.
|
|
2927
|
+
*
|
|
2928
|
+
* @see https://nitro.build/config#openapi
|
|
2692
2929
|
*/
|
|
2693
2930
|
production?: false | "runtime" | "prerender";
|
|
2694
2931
|
/**
|
|
2695
|
-
* UI configurations
|
|
2932
|
+
* UI configurations for interactive API documentation.
|
|
2696
2933
|
*/
|
|
2697
2934
|
ui?: {
|
|
2698
2935
|
/**
|
|
2699
|
-
* Scalar UI configuration
|
|
2936
|
+
* Scalar UI configuration.
|
|
2937
|
+
*
|
|
2938
|
+
* Set to `false` to disable.
|
|
2700
2939
|
*/
|
|
2701
2940
|
scalar?: false | (Partial<unknown> & {
|
|
2702
2941
|
/**
|
|
2703
|
-
* Scalar UI
|
|
2942
|
+
* Route for Scalar UI.
|
|
2704
2943
|
*
|
|
2705
|
-
*
|
|
2944
|
+
* @default "/_scalar"
|
|
2706
2945
|
*/
|
|
2707
2946
|
route?: string;
|
|
2708
2947
|
});
|
|
2709
2948
|
/**
|
|
2710
|
-
* Swagger UI configuration
|
|
2949
|
+
* Swagger UI configuration.
|
|
2950
|
+
*
|
|
2951
|
+
* Set to `false` to disable.
|
|
2711
2952
|
*
|
|
2712
2953
|
* @see https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/
|
|
2713
2954
|
*/
|
|
2714
2955
|
swagger?: false | (SwaggerUIConfig & {
|
|
2715
2956
|
/**
|
|
2716
|
-
* Swagger UI
|
|
2957
|
+
* Route for Swagger UI.
|
|
2717
2958
|
*
|
|
2718
|
-
*
|
|
2959
|
+
* @default "/_swagger"
|
|
2719
2960
|
*/
|
|
2720
2961
|
route?: string;
|
|
2721
2962
|
});
|
|
@@ -2732,7 +2973,12 @@ interface NitroPresetMeta$1 {
|
|
|
2732
2973
|
}
|
|
2733
2974
|
type RollupCommonJSOptions = NonNullable<Parameters<typeof commonjs.default>[0]>;
|
|
2734
2975
|
/**
|
|
2735
|
-
* Nitro
|
|
2976
|
+
* Fully resolved Nitro options available on `nitro.options`.
|
|
2977
|
+
*
|
|
2978
|
+
* These are the normalized options after preset defaults and user config
|
|
2979
|
+
* have been merged. For the user-facing input type, see {@link NitroConfig}.
|
|
2980
|
+
*
|
|
2981
|
+
* @see https://nitro.build/config
|
|
2736
2982
|
*/
|
|
2737
2983
|
interface NitroOptions extends PresetOptions {
|
|
2738
2984
|
_config: NitroConfig;
|
|
@@ -2740,42 +2986,226 @@ interface NitroOptions extends PresetOptions {
|
|
|
2740
2986
|
_cli?: {
|
|
2741
2987
|
command?: string;
|
|
2742
2988
|
};
|
|
2989
|
+
/**
|
|
2990
|
+
* Opt-in date for deployment provider and runtime compatibility features.
|
|
2991
|
+
*
|
|
2992
|
+
* Providers introduce new features that Nitro presets can leverage, but
|
|
2993
|
+
* some need to be explicitly opted into. Set to the latest tested date
|
|
2994
|
+
* in `YYYY-MM-DD` format.
|
|
2995
|
+
*
|
|
2996
|
+
* @default "latest"
|
|
2997
|
+
* @see https://nitro.build/config#compatibilitydate
|
|
2998
|
+
*/
|
|
2743
2999
|
compatibilityDate: CompatibilityDates;
|
|
3000
|
+
/**
|
|
3001
|
+
* Enables debugging nitro (build time) hooks in the console.
|
|
3002
|
+
*
|
|
3003
|
+
* @see https://nitro.build/config#debug
|
|
3004
|
+
*/
|
|
2744
3005
|
debug: boolean;
|
|
3006
|
+
/**
|
|
3007
|
+
* Deployment preset name.
|
|
3008
|
+
*
|
|
3009
|
+
* Determines how the production bundle is built and optimized for a
|
|
3010
|
+
* specific hosting provider or runtime. Auto-detected in known
|
|
3011
|
+
* environments when not set. Use the `NITRO_PRESET` environment
|
|
3012
|
+
* variable as an alternative.
|
|
3013
|
+
*
|
|
3014
|
+
* @see https://nitro.build/config#preset
|
|
3015
|
+
*/
|
|
2745
3016
|
preset: PresetName;
|
|
3017
|
+
/**
|
|
3018
|
+
* Disable the server build and only output prerendered static assets.
|
|
3019
|
+
*
|
|
3020
|
+
* When `true`, the server bundle is skipped entirely and only the public directory is produced.
|
|
3021
|
+
* Typically used by the `static` preset and its derivatives (e.g., `github-pages`, `vercel-static`).
|
|
3022
|
+
*
|
|
3023
|
+
* Note: This does not enable prerendering on its own — configure `prerender` options separately.
|
|
3024
|
+
*
|
|
3025
|
+
* @see https://nitro.build/config#static
|
|
3026
|
+
*/
|
|
2746
3027
|
static: boolean;
|
|
3028
|
+
/**
|
|
3029
|
+
* Log verbosity level.
|
|
3030
|
+
*
|
|
3031
|
+
* Defaults to `3`, or `1` when a testing environment is detected.
|
|
3032
|
+
*
|
|
3033
|
+
* @see https://nitro.build/config#loglevel
|
|
3034
|
+
* @see https://github.com/unjs/consola
|
|
3035
|
+
*/
|
|
2747
3036
|
logLevel: LogLevel;
|
|
3037
|
+
/**
|
|
3038
|
+
* Server runtime configuration accessible via `useRuntimeConfig()`.
|
|
3039
|
+
*
|
|
3040
|
+
* Values can be overridden at runtime using environment variables with
|
|
3041
|
+
* the `NITRO_` prefix. An alternative prefix can be configured via
|
|
3042
|
+
* `runtimeConfig.nitro.envPrefix` or `NITRO_ENV_PREFIX`.
|
|
3043
|
+
*
|
|
3044
|
+
* **Note:** The `nitro` namespace is reserved for internal use.
|
|
3045
|
+
*
|
|
3046
|
+
* @example
|
|
3047
|
+
* ```ts
|
|
3048
|
+
* runtimeConfig: {
|
|
3049
|
+
* apiSecret: "default-secret", // override with NITRO_API_SECRET
|
|
3050
|
+
* }
|
|
3051
|
+
* ```
|
|
3052
|
+
*
|
|
3053
|
+
* @see https://nitro.build/config#runtimeconfig
|
|
3054
|
+
*/
|
|
2748
3055
|
runtimeConfig: NitroRuntimeConfig;
|
|
3056
|
+
/**
|
|
3057
|
+
* Project workspace root directory.
|
|
3058
|
+
*
|
|
3059
|
+
* Auto-detected from the workspace (e.g. pnpm workspace) when not set.
|
|
3060
|
+
*
|
|
3061
|
+
* @see https://nitro.build/config#workspacedir
|
|
3062
|
+
*/
|
|
2749
3063
|
workspaceDir: string;
|
|
3064
|
+
/**
|
|
3065
|
+
* Project main root directory.
|
|
3066
|
+
*
|
|
3067
|
+
* @see https://nitro.build/config#rootdir
|
|
3068
|
+
*/
|
|
2750
3069
|
rootDir: string;
|
|
3070
|
+
/**
|
|
3071
|
+
* Server directory for scanning `api/`, `routes/`, `plugins/`, `utils/`,
|
|
3072
|
+
* `middleware/`, `modules/`, and `tasks/` folders.
|
|
3073
|
+
*
|
|
3074
|
+
* Set to `false` to disable automatic directory scanning, `"./"` to use
|
|
3075
|
+
* the root directory, or `"./server"` to use a `server/` subdirectory.
|
|
3076
|
+
*
|
|
3077
|
+
* @default false
|
|
3078
|
+
* @see https://nitro.build/config#serverdir
|
|
3079
|
+
*/
|
|
2751
3080
|
serverDir: string | false;
|
|
3081
|
+
/**
|
|
3082
|
+
* Additional directories to scan and auto-register files such as API
|
|
3083
|
+
* route handlers.
|
|
3084
|
+
*
|
|
3085
|
+
* @see https://nitro.build/config#scandirs
|
|
3086
|
+
*/
|
|
2752
3087
|
scanDirs: string[];
|
|
3088
|
+
/**
|
|
3089
|
+
* Directory name to scan for API route handlers.
|
|
3090
|
+
*
|
|
3091
|
+
* @default "api"
|
|
3092
|
+
* @see https://nitro.build/config#apidir
|
|
3093
|
+
*/
|
|
2753
3094
|
apiDir: string;
|
|
3095
|
+
/**
|
|
3096
|
+
* Directory name to scan for route handlers.
|
|
3097
|
+
*
|
|
3098
|
+
* @default "routes"
|
|
3099
|
+
* @see https://nitro.build/config#routesdir
|
|
3100
|
+
*/
|
|
2754
3101
|
routesDir: string;
|
|
3102
|
+
/**
|
|
3103
|
+
* Nitro's temporary working directory for build-related files.
|
|
3104
|
+
*
|
|
3105
|
+
* @default "node_modules/.nitro"
|
|
3106
|
+
* @see https://nitro.build/config#builddir
|
|
3107
|
+
*/
|
|
2755
3108
|
buildDir: string;
|
|
3109
|
+
/**
|
|
3110
|
+
* Output directories for the production bundle.
|
|
3111
|
+
*
|
|
3112
|
+
* @see https://nitro.build/config#output
|
|
3113
|
+
*/
|
|
2756
3114
|
output: {
|
|
2757
|
-
dir: string;
|
|
2758
|
-
serverDir: string;
|
|
3115
|
+
/** Production output root directory. */dir: string; /** Server bundle output directory. */
|
|
3116
|
+
serverDir: string; /** Public/static assets output directory. */
|
|
2759
3117
|
publicDir: string;
|
|
2760
3118
|
};
|
|
2761
|
-
/** @deprecated
|
|
3119
|
+
/** @deprecated Migrate to `serverDir`. */
|
|
2762
3120
|
srcDir: string;
|
|
3121
|
+
/**
|
|
3122
|
+
* Storage mount configuration.
|
|
3123
|
+
*
|
|
3124
|
+
* Keys are mount-point paths; values specify the unstorage driver and
|
|
3125
|
+
* its options.
|
|
3126
|
+
*
|
|
3127
|
+
* @see https://nitro.build/config#storage
|
|
3128
|
+
* @see https://nitro.build/docs/storage
|
|
3129
|
+
*/
|
|
2763
3130
|
storage: StorageMounts;
|
|
3131
|
+
/**
|
|
3132
|
+
* Storage mount overrides for development mode.
|
|
3133
|
+
*
|
|
3134
|
+
* Useful for swapping production drivers (e.g. Redis) with local
|
|
3135
|
+
* alternatives (e.g. filesystem) during development.
|
|
3136
|
+
*
|
|
3137
|
+
* @see https://nitro.build/config#devstorage
|
|
3138
|
+
* @see https://nitro.build/docs/storage
|
|
3139
|
+
*/
|
|
2764
3140
|
devStorage: StorageMounts;
|
|
3141
|
+
/**
|
|
3142
|
+
* Database connection configurations.
|
|
3143
|
+
*
|
|
3144
|
+
* Requires `experimental.database: true`.
|
|
3145
|
+
*
|
|
3146
|
+
* @see https://nitro.build/config#database
|
|
3147
|
+
* @see https://nitro.build/docs/database
|
|
3148
|
+
*/
|
|
2765
3149
|
database: DatabaseConnectionConfigs;
|
|
3150
|
+
/**
|
|
3151
|
+
* Database connection overrides for development mode.
|
|
3152
|
+
*
|
|
3153
|
+
* @see https://nitro.build/config#devdatabase
|
|
3154
|
+
* @see https://nitro.build/docs/database
|
|
3155
|
+
*/
|
|
2766
3156
|
devDatabase: DatabaseConnectionConfigs;
|
|
3157
|
+
/**
|
|
3158
|
+
* Server-side rendering entry configuration.
|
|
3159
|
+
*
|
|
3160
|
+
* Points to the main render handler (the file should export an event
|
|
3161
|
+
* handler as default). Set to `false` to disable.
|
|
3162
|
+
*
|
|
3163
|
+
* @see https://nitro.build/config#renderer
|
|
3164
|
+
* @see https://nitro.build/docs/renderer
|
|
3165
|
+
*/
|
|
2767
3166
|
renderer?: {
|
|
2768
3167
|
handler?: string;
|
|
2769
3168
|
static?: boolean;
|
|
2770
3169
|
template?: string;
|
|
2771
3170
|
};
|
|
3171
|
+
/**
|
|
3172
|
+
* Routes that should be server-side rendered.
|
|
3173
|
+
*/
|
|
2772
3174
|
ssrRoutes: string[];
|
|
3175
|
+
/**
|
|
3176
|
+
* Include a static asset handler in the server bundle to serve public assets.
|
|
3177
|
+
*
|
|
3178
|
+
* - `true` or `"node"` — read assets from the filesystem using Node.js `fs`.
|
|
3179
|
+
* - `"deno"` — read assets using Deno file APIs.
|
|
3180
|
+
* - `"inline"` — base64-encode assets directly into the server bundle.
|
|
3181
|
+
* - `false` — do not serve static assets from the server (rely on a CDN or reverse proxy).
|
|
3182
|
+
*
|
|
3183
|
+
* Most self-hosted presets (e.g. `node-server`, `bun`) enable this by default.
|
|
3184
|
+
*
|
|
3185
|
+
* @see https://nitro.build/config#servestatic
|
|
3186
|
+
*/
|
|
2773
3187
|
serveStatic: boolean | "node" | "deno" | "inline";
|
|
3188
|
+
/**
|
|
3189
|
+
* Disable the public output directory entirely.
|
|
3190
|
+
*
|
|
3191
|
+
* Skips preparing the `.output/public` directory, copying public
|
|
3192
|
+
* assets, and prerendering routes.
|
|
3193
|
+
*
|
|
3194
|
+
* @see https://nitro.build/config#nopublicdir
|
|
3195
|
+
*/
|
|
2774
3196
|
noPublicDir: boolean;
|
|
2775
3197
|
tracingChannel?: undefined | TracingOptions;
|
|
3198
|
+
/**
|
|
3199
|
+
* Build manifest options.
|
|
3200
|
+
*/
|
|
2776
3201
|
manifest?: {
|
|
2777
|
-
deploymentId?: string;
|
|
3202
|
+
/** Custom deployment identifier included in the build manifest. */deploymentId?: string;
|
|
2778
3203
|
};
|
|
3204
|
+
/**
|
|
3205
|
+
* Built-in feature flags.
|
|
3206
|
+
*
|
|
3207
|
+
* @see https://nitro.build/config#features
|
|
3208
|
+
*/
|
|
2779
3209
|
features: {
|
|
2780
3210
|
/**
|
|
2781
3211
|
* Enable runtime hooks for request and response.
|
|
@@ -2784,21 +3214,33 @@ interface NitroOptions extends PresetOptions {
|
|
|
2784
3214
|
*/
|
|
2785
3215
|
runtimeHooks?: boolean;
|
|
2786
3216
|
/**
|
|
2787
|
-
* Enable WebSocket support
|
|
3217
|
+
* Enable WebSocket support.
|
|
2788
3218
|
*/
|
|
2789
3219
|
websocket?: boolean;
|
|
2790
3220
|
};
|
|
2791
3221
|
/**
|
|
3222
|
+
* Native wasm compatibility/bundling support configuration.
|
|
3223
|
+
*
|
|
3224
|
+
* Set to `false` to disable.
|
|
2792
3225
|
*
|
|
3226
|
+
* @see https://nitro.build/config#wasm
|
|
2793
3227
|
* @see https://github.com/unjs/unwasm
|
|
2794
3228
|
*/
|
|
2795
3229
|
wasm?: false | UnwasmPluginOptions;
|
|
2796
3230
|
/**
|
|
2797
|
-
* OpenAPI configuration
|
|
3231
|
+
* OpenAPI specification generation and UI configuration.
|
|
2798
3232
|
*
|
|
3233
|
+
* @see https://nitro.build/config#openapi
|
|
2799
3234
|
* @see https://nitro.build/docs/openapi
|
|
2800
3235
|
*/
|
|
2801
3236
|
openAPI?: NitroOpenAPIConfig;
|
|
3237
|
+
/**
|
|
3238
|
+
* Experimental feature flags.
|
|
3239
|
+
*
|
|
3240
|
+
* These features are not yet stable and may change in future releases.
|
|
3241
|
+
*
|
|
3242
|
+
* @see https://nitro.build/config#experimental
|
|
3243
|
+
*/
|
|
2802
3244
|
experimental: {
|
|
2803
3245
|
/**
|
|
2804
3246
|
* Enable experimental OpenAPI support
|
|
@@ -2815,7 +3257,9 @@ interface NitroOptions extends PresetOptions {
|
|
|
2815
3257
|
*/
|
|
2816
3258
|
asyncContext?: boolean;
|
|
2817
3259
|
/**
|
|
2818
|
-
*
|
|
3260
|
+
* Set to `false` to disable sourcemap minification in production builds.
|
|
3261
|
+
*
|
|
3262
|
+
* Sourcemap minification is enabled by default when `sourcemap` is on.
|
|
2819
3263
|
*/
|
|
2820
3264
|
sourcemapMinify?: false;
|
|
2821
3265
|
/**
|
|
@@ -2825,84 +3269,293 @@ interface NitroOptions extends PresetOptions {
|
|
|
2825
3269
|
*/
|
|
2826
3270
|
envExpansion?: boolean;
|
|
2827
3271
|
/**
|
|
2828
|
-
* Enable WebSocket support
|
|
3272
|
+
* Enable WebSocket upgrade support
|
|
2829
3273
|
*
|
|
2830
|
-
* @
|
|
2831
|
-
*
|
|
2832
|
-
* @deprecated use `features.websocket` instead.
|
|
3274
|
+
* @deprecated Use `features.websocket` instead.
|
|
2833
3275
|
*/
|
|
2834
3276
|
websocket?: boolean;
|
|
2835
3277
|
/**
|
|
2836
3278
|
* Enable experimental Database support
|
|
2837
3279
|
*
|
|
2838
|
-
* @see https://nitro.build/
|
|
3280
|
+
* @see https://nitro.build/docs/database
|
|
2839
3281
|
*/
|
|
2840
3282
|
database?: boolean;
|
|
2841
3283
|
/**
|
|
2842
3284
|
* Enable experimental Tasks support
|
|
2843
3285
|
*
|
|
2844
|
-
* @see https://nitro.build/
|
|
3286
|
+
* @see https://nitro.build/docs/tasks
|
|
2845
3287
|
*/
|
|
2846
3288
|
tasks?: boolean;
|
|
2847
3289
|
};
|
|
3290
|
+
/**
|
|
3291
|
+
* Future features pending a major version to avoid breaking changes.
|
|
3292
|
+
*
|
|
3293
|
+
* @see https://nitro.build/config#future
|
|
3294
|
+
*/
|
|
2848
3295
|
future: {
|
|
2849
|
-
nativeSWR?: boolean;
|
|
3296
|
+
/** Opt in to Nitro's native `isr` route rule handling on Vercel and suppress backwards-compatibility warnings for legacy `swr`/`static` route options. */nativeSWR?: boolean;
|
|
2850
3297
|
};
|
|
3298
|
+
/**
|
|
3299
|
+
* Server-side asset directories bundled at build time.
|
|
3300
|
+
*
|
|
3301
|
+
* @see https://nitro.build/config#serverassets
|
|
3302
|
+
* @see https://nitro.build/docs/assets#server-assets
|
|
3303
|
+
*/
|
|
2851
3304
|
serverAssets: ServerAssetDir[];
|
|
3305
|
+
/**
|
|
3306
|
+
* Public asset directories served in development and bundled in production.
|
|
3307
|
+
*
|
|
3308
|
+
* A `public/` directory is added by default when detected.
|
|
3309
|
+
*
|
|
3310
|
+
* @see https://nitro.build/config#publicassets
|
|
3311
|
+
* @see https://nitro.build/docs/assets
|
|
3312
|
+
*/
|
|
2852
3313
|
publicAssets: PublicAssetDir[];
|
|
3314
|
+
/**
|
|
3315
|
+
* Auto-import configuration.
|
|
3316
|
+
*
|
|
3317
|
+
* Set to `false` to disable auto-imports. Pass an object to customize.
|
|
3318
|
+
*
|
|
3319
|
+
* @default false
|
|
3320
|
+
* @see https://nitro.build/config#imports
|
|
3321
|
+
* @see https://github.com/unjs/unimport
|
|
3322
|
+
*/
|
|
2853
3323
|
imports: Partial<UnimportPluginOptions> | false;
|
|
3324
|
+
/**
|
|
3325
|
+
* Nitro modules to extend behavior during initialization.
|
|
3326
|
+
*
|
|
3327
|
+
* Accepts module path strings, {@link NitroModule} objects, or bare setup functions.
|
|
3328
|
+
*
|
|
3329
|
+
* @see https://nitro.build/config#modules
|
|
3330
|
+
*/
|
|
2854
3331
|
modules?: NitroModuleInput[];
|
|
3332
|
+
/**
|
|
3333
|
+
* Paths to Nitro runtime plugins.
|
|
3334
|
+
*
|
|
3335
|
+
* Plugins in the `plugins/` directory are auto-registered.
|
|
3336
|
+
*
|
|
3337
|
+
* @see https://nitro.build/config#plugins
|
|
3338
|
+
* @see https://nitro.build/docs/plugins
|
|
3339
|
+
*/
|
|
2855
3340
|
plugins: string[];
|
|
3341
|
+
/**
|
|
3342
|
+
* Task definitions.
|
|
3343
|
+
*
|
|
3344
|
+
* Each key is a task name with a `handler` path and optional `description`.
|
|
3345
|
+
*
|
|
3346
|
+
* @example
|
|
3347
|
+
* ```ts
|
|
3348
|
+
* tasks: {
|
|
3349
|
+
* "db:migrate": {
|
|
3350
|
+
* handler: "./tasks/db-migrate",
|
|
3351
|
+
* description: "Run database migrations",
|
|
3352
|
+
* },
|
|
3353
|
+
* }
|
|
3354
|
+
* ```
|
|
3355
|
+
*
|
|
3356
|
+
* @see https://nitro.build/config#tasks
|
|
3357
|
+
* @see https://nitro.build/docs/tasks
|
|
3358
|
+
*/
|
|
2856
3359
|
tasks: {
|
|
2857
3360
|
[name: string]: {
|
|
2858
3361
|
handler?: string;
|
|
2859
3362
|
description?: string;
|
|
2860
3363
|
};
|
|
2861
3364
|
};
|
|
3365
|
+
/**
|
|
3366
|
+
* Map of cron expressions to task name(s).
|
|
3367
|
+
*
|
|
3368
|
+
* @example
|
|
3369
|
+
* ```ts
|
|
3370
|
+
* scheduledTasks: {
|
|
3371
|
+
* "0 * * * *": "cleanup:temp",
|
|
3372
|
+
* "*/5 * * * *": ["health:check", "metrics:collect"],
|
|
3373
|
+
* }
|
|
3374
|
+
* ```
|
|
3375
|
+
*
|
|
3376
|
+
* @see https://nitro.build/config#scheduledtasks
|
|
3377
|
+
* @see https://nitro.build/docs/tasks
|
|
3378
|
+
*/
|
|
2862
3379
|
scheduledTasks: {
|
|
2863
3380
|
[cron: string]: string | string[];
|
|
2864
3381
|
};
|
|
3382
|
+
/**
|
|
3383
|
+
* Virtual module definitions.
|
|
3384
|
+
*
|
|
3385
|
+
* A map from dynamic virtual import names to their contents or an async
|
|
3386
|
+
* function that returns them.
|
|
3387
|
+
*
|
|
3388
|
+
* @see https://nitro.build/config#virtual
|
|
3389
|
+
*/
|
|
2865
3390
|
virtual: Record<string, string | (() => string | Promise<string>)>;
|
|
3391
|
+
/**
|
|
3392
|
+
* Pre-compress public assets and prerendered routes.
|
|
3393
|
+
*
|
|
3394
|
+
* Generates gzip and brotli (and zstd when available)
|
|
3395
|
+
* variants of compressible assets larger than 1024 bytes. Pass an
|
|
3396
|
+
* object to selectively enable/disable each encoding.
|
|
3397
|
+
*
|
|
3398
|
+
* @see https://nitro.build/config#compresspublicassets
|
|
3399
|
+
*/
|
|
2866
3400
|
compressPublicAssets: boolean | CompressOptions;
|
|
3401
|
+
/**
|
|
3402
|
+
* Glob patterns to ignore when scanning directories.
|
|
3403
|
+
*
|
|
3404
|
+
* @see https://nitro.build/config#ignore
|
|
3405
|
+
*/
|
|
2867
3406
|
ignore: string[];
|
|
3407
|
+
/**
|
|
3408
|
+
* Whether the current build targets development mode.
|
|
3409
|
+
*
|
|
3410
|
+
* Defaults to `true` during development and `false` for production.
|
|
3411
|
+
*
|
|
3412
|
+
* @see https://nitro.build/config#dev
|
|
3413
|
+
*/
|
|
2868
3414
|
dev: boolean;
|
|
3415
|
+
/**
|
|
3416
|
+
* Development server options.
|
|
3417
|
+
*
|
|
3418
|
+
* @see https://nitro.build/config#devserver
|
|
3419
|
+
*/
|
|
2869
3420
|
devServer: {
|
|
2870
|
-
port?: number;
|
|
2871
|
-
hostname?: string;
|
|
2872
|
-
watch?: string[];
|
|
3421
|
+
/** Port number for the dev server. */port?: number; /** Hostname for the dev server. */
|
|
3422
|
+
hostname?: string; /** Additional paths to watch for dev server reloads. */
|
|
3423
|
+
watch?: string[]; /** Runtime runner to use for the dev server. */
|
|
2873
3424
|
runner?: RunnerName;
|
|
2874
3425
|
};
|
|
3426
|
+
/**
|
|
3427
|
+
* File watcher options for development mode.
|
|
3428
|
+
*
|
|
3429
|
+
* @see https://nitro.build/config#watchoptions
|
|
3430
|
+
* @see https://github.com/paulmillr/chokidar
|
|
3431
|
+
*/
|
|
2875
3432
|
watchOptions: ChokidarOptions;
|
|
3433
|
+
/**
|
|
3434
|
+
* Proxy configuration for the development server.
|
|
3435
|
+
*
|
|
3436
|
+
* A map of path prefixes to proxy target URLs or options.
|
|
3437
|
+
*
|
|
3438
|
+
* @example
|
|
3439
|
+
* ```ts
|
|
3440
|
+
* devProxy: {
|
|
3441
|
+
* "/proxy/test": "http://localhost:3001",
|
|
3442
|
+
* "/proxy/example": { target: "https://example.com", changeOrigin: true },
|
|
3443
|
+
* }
|
|
3444
|
+
* ```
|
|
3445
|
+
*
|
|
3446
|
+
* @see https://nitro.build/config#devproxy
|
|
3447
|
+
* @see https://github.com/unjs/httpxy
|
|
3448
|
+
*/
|
|
2876
3449
|
devProxy: Record<string, string | ProxyServerOptions>;
|
|
3450
|
+
/**
|
|
3451
|
+
* Build logging behavior.
|
|
3452
|
+
*
|
|
3453
|
+
* @see https://nitro.build/config#logging
|
|
3454
|
+
*/
|
|
2877
3455
|
logging: {
|
|
2878
|
-
compressedSizes?: boolean;
|
|
3456
|
+
/** Report compressed bundle sizes after build. */compressedSizes?: boolean; /** Show the build success message. */
|
|
2879
3457
|
buildSuccess?: boolean;
|
|
2880
3458
|
};
|
|
3459
|
+
/**
|
|
3460
|
+
* Server's main base URL prefix.
|
|
3461
|
+
*
|
|
3462
|
+
* Can also be set via the `NITRO_APP_BASE_URL` environment variable.
|
|
3463
|
+
*
|
|
3464
|
+
* @default "/"
|
|
3465
|
+
* @see https://nitro.build/config#baseurl
|
|
3466
|
+
*/
|
|
2881
3467
|
baseURL: string;
|
|
3468
|
+
/**
|
|
3469
|
+
* Base URL prefix for API routes.
|
|
3470
|
+
*
|
|
3471
|
+
* @default "/api"
|
|
3472
|
+
* @see https://nitro.build/config#apibaseurl
|
|
3473
|
+
*/
|
|
2882
3474
|
apiBaseURL: string;
|
|
3475
|
+
/**
|
|
3476
|
+
* Custom server entry point configuration.
|
|
3477
|
+
*
|
|
3478
|
+
* Set to `false` to disable the default server entry.
|
|
3479
|
+
*
|
|
3480
|
+
* @see https://nitro.build/docs/server-entry
|
|
3481
|
+
*/
|
|
2883
3482
|
serverEntry: false | {
|
|
2884
3483
|
handler: string;
|
|
2885
3484
|
format?: EventHandlerFormat;
|
|
2886
3485
|
};
|
|
3486
|
+
/**
|
|
3487
|
+
* Server handler registrations.
|
|
3488
|
+
*
|
|
3489
|
+
* Handlers in `routes/`, `api/`, and `middleware/` directories are
|
|
3490
|
+
* auto-registered when {@link NitroOptions.serverDir | serverDir} is set.
|
|
3491
|
+
*
|
|
3492
|
+
* @see https://nitro.build/config#handlers
|
|
3493
|
+
* @see https://nitro.build/docs/routing
|
|
3494
|
+
*/
|
|
2887
3495
|
handlers: NitroEventHandler[];
|
|
3496
|
+
/**
|
|
3497
|
+
* Development-only event handlers with inline handler functions.
|
|
3498
|
+
*
|
|
3499
|
+
* Not included in production builds.
|
|
3500
|
+
*
|
|
3501
|
+
* @see https://nitro.build/config#devhandlers
|
|
3502
|
+
*/
|
|
2888
3503
|
devHandlers: NitroDevEventHandler[];
|
|
3504
|
+
/**
|
|
3505
|
+
* Route rules applied to matching request paths.
|
|
3506
|
+
*
|
|
3507
|
+
* Supports caching, redirects, proxying, headers, CORS, and more.
|
|
3508
|
+
* Rules are matched using rou3 patterns and deep-merged when multiple
|
|
3509
|
+
* patterns match.
|
|
3510
|
+
*
|
|
3511
|
+
* @see https://nitro.build/config#routerules
|
|
3512
|
+
* @see https://nitro.build/docs/routing#route-rules
|
|
3513
|
+
*/
|
|
2889
3514
|
routeRules: {
|
|
2890
3515
|
[path: string]: NitroRouteRules;
|
|
2891
3516
|
};
|
|
3517
|
+
/**
|
|
3518
|
+
* Inline route definitions.
|
|
3519
|
+
*
|
|
3520
|
+
* A map from route pattern to handler path or handler options.
|
|
3521
|
+
*
|
|
3522
|
+
* @see https://nitro.build/config#routes
|
|
3523
|
+
*/
|
|
2892
3524
|
routes: Record<string, string | Omit<NitroEventHandler, "route" | "middleware">>;
|
|
3525
|
+
/**
|
|
3526
|
+
* Path(s) to custom runtime error handler(s).
|
|
3527
|
+
*
|
|
3528
|
+
* Custom handlers run before the built-in error handler, which is
|
|
3529
|
+
* always added as a fallback.
|
|
3530
|
+
*
|
|
3531
|
+
* @see https://nitro.build/config#errorhandler
|
|
3532
|
+
*/
|
|
2893
3533
|
errorHandler: string | string[];
|
|
3534
|
+
/**
|
|
3535
|
+
* Custom error handler function for development mode.
|
|
3536
|
+
*
|
|
3537
|
+
* @see https://nitro.build/config#deverrorhandler
|
|
3538
|
+
*/
|
|
2894
3539
|
devErrorHandler: NitroErrorHandler;
|
|
3540
|
+
/**
|
|
3541
|
+
* Prerendering options.
|
|
3542
|
+
*
|
|
3543
|
+
* Routes specified here are fetched during the build and copied to
|
|
3544
|
+
* `.output/public` as static assets.
|
|
3545
|
+
*
|
|
3546
|
+
* @see https://nitro.build/config#prerender
|
|
3547
|
+
*/
|
|
2895
3548
|
prerender: {
|
|
2896
3549
|
/**
|
|
2897
|
-
* Prerender HTML routes within subfolders (`/test`
|
|
3550
|
+
* Prerender HTML routes within subfolders (`/test` produces `/test/index.html`).
|
|
2898
3551
|
*/
|
|
2899
|
-
autoSubfolderIndex?: boolean;
|
|
2900
|
-
concurrency?: number;
|
|
2901
|
-
interval?: number;
|
|
2902
|
-
crawlLinks?: boolean;
|
|
2903
|
-
failOnError?: boolean;
|
|
2904
|
-
ignore?: Array<string | RegExp | ((path: string) => undefined | null | boolean)>;
|
|
2905
|
-
ignoreUnprefixedPublicAssets?: boolean;
|
|
3552
|
+
autoSubfolderIndex?: boolean; /** Maximum number of concurrent prerender requests. */
|
|
3553
|
+
concurrency?: number; /** Delay in milliseconds between prerender requests. */
|
|
3554
|
+
interval?: number; /** Crawl `<a>` tags in prerendered HTML to discover additional routes. */
|
|
3555
|
+
crawlLinks?: boolean; /** Fail the build when a route cannot be prerendered. */
|
|
3556
|
+
failOnError?: boolean; /** Patterns (string, RegExp, or function) of routes to skip. */
|
|
3557
|
+
ignore?: Array<string | RegExp | ((path: string) => undefined | null | boolean)>; /** Skip prerendering assets without a base URL prefix. */
|
|
3558
|
+
ignoreUnprefixedPublicAssets?: boolean; /** Explicit list of routes to prerender. */
|
|
2906
3559
|
routes?: string[];
|
|
2907
3560
|
/**
|
|
2908
3561
|
* Amount of retries. Pass Infinity to retry indefinitely.
|
|
@@ -2915,54 +3568,201 @@ interface NitroOptions extends PresetOptions {
|
|
|
2915
3568
|
*/
|
|
2916
3569
|
retryDelay?: number;
|
|
2917
3570
|
};
|
|
3571
|
+
/**
|
|
3572
|
+
* Bundler to use for production builds.
|
|
3573
|
+
*
|
|
3574
|
+
* Auto-detected when not set: `"vite"` if a `vite.config` with the
|
|
3575
|
+
* `nitro()` plugin is found, otherwise `"rolldown"` (bundled with Nitro).
|
|
3576
|
+
* Use the `NITRO_BUILDER` environment variable as an alternative.
|
|
3577
|
+
*
|
|
3578
|
+
* @see https://nitro.build/config#builder
|
|
3579
|
+
*/
|
|
2918
3580
|
builder?: "rollup" | "rolldown" | "vite";
|
|
3581
|
+
/**
|
|
3582
|
+
* Additional Rollup configuration.
|
|
3583
|
+
*
|
|
3584
|
+
* @see https://nitro.build/config#rollupconfig
|
|
3585
|
+
*/
|
|
2919
3586
|
rollupConfig?: RollupConfig;
|
|
3587
|
+
/**
|
|
3588
|
+
* Additional Rolldown configuration.
|
|
3589
|
+
*
|
|
3590
|
+
* @see https://nitro.build/config#rolldownconfig
|
|
3591
|
+
*/
|
|
2920
3592
|
rolldownConfig?: RolldownConfig;
|
|
3593
|
+
/**
|
|
3594
|
+
* Bundler entry point path.
|
|
3595
|
+
*
|
|
3596
|
+
* @see https://nitro.build/config#entry
|
|
3597
|
+
*/
|
|
2921
3598
|
entry: string;
|
|
3599
|
+
/**
|
|
3600
|
+
* unenv preset(s) for environment compatibility polyfills.
|
|
3601
|
+
*
|
|
3602
|
+
* @see https://nitro.build/config#unenv
|
|
3603
|
+
* @see https://github.com/unjs/unenv
|
|
3604
|
+
*/
|
|
2922
3605
|
unenv: Preset[];
|
|
3606
|
+
/**
|
|
3607
|
+
* Path aliases for module resolution.
|
|
3608
|
+
*
|
|
3609
|
+
* @example
|
|
3610
|
+
* ```ts
|
|
3611
|
+
* alias: {
|
|
3612
|
+
* "~utils": "./src/utils",
|
|
3613
|
+
* "#shared": "./shared",
|
|
3614
|
+
* }
|
|
3615
|
+
* ```
|
|
3616
|
+
*
|
|
3617
|
+
* @see https://nitro.build/config#alias
|
|
3618
|
+
*/
|
|
2923
3619
|
alias: Record<string, string>;
|
|
3620
|
+
/**
|
|
3621
|
+
* Minify the production bundle.
|
|
3622
|
+
*
|
|
3623
|
+
* @see https://nitro.build/config#minify
|
|
3624
|
+
*/
|
|
2924
3625
|
minify: boolean;
|
|
3626
|
+
/**
|
|
3627
|
+
* Bundle all code into a single file instead of separate chunks.
|
|
3628
|
+
*
|
|
3629
|
+
* When `false`, each route handler becomes a separate chunk loaded
|
|
3630
|
+
* on-demand. Some presets enable this by default.
|
|
3631
|
+
*
|
|
3632
|
+
* @see https://nitro.build/config#inlinedynamicimports
|
|
3633
|
+
*/
|
|
2925
3634
|
inlineDynamicImports: boolean;
|
|
3635
|
+
/**
|
|
3636
|
+
* Enable source map generation.
|
|
3637
|
+
*
|
|
3638
|
+
* @see https://nitro.build/config#sourcemap
|
|
3639
|
+
*/
|
|
2926
3640
|
sourcemap: boolean;
|
|
3641
|
+
/**
|
|
3642
|
+
* Target a Node.js-compatible runtime.
|
|
3643
|
+
*
|
|
3644
|
+
* When `true` (default), the bundler targets the `node` platform, prefers
|
|
3645
|
+
* Node.js built-in modules, and enables dependency externalization.
|
|
3646
|
+
*
|
|
3647
|
+
* When `false`, Nitro prepends the `nodeless` unenv preset to polyfill
|
|
3648
|
+
* Node.js globals and built-ins for non-Node runtimes (workers, edge, Deno).
|
|
3649
|
+
*
|
|
3650
|
+
* @see https://nitro.build/config#node
|
|
3651
|
+
*/
|
|
2927
3652
|
node: boolean;
|
|
3653
|
+
/**
|
|
3654
|
+
* OXC options for Rolldown builds (minification and transforms).
|
|
3655
|
+
*
|
|
3656
|
+
* @see https://nitro.build/config#oxc
|
|
3657
|
+
*/
|
|
2928
3658
|
oxc?: OXCOptions;
|
|
3659
|
+
/**
|
|
3660
|
+
* Build-time string replacements.
|
|
3661
|
+
*
|
|
3662
|
+
* @see https://nitro.build/config#replace
|
|
3663
|
+
*/
|
|
2929
3664
|
replace: Record<string, string | ((id: string) => string)>;
|
|
3665
|
+
/**
|
|
3666
|
+
* Additional configuration for the Rollup CommonJS plugin.
|
|
3667
|
+
*
|
|
3668
|
+
* @see https://nitro.build/config#commonjs
|
|
3669
|
+
*/
|
|
2930
3670
|
commonJS?: RollupCommonJSOptions;
|
|
3671
|
+
/**
|
|
3672
|
+
* Custom export conditions for module resolution.
|
|
3673
|
+
*
|
|
3674
|
+
* @see https://nitro.build/config#exportconditions
|
|
3675
|
+
*/
|
|
2931
3676
|
exportConditions?: string[];
|
|
3677
|
+
/**
|
|
3678
|
+
* Prevent packages from being externalized.
|
|
3679
|
+
*
|
|
3680
|
+
* Set to `true` to bundle all dependencies, or pass an array of
|
|
3681
|
+
* package names or patterns.
|
|
3682
|
+
*
|
|
3683
|
+
* @see https://nitro.build/config#noexternals
|
|
3684
|
+
*/
|
|
2932
3685
|
noExternals?: boolean | (string | RegExp)[];
|
|
3686
|
+
/**
|
|
3687
|
+
* Additional dependencies to trace and include in the build output.
|
|
3688
|
+
*
|
|
3689
|
+
* Supports `!pkg` to exclude and `pkg*` for full package trace.
|
|
3690
|
+
*
|
|
3691
|
+
* @see https://nitro.build/config#tracedeps
|
|
3692
|
+
*/
|
|
2933
3693
|
traceDeps?: (string | RegExp)[];
|
|
3694
|
+
/**
|
|
3695
|
+
* Advanced options for dependency tracing via nf3.
|
|
3696
|
+
*
|
|
3697
|
+
* @see https://nitro.build/config#traceopts
|
|
3698
|
+
* @see https://github.com/nicolo-ribaudo/nf3
|
|
3699
|
+
*/
|
|
2934
3700
|
traceOpts?: Pick<ExternalsTraceOptions, "nft" | "traceAlias" | "chmod" | "transform" | "hooks">;
|
|
3701
|
+
/**
|
|
3702
|
+
* TypeScript configuration options.
|
|
3703
|
+
*
|
|
3704
|
+
* @see https://nitro.build/config#typescript
|
|
3705
|
+
*/
|
|
2935
3706
|
typescript: {
|
|
2936
|
-
strict?: boolean;
|
|
2937
|
-
generateRuntimeConfigTypes?: boolean;
|
|
2938
|
-
generateTsConfig?: boolean;
|
|
3707
|
+
/** Enable strict TypeScript checks. */strict?: boolean; /** Generate types for runtime config. */
|
|
3708
|
+
generateRuntimeConfigTypes?: boolean; /** Generate a `tsconfig.json` in the build directory. */
|
|
3709
|
+
generateTsConfig?: boolean; /** Custom tsconfig overrides. */
|
|
2939
3710
|
tsConfig?: Partial<TSConfig>;
|
|
2940
3711
|
/**
|
|
2941
3712
|
* Path of the generated types directory.
|
|
2942
3713
|
*
|
|
2943
|
-
*
|
|
3714
|
+
* @default "node_modules/.nitro/types"
|
|
2944
3715
|
*/
|
|
2945
3716
|
generatedTypesDir?: string;
|
|
2946
3717
|
/**
|
|
2947
|
-
* Path of the generated `tsconfig.json` relative to `typescript.generatedTypesDir
|
|
3718
|
+
* Path of the generated `tsconfig.json` relative to `typescript.generatedTypesDir`.
|
|
2948
3719
|
*
|
|
2949
|
-
*
|
|
3720
|
+
* @default "tsconfig.json"
|
|
2950
3721
|
*/
|
|
2951
3722
|
tsconfigPath?: string;
|
|
2952
3723
|
};
|
|
3724
|
+
/**
|
|
3725
|
+
* Nitro lifecycle hooks.
|
|
3726
|
+
*
|
|
3727
|
+
* @see https://nitro.build/config#hooks
|
|
3728
|
+
* @see https://nitro.build/docs/lifecycle
|
|
3729
|
+
* @see https://github.com/unjs/hookable
|
|
3730
|
+
*/
|
|
2953
3731
|
hooks: NestedHooks<NitroHooks>;
|
|
3732
|
+
/**
|
|
3733
|
+
* Preview and deploy command hints (usually filled by deployment presets).
|
|
3734
|
+
*
|
|
3735
|
+
* @see https://nitro.build/config#commands
|
|
3736
|
+
*/
|
|
2954
3737
|
commands: {
|
|
2955
|
-
preview?: string;
|
|
3738
|
+
/** Command to preview the production build locally. */preview?: string; /** Command to deploy the production build. */
|
|
2956
3739
|
deploy?: string;
|
|
2957
3740
|
};
|
|
3741
|
+
/**
|
|
3742
|
+
* Metadata about the higher-level framework using Nitro (e.g. Nuxt).
|
|
3743
|
+
*
|
|
3744
|
+
* Used by presets and included in build info output.
|
|
3745
|
+
*
|
|
3746
|
+
* @see https://nitro.build/config#framework
|
|
3747
|
+
*/
|
|
2958
3748
|
framework: NitroFrameworkInfo;
|
|
3749
|
+
/**
|
|
3750
|
+
* IIS-specific deployment options.
|
|
3751
|
+
*/
|
|
2959
3752
|
iis?: {
|
|
2960
|
-
mergeConfig?: boolean;
|
|
3753
|
+
/** Merge with existing IIS `web.config` instead of replacing. */mergeConfig?: boolean; /** Override existing IIS `web.config` entirely. */
|
|
2961
3754
|
overrideConfig?: boolean;
|
|
2962
3755
|
};
|
|
2963
3756
|
}
|
|
2964
3757
|
/**
|
|
2965
|
-
* Nitro
|
|
3758
|
+
* User-facing Nitro configuration used in `nitro.config.ts` or
|
|
3759
|
+
* `defineNitroConfig()`.
|
|
3760
|
+
*
|
|
3761
|
+
* All properties are optional and will be merged with defaults and preset
|
|
3762
|
+
* values to produce the fully resolved {@link NitroOptions}.
|
|
3763
|
+
*
|
|
3764
|
+
* @see https://nitro.build/config
|
|
3765
|
+
* @see https://nitro.build/docs/configuration
|
|
2966
3766
|
*/
|
|
2967
3767
|
interface NitroConfig extends Partial<Omit<NitroOptions, "routeRules" | "rollupConfig" | "preset" | "compatibilityDate" | "unenv" | "serverDir" | "_config" | "_c12" | "serverEntry" | "renderer" | "output" | "tracingChannel">>, C12InputConfig<NitroConfig> {
|
|
2968
3768
|
preset?: PresetNameInput;
|
|
@@ -2979,39 +3779,79 @@ interface NitroConfig extends Partial<Omit<NitroOptions, "routeRules" | "rollupC
|
|
|
2979
3779
|
output?: Partial<NitroOptions["output"]>;
|
|
2980
3780
|
tracingChannel?: boolean | TracingOptions;
|
|
2981
3781
|
}
|
|
3782
|
+
/** Options for loading Nitro configuration via c12. */
|
|
2982
3783
|
interface LoadConfigOptions {
|
|
2983
3784
|
watch?: boolean;
|
|
2984
3785
|
c12?: WatchConfigOptions;
|
|
2985
3786
|
compatibilityDate?: CompatibilityDateSpec;
|
|
2986
3787
|
dotenv?: boolean | DotenvOptions;
|
|
2987
3788
|
}
|
|
3789
|
+
/**
|
|
3790
|
+
* Configuration for a public asset directory served in development and
|
|
3791
|
+
* bundled in production.
|
|
3792
|
+
*
|
|
3793
|
+
* @see https://nitro.build/config#publicassets
|
|
3794
|
+
* @see https://nitro.build/docs/assets
|
|
3795
|
+
*/
|
|
2988
3796
|
interface PublicAssetDir {
|
|
3797
|
+
/** URL prefix under which these assets are served. */
|
|
2989
3798
|
baseURL?: string;
|
|
3799
|
+
/** Fall through to the next handler when the asset is not found. */
|
|
2990
3800
|
fallthrough?: boolean;
|
|
3801
|
+
/** `Cache-Control` max-age value in seconds. */
|
|
2991
3802
|
maxAge: number;
|
|
3803
|
+
/** Filesystem path to the asset directory. */
|
|
2992
3804
|
dir: string;
|
|
2993
3805
|
/**
|
|
2994
|
-
* Pass false to disable ignore patterns when scanning the directory,
|
|
2995
|
-
* pass an array of glob patterns to ignore (
|
|
2996
|
-
* nitro.ignore patterns).
|
|
3806
|
+
* Pass `false` to disable ignore patterns when scanning the directory,
|
|
3807
|
+
* or pass an array of glob patterns to ignore (overrides global
|
|
3808
|
+
* `nitro.ignore` patterns).
|
|
2997
3809
|
*/
|
|
2998
3810
|
ignore?: false | string[];
|
|
2999
3811
|
}
|
|
3812
|
+
/**
|
|
3813
|
+
* Pre-compression options for public assets and prerendered routes.
|
|
3814
|
+
*
|
|
3815
|
+
* @see https://nitro.build/config#compresspublicassets
|
|
3816
|
+
*/
|
|
3000
3817
|
interface CompressOptions {
|
|
3818
|
+
/** Enable gzip pre-compression. */
|
|
3001
3819
|
gzip?: boolean;
|
|
3820
|
+
/** Enable brotli pre-compression. */
|
|
3002
3821
|
brotli?: boolean;
|
|
3822
|
+
/** Enable zstd pre-compression. */
|
|
3003
3823
|
zstd?: boolean;
|
|
3004
3824
|
}
|
|
3825
|
+
/**
|
|
3826
|
+
* Configuration for a server-side asset directory bundled at build time.
|
|
3827
|
+
*
|
|
3828
|
+
* @see https://nitro.build/config#serverassets
|
|
3829
|
+
* @see https://nitro.build/docs/assets#server-assets
|
|
3830
|
+
*/
|
|
3005
3831
|
interface ServerAssetDir {
|
|
3832
|
+
/** Logical name used to access the asset group at runtime. */
|
|
3006
3833
|
baseName: string;
|
|
3834
|
+
/** Glob pattern to filter files within the directory. */
|
|
3007
3835
|
pattern?: string;
|
|
3836
|
+
/** Filesystem path to the asset directory. */
|
|
3008
3837
|
dir: string;
|
|
3838
|
+
/** Glob patterns to ignore when scanning the directory. */
|
|
3009
3839
|
ignore?: string[];
|
|
3010
3840
|
}
|
|
3011
3841
|
interface TracingOptions {
|
|
3012
3842
|
srvx?: boolean;
|
|
3013
3843
|
h3?: boolean;
|
|
3844
|
+
unstorage?: boolean;
|
|
3014
3845
|
}
|
|
3846
|
+
/**
|
|
3847
|
+
* Storage mount configuration mapping mount points to driver options.
|
|
3848
|
+
*
|
|
3849
|
+
* Keys are storage mount-point paths; values specify the unstorage driver
|
|
3850
|
+
* and its options.
|
|
3851
|
+
*
|
|
3852
|
+
* @see https://nitro.build/config#storage
|
|
3853
|
+
* @see https://nitro.build/docs/storage
|
|
3854
|
+
*/
|
|
3015
3855
|
type CustomDriverName = string & {
|
|
3016
3856
|
_custom?: any;
|
|
3017
3857
|
};
|
|
@@ -3021,17 +3861,35 @@ interface StorageMounts {
|
|
|
3021
3861
|
[option: string]: any;
|
|
3022
3862
|
};
|
|
3023
3863
|
}
|
|
3864
|
+
/** Logical database connection name. Defaults to `"default"`. */
|
|
3024
3865
|
type DatabaseConnectionName = "default" | (string & {});
|
|
3866
|
+
/**
|
|
3867
|
+
* Database connection configuration specifying a db0 connector and options.
|
|
3868
|
+
*
|
|
3869
|
+
* @see https://nitro.build/config#database
|
|
3870
|
+
* @see https://nitro.build/docs/database
|
|
3871
|
+
*/
|
|
3025
3872
|
type DatabaseConnectionConfig = {
|
|
3026
3873
|
connector: ConnectorName;
|
|
3027
3874
|
options?: {
|
|
3028
3875
|
[key: string]: any;
|
|
3029
3876
|
};
|
|
3030
3877
|
};
|
|
3878
|
+
/** Map of {@link DatabaseConnectionName} to {@link DatabaseConnectionConfig}. */
|
|
3031
3879
|
type DatabaseConnectionConfigs = Record<DatabaseConnectionName, DatabaseConnectionConfig>;
|
|
3880
|
+
/** Application-specific runtime configuration. */
|
|
3032
3881
|
interface NitroRuntimeConfigApp {
|
|
3033
3882
|
[key: string]: any;
|
|
3034
3883
|
}
|
|
3884
|
+
/**
|
|
3885
|
+
* Server runtime configuration accessible via `useRuntimeConfig()`.
|
|
3886
|
+
*
|
|
3887
|
+
* Values can be overridden at runtime using environment variables with
|
|
3888
|
+
* the `NITRO_` prefix. An alternative prefix can be configured via
|
|
3889
|
+
* `nitro.envPrefix` or `NITRO_ENV_PREFIX`.
|
|
3890
|
+
*
|
|
3891
|
+
* @see https://nitro.build/config#runtimeconfig
|
|
3892
|
+
*/
|
|
3035
3893
|
interface NitroRuntimeConfig {
|
|
3036
3894
|
nitro?: {
|
|
3037
3895
|
envPrefix?: string;
|