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

callsite-record

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callsite-record - npm Package Compare versions

Comparing version 4.1.4 to 4.1.5

4

lib/index.d.ts

@@ -7,3 +7,3 @@ // Type definitions for callsite-record v4.0.0

import { Renderer, Renderers } from './renderers';
import { StackFrameOptions } from 'stackframe';
import '@devexpress/error-stack-parser';

@@ -13,3 +13,3 @@ declare namespace createCallsiteRecord {

type StackFrame = StackFrameOptions;
type StackFrame = StackFrame.StackFrameOptions;
type isCallSiteFrame = (stackFrame: StackFrame) => boolean;

@@ -16,0 +16,0 @@ type processFrameFn = (stackFrame: StackFrame) => StackFrame;

@@ -1,8 +0,8 @@

var fs = require('fs');
var Promise = require('pinkie-promise');
var callsite = require('callsite');
var stackParser = require('@devexpress/error-stack-parser');
var padStart = require('lodash').padStart;
var defaults = require('lodash').defaults;
var highlight = require('highlight-es');
var fs = require('fs');
var Promise = require('pinkie-promise');
var callsite = require('callsite');
var stackParser = require('@devexpress/error-stack-parser');
var padStart = require('lodash').padStart;
var defaults = require('lodash').defaults;
var highlight = require('highlight-es');

@@ -34,2 +34,3 @@ var renderers = {

catch (err) {
console.log(err);
return null;

@@ -82,3 +83,17 @@ }

function getFilePath (filename) {
if (filename.startsWith('file:'))
return new URL(filename);
return filename;
}
function getFrameNames (frame) {
return {
functionName: frame.getFunctionName(),
methodName: frame.getMethodName(),
typeName: getFrameTypeName(frame)
};
}
// CallsiteRecord

@@ -220,3 +235,4 @@ var CallsiteRecord = function (filename, lineNum, callsiteFrameIdx, stackFrames) {

CallsiteRecord.prototype.renderSync = function (opts) {
var fileContent = fs.readFileSync(this.filename).toString();
var filePath = getFilePath(this.filename);
var fileContent = fs. readFileSync(filePath).toString();

@@ -230,3 +246,5 @@ return this._renderRecord(fileContent, opts);

return new Promise(function (resolve, reject) {
fs.readFile(record.filename, function (err, fileContent) {
var filePath = getFilePath(record.filename);
fs.readFile(filePath, function (err, fileContent) {
if (err)

@@ -246,5 +264,8 @@ reject(err);

for (var i = 0; i < stackFrames.length; i++) {
var frame = stackFrames[i];
var fnNameMatch = frame.getFunctionName() === fnName || frame.getMethodName() === fnName;
var typeNameMatch = !typeName || getFrameTypeName(frame) === typeName;
var frameNames = getFrameNames(stackFrames[i]);
var fnNameMatch = frameNames.functionName === fnName || frameNames.methodName === fnName;
var typeNameMatch = !typeName ||
frameNames.typeName === typeName ||
// NOTE: frameNames.typeName === null on Node 16+ when calling a class constructor
fnNameMatch && frameNames.typeName === null && fnName === typeName;

@@ -251,0 +272,0 @@ if (fnNameMatch && typeNameMatch) {

{
"name": "callsite-record",
"version": "4.1.4",
"version": "4.1.5",
"description": "Create fancy log entries for errors and function call sites.",

@@ -11,3 +11,3 @@ "main": "lib/index.js",

"scripts": {
"test": "eslint lib test && mocha",
"test": "eslint lib test && mocha --color",
"publish-please": "publish-please",

@@ -37,8 +37,7 @@ "prepublish": "publish-please guard"

"eslint": "^1.10.3",
"mocha": "^2.4.5",
"publish-please": "^2.2.0"
"mocha": "^10.2.0",
"publish-please": "^5.5.2"
},
"dependencies": {
"@devexpress/error-stack-parser": "^2.0.6",
"@types/error-stack-parser": "^2.0.0",
"@types/lodash": "^4.14.72",

@@ -45,0 +44,0 @@ "callsite": "^1.0.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