@modern-js/server-core 2.4.1-beta.0 → 2.5.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,15 +1,29 @@
1
1
  # @modern-js/server-plugin
2
2
 
3
- ## 2.4.1-beta.0
3
+ ## 2.5.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 89ca6cc: refactor: merge build-config into scripts/build
8
+
9
+ refactor: 把 build-config 合并进 scripts/build
10
+
11
+ - 6fca567: feat: support bff handle complete server, include page render
12
+ feat: 支持 bff 处理整个服务,包括页面渲染
13
+ - 30614fa: chore: modify package.json entry fields and build config
14
+ chore: 更改 package.json entry 字段以及构建配置
7
15
  - 11c053b: feat: ssr support deploy worker
8
16
 
9
17
  feat: ssr 支持边缘部署
10
18
 
19
+ - 169c58b: feat: support force csr config
20
+ feat: 支持强制 CSR 的配置
21
+ - Updated dependencies [89ca6cc]
22
+ - Updated dependencies [30614fa]
23
+ - Updated dependencies [1b0ce87]
11
24
  - Updated dependencies [11c053b]
12
- - @modern-js/utils@2.4.1-beta.0
25
+ - @modern-js/plugin@2.5.0
26
+ - @modern-js/utils@2.5.0
13
27
 
14
28
  ## 2.4.0
15
29
 
File without changes
File without changes
@@ -35,6 +35,7 @@ const preparebeforeRouteHandler = (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)();
38
+ const repack = (0, import_plugin.createWaterfall)();
38
39
  const beforeDevServer = (0, import_plugin.createParallelWorkflow)();
39
40
  const setupCompiler = (0, import_plugin.createParallelWorkflow)();
40
41
  const afterDevServer = (0, import_plugin.createParallelWorkflow)();
@@ -74,6 +75,7 @@ const serverHooks = {
74
75
  preparebeforeRouteHandler,
75
76
  prepareWebServer,
76
77
  prepareApiServer,
78
+ repack,
77
79
  onApiChange,
78
80
  beforeDevServer,
79
81
  setupCompiler,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -13,6 +13,7 @@ const preparebeforeRouteHandler = createAsyncPipeline();
13
13
  const prepareWebServer = createAsyncPipeline();
14
14
  const prepareApiServer = createAsyncPipeline();
15
15
  const onApiChange = createWaterfall();
16
+ const repack = createWaterfall();
16
17
  const beforeDevServer = createParallelWorkflow();
17
18
  const setupCompiler = createParallelWorkflow();
18
19
  const afterDevServer = createParallelWorkflow();
@@ -52,6 +53,7 @@ const serverHooks = {
52
53
  preparebeforeRouteHandler,
53
54
  prepareWebServer,
54
55
  prepareApiServer,
56
+ repack,
55
57
  onApiChange,
56
58
  beforeDevServer,
57
59
  setupCompiler,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,8 +3,7 @@ import { IncomingMessage, ServerResponse } from 'http';
3
3
  import type { Component } from 'react';
4
4
  import { CommonAPI, ToThreads, AsyncSetup, PluginOptions } from '@modern-js/plugin';
5
5
  import type { ModernServerContext, BaseSSRServerContext, AfterMatchContext, AfterRenderContext, MiddlewareContext, ISAppContext, ServerRoute } from '@modern-js/types';
6
- import type { Options } from 'http-proxy-middleware';
7
- import type { ServerOptions, UserConfig } from './types/config';
6
+ import type { BffUserConfig, ServerOptions, UserConfig } from './types/config';
8
7
  export type WebAdapter = (ctx: MiddlewareContext) => void | Promise<void>;
9
8
  export type Adapter = (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
10
9
  export type WebServerStartInput = {
@@ -18,6 +17,7 @@ export type APIServerStartInput = {
18
17
  config?: {
19
18
  middleware?: Array<any>;
20
19
  };
20
+ render?: (req: IncomingMessage, res: ServerResponse, url?: string) => Promise<string | null>;
21
21
  };
22
22
  type Change = {
23
23
  filename: string;
@@ -60,6 +60,7 @@ declare const serverHooks: {
60
60
  }, BeforeRouteHandler>;
61
61
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
62
62
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
63
+ repack: import("@modern-js/plugin").Waterfall<void>;
63
64
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
64
65
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
65
66
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -122,6 +123,7 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
122
123
  }, BeforeRouteHandler>;
123
124
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
124
125
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
126
+ repack: import("@modern-js/plugin").Waterfall<void>;
125
127
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
126
128
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
127
129
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -179,6 +181,7 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
179
181
  }, BeforeRouteHandler>;
180
182
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
181
183
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
184
+ repack: import("@modern-js/plugin").Waterfall<void>;
182
185
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
183
186
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
184
187
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -227,9 +230,7 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
227
230
 
228
231
  export type ServerPlugin = PluginOptions<ServerHooks, AsyncSetup<ServerHooks, PluginAPI>>;
229
232
  export type ServerConfig = {
230
- bff?: Partial<{
231
- proxy: Record<string, Options>;
232
- }>;
233
+ bff?: BffUserConfig;
233
234
  plugins?: ServerPlugin[];
234
235
  };
235
236
  export declare const createPlugin: (setup?: AsyncSetup<{
@@ -245,6 +246,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
245
246
  }, BeforeRouteHandler>;
246
247
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
247
248
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
249
+ repack: import("@modern-js/plugin").Waterfall<void>;
248
250
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
249
251
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
250
252
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -301,6 +303,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
301
303
  }, BeforeRouteHandler>;
302
304
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
303
305
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
306
+ repack: import("@modern-js/plugin").Waterfall<void>;
304
307
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
305
308
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
306
309
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -353,6 +356,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
353
356
  }, BeforeRouteHandler>;
354
357
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
355
358
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
359
+ repack: import("@modern-js/plugin").Waterfall<void>;
356
360
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
357
361
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
358
362
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -409,6 +413,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
409
413
  }, BeforeRouteHandler>;
410
414
  prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
411
415
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
416
+ repack: import("@modern-js/plugin").Waterfall<void>;
412
417
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
413
418
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
414
419
  setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
@@ -1,5 +1,7 @@
1
+ import type { Options } from 'http-proxy-middleware';
1
2
  export interface BffUserConfig {
2
3
  prefix?: string;
3
- proxy?: Record<string, string>;
4
+ proxy?: Record<string, Options>;
5
+ enableHandleWeb?: boolean;
4
6
  }
5
7
  export type BffNormalizedConfig = BffUserConfig;
@@ -6,6 +6,7 @@ type Route = string | string[] | {
6
6
  };
7
7
  export type Routes = Record<string, Route>;
8
8
  export type SSR = boolean | {
9
+ forceCSR?: boolean;
9
10
  mode?: 'string' | 'stream';
10
11
  };
11
12
  export type SSRByEntries = Record<string, SSR>;
package/package.json CHANGED
@@ -11,26 +11,25 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.4.1-beta.0",
14
+ "version": "2.5.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
- "main": "./dist/js/node/index.js",
18
- "module": "./dist/js/treeshaking/index.js",
19
- "jsnext:modern": "./dist/js/modern/index.js",
17
+ "main": "./dist/cjs/index.js",
18
+ "module": "./dist/esm/index.js",
20
19
  "exports": {
21
20
  ".": {
22
21
  "node": {
23
22
  "jsnext:source": "./src/index.ts",
24
- "import": "./dist/js/modern/index.js",
25
- "require": "./dist/js/node/index.js"
23
+ "import": "./dist/esm/index.js",
24
+ "require": "./dist/cjs/index.js"
26
25
  },
27
26
  "types": "./dist/types/index.d.ts",
28
- "default": "./dist/js/node/index.js"
27
+ "default": "./dist/cjs/index.js"
29
28
  }
30
29
  },
31
30
  "dependencies": {
32
- "@modern-js/plugin": "2.4.0",
33
- "@modern-js/utils": "2.4.1-beta.0"
31
+ "@modern-js/plugin": "2.5.0",
32
+ "@modern-js/utils": "2.5.0"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@types/jest": "^27",
@@ -39,10 +38,10 @@
39
38
  "jest": "^27",
40
39
  "ts-jest": "^27.0.4",
41
40
  "typescript": "^4",
42
- "@modern-js/types": "2.4.0",
43
- "@modern-js/babel-preset-app": "2.4.1-beta.0",
44
- "@scripts/build": "2.4.0",
45
- "@scripts/jest-config": "2.4.0"
41
+ "@modern-js/types": "2.5.0",
42
+ "@modern-js/babel-preset-app": "2.5.0",
43
+ "@scripts/jest-config": "2.5.0",
44
+ "@scripts/build": "2.5.0"
46
45
  },
47
46
  "sideEffects": false,
48
47
  "publishConfig": {