Comparing version 1.0.3 to 1.1.0
# History | ||
## v1.1.0 2018 December 28 | ||
- Updated [base files](https://github.com/bevry/base) and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
## v1.0.3 2018 August 19 | ||
- Add duck typing for node version 4 and under | ||
- Prevent additional crashes on node version 4 | ||
- Add duck typing for node version 4 and under | ||
- Prevent additional crashes on node version 4 | ||
## v1.0.2 2018 July 27 | ||
- More effecient node version 4 crash prevention | ||
- More effecient node version 4 crash prevention | ||
## v1.0.1 2018 July 27 | ||
- Support node version 0.8 | ||
- Prevent a peculiar crash on node version 4 | ||
- Support node version 0.8 | ||
- Prevent a peculiar crash on node version 4 | ||
## v1.0.0 2018 July 21 | ||
- Initial working release | ||
- Initial working release |
'use strict' | ||
/** @type {typeof import("./source/index.js") } */ | ||
module.exports = require('editions').requirePackage(__dirname, require) |
169
package.json
{ | ||
"name": "errlop", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "An extended Error class that envelops a parent error, such that the stack trace contains the causation", | ||
@@ -25,14 +25,20 @@ "homepage": "https://github.com/bevry/errlop", | ||
"patreon", | ||
"flattr", | ||
"liberapay", | ||
"thanksapp", | ||
"boostlab", | ||
"buymeacoffee", | ||
"opencollective", | ||
"flattr", | ||
"crypto", | ||
"paypal", | ||
"bitcoin", | ||
"wishlist" | ||
], | ||
"config": { | ||
"buymeacoffeeUsername": "balupton", | ||
"cryptoURL": "https://bevry.me/crypto", | ||
"flattrUsername": "balupton", | ||
"liberapayUsername": "bevry", | ||
"opencollectiveUsername": "bevry", | ||
"patreonUsername": "bevry", | ||
"opencollectiveUsername": "bevry", | ||
"flattrUsername": "balupton", | ||
"paypalURL": "https://bevry.me/paypal", | ||
"bitcoinURL": "https://bevry.me/bitcoin", | ||
"wishlistURL": "https://bevry.me/wishlist" | ||
@@ -42,2 +48,8 @@ } | ||
"author": "2018+ Benjamin Lupton <b@lupton.cc>", | ||
"maintainers": [ | ||
"Benjamin Lupton (http://balupton.com)" | ||
], | ||
"contributors": [ | ||
"Benjamin Lupton (http://balupton.com)" | ||
], | ||
"bugs": { | ||
@@ -55,63 +67,134 @@ "url": "https://github.com/bevry/errlop/issues" | ||
{ | ||
"description": "Source + ESNext + Require", | ||
"description": "esnext source code with require for modules", | ||
"directory": "source", | ||
"entry": "index.js", | ||
"directory": "source", | ||
"syntaxes": [ | ||
"tags": [ | ||
"javascript", | ||
"esnext", | ||
"require" | ||
] | ||
], | ||
"engines": { | ||
"node": "6 || 8 || 10 || 11", | ||
"browsers": false | ||
} | ||
}, | ||
{ | ||
"description": "Babel Compiled + ES2015 + Require", | ||
"description": "esnext compiled for browsers with require for modules", | ||
"directory": "edition-browsers", | ||
"entry": "index.js", | ||
"directory": "es2015", | ||
"syntaxes": [ | ||
"tags": [ | ||
"javascript", | ||
"es2015", | ||
"require" | ||
] | ||
], | ||
"engines": { | ||
"node": false, | ||
"browsers": "defaults" | ||
} | ||
}, | ||
{ | ||
"description": "esnext compiled for node.js 0.8 with require for modules", | ||
"directory": "edition-node-0.8", | ||
"entry": "index.js", | ||
"tags": [ | ||
"javascript", | ||
"require" | ||
], | ||
"engines": { | ||
"node": "0.8 || 0.10 || 0.12 || 4 || 6 || 8 || 10 || 11", | ||
"browsers": false | ||
} | ||
} | ||
], | ||
"main": "index.js", | ||
"browser": "edition:node:0.8/index.js", | ||
"browser": "edition-browsers/index.js", | ||
"dependencies": { | ||
"editions": "^1.3.4" | ||
"editions": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"assert-helpers": "^4.5.1", | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"documentation": "^8.0.2", | ||
"eslint": "^5.1.0", | ||
"joe": "^2.0.2", | ||
"joe-reporter-console": "^2.0.1", | ||
"projectz": "^1.4.0", | ||
"surge": "^0.20.1" | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.2.2", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.2.0", | ||
"@babel/preset-env": "^7.2.3", | ||
"assert-helpers": "^4.9.3", | ||
"eslint": "^5.11.1", | ||
"eslint-config-bevry": "^1.0.2", | ||
"eslint-config-prettier": "^3.3.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"jsdoc": "^3.5.5", | ||
"kava": "^3.1.0", | ||
"minami": "^1.2.3", | ||
"prettier": "^1.15.3", | ||
"projectz": "^1.7.4", | ||
"surge": "^0.20.1", | ||
"valid-directory": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"our:setup": "npm run our:setup:npm", | ||
"our:setup:npm": "npm install", | ||
"our:clean": "rm -Rf ./docs ./es2015 ./es5 ./out", | ||
"our:compile": "npm run our:compile:es2015", | ||
"our:compile:es2015": "babel ./source --out-dir ./es2015 --presets es2015", | ||
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out", | ||
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-0.8", | ||
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source", | ||
"our:compile:edition-node-0.8": "env BABEL_ENV=edition-node-0.8 babel --out-dir ./edition-node-0.8 ./source", | ||
"our:deploy": "echo no need for this project", | ||
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz", | ||
"our:meta:docs": "documentation build -f html -o ./docs -g --shallow ./source/**.js", | ||
"our:meta:docs": "npm run our:meta:docs:jsdoc", | ||
"our:meta:docs:jsdoc": "rm -Rf ./docs && jsdoc --recurse --pedantic --access all --destination ./docs --package ./package.json --readme ./README.md --template ./node_modules/minami ./source && mv ./docs/$npm_package_name/$npm_package_version/* ./docs/ && rm -Rf ./docs/$npm_package_name/$npm_package_version", | ||
"our:meta:projectz": "projectz compile", | ||
"our:verify": "npm run our:verify:eslint", | ||
"our:verify:eslint": "eslint --fix ./source", | ||
"our:deploy": "echo no need for this project", | ||
"our:test": "npm run our:verify && npm test", | ||
"our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push", | ||
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta", | ||
"our:release:check-changelog": "cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)", | ||
"our:release:check-dirty": "git diff --exit-code", | ||
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta", | ||
"our:release:push": "git push origin master && git push origin --tags", | ||
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"", | ||
"our:release:push": "git push origin master && git push origin --tags", | ||
"test": "node --harmony ./test.js --joe-reporter=console" | ||
"our:setup": "npm run our:setup:npm", | ||
"our:setup:npm": "npm install", | ||
"our:test": "npm run our:verify && npm test", | ||
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint", | ||
"our:verify:directory": "npx valid-directory", | ||
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source", | ||
"test": "node ./test.js" | ||
}, | ||
"maintainers": [], | ||
"contributors": [ | ||
"Benjamin Lupton (http://balupton.com)" | ||
] | ||
"eslintConfig": { | ||
"extends": [ | ||
"bevry" | ||
] | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true | ||
}, | ||
"babel": { | ||
"env": { | ||
"edition-browsers": { | ||
"sourceType": "script", | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": "defaults", | ||
"modules": "commonjs" | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread" | ||
] | ||
}, | ||
"edition-node-0.8": { | ||
"sourceType": "script", | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "0.8" | ||
}, | ||
"modules": "commonjs" | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread" | ||
] | ||
} | ||
} | ||
} | ||
} |
@@ -17,6 +17,10 @@ <!-- TITLE/ --> | ||
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
<span class="badge-thanksapp"><a href="https://givethanks.app/donate/npm/errlop" title="Donate to this project using Thanks App"><img src="https://img.shields.io/badge/thanksapp-donate-yellow.svg" alt="Thanks App donate button" /></a></span> | ||
<span class="badge-boostlab"><a href="https://boost-lab.app/bevry/errlop" title="Donate to this project using Boost Lab"><img src="https://img.shields.io/badge/boostlab-donate-yellow.svg" alt="Boost Lab donate button" /></a></span> | ||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span> | ||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span> | ||
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span> | ||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span> | ||
@@ -38,25 +42,37 @@ | ||
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>NPM</h3></a><ul> | ||
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a> | ||
<ul> | ||
<li>Install: <code>npm install --save errlop</code></li> | ||
<li>Module: <code>require('errlop')</code></li></ul> | ||
<li>Require: <code>require('errlop')</code></li> | ||
</ul> | ||
<a href="http://browserify.org" title="Browserify lets you require('modules') in the browser by bundling up all of your dependencies"><h3>Browserify</h3></a><ul> | ||
<li>Install: <code>npm install --save errlop</code></li> | ||
<li>Module: <code>require('errlop')</code></li> | ||
<li>CDN URL: <code>//wzrd.in/bundle/errlop@1.0.3</code></li></ul> | ||
<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a> | ||
<a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul> | ||
<li>Install: <code>ender add errlop</code></li> | ||
<li>Module: <code>require('errlop')</code></li></ul> | ||
``` html | ||
<script type="module"> | ||
import * as pkg from '//dev.jspm.io/errlop' | ||
</script> | ||
``` | ||
<h3><a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3> | ||
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3> | ||
<p>This package is published with the following editions:</p> | ||
<ul><li><code>errlop</code> aliases <code>errlop/index.js</code> which uses <a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li> | ||
<li><code>errlop/source/index.js</code> is Source + <a href="https://babeljs.io/docs/learn-es2015/" title="ECMAScript Next">ESNext</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li> | ||
<li><code>errlop/es2015/index.js</code> is <a href="https://babeljs.io" title="The compiler for writing next generation JavaScript">Babel</a> Compiled + <a href="http://babeljs.io/docs/plugins/preset-es2015/" title="ECMAScript 2015">ES2015</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li></ul> | ||
<ul><li><code>errlop</code> aliases <code>errlop/index.js</code> which uses <a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li> | ||
<li><code>errlop/source/index.js</code> is esnext source code with require for modules</li> | ||
<li><code>errlop/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li> | ||
<li><code>errlop/edition-node-0.8/index.js</code> is esnext compiled for node.js 0.8 with require for modules</li></ul> | ||
<p>Older environments may need <a href="https://babeljs.io/docs/usage/polyfill/" title="A polyfill that emulates missing ECMAScript environment features">Babel's Polyfill</a> or something similar.</p> | ||
<h3><a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a></h3> | ||
This project provides its type information via inline <a href="http://usejsdoc.org" title="JSDoc is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor">JSDoc Comments</a>. To make use of this in <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a>, set your <code>maxNodeModuleJsDepth</code> compiler option to `5` or thereabouts. You can accomlish this via your `tsconfig.json` file like so: | ||
``` json | ||
{ | ||
"compilerOptions": { | ||
"maxNodeModuleJsDepth": 5 | ||
} | ||
} | ||
``` | ||
<!-- /INSTALL --> | ||
@@ -148,4 +164,6 @@ | ||
No maintainers yet! Will you be the first? | ||
These amazing people are maintaining this project: | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/errlop/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/errlop">view contributions</a></li></ul> | ||
<h3>Sponsors</h3> | ||
@@ -156,6 +174,10 @@ | ||
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
<span class="badge-thanksapp"><a href="https://givethanks.app/donate/npm/errlop" title="Donate to this project using Thanks App"><img src="https://img.shields.io/badge/thanksapp-donate-yellow.svg" alt="Thanks App donate button" /></a></span> | ||
<span class="badge-boostlab"><a href="https://boost-lab.app/bevry/errlop" title="Donate to this project using Boost Lab"><img src="https://img.shields.io/badge/boostlab-donate-yellow.svg" alt="Boost Lab donate button" /></a></span> | ||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span> | ||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span> | ||
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span> | ||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span> | ||
@@ -162,0 +184,0 @@ |
@@ -9,3 +9,3 @@ 'use strict' | ||
*/ | ||
function parseCode (code) { | ||
function parseCode(code) { | ||
const number = Number(code) | ||
@@ -22,5 +22,8 @@ if (isNaN(number)) return null | ||
*/ | ||
function fetchCode (value) { | ||
return value && ( | ||
parseCode(value.exitCode) || parseCode(value.errno) || parseCode(value.code) | ||
function fetchCode(value) { | ||
return ( | ||
value && | ||
(parseCode(value.exitCode) || | ||
parseCode(value.errno) || | ||
parseCode(value.code)) | ||
) | ||
@@ -35,3 +38,3 @@ } | ||
*/ | ||
function isValid (value) { | ||
function isValid(value) { | ||
/* eslint no-use-before-define:0 */ | ||
@@ -51,3 +54,3 @@ return value instanceof Error || Errlop.isErrlop(value) | ||
class Errlop extends Error { | ||
constructor (input, parent) { | ||
constructor(input, parent) { | ||
if (!input) throw new Error('Attempted to create an Errlop without a input') | ||
@@ -88,3 +91,7 @@ | ||
if (exitCode == null) exitCode = fetchCode(this) | ||
for (let index = 0; index < this.ancestors.length && exitCode == null; ++index) { | ||
for ( | ||
let index = 0; | ||
index < this.ancestors.length && exitCode == null; | ||
++index | ||
) { | ||
const error = this.ancestors[index] | ||
@@ -116,3 +123,6 @@ if (isValid(error)) exitCode = fetchCode(error) | ||
*/ | ||
this.stack = [this.orphanStack, ...this.ancestors].reduce((accumulator, error) => `${accumulator}\n↳ ${error.orphanStack || error.stack || error}`) | ||
this.stack = [this.orphanStack, ...this.ancestors].reduce( | ||
(accumulator, error) => | ||
`${accumulator}\n↳ ${error.orphanStack || error.stack || error}` | ||
) | ||
} | ||
@@ -128,3 +138,3 @@ | ||
*/ | ||
static create (...args) { | ||
static create(...args) { | ||
return new this(...args) | ||
@@ -140,3 +150,3 @@ } | ||
*/ | ||
static isErrlop (value) { | ||
static isErrlop(value) { | ||
return value && (value instanceof this || value.klass === this) | ||
@@ -152,3 +162,3 @@ } | ||
*/ | ||
static ensure (value) { | ||
static ensure(value) { | ||
return this.isErrlop(value) ? value : this.create(value) | ||
@@ -155,0 +165,0 @@ } |
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
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
42958
8
488
205
16
1
+ Addededitions@2.3.1(transitive)
+ Addederrlop@2.2.0(transitive)
+ Addedsemver@6.3.1(transitive)
- Removededitions@1.3.4(transitive)
Updatededitions@^2.1.0