Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@replit/clui-input

Package Overview
Dependencies
Maintainers
8
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@replit/clui-input - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

101

dist/input.js

@@ -100,6 +100,6 @@ "use strict";

var processUpdates = function () { return __awaiter(void 0, void 0, void 0, function () {
var valueStart, current, ast, atWhitespace, previousNode, search, result, search, result, currentNode, astCommands, last, args, parsedArgKeys, options, nodeStart, commonParams, getOptions, rootCommands, search, ref, argOptions, previousNode, search, optionsFn, token, prefix_1, suffix, searchValue_1, results, ref, argOptions, ref, argOptions, run, commandsList, refRun_1;
var _a, _b, _c, _d, _e, _f;
return __generator(this, function (_g) {
switch (_g.label) {
var valueStart, current, ast, atWhitespace, previousNode, search, result, search, result, currentNode, astCommands, last, args, parsedArgKeys, options, nodeStart, commonParams, getOptions, rootCommands, search, ref, argOptions, previousNode, search, optionsFn, token, prefix_1, suffix, searchValue_1, results, optionsFn, token, prefix_2, suffix, searchValue_2, results, ref, argOptions, ref, argOptions, run, commandsList, refRun_1;
var _a, _b, _c, _d, _e, _f, _g;
return __generator(this, function (_h) {
switch (_h.label) {
case 0:

@@ -114,3 +114,3 @@ valueStart = value.slice(0, index);

case 1:
ast = _g.sent();
ast = _h.sent();
atWhitespace = value[index - 1] === ' ';

@@ -125,3 +125,3 @@ if (!(value.length > index || atWhitespace)) return [3, 5];

case 2:
result = _g.sent();
result = _h.sent();
if (result) {

@@ -138,7 +138,7 @@ commandsCache[valueStart] = result;

case 4:
result = _g.sent();
result = _h.sent();
if (result) {
commandsCache[valueStart] = result;
}
_g.label = 5;
_h.label = 5;
case 5:

@@ -175,7 +175,7 @@ if (current !== updatedAt) {

case 6:
rootCommands = _g.sent();
rootCommands = _h.sent();
if (rootCommands) {
commandsCache[''] = rootCommands;
}
_g.label = 7;
_h.label = 7;
case 7:

@@ -192,3 +192,3 @@ if (current !== updatedAt) {

}
return [3, 18];
return [3, 20];
case 8:

@@ -202,3 +202,3 @@ if (!currentNode) return [3, 11];

case 9:
argOptions = _g.sent();
argOptions = _h.sent();
if (argOptions) {

@@ -210,6 +210,6 @@ optionsCache[valueStart] = argOptions;

}
_g.label = 10;
_h.label = 10;
case 10:
options.push.apply(options, __spread(getOptions(__assign({ currentNode: currentNode }, commonParams))));
return [3, 18];
return [3, 20];
case 11:

@@ -226,13 +226,13 @@ previousNode = ast_1.closestPrevious(ast, index);

: undefined;
if (!previousNode) return [3, 18];
if (!('cmdNodeCtx' in previousNode &&
typeof ((_d = previousNode.cmdNodeCtx) === null || _d === void 0 ? void 0 : _d.ref.options) === 'function')) return [3, 13];
optionsFn = previousNode.cmdNodeCtx.ref.options;
token = previousNode.cmdNodeCtx.token;
if (!previousNode) return [3, 20];
if (!(previousNode.kind === 'COMMAND' &&
typeof ((_d = previousNode) === null || _d === void 0 ? void 0 : _d.ref.options) === 'function')) return [3, 13];
optionsFn = previousNode.ref.options;
token = previousNode.token;
prefix_1 = ast.source.slice(0, token.end);
suffix = ast.source.slice(token.end);
searchValue_1 = suffix.trimLeft();
searchValue_1 = suffix.trimLeft() || undefined;
return [4, optionsFn(searchValue_1)];
case 12:
results = _g.sent();
results = _h.sent();
if (current !== updatedAt) {

@@ -251,10 +251,35 @@ return [2];

})));
_g.label = 13;
_h.label = 13;
case 13:
if (!(previousNode.kind === 'ARG_VALUE')) return [3, 15];
if (!('cmdNodeCtx' in previousNode &&
typeof ((_e = previousNode.cmdNodeCtx) === null || _e === void 0 ? void 0 : _e.ref.options) === 'function')) return [3, 15];
optionsFn = previousNode.cmdNodeCtx.ref.options;
token = previousNode.cmdNodeCtx.token;
prefix_2 = ast.source.slice(0, token.end);
suffix = ast.source.slice(token.end);
searchValue_2 = suffix.trimLeft() || undefined;
return [4, optionsFn(searchValue_2)];
case 14:
results = _h.sent();
if (current !== updatedAt) {
return [2];
}
options.push.apply(options, __spread(results.map(function (result) {
var inputValue = prefix_2 + " " + result.value;
return {
value: result.value,
inputValue: inputValue,
cursorTarget: inputValue.length,
searchValue: searchValue_2,
data: result,
};
})));
_h.label = 15;
case 15:
if (!(previousNode.kind === 'ARG_VALUE')) return [3, 17];
ref = previousNode.parent.ref;
if (!(typeof ref.options === 'function' && !optionsCache[valueStart])) return [3, 15];
if (!(typeof ref.options === 'function' && !optionsCache[valueStart])) return [3, 17];
return [4, ref.options(search || undefined)];
case 14:
argOptions = _g.sent();
case 16:
argOptions = _h.sent();
if (current !== updatedAt) {

@@ -266,10 +291,10 @@ return [2];

}
_g.label = 15;
case 15:
if (!(previousNode.kind === 'ARG_KEY')) return [3, 17];
_h.label = 17;
case 17:
if (!(previousNode.kind === 'ARG_KEY')) return [3, 19];
ref = previousNode.parent.ref;
if (!(typeof ref.options === 'function' && !optionsCache[valueStart])) return [3, 17];
if (!(typeof ref.options === 'function' && !optionsCache[valueStart])) return [3, 19];
return [4, ref.options(search || undefined)];
case 16:
argOptions = _g.sent();
case 18:
argOptions = _h.sent();
if (current !== updatedAt) {

@@ -281,7 +306,7 @@ return [2];

}
_g.label = 17;
case 17:
_h.label = 19;
case 19:
options.push.apply(options, __spread(getOptions(__assign({ previousNode: previousNode }, commonParams))));
_g.label = 18;
case 18:
_h.label = 20;
case 20:
commandsList = astCommands.map(function (c) {

@@ -309,5 +334,5 @@ var cargs = ast_1.toArgs(c);

ast: ast,
args: (_e = args) === null || _e === void 0 ? void 0 : _e.parsed,
args: (_f = args) === null || _f === void 0 ? void 0 : _f.parsed,
nodeStart: nodeStart,
exhausted: !!((_f = args) === null || _f === void 0 ? void 0 : _f.exhausted) && !last.ref.commands,
exhausted: !!((_g = args) === null || _g === void 0 ? void 0 : _g.exhausted) && !last.ref.commands,
commands: commandsList,

@@ -314,0 +339,0 @@ options: options,

{
"name": "@replit/clui-input",
"version": "0.0.15",
"version": "0.0.16",
"description": "A utility library for building CLI style interfaces with autocomplete",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc