async-hook-jl
Advanced tools
Comparing version 1.7.5 to 1.7.6
@@ -107,3 +107,3 @@ 'use strict'; | ||
if (process.env.hasOwnProperty('NODE_ASYNC_HOOK_WARNING')) { | ||
console.warn('warning: you are using async-hook which is unstable.'); | ||
console.warn('warning: you are using async-hook-jl which is unstable.'); | ||
} | ||
@@ -110,0 +110,0 @@ asyncWrap.setupHooks({ |
29
index.js
@@ -11,23 +11,22 @@ 'use strict'; | ||
module.exports = global._asyncHook; | ||
return; | ||
} | ||
// The version don't match, this is really bad. Lets just throw | ||
else { | ||
throw new Error('Conflicting version of async-hook found'); | ||
throw new Error('Conflicting version of async-hook-jl found'); | ||
} | ||
} | ||
} else { | ||
const stackChain = require('stack-chain'); | ||
const stackChain = require('stack-chain'); | ||
// Remove callSites from this module. AsyncWrap doesn't have any callSites | ||
// and the hooks are expected to be completely transparent. | ||
stackChain.filter.attach(function (error, frames) { | ||
return frames.filter(function (callSite) { | ||
const filename = callSite.getFileName(); | ||
// filename is not always a string, for example in case of eval it is | ||
// undefined. So check if the filename is defined. | ||
return !(filename && filename.slice(0, __dirname.length) === __dirname); | ||
// Remove callSites from this module. AsyncWrap doesn't have any callSites | ||
// and the hooks are expected to be completely transparent. | ||
stackChain.filter.attach(function (error, frames) { | ||
return frames.filter(function (callSite) { | ||
const filename = callSite.getFileName(); | ||
// filename is not always a string, for example in case of eval it is | ||
// undefined. So check if the filename is defined. | ||
return !(filename && filename.slice(0, __dirname.length) === __dirname); | ||
}); | ||
}); | ||
}); | ||
module.exports = global._asyncHook = new AsyncHook(); | ||
module.exports = global._asyncHook = new AsyncHook(); | ||
} |
{ | ||
"name": "async-hook-jl", | ||
"description": "Inspect the life of handle objects in node", | ||
"version": "1.7.5", | ||
"version": "1.7.6", | ||
"author": "Andreas Madsen <amwebdk@gmail.com>", | ||
@@ -33,2 +33,2 @@ "main": "./index.js", | ||
} | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
#async-hook | ||
[![Build Status](https://travis-ci.org/Jeff-Lewis/async-hook-jl.svg?branch=master)](https://travis-ci.org/Jeff-Lewis/async-hook-jl) | ||
#async-hook-jl | ||
> Inspect the life of handle objects in node | ||
@@ -19,3 +21,3 @@ | ||
```javascript | ||
const asyncHook = require('async-hook'); | ||
const asyncHook = require('async-hook-jl'); | ||
``` | ||
@@ -62,2 +64,2 @@ | ||
Be careful about disabling the hooks, this will most likely conflict with other | ||
modules that uses `async-hook`. | ||
modules that uses `async-hook-jl`. |
@@ -12,3 +12,3 @@ 'use strict'; | ||
} catch (e) { | ||
assert.equal(e.message, 'Conflicting version of async-hook found'); | ||
} | ||
assert.equal(e.message, 'Conflicting version of async-hook-jl found'); | ||
} |
Sorry, the diff of this file is not supported yet
89917
64
2080