@modern-js/server-core 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import { loadServerEnv } from "./loadEnv.mjs";
2
- import { loadServerPlugins } from "./loadPlugin.mjs";
3
- import { loadServerCliConfig, loadServerRuntimeConfig } from "./loadConfig.mjs";
4
- import { loadCacheConfig } from "./loadCache.mjs";
5
- import { isResFinalized } from "./utils.mjs";
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
- import { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono.mjs";
2
- import { createNodeServer, createWebRequest, sendResponse } from "./node.mjs";
3
- import { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins/index.mjs";
4
- import { loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig } from "./helper/index.mjs";
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";
@@ -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, X_MODERNJS_RENDER, X_RENDER_CACHE };
28
+ export { AGGRED_DIR, REPLACE_REG, SERVER_TIMING, X_MODERNJS_RENDER, X_RENDER_CACHE, constants_ServerTimings as ServerTimings };
@@ -1,3 +1,3 @@
1
1
  import { createStorage } from "./utils/storage.mjs";
2
- const { run, useHonoContext } = createStorage();
2
+ const { run: run, useHonoContext: useHonoContext } = createStorage();
3
3
  export { run, useHonoContext };
package/dist/esm/hono.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { deleteCookie, getCookie, setCookie } from "hono/cookie";
2
- import { languageDetector } from "hono/language";
3
- export { deleteCookie, getCookie, languageDetector, setCookie };
1
+ export { deleteCookie, getCookie, setCookie } from "hono/cookie";
2
+ export { languageDetector } from "hono/language";
@@ -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 { AGGRED_DIR, ErrorDigest, Hono, createErrorHtml, createServerBase, getLoaderCtx, getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, onError, resolvePublicDirPaths, run, useHonoContext };
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
- import { getRenderHandler, injectRenderHandlerPlugin, renderPlugin } from "./render/index.mjs";
2
- import { faviconPlugin } from "./favicon.mjs";
3
- import { injectServerTiming, injectloggerPlugin } from "./monitors.mjs";
4
- import { processedByPlugin } from "./processedBy.mjs";
5
- import { logPlugin } from "./log.mjs";
6
- import { createDefaultPlugins } from "./default.mjs";
7
- import { compatPlugin, handleSetupResult } from "./compat/index.mjs";
8
- import { injectConfigMiddlewarePlugin } from "./middlewares.mjs";
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,7 +1,7 @@
1
+ export * from "./inject.mjs";
1
2
  import { getLoaderCtx } from "../../helper.mjs";
2
3
  import { sortRoutes } from "../../utils/index.mjs";
3
4
  import { requestLatencyMiddleware } from "../monitors.mjs";
4
- export * from "./inject.mjs";
5
5
  const DYNAMIC_ROUTE_REG = /\/:./;
6
6
  function escapeRegexSpecialChars(path) {
7
7
  return path.replace(/[()[\]{}*+?.^$|\\]/g, '\\$&');
@@ -1,4 +1,5 @@
1
1
  import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
2
+ import { __webpack_require__ } from "../../rslib-runtime.mjs";
2
3
  import { cutNameByHyphen } from "@modern-js/utils/universal";
3
4
  import { TrieRouter } from "hono/router/trie-router";
4
5
  import { X_MODERNJS_RENDER } from "../../constants.mjs";
@@ -8,21 +9,11 @@ import { dataHandler } from "./dataHandler.mjs";
8
9
  import { renderRscHandler } from "./renderRscHandler.mjs";
9
10
  import { serverActionHandler } from "./serverActionHandler.mjs";
10
11
  import { ssrRender } from "./ssrRender.mjs";
11
- var __webpack_modules__ = {
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__ };
@@ -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, createErrorHtml, onError };
53
+ export { createErrorHtml, error_ErrorDigest as ErrorDigest, onError };
@@ -1,7 +1,6 @@
1
1
  import "node:module";
2
- import { loadServerEnv } from "./loadEnv.mjs";
3
- import { loadServerPlugins } from "./loadPlugin.mjs";
4
- import { loadServerCliConfig, loadServerRuntimeConfig } from "./loadConfig.mjs";
5
- import { loadCacheConfig } from "./loadCache.mjs";
6
- import { isResFinalized } from "./utils.mjs";
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
- import { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono.mjs";
3
- import { createNodeServer, createWebRequest, sendResponse } from "./node.mjs";
4
- import { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins/index.mjs";
5
- import { loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig } from "./helper/index.mjs";
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, X_MODERNJS_RENDER, X_RENDER_CACHE };
29
+ export { AGGRED_DIR, REPLACE_REG, SERVER_TIMING, X_MODERNJS_RENDER, X_RENDER_CACHE, constants_ServerTimings as ServerTimings };
@@ -1,4 +1,4 @@
1
1
  import "node:module";
2
2
  import { createStorage } from "./utils/storage.mjs";
3
- const { run, useHonoContext } = createStorage();
3
+ const { run: run, useHonoContext: useHonoContext } = createStorage();
4
4
  export { run, useHonoContext };
@@ -1,4 +1,3 @@
1
1
  import "node:module";
2
- import { deleteCookie, getCookie, setCookie } from "hono/cookie";
3
- import { languageDetector } from "hono/language";
4
- export { deleteCookie, getCookie, languageDetector, setCookie };
2
+ export { deleteCookie, getCookie, setCookie } from "hono/cookie";
3
+ export { languageDetector } from "hono/language";
@@ -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 { AGGRED_DIR, ErrorDigest, Hono, createErrorHtml, createServerBase, getLoaderCtx, getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, onError, resolvePublicDirPaths, run, useHonoContext };
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
- import { getRenderHandler, injectRenderHandlerPlugin, renderPlugin } from "./render/index.mjs";
3
- import { faviconPlugin } from "./favicon.mjs";
4
- import { injectServerTiming, injectloggerPlugin } from "./monitors.mjs";
5
- import { processedByPlugin } from "./processedBy.mjs";
6
- import { logPlugin } from "./log.mjs";
7
- import { createDefaultPlugins } from "./default.mjs";
8
- import { compatPlugin, handleSetupResult } from "./compat/index.mjs";
9
- import { injectConfigMiddlewarePlugin } from "./middlewares.mjs";
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,8 +1,8 @@
1
1
  import "node:module";
2
+ export * from "./inject.mjs";
2
3
  import { getLoaderCtx } from "../../helper.mjs";
3
4
  import { sortRoutes } from "../../utils/index.mjs";
4
5
  import { requestLatencyMiddleware } from "../monitors.mjs";
5
- export * from "./inject.mjs";
6
6
  const DYNAMIC_ROUTE_REG = /\/:./;
7
7
  function escapeRegexSpecialChars(path) {
8
8
  return path.replace(/[()[\]{}*+?.^$|\\]/g, '\\$&');
@@ -1,5 +1,6 @@
1
1
  import "node:module";
2
2
  import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
3
+ import { __webpack_require__ } from "../../rslib-runtime.mjs";
3
4
  import { cutNameByHyphen } from "@modern-js/utils/universal";
4
5
  import { TrieRouter } from "hono/router/trie-router";
5
6
  import { X_MODERNJS_RENDER } from "../../constants.mjs";
@@ -9,21 +10,11 @@ import { dataHandler } from "./dataHandler.mjs";
9
10
  import { renderRscHandler } from "./renderRscHandler.mjs";
10
11
  import { serverActionHandler } from "./serverActionHandler.mjs";
11
12
  import { ssrRender } from "./ssrRender.mjs";
12
- var __webpack_modules__ = {
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__ };
@@ -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, createErrorHtml, onError };
54
+ export { createErrorHtml, error_ErrorDigest as ErrorDigest, onError };
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.1.0",
18
+ "version": "3.1.1",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -71,19 +71,19 @@
71
71
  "flatted": "^3.4.0",
72
72
  "hono": "^4.11.7",
73
73
  "ts-deepmerge": "7.0.3",
74
- "@modern-js/plugin": "3.1.0",
75
- "@modern-js/runtime-utils": "3.1.0",
76
- "@modern-js/utils": "3.1.0"
74
+ "@modern-js/plugin": "3.1.1",
75
+ "@modern-js/runtime-utils": "3.1.1",
76
+ "@modern-js/utils": "3.1.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@rslib/core": "0.19.6",
79
+ "@rslib/core": "0.20.0",
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
85
  "@modern-js/rslib": "2.68.10",
86
- "@modern-js/types": "3.1.0",
86
+ "@modern-js/types": "3.1.1",
87
87
  "@scripts/rstest-config": "2.66.0"
88
88
  },
89
89
  "sideEffects": false,
File without changes