sourceMap.findEntry(lineOffset, columnOffset)


  • lineOffset <number> 生成的源中的零索引行号偏移量

    ¥lineOffset <number> The zero-indexed line number offset in the generated source

  • columnOffset <number> 生成的源中的零索引列号偏移量

    ¥columnOffset <number> The zero-indexed column number offset in the generated source

  • 返回:<Object>

    ¥Returns: <Object>

给定生成的源文件中的行偏移量和列偏移量,如果找到,则返回表示原始文件中的 SourceMap 范围的对象,如果没有,则返回空对象。

¥Given a line offset and column offset in the generated source file, returns an object representing the SourceMap range in the original file if found, or an empty object if not.

返回的对象包含以下键:

¥The object returned contains the following keys:

  • 生成行:<number> 生成的源中范围开始的行偏移量

    ¥generatedLine: <number> The line offset of the start of the range in the generated source

  • 生成的列:<number> 生成的源中范围开始的列偏移量

    ¥generatedColumn: <number> The column offset of start of the range in the generated source

  • 原文出处:<string> 原始源的文件名,如 SourceMap 中报告的那样

    ¥originalSource: <string> The file name of the original source, as reported in the SourceMap

  • 原行:<number> 原始源中范围开始的行偏移量

    ¥originalLine: <number> The line offset of the start of the range in the original source

  • 原文栏目:<number> 原始源中范围开始的列偏移量

    ¥originalColumn: <number> The column offset of start of the range in the original source

  • 名称:<string>

    ¥name: <string>

返回的值表示 SourceMap 中显示的原始范围,基于零索引偏移量,而不是错误消息和 CallSite 对象中显示的 1 索引行号和列号。

¥The returned value represents the raw range as it appears in the SourceMap, based on zero-indexed offsets, not 1-indexed line and column numbers as they appear in Error messages and CallSite objects.

要从错误堆栈和 CallSite 对象报告的行号和列号中获取相应的 1 索引行号和列号,请使用 sourceMap.findOrigin(lineNumber, columnNumber)

¥To get the corresponding 1-indexed line and column numbers from a lineNumber and columnNumber as they are reported by Error stacks and CallSite objects, use sourceMap.findOrigin(lineNumber, columnNumber)

Node.js 中文网 - 粤ICP备13048890号