Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cnysa

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnysa - npm Package Compare versions

Comparing version 0.5.3 to 0.6.0

15

index.d.ts

@@ -15,12 +15,17 @@ export declare type Serializable<T> = {

/**
* A RegExp to filter out `AsyncResource` types.
* Only AsyncResources with types that do not match this regular expression
* will be shown.
*/
ignoreTypes: RegExp;
/**
* A list of `AsyncResource` IDs that must be an ancestor of a given
* `AsyncResource` for it to be displayed. The default value, an empty list,
* is equivalent to specifying no constraint on ancestry.
* Only AsyncResources that have an ancestor whose type matches this regular
* expression will be shown.
*/
roots: number[];
rootTypes: RegExp;
/**
* AsyncResources with types that match this regular expression will only have
* their initialization event shown.
*/
markTypes: RegExp;
/**
* A number that represents the amount of space between each depicted event.

@@ -27,0 +32,0 @@ */

@@ -7,3 +7,3 @@ "use strict";

const stack_trace_1 = require("./stack-trace");
const assemble_1 = require("./assemble");
const semble_1 = require("semble");
const isRemovableLine = (str) => {

@@ -199,2 +199,6 @@ while (str = str.trim()) {

new RegExp(opts.ignoreTypes) : opts.ignoreTypes;
opts.rootTypes = typeof opts.rootTypes === 'string' ?
new RegExp(opts.rootTypes) : opts.rootTypes;
opts.markTypes = typeof opts.markTypes === 'string' ?
new RegExp(opts.markTypes) : opts.markTypes;
return opts;

@@ -235,4 +239,4 @@ }

const prepareNoLead = (c) => prepare(c);
// A string[][][] to format into a grid using the assemble() function.
const preassemble = [[[chalk_1.default.cyan('*'), ...stack_trace_1.createStackTrace().slice(2).map(prepareNoLead)]]];
// A string[][] to format into a grid using the assemble() function.
const preassemble = [[[chalk_1.default.cyan('*'), ...stack_trace_1.createStackTrace().slice(2).map(prepareNoLead)].join('\n')]];
let ancestryGraphQueue = this.currentScopes.map(x => [x.id]).reverse();

@@ -250,3 +254,3 @@ while (ancestryGraphQueue.length > 0) {

...this.resources[top(parents)].stack.map(prepareNoLead)
]));
].join('\n')));
// Go back one level in the ancestry graph.

@@ -260,3 +264,3 @@ ancestryGraphQueue = ancestryGraphQueue.reduce((acc, parents) => {

}
return assemble_1.assemble(preassemble);
return semble_1.semble(preassemble);
}

@@ -281,3 +285,3 @@ /**

const k = Number(key);
return this.resources[k].type.match(config.ignoreTypes) || !this.hasAncestor(this.resources[k], config.roots);
return this.resources[k].type.match(config.ignoreTypes) || !this.hasAncestor(this.resources[k], config.rootTypes);
}).reduce((acc, key) => acc.add(Number(key)), new Set());

@@ -309,2 +313,3 @@ const rowHeaderLength = Object.keys(this.resources).reduce((acc, key) => {

const k = Number(key);
const initOnly = event.uid >= 0 && !!this.resources[event.uid].type.match(config.markTypes);
if (!eventStrings[k]) {

@@ -315,5 +320,8 @@ eventStrings[k] = { alive: false, str: new StringRowsBuilder(adjustedWidth) };

if (event.type === 'init') {
eventStrings[k].str.appendChar('*', 'green');
eventStrings[k].alive = true;
eventStrings[k].str.appendChar('*', initOnly ? 'cyan' : 'green');
eventStrings[k].alive = !initOnly && true;
}
else if (initOnly) {
eventStrings[k].str.appendChar(' ');
}
else if (event.type === 'before') {

@@ -368,3 +376,3 @@ eventStrings[k].str.appendChar('{', 'blue');

};
if (event.type === 'internal' && maybeVertical('cyan')) {
if ((event.type === 'internal' || initOnly) && maybeVertical('cyan')) {
return;

@@ -444,3 +452,4 @@ }

ignoreTypes: /ignore/,
roots: [],
rootTypes: /.*/,
markTypes: /\*$/,
padding: 1,

@@ -447,0 +456,0 @@ format: 'default'

{
"name": "cnysa",
"version": "0.5.3",
"version": "0.6.0",
"description": "A tool for understanding async-hooks",

@@ -28,2 +28,3 @@ "main": "index.js",

"left-pad": "^1.2.0",
"semble": "^0.1.1",
"string-length": "^2.0.0"

@@ -30,0 +31,0 @@ },

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