Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wry/context

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wry/context - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

1

lib/context.d.ts

@@ -13,1 +13,2 @@ /// <reference types="node" />

export declare function asyncFromGen<TArgs extends any[], TResult>(genFn: (...args: TArgs) => IterableIterator<TResult>): (...args: TArgs) => Promise<TResult>;
export declare function wrapYieldingFiberMethods(Fiber: any): void;

@@ -146,3 +146,19 @@ var currentContext = null;

}
// If you use the fibers npm package to implement coroutines in Node.js,
// you should call this function at least once to ensure context management
// remains coherent across any yields.
function wrapYieldingFiberMethods(Fiber) {
function wrap(obj, method) {
var fn = obj[method];
obj[method] = function () {
return noContext(fn, arguments, this);
};
}
// These methods can yield, according to
// https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100
wrap(Fiber, "yield");
wrap(Fiber.prototype, "run");
wrap(Fiber.prototype, "throwInto");
}
export { Slot, asyncFromGen, bind, noContext, setTimeoutWithContext as setTimeout };
export { Slot, asyncFromGen, bind, noContext, setTimeoutWithContext as setTimeout, wrapYieldingFiberMethods };

@@ -150,2 +150,18 @@ 'use strict';

}
// If you use the fibers npm package to implement coroutines in Node.js,
// you should call this function at least once to ensure context management
// remains coherent across any yields.
function wrapYieldingFiberMethods(Fiber) {
function wrap(obj, method) {
var fn = obj[method];
obj[method] = function () {
return noContext(fn, arguments, this);
};
}
// These methods can yield, according to
// https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100
wrap(Fiber, "yield");
wrap(Fiber.prototype, "run");
wrap(Fiber.prototype, "throwInto");
}

@@ -157,1 +173,2 @@ exports.Slot = Slot;

exports.setTimeout = setTimeoutWithContext;
exports.wrapYieldingFiberMethods = wrapYieldingFiberMethods;

4

package.json
{
"name": "@wry/context",
"version": "0.2.3",
"version": "0.3.0",
"author": "Ben Newman <ben@eloper.dev>",

@@ -31,3 +31,3 @@ "description": "Manage contextual information needed by (a)synchronous tasks without explicitly passing objects around",

},
"gitHead": "cec6db29c1dcc43333f87ef00f9acdbc98b8930e"
"gitHead": "26e4fbd9bc9b9c9bac12cce8dd09243605d170bf"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc