-
Notifications
You must be signed in to change notification settings - Fork 9
/
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="connect" />
/// <reference types="node" />
import { HandleFunction, NextHandleFunction } from "connect";
import { Stats } from "fs";
declare function staticExpiry(app: staticExpiry.app | null | undefined, config: staticExpiry.config): staticExpiry.Middleware;
declare namespace staticExpiry {
type fileFilterCb = (fileName: string, stat: Stats) => boolean;
type furl = (filePath: string) => string;
interface Middleware extends NextHandleFunction {
furl: furl
}
// Static expiry works with express and connect, which return app objects
// of different shapes. So app.use() is the common interface relied on.
export type app = {
use(route: string, fn: HandleFunction): app;
};
export type config = {
duration?: number;
conditional?: "none" | "etag" | "last-modified" | "both";
unconditional?: "none" | "max-age" | "expires" | "both";
cacheControl?: string | false | null;
dir?: string;
fingerprint?: furl;
location?: 'prefile' | 'postfile' | 'query' | 'path';
host?: null | string | string[];
loadCache?: 'startup' | 'furl' | { at: 'startup', callback: fileFilterCb };
debug?: boolean;
};
export function clearCache(): void;
}
export= staticExpiry;