clean-stack
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -1,21 +0,19 @@ | ||
declare namespace cleanStack { | ||
interface Options { | ||
/** | ||
Prettify the file paths in the stack: | ||
export interface Options { | ||
/** | ||
Prettify the file paths in the stack: | ||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15` | ||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15` | ||
@default false | ||
*/ | ||
readonly pretty?: boolean; | ||
@default false | ||
*/ | ||
readonly pretty?: boolean; | ||
/** | ||
Remove the given base path from stack trace file paths, effectively turning absolute paths into relative ones. | ||
/** | ||
Remove the given base path from stack trace file paths, effectively turning absolute paths into relative ones. | ||
Example with `'/Users/sindresorhus/dev/clean-stack/'` as `basePath`: | ||
Example with `'/Users/sindresorhus/dev/clean-stack/'` as `basePath`: | ||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `unicorn.js:2:15` | ||
*/ | ||
readonly basePath?: string; | ||
} | ||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `unicorn.js:2:15` | ||
*/ | ||
readonly basePath?: string; | ||
} | ||
@@ -30,3 +28,3 @@ | ||
``` | ||
import cleanStack = require('clean-stack'); | ||
import cleanStack from 'clean-stack'; | ||
@@ -52,7 +50,2 @@ const error = new Error('Missing unicorn'); | ||
*/ | ||
declare function cleanStack( | ||
stack: string, | ||
options?: cleanStack.Options | ||
): string; | ||
export = cleanStack; | ||
export default function cleanStack(stack: string, options?: Options): string; |
@@ -1,4 +0,3 @@ | ||
'use strict'; | ||
const os = require('os'); | ||
const escapeStringRegexp = require('escape-string-regexp'); | ||
import os from 'os'; | ||
import escapeStringRegexp from 'escape-string-regexp'; | ||
@@ -9,3 +8,3 @@ const extractPathRegex = /\s+at.*[(\s](.*)\)?/; | ||
module.exports = (stack, {pretty = false, basePath} = {}) => { | ||
export default function cleanStack(stack, {pretty = false, basePath} = {}) { | ||
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath)}`, 'g'); | ||
@@ -46,2 +45,2 @@ | ||
.join('\n'); | ||
}; | ||
} |
{ | ||
"name": "clean-stack", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Clean up error stack traces", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
}, | ||
@@ -33,8 +35,8 @@ "scripts": { | ||
"dependencies": { | ||
"escape-string-regexp": "4.0.0" | ||
"escape-string-regexp": "5.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"tsd": "^0.11.0", | ||
"xo": "^0.32.0" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
}, | ||
@@ -41,0 +43,0 @@ "browser": { |
@@ -1,2 +0,2 @@ | ||
# clean-stack [![Build Status](https://travis-ci.com/sindresorhus/clean-stack.svg?branch=master)](https://travis-ci.com/github/sindresorhus/clean-stack) | ||
# clean-stack | ||
@@ -18,3 +18,3 @@ > Clean up error stack traces | ||
```js | ||
const cleanStack = require('clean-stack'); | ||
import cleanStack from 'clean-stack'; | ||
@@ -21,0 +21,0 @@ const error = new Error('Missing unicorn'); |
Yes
6187
72
+ Addedescape-string-regexp@5.0.0(transitive)
- Removedescape-string-regexp@4.0.0(transitive)
Updatedescape-string-regexp@5.0.0