@modern-js/types 2.67.0 → 2.67.1

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/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.0",
18
+ "version": "2.67.1",
19
19
  "types": "./index.d.ts",
20
20
  "exports": {
21
21
  ".": {
@@ -48,8 +48,8 @@
48
48
  "http-proxy-middleware": "^2.0.4",
49
49
  "jest": "^29",
50
50
  "type-fest": "2.15.0",
51
- "@scripts/jest-config": "2.66.0",
52
- "@scripts/build": "2.66.0"
51
+ "@scripts/build": "2.66.0",
52
+ "@scripts/jest-config": "2.66.0"
53
53
  },
54
54
  "sideEffects": false,
55
55
  "publishConfig": {
@@ -1,11 +1,11 @@
1
- import type { IncomingMessage, ServerResponse } from 'http';
1
+ import type { NodeRequest, NodeResponse } from '@modern-js/server-core/node';
2
2
  import type { BffProxyOptions, NextFunction } from './utils';
3
3
 
4
4
  export type DevServerHttpsOptions = boolean | { key: string; cert: string };
5
5
 
6
6
  export type RequestHandler = (
7
- req: IncomingMessage,
8
- res: ServerResponse,
7
+ req: NodeRequest,
8
+ res: NodeResponse,
9
9
  next: NextFunction,
10
10
  ) => void;
11
11
 
package/server/hook.d.ts CHANGED
@@ -4,6 +4,7 @@ import type {
4
4
  ServerResponse,
5
5
  } from 'http';
6
6
  import type { ServerRoute } from './route';
7
+ import type { NodeRequest, NodeResponse } from './server';
7
8
  import type { Logger, Metrics, Reporter } from './utils';
8
9
 
9
10
  export type CookieAPI = {
@@ -90,7 +91,7 @@ export type MiddlewareContext<T extends 'worker' | 'node' = 'node'> =
90
91
  reporter?: Reporter;
91
92
  response: ModernResponse & { locals: Record<string, any> };
92
93
  source: {
93
- req: T extends 'worker' ? Request : IncomingMessage;
94
- res: T extends 'worker' ? ModernResponse : ServerResponse;
94
+ req: T extends 'worker' ? Request : NodeRequest;
95
+ res: T extends 'worker' ? ModernResponse : NodeResponse;
95
96
  };
96
97
  };
package/server/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './hook';
3
3
  export * from './utils';
4
4
  export * from './route';
5
5
  export * from './bff';
6
+ export * from './server';
6
7
  export * from './devServer';
7
8
  export * from './middleware';
8
9
  export * from './monitor';
@@ -0,0 +1,2 @@
1
+ export type NodeRequest = IncomingMessage | Http2ServerRequest;
2
+ export type NodeResponse = ServerResponse | Http2ServerResponse;
package/server/utils.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'http';
2
+ import type { Http2ServerRequest } from 'node:http2';
2
3
  import type {
3
4
  Filter as ProxyFilter,
4
5
  Options as ProxyOptions,
5
6
  } from 'http-proxy-middleware';
6
-
7
+ import type { NodeRequest } from './server';
7
8
  export interface Metrics {
8
9
  emitCounter: (
9
10
  name: string,
@@ -102,7 +103,7 @@ export type CacheControl = {
102
103
  };
103
104
 
104
105
  export type CacheOptionProvider = (
105
- req: IncomingMessage,
106
+ req: NodeRequest,
106
107
  ) => Promise<CacheControl | false> | CacheControl | false;
107
108
 
108
109
  export type CacheOption =