🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@eggjs/koa

Package Overview
Dependencies
Maintainers
9
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eggjs/koa - npm Package Compare versions

Comparing version
3.1.2-beta.7
to
3.1.2-beta.8
+1
-1
dist/application.d.ts

@@ -35,3 +35,3 @@ import { Response } from "./response.js";

middleware: MiddlewareFunc<Context>[];
ctxStorage: AsyncLocalStorage<Context>;
ctxStorage: AsyncLocalStorage<Context> | null;
silent: boolean;

@@ -38,0 +38,0 @@ ContextClass: ProtoImplClass<Context>;

@@ -8,2 +8,3 @@ import { Context } from "./context.js";

import util, { debuglog } from "node:util";
import v8 from "node:v8";
import { getAsyncLocalStorage } from "gals";

@@ -64,3 +65,8 @@ import { HttpError } from "http-errors";

this.middleware = [];
this.ctxStorage = getAsyncLocalStorage();
if (v8.startupSnapshot?.isBuildingSnapshot?.()) {
this.ctxStorage = null;
v8.startupSnapshot.addDeserializeCallback((app) => {
app.ctxStorage = getAsyncLocalStorage();
}, this);
} else this.ctxStorage = getAsyncLocalStorage();
this.silent = false;

@@ -139,5 +145,6 @@ this.ContextClass = class ApplicationContext extends Context {};

const ctx = this.createContext(req, res);
return this.ctxStorage.run(ctx, async () => {
if (this.ctxStorage) return this.ctxStorage.run(ctx, async () => {
return await this.handleRequest(ctx, fn);
});
return this.handleRequest(ctx, fn);
};

@@ -150,3 +157,3 @@ return handleRequest;

get currentContext() {
return this.ctxStorage.getStore();
return this.ctxStorage?.getStore();
}

@@ -153,0 +160,0 @@ /**

{
"name": "@eggjs/koa",
"version": "3.1.2-beta.7",
"version": "3.1.2-beta.8",
"description": "Koa web app framework for https://eggjs.org",

@@ -54,3 +54,3 @@ "keywords": [

"vary": "^1.1.2",
"@eggjs/cookies": "4.0.2-beta.7"
"@eggjs/cookies": "4.0.2-beta.8"
},

@@ -73,3 +73,3 @@ "devDependencies": {

"typescript": "^5.9.3",
"@eggjs/supertest": "9.0.2-beta.7"
"@eggjs/supertest": "9.0.2-beta.8"
},

@@ -76,0 +76,0 @@ "engines": {