callsite-record
Advanced tools
Comparing version 4.1.4 to 4.1.5
@@ -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", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
24154
7
421
0
- Removed@types/error-stack-parser@^2.0.0
- Removed@types/error-stack-parser@2.0.2(transitive)
- Removederror-stack-parser@3.0.0(transitive)