@thi.ng/errors
Advanced tools
Comparing version 1.3.4 to 2.0.0
@@ -6,21 +6,33 @@ # Change Log | ||
## [1.3.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.3.3...@thi.ng/errors@1.3.4) (2021-08-08) | ||
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.3.4...@thi.ng/errors@2.0.0) (2021-10-12) | ||
**Note:** Version bump only for package @thi.ng/errors | ||
### Build System | ||
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6)) | ||
### Features | ||
## [1.3.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.3.2...@thi.ng/errors@1.3.3) (2021-08-08) | ||
* **errors:** add snowpack env var support for assert ([52822b1](https://github.com/thi-ng/umbrella/commit/52822b18160949a0a1eefa82e5e667cd0811cd89)) | ||
* **errors:** migrate assert() from thi.ng/api ([7030a6a](https://github.com/thi-ng/umbrella/commit/7030a6aecd50367cbc08bccb13e05b3af41f4eca)) | ||
**Note:** Version bump only for package @thi.ng/errors | ||
### BREAKING CHANGES | ||
* discontinue CommonJS & UMD versions | ||
- only ESM modules will be published from now on | ||
- CJS obsolete due to ESM support in recent versions of node: | ||
- i.e. launch NodeJS via: | ||
- `node --experimental-specifier-resolution=node --experimental-repl-await` | ||
- in the node REPL use `await import(...)` instead of `require()` | ||
- UMD obsolete due to widespread browser support for ESM | ||
Also: | ||
- normalize/restructure/reorg all package.json files | ||
- cleanup all build scripts, remove obsolete | ||
- switch from mocha to @thi.ng/testament for all tests | ||
## [1.3.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.3.1...@thi.ng/errors@1.3.2) (2021-07-01) | ||
**Note:** Version bump only for package @thi.ng/errors | ||
@@ -30,56 +42,37 @@ | ||
# [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.2.32...@thi.ng/errors@1.3.0) (2021-03-17) | ||
## [1.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.3.0...@thi.ng/errors@1.3.1) (2021-06-08) | ||
### Features | ||
**Note:** Version bump only for package @thi.ng/errors | ||
- **errors:** add ensureIndex2(), update outOfBounds() arg type ([ab007d6](https://github.com/thi-ng/umbrella/commit/ab007d6b502c3d1650c7e9cf50da05f0ac042ef3)) | ||
- **errors:** add outOfBounds(), ensureIndex() ([fb5ca0a](https://github.com/thi-ng/umbrella/commit/fb5ca0a7f8a4a6648d3c8485a9108e9154ee4400)) | ||
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.1.2...@thi.ng/errors@1.2.0) (2019-08-21) | ||
### Features | ||
- **errors:** add defError(), refactor all existing, update readme ([ded89c2](https://github.com/thi-ng/umbrella/commit/ded89c2)) | ||
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.0.6...@thi.ng/errors@1.1.0) (2019-07-07) | ||
# [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.2.32...@thi.ng/errors@1.3.0) (2021-03-17) | ||
### Features | ||
- **errors:** enable TS strict compiler flags (refactor) ([8460aea](https://github.com/thi-ng/umbrella/commit/8460aea)) | ||
### Features | ||
# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@0.1.12...@thi.ng/errors@1.0.0) (2019-01-21) | ||
* **errors:** add ensureIndex2(), update outOfBounds() arg type ([ab007d6](https://github.com/thi-ng/umbrella/commit/ab007d6b502c3d1650c7e9cf50da05f0ac042ef3)) | ||
* **errors:** add outOfBounds(), ensureIndex() ([fb5ca0a](https://github.com/thi-ng/umbrella/commit/fb5ca0a7f8a4a6648d3c8485a9108e9154ee4400)) | ||
### Build System | ||
- update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703)) | ||
### BREAKING CHANGES | ||
- enabled multi-outputs (ES6 modules, CJS, UMD) | ||
- build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib` | ||
- all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols. | ||
# 0.1.0 (2018-05-10) | ||
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.1.2...@thi.ng/errors@1.2.0) (2019-08-21) | ||
### Features | ||
### Features | ||
* **errors:** add defError(), refactor all existing, update readme ([ded89c2](https://github.com/thi-ng/umbrella/commit/ded89c2)) | ||
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@1.0.6...@thi.ng/errors@1.1.0) (2019-07-07) | ||
### Features | ||
* **errors:** enable TS strict compiler flags (refactor) ([8460aea](https://github.com/thi-ng/umbrella/commit/8460aea)) | ||
# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/errors@0.1.12...@thi.ng/errors@1.0.0) (2019-01-21) | ||
### Build System | ||
* update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703)) | ||
### BREAKING CHANGES | ||
* enabled multi-outputs (ES6 modules, CJS, UMD) | ||
- build scripts now first build ES6 modules in package root, then call | ||
`scripts/bundle-module` to build minified CJS & UMD bundles in `/lib` | ||
- all imports MUST be updated to only refer to package level | ||
(not individual files anymore). tree shaking in user land will get rid of | ||
all unused imported symbols. | ||
<a name="0.1.0"></a> | ||
# 0.1.0 (2018-05-10) | ||
### Features | ||
* **errors:** add new package [@thi](https://github.com/thi).ng/errors ([1e97856](https://github.com/thi-ng/umbrella/commit/1e97856)) | ||
- **errors:** add new package [@thi](https://github.com/thi).ng/errors ([1e97856](https://github.com/thi-ng/umbrella/commit/1e97856)) |
/// <reference types="node" /> | ||
export declare const defError: <T>(prefix: (msg?: T | undefined) => string, suffix?: (msg?: T | undefined) => string) => { | ||
export declare const defError: <T = string>(prefix: (msg?: T | undefined) => string, suffix?: (msg?: T | undefined) => string) => { | ||
new (msg?: T | undefined): { | ||
@@ -4,0 +4,0 @@ name: string; |
export * from "./deferror"; | ||
export * from "./assert"; | ||
export * from "./illegal-arguments"; | ||
@@ -3,0 +4,0 @@ export * from "./illegal-arity"; |
export * from "./deferror"; | ||
export * from "./assert"; | ||
export * from "./illegal-arguments"; | ||
@@ -3,0 +4,0 @@ export * from "./illegal-arity"; |
{ | ||
"name": "@thi.ng/errors", | ||
"version": "1.3.4", | ||
"version": "2.0.0", | ||
"description": "Custom error types and error factory functions", | ||
"type": "module", | ||
"module": "./index.js", | ||
"main": "./lib/index.js", | ||
"umd:main": "./lib/index.umd.js", | ||
"typings": "./index.d.ts", | ||
"sideEffects": false, | ||
"repository": { | ||
@@ -27,21 +27,16 @@ "type": "git", | ||
"scripts": { | ||
"build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module", | ||
"build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all", | ||
"build:es6": "tsc --declaration", | ||
"build:test": "rimraf build && tsc -p test/tsconfig.json", | ||
"build:check": "tsc --isolatedModules --noEmit", | ||
"test": "mocha test", | ||
"cover": "nyc mocha test && nyc report --reporter=lcov", | ||
"clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib", | ||
"doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts", | ||
"doc": "typedoc --excludePrivate --out doc --theme ../../tools/doc/typedoc-theme src/index.ts", | ||
"build": "yarn clean && tsc --declaration", | ||
"clean": "rimraf *.js *.d.ts *.map doc", | ||
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts", | ||
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose", | ||
"pub": "yarn build:release && yarn publish --access public" | ||
"doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts", | ||
"doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts", | ||
"pub": "yarn build && yarn publish --access public", | ||
"test": "testament test" | ||
}, | ||
"files": [ | ||
"*.js", | ||
"*.d.ts", | ||
"lib" | ||
], | ||
"devDependencies": { | ||
"@thi.ng/testament": "^0.1.0" | ||
}, | ||
"keywords": [ | ||
"assert", | ||
"error", | ||
@@ -57,7 +52,36 @@ "typescript" | ||
}, | ||
"sideEffects": false, | ||
"files": [ | ||
"*.js", | ||
"*.d.ts" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./index.js" | ||
}, | ||
"./assert": { | ||
"import": "./assert.js" | ||
}, | ||
"./deferror": { | ||
"import": "./deferror.js" | ||
}, | ||
"./illegal-arguments": { | ||
"import": "./illegal-arguments.js" | ||
}, | ||
"./illegal-arity": { | ||
"import": "./illegal-arity.js" | ||
}, | ||
"./illegal-state": { | ||
"import": "./illegal-state.js" | ||
}, | ||
"./out-of-bounds": { | ||
"import": "./out-of-bounds.js" | ||
}, | ||
"./unsupported": { | ||
"import": "./unsupported.js" | ||
} | ||
}, | ||
"thi.ng": { | ||
"year": 2018 | ||
}, | ||
"gitHead": "538019e9d8ca6c5fee4754af93ad454c0674dc72" | ||
"gitHead": "9ac1344b38b565eb894306fbf72233b6c0b2d115" | ||
} |
@@ -17,2 +17,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
- [API](#api) | ||
- [Environment variables](#environment-variables) | ||
- [Authors](#authors) | ||
@@ -25,3 +26,12 @@ - [License](#license) | ||
Additional error types can be defined using | ||
This package defines the following error types & helper functions to throw them: | ||
- [`AssertionError`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/assert.ts) | ||
- [`IllegalArgumentError`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/illegal-arguments.ts) | ||
- [`IllegalArityError`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/illegal-arity.ts) | ||
- [`IllegalStateError`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/illegal-statre.ts) | ||
- [`OutOfBoundsError`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/out-of-bounds.ts) | ||
- [`UnsupportedOperationError`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/unsupported.ts) | ||
Custom error types can be easily defined using | ||
[`defError()`](https://github.com/thi-ng/umbrella/tree/develop/packages/errors/src/deferror.ts). | ||
@@ -41,11 +51,19 @@ | ||
ES module import: | ||
```html | ||
// ES module | ||
<script type="module" src="https://unpkg.com/@thi.ng/errors?module" crossorigin></script> | ||
<script type="module" src="https://cdn.skypack.dev/@thi.ng/errors"></script> | ||
``` | ||
// UMD | ||
<script src="https://unpkg.com/@thi.ng/errors/lib/index.umd.js" crossorigin></script> | ||
[Skypack documentation](https://docs.skypack.dev/) | ||
For NodeJS (v14.6+): | ||
```text | ||
node --experimental-specifier-resolution=node --experimental-repl-await | ||
> const errors = await import("@thi.ng/errors"); | ||
``` | ||
Package sizes (gzipped, pre-treeshake): ESM: 356 bytes / CJS: 448 bytes / UMD: 508 bytes | ||
Package sizes (gzipped, pre-treeshake): ESM: 538 bytes | ||
@@ -91,2 +109,10 @@ ## Dependencies | ||
### Environment variables | ||
The `UMBRELLA_ASSERTS` or `SNOWPACK_PUBLIC_UMBRELLA_ASSERTS` env variables are | ||
used to control the behavior of the `assert()` function in production builds: If | ||
either is set (to a non-empty string), the function will **always** be enabled. | ||
Otherwise (by default), `assert()` will be **disabled for production builds**, | ||
i.e. if `process.env.NODE_ENV === "production"`. | ||
## Authors | ||
@@ -93,0 +119,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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances 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
199
132
Yes
28248
1
20
3