Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
27
node_modules/stack-slice/.npmignore
generated
vendored
Normal file
27
node_modules/stack-slice/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
22
node_modules/stack-slice/LICENSE
generated
vendored
Normal file
22
node_modules/stack-slice/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Maurice Butler
|
||||
|
||||
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.
|
||||
|
||||
70
node_modules/stack-slice/README.md
generated
vendored
Normal file
70
node_modules/stack-slice/README.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# stack-slice
|
||||
|
||||
Slice a file or directory from the middle of an Error stack trace
|
||||
|
||||
## why
|
||||
|
||||
Sometimes you get an error at a point when you are the middle man, and you want to remove your function from the stack.
|
||||
|
||||
usualy if you are a masheling function and dont want to litter the stack with your implementation.
|
||||
|
||||
It is too late to use `captureStackTrace` thus this allows you to splice your call sites out of the stack.
|
||||
|
||||
## usage
|
||||
|
||||
###stackSlice(error, path[, allowPartialMatch])
|
||||
|
||||
|
||||
|
||||
``` javascript
|
||||
|
||||
var stackSlice = require('stack-slice'),
|
||||
error = new Error('BANG!!!');
|
||||
|
||||
// Assume error.stack is the following
|
||||
// Error: BANG!!!
|
||||
// at run (/foo/bar/myCoolModule/node_modules/someOtherModule/node_modulesrun.js:11:11)
|
||||
// at foo (/foo/bar/myCoolModule/node_modules/someOtherModule/run.js:11:11)
|
||||
// at bar (/foo/bar/myCoolModule/run.js:11:11)
|
||||
// at stuff (/foo/bar/myCoolModule/main.js:11:11)
|
||||
// at processImmediate [as _immediateCallback] (timers.js:11:11)
|
||||
|
||||
|
||||
stackSlice(error, '/foo/bar/myCoolModule/main.js');
|
||||
|
||||
|
||||
// error.stack is now
|
||||
// Error: BANG!!!
|
||||
// at run (/foo/bar/myCoolModule/node_modules/someOtherModule/node_modulesrun.js:11:11)
|
||||
// at foo (/foo/bar/myCoolModule/node_modules/someOtherModule/run.js:11:11)
|
||||
// at bar (/foo/bar/myCoolModule/run.js:11:11)
|
||||
// at processImmediate [as _immediateCallback] (timers.js:11:11)
|
||||
|
||||
|
||||
stackSlice(error, '/foo/bar/myCoolModule/node_modules/someOtherModule', true);
|
||||
|
||||
|
||||
// error.stack is now
|
||||
// Error: BANG!!!
|
||||
// at bar (/foo/bar/myCoolModule/run.js:11:11)
|
||||
// at processImmediate [as _immediateCallback] (timers.js:11:11)
|
||||
|
||||
|
||||
```
|
||||
|
||||
### more legitimate use
|
||||
|
||||
``` javascript
|
||||
|
||||
childModule.run(functionFromParentModule, function(error, result){
|
||||
if(error){
|
||||
|
||||
// remove all callsite for this module leaving parent and child
|
||||
stackSlice(error, __dirname, true);
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
callback(null, result);
|
||||
});
|
||||
|
||||
```
|
||||
27
node_modules/stack-slice/index.js
generated
vendored
Normal file
27
node_modules/stack-slice/index.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var fileNameRegex = /\(?((?:\w:\\|\/).*?):/;
|
||||
|
||||
function stackSlice(error, path, partialMatches){
|
||||
var callSites = error.stack.split('\n'),
|
||||
validCallSites = [];
|
||||
|
||||
for (var i = 0; i < callSites.length; i++) {
|
||||
var site = callSites[i],
|
||||
match = site.match(fileNameRegex),
|
||||
fileName;
|
||||
|
||||
if(match){
|
||||
fileName = match[1];
|
||||
|
||||
if(fileName === path || ~fileName.indexOf(path) && partialMatches){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
validCallSites.push(site);
|
||||
}
|
||||
|
||||
error.stack = validCallSites.join('\n');
|
||||
return error;
|
||||
}
|
||||
|
||||
module.exports = stackSlice;
|
||||
65
node_modules/stack-slice/package.json
generated
vendored
Normal file
65
node_modules/stack-slice/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "stack-slice@^1.0.0",
|
||||
"_id": "stack-slice@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-2/JZaKvjsqPbHTk57vobN1Ve3eY=",
|
||||
"_location": "/stack-slice",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "stack-slice@^1.0.0",
|
||||
"name": "stack-slice",
|
||||
"escapedName": "stack-slice",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/kgo"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/stack-slice/-/stack-slice-1.0.1.tgz",
|
||||
"_shasum": "dbf25968abe3b2a3db1d3939eefa1b37555edde6",
|
||||
"_spec": "stack-slice@^1.0.0",
|
||||
"_where": "D:\\dev\\xmap\\cm-oauth\\node_modules\\kgo",
|
||||
"author": {
|
||||
"name": "Maurice Butler",
|
||||
"email": "maurice.butler@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/MauriceButler/stack-slice/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Slice a file or directory from the middle of an Error stack trace",
|
||||
"devDependencies": {
|
||||
"tape": "^4.2.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"homepage": "https://github.com/MauriceButler/stack-slice#readme",
|
||||
"keywords": [
|
||||
"error",
|
||||
"stack",
|
||||
"trace",
|
||||
"stack-trace",
|
||||
"slice",
|
||||
"splice",
|
||||
"remove",
|
||||
"edit",
|
||||
"change"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "stack-slice",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MauriceButler/stack-slice.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node ./tests"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
78
node_modules/stack-slice/tests/index.js
generated
vendored
Normal file
78
node_modules/stack-slice/tests/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
var test = require('tape'),
|
||||
path = require('path'),
|
||||
stackSlice = require('../');
|
||||
|
||||
test('no touchy', function(t){
|
||||
t.plan(1);
|
||||
|
||||
var testError = new Error('BANG!!!!'),
|
||||
originalStack = testError.stack;
|
||||
|
||||
stackSlice(testError, 'something that wont match');
|
||||
|
||||
t.equal(originalStack, testError.stack, 'stack was not modified');
|
||||
});
|
||||
|
||||
test('exact match', function(t){
|
||||
t.plan(1);
|
||||
|
||||
var testError = new Error('BANG!!!!'),
|
||||
originalStack = testError.stack.split('\n');
|
||||
|
||||
originalStack.splice(1,1);
|
||||
|
||||
var expectedStack = originalStack.join('\n');
|
||||
|
||||
stackSlice(testError, __filename);
|
||||
|
||||
t.equal(testError.stack, expectedStack, 'stack was modified correctly');
|
||||
});
|
||||
|
||||
test('exact match with anonomous function', function(t){
|
||||
t.plan(1);
|
||||
|
||||
var testError = function(){
|
||||
return new Error('BANG!!!!');
|
||||
}(),
|
||||
originalStack = testError.stack.split('\n');
|
||||
|
||||
originalStack.splice(1,2);
|
||||
|
||||
var expectedStack = originalStack.join('\n');
|
||||
|
||||
stackSlice(testError, __filename);
|
||||
|
||||
t.equal(testError.stack, expectedStack, 'stack was modified correctly');
|
||||
});
|
||||
|
||||
test('partial match', function(t){
|
||||
t.plan(1);
|
||||
|
||||
var testError = new Error('BANG!!!!'),
|
||||
originalStack = testError.stack.split('\n'),
|
||||
expectedStack = [];
|
||||
|
||||
expectedStack.push(originalStack.shift());
|
||||
expectedStack.push(originalStack.pop());
|
||||
|
||||
stackSlice(testError, path.resolve(__dirname, '..'), true);
|
||||
|
||||
t.equal(testError.stack, expectedStack.join('\n'), 'stack was modified correctly');
|
||||
});
|
||||
|
||||
test('partial match with anonomous function', function(t){
|
||||
t.plan(1);
|
||||
|
||||
var testError = function(){
|
||||
return new Error('BANG!!!!');
|
||||
}(),
|
||||
originalStack = testError.stack.split('\n'),
|
||||
expectedStack = [];
|
||||
|
||||
expectedStack.push(originalStack.shift());
|
||||
expectedStack.push(originalStack.pop());
|
||||
|
||||
stackSlice(testError, path.resolve(__dirname, '..'), true);
|
||||
|
||||
t.equal(testError.stack, expectedStack.join('\n'), 'stack was modified correctly');
|
||||
});
|
||||
Reference in New Issue
Block a user