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.3.0 to 0.3.1

2

lib/context.d.ts

@@ -13,2 +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;
export declare function wrapYieldingFiberMethods<F extends Function>(Fiber: F): F;

@@ -149,16 +149,23 @@ var currentContext = null;

// remains coherent across any yields.
var wrappedFibers = [];
function wrapYieldingFiberMethods(Fiber) {
function wrap(obj, method) {
var fn = obj[method];
obj[method] = function () {
return noContext(fn, arguments, this);
// There can be only one implementation of Fiber per process, so this array
// should never grow longer than one element.
if (wrappedFibers.indexOf(Fiber) < 0) {
var wrap = function (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");
wrappedFibers.push(Fiber);
}
// 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");
return Fiber;
}
export { Slot, asyncFromGen, bind, noContext, setTimeoutWithContext as setTimeout, wrapYieldingFiberMethods };

@@ -153,14 +153,21 @@ 'use strict';

// remains coherent across any yields.
var wrappedFibers = [];
function wrapYieldingFiberMethods(Fiber) {
function wrap(obj, method) {
var fn = obj[method];
obj[method] = function () {
return noContext(fn, arguments, this);
// There can be only one implementation of Fiber per process, so this array
// should never grow longer than one element.
if (wrappedFibers.indexOf(Fiber) < 0) {
var wrap = function (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");
wrappedFibers.push(Fiber);
}
// 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");
return Fiber;
}

@@ -167,0 +174,0 @@

{
"name": "@wry/context",
"version": "0.3.0",
"version": "0.3.1",
"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": "26e4fbd9bc9b9c9bac12cce8dd09243605d170bf"
"gitHead": "3a0643ee8dda643e9ac20249442f3ea6ecc1bc8d"
}

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