summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/clean-stack
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@github.com>2020-10-02 17:52:19 -0400
committerMyles Borins <mylesborins@github.com>2020-10-07 09:59:49 -0400
commit2e545249557c265f7d5f338cc3a382985211603c (patch)
treea18ca49252a58cc5a80cd438a020a99bf48a8d23 /deps/npm/node_modules/clean-stack
parent14699846452e627f97dedb85991eea67d932a79d (diff)
downloadnode-new-2e545249557c265f7d5f338cc3a382985211603c.tar.gz
deps: update npm to 7.0.0-rc.3
PR-URL: https://github.com/nodejs/node/pull/35474 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/clean-stack')
-rw-r--r--deps/npm/node_modules/clean-stack/index.d.ts47
-rw-r--r--deps/npm/node_modules/clean-stack/index.js40
-rw-r--r--deps/npm/node_modules/clean-stack/license9
-rw-r--r--deps/npm/node_modules/clean-stack/package.json39
-rw-r--r--deps/npm/node_modules/clean-stack/readme.md76
5 files changed, 211 insertions, 0 deletions
diff --git a/deps/npm/node_modules/clean-stack/index.d.ts b/deps/npm/node_modules/clean-stack/index.d.ts
new file mode 100644
index 0000000000..ed58995094
--- /dev/null
+++ b/deps/npm/node_modules/clean-stack/index.d.ts
@@ -0,0 +1,47 @@
+declare namespace cleanStack {
+ 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`
+
+ @default false
+ */
+ readonly pretty?: boolean;
+ }
+}
+
+/**
+Clean up error stack traces. Removes the mostly unhelpful internal Node.js entries.
+
+@param stack - The `stack` property of an `Error`.
+
+@example
+```
+import cleanStack = require('clean-stack');
+
+const error = new Error('Missing unicorn');
+
+console.log(error.stack);
+
+// Error: Missing unicorn
+// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
+// at Module._compile (module.js:409:26)
+// at Object.Module._extensions..js (module.js:416:10)
+// at Module.load (module.js:343:32)
+// at Function.Module._load (module.js:300:12)
+// at Function.Module.runMain (module.js:441:10)
+// at startup (node.js:139:18)
+
+console.log(cleanStack(error.stack));
+
+// Error: Missing unicorn
+// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
+```
+*/
+declare function cleanStack(
+ stack: string,
+ options?: cleanStack.Options
+): string;
+
+export = cleanStack;
diff --git a/deps/npm/node_modules/clean-stack/index.js b/deps/npm/node_modules/clean-stack/index.js
new file mode 100644
index 0000000000..8c1dcc4cd0
--- /dev/null
+++ b/deps/npm/node_modules/clean-stack/index.js
@@ -0,0 +1,40 @@
+'use strict';
+const os = require('os');
+
+const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/;
+const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;
+const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir();
+
+module.exports = (stack, options) => {
+ options = Object.assign({pretty: false}, options);
+
+ return stack.replace(/\\/g, '/')
+ .split('\n')
+ .filter(line => {
+ const pathMatches = line.match(extractPathRegex);
+ if (pathMatches === null || !pathMatches[1]) {
+ return true;
+ }
+
+ const match = pathMatches[1];
+
+ // Electron
+ if (
+ match.includes('.app/Contents/Resources/electron.asar') ||
+ match.includes('.app/Contents/Resources/default_app.asar')
+ ) {
+ return false;
+ }
+
+ return !pathRegex.test(match);
+ })
+ .filter(line => line.trim() !== '')
+ .map(line => {
+ if (options.pretty) {
+ return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));
+ }
+
+ return line;
+ })
+ .join('\n');
+};
diff --git a/deps/npm/node_modules/clean-stack/license b/deps/npm/node_modules/clean-stack/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/deps/npm/node_modules/clean-stack/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/clean-stack/package.json b/deps/npm/node_modules/clean-stack/package.json
new file mode 100644
index 0000000000..719fdff55e
--- /dev/null
+++ b/deps/npm/node_modules/clean-stack/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "clean-stack",
+ "version": "2.2.0",
+ "description": "Clean up error stack traces",
+ "license": "MIT",
+ "repository": "sindresorhus/clean-stack",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "clean",
+ "stack",
+ "trace",
+ "traces",
+ "error",
+ "err",
+ "electron"
+ ],
+ "devDependencies": {
+ "ava": "^1.4.1",
+ "tsd": "^0.7.2",
+ "xo": "^0.24.0"
+ },
+ "browser": {
+ "os": false
+ }
+}
diff --git a/deps/npm/node_modules/clean-stack/readme.md b/deps/npm/node_modules/clean-stack/readme.md
new file mode 100644
index 0000000000..8d44160468
--- /dev/null
+++ b/deps/npm/node_modules/clean-stack/readme.md
@@ -0,0 +1,76 @@
+# clean-stack [![Build Status](https://travis-ci.org/sindresorhus/clean-stack.svg?branch=master)](https://travis-ci.org/sindresorhus/clean-stack)
+
+> Clean up error stack traces
+
+Removes the mostly unhelpful internal Node.js entries.
+
+Also works in Electron.
+
+
+## Install
+
+```
+$ npm install clean-stack
+```
+
+
+## Usage
+
+```js
+const cleanStack = require('clean-stack');
+
+const error = new Error('Missing unicorn');
+
+console.log(error.stack);
+/*
+Error: Missing unicorn
+ at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
+ at Module._compile (module.js:409:26)
+ at Object.Module._extensions..js (module.js:416:10)
+ at Module.load (module.js:343:32)
+ at Function.Module._load (module.js:300:12)
+ at Function.Module.runMain (module.js:441:10)
+ at startup (node.js:139:18)
+*/
+
+console.log(cleanStack(error.stack));
+/*
+Error: Missing unicorn
+ at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
+*/
+```
+
+
+## API
+
+### cleanStack(stack, [options])
+
+#### stack
+
+Type: `string`
+
+The `stack` property of an `Error`.
+
+#### options
+
+Type: `Object`
+
+##### pretty
+
+Type: `boolean`<br>
+Default: `false`
+
+Prettify the file paths in the stack:
+
+`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`
+
+
+## Related
+
+- [extrack-stack](https://github.com/sindresorhus/extract-stack) - Extract the actual stack of an error
+- [stack-utils](https://github.com/tapjs/stack-utils) - Captures and cleans stack traces
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)