How to use the source-map-support.wrapCallSite function in source-map-support

To help you get started, we’ve selected a few source-map-support examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sebastian-software / edge / packages / edge-core / src / server / debug.js View on Github external
export function frameToString(frame)
{
  const wrappedFrame = wrapCallSite(frame)

  var sourceFile = wrappedFrame.getFileName()
  var functionName = wrappedFrame.getFunctionName()
  var typeName = wrappedFrame.getTypeName()

  // Ignore some cryptic function names which typically are just function calls
  if (FUNCTION_NAME_CLEARANCE.some((regexp) => regexp.test(functionName))) {
    functionName = ""
  }

  // Filter out configured type names
  if (TYPE_NAME_CLEARANCE.some((regexp) => regexp.test(typeName))) {
    typeName = ""
  }

  // Strip out generated filename part from source field
github strues / boldr / server / utils / debugUtil.js View on Github external
export function frameToString(frame)
{
  const wrappedFrame = wrapCallSite(frame)

  var sourceFile = wrappedFrame.getFileName()
  var functionName = wrappedFrame.getFunctionName()
  var typeName = wrappedFrame.getTypeName()

  // Ignore some cryptic function names which typically are just function calls
  if (FUNCTION_NAME_CLEARANCE.some((regexp) => regexp.test(functionName))) {
    functionName = ""
  }

  // Filter out configured type names
  if (TYPE_NAME_CLEARANCE.some((regexp) => regexp.test(typeName))) {
    typeName = ""
  }

  // Strip out generated filename part from source field
github strues / boldr / web / src / server / utils / debugUtil.js View on Github external
export function isRelevantFrame(frame) {
  const wrappedFrame = wrapCallSite(frame);
  const generatedFile = frame.getFileName();

  const sourceFile = wrappedFrame.getFileName();
  const functionName = wrappedFrame.getFunctionName();

  // Filter out all raw files which do not have any source mapping
  // This typically removes most of the build related infrastructure
  // which is neither application or framework code.
  const isCompiled = sourceFile !== generatedFile;
  if (!isCompiled) {
    return false;
  }

  // Filter out specific functions e.g. webpack require wrappers
  if (FUNCTION_NAME_FILTERS.some(regexp => regexp.test(functionName))) {
    return false;
github sebastian-software / edgestack / src / api / server / debug.js View on Github external
export function isRelevantFrame(frame)
{
  const wrappedFrame = wrapCallSite(frame)
  const generatedFile = frame.getFileName()

  var sourceFile = wrappedFrame.getFileName()
  var functionName = wrappedFrame.getFunctionName()

  // Filter out all raw files which do not have any source mapping
  // This typically removes most of the build related infrastructure
  // which is neither application or framework code.
  const isCompiled = sourceFile !== generatedFile
  if (!isCompiled) {
    return false
  }

  // Filter out specific functions e.g. webpack require wrappers
  if (FUNCTION_NAME_FILTERS.some((regexp) => regexp.test(functionName))) {
    return false
github bentonam / fakeit / packages / fakeit-core / src / error.js View on Github external
function processFrameFn (frame: Object): Object {
  // fixes a weird bug with `wrapCallSite`
  frame.isNative = () => false

  let file = frame.getFileName()

  frame = wrapCallSite(frame)
  if (file.includes('fakeit')) {
    file = file.replace('dist', 'src')
      .replace(/jsx$/, 'js')
    frame.getFileName = () => file
    frame.getScriptNameOrSourceURL = () => file
  }

  return frame
}
github strues / boldr / web / src / server / utils / debugUtil.js View on Github external
export function prepareStackTrace(nativeError, structuredStackTrace) {
  const frames = getRelevantFrames(structuredStackTrace);
  const firstFrame = frames[0];
  // Need the first frame for highlighting affected source code, sometimes that's not available.
  if (firstFrame != null) {
    const wrappedFirstFrame = wrapCallSite(firstFrame);
    const sourceFile = cleanSourceFileName(wrappedFirstFrame.getFileName());

    let sourceText = '';
    try {
      sourceText = readFileSync(sourceFile, 'utf-8');
    } catch (error) {
      // Ignore errors
    }

    // Generate highlighted code frame and attach it to the native error object (for later usage)
    if (sourceText) {
      const result = codeFrame(
        sourceText,
        wrappedFirstFrame.getLineNumber(),
        wrappedFirstFrame.getColumnNumber(),
        CODE_FRAME_OPTIONS,
github sebastian-software / edgestack / src / server / generateStacktrace.js View on Github external
function frameToString(frame)
{
  const wrappedFrame = wrapCallSite(frame)

  const name = wrappedFrame.getFunctionName() || `${wrappedFrame.getTypeName()}.`
  const sourceFilePointer = wrappedFrame.getFileName()
  const generatedFile = frame.getFileName()
  const lineNumber = wrappedFrame.getLineNumber()
  const columnNumber = wrappedFrame.getColumnNumber()
  const isCompiled = sourceFilePointer !== generatedFile
  let sourceFile = generatedFile

  if (isCompiled)
    sourceFile = `.${sourceFilePointer.split(":")[1]}`
  else if (!SHOW_EXTENDED_STACKTRACE)
    return null

  const toParsed = () => ({
    name,
github ember-fastboot / fastboot / src / install-source-map-support.js View on Github external
return error + stack.map(function(frame) {
    return '\n    at ' + sourceMapSupport.wrapCallSite(frame);
  }).join('');
}

source-map-support

Fixes stack traces for files with source maps

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis

Similar packages