-
Notifications
You must be signed in to change notification settings - Fork 170
/
types.ts
75 lines (63 loc) · 1.94 KB
/
types.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import type { UserConfig as UnoConfig } from "https://esm.sh/@unocss/core@0.32.12";
export type AlephConfig = {
/** The basePath of the app. */
basePath?: string;
/** The build optioins for `build` command. */
build?: BuildOptions;
/** The config for file-system based routing. */
routes?: RoutesConfig | string;
/** The config for atomic css powered by unocss. */
unocss?: UnoConfig;
};
export type BuildPlatform = "deno" | "cloudflare" | "vercel";
export type BuildOptions = {
/** The supported platform. default is "deno" */
platform?: BuildPlatform;
/** The directory for build output files. default is "dist" */
outputDir?: string;
/** The build target passes to esbuild. default is "es2020" */
target?: "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022";
};
export type RoutesConfig = {
glob: string;
generate?: boolean;
host?: boolean;
};
export type FetchHandler = {
(request: Request): Promise<Response> | Response;
};
export interface Middleware {
fetch(
request: Request,
context: Record<string, unknown>,
): Promise<Response | CallableFunction | void> | Response | CallableFunction | void;
}
export type ImportMap = {
readonly __filename: string;
readonly imports: Record<string, string>;
readonly scopes: Record<string, Record<string, string>>;
};
export type JSXConfig = {
jsxRuntime?: "react" | "preact";
jsxImportSource?: string;
jsxRuntimeVersion?: string;
jsxRuntimeCdnVersion?: string;
};
export type ModuleLoader = {
test(pathname: string): boolean;
load(pathname: string, env: ModuleLoaderEnv): Promise<ModuleLoaderContent> | ModuleLoaderContent;
};
export type ModuleLoaderEnv = {
importMap?: ImportMap;
isDev?: boolean;
ssr?: boolean;
};
export type ModuleLoaderContent = {
code: string;
inlineCSS?: string;
atomicCSS?: boolean;
lang?: "js" | "jsx" | "ts" | "tsx" | "css";
map?: string;
modtime?: number;
};
export { UnoConfig };