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

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,21 @@ 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
+ function promptFunctionKeys() {
42
+ return Object.keys(defaultPromptFunctions);
43
+ }
44
+ function assignPromptFunctionOverride(override, key, candidate) {
45
+ if (typeof candidate === "function") override[key] = candidate;
46
+ }
47
+ function getPromptFunctionsOverride(value) {
48
+ if (typeof value !== "object" || value == null) return void 0;
49
+ const override = {};
50
+ for (const key of promptFunctionKeys()) assignPromptFunctionOverride(override, key, Reflect.get(value, key));
51
+ return override;
43
52
  }
44
53
  function getPromptFunctions() {
45
- const override = Reflect.get(globalThis, promptFunctionsOverrideSymbol);
46
- return isPromptFunctionsOverride(override) ? {
54
+ const override = getPromptFunctionsOverride(Reflect.get(globalThis, promptFunctionsOverrideSymbol));
55
+ return override != null ? {
47
56
  ...defaultPromptFunctions,
48
57
  ...override
49
58
  } : defaultPromptFunctions;
package/dist/index.js CHANGED
@@ -15,12 +15,21 @@ const defaultPromptFunctions = {
15
15
  expand,
16
16
  checkbox
17
17
  };
18
- function isPromptFunctionsOverride(value) {
19
- return typeof value === "object" && value != null;
18
+ function promptFunctionKeys() {
19
+ return Object.keys(defaultPromptFunctions);
20
+ }
21
+ function assignPromptFunctionOverride(override, key, candidate) {
22
+ if (typeof candidate === "function") override[key] = candidate;
23
+ }
24
+ function getPromptFunctionsOverride(value) {
25
+ if (typeof value !== "object" || value == null) return void 0;
26
+ const override = {};
27
+ for (const key of promptFunctionKeys()) assignPromptFunctionOverride(override, key, Reflect.get(value, key));
28
+ return override;
20
29
  }
21
30
  function getPromptFunctions() {
22
- const override = Reflect.get(globalThis, promptFunctionsOverrideSymbol);
23
- return isPromptFunctionsOverride(override) ? {
31
+ const override = getPromptFunctionsOverride(Reflect.get(globalThis, promptFunctionsOverrideSymbol));
32
+ return override != null ? {
24
33
  ...defaultPromptFunctions,
25
34
  ...override
26
35
  } : 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.617+c4b77759",
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.617+c4b77759"
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.617+c4b77759"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsdown",