utils.js 373 B

123456789101112131415161718192021
  1. const { sep } = require('path')
  2. // copied from https://github.com/nuxt/consola/blob/master/src/utils/error.js
  3. function parseStack (stack) {
  4. const cwd = process.cwd() + sep
  5. const lines = stack
  6. .split('\n')
  7. .splice(1)
  8. .map(l => l
  9. .trim()
  10. .replace('file://', '')
  11. .replace(cwd, '')
  12. )
  13. return lines
  14. }
  15. module.exports = {
  16. parseStack
  17. }