@optique/inquirer 1.0.0-dev.1172 → 1.0.0-dev.1178
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 +6 -12
- package/dist/index.js +6 -12
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -144,7 +144,7 @@ function prompt(parser, config) {
|
|
|
144
144
|
[promptBindStateKey] = true;
|
|
145
145
|
hasCliValue = false;
|
|
146
146
|
};
|
|
147
|
-
|
|
147
|
+
const promptCache = /* @__PURE__ */ new WeakMap();
|
|
148
148
|
function shouldAttemptInnerCompletion(cliState, state) {
|
|
149
149
|
if (cliState == null || cliState instanceof PromptBindInitialStateClass) return false;
|
|
150
150
|
const cliStateHasAnnotations = typeof cliState === "object" && __optique_core_annotations.annotationKey in cliState;
|
|
@@ -361,9 +361,9 @@ function prompt(parser, config) {
|
|
|
361
361
|
return Promise.resolve(r);
|
|
362
362
|
}
|
|
363
363
|
if (state instanceof PromptBindInitialStateClass) {
|
|
364
|
-
if (promptCache
|
|
365
|
-
const cached = promptCache.
|
|
366
|
-
promptCache
|
|
364
|
+
if (promptCache.has(state)) {
|
|
365
|
+
const cached = promptCache.get(state);
|
|
366
|
+
promptCache.delete(state);
|
|
367
367
|
return cached;
|
|
368
368
|
}
|
|
369
369
|
const hasDeferHook = typeof parser.shouldDeferCompletion === "function";
|
|
@@ -380,10 +380,7 @@ function prompt(parser, config) {
|
|
|
380
380
|
return usePromptOrDefer(state, res);
|
|
381
381
|
};
|
|
382
382
|
const cachedResult$1 = annotatedR instanceof Promise ? annotatedR.then(usePromptOrDeferSentinel) : usePromptOrDeferSentinel(annotatedR);
|
|
383
|
-
promptCache
|
|
384
|
-
state,
|
|
385
|
-
result: cachedResult$1
|
|
386
|
-
};
|
|
383
|
+
promptCache.set(state, cachedResult$1);
|
|
387
384
|
return cachedResult$1;
|
|
388
385
|
}
|
|
389
386
|
const simParseR = withAnnotatedInnerState(state, effectiveInitialState, (annotatedState) => parser.parse({
|
|
@@ -412,10 +409,7 @@ function prompt(parser, config) {
|
|
|
412
409
|
return executePrompt();
|
|
413
410
|
};
|
|
414
411
|
const cachedResult = simParseR instanceof Promise ? simParseR.then(decideFromParse) : decideFromParse(simParseR);
|
|
415
|
-
promptCache
|
|
416
|
-
state,
|
|
417
|
-
result: cachedResult
|
|
418
|
-
};
|
|
412
|
+
promptCache.set(state, cachedResult);
|
|
419
413
|
return cachedResult;
|
|
420
414
|
}
|
|
421
415
|
const cliState = isPromptBindState(state) ? state.cliState : void 0;
|
package/dist/index.js
CHANGED
|
@@ -121,7 +121,7 @@ function prompt(parser, config) {
|
|
|
121
121
|
[promptBindStateKey] = true;
|
|
122
122
|
hasCliValue = false;
|
|
123
123
|
};
|
|
124
|
-
|
|
124
|
+
const promptCache = /* @__PURE__ */ new WeakMap();
|
|
125
125
|
function shouldAttemptInnerCompletion(cliState, state) {
|
|
126
126
|
if (cliState == null || cliState instanceof PromptBindInitialStateClass) return false;
|
|
127
127
|
const cliStateHasAnnotations = typeof cliState === "object" && annotationKey in cliState;
|
|
@@ -338,9 +338,9 @@ function prompt(parser, config) {
|
|
|
338
338
|
return Promise.resolve(r);
|
|
339
339
|
}
|
|
340
340
|
if (state instanceof PromptBindInitialStateClass) {
|
|
341
|
-
if (promptCache
|
|
342
|
-
const cached = promptCache.
|
|
343
|
-
promptCache
|
|
341
|
+
if (promptCache.has(state)) {
|
|
342
|
+
const cached = promptCache.get(state);
|
|
343
|
+
promptCache.delete(state);
|
|
344
344
|
return cached;
|
|
345
345
|
}
|
|
346
346
|
const hasDeferHook = typeof parser.shouldDeferCompletion === "function";
|
|
@@ -357,10 +357,7 @@ function prompt(parser, config) {
|
|
|
357
357
|
return usePromptOrDefer(state, res);
|
|
358
358
|
};
|
|
359
359
|
const cachedResult$1 = annotatedR instanceof Promise ? annotatedR.then(usePromptOrDeferSentinel) : usePromptOrDeferSentinel(annotatedR);
|
|
360
|
-
promptCache
|
|
361
|
-
state,
|
|
362
|
-
result: cachedResult$1
|
|
363
|
-
};
|
|
360
|
+
promptCache.set(state, cachedResult$1);
|
|
364
361
|
return cachedResult$1;
|
|
365
362
|
}
|
|
366
363
|
const simParseR = withAnnotatedInnerState(state, effectiveInitialState, (annotatedState) => parser.parse({
|
|
@@ -389,10 +386,7 @@ function prompt(parser, config) {
|
|
|
389
386
|
return executePrompt();
|
|
390
387
|
};
|
|
391
388
|
const cachedResult = simParseR instanceof Promise ? simParseR.then(decideFromParse) : decideFromParse(simParseR);
|
|
392
|
-
promptCache
|
|
393
|
-
state,
|
|
394
|
-
result: cachedResult
|
|
395
|
-
};
|
|
389
|
+
promptCache.set(state, cachedResult);
|
|
396
390
|
return cachedResult;
|
|
397
391
|
}
|
|
398
392
|
const cliState = isPromptBindState(state) ? state.cliState : void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/inquirer",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.1178+6b5574a3",
|
|
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.
|
|
59
|
+
"@optique/core": "1.0.0-dev.1178+6b5574a3"
|
|
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.
|
|
65
|
+
"@optique/env": "1.0.0-dev.1178+6b5574a3"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsdown",
|