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

backtrace-node

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backtrace-node - npm Package Compare versions

Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7

4

lib/helpers/moduleResolver.d.ts

@@ -5,3 +5,3 @@ /// <reference types="node" />

*/
export declare function readModuleDependencies(modulePath: string): object;
export declare function readModule(root: string, depth?: number): [NodeRequire, string];
export declare function readModuleDependencies(modulePath: string): object | undefined;
export declare function readModule(root: string | undefined, depth?: number): [NodeRequire, string];

@@ -16,2 +16,5 @@ "use strict";

function readModuleDependencies(modulePath) {
if (!modulePath) {
return undefined;
}
var packageJson = require(modulePath);

@@ -18,0 +21,0 @@ return {

@@ -146,2 +146,5 @@ "use strict";

};
backtraceReport.sendSync = function () {
backtraceClient.sendReport(backtraceReport);
};
return backtraceReport;

@@ -148,0 +151,0 @@ }

@@ -19,3 +19,3 @@ import { IBacktraceData } from './backtraceData';

/**
* Deprecated
* @deprecated
* Please use client.sendReport instead

@@ -27,2 +27,9 @@ * BacktraceReport generated by library allows you to

/**
* @deprecated
* Please use client.sendReport instead
* BacktraceReport generated by library allows you to
* automatically send reports to Backtrace via send method
*/
sendSync: () => void | undefined;
/**
* Thread information about current application

@@ -72,2 +79,12 @@ */

/**
* @deprecated
* Please don't use log method in new BacktraceReport object.
*/
log(): void;
/**
* @deprecated
* Please don't use trace method in new BacktraceReport object
*/
trace(): void;
/**
* Add new attributes to existing report attributes

@@ -74,0 +91,0 @@ * @param attributes new report attributes object

@@ -139,2 +139,16 @@ "use strict";

/**
* @deprecated
* Please don't use log method in new BacktraceReport object.
*/
BacktraceReport.prototype.log = function () {
console.warn('log method is deprecated.');
};
/**
* @deprecated
* Please don't use trace method in new BacktraceReport object
*/
BacktraceReport.prototype.trace = function () {
console.warn('trace method is deprecated.');
};
/**
* Add new attributes to existing report attributes

@@ -141,0 +155,0 @@ * @param attributes new report attributes object

@@ -34,3 +34,3 @@ import { ISourceCode } from './sourceCode';

*/
getCallingModulePath(): string;
getCallingModulePath(): string | undefined;
/**

@@ -37,0 +37,0 @@ * Get Json data from Stack trace object

@@ -76,2 +76,5 @@ "use strict";

BacktraceStackTrace.prototype.getCallingModulePath = function () {
if (!this.stack || this.stack.length === 0) {
return undefined;
}
// handle a situation when every one stack frame is from node_modules

@@ -116,5 +119,9 @@ if (!this.callingModulePath) {

var match = line.match(_this.stackLineRe);
if (!match) {
if (!match || match.length < 4) {
return;
}
var backtraceLibStackFrame = match[4].indexOf('node_modules/backtrace-node') !== -1;
if (backtraceLibStackFrame) {
return;
}
var stackFrame = {

@@ -121,0 +128,0 @@ funcName: match[1],

{
"name": "backtrace-node",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"description": "Backtrace error reporting tool",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -44,3 +44,3 @@ # backtrace-node

Required.
Required if you're not using integration via submit.backtrace.io.

@@ -115,2 +115,14 @@ Example: `51cc8e69c5b62fa8c72dc963e730f1e8eacbd243aeafc35d08d05ded9a024121`.

#### `sampling`
Now, Backtrace-node supports sampling attribute. By using this argument, you can prevent sending reports to the server. You can define sampling value in the BacktraceClientOptions.Sampling option which accepts values from 0 to 1, where 1 means sampling algorithm will skill all reports. If you want to know when Backtrace-node skips a report, please check BacktraceResult object, or use 'sampling-hit' event.
#### `rateLimit`
Backtrace-node supports client rate limiting! You can define how many reports per one minute you want to send to Backtrace by adding the additional option to the BacktraceClientOptions object. Now, when you reach the defined limit, the client will skip the current report. You can still learn which report won’t be available on the server by using event-emitter and ‘rate-limit’ events or by checking BacktraceResult – object that will return the reportSync/reportAsync method.
### bt.getBacktraceClient()
Returns a new `BacktraceClient` instance that you can use to send data to Backtrace. You can create new `BacktraceClient` manually and then replace existing default `BacktraceClient` with yours by using `use` method.
### bt.report([error], [attributes], [callback])

@@ -271,3 +283,3 @@

#### report.trace()
[Deprecated]
This function captures a stack trace at the current location. Due to the event

@@ -287,2 +299,3 @@ loop, errors in Node.js sometimes are missing part of the stack trace.

#### report.log(...)
[Deprecated]

@@ -289,0 +302,0 @@ Adds a timestamped log message to the report. Log output is available when you

@@ -7,3 +7,6 @@ import * as fs from 'fs';

*/
export function readModuleDependencies(modulePath: string): object {
export function readModuleDependencies(modulePath: string): object | undefined {
if(!modulePath){
return undefined;
}
const packageJson = require(modulePath);

@@ -16,3 +19,3 @@ return {

export function readModule(root: string, depth: number = 5): [NodeRequire, string] {
export function readModule(root: string | undefined, depth: number = 5): [NodeRequire, string] {
if (depth < 0) {

@@ -19,0 +22,0 @@ return readLibModule();

@@ -94,2 +94,5 @@ import { BacktraceClient } from './backtraceClient';

};
backtraceReport.sendSync = () => {
backtraceClient.sendReport(backtraceReport);
}

@@ -96,0 +99,0 @@ return backtraceReport;

@@ -33,3 +33,3 @@ // tslint:disable-next-line: no-var-requires

/**
* Deprecated
* @deprecated
* Please use client.sendReport instead

@@ -42,2 +42,10 @@ * BacktraceReport generated by library allows you to

/**
* @deprecated
* Please use client.sendReport instead
* BacktraceReport generated by library allows you to
* automatically send reports to Backtrace via send method
*/
public sendSync!: () => void | undefined;
/**
* Thread information about current application

@@ -113,2 +121,18 @@ */

/**
* @deprecated
* Please don't use log method in new BacktraceReport object.
*/
public log() {
console.warn('log method is deprecated.');
}
/**
* @deprecated
* Please don't use trace method in new BacktraceReport object
*/
public trace() {
console.warn('trace method is deprecated.');
}
/**
* Add new attributes to existing report attributes

@@ -115,0 +139,0 @@ * @param attributes new report attributes object

@@ -50,3 +50,6 @@ import * as fs from 'fs';

*/
public getCallingModulePath(): string {
public getCallingModulePath(): string | undefined {
if (!this.stack || this.stack.length === 0) {
return undefined;
}
// handle a situation when every one stack frame is from node_modules

@@ -89,5 +92,9 @@ if (!this.callingModulePath) {

const match = line.match(this.stackLineRe);
if (!match) {
if (!match || match.length < 4) {
return;
}
const backtraceLibStackFrame = match[4].indexOf('node_modules/backtrace-node') !== -1;
if (backtraceLibStackFrame) {
return;
}

@@ -94,0 +101,0 @@ const stackFrame = {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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