@contrast/deadzones
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -18,2 +18,11 @@ /* | ||
const { callChildComponentMethodsSync } = require('@contrast/common'); | ||
/** | ||
* @param {{ | ||
* scopes: { | ||
* instrumentation: import('@contrast/scopes').Instrumentation | ||
* } | ||
* }} core | ||
*/ | ||
module.exports = function(core) { | ||
@@ -35,30 +44,25 @@ const { | ||
createAroundHook, | ||
installers: [], | ||
}; | ||
const consoleDeadzone = require('./install/console')(core); | ||
const moduleDeadzones = require('./install/module')(core); | ||
require('./install/@cyclonedx')(core); | ||
require('./install/console')(core); | ||
require('./install/coffeescript')(core); | ||
require('./install/babel')(core); | ||
require('./install/bson')(core); | ||
require('./install/iconv-lite')(core); | ||
require('./install/jsrsasign')(core); | ||
require('./install/less')(core); | ||
require('./install/module')(core); | ||
require('./install/pino')(core); | ||
require('./install/type-is')(core); | ||
deadzones.install = function() { | ||
consoleDeadzone.install(); | ||
moduleDeadzones.install(); | ||
// logger isn't a dependency of deadzones so check if it has been composed | ||
if (core.logger) { | ||
for (const level of ['trace', 'debug', 'info', 'warn', 'error']) { | ||
const store = { lock: true, name: `core.logger.${level}` }; | ||
const boundMethod = core.logger[level].bind(core.logger); | ||
core.logger[level] = function(...args) { | ||
if (!instrumentation.isLocked()) { | ||
return instrumentation.run(store, boundMethod, ...args); | ||
} | ||
return boundMethod(...args); | ||
}; | ||
} | ||
} | ||
callChildComponentMethodsSync(deadzones, 'install'); | ||
}; | ||
deadzones.uninstall = function() { | ||
consoleDeadzone.uninstall(); | ||
moduleDeadzones.uninstall(); | ||
for (const installer of deadzones.installers) { | ||
installer.uninstall?.(); | ||
} | ||
}; | ||
@@ -65,0 +69,0 @@ |
@@ -24,3 +24,2 @@ /* | ||
patcher, | ||
deadzones, | ||
deadzones: { | ||
@@ -31,13 +30,10 @@ createAroundHook, | ||
const name = 'Module.prototype.require'; | ||
const store = { | ||
name: `${name}`, | ||
lock: true, | ||
}; | ||
return core.deadzones.moduleInstrumentation = { | ||
install() { | ||
const patchName = 'Module.prototype.require'; | ||
const store = { lock: true, name: patchName }; | ||
return deadzones.moduleInstrumentation = { | ||
install() { | ||
// `require` has sinks and propagators that run | ||
patcher.patch(Module.prototype, 'require', { | ||
name, | ||
name: patchName, | ||
patchType, | ||
@@ -44,0 +40,0 @@ around: createAroundHook(store), |
{ | ||
"name": "@contrast/deadzones", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Configures Contrast agent services and instrumentation within an application", | ||
@@ -18,3 +18,6 @@ "license": "SEE LICENSE IN LICENSE", | ||
"test": "../scripts/test.sh" | ||
}, | ||
"dependencies": { | ||
"@contrast/common": "1.21.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21640
16
551
1
1
+ Added@contrast/common@1.21.0
+ Added@contrast/common@1.21.0(transitive)