-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
38 lines (31 loc) · 1.22 KB
/
index.d.ts
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
37
38
/// <reference types="node"/>
import { MinifyOptions, CompressOptions } from "csso";
import { Options } from "html-minifier-terser";
import { MinifyOptions as TerserMinifyOptions } from "terser";
import { FastifyPluginCallback, FastifyRequest, FastifyReply } from "fastify";
import { Stream } from "stream";
type CSSOOptions = MinifyOptions & CompressOptions;
export interface Transformer {
suffix: string | string[];
contentType: string | string[];
func: ((value: string) => string) | ((value: string) => Promise<string>);
decorate?: string;
useCache?: boolean;
}
export interface Cache {
set: (key: string, value: string) => void;
get: ((key: string) => string) | ((key: string) => Promise<string>);
}
export interface FastifyMinifyOptions {
cache?: number | Cache;
global?: boolean;
minInfix?: boolean | ((req: FastifyRequest) => void);
validate?: (req: FastifyRequest, rep: FastifyReply, payload: string | Buffer | Stream) => boolean;
htmlOptions?: Options;
jsOptions?: TerserMinifyOptions;
cssOptions?: CSSOOptions;
transformers?: Transformer[];
}
declare const fastifyMinify: FastifyPluginCallback<FastifyMinifyOptions>;
export default fastifyMinify;
export { fastifyMinify };