@modern-js/server-core 2.9.0 → 2.10.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 +15 -0
- package/dist/cjs/plugin.js +2 -2
- package/dist/esm/plugin.js +2 -2
- package/dist/types/plugin.d.ts +18 -16
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @modern-js/server-plugin
|
|
2
2
|
|
|
3
|
+
## 2.10.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3e0bd50: feat: when enable bff handle render, support use `useContext` to get framework plugin context in data loader.
|
|
8
|
+
feat: 当开启 BFF 托管渲染时,支持在 data loader 中使用 `useContext` 获取框架插件提供的上下文。
|
|
9
|
+
- 0da32d0: chore: upgrade jest and puppeteer
|
|
10
|
+
chore: 升级 jest 和 puppeteer 到 latest
|
|
11
|
+
- Updated dependencies [0da32d0]
|
|
12
|
+
- Updated dependencies [fbefa7e]
|
|
13
|
+
- Updated dependencies [4d54233]
|
|
14
|
+
- Updated dependencies [6db4864]
|
|
15
|
+
- @modern-js/plugin@2.10.0
|
|
16
|
+
- @modern-js/utils@2.10.0
|
|
17
|
+
|
|
3
18
|
## 2.9.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_plugin = require("@modern-js/plugin");
|
|
|
31
31
|
const gather = (0, import_plugin.createParallelWorkflow)();
|
|
32
32
|
const config = (0, import_plugin.createWaterfall)();
|
|
33
33
|
const prepare = (0, import_plugin.createWaterfall)();
|
|
34
|
-
const
|
|
34
|
+
const prepareLoaderHandler = (0, import_plugin.createAsyncPipeline)();
|
|
35
35
|
const prepareWebServer = (0, import_plugin.createAsyncPipeline)();
|
|
36
36
|
const prepareApiServer = (0, import_plugin.createAsyncPipeline)();
|
|
37
37
|
const onApiChange = (0, import_plugin.createWaterfall)();
|
|
@@ -73,7 +73,7 @@ const serverHooks = {
|
|
|
73
73
|
gather,
|
|
74
74
|
config,
|
|
75
75
|
prepare,
|
|
76
|
-
|
|
76
|
+
prepareLoaderHandler,
|
|
77
77
|
prepareWebServer,
|
|
78
78
|
prepareApiServer,
|
|
79
79
|
repack,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
const gather = createParallelWorkflow();
|
|
10
10
|
const config = createWaterfall();
|
|
11
11
|
const prepare = createWaterfall();
|
|
12
|
-
const
|
|
12
|
+
const prepareLoaderHandler = createAsyncPipeline();
|
|
13
13
|
const prepareWebServer = createAsyncPipeline();
|
|
14
14
|
const prepareApiServer = createAsyncPipeline();
|
|
15
15
|
const onApiChange = createWaterfall();
|
|
@@ -51,7 +51,7 @@ const serverHooks = {
|
|
|
51
51
|
gather,
|
|
52
52
|
config,
|
|
53
53
|
prepare,
|
|
54
|
-
|
|
54
|
+
prepareLoaderHandler,
|
|
55
55
|
prepareWebServer,
|
|
56
56
|
prepareApiServer,
|
|
57
57
|
repack,
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
|
+
import { Readable } from 'stream';
|
|
3
5
|
import type { Component } from 'react';
|
|
4
6
|
import { CommonAPI, ToThreads, AsyncSetup, PluginOptions } from '@modern-js/plugin';
|
|
5
7
|
import type { ModernServerContext, BaseSSRServerContext, AfterMatchContext, AfterRenderContext, MiddlewareContext, ISAppContext, ServerRoute, HttpMethodDecider } from '@modern-js/types';
|
|
@@ -10,7 +12,7 @@ export type WebServerStartInput = {
|
|
|
10
12
|
pwd: string;
|
|
11
13
|
config: Record<string, any>;
|
|
12
14
|
};
|
|
13
|
-
export type
|
|
15
|
+
export type LoaderHandler = (context: ModernServerContext) => Promise<void>;
|
|
14
16
|
export type APIServerStartInput = {
|
|
15
17
|
pwd: string;
|
|
16
18
|
prefix?: string;
|
|
@@ -18,7 +20,7 @@ export type APIServerStartInput = {
|
|
|
18
20
|
config?: {
|
|
19
21
|
middleware?: Array<any>;
|
|
20
22
|
};
|
|
21
|
-
render?: (req: IncomingMessage, res: ServerResponse, url?: string) => Promise<string | null>;
|
|
23
|
+
render?: (req: IncomingMessage, res: ServerResponse, url?: string) => Promise<string | Readable | null>;
|
|
22
24
|
};
|
|
23
25
|
type Change = {
|
|
24
26
|
filename: string;
|
|
@@ -55,10 +57,10 @@ declare const serverHooks: {
|
|
|
55
57
|
}, unknown>;
|
|
56
58
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
57
59
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
58
|
-
|
|
60
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
59
61
|
serverRoutes: ServerRoute[];
|
|
60
62
|
distDir: string;
|
|
61
|
-
},
|
|
63
|
+
}, LoaderHandler>;
|
|
62
64
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
63
65
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
64
66
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
@@ -118,10 +120,10 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
|
|
|
118
120
|
}, unknown>;
|
|
119
121
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
120
122
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
121
|
-
|
|
123
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
122
124
|
serverRoutes: ServerRoute[];
|
|
123
125
|
distDir: string;
|
|
124
|
-
},
|
|
126
|
+
}, LoaderHandler>;
|
|
125
127
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
126
128
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
127
129
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
@@ -176,10 +178,10 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
|
|
|
176
178
|
}, unknown>;
|
|
177
179
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
178
180
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
179
|
-
|
|
181
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
180
182
|
serverRoutes: ServerRoute[];
|
|
181
183
|
distDir: string;
|
|
182
|
-
},
|
|
184
|
+
}, LoaderHandler>;
|
|
183
185
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
184
186
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
185
187
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
@@ -241,10 +243,10 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
241
243
|
}, unknown>;
|
|
242
244
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
243
245
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
244
|
-
|
|
246
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
245
247
|
serverRoutes: ServerRoute[];
|
|
246
248
|
distDir: string;
|
|
247
|
-
},
|
|
249
|
+
}, LoaderHandler>;
|
|
248
250
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
249
251
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
250
252
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
@@ -298,10 +300,10 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
298
300
|
}, unknown>;
|
|
299
301
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
300
302
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
301
|
-
|
|
303
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
302
304
|
serverRoutes: ServerRoute[];
|
|
303
305
|
distDir: string;
|
|
304
|
-
},
|
|
306
|
+
}, LoaderHandler>;
|
|
305
307
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
306
308
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
307
309
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
@@ -351,10 +353,10 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
351
353
|
}, unknown>;
|
|
352
354
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
353
355
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
354
|
-
|
|
356
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
355
357
|
serverRoutes: ServerRoute[];
|
|
356
358
|
distDir: string;
|
|
357
|
-
},
|
|
359
|
+
}, LoaderHandler>;
|
|
358
360
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
359
361
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
360
362
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
@@ -408,10 +410,10 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
408
410
|
}, unknown>;
|
|
409
411
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
410
412
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
411
|
-
|
|
413
|
+
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
412
414
|
serverRoutes: ServerRoute[];
|
|
413
415
|
distDir: string;
|
|
414
|
-
},
|
|
416
|
+
}, LoaderHandler>;
|
|
415
417
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
|
|
416
418
|
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
|
|
417
419
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.10.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/cjs/index.js",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modern-js/plugin": "2.
|
|
32
|
-
"@modern-js/utils": "2.
|
|
31
|
+
"@modern-js/plugin": "2.10.0",
|
|
32
|
+
"@modern-js/utils": "2.10.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/jest": "^
|
|
35
|
+
"@types/jest": "^29",
|
|
36
36
|
"@types/node": "^14",
|
|
37
37
|
"http-proxy-middleware": "^2.0.4",
|
|
38
|
-
"jest": "^
|
|
39
|
-
"ts-jest": "^
|
|
38
|
+
"jest": "^29",
|
|
39
|
+
"ts-jest": "^29.0.5",
|
|
40
40
|
"typescript": "^4",
|
|
41
|
-
"@modern-js/types": "2.
|
|
42
|
-
"@modern-js/babel-preset-app": "2.
|
|
43
|
-
"@scripts/
|
|
44
|
-
"@scripts/
|
|
41
|
+
"@modern-js/types": "2.10.0",
|
|
42
|
+
"@modern-js/babel-preset-app": "2.10.0",
|
|
43
|
+
"@scripts/build": "2.10.0",
|
|
44
|
+
"@scripts/jest-config": "2.10.0"
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"publishConfig": {
|