@d7z-project/gitea-pages 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/globals.d.ts +20 -104
- package/package.json +1 -1
package/globals.d.ts
CHANGED
|
@@ -1,72 +1,24 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
interface
|
|
3
|
-
|
|
4
|
-
set(name: string, value: string): void;
|
|
5
|
-
append(name: string, value: string): void;
|
|
6
|
-
has(name: string): boolean;
|
|
7
|
-
delete(name: string): void;
|
|
8
|
-
keys(): string[];
|
|
9
|
-
values(): string[];
|
|
10
|
-
entries(): [string, string][];
|
|
11
|
-
forEach(callback: (value: string, key: string, parent: Headers) => void): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface RequestInit {
|
|
15
|
-
method?: string;
|
|
16
|
-
headers?: Headers | Record<string, string>;
|
|
17
|
-
body?: string | Uint8Array | ArrayBuffer;
|
|
18
|
-
signal?: AbortSignal;
|
|
2
|
+
interface Blob {
|
|
3
|
+
bytes(): Promise<Uint8Array>;
|
|
19
4
|
}
|
|
20
5
|
|
|
21
6
|
interface Request {
|
|
22
|
-
|
|
23
|
-
readonly url: string;
|
|
24
|
-
readonly headers: Headers;
|
|
25
|
-
readonly bodyUsed: boolean;
|
|
26
|
-
readonly signal: AbortSignal;
|
|
27
|
-
text(): Promise<string>;
|
|
28
|
-
json<T = any>(): Promise<T>;
|
|
29
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
30
|
-
clone(): Request;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ResponseInit {
|
|
34
|
-
status?: number;
|
|
35
|
-
statusText?: string;
|
|
36
|
-
headers?: Headers | Record<string, string>;
|
|
7
|
+
bytes(): Promise<Uint8Array>;
|
|
37
8
|
}
|
|
38
9
|
|
|
39
10
|
interface Response {
|
|
40
|
-
|
|
41
|
-
readonly statusText: string;
|
|
42
|
-
readonly headers: Headers;
|
|
43
|
-
readonly ok: boolean;
|
|
44
|
-
readonly bodyUsed: boolean;
|
|
45
|
-
text(): Promise<string>;
|
|
46
|
-
json<T = any>(): Promise<T>;
|
|
47
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
48
|
-
clone(): Response;
|
|
11
|
+
bytes(): Promise<Uint8Array>;
|
|
49
12
|
}
|
|
50
13
|
|
|
51
|
-
var Request: {
|
|
52
|
-
new(input: string | Request, init?: RequestInit): Request;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var Response: {
|
|
56
|
-
new(body?: string | Uint8Array | ArrayBuffer | null, init?: ResponseInit): Response;
|
|
57
|
-
json(data: any, init?: ResponseInit): Response;
|
|
58
|
-
redirect(location: string, status?: number): Response;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
interface FetchOptions extends RequestInit {}
|
|
62
|
-
|
|
63
|
-
function fetch(url: string, options?: FetchOptions): Promise<Response>;
|
|
64
|
-
|
|
65
14
|
type RequestHandler = (request: Request) => Response | Promise<Response>;
|
|
66
|
-
|
|
15
|
+
|
|
16
|
+
interface FetchHandlerObject {
|
|
67
17
|
fetch(request: Request): Response | Promise<Response>;
|
|
68
|
-
}
|
|
18
|
+
}
|
|
19
|
+
|
|
69
20
|
type PageHandler = RequestHandler | FetchHandlerObject;
|
|
21
|
+
|
|
70
22
|
function serve(handler: PageHandler): void;
|
|
71
23
|
|
|
72
24
|
interface RouteContext {
|
|
@@ -161,6 +113,10 @@ declare global {
|
|
|
161
113
|
|
|
162
114
|
interface PageFS {
|
|
163
115
|
list(path?: string): PageEntry[];
|
|
116
|
+
read(path: string): Promise<Uint8Array>;
|
|
117
|
+
readText(path: string): Promise<string>;
|
|
118
|
+
readSync(path: string): Uint8Array;
|
|
119
|
+
readTextSync(path: string): string;
|
|
164
120
|
}
|
|
165
121
|
|
|
166
122
|
interface KVListResult {
|
|
@@ -197,9 +153,15 @@ declare global {
|
|
|
197
153
|
const page: PageHost;
|
|
198
154
|
const fs: PageFS;
|
|
199
155
|
const kv: KVSystem;
|
|
156
|
+
// @ts-ignore
|
|
200
157
|
const event: EventSystem;
|
|
158
|
+
|
|
159
|
+
interface PageWebSocket extends WebSocket {
|
|
160
|
+
send(data: string | Uint8Array | ArrayBuffer): Promise<void>;
|
|
161
|
+
}
|
|
162
|
+
|
|
201
163
|
function upgradeWebSocket(request?: Request): {
|
|
202
|
-
socket:
|
|
164
|
+
socket: PageWebSocket;
|
|
203
165
|
response: Response;
|
|
204
166
|
};
|
|
205
167
|
|
|
@@ -211,52 +173,6 @@ declare global {
|
|
|
211
173
|
}): Promise<void>;
|
|
212
174
|
close(): void;
|
|
213
175
|
}
|
|
214
|
-
|
|
215
|
-
interface WebSocketEventMap {
|
|
216
|
-
open: Event;
|
|
217
|
-
message: MessageEvent<string | Uint8Array>;
|
|
218
|
-
close: CloseEvent;
|
|
219
|
-
error: Event;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
interface Event {
|
|
223
|
-
type: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
interface MessageEvent<T = any> extends Event {
|
|
227
|
-
data: T;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
interface CloseEvent extends Event {
|
|
231
|
-
code?: number;
|
|
232
|
-
reason?: string;
|
|
233
|
-
wasClean?: boolean;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
interface WebSocket {
|
|
237
|
-
readonly CONNECTING: 0;
|
|
238
|
-
readonly OPEN: 1;
|
|
239
|
-
readonly CLOSING: 2;
|
|
240
|
-
readonly CLOSED: 3;
|
|
241
|
-
readonly readyState: number;
|
|
242
|
-
onopen: ((event: Event) => void) | null;
|
|
243
|
-
onmessage: ((event: MessageEvent<string | Uint8Array>) => void) | null;
|
|
244
|
-
onerror: ((event: Event) => void) | null;
|
|
245
|
-
onclose: ((event: CloseEvent) => void) | null;
|
|
246
|
-
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (event: WebSocketEventMap[K]) => void): void;
|
|
247
|
-
send(data: string | Uint8Array | ArrayBuffer): Promise<void>;
|
|
248
|
-
close(code?: number): void;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
interface Console {
|
|
252
|
-
log(...args: any[]): void;
|
|
253
|
-
warn(...args: any[]): void;
|
|
254
|
-
error(...args: any[]): void;
|
|
255
|
-
info(...args: any[]): void;
|
|
256
|
-
debug(...args: any[]): void;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const console: Console;
|
|
260
176
|
}
|
|
261
177
|
|
|
262
178
|
export {};
|