-
-
Notifications
You must be signed in to change notification settings - Fork 813
Expand file tree
/
Copy pathmodule.ts
More file actions
36 lines (34 loc) · 984 Bytes
/
module.ts
File metadata and controls
36 lines (34 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { Nitro } from "./nitro.ts";
/**
* Accepted input formats for Nitro modules.
*
* Can be a module path string, a {@link NitroModule} object, a bare setup
* function, or an object with a `nitro` key containing a {@link NitroModule}.
*
* @see https://nitro.build/config#modules
*/
export type NitroModuleInput = string | NitroModule | NitroModule["setup"] | { nitro: NitroModule };
/**
* A Nitro module that extends behavior during initialization.
*
* Modules receive the {@link Nitro} instance and can register hooks,
* add handlers, modify options, or perform other setup tasks.
*
* @example
* ```ts
* const myModule: NitroModule = {
* name: "my-module",
* setup(nitro) {
* nitro.hooks.hook("compiled", () => {
* console.log("Build complete!");
* });
* },
* };
* ```
*
* @see https://nitro.build/config#modules
*/
export interface NitroModule {
name?: string;
setup: (this: void, nitro: Nitro) => void | Promise<void>;
}