@instana/core
Advanced tools
Comparing version 1.132.1 to 1.132.2
{ | ||
"name": "@instana/core", | ||
"version": "1.132.1", | ||
"version": "1.132.2", | ||
"description": "Core library for Instana's Node.js packages", | ||
@@ -135,3 +135,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "ce288441e8995f5bd326c50ae8f467d27fc689cf" | ||
"gitHead": "05a4a392340c90788ed075cc205e5b5858ebb815" | ||
} |
@@ -7,2 +7,16 @@ /* | ||
* (see https://github.com/othiym23/emitter-listener/blob/7586fba839cf87774d5df224ce479c3b7e2b9964/package.json#L26) | ||
* | ||
* A note on the usage of the properties __wrappedInstana, __unwrapInstana, __wrapped and __unwrap: The original | ||
* package (https://github.com/othiym23/emitter-listener/blob/af156cef522f1daa11523b2d94b6f7fd1e859ca5/listener.js) | ||
* attaches properties named __wrapped and __unwrap to the event emitter object. Even with this fixed and vendored | ||
* version of emitter-listener, the issue fixed in https://github.com/othiym23/emitter-listener/pull/7 can still | ||
* persist if other packages install the unfixed emitter-listener package as a dependency, and if the unfixed version | ||
* of wrapEmitter gets called _after_ this version. | ||
* | ||
* To fix that, our version uses different property names (__wrappedInstana, __unwrapInstana) when attaching properties | ||
* to the event emitter object. In addition to that, both the original and this fixed version use the package shimmer | ||
* internally. The package shimmer also uses properties named __wrapped etc., but it attaches them to individual | ||
* functions instead of the event emitter object. emitter-listener relies on this and checks whether a function has been | ||
* shimmed by checking if the function has a __wrapped property. For those usages, we need to stick with the original | ||
* property names. | ||
*/ | ||
@@ -19,5 +33,3 @@ // @ts-nocheck - not going to add type checking to a temporarily vendored dependency. | ||
// Default to complaining loudly when things don't go according to plan. | ||
// dunderscores are boring | ||
const SYMBOL = 'wrap@before'; | ||
const SYMBOL = 'instana@before'; | ||
@@ -166,7 +178,7 @@ // Sets a property on an object, preserving its enumerability. | ||
// the same emitter is handled above by pushing them into an array if necessary. | ||
if (!emitter.__wrapped) { | ||
if (!emitter.__wrappedInstana) { | ||
wrap(emitter, 'addListener', adding); | ||
wrap(emitter, 'on', adding); | ||
defineProperty(emitter, '__unwrap', function () { | ||
defineProperty(emitter, '__unwrapInstana', function () { | ||
unwrap(emitter, 'addListener'); | ||
@@ -176,5 +188,5 @@ unwrap(emitter, 'on'); | ||
delete emitter[SYMBOL]; | ||
delete emitter.__wrapped; | ||
delete emitter.__wrappedInstana; | ||
}); | ||
defineProperty(emitter, '__wrapped', true); | ||
defineProperty(emitter, '__wrappedInstana', true); | ||
} | ||
@@ -181,0 +193,0 @@ |
544033
15382