-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathutil.ts
59 lines (51 loc) · 1.27 KB
/
util.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
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
import type { API } from "./utils/api.ts";
import type { FullUser, RuntimeCompat } from "./utils/api_types.ts";
import type { TraceSpan } from "./utils/tracing.ts";
import type { SourceDir, SourceFile } from "./utils/api_types.ts";
import { createDefine } from "fresh";
export const define = createDefine<State>();
export interface State {
api: API;
span: TraceSpan;
userPromise: Promise<FullUser | null | Response>;
user: FullUser | null;
sudo: boolean;
meta: Meta;
searchKind?: SearchKind;
}
export interface Meta {
title?: string;
description?: string;
ogImage?: string;
}
export type SearchKind = "packages" | "docs";
export interface Docs {
css: string;
comrakCss: string;
script: string;
// null only on index page
breadcrumbs: string | null;
// null only on all symbols page
toc: string | null;
main: string;
}
export interface Source {
css: string;
comrakCss: string;
script: string;
source: SourceDir | SourceFile;
}
export interface OramaPackageHit {
id: string;
scope: string;
name: string;
description: string;
runtimeCompat: RuntimeCompat;
score: number | null;
}
export interface PaginationData {
page: number;
limit: number;
total: number;
}