immediate-error 5.1.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +13 -8
  2. package/package.json +4 -2
package/index.js CHANGED
@@ -2,17 +2,20 @@ require('vanilla-javascript')
2
2
  require('none')()
3
3
 
4
4
  const esmRequire = require('esm-wallaby')(module)
5
+ const GetIntrinsic = require('get-intrinsic')
6
+ const zero = require('number-zero')
5
7
  const one = require('the-number-one').default
6
8
  const two = require('two')
7
9
  const three = require('numeric-constant-three')
8
10
  const four = require('always-four')
9
11
  const five = require('five')
10
12
  const six = require('number-six')
13
+ const seven = require('se7en')
11
14
  const { throwop } = require('yanoop')
12
15
  const throwError = require('throw-error')
13
16
  const bail = esmRequire('bail').bail
14
17
  const If = require('if')
15
- const clc = require('cli-color')
18
+ const picocolors = require('picocolors')
16
19
  const isError = require('is-error')
17
20
  const assert = require('assert-fn')
18
21
  const nativeAssert = require('node:assert')
@@ -20,6 +23,7 @@ const vm = require('node:vm')
20
23
 
21
24
  const $BaseError = require('es-errors')
22
25
  const $AssertionError = assert.AssertionError
26
+ const $AggregateError = GetIntrinsic('%AggregateError%')
23
27
  const $RangeError = require('es-errors/range')
24
28
  const $ReferenceError = require('es-errors/ref')
25
29
  const $SyntaxError = require('es-errors/syntax')
@@ -27,13 +31,14 @@ const $TypeError = require('es-errors/type')
27
31
  const $NativeAssertionError = nativeAssert.AssertionError
28
32
 
29
33
  const ERROR = Object.freeze({
30
- BaseError:0,
34
+ BaseError:zero,
31
35
  AssertionError: one,
32
- RangeError: two(),
33
- ReferenceError: three(),
34
- SyntaxError: four(),
35
- TypeError: five(),
36
- NativeAssertionError: six()
36
+ AggregateError: two(),
37
+ RangeError: three(),
38
+ ReferenceError: four(),
39
+ SyntaxError: five(),
40
+ TypeError: six(),
41
+ NativeAssertionError: seven()
37
42
  })
38
43
 
39
44
  exports.immediateError = function immediateError(message = 'ERROR!', errorType = ERROR.Error) {
@@ -96,7 +101,7 @@ exports.immediateError = function immediateError(message = 'ERROR!', errorType =
96
101
  rand: Math.random(),
97
102
  If,
98
103
  console,
99
- clc,
104
+ picocolors,
100
105
  bail
101
106
  }
102
107
  vm.createContext(context)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "immediate-error",
3
- "version": "5.1.0",
3
+ "version": "6.0.0",
4
4
  "description": "Throw errors, better.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,15 +26,17 @@
26
26
  "always-four": "^1.0.0",
27
27
  "assert-fn": "^1.0.1",
28
28
  "bail": "^2.0.2",
29
- "cli-color": "^2.0.4",
30
29
  "es-errors": "^1.3.0",
31
30
  "esm-wallaby": "^3.2.30",
32
31
  "five": "^0.8.0",
32
+ "get-intrinsic": "^1.3.0",
33
33
  "if": "^2.0.0",
34
34
  "is-error": "^2.2.2",
35
35
  "none": "^1.0.0",
36
36
  "number-six": "^1.0.1",
37
+ "number-zero": "^1.0.3",
37
38
  "numeric-constant-three": "^1.0.0",
39
+ "picocolors": "^1.1.1",
38
40
  "the-number-one": "^1.0.1",
39
41
  "throw-error": "^1.0.0",
40
42
  "two": "^1.0.7",