@modern-js/server-core 2.48.5-alpha.0 → 2.48.5-alpha.2
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/base/adapters/node/bff.js +4 -3
- package/dist/cjs/base/index.js +4 -2
- package/dist/cjs/{core/hono.js → base/middlewares/frameworkHeader.js} +17 -2
- package/dist/cjs/base/middlewares/index.js +3 -1
- package/dist/cjs/base/middlewares/renderHandler/render.js +2 -1
- package/dist/cjs/base/serverBase.js +11 -11
- package/dist/cjs/base/utils/index.js +0 -11
- package/dist/cjs/core/plugin.js +0 -39
- package/dist/esm/base/adapters/node/bff.js +4 -4
- package/dist/esm/base/index.js +3 -2
- package/dist/esm/base/middlewares/frameworkHeader.js +27 -0
- package/dist/esm/base/middlewares/index.js +1 -0
- package/dist/esm/base/middlewares/renderHandler/render.js +2 -1
- package/dist/esm/base/serverBase.js +11 -11
- package/dist/esm/base/utils/index.js +0 -6
- package/dist/esm/core/plugin.js +0 -39
- package/dist/esm-node/base/adapters/node/bff.js +4 -3
- package/dist/esm-node/base/index.js +3 -2
- package/dist/esm-node/base/middlewares/frameworkHeader.js +7 -0
- package/dist/esm-node/base/middlewares/index.js +1 -0
- package/dist/esm-node/base/middlewares/renderHandler/render.js +2 -1
- package/dist/esm-node/base/serverBase.js +11 -11
- package/dist/esm-node/base/utils/index.js +0 -6
- package/dist/esm-node/core/plugin.js +0 -39
- package/dist/types/base/adapters/node/bff.d.ts +1 -2
- package/dist/types/base/adapters/node/hono.d.ts +3 -3
- package/dist/types/base/adapters/node/loadServer.d.ts +1 -1
- package/dist/types/base/adapters/node/middlewares/serverManifest.d.ts +2 -2
- package/dist/types/base/adapters/node/middlewares/templates.d.ts +2 -2
- package/dist/types/base/index.d.ts +3 -3
- package/dist/types/base/middlewares/customServer/base.d.ts +2 -2
- package/dist/types/base/middlewares/customServer/context.d.ts +3 -3
- package/dist/types/base/middlewares/frameworkHeader.d.ts +2 -0
- package/dist/types/base/middlewares/index.d.ts +1 -0
- package/dist/types/base/middlewares/monitor.d.ts +5 -5
- package/dist/types/base/middlewares/renderHandler/index.d.ts +1 -2
- package/dist/types/base/middlewares/renderHandler/ssrCache.d.ts +1 -2
- package/dist/types/base/middlewares/renderHandler/ssrRender.d.ts +1 -2
- package/dist/types/base/serverBase.d.ts +22 -4
- package/dist/types/base/utils/index.d.ts +0 -1
- package/dist/types/core/plugin.d.ts +10 -298
- package/dist/types/core/server.d.ts +2 -64
- package/package.json +5 -5
- package/dist/esm/core/hono.js +0 -0
- package/dist/esm-node/core/hono.js +0 -0
- package/dist/types/core/hono.d.ts +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
-
import type { Component } from 'react';
|
|
4
3
|
import { CommonAPI, ToThreads, AsyncSetup, PluginOptions, ToRunners } from '@modern-js/plugin';
|
|
5
|
-
import type { ModernServerContext,
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
4
|
+
import type { ModernServerContext, AfterMatchContext, AfterRenderContext, MiddlewareContext, ISAppContext, HttpMethodDecider, ServerInitHookContext, AfterStreamingRenderContext } from '@modern-js/types';
|
|
5
|
+
import { MiddlewareHandler as Middleware } from 'hono';
|
|
6
|
+
import type { BffUserConfig, UserConfig } from '../types/config';
|
|
8
7
|
import { Render } from './render';
|
|
9
8
|
export type WebAdapter = (ctx: MiddlewareContext) => void | Promise<void>;
|
|
10
9
|
export type NodeRequest = IncomingMessage;
|
|
@@ -57,55 +56,14 @@ declare const serverHooks: {
|
|
|
57
56
|
}, unknown>;
|
|
58
57
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
59
58
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
60
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
61
|
-
serverRoutes: ServerRoute[];
|
|
62
|
-
distDir: string;
|
|
63
|
-
}, LoaderHandler>;
|
|
64
59
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
65
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
60
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
66
61
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
67
62
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
68
63
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
69
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
70
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
71
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
72
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
73
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
74
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
75
|
-
ip: string;
|
|
76
|
-
port: number;
|
|
77
|
-
}, any[]>;
|
|
78
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
79
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
80
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
81
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
82
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
83
|
-
error: Error;
|
|
84
|
-
}, unknown>;
|
|
85
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
86
|
-
ctx: ModernServerContext;
|
|
87
|
-
type: 'query' | 'error' | 'header';
|
|
88
|
-
}, unknown>;
|
|
89
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
90
|
-
context: ModernServerContext;
|
|
91
|
-
}, any>;
|
|
92
64
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
93
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
94
|
-
context: SSRServerContext;
|
|
95
|
-
}, unknown>;
|
|
96
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
97
|
-
App: Component;
|
|
98
|
-
context: RenderContext;
|
|
99
|
-
}, string>;
|
|
100
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
101
|
-
context: ModernServerContext;
|
|
102
|
-
}, any>;
|
|
103
65
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
104
66
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
105
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
106
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
107
|
-
context: ModernServerContext;
|
|
108
|
-
}, unknown>;
|
|
109
67
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
110
68
|
};
|
|
111
69
|
/** All hooks of server plugin. */
|
|
@@ -123,55 +81,14 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
|
|
|
123
81
|
}, unknown>;
|
|
124
82
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
125
83
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
126
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
127
|
-
serverRoutes: ServerRoute[];
|
|
128
|
-
distDir: string;
|
|
129
|
-
}, LoaderHandler>;
|
|
130
84
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
131
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
85
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
132
86
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
133
87
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
134
88
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
135
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
136
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
137
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
138
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
139
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
140
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
141
|
-
ip: string;
|
|
142
|
-
port: number;
|
|
143
|
-
}, any[]>;
|
|
144
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
145
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
146
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
147
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
148
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
149
|
-
error: Error;
|
|
150
|
-
}, unknown>;
|
|
151
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
152
|
-
ctx: ModernServerContext;
|
|
153
|
-
type: 'query' | 'error' | 'header';
|
|
154
|
-
}, unknown>;
|
|
155
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
156
|
-
context: ModernServerContext;
|
|
157
|
-
}, any>;
|
|
158
89
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
159
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
160
|
-
context: SSRServerContext;
|
|
161
|
-
}, unknown>;
|
|
162
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
163
|
-
App: Component;
|
|
164
|
-
context: RenderContext;
|
|
165
|
-
}, string>;
|
|
166
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
167
|
-
context: ModernServerContext;
|
|
168
|
-
}, any>;
|
|
169
90
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
170
91
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
171
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
172
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
173
|
-
context: ModernServerContext;
|
|
174
|
-
}, unknown>;
|
|
175
92
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
176
93
|
}, {
|
|
177
94
|
useAppContext: () => ISAppContext;
|
|
@@ -185,55 +102,14 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
|
|
|
185
102
|
}, unknown>;
|
|
186
103
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
187
104
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
188
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
189
|
-
serverRoutes: ServerRoute[];
|
|
190
|
-
distDir: string;
|
|
191
|
-
}, LoaderHandler>;
|
|
192
105
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
193
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
106
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
194
107
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
195
108
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
196
109
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
197
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
198
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
199
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
200
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
201
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
202
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
203
|
-
ip: string;
|
|
204
|
-
port: number;
|
|
205
|
-
}, any[]>;
|
|
206
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
207
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
208
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
209
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
210
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
211
|
-
error: Error;
|
|
212
|
-
}, unknown>;
|
|
213
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
214
|
-
ctx: ModernServerContext;
|
|
215
|
-
type: 'query' | 'error' | 'header';
|
|
216
|
-
}, unknown>;
|
|
217
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
218
|
-
context: ModernServerContext;
|
|
219
|
-
}, any>;
|
|
220
110
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
221
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
222
|
-
context: SSRServerContext;
|
|
223
|
-
}, unknown>;
|
|
224
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
225
|
-
App: Component;
|
|
226
|
-
context: RenderContext;
|
|
227
|
-
}, string>;
|
|
228
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
229
|
-
context: ModernServerContext;
|
|
230
|
-
}, any>;
|
|
231
111
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
232
112
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
233
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
234
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
235
|
-
context: ModernServerContext;
|
|
236
|
-
}, unknown>;
|
|
237
113
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
238
114
|
}, {
|
|
239
115
|
useAppContext: () => ISAppContext;
|
|
@@ -253,55 +129,14 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
253
129
|
}, unknown>;
|
|
254
130
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
255
131
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
256
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
257
|
-
serverRoutes: ServerRoute[];
|
|
258
|
-
distDir: string;
|
|
259
|
-
}, LoaderHandler>;
|
|
260
132
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
261
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
133
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
262
134
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
263
135
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
264
136
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
265
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
266
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
267
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
268
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
269
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
270
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
271
|
-
ip: string;
|
|
272
|
-
port: number;
|
|
273
|
-
}, any[]>;
|
|
274
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
275
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
276
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
277
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
278
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
279
|
-
error: Error;
|
|
280
|
-
}, unknown>;
|
|
281
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
282
|
-
ctx: ModernServerContext;
|
|
283
|
-
type: 'query' | 'error' | 'header';
|
|
284
|
-
}, unknown>;
|
|
285
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
286
|
-
context: ModernServerContext;
|
|
287
|
-
}, any>;
|
|
288
137
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
289
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
290
|
-
context: SSRServerContext;
|
|
291
|
-
}, unknown>;
|
|
292
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
293
|
-
App: Component;
|
|
294
|
-
context: RenderContext;
|
|
295
|
-
}, string>;
|
|
296
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
297
|
-
context: ModernServerContext;
|
|
298
|
-
}, any>;
|
|
299
138
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
300
139
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
301
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
302
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
303
|
-
context: ModernServerContext;
|
|
304
|
-
}, unknown>;
|
|
305
140
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
306
141
|
}, {
|
|
307
142
|
useAppContext: () => ISAppContext;
|
|
@@ -314,55 +149,14 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
314
149
|
}, unknown>;
|
|
315
150
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
316
151
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
317
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
318
|
-
serverRoutes: ServerRoute[];
|
|
319
|
-
distDir: string;
|
|
320
|
-
}, LoaderHandler>;
|
|
321
152
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
322
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
153
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
323
154
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
324
155
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
325
156
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
326
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
327
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
328
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
329
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
330
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
331
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
332
|
-
ip: string;
|
|
333
|
-
port: number;
|
|
334
|
-
}, any[]>;
|
|
335
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
336
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
337
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
338
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
339
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
340
|
-
error: Error;
|
|
341
|
-
}, unknown>;
|
|
342
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
343
|
-
ctx: ModernServerContext;
|
|
344
|
-
type: 'query' | 'error' | 'header';
|
|
345
|
-
}, unknown>;
|
|
346
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
347
|
-
context: ModernServerContext;
|
|
348
|
-
}, any>;
|
|
349
157
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
350
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
351
|
-
context: SSRServerContext;
|
|
352
|
-
}, unknown>;
|
|
353
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
354
|
-
App: Component;
|
|
355
|
-
context: RenderContext;
|
|
356
|
-
}, string>;
|
|
357
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
358
|
-
context: ModernServerContext;
|
|
359
|
-
}, any>;
|
|
360
158
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
361
159
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
362
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
363
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
364
|
-
context: ModernServerContext;
|
|
365
|
-
}, unknown>;
|
|
366
160
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
367
161
|
}, AsyncSetup<{
|
|
368
162
|
gather: import("@modern-js/plugin").ParallelWorkflow<{
|
|
@@ -371,55 +165,14 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
371
165
|
}, unknown>;
|
|
372
166
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
373
167
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
374
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
375
|
-
serverRoutes: ServerRoute[];
|
|
376
|
-
distDir: string;
|
|
377
|
-
}, LoaderHandler>;
|
|
378
168
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
379
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
169
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
380
170
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
381
171
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
382
172
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
383
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
384
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
385
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
386
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
387
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
388
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
389
|
-
ip: string;
|
|
390
|
-
port: number;
|
|
391
|
-
}, any[]>;
|
|
392
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
393
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
394
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
395
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
396
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
397
|
-
error: Error;
|
|
398
|
-
}, unknown>;
|
|
399
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
400
|
-
ctx: ModernServerContext;
|
|
401
|
-
type: 'query' | 'error' | 'header';
|
|
402
|
-
}, unknown>;
|
|
403
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
404
|
-
context: ModernServerContext;
|
|
405
|
-
}, any>;
|
|
406
173
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
407
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
408
|
-
context: SSRServerContext;
|
|
409
|
-
}, unknown>;
|
|
410
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
411
|
-
App: Component;
|
|
412
|
-
context: RenderContext;
|
|
413
|
-
}, string>;
|
|
414
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
415
|
-
context: ModernServerContext;
|
|
416
|
-
}, any>;
|
|
417
174
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
418
175
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
419
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
420
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
421
|
-
context: ModernServerContext;
|
|
422
|
-
}, unknown>;
|
|
423
176
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
424
177
|
}, {
|
|
425
178
|
useAppContext: () => ISAppContext;
|
|
@@ -432,55 +185,14 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
432
185
|
}, unknown>;
|
|
433
186
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
434
187
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
435
|
-
prepareLoaderHandler: import("@modern-js/plugin").AsyncPipeline<{
|
|
436
|
-
serverRoutes: ServerRoute[];
|
|
437
|
-
distDir: string;
|
|
438
|
-
}, LoaderHandler>;
|
|
439
188
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
440
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
189
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
441
190
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
442
191
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
443
192
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
444
|
-
setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
|
|
445
|
-
beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<Route[], Route[]>;
|
|
446
|
-
afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
|
|
447
|
-
beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
448
|
-
afterProdServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
|
|
449
|
-
listen: import("@modern-js/plugin").ParallelWorkflow<{
|
|
450
|
-
ip: string;
|
|
451
|
-
port: number;
|
|
452
|
-
}, any[]>;
|
|
453
|
-
beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
454
|
-
afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
455
|
-
extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<BaseSSRServerContext>;
|
|
456
|
-
extendContext: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, ModernServerContext>;
|
|
457
|
-
handleError: import("@modern-js/plugin").ParallelWorkflow<{
|
|
458
|
-
error: Error;
|
|
459
|
-
}, unknown>;
|
|
460
|
-
handleSSRFallback: import("@modern-js/plugin").ParallelWorkflow<{
|
|
461
|
-
ctx: ModernServerContext;
|
|
462
|
-
type: 'query' | 'error' | 'header';
|
|
463
|
-
}, unknown>;
|
|
464
|
-
beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
|
|
465
|
-
context: ModernServerContext;
|
|
466
|
-
}, any>;
|
|
467
193
|
afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
|
|
468
|
-
prefetch: import("@modern-js/plugin").ParallelWorkflow<{
|
|
469
|
-
context: SSRServerContext;
|
|
470
|
-
}, unknown>;
|
|
471
|
-
renderToString: import("@modern-js/plugin").AsyncPipeline<{
|
|
472
|
-
App: Component;
|
|
473
|
-
context: RenderContext;
|
|
474
|
-
}, string>;
|
|
475
|
-
beforeRender: import("@modern-js/plugin").AsyncPipeline<{
|
|
476
|
-
context: ModernServerContext;
|
|
477
|
-
}, any>;
|
|
478
194
|
afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
|
|
479
195
|
afterStreamingRender: import("@modern-js/plugin").AsyncPipeline<AfterStreamingRenderContext, string>;
|
|
480
|
-
beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
|
|
481
|
-
afterSend: import("@modern-js/plugin").ParallelWorkflow<{
|
|
482
|
-
context: ModernServerContext;
|
|
483
|
-
}, unknown>;
|
|
484
196
|
reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
|
485
197
|
}, {
|
|
486
198
|
useAppContext: () => ISAppContext;
|
|
@@ -1,72 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import type { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
5
2
|
import type { Readable } from 'node:stream';
|
|
6
|
-
import type { Metrics, Logger,
|
|
7
|
-
import { MiddlewareHandler } from 'hono';
|
|
8
|
-
import { ServerOptions } from '../types/config/index';
|
|
9
|
-
import { ServerHookRunner, ServerPlugin } from './plugin';
|
|
10
|
-
import { HonoEnv } from './hono';
|
|
11
|
-
declare module 'http' {
|
|
12
|
-
interface IncomingMessage {
|
|
13
|
-
logger: Logger;
|
|
14
|
-
metrics: Metrics;
|
|
15
|
-
reporter?: Reporter;
|
|
16
|
-
body?: any;
|
|
17
|
-
}
|
|
18
|
-
interface OutgoingMessage {
|
|
19
|
-
set: (key: string, value: any) => this;
|
|
20
|
-
modernFlushedHeaders?: boolean;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export type ServerBaseOptions = {
|
|
24
|
-
/** server working directory, and then also dist directory */
|
|
25
|
-
pwd: string;
|
|
26
|
-
config: ServerOptions;
|
|
27
|
-
serverConfigFile?: string;
|
|
28
|
-
routes?: ServerRoute[];
|
|
29
|
-
plugins?: ServerPlugin[];
|
|
30
|
-
internalPlugins?: InternalPlugins;
|
|
31
|
-
appContext: {
|
|
32
|
-
appDirectory?: string;
|
|
33
|
-
sharedDirectory?: string;
|
|
34
|
-
apiDirectory?: string;
|
|
35
|
-
lambdaDirectory?: string;
|
|
36
|
-
};
|
|
37
|
-
runMode?: 'apiOnly' | 'ssrOnly' | 'webOnly';
|
|
38
|
-
};
|
|
3
|
+
import type { Metrics, Logger, Reporter, BaseSSRServerContext, ServerRoute, NestedRoute } from '@modern-js/types';
|
|
39
4
|
export type SSRServerContext = BaseSSRServerContext & {
|
|
40
5
|
staticGenerate?: boolean;
|
|
41
6
|
};
|
|
42
7
|
export type ServerRender = (ssrContext: SSRServerContext) => Promise<string | Readable | ReadableStream>;
|
|
43
|
-
export type RenderResult = {
|
|
44
|
-
content: string | Buffer;
|
|
45
|
-
contentType: string;
|
|
46
|
-
contentStream?: Readable;
|
|
47
|
-
statusCode?: number;
|
|
48
|
-
redirect?: boolean;
|
|
49
|
-
};
|
|
50
|
-
export type ConfWithBFF = {
|
|
51
|
-
bff?: {
|
|
52
|
-
prefix: string;
|
|
53
|
-
} & ServerOptions['bff'];
|
|
54
|
-
};
|
|
55
|
-
export type Then<T> = T extends PromiseLike<infer U> ? U : T;
|
|
56
|
-
export type { Metrics, Logger, NextFunction };
|
|
57
|
-
export type HookNames = 'afterMatch' | 'afterRender';
|
|
58
|
-
export interface ModernServerInterface {
|
|
59
|
-
pwd: string;
|
|
60
|
-
distDir: string;
|
|
61
|
-
onInit: (runner: ServerHookRunner, app: Server) => Promise<void>;
|
|
62
|
-
getRequestHandler: () => (req: IncomingMessage, res: ServerResponse, next?: () => void) => void;
|
|
63
|
-
createHTTPServer: (handler: (req: IncomingMessage, res: ServerResponse, next?: () => void) => void) => Promise<Server>;
|
|
64
|
-
render: (req: IncomingMessage, res: ServerResponse, url?: string) => Promise<string | Readable | null>;
|
|
65
|
-
close?: () => Promise<void>;
|
|
66
|
-
}
|
|
67
|
-
export type ServerConstructor = (options: ServerBaseOptions) => ModernServerInterface;
|
|
68
|
-
export type ModernServerHandler = (context: ModernServerContext, next: NextFunction) => Promise<void> | void;
|
|
69
|
-
export type Middleware<Env extends HonoEnv = any> = MiddlewareHandler<Env>;
|
|
70
8
|
export type RequestHandler = (request: Request, ...args: any[]) => Response | Promise<Response>;
|
|
71
9
|
type ServerLoaderBundle = {
|
|
72
10
|
routes: NestedRoute[];
|
|
@@ -103,4 +41,4 @@ type ServerVariables = {
|
|
|
103
41
|
export type ServerEnv = {
|
|
104
42
|
Variables: ServerVariables;
|
|
105
43
|
};
|
|
106
|
-
export type {
|
|
44
|
+
export type { Context, Env, HonoRequest, Next, MiddlewareHandler as Middleware, } from 'hono';
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.48.5-alpha.
|
|
18
|
+
"version": "2.48.5-alpha.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"hono": "^3.12.2",
|
|
70
70
|
"isbot": "3.8.0",
|
|
71
71
|
"merge-deep": "^3.0.3",
|
|
72
|
-
"@modern-js/runtime-utils": "2.48.4",
|
|
73
72
|
"@modern-js/plugin": "2.48.4",
|
|
74
|
-
"@modern-js/utils": "2.48.4"
|
|
73
|
+
"@modern-js/utils": "2.48.4",
|
|
74
|
+
"@modern-js/runtime-utils": "2.48.4"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/jest": "^29",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"jest": "^29",
|
|
82
82
|
"ts-jest": "^29.1.0",
|
|
83
83
|
"typescript": "^5",
|
|
84
|
-
"@scripts/build": "2.48.4",
|
|
85
84
|
"@modern-js/types": "2.48.4",
|
|
86
|
-
"@scripts/jest-config": "2.48.4"
|
|
85
|
+
"@scripts/jest-config": "2.48.4",
|
|
86
|
+
"@scripts/build": "2.48.4"
|
|
87
87
|
},
|
|
88
88
|
"sideEffects": false,
|
|
89
89
|
"publishConfig": {
|
package/dist/esm/core/hono.js
DELETED
|
File without changes
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Context as HonoContext, Env as HonoEnv, HonoRequest, Next, MiddlewareHandler as HonoMiddleware, } from 'hono';
|