@optique/inquirer 1.0.0-dev.613 → 1.0.0-dev.615

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.
package/dist/index.cjs CHANGED
@@ -38,12 +38,29 @@ const defaultPromptFunctions = {
38
38
  expand: __inquirer_prompts.expand,
39
39
  checkbox: __inquirer_prompts.checkbox
40
40
  };
41
- function isPromptFunctionsOverride(value) {
42
- return typeof value === "object" && value != null;
41
+ const promptFunctionKeys = [
42
+ "confirm",
43
+ "number",
44
+ "input",
45
+ "password",
46
+ "editor",
47
+ "select",
48
+ "rawlist",
49
+ "expand",
50
+ "checkbox"
51
+ ];
52
+ function assignPromptFunctionOverride(override, key, candidate) {
53
+ if (typeof candidate === "function") override[key] = candidate;
54
+ }
55
+ function getPromptFunctionsOverride(value) {
56
+ if (typeof value !== "object" || value == null) return void 0;
57
+ const override = {};
58
+ for (const key of promptFunctionKeys) assignPromptFunctionOverride(override, key, Reflect.get(value, key));
59
+ return override;
43
60
  }
44
61
  function getPromptFunctions() {
45
- const override = Reflect.get(globalThis, promptFunctionsOverrideSymbol);
46
- return isPromptFunctionsOverride(override) ? {
62
+ const override = getPromptFunctionsOverride(Reflect.get(globalThis, promptFunctionsOverrideSymbol));
63
+ return override != null ? {
47
64
  ...defaultPromptFunctions,
48
65
  ...override
49
66
  } : defaultPromptFunctions;
package/dist/index.js CHANGED
@@ -15,12 +15,29 @@ const defaultPromptFunctions = {
15
15
  expand,
16
16
  checkbox
17
17
  };
18
- function isPromptFunctionsOverride(value) {
19
- return typeof value === "object" && value != null;
18
+ const promptFunctionKeys = [
19
+ "confirm",
20
+ "number",
21
+ "input",
22
+ "password",
23
+ "editor",
24
+ "select",
25
+ "rawlist",
26
+ "expand",
27
+ "checkbox"
28
+ ];
29
+ function assignPromptFunctionOverride(override, key, candidate) {
30
+ if (typeof candidate === "function") override[key] = candidate;
31
+ }
32
+ function getPromptFunctionsOverride(value) {
33
+ if (typeof value !== "object" || value == null) return void 0;
34
+ const override = {};
35
+ for (const key of promptFunctionKeys) assignPromptFunctionOverride(override, key, Reflect.get(value, key));
36
+ return override;
20
37
  }
21
38
  function getPromptFunctions() {
22
- const override = Reflect.get(globalThis, promptFunctionsOverrideSymbol);
23
- return isPromptFunctionsOverride(override) ? {
39
+ const override = getPromptFunctionsOverride(Reflect.get(globalThis, promptFunctionsOverrideSymbol));
40
+ return override != null ? {
24
41
  ...defaultPromptFunctions,
25
42
  ...override
26
43
  } : defaultPromptFunctions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/inquirer",
3
- "version": "1.0.0-dev.613+0df991c6",
3
+ "version": "1.0.0-dev.615+008c7a81",
4
4
  "description": "Interactive prompt support for Optique via Inquirer.js",
5
5
  "keywords": [
6
6
  "CLI",
@@ -56,13 +56,13 @@
56
56
  "sideEffects": false,
57
57
  "dependencies": {
58
58
  "@inquirer/prompts": "^8.3.0",
59
- "@optique/core": "1.0.0-dev.613+0df991c6"
59
+ "@optique/core": "1.0.0-dev.615+008c7a81"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^20.19.9",
63
63
  "tsdown": "^0.13.0",
64
64
  "typescript": "^5.8.3",
65
- "@optique/env": "1.0.0-dev.613+0df991c6"
65
+ "@optique/env": "1.0.0-dev.615+008c7a81"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsdown",