@modern-js/types 2.5.1-alpha.0 → 2.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @modern-js/types
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dcad887024: feat: support deferred data for streaming ssr
8
+ feat: 流式渲染支持 deferred data
9
+ - 84bfb439b8: feat: support custom apiDir, lambdaDir and style of writing for bff
10
+ feat: 支持定制 api 目录,lambda 目录,bff 的写法
11
+
12
+ ## 2.6.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 49fa0b1: fix: remove header info from SSR ctx to avoid security issues, reserved a switch
17
+ fix: 移除 SSR 上下文中的 header 信息,避免造成安全问题,预留一个字段开启
18
+ - 62930b9: fix: support configure host for devServer
19
+ fix: 支持配置 devServer 的 host
20
+
3
21
  ## 2.5.0
4
22
 
5
23
  ### Patch Changes
package/common/index.d.ts CHANGED
@@ -7,3 +7,5 @@ export type InternalPlugins = Record<
7
7
  string,
8
8
  string | { path: string; forced?: boolean }
9
9
  >;
10
+
11
+ export type SSRMode = 'string' | 'stream';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.5.1-alpha.0",
14
+ "version": "2.7.0",
15
15
  "types": "./index.d.ts",
16
16
  "exports": {
17
17
  ".": "./index.d.ts",
@@ -31,15 +31,15 @@
31
31
  }
32
32
  },
33
33
  "devDependencies": {
34
- "@scripts/build": "2.5.0",
35
34
  "@types/babel__core": "^7.1.19",
36
- "@scripts/jest-config": "2.5.0",
37
35
  "@types/jest": "^27",
38
36
  "@types/node": "^14",
39
37
  "@jest/types": "^27.0.6",
40
38
  "http-proxy-middleware": "^2.0.4",
41
39
  "jest": "^27",
42
- "type-fest": "2.15.0"
40
+ "type-fest": "2.15.0",
41
+ "@scripts/build": "2.7.0",
42
+ "@scripts/jest-config": "2.7.0"
43
43
  },
44
44
  "sideEffects": false,
45
45
  "publishConfig": {
@@ -1,6 +1,7 @@
1
1
  import { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
2
2
  import { URL } from 'url';
3
3
  import qs from 'querystring';
4
+ import type { SSRMode } from 'common';
4
5
  import { Metrics, Logger } from './utils';
5
6
 
6
7
  export interface ModernServerContext {
@@ -58,7 +59,6 @@ export type BaseSSRServerContext = {
58
59
  query: Record<string, string>;
59
60
  headers: IncomingHttpHeaders;
60
61
  host: string;
61
- cookieMap: Record<string, any>;
62
62
  [propsName: string]: any;
63
63
  };
64
64
  response: {
@@ -90,9 +90,13 @@ export type BaseSSRServerContext = {
90
90
  };
91
91
  cacheConfig?: any;
92
92
 
93
+ enableUnsafeCtx?: boolean;
94
+
93
95
  req: ModernServerContext['req'];
94
96
 
95
97
  res: ModernServerContext['res'];
98
+
99
+ mode?: SSRMode; // ssr type
96
100
  };
97
101
  export interface ISAppContext {
98
102
  appDirectory: string;
@@ -25,7 +25,8 @@ export type DevServerOptions = {
25
25
  protocol?: string;
26
26
  };
27
27
  devMiddleware?: {
28
- writeToDisk: boolean | ((filename: string) => boolean);
28
+ writeToDisk?: boolean | ((filename: string) => boolean);
29
+ outputFileSystem?: Record<string, any>;
29
30
  };
30
31
  proxy?: BffProxyOptions;
31
32
  headers?: Record<string, string>;