@modern-js/server-core 2.56.1 → 2.57.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/dist/cjs/adapters/node/helper/loadConfig.js +2 -2
- package/dist/cjs/adapters/node/plugins/resource.js +4 -1
- package/dist/cjs/{plugins/customServer/loader.js → helper.js} +6 -5
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/plugins/customServer/base.js +3 -0
- package/dist/cjs/plugins/customServer/index.js +2 -5
- package/dist/cjs/plugins/default.js +42 -0
- package/dist/cjs/plugins/index.js +6 -6
- package/dist/cjs/plugins/monitors.js +4 -3
- package/dist/cjs/plugins/render/index.js +10 -34
- package/dist/cjs/plugins/render/inject.js +75 -0
- package/dist/cjs/plugins/render/render.js +23 -2
- package/dist/esm/adapters/node/helper/loadConfig.js +2 -2
- package/dist/esm/adapters/node/plugins/resource.js +13 -3
- package/dist/esm/{plugins/customServer/loader.js → helper.js} +3 -2
- package/dist/esm/index.js +2 -0
- package/dist/esm/plugins/customServer/base.js +3 -0
- package/dist/esm/plugins/customServer/index.js +1 -3
- package/dist/esm/plugins/default.js +19 -0
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/plugins/monitors.js +3 -3
- package/dist/esm/plugins/render/index.js +27 -70
- package/dist/esm/plugins/render/inject.js +85 -0
- package/dist/esm/plugins/render/render.js +23 -2
- package/dist/esm-node/adapters/node/helper/loadConfig.js +2 -2
- package/dist/esm-node/adapters/node/plugins/resource.js +5 -2
- package/dist/esm-node/{plugins/customServer/loader.js → helper.js} +3 -2
- package/dist/esm-node/index.js +2 -0
- package/dist/esm-node/plugins/customServer/base.js +3 -0
- package/dist/esm-node/plugins/customServer/index.js +1 -3
- package/dist/esm-node/plugins/default.js +18 -0
- package/dist/esm-node/plugins/index.js +5 -5
- package/dist/esm-node/plugins/monitors.js +4 -3
- package/dist/esm-node/plugins/render/index.js +7 -32
- package/dist/esm-node/plugins/render/inject.js +50 -0
- package/dist/esm-node/plugins/render/render.js +23 -2
- package/dist/types/{plugins/customServer/loader.d.ts → helper.d.ts} +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugins/customServer/index.d.ts +0 -1
- package/dist/types/plugins/default.d.ts +7 -0
- package/dist/types/plugins/index.d.ts +3 -3
- package/dist/types/plugins/monitors.d.ts +2 -2
- package/dist/types/plugins/render/index.d.ts +3 -16
- package/dist/types/plugins/render/inject.d.ts +7 -0
- package/dist/types/types/config/output.d.ts +0 -1
- package/dist/types/types/config/server.d.ts +4 -0
- package/dist/types/types/plugin.d.ts +10 -0
- package/dist/types/types/server.d.ts +1 -0
- package/package.json +7 -7
|
@@ -2,7 +2,6 @@ import { ServerRoute, UnstableMiddleware } from '@modern-js/types';
|
|
|
2
2
|
import { ServerBase } from '../../serverBase';
|
|
3
3
|
import { ServerHookRunner, Middleware, ServerEnv } from '../../types';
|
|
4
4
|
import type { ServerNodeEnv } from '../../adapters/node/hono';
|
|
5
|
-
export { getLoaderCtx } from './loader';
|
|
6
5
|
export declare class CustomServer {
|
|
7
6
|
private runner;
|
|
8
7
|
private serverMiddlewarePromise;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Logger } from '@modern-js/types';
|
|
2
|
+
import type { ServerPlugin } from '../types';
|
|
3
|
+
import { InjectRenderHandlerOptions } from './render';
|
|
4
|
+
export type CreateDefaultPluginsOptions = InjectRenderHandlerOptions & {
|
|
5
|
+
logger?: Logger;
|
|
6
|
+
};
|
|
7
|
+
export declare function createDefaultPlugins(options?: CreateDefaultPluginsOptions): ServerPlugin[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { renderPlugin,
|
|
1
|
+
export { renderPlugin, injectRenderHandlerPlugin, type InjectRenderHandlerOptions, getRenderHandler, } from './render';
|
|
2
2
|
export { faviconPlugin } from './favicon';
|
|
3
|
+
export { injectServerTiming, injectloggerPluigin } from './monitors';
|
|
3
4
|
export { processedByPlugin } from './processedBy';
|
|
4
|
-
export { getLoaderCtx } from './customServer';
|
|
5
5
|
export { logPlugin } from './log';
|
|
6
|
-
export {
|
|
6
|
+
export { createDefaultPlugins, type CreateDefaultPluginsOptions, } from './default';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from '@modern-js/types';
|
|
2
2
|
import type { Context, Next, ServerEnv, ServerPlugin } from '../types';
|
|
3
3
|
export declare const initMonitorsPlugin: () => ServerPlugin;
|
|
4
|
-
export declare const injectloggerPluigin: (
|
|
5
|
-
export declare const injectServerTiming: (
|
|
4
|
+
export declare const injectloggerPluigin: (inputLogger?: Logger) => ServerPlugin;
|
|
5
|
+
export declare const injectServerTiming: () => ServerPlugin;
|
|
6
6
|
export declare function initReporter(entryName: string): (c: Context<ServerEnv>, next: Next) => Promise<void>;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
staticGenerate?: boolean;
|
|
5
|
-
cacheConfig?: CacheConfig;
|
|
6
|
-
}
|
|
7
|
-
export declare const renderPlugin: (options?: RenderPluginOptions) => ServerPlugin;
|
|
8
|
-
export interface GetRenderHandlerOptions {
|
|
9
|
-
pwd: string;
|
|
10
|
-
routes: ServerRoute[];
|
|
11
|
-
config: UserConfig;
|
|
12
|
-
cacheConfig?: CacheConfig;
|
|
13
|
-
staticGenerate?: boolean;
|
|
14
|
-
metaName?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, }: GetRenderHandlerOptions): Promise<Render>;
|
|
1
|
+
import { ServerPlugin } from '../../types';
|
|
2
|
+
export * from './inject';
|
|
3
|
+
export declare const renderPlugin: () => ServerPlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CacheConfig, GetRenderHandlerOptions, Render, ServerPlugin } from '../../types';
|
|
2
|
+
export interface InjectRenderHandlerOptions {
|
|
3
|
+
staticGenerate?: boolean;
|
|
4
|
+
cacheConfig?: CacheConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare const injectRenderHandlerPlugin: ({ staticGenerate, cacheConfig, }: InjectRenderHandlerOptions) => ServerPlugin;
|
|
7
|
+
export declare function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, }: GetRenderHandlerOptions): Promise<Render>;
|
|
@@ -41,6 +41,10 @@ export type SSR = boolean | {
|
|
|
41
41
|
export type SSRByEntries = Record<string, SSR>;
|
|
42
42
|
export interface ServerUserConfig {
|
|
43
43
|
routes?: Routes;
|
|
44
|
+
/**
|
|
45
|
+
* Experimenal, it is not recommended to use it now
|
|
46
|
+
*/
|
|
47
|
+
ssrByRouteIds?: string[];
|
|
44
48
|
publicRoutes?: Record<string, string>;
|
|
45
49
|
ssr?: SSR;
|
|
46
50
|
ssrByEntries?: SSRByEntries;
|
|
@@ -96,10 +96,20 @@ type Middleware = {
|
|
|
96
96
|
before?: Array<Middleware['name']>;
|
|
97
97
|
order?: MiddlewareOrder;
|
|
98
98
|
};
|
|
99
|
+
export interface GetRenderHandlerOptions {
|
|
100
|
+
pwd: string;
|
|
101
|
+
routes: ServerRoute[];
|
|
102
|
+
config: UserConfig;
|
|
103
|
+
cacheConfig?: CacheConfig;
|
|
104
|
+
staticGenerate?: boolean;
|
|
105
|
+
metaName?: string;
|
|
106
|
+
}
|
|
99
107
|
declare module '@modern-js/types' {
|
|
100
108
|
interface ISAppContext {
|
|
101
109
|
middlewares: Middleware[];
|
|
102
110
|
metaName: string;
|
|
111
|
+
getRenderOptions?: GetRenderHandlerOptions;
|
|
112
|
+
render?: Render;
|
|
103
113
|
routes?: ServerRoute[];
|
|
104
114
|
nodeServer?: NodeServer;
|
|
105
115
|
}
|
|
@@ -28,6 +28,7 @@ export type ServerManifest = {
|
|
|
28
28
|
renderBundles?: Record<string, ServerRenderBundle>;
|
|
29
29
|
loadableStats?: Record<string, any>;
|
|
30
30
|
routeManifest?: Record<string, any>;
|
|
31
|
+
nestedRoutesJson?: Record<string, any>;
|
|
31
32
|
};
|
|
32
33
|
type ServerVariables = {
|
|
33
34
|
/** @deprecated */
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.57.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@web-std/file": "^3.0.3",
|
|
53
53
|
"hono": "^3.12.2",
|
|
54
54
|
"ts-deepmerge": "7.0.0",
|
|
55
|
-
"@modern-js/plugin": "2.
|
|
56
|
-
"@modern-js/runtime-utils": "2.
|
|
57
|
-
"@modern-js/utils": "2.
|
|
55
|
+
"@modern-js/plugin": "2.57.0",
|
|
56
|
+
"@modern-js/runtime-utils": "2.57.0",
|
|
57
|
+
"@modern-js/utils": "2.57.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/jest": "^29",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"jest": "^29",
|
|
65
65
|
"ts-jest": "^29.1.0",
|
|
66
66
|
"typescript": "^5",
|
|
67
|
-
"@modern-js/types": "2.
|
|
68
|
-
"@scripts/
|
|
69
|
-
"@scripts/
|
|
67
|
+
"@modern-js/types": "2.57.0",
|
|
68
|
+
"@scripts/build": "2.57.0",
|
|
69
|
+
"@scripts/jest-config": "2.57.0"
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"publishConfig": {
|