Socket
Socket
Sign inDemoInstall

koa

Package Overview
Dependencies
23
Maintainers
11
Versions
104
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.13.4 to 2.14.0

6

History.md
2.14.0 / 2022-12-06
==================
**features**
* [[`a293122`](http://github.com/koajs/koa/commit/a29312212839c6f0418152d2a2cd3bf3fd3ee5e4)] - feat: support asyncLocalStorage (#1721) (fengmk2 <<fengmk2@gmail.com>>)
2.13.4 / 2021-10-19

@@ -3,0 +9,0 @@ ==================

@@ -11,2 +11,3 @@

const onFinished = require('on-finished');
const assert = require('assert');
const response = require('./response');

@@ -68,2 +69,8 @@ const compose = require('koa-compose');

}
if (options.asyncLocalStorage) {
const { AsyncLocalStorage } = require('async_hooks');
assert(AsyncLocalStorage, 'Requires node 12.17.0 or higher to enable asyncLocalStorage');
this.ctxStorage = new AsyncLocalStorage();
this.use(createAsyncCtxStorage(this));
}
}

@@ -159,2 +166,9 @@

/**
* return currnect contenxt from async local storage
*/
get currentContext() {
if (this.ctxStorage) return this.ctxStorage.getStore();
}
/**
* Handle request in callback.

@@ -228,2 +242,10 @@ *

function createAsyncCtxStorage(app) {
return async function asyncCtxStorage(ctx, next) {
await app.ctxStorage.run(ctx, async() => {
return await next();
});
};
}
/**

@@ -230,0 +252,0 @@ * Response helper.

2

package.json
{
"name": "koa",
"version": "2.13.4",
"version": "2.14.0",
"description": "Koa web app framework",

@@ -5,0 +5,0 @@ "main": "lib/application.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc