0.0.1 • Published 3 years ago

cbk-monitor-source-map-parser v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

@cbk/monitor-source-map-parser

此库为 node cli 工具库,用于服务端执行子进程 shell,解析出 sourcemap 源码(输出日志中获取)

参数

需提供默认参数 文件名,行号参数 --line ,列号参数 --column

返回值

{
  "source": "",
  "line": 0,
  "column": 0,
  "name": ""
}
  • source {string} 源代码
  • line {number} 行号
  • column {number} 列号
  • name {string} 名称

nodejs 使用示例

const child_process = require('node:child_process');

try {
  const output = child_process.execSync(
    'cbk-source-map-parser /path/to/project-name/version/main.js.map --line 10 --column 10',
    {
      encoding: 'utf-8',
    },
  );

  console.log(output);
} catch (e) {
  console.log(e);
}