@inquirer/core 9.0.4 → 9.0.6

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.
@@ -4,6 +4,12 @@ exports.ValidationError = exports.HookError = exports.ExitPromptError = exports.
4
4
  class CancelPromptError extends Error {
5
5
  constructor() {
6
6
  super(...arguments);
7
+ Object.defineProperty(this, "name", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: 'CancelPromptError'
12
+ });
7
13
  Object.defineProperty(this, "message", {
8
14
  enumerable: true,
9
15
  configurable: true,
@@ -14,11 +20,38 @@ class CancelPromptError extends Error {
14
20
  }
15
21
  exports.CancelPromptError = CancelPromptError;
16
22
  class ExitPromptError extends Error {
23
+ constructor() {
24
+ super(...arguments);
25
+ Object.defineProperty(this, "name", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: 'ExitPromptError'
30
+ });
31
+ }
17
32
  }
18
33
  exports.ExitPromptError = ExitPromptError;
19
34
  class HookError extends Error {
35
+ constructor() {
36
+ super(...arguments);
37
+ Object.defineProperty(this, "name", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: 'HookError'
42
+ });
43
+ }
20
44
  }
21
45
  exports.HookError = HookError;
22
46
  class ValidationError extends Error {
47
+ constructor() {
48
+ super(...arguments);
49
+ Object.defineProperty(this, "name", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: 'ValidationError'
54
+ });
55
+ }
23
56
  }
24
57
  exports.ValidationError = ValidationError;
@@ -28,7 +28,7 @@ function lines({ items, width, renderItem, active, position: requested, pageSize
28
28
  isActive: index === active,
29
29
  }));
30
30
  const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
31
- const renderItemAt = (index) => split(renderItem(layoutsInPage[index]), width);
31
+ const renderItemAt = (index) => layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);
32
32
  // Create a blank array of lines for the page
33
33
  const pageBuffer = Array.from({ length: pageSize });
34
34
  // Render the active item to decide the position
@@ -1,9 +1,13 @@
1
1
  export declare class CancelPromptError extends Error {
2
+ name: string;
2
3
  message: string;
3
4
  }
4
5
  export declare class ExitPromptError extends Error {
6
+ name: string;
5
7
  }
6
8
  export declare class HookError extends Error {
9
+ name: string;
7
10
  }
8
11
  export declare class ValidationError extends Error {
12
+ name: string;
9
13
  }
@@ -1,9 +1,13 @@
1
1
  export class CancelPromptError extends Error {
2
+ name = 'CancelPromptError';
2
3
  message = 'Prompt was canceled';
3
4
  }
4
5
  export class ExitPromptError extends Error {
6
+ name = 'ExitPromptError';
5
7
  }
6
8
  export class HookError extends Error {
9
+ name = 'HookError';
7
10
  }
8
11
  export class ValidationError extends Error {
12
+ name = 'ValidationError';
9
13
  }
@@ -25,7 +25,7 @@ export function lines({ items, width, renderItem, active, position: requested, p
25
25
  isActive: index === active,
26
26
  }));
27
27
  const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
28
- const renderItemAt = (index) => split(renderItem(layoutsInPage[index]), width);
28
+ const renderItemAt = (index) => layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);
29
29
  // Create a blank array of lines for the page
30
30
  const pageBuffer = Array.from({ length: pageSize });
31
31
  // Render the active item to decide the position
@@ -1,9 +1,13 @@
1
1
  export declare class CancelPromptError extends Error {
2
+ name: string;
2
3
  message: string;
3
4
  }
4
5
  export declare class ExitPromptError extends Error {
6
+ name: string;
5
7
  }
6
8
  export declare class HookError extends Error {
9
+ name: string;
7
10
  }
8
11
  export declare class ValidationError extends Error {
12
+ name: string;
9
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/core",
3
- "version": "9.0.4",
3
+ "version": "9.0.6",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
@@ -57,10 +57,10 @@
57
57
  "license": "MIT",
58
58
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/README.md",
59
59
  "dependencies": {
60
- "@inquirer/figures": "^1.0.4",
61
- "@inquirer/type": "^1.5.0",
60
+ "@inquirer/figures": "^1.0.5",
61
+ "@inquirer/type": "^1.5.1",
62
62
  "@types/mute-stream": "^0.0.4",
63
- "@types/node": "^20.14.11",
63
+ "@types/node": "^20.14.13",
64
64
  "@types/wrap-ansi": "^3.0.0",
65
65
  "ansi-escapes": "^4.3.2",
66
66
  "cli-spinners": "^2.9.2",
@@ -72,13 +72,12 @@
72
72
  "yoctocolors-cjs": "^2.1.2"
73
73
  },
74
74
  "devDependencies": {
75
- "@inquirer/testing": "^2.1.27"
75
+ "@inquirer/testing": "^2.1.29"
76
76
  },
77
77
  "scripts": {
78
78
  "tsc": "yarn run tsc:esm && yarn run tsc:cjs",
79
79
  "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
80
80
  "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
81
- "tsc:watch": "tsc -p ./tsconfig.json --watch",
82
81
  "attw": "attw --pack"
83
82
  },
84
83
  "publishConfig": {
@@ -97,5 +96,5 @@
97
96
  }
98
97
  },
99
98
  "sideEffects": false,
100
- "gitHead": "f2c4983dd390c6244fb4668a8e87c9e786e4326f"
99
+ "gitHead": "7a061f13e053dd64ef7373b08e8a10130131ea59"
101
100
  }