@modern-js/server-core 3.1.0 → 3.1.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/serverBase.js +6 -3
- package/dist/esm/adapters/node/helper/index.mjs +5 -6
- package/dist/esm/adapters/node/index.mjs +4 -5
- package/dist/esm/constants.mjs +1 -1
- package/dist/esm/context.mjs +1 -1
- package/dist/esm/hono.mjs +2 -3
- package/dist/esm/index.mjs +7 -8
- package/dist/esm/plugins/index.mjs +8 -9
- package/dist/esm/plugins/render/render.mjs +4 -13
- package/dist/esm/rslib-runtime.mjs +18 -0
- package/dist/esm/serverBase.mjs +6 -3
- package/dist/esm/utils/error.mjs +1 -1
- package/dist/esm/utils/storage.mjs +2 -2
- package/dist/esm-node/adapters/node/helper/index.mjs +5 -6
- package/dist/esm-node/adapters/node/index.mjs +4 -5
- package/dist/esm-node/constants.mjs +1 -1
- package/dist/esm-node/context.mjs +1 -1
- package/dist/esm-node/hono.mjs +2 -3
- package/dist/esm-node/index.mjs +7 -8
- package/dist/esm-node/plugins/index.mjs +8 -9
- package/dist/esm-node/plugins/render/render.mjs +4 -13
- package/dist/esm-node/rslib-runtime.mjs +19 -0
- package/dist/esm-node/serverBase.mjs +6 -3
- package/dist/esm-node/utils/error.mjs +1 -1
- package/dist/esm-node/utils/storage.mjs +2 -2
- package/dist/types/serverBase.d.ts +2 -1
- package/package.json +7 -7
- /package/{rstest.config.ts → rstest.config.mts} +0 -0
package/dist/cjs/serverBase.js
CHANGED
|
@@ -46,14 +46,14 @@ function _class_private_method_init(obj, privateSet) {
|
|
|
46
46
|
var _applyMiddlewares = /*#__PURE__*/ new WeakSet();
|
|
47
47
|
class ServerBase {
|
|
48
48
|
async init() {
|
|
49
|
-
const { serverConfig, config: cliConfig } = this.
|
|
49
|
+
const { serverConfig, config: cliConfig } = this.serverOptions;
|
|
50
50
|
const mergedConfig = (0, index_js_namespaceObject.loadConfig)({
|
|
51
51
|
cliConfig,
|
|
52
52
|
serverConfig: serverConfig || {}
|
|
53
53
|
});
|
|
54
54
|
const { serverContext } = await server_namespaceObject.server.run({
|
|
55
55
|
plugins: this.plugins,
|
|
56
|
-
options: this.
|
|
56
|
+
options: this.serverOptions,
|
|
57
57
|
config: mergedConfig,
|
|
58
58
|
handleSetupResult: hooks_js_namespaceObject.handleSetupResult
|
|
59
59
|
});
|
|
@@ -78,6 +78,9 @@ class ServerBase {
|
|
|
78
78
|
get get() {
|
|
79
79
|
return this.app.get.bind(this.app);
|
|
80
80
|
}
|
|
81
|
+
get options() {
|
|
82
|
+
return this.app.options.bind(this.app);
|
|
83
|
+
}
|
|
81
84
|
get post() {
|
|
82
85
|
return this.app.post.bind(this.app);
|
|
83
86
|
}
|
|
@@ -106,7 +109,7 @@ class ServerBase {
|
|
|
106
109
|
_class_private_method_init(this, _applyMiddlewares);
|
|
107
110
|
this.plugins = [];
|
|
108
111
|
this.serverContext = null;
|
|
109
|
-
this.
|
|
112
|
+
this.serverOptions = options;
|
|
110
113
|
this.app = new external_hono_namespaceObject.Hono();
|
|
111
114
|
this.app.use('*', external_context_js_namespaceObject.run);
|
|
112
115
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { isResFinalized, loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig };
|
|
1
|
+
export { loadServerEnv } from "./loadEnv.mjs";
|
|
2
|
+
export { loadServerPlugins } from "./loadPlugin.mjs";
|
|
3
|
+
export { loadServerCliConfig, loadServerRuntimeConfig } from "./loadConfig.mjs";
|
|
4
|
+
export { loadCacheConfig } from "./loadCache.mjs";
|
|
5
|
+
export { isResFinalized } from "./utils.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { connectMid2HonoMid, connectMockMid2HonoMid, createNodeServer, createWebRequest, getHtmlTemplates, getServerManifest, httpCallBack2HonoMid, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig, sendResponse, serverStaticPlugin };
|
|
1
|
+
export { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono.mjs";
|
|
2
|
+
export { createNodeServer, createWebRequest, sendResponse } from "./node.mjs";
|
|
3
|
+
export { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins/index.mjs";
|
|
4
|
+
export { loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig } from "./helper/index.mjs";
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -25,4 +25,4 @@ var constants_ServerTimings = /*#__PURE__*/ function(ServerTimings) {
|
|
|
25
25
|
const SERVER_TIMING = 'Server-Timing';
|
|
26
26
|
const X_RENDER_CACHE = 'x-render-cache';
|
|
27
27
|
const X_MODERNJS_RENDER = 'x-modernjs-render';
|
|
28
|
-
export { AGGRED_DIR, REPLACE_REG, SERVER_TIMING, constants_ServerTimings as ServerTimings
|
|
28
|
+
export { AGGRED_DIR, REPLACE_REG, SERVER_TIMING, X_MODERNJS_RENDER, X_RENDER_CACHE, constants_ServerTimings as ServerTimings };
|
package/dist/esm/context.mjs
CHANGED
package/dist/esm/hono.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { deleteCookie, getCookie, languageDetector, setCookie };
|
|
1
|
+
export { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
2
|
+
export { languageDetector } from "hono/language";
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ErrorDigest, createErrorHtml, onError } from "./utils/index.mjs";
|
|
2
|
-
import { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir.mjs";
|
|
3
|
-
import { AGGRED_DIR } from "./constants.mjs";
|
|
4
|
-
import { createServerBase } from "./serverBase.mjs";
|
|
5
|
-
import { run, useHonoContext } from "./context.mjs";
|
|
6
|
-
import { Hono } from "hono";
|
|
7
|
-
import { getLoaderCtx } from "./helper.mjs";
|
|
8
1
|
export * from "./plugins/index.mjs";
|
|
9
2
|
export * from "./types/plugins/index.mjs";
|
|
10
3
|
export * from "./types/render.mjs";
|
|
11
4
|
export * from "./types/config/index.mjs";
|
|
12
5
|
export * from "./types/requestHandler.mjs";
|
|
13
|
-
export {
|
|
6
|
+
export { ErrorDigest, createErrorHtml, onError } from "./utils/index.mjs";
|
|
7
|
+
export { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir.mjs";
|
|
8
|
+
export { AGGRED_DIR } from "./constants.mjs";
|
|
9
|
+
export { createServerBase } from "./serverBase.mjs";
|
|
10
|
+
export { run, useHonoContext } from "./context.mjs";
|
|
11
|
+
export { Hono } from "hono";
|
|
12
|
+
export { getLoaderCtx } from "./helper.mjs";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export { compatPlugin, createDefaultPlugins, faviconPlugin, getRenderHandler, handleSetupResult, injectConfigMiddlewarePlugin, injectRenderHandlerPlugin, injectServerTiming, injectloggerPlugin, logPlugin, processedByPlugin, renderPlugin };
|
|
1
|
+
export { getRenderHandler, injectRenderHandlerPlugin, renderPlugin } from "./render/index.mjs";
|
|
2
|
+
export { faviconPlugin } from "./favicon.mjs";
|
|
3
|
+
export { injectServerTiming, injectloggerPlugin } from "./monitors.mjs";
|
|
4
|
+
export { processedByPlugin } from "./processedBy.mjs";
|
|
5
|
+
export { logPlugin } from "./log.mjs";
|
|
6
|
+
export { createDefaultPlugins } from "./default.mjs";
|
|
7
|
+
export { compatPlugin, handleSetupResult } from "./compat/index.mjs";
|
|
8
|
+
export { injectConfigMiddlewarePlugin } from "./middlewares.mjs";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
|
|
2
1
|
import { cutNameByHyphen } from "@modern-js/utils/universal";
|
|
3
2
|
import { TrieRouter } from "hono/router/trie-router";
|
|
4
3
|
import { X_MODERNJS_RENDER } from "../../constants.mjs";
|
|
@@ -8,21 +7,13 @@ import { dataHandler } from "./dataHandler.mjs";
|
|
|
8
7
|
import { renderRscHandler } from "./renderRscHandler.mjs";
|
|
9
8
|
import { serverActionHandler } from "./serverActionHandler.mjs";
|
|
10
9
|
import { ssrRender } from "./ssrRender.mjs";
|
|
11
|
-
|
|
10
|
+
import { __webpack_require__ } from "../../rslib-runtime.mjs";
|
|
11
|
+
import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
|
|
12
|
+
__webpack_require__.add({
|
|
12
13
|
"@modern-js/runtime-utils/router" (module) {
|
|
13
14
|
module.exports = __rspack_external__modern_js_runtime_utils_router_2aa8d96f;
|
|
14
15
|
}
|
|
15
|
-
};
|
|
16
|
-
var __webpack_module_cache__ = {};
|
|
17
|
-
function __webpack_require__(moduleId) {
|
|
18
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
19
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
20
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
21
|
-
exports: {}
|
|
22
|
-
};
|
|
23
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
24
|
-
return module.exports;
|
|
25
|
-
}
|
|
16
|
+
});
|
|
26
17
|
const DYNAMIC_ROUTE_REG = /\/:./;
|
|
27
18
|
function getRouter(routes) {
|
|
28
19
|
const dynamicRoutes = [];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __webpack_modules__ = {};
|
|
2
|
+
var __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
+
return module.exports;
|
|
11
|
+
}
|
|
12
|
+
__webpack_require__.m = __webpack_modules__;
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.add = function(modules) {
|
|
15
|
+
Object.assign(__webpack_require__.m, modules);
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
export { __webpack_require__ };
|
package/dist/esm/serverBase.mjs
CHANGED
|
@@ -17,14 +17,14 @@ function _class_private_method_init(obj, privateSet) {
|
|
|
17
17
|
var _applyMiddlewares = /*#__PURE__*/ new WeakSet();
|
|
18
18
|
class ServerBase {
|
|
19
19
|
async init() {
|
|
20
|
-
const { serverConfig, config: cliConfig } = this.
|
|
20
|
+
const { serverConfig, config: cliConfig } = this.serverOptions;
|
|
21
21
|
const mergedConfig = loadConfig({
|
|
22
22
|
cliConfig,
|
|
23
23
|
serverConfig: serverConfig || {}
|
|
24
24
|
});
|
|
25
25
|
const { serverContext } = await server_server.run({
|
|
26
26
|
plugins: this.plugins,
|
|
27
|
-
options: this.
|
|
27
|
+
options: this.serverOptions,
|
|
28
28
|
config: mergedConfig,
|
|
29
29
|
handleSetupResult: handleSetupResult
|
|
30
30
|
});
|
|
@@ -49,6 +49,9 @@ class ServerBase {
|
|
|
49
49
|
get get() {
|
|
50
50
|
return this.app.get.bind(this.app);
|
|
51
51
|
}
|
|
52
|
+
get options() {
|
|
53
|
+
return this.app.options.bind(this.app);
|
|
54
|
+
}
|
|
52
55
|
get post() {
|
|
53
56
|
return this.app.post.bind(this.app);
|
|
54
57
|
}
|
|
@@ -77,7 +80,7 @@ class ServerBase {
|
|
|
77
80
|
_class_private_method_init(this, _applyMiddlewares);
|
|
78
81
|
this.plugins = [];
|
|
79
82
|
this.serverContext = null;
|
|
80
|
-
this.
|
|
83
|
+
this.serverOptions = options;
|
|
81
84
|
this.app = new Hono();
|
|
82
85
|
this.app.use('*', run);
|
|
83
86
|
}
|
package/dist/esm/utils/error.mjs
CHANGED
|
@@ -50,4 +50,4 @@ function onError(digest, error, monitors, req) {
|
|
|
50
50
|
else if (req) console.error(`Server Error - ${digest}, error = ${error instanceof Error ? error.stack || error.message : error}, req.url = ${req.url}, req.headers = ${JSON.stringify(headerData)}`);
|
|
51
51
|
else console.error(`Server Error - ${digest}, error = ${error instanceof Error ? error.stack || error.message : error} `);
|
|
52
52
|
}
|
|
53
|
-
export { error_ErrorDigest as ErrorDigest,
|
|
53
|
+
export { createErrorHtml, error_ErrorDigest as ErrorDigest, onError };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as __rspack_external_async_hooks from "async_hooks";
|
|
2
2
|
const createStorage = ()=>{
|
|
3
3
|
let storage;
|
|
4
|
-
if (void 0 !== AsyncLocalStorage) storage = new AsyncLocalStorage();
|
|
4
|
+
if (void 0 !== __rspack_external_async_hooks.AsyncLocalStorage) storage = new __rspack_external_async_hooks.AsyncLocalStorage();
|
|
5
5
|
const run = (context, cb)=>{
|
|
6
6
|
if (!storage) throw new Error(`Unable to use async_hook, please confirm the node version >= 12.17
|
|
7
7
|
`);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { isResFinalized, loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig };
|
|
2
|
+
export { loadServerEnv } from "./loadEnv.mjs";
|
|
3
|
+
export { loadServerPlugins } from "./loadPlugin.mjs";
|
|
4
|
+
export { loadServerCliConfig, loadServerRuntimeConfig } from "./loadConfig.mjs";
|
|
5
|
+
export { loadCacheConfig } from "./loadCache.mjs";
|
|
6
|
+
export { isResFinalized } from "./utils.mjs";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { connectMid2HonoMid, connectMockMid2HonoMid, createNodeServer, createWebRequest, getHtmlTemplates, getServerManifest, httpCallBack2HonoMid, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig, sendResponse, serverStaticPlugin };
|
|
2
|
+
export { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono.mjs";
|
|
3
|
+
export { createNodeServer, createWebRequest, sendResponse } from "./node.mjs";
|
|
4
|
+
export { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins/index.mjs";
|
|
5
|
+
export { loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig } from "./helper/index.mjs";
|
|
@@ -26,4 +26,4 @@ var constants_ServerTimings = /*#__PURE__*/ function(ServerTimings) {
|
|
|
26
26
|
const SERVER_TIMING = 'Server-Timing';
|
|
27
27
|
const X_RENDER_CACHE = 'x-render-cache';
|
|
28
28
|
const X_MODERNJS_RENDER = 'x-modernjs-render';
|
|
29
|
-
export { AGGRED_DIR, REPLACE_REG, SERVER_TIMING, constants_ServerTimings as ServerTimings
|
|
29
|
+
export { AGGRED_DIR, REPLACE_REG, SERVER_TIMING, X_MODERNJS_RENDER, X_RENDER_CACHE, constants_ServerTimings as ServerTimings };
|
package/dist/esm-node/hono.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { deleteCookie, getCookie, languageDetector, setCookie };
|
|
2
|
+
export { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
3
|
+
export { languageDetector } from "hono/language";
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { ErrorDigest, createErrorHtml, onError } from "./utils/index.mjs";
|
|
3
|
-
import { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir.mjs";
|
|
4
|
-
import { AGGRED_DIR } from "./constants.mjs";
|
|
5
|
-
import { createServerBase } from "./serverBase.mjs";
|
|
6
|
-
import { run, useHonoContext } from "./context.mjs";
|
|
7
|
-
import { Hono } from "hono";
|
|
8
|
-
import { getLoaderCtx } from "./helper.mjs";
|
|
9
2
|
export * from "./plugins/index.mjs";
|
|
10
3
|
export * from "./types/plugins/index.mjs";
|
|
11
4
|
export * from "./types/render.mjs";
|
|
12
5
|
export * from "./types/config/index.mjs";
|
|
13
6
|
export * from "./types/requestHandler.mjs";
|
|
14
|
-
export {
|
|
7
|
+
export { ErrorDigest, createErrorHtml, onError } from "./utils/index.mjs";
|
|
8
|
+
export { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir.mjs";
|
|
9
|
+
export { AGGRED_DIR } from "./constants.mjs";
|
|
10
|
+
export { createServerBase } from "./serverBase.mjs";
|
|
11
|
+
export { run, useHonoContext } from "./context.mjs";
|
|
12
|
+
export { Hono } from "hono";
|
|
13
|
+
export { getLoaderCtx } from "./helper.mjs";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { compatPlugin, createDefaultPlugins, faviconPlugin, getRenderHandler, handleSetupResult, injectConfigMiddlewarePlugin, injectRenderHandlerPlugin, injectServerTiming, injectloggerPlugin, logPlugin, processedByPlugin, renderPlugin };
|
|
2
|
+
export { getRenderHandler, injectRenderHandlerPlugin, renderPlugin } from "./render/index.mjs";
|
|
3
|
+
export { faviconPlugin } from "./favicon.mjs";
|
|
4
|
+
export { injectServerTiming, injectloggerPlugin } from "./monitors.mjs";
|
|
5
|
+
export { processedByPlugin } from "./processedBy.mjs";
|
|
6
|
+
export { logPlugin } from "./log.mjs";
|
|
7
|
+
export { createDefaultPlugins } from "./default.mjs";
|
|
8
|
+
export { compatPlugin, handleSetupResult } from "./compat/index.mjs";
|
|
9
|
+
export { injectConfigMiddlewarePlugin } from "./middlewares.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
|
|
3
2
|
import { cutNameByHyphen } from "@modern-js/utils/universal";
|
|
4
3
|
import { TrieRouter } from "hono/router/trie-router";
|
|
5
4
|
import { X_MODERNJS_RENDER } from "../../constants.mjs";
|
|
@@ -9,21 +8,13 @@ import { dataHandler } from "./dataHandler.mjs";
|
|
|
9
8
|
import { renderRscHandler } from "./renderRscHandler.mjs";
|
|
10
9
|
import { serverActionHandler } from "./serverActionHandler.mjs";
|
|
11
10
|
import { ssrRender } from "./ssrRender.mjs";
|
|
12
|
-
|
|
11
|
+
import { __webpack_require__ } from "../../rslib-runtime.mjs";
|
|
12
|
+
import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
|
|
13
|
+
__webpack_require__.add({
|
|
13
14
|
"@modern-js/runtime-utils/router" (module) {
|
|
14
15
|
module.exports = __rspack_external__modern_js_runtime_utils_router_2aa8d96f;
|
|
15
16
|
}
|
|
16
|
-
};
|
|
17
|
-
var __webpack_module_cache__ = {};
|
|
18
|
-
function __webpack_require__(moduleId) {
|
|
19
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
20
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
21
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
22
|
-
exports: {}
|
|
23
|
-
};
|
|
24
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
25
|
-
return module.exports;
|
|
26
|
-
}
|
|
17
|
+
});
|
|
27
18
|
const DYNAMIC_ROUTE_REG = /\/:./;
|
|
28
19
|
function getRouter(routes) {
|
|
29
20
|
const dynamicRoutes = [];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
var __webpack_modules__ = {};
|
|
3
|
+
var __webpack_module_cache__ = {};
|
|
4
|
+
function __webpack_require__(moduleId) {
|
|
5
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
6
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
7
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
11
|
+
return module.exports;
|
|
12
|
+
}
|
|
13
|
+
__webpack_require__.m = __webpack_modules__;
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.add = function(modules) {
|
|
16
|
+
Object.assign(__webpack_require__.m, modules);
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
export { __webpack_require__ };
|
|
@@ -18,14 +18,14 @@ function _class_private_method_init(obj, privateSet) {
|
|
|
18
18
|
var _applyMiddlewares = /*#__PURE__*/ new WeakSet();
|
|
19
19
|
class ServerBase {
|
|
20
20
|
async init() {
|
|
21
|
-
const { serverConfig, config: cliConfig } = this.
|
|
21
|
+
const { serverConfig, config: cliConfig } = this.serverOptions;
|
|
22
22
|
const mergedConfig = loadConfig({
|
|
23
23
|
cliConfig,
|
|
24
24
|
serverConfig: serverConfig || {}
|
|
25
25
|
});
|
|
26
26
|
const { serverContext } = await server_server.run({
|
|
27
27
|
plugins: this.plugins,
|
|
28
|
-
options: this.
|
|
28
|
+
options: this.serverOptions,
|
|
29
29
|
config: mergedConfig,
|
|
30
30
|
handleSetupResult: handleSetupResult
|
|
31
31
|
});
|
|
@@ -50,6 +50,9 @@ class ServerBase {
|
|
|
50
50
|
get get() {
|
|
51
51
|
return this.app.get.bind(this.app);
|
|
52
52
|
}
|
|
53
|
+
get options() {
|
|
54
|
+
return this.app.options.bind(this.app);
|
|
55
|
+
}
|
|
53
56
|
get post() {
|
|
54
57
|
return this.app.post.bind(this.app);
|
|
55
58
|
}
|
|
@@ -78,7 +81,7 @@ class ServerBase {
|
|
|
78
81
|
_class_private_method_init(this, _applyMiddlewares);
|
|
79
82
|
this.plugins = [];
|
|
80
83
|
this.serverContext = null;
|
|
81
|
-
this.
|
|
84
|
+
this.serverOptions = options;
|
|
82
85
|
this.app = new Hono();
|
|
83
86
|
this.app.use('*', run);
|
|
84
87
|
}
|
|
@@ -51,4 +51,4 @@ function onError(digest, error, monitors, req) {
|
|
|
51
51
|
else if (req) console.error(`Server Error - ${digest}, error = ${error instanceof Error ? error.stack || error.message : error}, req.url = ${req.url}, req.headers = ${JSON.stringify(headerData)}`);
|
|
52
52
|
else console.error(`Server Error - ${digest}, error = ${error instanceof Error ? error.stack || error.message : error} `);
|
|
53
53
|
}
|
|
54
|
-
export { error_ErrorDigest as ErrorDigest,
|
|
54
|
+
export { createErrorHtml, error_ErrorDigest as ErrorDigest, onError };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import
|
|
2
|
+
import * as __rspack_external_async_hooks from "async_hooks";
|
|
3
3
|
const createStorage = ()=>{
|
|
4
4
|
let storage;
|
|
5
|
-
if (void 0 !== AsyncLocalStorage) storage = new AsyncLocalStorage();
|
|
5
|
+
if (void 0 !== __rspack_external_async_hooks.AsyncLocalStorage) storage = new __rspack_external_async_hooks.AsyncLocalStorage();
|
|
6
6
|
const run = (context, cb)=>{
|
|
7
7
|
if (!storage) throw new Error(`Unable to use async_hook, please confirm the node version >= 12.17
|
|
8
8
|
`);
|
|
@@ -9,7 +9,7 @@ export interface ServerBaseOptions extends ServerCreateOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class ServerBase<E extends Env = any> {
|
|
11
11
|
#private;
|
|
12
|
-
|
|
12
|
+
serverOptions: ServerBaseOptions;
|
|
13
13
|
private app;
|
|
14
14
|
private plugins;
|
|
15
15
|
private serverContext;
|
|
@@ -25,6 +25,7 @@ export declare class ServerBase<E extends Env = any> {
|
|
|
25
25
|
get all(): import("hono/types").HandlerInterface<E, "all", import("hono/types").BlankSchema, "/", "/">;
|
|
26
26
|
get use(): import("hono/types").MiddlewareHandlerInterface<E, import("hono/types").BlankSchema, "/">;
|
|
27
27
|
get get(): import("hono/types").HandlerInterface<E, "get", import("hono/types").BlankSchema, "/", "/">;
|
|
28
|
+
get options(): import("hono/types").HandlerInterface<E, "options", import("hono/types").BlankSchema, "/", "/">;
|
|
28
29
|
get post(): import("hono/types").HandlerInterface<E, "post", import("hono/types").BlankSchema, "/", "/">;
|
|
29
30
|
get put(): import("hono/types").HandlerInterface<E, "put", import("hono/types").BlankSchema, "/", "/">;
|
|
30
31
|
get delete(): import("hono/types").HandlerInterface<E, "delete", import("hono/types").BlankSchema, "/", "/">;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.1.
|
|
18
|
+
"version": "3.1.2",
|
|
19
19
|
"types": "./dist/types/index.d.ts",
|
|
20
20
|
"main": "./dist/cjs/index.js",
|
|
21
21
|
"exports": {
|
|
@@ -68,22 +68,22 @@
|
|
|
68
68
|
"@web-std/file": "^3.0.3",
|
|
69
69
|
"@web-std/stream": "^1.0.3",
|
|
70
70
|
"cloneable-readable": "^3.0.0",
|
|
71
|
-
"flatted": "^3.4.
|
|
71
|
+
"flatted": "^3.4.2",
|
|
72
72
|
"hono": "^4.11.7",
|
|
73
73
|
"ts-deepmerge": "7.0.3",
|
|
74
|
-
"@modern-js/plugin": "3.1.
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/utils": "3.1.
|
|
74
|
+
"@modern-js/plugin": "3.1.2",
|
|
75
|
+
"@modern-js/utils": "3.1.2",
|
|
76
|
+
"@modern-js/runtime-utils": "3.1.2"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@rslib/core": "0.
|
|
79
|
+
"@rslib/core": "0.20.3",
|
|
80
80
|
"@types/cloneable-readable": "^2.0.3",
|
|
81
81
|
"@types/merge-deep": "^3.0.3",
|
|
82
82
|
"@types/node": "^20",
|
|
83
83
|
"http-proxy-middleware": "^2.0.9",
|
|
84
84
|
"typescript": "^5",
|
|
85
|
+
"@modern-js/types": "3.1.2",
|
|
85
86
|
"@modern-js/rslib": "2.68.10",
|
|
86
|
-
"@modern-js/types": "3.1.0",
|
|
87
87
|
"@scripts/rstest-config": "2.66.0"
|
|
88
88
|
},
|
|
89
89
|
"sideEffects": false,
|
|
File without changes
|