@modern-js/types 2.6.0 → 2.8.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.8.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 70d82e1408: fix: use mock host instead real url host for url parse, for new URL not support ipv6, and we only need parse url path & search
8
+ fix: 使用虚拟的域名代替真实的主机名,因为 new URL 不支持解析 ipv6 的域名,并且我们只需要解析 url 的路径和查询字符串
9
+ - 1f6ca2c7fb: fix: nested routes in ssg
10
+ fix: 修复嵌套路由在 SSG 中的问题
11
+
12
+ ## 2.7.0
13
+
14
+ ### Minor Changes
15
+
16
+ - dcad887024: feat: support deferred data for streaming ssr
17
+ feat: 流式渲染支持 deferred data
18
+ - 84bfb439b8: feat: support custom apiDir, lambdaDir and style of writing for bff
19
+ feat: 支持定制 api 目录,lambda 目录,bff 的写法
20
+
3
21
  ## 2.6.0
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -19,8 +19,8 @@ Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-sta
19
19
 
20
20
  ## Contributing
21
21
 
22
- Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
22
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/modern.js/blob/main/CONTRIBUTING.md).
23
23
 
24
24
  ## License
25
25
 
26
- Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
26
+ Modern.js is [MIT licensed](https://github.com/web-infra-dev/modern.js/blob/main/LICENSE).
package/cli/index.d.ts CHANGED
@@ -88,4 +88,32 @@ export interface HtmlTemplates {
88
88
  [name: string]: string;
89
89
  }
90
90
 
91
+ export type SSGRouteOptions =
92
+ | string
93
+ | {
94
+ url: string;
95
+ output?: string;
96
+ params?: Record<string, any>[];
97
+ headers?: Record<string, any>;
98
+ };
99
+
100
+ export type SSGSingleEntryOptions =
101
+ | boolean
102
+ | {
103
+ preventDefault?: string[];
104
+ headers?: Record<string, any>;
105
+ routes?: SSGRouteOptions[];
106
+ };
107
+
108
+ export type SSGMultiEntryOptions = Record<string, SSGSingleEntryOptions>;
109
+
110
+ export type SSGConfig =
111
+ | boolean
112
+ | SSGSingleEntryOptions
113
+ | SSGMultiEntryOptions
114
+ | ((
115
+ entryName: string,
116
+ payload: { baseUrl?: string },
117
+ ) => SSGSingleEntryOptions);
118
+
91
119
  export type { Merge } from 'type-fest';
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
@@ -2,8 +2,8 @@
2
2
  "name": "@modern-js/types",
3
3
  "description": "A Progressive React Framework for modern web development.",
4
4
  "homepage": "https://modernjs.dev",
5
- "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
- "repository": "modern-js-dev/modern.js",
5
+ "bugs": "https://github.com/web-infra-dev/modern.js/issues",
6
+ "repository": "web-infra-dev/modern.js",
7
7
  "license": "MIT",
8
8
  "keywords": [
9
9
  "react",
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.6.0",
14
+ "version": "2.8.0",
15
15
  "types": "./index.d.ts",
16
16
  "exports": {
17
17
  ".": "./index.d.ts",
@@ -38,8 +38,8 @@
38
38
  "http-proxy-middleware": "^2.0.4",
39
39
  "jest": "^27",
40
40
  "type-fest": "2.15.0",
41
- "@scripts/build": "2.6.0",
42
- "@scripts/jest-config": "2.6.0"
41
+ "@scripts/build": "2.8.0",
42
+ "@scripts/jest-config": "2.8.0"
43
43
  },
44
44
  "sideEffects": false,
45
45
  "publishConfig": {
@@ -0,0 +1 @@
1
+ export type HttpMethodDecider = 'functionName' | 'inputParams';
@@ -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 {
@@ -32,8 +33,6 @@ export interface ModernServerContext {
32
33
 
33
34
  href: string;
34
35
 
35
- parsedURL: URL;
36
-
37
36
  path: string;
38
37
 
39
38
  querystring: string;
@@ -94,6 +93,8 @@ export type BaseSSRServerContext = {
94
93
  req: ModernServerContext['req'];
95
94
 
96
95
  res: ModernServerContext['res'];
96
+
97
+ mode?: SSRMode; // ssr type
97
98
  };
98
99
  export interface ISAppContext {
99
100
  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>;
package/server/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './context';
2
2
  export * from './hook';
3
3
  export * from './utils';
4
4
  export * from './route';
5
+ export * from './bff';
5
6
  export * from './devServer';