@modern-js/server-core 2.48.5-alpha.1 → 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 +3 -3
- package/dist/esm/base/adapters/node/bff.js +3 -3
- package/dist/esm-node/base/adapters/node/bff.js +3 -3
- 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 +2 -2
- 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/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/core/plugin.d.ts +8 -8
- package/dist/types/core/server.d.ts +2 -52
- package/package.json +5 -5
- package/dist/cjs/core/hono.js +0 -16
- 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
|
@@ -25,10 +25,10 @@ var import_utils = require("@modern-js/utils");
|
|
|
25
25
|
var import_middlewares = require("../../../base/middlewares");
|
|
26
26
|
var import_utils2 = require("../../utils");
|
|
27
27
|
const bindBFFHandler = async (server, options) => {
|
|
28
|
-
var _options_config_bff, _options_config;
|
|
28
|
+
var _options_config_bff, _options_config, _options_config1, _options_config_bff1, _options_config2;
|
|
29
29
|
const prefix = (options === null || options === void 0 ? void 0 : (_options_config = options.config) === null || _options_config === void 0 ? void 0 : (_options_config_bff = _options_config.bff) === null || _options_config_bff === void 0 ? void 0 : _options_config_bff.prefix) || "/api";
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const enableHandleWeb = options === null || options === void 0 ? void 0 : (_options_config1 = options.config) === null || _options_config1 === void 0 ? void 0 : _options_config1.bff.enableHandleWeb;
|
|
31
|
+
const httpMethodDecider = options === null || options === void 0 ? void 0 : (_options_config2 = options.config) === null || _options_config2 === void 0 ? void 0 : (_options_config_bff1 = _options_config2.bff) === null || _options_config_bff1 === void 0 ? void 0 : _options_config_bff1.httpMethodDecider;
|
|
32
32
|
const runtimeEnv = (0, import_utils2.getRuntimeEnv)();
|
|
33
33
|
if (runtimeEnv !== "node") {
|
|
34
34
|
return;
|
|
@@ -6,13 +6,13 @@ import { getRenderHandler } from "../../../base/middlewares";
|
|
|
6
6
|
import { createMiddlewareCollecter, getRuntimeEnv } from "../../utils";
|
|
7
7
|
var bindBFFHandler = function() {
|
|
8
8
|
var _ref = _async_to_generator(function(server, options) {
|
|
9
|
-
var _options_config_bff, _options_config, prefix, enableHandleWeb, httpMethodDecider, runtimeEnv, _createMiddlewareCollecter, getMiddlewares, collector, runner, webOnly, handler, renderHandler, _tmp;
|
|
9
|
+
var _options_config_bff, _options_config, _options_config1, _options_config_bff1, _options_config2, prefix, enableHandleWeb, httpMethodDecider, runtimeEnv, _createMiddlewareCollecter, getMiddlewares, collector, runner, webOnly, handler, renderHandler, _tmp;
|
|
10
10
|
return _ts_generator(this, function(_state) {
|
|
11
11
|
switch (_state.label) {
|
|
12
12
|
case 0:
|
|
13
13
|
prefix = (options === null || options === void 0 ? void 0 : (_options_config = options.config) === null || _options_config === void 0 ? void 0 : (_options_config_bff = _options_config.bff) === null || _options_config_bff === void 0 ? void 0 : _options_config_bff.prefix) || "/api";
|
|
14
|
-
enableHandleWeb = options.config.bff.enableHandleWeb;
|
|
15
|
-
httpMethodDecider = options.config.bff.httpMethodDecider;
|
|
14
|
+
enableHandleWeb = options === null || options === void 0 ? void 0 : (_options_config1 = options.config) === null || _options_config1 === void 0 ? void 0 : _options_config1.bff.enableHandleWeb;
|
|
15
|
+
httpMethodDecider = options === null || options === void 0 ? void 0 : (_options_config2 = options.config) === null || _options_config2 === void 0 ? void 0 : (_options_config_bff1 = _options_config2.bff) === null || _options_config_bff1 === void 0 ? void 0 : _options_config_bff1.httpMethodDecider;
|
|
16
16
|
runtimeEnv = getRuntimeEnv();
|
|
17
17
|
if (runtimeEnv !== "node") {
|
|
18
18
|
return [
|
|
@@ -2,10 +2,10 @@ import { isWebOnly } from "@modern-js/utils";
|
|
|
2
2
|
import { getRenderHandler } from "../../../base/middlewares";
|
|
3
3
|
import { createMiddlewareCollecter, getRuntimeEnv } from "../../utils";
|
|
4
4
|
const bindBFFHandler = async (server, options) => {
|
|
5
|
-
var _options_config_bff, _options_config;
|
|
5
|
+
var _options_config_bff, _options_config, _options_config1, _options_config_bff1, _options_config2;
|
|
6
6
|
const prefix = (options === null || options === void 0 ? void 0 : (_options_config = options.config) === null || _options_config === void 0 ? void 0 : (_options_config_bff = _options_config.bff) === null || _options_config_bff === void 0 ? void 0 : _options_config_bff.prefix) || "/api";
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const enableHandleWeb = options === null || options === void 0 ? void 0 : (_options_config1 = options.config) === null || _options_config1 === void 0 ? void 0 : _options_config1.bff.enableHandleWeb;
|
|
8
|
+
const httpMethodDecider = options === null || options === void 0 ? void 0 : (_options_config2 = options.config) === null || _options_config2 === void 0 ? void 0 : (_options_config_bff1 = _options_config2.bff) === null || _options_config_bff1 === void 0 ? void 0 : _options_config_bff1.httpMethodDecider;
|
|
9
9
|
const runtimeEnv = getRuntimeEnv();
|
|
10
10
|
if (runtimeEnv !== "node") {
|
|
11
11
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ServerBaseOptions } from '../../../core/server';
|
|
2
1
|
import { BindRenderHandleOptions } from '../../../base/middlewares';
|
|
3
|
-
import { ServerBase } from '../../serverBase';
|
|
2
|
+
import { ServerBase, type ServerBaseOptions } from '../../serverBase';
|
|
4
3
|
export declare const bindBFFHandler: (server: ServerBase, options: ServerBaseOptions & BindRenderHandleOptions) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeRequest, NodeResponse } from '../../../core/plugin';
|
|
2
|
-
import {
|
|
2
|
+
import { Context, HonoRequest, ServerEnv, Middleware, Next, ServerManifest } from '../../../core/server';
|
|
3
3
|
type NodeBindings = {
|
|
4
4
|
node: {
|
|
5
5
|
req: NodeRequest & {
|
|
@@ -14,9 +14,9 @@ export type ServerNodeEnv = {
|
|
|
14
14
|
Bindings: NodeBindings;
|
|
15
15
|
};
|
|
16
16
|
export type ServerNodeMiddleware = Middleware<ServerNodeEnv>;
|
|
17
|
-
export type ServerNodeContext =
|
|
17
|
+
export type ServerNodeContext = Context<ServerNodeEnv>;
|
|
18
18
|
type Handler = (req: NodeRequest, res: NodeResponse) => void | Promise<void>;
|
|
19
|
-
export declare const httpCallBack2HonoMid: (handler: Handler) => (context:
|
|
19
|
+
export declare const httpCallBack2HonoMid: (handler: Handler) => (context: Context<ServerNodeEnv & ServerEnv>, next: Next) => Promise<void>;
|
|
20
20
|
type ConnectMiddleware = ((req: NodeRequest, res: NodeResponse, callback: (...args: unknown[]) => void) => void) | ((req: NodeRequest, res: NodeResponse) => void);
|
|
21
21
|
export declare const connectMid2HonoMid: (handler: ConnectMiddleware) => Middleware;
|
|
22
22
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServerRoute } from '@modern-js/types';
|
|
2
|
-
import {
|
|
3
|
-
export declare function injectServerManifest(pwd: string, routes?: ServerRoute[]):
|
|
2
|
+
import { Middleware, ServerEnv } from '../../../../core/server';
|
|
3
|
+
export declare function injectServerManifest(pwd: string, routes?: ServerRoute[]): Middleware<ServerEnv>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ServerRoute } from '@modern-js/types';
|
|
2
|
-
import {
|
|
2
|
+
import { Middleware, ServerEnv } from '../../../../core/server';
|
|
3
3
|
export declare function getHtmlTemplates(pwd: string, routes: ServerRoute[]): Promise<Record<string, string>>;
|
|
4
|
-
export declare function injectTemplates(pwd: string, routes?: ServerRoute[]):
|
|
4
|
+
export declare function injectTemplates(pwd: string, routes?: ServerRoute[]): Middleware<ServerEnv>;
|
|
@@ -2,6 +2,6 @@ export { createErrorHtml } from './utils';
|
|
|
2
2
|
export { AGGRED_DIR } from './constants';
|
|
3
3
|
export { favionFallbackMiddleware, injectReporter, injectLogger, getRenderHandler, bindRenderHandler, logHandler, processedBy, } from './middlewares';
|
|
4
4
|
export type { BindRenderHandleOptions } from './middlewares';
|
|
5
|
-
export type { ServerBase } from './serverBase';
|
|
5
|
+
export type { ServerBase, ServerBaseOptions } from './serverBase';
|
|
6
6
|
export { createServerBase } from './serverBase';
|
|
7
|
-
export type {
|
|
7
|
+
export type { Middleware, Context, Next, HonoRequest, ServerEnv, ServerManifest, } from '../core/server';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { HookContext } from '@modern-js/types';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function createBaseHookContext(c:
|
|
2
|
+
import type { Context, ServerEnv } from '../../../core/server';
|
|
3
|
+
export declare function createBaseHookContext(c: Context<ServerEnv>): HookContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterMatchContext, AfterRenderContext, MiddlewareContext, AfterStreamingRenderContext, ServerRoute, HookContext } from '@modern-js/types';
|
|
2
|
-
import {
|
|
2
|
+
import { Context, ServerEnv } from '../../../core/server';
|
|
3
3
|
import type { ServerNodeEnv } from '../../adapters/node/hono';
|
|
4
4
|
export declare function getAfterMatchCtx(entryName: string, baseHookCtx: HookContext): AfterMatchContext;
|
|
5
|
-
export declare function getAfterRenderCtx(c:
|
|
6
|
-
export declare function createCustomMiddlewaresCtx(c:
|
|
5
|
+
export declare function getAfterRenderCtx(c: Context, baseHookCtx: HookContext, route: Partial<ServerRoute>): Promise<AfterRenderContext>;
|
|
6
|
+
export declare function createCustomMiddlewaresCtx(c: Context<ServerNodeEnv & ServerEnv>, locals: Record<string, any>): MiddlewareContext;
|
|
7
7
|
export declare function createAfterStreamingRenderContext(baseHookCtx: HookContext, route: Partial<ServerRoute>): (chunk: string) => AfterStreamingRenderContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger, Metrics } from '@modern-js/types';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function injectReporter(): (c:
|
|
4
|
-
export declare function initReporter(entryName: string): (c:
|
|
5
|
-
export declare function injectLogger(inputLogger: Logger): (c:
|
|
6
|
-
export declare function injectMetrics(inputMetrics: Metrics): (c:
|
|
2
|
+
import type { Context, Next, ServerEnv } from '../../core/server';
|
|
3
|
+
export declare function injectReporter(): (c: Context<ServerEnv>, next: Next) => Promise<void>;
|
|
4
|
+
export declare function initReporter(entryName: string): (c: Context<ServerEnv>, next: Next) => Promise<void>;
|
|
5
|
+
export declare function injectLogger(inputLogger: Logger): (c: Context<ServerEnv>, next: Next) => Promise<void>;
|
|
6
|
+
export declare function injectMetrics(inputMetrics: Metrics): (c: Context<ServerEnv>, next: Next) => Promise<void>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Render } from '../../../core/render';
|
|
2
|
-
import { ServerBaseOptions } from '
|
|
3
|
-
import { ServerBase } from '../../serverBase';
|
|
2
|
+
import { ServerBase, type ServerBaseOptions } from '../../serverBase';
|
|
4
3
|
export type BindRenderHandleOptions = {
|
|
5
4
|
metaName?: string;
|
|
6
5
|
staticGenerate?: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node
|
|
3
|
-
/// <reference types="dist/types/core/server" />
|
|
2
|
+
/// <reference types="node" />
|
|
4
3
|
import type { IncomingMessage } from 'http';
|
|
5
4
|
import { Readable } from 'stream';
|
|
6
5
|
import type { CacheControl, CacheOption, Container } from '@modern-js/types';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="node
|
|
2
|
-
/// <reference types="dist/types/core/server" />
|
|
1
|
+
/// <reference types="node" />
|
|
3
2
|
import type { IncomingMessage } from 'http';
|
|
4
3
|
import type { Logger, Reporter, ServerRoute } from '@modern-js/types';
|
|
5
4
|
import { ServerManifest } from '../../../core/server';
|
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
import { InternalPlugins, ServerRoute } from '@modern-js/types';
|
|
1
2
|
import { Hono } from 'hono';
|
|
2
|
-
import { ServerHookRunner } from '../core';
|
|
3
|
-
import type {
|
|
3
|
+
import { ServerHookRunner, ServerPlugin } from '../core';
|
|
4
|
+
import type { Env } from '../core/server';
|
|
5
|
+
import type { ServerOptions } from '../types/config';
|
|
4
6
|
declare module '@modern-js/types' {
|
|
5
7
|
interface ISAppContext {
|
|
6
8
|
serverBase?: ServerBase;
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
|
-
export
|
|
11
|
+
export type ServerBaseOptions = {
|
|
12
|
+
/** server working directory, and then also dist directory */
|
|
13
|
+
pwd: string;
|
|
14
|
+
config: ServerOptions;
|
|
15
|
+
serverConfigFile?: string;
|
|
16
|
+
routes?: ServerRoute[];
|
|
17
|
+
plugins?: ServerPlugin[];
|
|
18
|
+
internalPlugins?: InternalPlugins;
|
|
19
|
+
appContext: {
|
|
20
|
+
appDirectory?: string;
|
|
21
|
+
sharedDirectory?: string;
|
|
22
|
+
apiDirectory?: string;
|
|
23
|
+
lambdaDirectory?: string;
|
|
24
|
+
};
|
|
25
|
+
runMode?: 'apiOnly' | 'ssrOnly' | 'webOnly';
|
|
26
|
+
};
|
|
27
|
+
export declare class ServerBase<E extends Env = any> {
|
|
10
28
|
options: ServerBaseOptions;
|
|
11
29
|
runner: ServerHookRunner;
|
|
12
30
|
private app;
|
|
@@ -49,4 +67,4 @@ export declare class ServerBase<E extends HonoEnv = any> {
|
|
|
49
67
|
get notFound(): (handler: import("hono").NotFoundHandler<E>) => Hono<E, {}, "/">;
|
|
50
68
|
get onError(): (handler: import("hono").ErrorHandler<E>) => Hono<E, {}, "/">;
|
|
51
69
|
}
|
|
52
|
-
export declare function createServerBase<E extends
|
|
70
|
+
export declare function createServerBase<E extends Env>(options: ServerBaseOptions): ServerBase<E>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
3
|
import { CommonAPI, ToThreads, AsyncSetup, PluginOptions, ToRunners } from '@modern-js/plugin';
|
|
4
4
|
import type { ModernServerContext, AfterMatchContext, AfterRenderContext, MiddlewareContext, ISAppContext, HttpMethodDecider, ServerInitHookContext, AfterStreamingRenderContext } from '@modern-js/types';
|
|
5
|
+
import { MiddlewareHandler as Middleware } from 'hono';
|
|
5
6
|
import type { BffUserConfig, UserConfig } from '../types/config';
|
|
6
|
-
import { HonoMiddleware } from './hono';
|
|
7
7
|
import { Render } from './render';
|
|
8
8
|
export type WebAdapter = (ctx: MiddlewareContext) => void | Promise<void>;
|
|
9
9
|
export type NodeRequest = IncomingMessage;
|
|
@@ -57,7 +57,7 @@ declare const serverHooks: {
|
|
|
57
57
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
58
58
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
59
59
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
60
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
60
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
61
61
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
62
62
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
63
63
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -82,7 +82,7 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
|
|
|
82
82
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
83
83
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
84
84
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
85
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
85
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
86
86
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
87
87
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
88
88
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -103,7 +103,7 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
|
|
|
103
103
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
104
104
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
105
105
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
106
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
106
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
107
107
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
108
108
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
109
109
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -130,7 +130,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
130
130
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
131
131
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
132
132
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
133
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
133
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
134
134
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
135
135
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
136
136
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -150,7 +150,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
150
150
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
151
151
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
152
152
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
153
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
153
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
154
154
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
155
155
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
156
156
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -166,7 +166,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
166
166
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
167
167
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
168
168
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
169
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
169
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
170
170
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
171
171
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
172
172
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -186,7 +186,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
|
|
|
186
186
|
config: import("@modern-js/plugin").Waterfall<ServerConfig>;
|
|
187
187
|
prepare: import("@modern-js/plugin").Waterfall<void>;
|
|
188
188
|
prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter | null>;
|
|
189
|
-
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput,
|
|
189
|
+
prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Middleware>;
|
|
190
190
|
repack: import("@modern-js/plugin").Waterfall<void>;
|
|
191
191
|
onApiChange: import("@modern-js/plugin").AsyncWaterfall<Change[]>;
|
|
192
192
|
beforeServerInit: import("@modern-js/plugin").AsyncWaterfall<ServerInitHookContext>;
|
|
@@ -1,60 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import type { Readable } from 'node:stream';
|
|
4
|
-
import type { Metrics, Logger,
|
|
5
|
-
import { MiddlewareHandler } from 'hono';
|
|
6
|
-
import { ServerOptions } from '../types/config/index';
|
|
7
|
-
import { ServerPlugin } from './plugin';
|
|
8
|
-
import { HonoEnv } from './hono';
|
|
9
|
-
declare module 'http' {
|
|
10
|
-
interface IncomingMessage {
|
|
11
|
-
logger: Logger;
|
|
12
|
-
metrics: Metrics;
|
|
13
|
-
reporter?: Reporter;
|
|
14
|
-
body?: any;
|
|
15
|
-
}
|
|
16
|
-
interface OutgoingMessage {
|
|
17
|
-
set: (key: string, value: any) => this;
|
|
18
|
-
modernFlushedHeaders?: boolean;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export type ServerBaseOptions = {
|
|
22
|
-
/** server working directory, and then also dist directory */
|
|
23
|
-
pwd: string;
|
|
24
|
-
config: ServerOptions;
|
|
25
|
-
serverConfigFile?: string;
|
|
26
|
-
routes?: ServerRoute[];
|
|
27
|
-
plugins?: ServerPlugin[];
|
|
28
|
-
internalPlugins?: InternalPlugins;
|
|
29
|
-
appContext: {
|
|
30
|
-
appDirectory?: string;
|
|
31
|
-
sharedDirectory?: string;
|
|
32
|
-
apiDirectory?: string;
|
|
33
|
-
lambdaDirectory?: string;
|
|
34
|
-
};
|
|
35
|
-
runMode?: 'apiOnly' | 'ssrOnly' | 'webOnly';
|
|
36
|
-
};
|
|
3
|
+
import type { Metrics, Logger, Reporter, BaseSSRServerContext, ServerRoute, NestedRoute } from '@modern-js/types';
|
|
37
4
|
export type SSRServerContext = BaseSSRServerContext & {
|
|
38
5
|
staticGenerate?: boolean;
|
|
39
6
|
};
|
|
40
7
|
export type ServerRender = (ssrContext: SSRServerContext) => Promise<string | Readable | ReadableStream>;
|
|
41
|
-
export type RenderResult = {
|
|
42
|
-
content: string | Buffer;
|
|
43
|
-
contentType: string;
|
|
44
|
-
contentStream?: Readable;
|
|
45
|
-
statusCode?: number;
|
|
46
|
-
redirect?: boolean;
|
|
47
|
-
};
|
|
48
|
-
export type ConfWithBFF = {
|
|
49
|
-
bff?: {
|
|
50
|
-
prefix: string;
|
|
51
|
-
} & ServerOptions['bff'];
|
|
52
|
-
};
|
|
53
|
-
export type Then<T> = T extends PromiseLike<infer U> ? U : T;
|
|
54
|
-
export type { Metrics, Logger, NextFunction };
|
|
55
|
-
export type HookNames = 'afterMatch' | 'afterRender';
|
|
56
|
-
export type ModernServerHandler = (context: ModernServerContext, next: NextFunction) => Promise<void> | void;
|
|
57
|
-
export type Middleware<Env extends HonoEnv = any> = MiddlewareHandler<Env>;
|
|
58
8
|
export type RequestHandler = (request: Request, ...args: any[]) => Response | Promise<Response>;
|
|
59
9
|
type ServerLoaderBundle = {
|
|
60
10
|
routes: NestedRoute[];
|
|
@@ -91,4 +41,4 @@ type ServerVariables = {
|
|
|
91
41
|
export type ServerEnv = {
|
|
92
42
|
Variables: ServerVariables;
|
|
93
43
|
};
|
|
94
|
-
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",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"ts-jest": "^29.1.0",
|
|
83
83
|
"typescript": "^5",
|
|
84
84
|
"@modern-js/types": "2.48.4",
|
|
85
|
-
"@scripts/
|
|
86
|
-
"@scripts/
|
|
85
|
+
"@scripts/jest-config": "2.48.4",
|
|
86
|
+
"@scripts/build": "2.48.4"
|
|
87
87
|
},
|
|
88
88
|
"sideEffects": false,
|
|
89
89
|
"publishConfig": {
|
package/dist/cjs/core/hono.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var hono_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(hono_exports);
|
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';
|