@artdeco/clean-stack
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -0,1 +1,10 @@ | ||
## 5 April 2020 | ||
### [1.2.0](https://gitlab.com/artdeco/clean-stack/compare/v1.1.1...v1.2.0) | ||
- [package] Migrate to _GitLab_. | ||
- [fix] Prettify on Windows too. | ||
- [feature] Ignore `@artdeco/pirates`. | ||
- [feature] Compile the package. | ||
## 10 April 2019 | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "@artdeco/clean-stack", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A utility to remove internal Node.JS lines and specific modules from error stacks.", | ||
"main": "build/index.js", | ||
"main": "compile/index.js", | ||
"module": "src/index.js", | ||
"scripts": { | ||
"t": "zoroaster -a", | ||
"test": "yarn t test/mask", | ||
"mask": "yarn t test/mask", | ||
"test-build": "ALAMODE_ENV=test-build yarn test", | ||
"test-watch": "yarn test -w", | ||
"lint": "eslint .", | ||
"doc": "NODE_DEBUG=doc doc documentary -o README.md", | ||
"b": "alamode src -o build -s", | ||
"d": "typal src -c", | ||
"externs": "typal externs.js -e", | ||
"build": "yarn-s d b doc", | ||
"rec": "NODE_DEBUG=appshot appshot -T 23 -a Terminal -y 150 -f", | ||
"e": "alanode", | ||
"example/": "yarn e example/example.js" | ||
}, | ||
"files": [ | ||
"build", | ||
"compile", | ||
"src", | ||
"externs.js" | ||
"types/externs.js", | ||
"typedefs.json" | ||
], | ||
"externs": "externs.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/artdecocode/clean-stack.git" | ||
}, | ||
"externs": "types/externs.js", | ||
"repository": "gitlab:artdeco/clean-stack", | ||
"typedefs": "typedefs.json", | ||
"keywords": [ | ||
@@ -43,14 +26,20 @@ "@artdeco/clean-stack", | ||
"author": "Anton <anton@adc.sh>", | ||
"license": "MIT", | ||
"license": "AGPL-3.0", | ||
"bugs": { | ||
"url": "https://github.com/artdecocode/clean-stack/issues" | ||
"url": "https://gitlab.com/artdeco/issues/-/issues", | ||
"email": "incoming+artdeco-issues-17934443-issue-@incoming.gitlab.com" | ||
}, | ||
"homepage": "https://github.com/artdecocode/clean-stack#readme", | ||
"homepage": "https://www.artd.eco", | ||
"devDependencies": { | ||
"alamode": "^1.9.2", | ||
"documentary": "^1.23.4", | ||
"@artdeco/scripts.json": "^1.0.1", | ||
"alamode": "^3.7.1", | ||
"depack": "^1.1.2", | ||
"documentary": "^1.38.1", | ||
"eslint-config-artdeco": "1.0.1", | ||
"yarn-s": "1.1.0", | ||
"zoroaster": "^3.11.4" | ||
"yarn-s": "1.2.3", | ||
"zoroaster": "^4.3.0" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.com" | ||
} | ||
} |
@@ -0,9 +1,17 @@ | ||
<div align="center"> | ||
# @artdeco/clean-stack | ||
[![npm version](https://badge.fury.io/js/%40artdeco%2Fclean-stack.svg)](https://npmjs.org/package/@artdeco/clean-stack) | ||
[![npm version](https://badge.fury.io/js/%40artdeco%2Fclean-stack.svg)](https://www.npmjs.com/package/@artdeco/clean-stack) | ||
<a href="https://gitlab.com/artdeco/clean-stack/-/commits/master"> | ||
<img src="https://gitlab.com/artdeco/clean-stack/badges/master/pipeline.svg" alt="Pipeline Badge"> | ||
</a> | ||
`@artdeco/clean-stack` is a fork of clean-stack to remove internal Node.js lines from error stacks, as well as lines from specific modules. | ||
</div> | ||
`@artdeco/clean-stack` is used to remove internal _Node.JS_ lines from error stacks, as well as lines from specific modules. | ||
```sh | ||
yarn add -E @artdeco/clean-stack | ||
yarn add @artdeco/clean-stack | ||
npm i @artdeco/clean-stack | ||
``` | ||
@@ -15,6 +23,10 @@ | ||
- [API](#api) | ||
- [`cleanStack(stack: string, options?: Config)`](#cleanstackstack-stringoptions-config-void) | ||
- [`cleanStack(stack, options=): string`](#cleanstackstack-stringoptions-config-string) | ||
* [`Config`](#type-config) | ||
- [Copyright](#copyright) | ||
- [Copyright & License](#copyright--license) | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/0.svg?sanitize=true"> | ||
</a></div> | ||
## API | ||
@@ -28,13 +40,18 @@ | ||
## `cleanStack(`<br/> `stack: string,`<br/> `options?: Config,`<br/>`): void` | ||
## <code><ins>cleanStack</ins>(</code><sub><br/> `stack: string,`<br/> `options=: !Config,`<br/></sub><code>): <i>string</i></code> | ||
Remove internal Node.JS lines from the error stack traces. | ||
- <kbd><strong>stack*</strong></kbd> <em>`string`</em>: The stack to clean. | ||
- <kbd>options</kbd> <em><code><a href="#type-config" title="Options for the program.">!Config</a></code></em> (optional): Additional options. | ||
__<a name="type-config">`Config`</a>__: Options for the program. | ||
| Name | Type | Description | Default | | ||
| ------------- | --------------------- | ------------------------------------------------------------- | ------------- | | ||
| pretty | _boolean_ | Replace the absolute path to the home directory with the `~`. | `false` | | ||
| ignoreModules | _Array<string>_ | Which modules to ignore in the path. | `['pirates']` | | ||
Remove unuseful internal _Node.JS_ lines from the error stack. Any other modules to ignore can be passed in the `ignoreModules` option. | ||
| Name | Type | Description | Default | | ||
| -------------- | ----------------------------- | ------------------------------------------------------------- | ------------- | | ||
| pretty | <em>boolean</em> | Replace the absolute path to the home directory with the `~`. | `false` | | ||
| ignoredModules | <em>!Array<string></em> | Which modules to ignore in the path. | `['pirates']` | | ||
The example below will remove unuseful internal _Node.JS_ lines from the error stack. Any other modules to ignore can be passed in the `ignoreModules` option. | ||
```js | ||
@@ -66,6 +83,25 @@ /* yarn example/ */ | ||
## Copyright | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/1.svg?sanitize=true"> | ||
</a></div> | ||
(c) [Art Deco][1] 2019 | ||
## Copyright & License | ||
[1]: https://artd.eco | ||
[Original work](https://www.npmjs.com/package/clean-stack) by Sindre Sorhus under [MIT License](COPYING). | ||
<table> | ||
<tr> | ||
<th> | ||
<a href="https://www.artd.eco"> | ||
<img width="100" src="https://gitlab.com/uploads/-/system/group/avatar/7454762/artdeco.png" | ||
alt="Art Deco"> | ||
</a> | ||
</th> | ||
<th>© <a href="https://www.artd.eco">Art Deco™</a> 2020</th> | ||
<th><a href="LICENSE"><img src=".documentary/agpl-3.0.svg" alt="AGPL-3.0"></a></th> | ||
</tr> | ||
</table> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/-1.svg?sanitize=true"> | ||
</a></div> |
@@ -1,2 +0,2 @@ | ||
import { homedir } from 'os' | ||
import { homedir, EOL } from 'os' | ||
@@ -6,15 +6,9 @@ const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/ | ||
const homeDir = homedir() | ||
/** | ||
* Remove internal Node.JS lines from the error stack traces. | ||
* @param {string} stack The error stack to update. | ||
* @param {!_cleanStack.Config} [options] Options for the program. | ||
* @param {boolean} [options.pretty=false] Replace the absolute path to the home directory with the `~`. Default `false`. | ||
* @param {!Array<string>} [options.ignoredModules="['pirates']"] Which modules to ignore in the path. Default `['pirates']`. | ||
* @type {_cleanStack.cleanStack} | ||
*/ | ||
const cleanStack = (stack, options) => { | ||
const cleanStack = (stack, options = {}) => { | ||
const { | ||
pretty = false, ignoredModules = ['pirates'], | ||
} = options || {} | ||
pretty = false, ignoredModules = ['pirates', '@artdeco/pirates'], | ||
} = options | ||
const j = ignoredModules.join('|') | ||
@@ -24,3 +18,3 @@ const re = new RegExp(pathRegex.source.replace('IGNORED_MODULES', j)) | ||
return stack.replace(/\\/g, '/') | ||
.split('\n') | ||
.split(/\r?\n/) | ||
.filter(x => { | ||
@@ -45,3 +39,4 @@ const pathMatches = x.match(extractPathRegex) | ||
if (pretty) { | ||
return x.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~'))) | ||
const h = homedir().replace(/\\/g, '/') | ||
return x.replace(/\s+at.*(?:\(|\s)(.*)\)?/, (m, p1) => m.replace(p1, p1.replace(h, '~'))) | ||
} | ||
@@ -51,3 +46,3 @@ | ||
}) | ||
.join('\n') | ||
.join(EOL) | ||
} | ||
@@ -57,12 +52,5 @@ | ||
/* documentary types/index.xml */ | ||
/** | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {_cleanStack.Config} Config Options for the program. | ||
*/ | ||
/** | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {Object} _cleanStack.Config Options for the program. | ||
* @prop {boolean} [pretty=false] Replace the absolute path to the home directory with the `~`. Default `false`. | ||
* @prop {!Array<string>} [ignoredModules="['pirates']"] Which modules to ignore in the path. Default `['pirates']`. | ||
*/ | ||
* @typedef {import('..')} _cleanStack.cleanStack | ||
*/ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46612
12
133
104
7
2
70
1
1
1