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

@kearisp/cli

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kearisp/cli - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

10

dist/makes/Command.d.ts

@@ -58,9 +58,7 @@ import { Logger } from "../types";

complete(parts: string[]): Promise<string[]>;
isMatch(part: string): boolean;
getRegExp(part: string, partial?: boolean): void;
getReg(partial?: boolean): RegExp;
info(...args: any[]): void;
warning(...args: any[]): void;
error(...args: any[]): void;
protected log(...args: any[]): void;
protected info(...args: any[]): void;
protected warning(...args: any[]): void;
protected error(...args: any[]): void;
}
export { Command };

88

dist/makes/Command.js

@@ -79,2 +79,12 @@ "use strict";

while (current < parts.length) {
isLast = current === parts.length - 1;
if (partial && isLast) {
args.push(value);
return {
args,
options,
command,
part: parts[current]
};
}
value.push(parts[current]);

@@ -220,3 +230,4 @@ current++;

const comAttrOpt = /^\[([\w_-]+)](.*)?$/;
const comSpread = /^\[\.\.\.([0-9\w_-]+)](.*)$/;
const comSpread = /^\[\.\.\.([0-9\w_-]+)](.*)?$/;
const comSpreadReq = /^<\.\.\.([0-9\w_-]+)>(.*)?$/;
const comOther = /^([^\[\]<>{}]+)(.*)$/;

@@ -228,3 +239,2 @@ let exitCount = 0;

let predict = "";
let predicts = [];
let resPredicts = [""];

@@ -247,2 +257,16 @@ while (restCommand) {

}
else if (comSpread.test(restCommand)) {
const [, match, rest] = comSpread.exec(restCommand) || [];
isAction = true;
predict = match;
restCommand = rest;
stepReg = "(.+?)?";
}
else if (comSpreadReq.test(restCommand)) {
const [, match, rest] = comSpreadReq.exec(restCommand) || [];
isAction = true;
predict = match;
restCommand = rest;
stepReg = "(.+?)";
}
else if (comOther.test(restCommand)) {

@@ -257,2 +281,5 @@ const [, match, rest] = comOther.exec(restCommand) || [];

if (exitCount > 100) {
this.warning("Emergency exit", {
restCommand
});
return null;

@@ -309,57 +336,8 @@ }

}
isMatch(part) {
const regExp = this.getReg();
return regExp.test(part);
}
getRegExp(part, partial = false) {
const comAttrReq = /^<([\w_-]+)>(.*)?$/;
const comAttrOpt = /^\[([\w_-]+)](.*)?$/;
let restCommand = part;
while (restCommand) {
let stepReg;
if (comAttrOpt.test(restCommand)) {
}
else {
}
log(...args) {
if (!this._logger) {
return;
}
this._logger.log(...args);
}
getReg(partial = false) {
const comAttrReq = /^<([\w_-]+)>(.*)?$/;
const comAttrOpt = /^\[([\w_-]+)](.*)?$/;
const comSpread = /^\[\.\.\.([0-9\w_-]+)](.*)$/;
const comOther = /^([^[\]<>{}])(.*)$/;
let exitCount = 0;
let restCommand = this._command;
let res = "";
let partialRes = "";
while (restCommand) {
let stepReg;
if (comAttrReq.test(restCommand)) {
const [, name, rest] = comAttrReq.exec(restCommand) || [];
restCommand = rest;
stepReg = partial ? `(?:.+?)` : `(.+?)`;
}
else if (comAttrOpt.test(restCommand)) {
const [, name, rest] = comAttrReq.exec(restCommand) || [];
restCommand = rest;
stepReg = partial ? `(?:.+?)?` : `(.+?)?`;
}
else if (comOther.test(restCommand)) {
const [, match, rest] = comOther.exec(restCommand) || [];
restCommand = rest;
stepReg = `${(0, utils_1.escapeRegExp)(match)}`;
}
else {
return null;
}
if (stepReg) {
res += stepReg;
partialRes = `${res}${"|" + partialRes}`;
}
if (exitCount++ > 1000) {
break;
}
}
return new RegExp(`^(?:${partial ? partialRes : res})$`);
}
info(...args) {

@@ -366,0 +344,0 @@ if (!this._logger) {

export interface Logger {
log(...args: any[]): void;
info(...args: any[]): void;

@@ -3,0 +4,0 @@ warning(...args: any[]): void;

@@ -5,8 +5,8 @@ "use strict";

const escapeRegExp_1 = require("./escapeRegExp");
const comAttrReq = /^<([\w_-]+)>(.*)?$/;
const comAttrOpt = /^\[([\w_-]+)](.*)?$/;
const comSpread = /^\[\.\.\.([0-9\w_-]+)](.*)$/;
const comOther = /^([^[\]<>{}])(.*)$/;
const generateCommandRegExp = (part, partial = false) => {
if (partial) {
const comAttrReq = /^<([\w_-]+)>(.*)?$/;
const comAttrOpt = /^\[([\w_-]+)](.*)?$/;
const comSpread = /^\[\.\.\.([0-9\w_-]+)](.*)$/;
const comOther = /^([^[\]<>{}])(.*)$/;
let exitCount = 0;

@@ -13,0 +13,0 @@ let restCommand = part;

@@ -5,5 +5,5 @@ "use strict";

const isSpread = (command) => {
const comSpread = /^\[\.\.\.([0-9\w_-]+)]$/;
const comSpread = /^\[\.\.\.([0-9\w_-]+)]$|^<\.\.\.([0-9\w_-]+)>$/;
return comSpread.test(command);
};
exports.isSpread = isSpread;
{
"name": "@kearisp/cli",
"version": "1.0.3",
"version": "1.0.4",
"license": "MIT",

@@ -32,13 +32,9 @@ "author": "Kris Papercut <krispcut@gmail.com>",

"devDependencies": {
"@babel/core": "^7.22.10",
"@babel/preset-env": "^7.22.10",
"@babel/preset-typescript": "^7.22.5",
"@types/jest": "^29.5.3",
"@types/node": "^20.9.1",
"babel-jest": "^29.7.0",
"dotenv": "^16.3.1",
"@types/node": "^20.9.2",
"jest": "^29.7.0",
"path": "^0.12.7",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
}

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