@modern-js/server-core 3.1.1 → 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.
@@ -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.options;
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.options,
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.options = options;
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,7 +1,7 @@
1
- export * from "./inject.mjs";
2
1
  import { getLoaderCtx } from "../../helper.mjs";
3
2
  import { sortRoutes } from "../../utils/index.mjs";
4
3
  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,5 +1,3 @@
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";
3
1
  import { cutNameByHyphen } from "@modern-js/utils/universal";
4
2
  import { TrieRouter } from "hono/router/trie-router";
5
3
  import { X_MODERNJS_RENDER } from "../../constants.mjs";
@@ -9,6 +7,8 @@ import { dataHandler } from "./dataHandler.mjs";
9
7
  import { renderRscHandler } from "./renderRscHandler.mjs";
10
8
  import { serverActionHandler } from "./serverActionHandler.mjs";
11
9
  import { ssrRender } from "./ssrRender.mjs";
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
12
  __webpack_require__.add({
13
13
  "@modern-js/runtime-utils/router" (module) {
14
14
  module.exports = __rspack_external__modern_js_runtime_utils_router_2aa8d96f;
@@ -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.options;
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.options,
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.options = options;
83
+ this.serverOptions = options;
81
84
  this.app = new Hono();
82
85
  this.app.use('*', run);
83
86
  }
@@ -1,7 +1,7 @@
1
- import { AsyncLocalStorage } from "async_hooks";
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,8 +1,8 @@
1
1
  import "node:module";
2
- export * from "./inject.mjs";
3
2
  import { getLoaderCtx } from "../../helper.mjs";
4
3
  import { sortRoutes } from "../../utils/index.mjs";
5
4
  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,6 +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
- import { __webpack_require__ } from "../../rslib-runtime.mjs";
4
2
  import { cutNameByHyphen } from "@modern-js/utils/universal";
5
3
  import { TrieRouter } from "hono/router/trie-router";
6
4
  import { X_MODERNJS_RENDER } from "../../constants.mjs";
@@ -10,6 +8,8 @@ import { dataHandler } from "./dataHandler.mjs";
10
8
  import { renderRscHandler } from "./renderRscHandler.mjs";
11
9
  import { serverActionHandler } from "./serverActionHandler.mjs";
12
10
  import { ssrRender } from "./ssrRender.mjs";
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
13
  __webpack_require__.add({
14
14
  "@modern-js/runtime-utils/router" (module) {
15
15
  module.exports = __rspack_external__modern_js_runtime_utils_router_2aa8d96f;
@@ -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.options;
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.options,
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.options = options;
84
+ this.serverOptions = options;
82
85
  this.app = new Hono();
83
86
  this.app.use('*', run);
84
87
  }
@@ -1,8 +1,8 @@
1
1
  import "node:module";
2
- import { AsyncLocalStorage } from "async_hooks";
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
- options: ServerBaseOptions;
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.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.0",
71
+ "flatted": "^3.4.2",
72
72
  "hono": "^4.11.7",
73
73
  "ts-deepmerge": "7.0.3",
74
- "@modern-js/plugin": "3.1.1",
75
- "@modern-js/runtime-utils": "3.1.1",
76
- "@modern-js/utils": "3.1.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.20.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.1",
87
87
  "@scripts/rstest-config": "2.66.0"
88
88
  },
89
89
  "sideEffects": false,