údržba
This commit is contained in:
47
CyLukTs/lukan/node_modules/clean-stack/index.d.ts
generated
vendored
Normal file
47
CyLukTs/lukan/node_modules/clean-stack/index.d.ts
generated
vendored
Normal file
@ -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;
|
40
CyLukTs/lukan/node_modules/clean-stack/index.js
generated
vendored
Normal file
40
CyLukTs/lukan/node_modules/clean-stack/index.js
generated
vendored
Normal file
@ -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');
|
||||
};
|
9
CyLukTs/lukan/node_modules/clean-stack/license
generated
vendored
Normal file
9
CyLukTs/lukan/node_modules/clean-stack/license
generated
vendored
Normal file
@ -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.
|
39
CyLukTs/lukan/node_modules/clean-stack/package.json
generated
vendored
Normal file
39
CyLukTs/lukan/node_modules/clean-stack/package.json
generated
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
76
CyLukTs/lukan/node_modules/clean-stack/readme.md
generated
vendored
Normal file
76
CyLukTs/lukan/node_modules/clean-stack/readme.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# clean-stack [](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)
|
Reference in New Issue
Block a user