crossws 0.4.1 → 0.4.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/dist/_chunks/_request.mjs +82 -0
- package/dist/_chunks/_types.d.mts +24 -0
- package/dist/_chunks/adapter.d.mts +174 -0
- package/dist/_chunks/adapter.mjs +93 -0
- package/dist/_chunks/bun.d.mts +38 -0
- package/dist/_chunks/cloudflare.d.mts +45 -0
- package/dist/_chunks/deno.d.mts +17 -0
- package/dist/_chunks/error.mjs +10 -0
- package/dist/_chunks/libs/ws.mjs +3531 -0
- package/dist/_chunks/node.d.mts +299 -0
- package/dist/_chunks/peer.mjs +244 -0
- package/dist/_chunks/rolldown-runtime.mjs +32 -0
- package/dist/_chunks/sse.d.mts +12 -0
- package/dist/_chunks/web.d.mts +298 -0
- package/dist/adapters/bun.d.mts +2 -41
- package/dist/adapters/bun.mjs +83 -93
- package/dist/adapters/cloudflare.d.mts +2 -46
- package/dist/adapters/cloudflare.mjs +173 -218
- package/dist/adapters/deno.d.mts +2 -19
- package/dist/adapters/deno.mjs +65 -74
- package/dist/adapters/node.d.mts +2 -299
- package/dist/adapters/node.mjs +119 -156
- package/dist/adapters/sse.d.mts +2 -13
- package/dist/adapters/sse.mjs +98 -118
- package/dist/adapters/uws.d.mts +44 -44
- package/dist/adapters/uws.mjs +152 -175
- package/dist/index.d.mts +2 -170
- package/dist/index.mjs +3 -1
- package/dist/server/bun.d.mts +8 -21
- package/dist/server/bun.mjs +24 -31
- package/dist/server/cloudflare.d.mts +8 -21
- package/dist/server/cloudflare.mjs +21 -30
- package/dist/server/default.d.mts +8 -21
- package/dist/server/default.mjs +22 -26
- package/dist/server/deno.d.mts +8 -21
- package/dist/server/deno.mjs +21 -24
- package/dist/server/node.d.mts +8 -21
- package/dist/server/node.mjs +32 -43
- package/dist/websocket/native.d.mts +3 -2
- package/dist/websocket/native.mjs +4 -1
- package/dist/websocket/node.d.mts +3 -2
- package/dist/websocket/node.mjs +7 -13
- package/dist/websocket/sse.d.mts +34 -34
- package/dist/websocket/sse.mjs +112 -123
- package/package.json +36 -28
- package/adapters/cloudflare-durable.d.ts +0 -2
- package/dist/shared/crossws.95-eYp2D.d.mts +0 -23
- package/dist/shared/crossws.B31KJMcF.mjs +0 -83
- package/dist/shared/crossws.BQXMA5bH.d.mts +0 -297
- package/dist/shared/crossws.By9qWDAI.mjs +0 -8
- package/dist/shared/crossws.CPlNx7g8.mjs +0 -105
- package/dist/shared/crossws.CipVM6lf.mjs +0 -4973
- package/dist/shared/crossws.WpyOHUXc.mjs +0 -330
package/dist/websocket/node.mjs
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import 'events';
|
|
4
|
-
import 'http';
|
|
5
|
-
import 'crypto';
|
|
6
|
-
import 'buffer';
|
|
7
|
-
import 'zlib';
|
|
8
|
-
import 'https';
|
|
9
|
-
import 'net';
|
|
10
|
-
import 'tls';
|
|
11
|
-
import 'url';
|
|
1
|
+
import "../_chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { t as import_websocket } from "../_chunks/libs/ws.mjs";
|
|
12
3
|
|
|
13
|
-
|
|
4
|
+
//#region src/websocket/node.ts
|
|
5
|
+
const Websocket = globalThis.WebSocket || import_websocket.default;
|
|
6
|
+
var node_default = Websocket;
|
|
14
7
|
|
|
15
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
export { node_default as default };
|
package/dist/websocket/sse.d.mts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as WebSocket, i as MessageEvent, n as Event, r as EventTarget, t as CloseEvent } from "../_chunks/web.mjs";
|
|
2
2
|
|
|
3
|
+
//#region src/websocket/sse.d.ts
|
|
3
4
|
type Ctor<T> = {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
prototype: T;
|
|
6
|
+
new (): T;
|
|
6
7
|
};
|
|
7
8
|
declare const _EventTarget: Ctor<EventTarget>;
|
|
8
9
|
interface WebSocketSSEOptions {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
protocols?: string | string[];
|
|
11
|
+
/** enabled by default */
|
|
12
|
+
bidir?: boolean;
|
|
13
|
+
/** enabled by default */
|
|
14
|
+
stream?: boolean;
|
|
15
|
+
headers?: HeadersInit;
|
|
15
16
|
}
|
|
16
17
|
declare class WebSocketSSE extends _EventTarget implements WebSocket {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
#private;
|
|
19
|
+
static CONNECTING: number;
|
|
20
|
+
static OPEN: number;
|
|
21
|
+
static CLOSING: number;
|
|
22
|
+
static CLOSED: number;
|
|
23
|
+
readonly CONNECTING = 0;
|
|
24
|
+
readonly OPEN = 1;
|
|
25
|
+
readonly CLOSING = 2;
|
|
26
|
+
readonly CLOSED = 3;
|
|
27
|
+
onclose: ((this: WebSocket, ev: CloseEvent) => any) | null;
|
|
28
|
+
onerror: ((this: WebSocket, ev: Event) => any) | null;
|
|
29
|
+
onopen: ((this: WebSocket, ev: Event) => any) | null;
|
|
30
|
+
onmessage: ((this: WebSocket, ev: MessageEvent<any>) => any) | null;
|
|
31
|
+
binaryType: BinaryType;
|
|
32
|
+
readyState: number;
|
|
33
|
+
readonly url: string;
|
|
34
|
+
readonly protocol: string;
|
|
35
|
+
readonly extensions: string;
|
|
36
|
+
readonly bufferedAmount: number;
|
|
37
|
+
constructor(url: string, init?: string | string[] | WebSocketSSEOptions);
|
|
38
|
+
close(_code?: number, _reason?: string): void;
|
|
39
|
+
send(data: any): Promise<void>;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
export { WebSocketSSE };
|
|
42
|
-
export type { WebSocketSSEOptions };
|
|
41
|
+
//#endregion
|
|
42
|
+
export { WebSocketSSE, WebSocketSSEOptions };
|
package/dist/websocket/sse.mjs
CHANGED
|
@@ -1,127 +1,116 @@
|
|
|
1
|
+
//#region src/websocket/sse.ts
|
|
1
2
|
const _EventTarget = EventTarget;
|
|
2
3
|
const defaultOptions = Object.freeze({
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
bidir: true,
|
|
5
|
+
stream: true
|
|
5
6
|
});
|
|
6
|
-
class WebSocketSSE extends _EventTarget {
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (this.#sendController) {
|
|
114
|
-
this.#sendController.enqueue(data);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
await fetch(this.url, {
|
|
118
|
-
method: "POST",
|
|
119
|
-
headers: {
|
|
120
|
-
"x-crossws-id": this.#id
|
|
121
|
-
},
|
|
122
|
-
body: data
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
7
|
+
var WebSocketSSE = class WebSocketSSE extends _EventTarget {
|
|
8
|
+
static CONNECTING = 0;
|
|
9
|
+
static OPEN = 1;
|
|
10
|
+
static CLOSING = 2;
|
|
11
|
+
static CLOSED = 3;
|
|
12
|
+
CONNECTING = 0;
|
|
13
|
+
OPEN = 1;
|
|
14
|
+
CLOSING = 2;
|
|
15
|
+
CLOSED = 3;
|
|
16
|
+
onclose = null;
|
|
17
|
+
onerror = null;
|
|
18
|
+
onopen = null;
|
|
19
|
+
onmessage = null;
|
|
20
|
+
binaryType = "blob";
|
|
21
|
+
readyState = WebSocketSSE.CONNECTING;
|
|
22
|
+
url;
|
|
23
|
+
protocol = "";
|
|
24
|
+
extensions = "";
|
|
25
|
+
bufferedAmount = 0;
|
|
26
|
+
#options = {};
|
|
27
|
+
#sse;
|
|
28
|
+
#id;
|
|
29
|
+
#sendController;
|
|
30
|
+
#queue = [];
|
|
31
|
+
constructor(url, init) {
|
|
32
|
+
super();
|
|
33
|
+
this.url = url.replace(/^ws/, "http");
|
|
34
|
+
if (typeof init === "string") this.#options = {
|
|
35
|
+
...defaultOptions,
|
|
36
|
+
protocols: init
|
|
37
|
+
};
|
|
38
|
+
else if (Array.isArray(init)) this.#options = {
|
|
39
|
+
...defaultOptions,
|
|
40
|
+
protocols: init
|
|
41
|
+
};
|
|
42
|
+
else this.#options = {
|
|
43
|
+
...defaultOptions,
|
|
44
|
+
...init
|
|
45
|
+
};
|
|
46
|
+
this.#sse = new EventSource(this.url);
|
|
47
|
+
this.#sse.addEventListener("open", (_sseEvent) => {
|
|
48
|
+
this.readyState = WebSocketSSE.OPEN;
|
|
49
|
+
const event = new Event("open");
|
|
50
|
+
this.onopen?.(event);
|
|
51
|
+
this.dispatchEvent(event);
|
|
52
|
+
});
|
|
53
|
+
this.#sse.addEventListener("message", (sseEvent) => {
|
|
54
|
+
const _event = new MessageEvent("message", { data: sseEvent.data });
|
|
55
|
+
this.onmessage?.(_event);
|
|
56
|
+
this.dispatchEvent(_event);
|
|
57
|
+
});
|
|
58
|
+
if (this.#options.bidir) this.#sse.addEventListener("crossws-id", (sseEvent) => {
|
|
59
|
+
this.#id = sseEvent.data;
|
|
60
|
+
if (this.#options.stream) fetch(this.url, {
|
|
61
|
+
method: "POST",
|
|
62
|
+
duplex: "half",
|
|
63
|
+
headers: {
|
|
64
|
+
"content-type": "application/octet-stream",
|
|
65
|
+
"x-crossws-id": this.#id
|
|
66
|
+
},
|
|
67
|
+
body: new ReadableStream({
|
|
68
|
+
start: (controller) => {
|
|
69
|
+
this.#sendController = controller;
|
|
70
|
+
},
|
|
71
|
+
cancel: () => {
|
|
72
|
+
this.#sendController = void 0;
|
|
73
|
+
}
|
|
74
|
+
}).pipeThrough(new TextEncoderStream())
|
|
75
|
+
}).catch(() => {});
|
|
76
|
+
for (const data of this.#queue) this.send(data);
|
|
77
|
+
this.#queue = [];
|
|
78
|
+
});
|
|
79
|
+
this.#sse.addEventListener("error", (_sseEvent) => {
|
|
80
|
+
const event = new Event("error");
|
|
81
|
+
this.onerror?.(event);
|
|
82
|
+
this.dispatchEvent(event);
|
|
83
|
+
});
|
|
84
|
+
this.#sse.addEventListener("close", (_sseEvent) => {
|
|
85
|
+
this.readyState = WebSocketSSE.CLOSED;
|
|
86
|
+
const event = new Event("close");
|
|
87
|
+
this.onclose?.(event);
|
|
88
|
+
this.dispatchEvent(event);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
close(_code, _reason) {
|
|
92
|
+
this.readyState = WebSocketSSE.CLOSING;
|
|
93
|
+
this.#sse.close();
|
|
94
|
+
this.readyState = WebSocketSSE.CLOSED;
|
|
95
|
+
}
|
|
96
|
+
async send(data) {
|
|
97
|
+
if (!this.#options.bidir) throw new Error("bdir option is not enabled!");
|
|
98
|
+
if (this.readyState !== WebSocketSSE.OPEN) throw new Error("WebSocket is not open!");
|
|
99
|
+
if (!this.#id) {
|
|
100
|
+
this.#queue.push(data);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (this.#sendController) {
|
|
104
|
+
this.#sendController.enqueue(data);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
await fetch(this.url, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: { "x-crossws-id": this.#id },
|
|
110
|
+
body: data
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
126
114
|
|
|
127
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
export { WebSocketSSE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crossws",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Cross-platform WebSocket Servers for Node.js, Deno, Bun and Cloudflare Workers",
|
|
5
5
|
"homepage": "https://crossws.h3.dev",
|
|
6
6
|
"repository": "h3js/crossws",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"*.d.ts"
|
|
49
49
|
],
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "
|
|
51
|
+
"build": "obuild",
|
|
52
52
|
"dev": "vitest",
|
|
53
53
|
"lint": "eslint --cache . && prettier -c src test",
|
|
54
54
|
"lint:fix": "eslint --cache . --fix && prettier -w src test",
|
|
@@ -62,39 +62,41 @@
|
|
|
62
62
|
"play:uws": "jiti test/fixture/uws.ts",
|
|
63
63
|
"release": "pnpm test && pnpm build && changelogen --release && npm publish && git push --follow-tags",
|
|
64
64
|
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
|
|
65
|
-
"test:types": "
|
|
65
|
+
"test:types": "tsgo --noEmit --skipLibCheck"
|
|
66
66
|
},
|
|
67
67
|
"resolutions": {
|
|
68
68
|
"crossws": "workspace:*"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@cloudflare/workers-types": "^4.
|
|
72
|
-
"@types/bun": "^1.
|
|
73
|
-
"@types/deno": "^2.
|
|
74
|
-
"@types/node": "^
|
|
75
|
-
"@types/web": "^0.0.
|
|
71
|
+
"@cloudflare/workers-types": "^4.20260118.0",
|
|
72
|
+
"@types/bun": "^1.3.6",
|
|
73
|
+
"@types/deno": "^2.5.0",
|
|
74
|
+
"@types/node": "^25.0.9",
|
|
75
|
+
"@types/web": "^0.0.318",
|
|
76
76
|
"@types/ws": "^8.18.1",
|
|
77
|
-
"@
|
|
78
|
-
"
|
|
79
|
-
"
|
|
77
|
+
"@typescript/native-preview": "7.0.0-dev.20260119.1",
|
|
78
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
79
|
+
"automd": "^0.4.2",
|
|
80
|
+
"changelogen": "^0.6.2",
|
|
80
81
|
"consola": "^3.4.2",
|
|
81
|
-
"eslint": "^9.
|
|
82
|
-
"eslint-config-unjs": "^0.
|
|
83
|
-
"eventsource": "^4.
|
|
84
|
-
"execa": "^9.
|
|
85
|
-
"get-port-please": "^3.
|
|
86
|
-
"h3": "^1.
|
|
87
|
-
"jiti": "^2.
|
|
82
|
+
"eslint": "^9.39.2",
|
|
83
|
+
"eslint-config-unjs": "^0.6.2",
|
|
84
|
+
"eventsource": "^4.1.0",
|
|
85
|
+
"execa": "^9.6.1",
|
|
86
|
+
"get-port-please": "^3.2.0",
|
|
87
|
+
"h3": "^2.0.1-rc.8",
|
|
88
|
+
"jiti": "^2.6.1",
|
|
88
89
|
"listhen": "^1.9.0",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
90
|
+
"obuild": "^0.4.16",
|
|
91
|
+
"prettier": "^3.8.0",
|
|
92
|
+
"srvx": "^0.10.1",
|
|
93
|
+
"typescript": "^5.9.3",
|
|
94
|
+
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.57.0",
|
|
95
|
+
"unbuild": "^3.6.1",
|
|
96
|
+
"undici": "^7.18.2",
|
|
97
|
+
"vitest": "^4.0.17",
|
|
98
|
+
"wrangler": "^4.59.2",
|
|
99
|
+
"ws": "^8.19.0"
|
|
98
100
|
},
|
|
99
101
|
"peerDependencies": {
|
|
100
102
|
"srvx": ">=0.7.1"
|
|
@@ -104,13 +106,19 @@
|
|
|
104
106
|
"optional": true
|
|
105
107
|
}
|
|
106
108
|
},
|
|
107
|
-
"packageManager": "pnpm@10.
|
|
109
|
+
"packageManager": "pnpm@10.28.1",
|
|
108
110
|
"pnpm": {
|
|
109
111
|
"ignoredBuiltDependencies": [
|
|
110
112
|
"@parcel/watcher",
|
|
111
113
|
"esbuild",
|
|
112
114
|
"sharp",
|
|
113
115
|
"workerd"
|
|
116
|
+
],
|
|
117
|
+
"onlyBuiltDependencies": [
|
|
118
|
+
"@parcel/watcher",
|
|
119
|
+
"esbuild",
|
|
120
|
+
"sharp",
|
|
121
|
+
"workerd"
|
|
114
122
|
]
|
|
115
123
|
}
|
|
116
124
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ServerRequest, ServerOptions } from 'srvx/types';
|
|
2
|
-
import { Hooks } from '../index.mjs';
|
|
3
|
-
import { BunOptions } from '../adapters/bun.mjs';
|
|
4
|
-
import { DenoOptions } from '../adapters/deno.mjs';
|
|
5
|
-
import { NodeOptions } from '../adapters/node.mjs';
|
|
6
|
-
import { SSEOptions } from '../adapters/sse.mjs';
|
|
7
|
-
import { CloudflareOptions } from '../adapters/cloudflare.mjs';
|
|
8
|
-
|
|
9
|
-
type WSOptions = Partial<Hooks> & {
|
|
10
|
-
resolve?: (req: ServerRequest) => Partial<Hooks> | Promise<Partial<Hooks>>;
|
|
11
|
-
options?: {
|
|
12
|
-
bun?: BunOptions;
|
|
13
|
-
deno?: DenoOptions;
|
|
14
|
-
node?: NodeOptions;
|
|
15
|
-
sse?: SSEOptions;
|
|
16
|
-
cloudflare?: CloudflareOptions;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
type ServerWithWSOptions = ServerOptions & {
|
|
20
|
-
websocket?: WSOptions;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type { ServerWithWSOptions as S, WSOptions as W };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const StubRequest = /* @__PURE__ */ (() => {
|
|
2
|
-
class StubRequest2 {
|
|
3
|
-
url;
|
|
4
|
-
_signal;
|
|
5
|
-
_headers;
|
|
6
|
-
_init;
|
|
7
|
-
constructor(url, init = {}) {
|
|
8
|
-
this.url = url;
|
|
9
|
-
this._init = init;
|
|
10
|
-
}
|
|
11
|
-
get headers() {
|
|
12
|
-
if (!this._headers) {
|
|
13
|
-
this._headers = new Headers(this._init?.headers);
|
|
14
|
-
}
|
|
15
|
-
return this._headers;
|
|
16
|
-
}
|
|
17
|
-
clone() {
|
|
18
|
-
return new StubRequest2(this.url, this._init);
|
|
19
|
-
}
|
|
20
|
-
// --- dummy ---
|
|
21
|
-
get method() {
|
|
22
|
-
return "GET";
|
|
23
|
-
}
|
|
24
|
-
get signal() {
|
|
25
|
-
return this._signal ??= new AbortSignal();
|
|
26
|
-
}
|
|
27
|
-
get cache() {
|
|
28
|
-
return "default";
|
|
29
|
-
}
|
|
30
|
-
get credentials() {
|
|
31
|
-
return "same-origin";
|
|
32
|
-
}
|
|
33
|
-
get destination() {
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
get integrity() {
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
get keepalive() {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
get redirect() {
|
|
43
|
-
return "follow";
|
|
44
|
-
}
|
|
45
|
-
get mode() {
|
|
46
|
-
return "cors";
|
|
47
|
-
}
|
|
48
|
-
get referrer() {
|
|
49
|
-
return "about:client";
|
|
50
|
-
}
|
|
51
|
-
get referrerPolicy() {
|
|
52
|
-
return "";
|
|
53
|
-
}
|
|
54
|
-
get body() {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
get bodyUsed() {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
arrayBuffer() {
|
|
61
|
-
return Promise.resolve(new ArrayBuffer(0));
|
|
62
|
-
}
|
|
63
|
-
blob() {
|
|
64
|
-
return Promise.resolve(new Blob());
|
|
65
|
-
}
|
|
66
|
-
bytes() {
|
|
67
|
-
return Promise.resolve(new Uint8Array());
|
|
68
|
-
}
|
|
69
|
-
formData() {
|
|
70
|
-
return Promise.resolve(new FormData());
|
|
71
|
-
}
|
|
72
|
-
json() {
|
|
73
|
-
return Promise.resolve(JSON.parse(""));
|
|
74
|
-
}
|
|
75
|
-
text() {
|
|
76
|
-
return Promise.resolve("");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
Object.setPrototypeOf(StubRequest2.prototype, globalThis.Request.prototype);
|
|
80
|
-
return StubRequest2;
|
|
81
|
-
})();
|
|
82
|
-
|
|
83
|
-
export { StubRequest as S };
|