@modern-js/server-core 2.0.0-beta.7 → 2.0.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/CHANGELOG.md +22 -0
- package/dist/types/plugin.d.ts +15 -15
- package/dist/types/types/config/bff.d.ts +1 -1
- package/dist/types/types/config/html.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +2 -2
- package/dist/types/types/config/output.d.ts +1 -1
- package/dist/types/types/config/server.d.ts +6 -6
- package/dist/types/types/config/share.d.ts +2 -2
- package/dist/types/types/config/source.d.ts +5 -5
- package/dist/types/types/config/tools.d.ts +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @modern-js/server-plugin
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @modern-js/plugin@2.0.1
|
|
8
|
+
- @modern-js/utils@2.0.1
|
|
9
|
+
|
|
10
|
+
## 2.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- dda38c9c3e: chore: v2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [edd1cfb1af]
|
|
19
|
+
- Updated dependencies [dda38c9c3e]
|
|
20
|
+
- Updated dependencies [ffb2ed4]
|
|
21
|
+
- Updated dependencies [bbe4c4ab64]
|
|
22
|
+
- @modern-js/utils@2.0.0
|
|
23
|
+
- @modern-js/plugin@2.0.0
|
|
24
|
+
|
|
3
25
|
## 2.0.0-beta.7
|
|
4
26
|
|
|
5
27
|
### Major Changes
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -5,30 +5,30 @@ import { CommonAPI, ToThreads, AsyncSetup, PluginOptions } from '@modern-js/plug
|
|
|
5
5
|
import type { ModernServerContext, BaseSSRServerContext, AfterMatchContext, AfterRenderContext, MiddlewareContext, ISAppContext, ServerRoute } from '@modern-js/types';
|
|
6
6
|
import type { Options } from 'http-proxy-middleware';
|
|
7
7
|
import type { ServerOptions, UserConfig } from './types/config';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
export type WebAdapter = (ctx: MiddlewareContext) => void | Promise<void>;
|
|
9
|
+
export type Adapter = (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
10
|
+
export type WebServerStartInput = {
|
|
11
11
|
pwd: string;
|
|
12
12
|
config: Record<string, any>;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type BeforeRouteHandler = (context: ModernServerContext) => Promise<void>;
|
|
15
|
+
export type APIServerStartInput = {
|
|
16
16
|
pwd: string;
|
|
17
17
|
prefix?: string;
|
|
18
18
|
config?: {
|
|
19
19
|
middleware?: Array<any>;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
type Change = {
|
|
23
23
|
filename: string;
|
|
24
24
|
event: 'add' | 'change' | 'unlink';
|
|
25
25
|
};
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type Route = Record<string, unknown>;
|
|
27
|
+
export type RequestResult = {
|
|
28
28
|
isfinish: boolean;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
31
|
-
export
|
|
30
|
+
export type SSRServerContext = Record<string, unknown>;
|
|
31
|
+
export type RenderContext = Record<string, unknown>;
|
|
32
32
|
export declare const AppContext: import("@modern-js/plugin").Context<ISAppContext>;
|
|
33
33
|
export declare const setAppContext: (value: ISAppContext) => void;
|
|
34
34
|
export declare const ConfigContext: import("@modern-js/plugin").Context<UserConfig>;
|
|
@@ -102,13 +102,13 @@ declare const serverHooks: {
|
|
|
102
102
|
};
|
|
103
103
|
/** All hooks of server plugin. */
|
|
104
104
|
|
|
105
|
-
export
|
|
105
|
+
export type ServerHooks = typeof serverHooks;
|
|
106
106
|
/** All hook callbacks of server plugin. */
|
|
107
107
|
|
|
108
|
-
export
|
|
108
|
+
export type ServerHookCallbacks = ToThreads<ServerHooks>;
|
|
109
109
|
/** All apis for server plugin. */
|
|
110
110
|
|
|
111
|
-
export
|
|
111
|
+
export type PluginAPI = typeof pluginAPI & CommonAPI<ServerHooks>;
|
|
112
112
|
export declare const createServerManager: () => import("@modern-js/plugin").AsyncManager<{
|
|
113
113
|
gather: import("@modern-js/plugin").ParallelWorkflow<{
|
|
114
114
|
addWebMiddleware: (_input: any) => void;
|
|
@@ -225,8 +225,8 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
|
|
|
225
225
|
}>;
|
|
226
226
|
/** Plugin options of a server plugin. */
|
|
227
227
|
|
|
228
|
-
export
|
|
229
|
-
export
|
|
228
|
+
export type ServerPlugin = PluginOptions<ServerHooks, AsyncSetup<ServerHooks, PluginAPI>>;
|
|
229
|
+
export type ServerConfig = {
|
|
230
230
|
bff?: Partial<{
|
|
231
231
|
proxy: Record<string, Options>;
|
|
232
232
|
}>;
|
|
@@ -13,7 +13,7 @@ export * from './tools';
|
|
|
13
13
|
interface RuntimeUserConfig {
|
|
14
14
|
[property: string]: any;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type RuntimeNormalizedConfig = RuntimeUserConfig;
|
|
17
17
|
export interface UserConfig {
|
|
18
18
|
output?: OutputUserConfig;
|
|
19
19
|
source?: SourceUserConfig;
|
|
@@ -23,7 +23,7 @@ export interface UserConfig {
|
|
|
23
23
|
html?: HtmlUserConfig;
|
|
24
24
|
bff?: BffUserConfig;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type ServerOptions = {
|
|
27
27
|
output: OutputNormalizedConfig;
|
|
28
28
|
source: SourceNormalizedConfig;
|
|
29
29
|
tools: ToolsNormalizedConfig;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { WatchOptions } from '@modern-js/utils';
|
|
2
|
-
|
|
2
|
+
type Route = string | string[] | {
|
|
3
3
|
route?: string | string[];
|
|
4
4
|
disableSpa?: boolean;
|
|
5
5
|
resHeaders?: Record<string, unknown>;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type Routes = Record<string, Route>;
|
|
8
|
+
export type SSR = boolean | {
|
|
9
9
|
mode?: 'string' | 'stream';
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type SSRByEntries = Record<string, SSR>;
|
|
12
12
|
export interface ServerUserConfig {
|
|
13
13
|
routes?: Routes;
|
|
14
14
|
publicRoutes?: Record<string, string>;
|
|
@@ -21,7 +21,7 @@ export interface ServerUserConfig {
|
|
|
21
21
|
enableMicroFrontendDebug?: boolean;
|
|
22
22
|
watchOptions?: WatchOptions;
|
|
23
23
|
compiler?: 'babel' | 'typescript';
|
|
24
|
-
|
|
24
|
+
enableFrameworkExt?: boolean;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type ServerNormalizedConfig = ServerUserConfig;
|
|
27
27
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
type ArrayOrNot<T> = T | T[];
|
|
2
|
+
export type ChainedConfig<Config, Utils = unknown> = ArrayOrNot<Config | (keyof Utils extends never ? (config: Config) => Config | void : (config: Config, utils: Utils) => Config | void)>;
|
|
3
3
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Alias } from '@modern-js/utils';
|
|
2
2
|
import type { ChainedConfig } from './share';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type JSONPrimitive = string | number | boolean | null;
|
|
4
|
+
type JSONArray = Array<JSONValue>;
|
|
5
|
+
type JSONObject = {
|
|
6
6
|
[key: string]: JSONValue;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
9
9
|
export interface SourceUserConfig {
|
|
10
10
|
alias?: ChainedConfig<Alias>;
|
|
11
11
|
define?: Record<string, any>;
|
|
12
12
|
globalVars?: Record<string, JSONValue>;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type SourceNormalizedConfig = SourceUserConfig;
|
|
15
15
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BabelConfigUtils } from '@modern-js/babel-preset-app';
|
|
2
2
|
import { BabelTransformOptions } from '@modern-js/types/common';
|
|
3
3
|
import { ChainedConfig } from './share';
|
|
4
|
-
|
|
4
|
+
type ToolsBabelConfig = ChainedConfig<BabelTransformOptions, BabelConfigUtils>;
|
|
5
5
|
export interface ToolsUserConfig {
|
|
6
6
|
babel?: ToolsBabelConfig;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type ToolsNormalizedConfig = ToolsUserConfig;
|
|
9
9
|
export {};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.
|
|
14
|
+
"version": "2.0.1",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@modern-js/plugin": "2.0.
|
|
33
|
-
"@modern-js/utils": "2.0.
|
|
32
|
+
"@modern-js/plugin": "2.0.1",
|
|
33
|
+
"@modern-js/utils": "2.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jest": "^27",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"jest": "^27",
|
|
40
40
|
"ts-jest": "^27.0.4",
|
|
41
41
|
"typescript": "^4",
|
|
42
|
-
"@modern-js/types": "2.0.
|
|
43
|
-
"@modern-js/babel-preset-app": "2.0.
|
|
44
|
-
"@scripts/
|
|
45
|
-
"@scripts/
|
|
42
|
+
"@modern-js/types": "2.0.1",
|
|
43
|
+
"@modern-js/babel-preset-app": "2.0.1",
|
|
44
|
+
"@scripts/build": "2.0.1",
|
|
45
|
+
"@scripts/jest-config": "2.0.1"
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"publishConfig": {
|