routup 3.2.0 → 3.3.0
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/constants.d.ts +2 -0
- package/dist/index.cjs +100 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +98 -2
- package/dist/index.mjs.map +1 -1
- package/dist/request/helpers/http2.d.ts +2 -0
- package/dist/request/helpers/index.d.ts +1 -0
- package/dist/response/helpers/event-stream/factory.d.ts +3 -0
- package/dist/response/helpers/event-stream/index.d.ts +2 -0
- package/dist/response/helpers/event-stream/module.d.ts +17 -0
- package/dist/response/helpers/event-stream/types.d.ts +24 -0
- package/dist/response/helpers/event-stream/utils.d.ts +2 -0
- package/dist/response/helpers/gone.d.ts +1 -0
- package/dist/response/helpers/index.d.ts +1 -0
- package/package.json +20 -20
|
@@ -7,6 +7,7 @@ export * from './header-accept-encoding';
|
|
|
7
7
|
export * from './header-accept-language';
|
|
8
8
|
export * from './header-content-type';
|
|
9
9
|
export * from './hostname';
|
|
10
|
+
export * from './http2';
|
|
10
11
|
export * from './ip';
|
|
11
12
|
export * from './mount-path';
|
|
12
13
|
export * from './negotiator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PassThrough } from 'readable-stream';
|
|
2
|
+
import type { Response } from '../../types';
|
|
3
|
+
import type { EventStreamListener, EventStreamMessage } from './types';
|
|
4
|
+
export declare class EventStream {
|
|
5
|
+
protected response: Response;
|
|
6
|
+
protected passThrough: PassThrough;
|
|
7
|
+
protected flushed: boolean;
|
|
8
|
+
protected eventHandlers: Record<string, EventStreamListener[]>;
|
|
9
|
+
constructor(response: Response);
|
|
10
|
+
protected open(): void;
|
|
11
|
+
write(message: EventStreamMessage): void;
|
|
12
|
+
write(message: string): void;
|
|
13
|
+
end(): void;
|
|
14
|
+
on(event: 'close', listener: EventStreamListener): void;
|
|
15
|
+
on(event: 'error', listener: EventStreamListener): void;
|
|
16
|
+
protected emit(event: string, ...args: any[]): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
|
|
3
|
+
*/
|
|
4
|
+
export type EventStreamMessage = {
|
|
5
|
+
/**
|
|
6
|
+
* The event ID to set the EventSource object's last event ID value.
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The reconnection time.
|
|
11
|
+
* If the connection to the server is lost, the browser will wait for the specified time before attempting to reconnect.
|
|
12
|
+
* This must be an integer, specifying the reconnection time in milliseconds.
|
|
13
|
+
*/
|
|
14
|
+
retry?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The data field for the message.
|
|
17
|
+
*/
|
|
18
|
+
data: string;
|
|
19
|
+
/**
|
|
20
|
+
* A string identifying the type of event described.
|
|
21
|
+
*/
|
|
22
|
+
event?: string;
|
|
23
|
+
};
|
|
24
|
+
export type EventStreamListener<T = any> = (err: Error | null, data: T) => void | Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routup",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Routup is a minimalistic http based routing framework.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -52,35 +52,35 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@ebec/http": "^2.3.0",
|
|
54
54
|
"buffer": "^6.0.3",
|
|
55
|
-
"mime-explorer": "^1.
|
|
55
|
+
"mime-explorer": "^1.1.0",
|
|
56
56
|
"negotiator": "^0.6.3",
|
|
57
57
|
"path-to-regexp": "^6.2.1",
|
|
58
58
|
"proxy-addr": "^2.0.7",
|
|
59
|
-
"readable-stream": "^4.
|
|
60
|
-
"smob": "^1.
|
|
59
|
+
"readable-stream": "^4.5.2",
|
|
60
|
+
"smob": "^1.5.0",
|
|
61
61
|
"uncrypto": "^0.1.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
66
|
-
"@swc/core": "^1.
|
|
67
|
-
"@swc/jest": "^0.2.
|
|
68
|
-
"@tada5hi/commitlint-config": "^1.
|
|
69
|
-
"@tada5hi/eslint-config-typescript": "^1.2.
|
|
70
|
-
"@tada5hi/semantic-release": "^0.3.
|
|
71
|
-
"@tada5hi/tsconfig": "^0.5.
|
|
72
|
-
"@types/jest": "^29.5.
|
|
73
|
-
"@types/negotiator": "^0.6.
|
|
74
|
-
"@types/node": "^20.
|
|
75
|
-
"@types/proxy-addr": "^2.0.
|
|
76
|
-
"@types/readable-stream": "^4.0.
|
|
77
|
-
"@types/supertest": "^
|
|
66
|
+
"@swc/core": "^1.4.11",
|
|
67
|
+
"@swc/jest": "^0.2.36",
|
|
68
|
+
"@tada5hi/commitlint-config": "^1.2.0",
|
|
69
|
+
"@tada5hi/eslint-config-typescript": "^1.2.10",
|
|
70
|
+
"@tada5hi/semantic-release": "^0.3.1",
|
|
71
|
+
"@tada5hi/tsconfig": "^0.5.1",
|
|
72
|
+
"@types/jest": "^29.5.12",
|
|
73
|
+
"@types/negotiator": "^0.6.3",
|
|
74
|
+
"@types/node": "^20.12.2",
|
|
75
|
+
"@types/proxy-addr": "^2.0.3",
|
|
76
|
+
"@types/readable-stream": "^4.0.11",
|
|
77
|
+
"@types/supertest": "^6.0.2",
|
|
78
78
|
"cross-env": "^7.0.3",
|
|
79
79
|
"jest": "^29.7.0",
|
|
80
80
|
"rimraf": "^5.0.5",
|
|
81
|
-
"rollup": "^4.
|
|
82
|
-
"semantic-release": "^22.0.
|
|
83
|
-
"supertest": "^6.3.
|
|
84
|
-
"typescript": "5.
|
|
81
|
+
"rollup": "^4.13.2",
|
|
82
|
+
"semantic-release": "^22.0.12",
|
|
83
|
+
"supertest": "^6.3.4",
|
|
84
|
+
"typescript": "5.4.3"
|
|
85
85
|
}
|
|
86
86
|
}
|