@jayfong/x-server 2.59.0 → 2.60.0

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.
File without changes
@@ -26,7 +26,7 @@ class Handler {
26
26
  if (Handler.hooks.length) {
27
27
  await Promise.all(Handler.hooks.map(hook => hook(this.options, data, ctx)));
28
28
  }
29
- let useAsyncContext = _server.Server.options.useAsyncContext !== false;
29
+ let useAsyncContext = !!_server.Server.options.useAsyncContext;
30
30
  if (this.options.useAsyncContext != null) {
31
31
  useAsyncContext = this.options.useAsyncContext;
32
32
  }
@@ -16,9 +16,6 @@ class Server {
16
16
  this.options = options;
17
17
  this.fastify = void 0;
18
18
  this.routes = [];
19
- if (options.useAsyncContext == null) {
20
- options.useAsyncContext = true;
21
- }
22
19
  Server.options = options;
23
20
  _nodeProcess.default.on('unhandledRejection', (reason, promise) => {
24
21
  console.error('未捕获的错误', reason, promise);
@@ -20,7 +20,7 @@ export class Handler {
20
20
  if (Handler.hooks.length) {
21
21
  await Promise.all(Handler.hooks.map(hook => hook(this.options, data, ctx)));
22
22
  }
23
- let useAsyncContext = Server.options.useAsyncContext !== false;
23
+ let useAsyncContext = !!Server.options.useAsyncContext;
24
24
  if (this.options.useAsyncContext != null) {
25
25
  useAsyncContext = this.options.useAsyncContext;
26
26
  }
@@ -10,9 +10,6 @@ export class Server {
10
10
  this.options = options;
11
11
  this.fastify = void 0;
12
12
  this.routes = [];
13
- if (options.useAsyncContext == null) {
14
- options.useAsyncContext = true;
15
- }
16
13
  Server.options = options;
17
14
  process.on('unhandledRejection', (reason, promise) => {
18
15
  console.error('未捕获的错误', reason, promise);
@@ -47,7 +47,7 @@ export declare namespace XServer {
47
47
  /**
48
48
  * 是否使用异步上下文
49
49
  *
50
- * @default true
50
+ * @default false
51
51
  */
52
52
  useAsyncContext?: boolean;
53
53
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.59.0",
3
+ "version": "2.60.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",