New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@curong/term

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@curong/term - npm Package Compare versions

Comparing version 0.0.0-alpha.5 to 0.1.0

30

dist/index.dev.js

@@ -47,2 +47,6 @@ 'use strict';

function isArrayHave(value) {
return isArray(value) && value.length > 0;
}
function isNull(value) {

@@ -52,10 +56,2 @@ return value === null;

function isUndefined(value) {
return typeof value === 'undefined';
}
function isArrayHave(value) {
return isArray(value) && value.length > 0;
}
function isNumberPrimitive(value) {

@@ -104,4 +100,11 @@ return typeof value === 'number';

function isObjectHave(value) {
return isObject(value) && Object.keys(value).length > 0;
function isObjectHave(value, methodLevel = 0) {
const f = methodLevel === 0
? Object.keys
: methodLevel === 1
? Object.getOwnPropertyNames
: methodLevel === 2
? Object.getOwnPropertySymbols
: Reflect.ownKeys;
return isObject(value) && f(value).length > 0;
}

@@ -117,2 +120,6 @@

function isUndefined(value) {
return typeof value === 'undefined';
}
function isZero(value) {

@@ -583,2 +590,5 @@ return value === 0;

class ProgressBar {
options;
index;
record;
constructor(options) {

@@ -585,0 +595,0 @@ options = {

@@ -43,2 +43,6 @@ import 'stream';

function isArrayHave(value) {
return isArray(value) && value.length > 0;
}
function isNull(value) {

@@ -48,10 +52,2 @@ return value === null;

function isUndefined(value) {
return typeof value === 'undefined';
}
function isArrayHave(value) {
return isArray(value) && value.length > 0;
}
function isNumberPrimitive(value) {

@@ -100,4 +96,11 @@ return typeof value === 'number';

function isObjectHave(value) {
return isObject(value) && Object.keys(value).length > 0;
function isObjectHave(value, methodLevel = 0) {
const f = methodLevel === 0
? Object.keys
: methodLevel === 1
? Object.getOwnPropertyNames
: methodLevel === 2
? Object.getOwnPropertySymbols
: Reflect.ownKeys;
return isObject(value) && f(value).length > 0;
}

@@ -113,2 +116,6 @@

function isUndefined(value) {
return typeof value === 'undefined';
}
function isZero(value) {

@@ -579,2 +586,5 @@ return value === 0;

class ProgressBar {
options;
index;
record;
constructor(options) {

@@ -581,0 +591,0 @@ options = {

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("stream");var r=require("util"),t=require("process"),e=require("readline");function o(r){return function(r){return"string"==typeof r}(r)||function(r){return"object"==typeof r&&"String"===s(r)}(r)}function n(r){return!0===r}function s(r,t=!0){const e=Object.prototype.toString;let s=null;return function(r){return"function"==typeof r}(e)&&o(s=e.call(r))&&n(t)&&s.startsWith("[object ")&&s.endsWith("]")?s.slice(8,-1):s}function i(r){return Array.isArray(r)}function u(r){return void 0===r}function c(r){return function(r){return"number"==typeof r}(r)||function(r){return"object"==typeof r&&"Number"===s(r)}(r)}function a(r){return!1===r}function l(r){return Number.isNaN(r)}function d(r,...t){const e=l(r)?r=>l(r):t=>r===t;if(function(r){return i(r)&&r.length>0}(t)){for(let r=0,o=t.length;r<o;r++)if(a(e(t[r])))return!1;return!0}return!1}function p(r){return function(r){return"Object"===s(r)}(r)&&Object.keys(r).length>0}function f(r){return o(r)&&r.length>0}function h(r){return Number.isSafeInteger(r)&&r>=0}function g(r={}){const t=[],e=[],o=["bold","dim","italic","underlined","blink","rapidBlink","reverse","hidden","crossedOut"];for(let s=0,i=o.length;s<i;s++){const i=o[s],c=r[i];let l=21;if(!u(c))switch(i){case"bold":l++;default:n(c)?(t.push(s+1),e.push(s+l)):a(c)&&e.push(s+l)}}return{set:t.join(";"),reset:e.join(";")}}function b(r){if(!h(r)||r<0||r>255)throw new TypeError(`[colorCode8bit]: colorCode不是一个有效数字, "${r}"`);return{foreground:"38;5;"+r,background:"48;5;"+r}}const x={standard:["black","red","green","yellow","blue","magenta","cyan","white"],highIntensity:["lightblack","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","lightwhite"]},m={VGA:[[0,0,0],[170,0,0],[0,170,0],[170,85,0],[0,0,170],[170,0,170],[0,170,170],[170,170,170],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],CMD:[[0,0,0],[128,0,0],[0,128,0],[128,128,0],[0,0,128],[128,0,128],[0,128,128],[192,192,192],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]],"Terminal.app":[[0,0,0],[194,54,33],[37,188,36],[173,173,39],[73,46,225],[211,56,211],[51,187,200],[203,204,205],[129,131,131],[252,57,31],[49,231,34],[234,236,35],[88,51,255],[249,53,248],[20,240,240],[233,235,235]],PuTTY:[[0,0,0],[187,0,0],[0,187,0],[187,187,0],[0,0,187],[187,0,187],[0,187,187],[187,187,187],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],mlRC:[[0,0,0],[127,0,0],[0,147,0],[252,127,0],[0,0,127],[156,0,156],[0,147,147],[210,210,210],[127,127,127],[255,0,0],[0,252,0],[255,255,0],[0,0,252],[255,0,255],[0,255,255],[255,255,255]],xterm:[[0,0,0],[205,0,0],[0,205,0],[205,205,0],[0,0,238],[205,0,205],[0,205,205],[229,229,229],[127,127,127],[255,0,0],[0,255,0],[255,255,0],[92,92,255],[255,0,255],[0,255,255],[255,255,255]],Ubuntu:[[1,1,1],[222,56,43],[57,181,74],[255,199,6],[0,111,184],[118,38,113],[44,181,233],[204,204,204],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]]};function w(r){return b(x.standard.concat(x.highIntensity).findIndex(t=>t===r))}const y="[",C=(r=0)=>y+r+"K";function k(r,t){if(function(r){return 0===r}(r.length))return"";if(u(t))return""+r;const e=[],o=[],{foreground:n,background:s}=t;n&&(e.push(w(n).foreground),o.push("39")),s&&(e.push(w(s).background),o.push("49"));const{set:i,reset:c}=g(t);return i.length>0&&e.push(i),c.length>0&&o.push(c),`[${e.join(";")}m`+r+`[${o.join(";")}m`}const $="\n";function j(t,e){e={showHidden:!0,depth:null,colors:!0,maxArrayLength:null,compact:!1,sorted:!0,...e};const{dividers:o=!0,title:n=!0}=e.display??{},s="-".repeat(80),i=[],u=function(r){const t=[];if(!p(r))return t;const{type:e="error",name:o,code:n,message:s,data:i,date:u=!0,stack:a=!1}=r,l="时间",h="名称",g="代码",b="消息",x="数据",m="堆栈",w=(r,e)=>{if(f(e)){const r=k(` ${e} `,{foreground:"lightwhite",background:"cyan"});t.push($+r)}t.push(r)};if(Object.keys(r).forEach(r=>{switch(r){case"name":f(o)&&w(o,h);break;case"code":(c(n)||f(n))&&w(n,g);break;case"message":f(s)&&w(s,b);break;case"data":w(i,x)}}),u){const r=(new Date).toLocaleString();w(k(r,{foreground:"magenta"}),l)}if(a||d(e,"error")&&t.length>0){const r=(new Error).stack;if(f(r)){const t=k($+r.split($).slice(3).join($),{foreground:"red"});w(t,m)}}return t}(t);return n&&i.push(function(r="error",t){if(!f(t))return"";const e=e=>[k(` ${r.toLocaleUpperCase()} `,{foreground:"lightwhite",background:e}),k(t,{foreground:e})].join(" ");switch(r){case"warn":return e("yellow");case"info":return e("green");case"error":default:return e("lightred")}}(t.type,t.title)),o?i.push($+s,...u,$+s):i.push(...u),0!==u.length&&(i[0]=$+i[0].trimStart(),i.push($)),r.formatWithOptions({...e},...i)}function N(r,...t){return console.log(j({title:t.join("\n "),type:r,date:!1,stack:!1},{display:{title:!0,dividers:!1}}))}const E=()=>""+C();exports.COLORS_CODE=x,exports.CSI=y,exports.ESC="",exports.ProgressBar=class{constructor(r){r={total:NaN,percentage:!0,count:!0,picture:!0,hiddenCursor:!0,...r},this.options=r,this.index=-1,this.record=[],this.reset()}reset(){const{total:r,percentage:t,count:e,picture:o,hiddenCursor:n}=this.options;let s=[];const i=this.index+1;if(h(r)){if(o){const t=Math.floor(i/r*10),e="#".repeat(t).padEnd(10," ");s.push(`[${e}]`)}if(t){const t=Math.floor(i/r*100);s.push(t+"%")}e&&s.push(`(${i}/${r})`)}else s.push("RUNNING:");n&&(s[0]="[?25l"+(s[0]??"")),this.record=s}write(r=""){return t.stdout.write(`${E()}${this.record.join(" ")} ${r}`),d(this.options.total,this.index)&&this.end()}pushWrite(r=""){return this.index++,this.reset(),this.write(r)}end(){let r=E();return this.options.hiddenCursor&&(r+="[?25h"),t.stdout.write(r),!0}},exports.ResetDevice="c",exports.SaveCursorAndAttr="7",exports.TERMINAL_COLOR_MAP=m,exports.ansiFormat=g,exports.colorCode24bit=function(r){if(!i(r)||3!==r.length)throw new TypeError(`[colorCode24bit]: colorCodes不是一个有效RGB数组, "${r}"`);r.forEach(r=>{if(!h(r)||r<0||r>255)throw new TypeError(`[colorCode24bit]: colorCode不是一个有效数字, "${r}"`)});const t=r.join(";");return{foreground:"38;2;"+t,background:"48;2;"+t}},exports.colorCode8bit=b,exports.colorNameCode24bit=function(r,t="Ubuntu"){const e=x.standard.concat(x.highIntensity).findIndex(t=>t===r),o=m[t];if(d(e,-1)||u(o)||u(o[e]))throw new Error(`[colorNameCode24bit]: colorName不是有效颜色值, "${r}"`);const n=o[e].join(";");return{foreground:"38;2;"+n,background:"48;2;"+n}},exports.colorNameCode3bit=function(r){const t=x.standard;let e=null;for(let o=0,n=t.length;o<n;o++){const n=t[o],s="light"+n;if(d(r,n)){e=30+o;break}if(d(r,s)){e=90+o;break}}if(null===e)throw new Error(`[colorNameCode3bit]: colorName不是有效颜色值, "${r}"`);return{foreground:e.toString(),background:(e+10).toString()}},exports.colorNameCode8bit=w,exports.cursorHidden="[?25l",exports.cursorMove=(r,t=1)=>y+t+{up:"A",down:"B",forward:"C",back:"D",next:"E",previous:"F",absolute:"G"}[r],exports.cursorOnLineBegin="",exports.cursorPosition=(r=1,t=1)=>`[${r};${t}H`,exports.cursorRestore="",exports.cursorSave="",exports.cursorShow="[?25h",exports.eraseLine=C,exports.eraseScreen=(r=0)=>y+r+"J",exports.fontColor=k,exports.format=j,exports.lineWrapClose="",exports.lineWrapOpen="",exports.printError=function(...r){return N("error",...r)},exports.printInfo=function(...r){return N("info",...r)},exports.printWarn=function(...r){return N("warn",...r)},exports.readByQuestion=function(r){return new Promise(t=>{const o=e.createInterface({input:process.stdin,output:process.stdout});o.question(r,r=>{o.close(),t(r.trim())})})},exports.restoreCursorAndAttr="8",exports.restoreFont="(",exports.scrollDown=(r=1)=>y+r+"T",exports.scrollPosition=(r=1,t=1)=>`[${r};${t}f`,exports.scrollUp=(r=1)=>y+r+"S";
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("stream");var t=require("util"),r=require("process"),e=require("readline");function o(t){return function(t){return"string"==typeof t}(t)||function(t){return"object"==typeof t&&"String"===s(t)}(t)}function n(t){return!0===t}function s(t,r=!0){const e=Object.prototype.toString;let s=null;return function(t){return"function"==typeof t}(e)&&o(s=e.call(t))&&n(r)&&s.startsWith("[object ")&&s.endsWith("]")?s.slice(8,-1):s}function i(t){return Array.isArray(t)}function u(t){return function(t){return"number"==typeof t}(t)||function(t){return"object"==typeof t&&"Number"===s(t)}(t)}function c(t){return!1===t}function a(t){return Number.isNaN(t)}function l(t,...r){const e=a(t)?t=>a(t):r=>t===r;if(function(t){return i(t)&&t.length>0}(r)){for(let t=0,o=r.length;t<o;t++)if(c(e(r[t])))return!1;return!0}return!1}function d(t,r=0){const e=0===r?Object.keys:1===r?Object.getOwnPropertyNames:2===r?Object.getOwnPropertySymbols:Reflect.ownKeys;return function(t){return"Object"===s(t)}(t)&&e(t).length>0}function p(t){return o(t)&&t.length>0}function f(t){return Number.isSafeInteger(t)&&t>=0}function h(t){return void 0===t}function g(t={}){const r=[],e=[],o=["bold","dim","italic","underlined","blink","rapidBlink","reverse","hidden","crossedOut"];for(let s=0,i=o.length;s<i;s++){const i=o[s],u=t[i];let a=21;if(!h(u))switch(i){case"bold":a++;default:n(u)?(r.push(s+1),e.push(s+a)):c(u)&&e.push(s+a)}}return{set:r.join(";"),reset:e.join(";")}}function b(t){if(!f(t)||t<0||t>255)throw new TypeError(`[colorCode8bit]: colorCode不是一个有效数字, "${t}"`);return{foreground:"38;5;"+t,background:"48;5;"+t}}const x={standard:["black","red","green","yellow","blue","magenta","cyan","white"],highIntensity:["lightblack","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","lightwhite"]},w={VGA:[[0,0,0],[170,0,0],[0,170,0],[170,85,0],[0,0,170],[170,0,170],[0,170,170],[170,170,170],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],CMD:[[0,0,0],[128,0,0],[0,128,0],[128,128,0],[0,0,128],[128,0,128],[0,128,128],[192,192,192],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]],"Terminal.app":[[0,0,0],[194,54,33],[37,188,36],[173,173,39],[73,46,225],[211,56,211],[51,187,200],[203,204,205],[129,131,131],[252,57,31],[49,231,34],[234,236,35],[88,51,255],[249,53,248],[20,240,240],[233,235,235]],PuTTY:[[0,0,0],[187,0,0],[0,187,0],[187,187,0],[0,0,187],[187,0,187],[0,187,187],[187,187,187],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],mlRC:[[0,0,0],[127,0,0],[0,147,0],[252,127,0],[0,0,127],[156,0,156],[0,147,147],[210,210,210],[127,127,127],[255,0,0],[0,252,0],[255,255,0],[0,0,252],[255,0,255],[0,255,255],[255,255,255]],xterm:[[0,0,0],[205,0,0],[0,205,0],[205,205,0],[0,0,238],[205,0,205],[0,205,205],[229,229,229],[127,127,127],[255,0,0],[0,255,0],[255,255,0],[92,92,255],[255,0,255],[0,255,255],[255,255,255]],Ubuntu:[[1,1,1],[222,56,43],[57,181,74],[255,199,6],[0,111,184],[118,38,113],[44,181,233],[204,204,204],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]]};function m(t){return b(x.standard.concat(x.highIntensity).findIndex(r=>r===t))}const y="[",C=(t=0)=>y+t+"K";function k(t,r){if(function(t){return 0===t}(t.length))return"";if(h(r))return""+t;const e=[],o=[],{foreground:n,background:s}=r;n&&(e.push(m(n).foreground),o.push("39")),s&&(e.push(m(s).background),o.push("49"));const{set:i,reset:u}=g(r);i.length>0&&e.push(i),u.length>0&&o.push(u);return`[${e.join(";")}m`+t+`[${o.join(";")}m`}const j="\n";function N(r,e){e={showHidden:!0,depth:null,colors:!0,maxArrayLength:null,compact:!1,sorted:!0,...e};const{dividers:o=!0,title:n=!0}=e.display??{},s="-".repeat(80),i=[],c=function(t){const r=[];if(!d(t))return r;const{type:e="error",name:o,code:n,message:s,data:i,date:c=!0,stack:a=!1}=t,f="时间",h="名称",g="代码",b="消息",x="数据",w="堆栈",m=(t,e)=>{if(p(e)){const t=k(` ${e} `,{foreground:"lightwhite",background:"cyan"});r.push(j+t)}r.push(t)};if(Object.keys(t).forEach(t=>{switch(t){case"name":p(o)&&m(o,h);break;case"code":(u(n)||p(n))&&m(n,g);break;case"message":p(s)&&m(s,b);break;case"data":m(i,x)}}),c){const t=(new Date).toLocaleString();m(k(t,{foreground:"magenta"}),f)}if(a||l(e,"error")&&r.length>0){const t=(new Error).stack;if(p(t)){const r=k(j+t.split(j).slice(3).join(j),{foreground:"red"});m(r,w)}}return r}(r);return n&&i.push(function(t="error",r){if(!p(r))return"";const e=e=>[k(` ${t.toLocaleUpperCase()} `,{foreground:"lightwhite",background:e}),k(r,{foreground:e})].join(" ");switch(t){case"warn":return e("yellow");case"info":return e("green");case"error":default:return e("lightred")}}(r.type,r.title)),o?i.push(j+s,...c,j+s):i.push(...c),0!==c.length&&(i[0]=j+i[0].trimStart(),i.push(j)),t.formatWithOptions({...e},...i)}function $(t,...r){return console.log(N({title:r.join("\n "),type:t,date:!1,stack:!1},{display:{title:!0,dividers:!1}}))}const O=()=>""+C();exports.COLORS_CODE=x,exports.CSI=y,exports.ESC="",exports.ProgressBar=class{options;index;record;constructor(t){t={total:NaN,percentage:!0,count:!0,picture:!0,hiddenCursor:!0,...t},this.options=t,this.index=-1,this.record=[],this.reset()}reset(){const{total:t,percentage:r,count:e,picture:o,hiddenCursor:n}=this.options;let s=[];const i=this.index+1;if(f(t)){if(o){const r=Math.floor(i/t*10),e="#".repeat(r).padEnd(10," ");s.push(`[${e}]`)}if(r){const r=Math.floor(i/t*100);s.push(r+"%")}e&&s.push(`(${i}/${t})`)}else s.push("RUNNING:");n&&(s[0]="[?25l"+(s[0]??"")),this.record=s}write(t=""){return r.stdout.write(`${O()}${this.record.join(" ")} ${t}`),l(this.options.total,this.index)&&this.end()}pushWrite(t=""){return this.index++,this.reset(),this.write(t)}end(){let t=O();return this.options.hiddenCursor&&(t+="[?25h"),r.stdout.write(t),!0}},exports.ResetDevice="c",exports.SaveCursorAndAttr="7",exports.TERMINAL_COLOR_MAP=w,exports.ansiFormat=g,exports.colorCode24bit=function(t){if(!i(t)||3!==t.length)throw new TypeError(`[colorCode24bit]: colorCodes不是一个有效RGB数组, "${t}"`);t.forEach(t=>{if(!f(t)||t<0||t>255)throw new TypeError(`[colorCode24bit]: colorCode不是一个有效数字, "${t}"`)});const r=t.join(";");return{foreground:"38;2;"+r,background:"48;2;"+r}},exports.colorCode8bit=b,exports.colorNameCode24bit=function(t,r="Ubuntu"){const e=x.standard.concat(x.highIntensity).findIndex(r=>r===t),o=w[r];if(l(e,-1)||h(o)||h(o[e]))throw new Error(`[colorNameCode24bit]: colorName不是有效颜色值, "${t}"`);const n=o[e].join(";");return{foreground:"38;2;"+n,background:"48;2;"+n}},exports.colorNameCode3bit=function(t){const r=x.standard;let e=null;for(let o=0,n=r.length;o<n;o++){const n=r[o],s="light"+n;if(l(t,n)){e=30+o;break}if(l(t,s)){e=90+o;break}}if(null===e)throw new Error(`[colorNameCode3bit]: colorName不是有效颜色值, "${t}"`);return{foreground:e.toString(),background:(e+10).toString()}},exports.colorNameCode8bit=m,exports.cursorHidden="[?25l",exports.cursorMove=(t,r=1)=>y+r+{up:"A",down:"B",forward:"C",back:"D",next:"E",previous:"F",absolute:"G"}[t],exports.cursorOnLineBegin="",exports.cursorPosition=(t=1,r=1)=>`[${t};${r}H`,exports.cursorRestore="",exports.cursorSave="",exports.cursorShow="[?25h",exports.eraseLine=C,exports.eraseScreen=(t=0)=>y+t+"J",exports.fontColor=k,exports.format=N,exports.lineWrapClose="",exports.lineWrapOpen="",exports.printError=function(...t){return $("error",...t)},exports.printInfo=function(...t){return $("info",...t)},exports.printWarn=function(...t){return $("warn",...t)},exports.readByQuestion=function(t){return new Promise(r=>{const o=e.createInterface({input:process.stdin,output:process.stdout});o.question(t,t=>{o.close(),r(t.trim())})})},exports.restoreCursorAndAttr="8",exports.restoreFont="(",exports.scrollDown=(t=1)=>y+t+"T",exports.scrollPosition=(t=1,r=1)=>`[${t};${r}f`,exports.scrollUp=(t=1)=>y+t+"S";

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.term = {}, null, global.util, global.process$1, global.readline));
}(this, (function (exports, stream, util, process$1, readline) { 'use strict';
})(this, (function (exports, stream, util, process$1, readline) { 'use strict';

@@ -45,2 +45,6 @@ function isFunction(value) {

function isArrayHave(value) {
return isArray(value) && value.length > 0;
}
function isNull(value) {

@@ -50,10 +54,2 @@ return value === null;

function isUndefined(value) {
return typeof value === 'undefined';
}
function isArrayHave(value) {
return isArray(value) && value.length > 0;
}
function isNumberPrimitive(value) {

@@ -102,4 +98,11 @@ return typeof value === 'number';

function isObjectHave(value) {
return isObject(value) && Object.keys(value).length > 0;
function isObjectHave(value, methodLevel = 0) {
const f = methodLevel === 0
? Object.keys
: methodLevel === 1
? Object.getOwnPropertyNames
: methodLevel === 2
? Object.getOwnPropertySymbols
: Reflect.ownKeys;
return isObject(value) && f(value).length > 0;
}

@@ -115,2 +118,6 @@

function isUndefined(value) {
return typeof value === 'undefined';
}
function isZero(value) {

@@ -581,2 +588,5 @@ return value === 0;

class ProgressBar {
options;
index;
record;
constructor(options) {

@@ -690,2 +700,2 @@ options = {

})));
}));

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stream"),require("util"),require("process"),require("readline")):"function"==typeof define&&define.amd?define(["exports","stream","util","process","readline"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).term={},null,e.util,e.process$1,e.readline)}(this,(function(e,t,r,n,o){"use strict";function i(e){return function(e){return"string"==typeof e}(e)||function(e){return"object"==typeof e&&"String"===u(e)}(e)}function s(e){return!0===e}function u(e,t=!0){const r=Object.prototype.toString;let n=null;return function(e){return"function"==typeof e}(r)&&i(n=r.call(e))&&s(t)&&n.startsWith("[object ")&&n.endsWith("]")?n.slice(8,-1):n}function c(e){return Array.isArray(e)}function l(e){return void 0===e}function a(e){return function(e){return"number"==typeof e}(e)||function(e){return"object"==typeof e&&"Number"===u(e)}(e)}function d(e){return!1===e}function f(e){return Number.isNaN(e)}function h(e,...t){const r=f(e)?e=>f(e):t=>e===t;if(function(e){return c(e)&&e.length>0}(t)){for(let e=0,n=t.length;e<n;e++)if(d(r(t[e])))return!1;return!0}return!1}function p(e){return function(e){return"Object"===u(e)}(e)&&Object.keys(e).length>0}function g(e){return i(e)&&e.length>0}function b(e){return Number.isSafeInteger(e)&&e>=0}function m(e={}){const t=[],r=[],n=["bold","dim","italic","underlined","blink","rapidBlink","reverse","hidden","crossedOut"];for(let o=0,i=n.length;o<i;o++){const i=n[o],u=e[i];let c=21;if(!l(u))switch(i){case"bold":c++;default:s(u)?(t.push(o+1),r.push(o+c)):d(u)&&r.push(o+c)}}return{set:t.join(";"),reset:r.join(";")}}function w(e){if(!b(e)||e<0||e>255)throw new TypeError(`[colorCode8bit]: colorCode不是一个有效数字, "${e}"`);return{foreground:"38;5;"+e,background:"48;5;"+e}}const y={standard:["black","red","green","yellow","blue","magenta","cyan","white"],highIntensity:["lightblack","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","lightwhite"]},C={VGA:[[0,0,0],[170,0,0],[0,170,0],[170,85,0],[0,0,170],[170,0,170],[0,170,170],[170,170,170],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],CMD:[[0,0,0],[128,0,0],[0,128,0],[128,128,0],[0,0,128],[128,0,128],[0,128,128],[192,192,192],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]],"Terminal.app":[[0,0,0],[194,54,33],[37,188,36],[173,173,39],[73,46,225],[211,56,211],[51,187,200],[203,204,205],[129,131,131],[252,57,31],[49,231,34],[234,236,35],[88,51,255],[249,53,248],[20,240,240],[233,235,235]],PuTTY:[[0,0,0],[187,0,0],[0,187,0],[187,187,0],[0,0,187],[187,0,187],[0,187,187],[187,187,187],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],mlRC:[[0,0,0],[127,0,0],[0,147,0],[252,127,0],[0,0,127],[156,0,156],[0,147,147],[210,210,210],[127,127,127],[255,0,0],[0,252,0],[255,255,0],[0,0,252],[255,0,255],[0,255,255],[255,255,255]],xterm:[[0,0,0],[205,0,0],[0,205,0],[205,205,0],[0,0,238],[205,0,205],[0,205,205],[229,229,229],[127,127,127],[255,0,0],[0,255,0],[255,255,0],[92,92,255],[255,0,255],[0,255,255],[255,255,255]],Ubuntu:[[1,1,1],[222,56,43],[57,181,74],[255,199,6],[0,111,184],[118,38,113],[44,181,233],[204,204,204],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]]};function k(e){return w(y.standard.concat(y.highIntensity).findIndex(t=>t===e))}const $="[",j=(e=0)=>$+e+"K";function N(e,t){if(function(e){return 0===e}(e.length))return"";if(l(t))return""+e;const r=[],n=[],{foreground:o,background:i}=t;o&&(r.push(k(o).foreground),n.push("39")),i&&(r.push(k(i).background),n.push("49"));const{set:s,reset:u}=m(t);return s.length>0&&r.push(s),u.length>0&&n.push(u),`[${r.join(";")}m`+e+`[${n.join(";")}m`}const E="\n";function S(e,t){t={showHidden:!0,depth:null,colors:!0,maxArrayLength:null,compact:!1,sorted:!0,...t};const{dividers:n=!0,title:o=!0}=t.display??{},i="-".repeat(80),s=[],u=function(e){const t=[];if(!p(e))return t;const{type:r="error",name:n,code:o,message:i,data:s,date:u=!0,stack:c=!1}=e,l="时间",d="名称",f="代码",b="消息",m="数据",w="堆栈",y=(e,r)=>{if(g(r)){const e=N(` ${r} `,{foreground:"lightwhite",background:"cyan"});t.push(E+e)}t.push(e)};if(Object.keys(e).forEach(e=>{switch(e){case"name":g(n)&&y(n,d);break;case"code":(a(o)||g(o))&&y(o,f);break;case"message":g(i)&&y(i,b);break;case"data":y(s,m)}}),u){const e=(new Date).toLocaleString();y(N(e,{foreground:"magenta"}),l)}if(c||h(r,"error")&&t.length>0){const e=(new Error).stack;if(g(e)){const t=N(E+e.split(E).slice(3).join(E),{foreground:"red"});y(t,w)}}return t}(e);return o&&s.push(function(e="error",t){if(!g(t))return"";const r=r=>[N(` ${e.toLocaleUpperCase()} `,{foreground:"lightwhite",background:r}),N(t,{foreground:r})].join(" ");switch(e){case"warn":return r("yellow");case"info":return r("green");case"error":default:return r("lightred")}}(e.type,e.title)),n?s.push(E+i,...u,E+i):s.push(...u),0!==u.length&&(s[0]=E+s[0].trimStart(),s.push(E)),r.formatWithOptions({...t},...s)}function O(e,...t){return console.log(S({title:t.join("\n "),type:e,date:!1,stack:!1},{display:{title:!0,dividers:!1}}))}const A=()=>""+j();e.COLORS_CODE=y,e.CSI=$,e.ESC="",e.ProgressBar=class{constructor(e){e={total:NaN,percentage:!0,count:!0,picture:!0,hiddenCursor:!0,...e},this.options=e,this.index=-1,this.record=[],this.reset()}reset(){const{total:e,percentage:t,count:r,picture:n,hiddenCursor:o}=this.options;let i=[];const s=this.index+1;if(b(e)){if(n){const t=Math.floor(s/e*10),r="#".repeat(t).padEnd(10," ");i.push(`[${r}]`)}if(t){const t=Math.floor(s/e*100);i.push(t+"%")}r&&i.push(`(${s}/${e})`)}else i.push("RUNNING:");o&&(i[0]="[?25l"+(i[0]??"")),this.record=i}write(e=""){return n.stdout.write(`${A()}${this.record.join(" ")} ${e}`),h(this.options.total,this.index)&&this.end()}pushWrite(e=""){return this.index++,this.reset(),this.write(e)}end(){let e=A();return this.options.hiddenCursor&&(e+="[?25h"),n.stdout.write(e),!0}},e.ResetDevice="c",e.SaveCursorAndAttr="7",e.TERMINAL_COLOR_MAP=C,e.ansiFormat=m,e.colorCode24bit=function(e){if(!c(e)||3!==e.length)throw new TypeError(`[colorCode24bit]: colorCodes不是一个有效RGB数组, "${e}"`);e.forEach(e=>{if(!b(e)||e<0||e>255)throw new TypeError(`[colorCode24bit]: colorCode不是一个有效数字, "${e}"`)});const t=e.join(";");return{foreground:"38;2;"+t,background:"48;2;"+t}},e.colorCode8bit=w,e.colorNameCode24bit=function(e,t="Ubuntu"){const r=y.standard.concat(y.highIntensity).findIndex(t=>t===e),n=C[t];if(h(r,-1)||l(n)||l(n[r]))throw new Error(`[colorNameCode24bit]: colorName不是有效颜色值, "${e}"`);const o=n[r].join(";");return{foreground:"38;2;"+o,background:"48;2;"+o}},e.colorNameCode3bit=function(e){const t=y.standard;let r=null;for(let n=0,o=t.length;n<o;n++){const o=t[n],i="light"+o;if(h(e,o)){r=30+n;break}if(h(e,i)){r=90+n;break}}if(null===r)throw new Error(`[colorNameCode3bit]: colorName不是有效颜色值, "${e}"`);return{foreground:r.toString(),background:(r+10).toString()}},e.colorNameCode8bit=k,e.cursorHidden="[?25l",e.cursorMove=(e,t=1)=>$+t+{up:"A",down:"B",forward:"C",back:"D",next:"E",previous:"F",absolute:"G"}[e],e.cursorOnLineBegin="",e.cursorPosition=(e=1,t=1)=>`[${e};${t}H`,e.cursorRestore="",e.cursorSave="",e.cursorShow="[?25h",e.eraseLine=j,e.eraseScreen=(e=0)=>$+e+"J",e.fontColor=N,e.format=S,e.lineWrapClose="",e.lineWrapOpen="",e.printError=function(...e){return O("error",...e)},e.printInfo=function(...e){return O("info",...e)},e.printWarn=function(...e){return O("warn",...e)},e.readByQuestion=function(e){return new Promise(t=>{const r=o.createInterface({input:process.stdin,output:process.stdout});r.question(e,e=>{r.close(),t(e.trim())})})},e.restoreCursorAndAttr="8",e.restoreFont="(",e.scrollDown=(e=1)=>$+e+"T",e.scrollPosition=(e=1,t=1)=>`[${e};${t}f`,e.scrollUp=(e=1)=>$+e+"S",Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stream"),require("util"),require("process"),require("readline")):"function"==typeof define&&define.amd?define(["exports","stream","util","process","readline"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).term={},null,e.util,e.process$1,e.readline)}(this,(function(e,t,r,n,o){"use strict";function i(e){return function(e){return"string"==typeof e}(e)||function(e){return"object"==typeof e&&"String"===u(e)}(e)}function s(e){return!0===e}function u(e,t=!0){const r=Object.prototype.toString;let n=null;return function(e){return"function"==typeof e}(r)&&i(n=r.call(e))&&s(t)&&n.startsWith("[object ")&&n.endsWith("]")?n.slice(8,-1):n}function c(e){return Array.isArray(e)}function l(e){return function(e){return"number"==typeof e}(e)||function(e){return"object"==typeof e&&"Number"===u(e)}(e)}function a(e){return!1===e}function d(e){return Number.isNaN(e)}function f(e,...t){const r=d(e)?e=>d(e):t=>e===t;if(function(e){return c(e)&&e.length>0}(t)){for(let e=0,n=t.length;e<n;e++)if(a(r(t[e])))return!1;return!0}return!1}function h(e,t=0){const r=0===t?Object.keys:1===t?Object.getOwnPropertyNames:2===t?Object.getOwnPropertySymbols:Reflect.ownKeys;return function(e){return"Object"===u(e)}(e)&&r(e).length>0}function p(e){return i(e)&&e.length>0}function g(e){return Number.isSafeInteger(e)&&e>=0}function b(e){return void 0===e}function m(e={}){const t=[],r=[],n=["bold","dim","italic","underlined","blink","rapidBlink","reverse","hidden","crossedOut"];for(let o=0,i=n.length;o<i;o++){const i=n[o],u=e[i];let c=21;if(!b(u))switch(i){case"bold":c++;default:s(u)?(t.push(o+1),r.push(o+c)):a(u)&&r.push(o+c)}}return{set:t.join(";"),reset:r.join(";")}}function y(e){if(!g(e)||e<0||e>255)throw new TypeError(`[colorCode8bit]: colorCode不是一个有效数字, "${e}"`);return{foreground:"38;5;"+e,background:"48;5;"+e}}const w={standard:["black","red","green","yellow","blue","magenta","cyan","white"],highIntensity:["lightblack","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","lightwhite"]},C={VGA:[[0,0,0],[170,0,0],[0,170,0],[170,85,0],[0,0,170],[170,0,170],[0,170,170],[170,170,170],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],CMD:[[0,0,0],[128,0,0],[0,128,0],[128,128,0],[0,0,128],[128,0,128],[0,128,128],[192,192,192],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]],"Terminal.app":[[0,0,0],[194,54,33],[37,188,36],[173,173,39],[73,46,225],[211,56,211],[51,187,200],[203,204,205],[129,131,131],[252,57,31],[49,231,34],[234,236,35],[88,51,255],[249,53,248],[20,240,240],[233,235,235]],PuTTY:[[0,0,0],[187,0,0],[0,187,0],[187,187,0],[0,0,187],[187,0,187],[0,187,187],[187,187,187],[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]],mlRC:[[0,0,0],[127,0,0],[0,147,0],[252,127,0],[0,0,127],[156,0,156],[0,147,147],[210,210,210],[127,127,127],[255,0,0],[0,252,0],[255,255,0],[0,0,252],[255,0,255],[0,255,255],[255,255,255]],xterm:[[0,0,0],[205,0,0],[0,205,0],[205,205,0],[0,0,238],[205,0,205],[0,205,205],[229,229,229],[127,127,127],[255,0,0],[0,255,0],[255,255,0],[92,92,255],[255,0,255],[0,255,255],[255,255,255]],Ubuntu:[[1,1,1],[222,56,43],[57,181,74],[255,199,6],[0,111,184],[118,38,113],[44,181,233],[204,204,204],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]]};function k(e){return y(w.standard.concat(w.highIntensity).findIndex(t=>t===e))}const j="[",$=(e=0)=>j+e+"K";function N(e,t){if(function(e){return 0===e}(e.length))return"";if(b(t))return""+e;const r=[],n=[],{foreground:o,background:i}=t;o&&(r.push(k(o).foreground),n.push("39")),i&&(r.push(k(i).background),n.push("49"));const{set:s,reset:u}=m(t);s.length>0&&r.push(s),u.length>0&&n.push(u);return`[${r.join(";")}m`+e+`[${n.join(";")}m`}const O="\n";function E(e,t){t={showHidden:!0,depth:null,colors:!0,maxArrayLength:null,compact:!1,sorted:!0,...t};const{dividers:n=!0,title:o=!0}=t.display??{},i="-".repeat(80),s=[],u=function(e){const t=[];if(!h(e))return t;const{type:r="error",name:n,code:o,message:i,data:s,date:u=!0,stack:c=!1}=e,a="时间",d="名称",g="代码",b="消息",m="数据",y="堆栈",w=(e,r)=>{if(p(r)){const e=N(` ${r} `,{foreground:"lightwhite",background:"cyan"});t.push(O+e)}t.push(e)};if(Object.keys(e).forEach(e=>{switch(e){case"name":p(n)&&w(n,d);break;case"code":(l(o)||p(o))&&w(o,g);break;case"message":p(i)&&w(i,b);break;case"data":w(s,m)}}),u){const e=(new Date).toLocaleString();w(N(e,{foreground:"magenta"}),a)}if(c||f(r,"error")&&t.length>0){const e=(new Error).stack;if(p(e)){const t=N(O+e.split(O).slice(3).join(O),{foreground:"red"});w(t,y)}}return t}(e);return o&&s.push(function(e="error",t){if(!p(t))return"";const r=r=>[N(` ${e.toLocaleUpperCase()} `,{foreground:"lightwhite",background:r}),N(t,{foreground:r})].join(" ");switch(e){case"warn":return r("yellow");case"info":return r("green");case"error":default:return r("lightred")}}(e.type,e.title)),n?s.push(O+i,...u,O+i):s.push(...u),0!==u.length&&(s[0]=O+s[0].trimStart(),s.push(O)),r.formatWithOptions({...t},...s)}function S(e,...t){return console.log(E({title:t.join("\n "),type:e,date:!1,stack:!1},{display:{title:!0,dividers:!1}}))}const x=()=>""+$();e.COLORS_CODE=w,e.CSI=j,e.ESC="",e.ProgressBar=class{options;index;record;constructor(e){e={total:NaN,percentage:!0,count:!0,picture:!0,hiddenCursor:!0,...e},this.options=e,this.index=-1,this.record=[],this.reset()}reset(){const{total:e,percentage:t,count:r,picture:n,hiddenCursor:o}=this.options;let i=[];const s=this.index+1;if(g(e)){if(n){const t=Math.floor(s/e*10),r="#".repeat(t).padEnd(10," ");i.push(`[${r}]`)}if(t){const t=Math.floor(s/e*100);i.push(t+"%")}r&&i.push(`(${s}/${e})`)}else i.push("RUNNING:");o&&(i[0]="[?25l"+(i[0]??"")),this.record=i}write(e=""){return n.stdout.write(`${x()}${this.record.join(" ")} ${e}`),f(this.options.total,this.index)&&this.end()}pushWrite(e=""){return this.index++,this.reset(),this.write(e)}end(){let e=x();return this.options.hiddenCursor&&(e+="[?25h"),n.stdout.write(e),!0}},e.ResetDevice="c",e.SaveCursorAndAttr="7",e.TERMINAL_COLOR_MAP=C,e.ansiFormat=m,e.colorCode24bit=function(e){if(!c(e)||3!==e.length)throw new TypeError(`[colorCode24bit]: colorCodes不是一个有效RGB数组, "${e}"`);e.forEach(e=>{if(!g(e)||e<0||e>255)throw new TypeError(`[colorCode24bit]: colorCode不是一个有效数字, "${e}"`)});const t=e.join(";");return{foreground:"38;2;"+t,background:"48;2;"+t}},e.colorCode8bit=y,e.colorNameCode24bit=function(e,t="Ubuntu"){const r=w.standard.concat(w.highIntensity).findIndex(t=>t===e),n=C[t];if(f(r,-1)||b(n)||b(n[r]))throw new Error(`[colorNameCode24bit]: colorName不是有效颜色值, "${e}"`);const o=n[r].join(";");return{foreground:"38;2;"+o,background:"48;2;"+o}},e.colorNameCode3bit=function(e){const t=w.standard;let r=null;for(let n=0,o=t.length;n<o;n++){const o=t[n],i="light"+o;if(f(e,o)){r=30+n;break}if(f(e,i)){r=90+n;break}}if(null===r)throw new Error(`[colorNameCode3bit]: colorName不是有效颜色值, "${e}"`);return{foreground:r.toString(),background:(r+10).toString()}},e.colorNameCode8bit=k,e.cursorHidden="[?25l",e.cursorMove=(e,t=1)=>j+t+{up:"A",down:"B",forward:"C",back:"D",next:"E",previous:"F",absolute:"G"}[e],e.cursorOnLineBegin="",e.cursorPosition=(e=1,t=1)=>`[${e};${t}H`,e.cursorRestore="",e.cursorSave="",e.cursorShow="[?25h",e.eraseLine=$,e.eraseScreen=(e=0)=>j+e+"J",e.fontColor=N,e.format=E,e.lineWrapClose="",e.lineWrapOpen="",e.printError=function(...e){return S("error",...e)},e.printInfo=function(...e){return S("info",...e)},e.printWarn=function(...e){return S("warn",...e)},e.readByQuestion=function(e){return new Promise(t=>{const r=o.createInterface({input:process.stdin,output:process.stdout});r.question(e,e=>{r.close(),t(e.trim())})})},e.restoreCursorAndAttr="8",e.restoreFont="(",e.scrollDown=(e=1)=>j+e+"T",e.scrollPosition=(e=1,t=1)=>`[${e};${t}f`,e.scrollUp=(e=1)=>j+e+"S",Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@curong/term",
"version": "0.0.0-alpha.5",
"version": "0.1.0",
"license": "MIT",

@@ -28,9 +28,9 @@ "author": {

"access": "public",
"registry": "http://registry.npmjs.org/"
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"@curong/types": "^0.0.0-alpha.5"
"@curong/types": "^0.1.0"
},
"sideEffects": false,
"gitHead": "04f140c3b1bb6673b1a0f79a00e3c770cf9a5a19"
"gitHead": "14398671ee89125c02691430ab4e00b1e8a4a4d3"
}
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