Comparing version 0.0.5 to 0.1.0
24
index.js
@@ -14,3 +14,2 @@ const leftPad = require('left-pad'); | ||
this.typesTable = {}; | ||
this.triggerTable = {}; | ||
this.promiseTable = new Map(); | ||
@@ -20,11 +19,2 @@ this.indent = ''; | ||
_createTriggerChain(id) { | ||
let result = chalk.yellow(id); | ||
while (this.triggerTable[id] !== undefined) { | ||
id = this.triggerTable[id]; | ||
result += `:${chalk.magenta(id)}`; | ||
} | ||
return result; | ||
} | ||
_init(id, type, trigger, resource) { | ||
@@ -35,3 +25,2 @@ if (this.typeFilter && !this.typeFilter.exec(type)) { | ||
this.typesTable[id] = type; | ||
this.triggerTable[id] = trigger; | ||
if (type === 'PROMISE') { | ||
@@ -44,7 +33,6 @@ this.promiseTable.set(resource.promise, id); | ||
this._write(`] ${this.typesTable[id]} `, 'green'); | ||
this._write(this._createTriggerChain(id)); | ||
if (resource.parentId) { | ||
this._write(' [', 'green'); | ||
this._write(resource.parentId, 'yellow'); | ||
this._write(']', 'green'); | ||
this._write(id, 'yellow'); | ||
if (asyncHooks.executionAsyncId() !== trigger) { | ||
this._write(':', 'green'); | ||
this._write(trigger, 'magenta'); | ||
} | ||
@@ -61,6 +49,2 @@ this._write('\n'); | ||
this._write(`${id}`, 'yellow'); | ||
this._write('|ex '); | ||
this._write(asyncHooks.executionAsyncId(), 'yellow'); | ||
this._write('|tr '); | ||
this._write(asyncHooks.triggerAsyncId(), 'yellow'); | ||
this._write(' {\n', 'blue'); | ||
@@ -67,0 +51,0 @@ this.indent += ' '; |
{ | ||
"name": "cnysa", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"description": "A tool for understanding async-hooks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,8 +48,6 @@ `cnysa` (unpronouncible) is a module that allows you to see information about what the `async_hooks` module is doing under the covers. | ||
After that, you get a list of numbers delimited by `:`. The first number is the `uid` passed in to the corresponding hook, and subsequent numbers follow its `triggerAsyncId` chain. | ||
The async resource's execution ID follows. For `init` events, if the trigger ID is different than the current execution ID, it is displayed as well. | ||
For `before` lines, you'll also see the current execution ID (ex), trigger ID (tr), and an opening brace. | ||
`before`-`after` pairs are visualized as indents. | ||
`before`-`after` pairs are visualized as indents. A closing brace indicates an `after` event emission. | ||
## Examples | ||
@@ -56,0 +54,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
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
5464
120
63