Socket
Socket
Sign inDemoInstall

repll

Package Overview
Dependencies
0
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.2 to 1.4.3

32

dist/index.js

@@ -16,21 +16,21 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"UOOq":[function(require,module,exports) {

},{}],"QUZx":[function(require,module,exports) {
function e(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const{moveCursor:t,clearScreenDown:i,cursorTo:s,createInterface:r}=require("readline"),{stringBleach:n,wiseUpdate:h}=require("./utils"),{EOL:l,platform:o}=require("os"),a=require("events"),u="[";let p=null;class c extends a{constructor(a){
function e(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const{moveCursor:t,clearScreenDown:i,cursorTo:s,createInterface:r}=require("readline"),{stringBleach:n,wiseUpdate:h}=require("./utils"),{EOL:l,platform:o}=require("os"),a=require("events"),u="[";let c=null;class p extends a{constructor(a){
// Deconstruct prompts && placeholders
const c=[],f=[];super((()=>{Object.keys(a).forEach(e=>{c.push(e),f.push(a[e])}),(// Set prompt interface
p=r({input:process.stdin,output:process.stdout,prompt:c[0].replace("<hide>",()=>`${u}?25l`).replace("<ig>",""),
const p=[],f=[];super((()=>{Object.keys(a).forEach(e=>{p.push(e),f.push(a[e])}),(// Set prompt interface
c=r({input:process.stdin,output:process.stdout,prompt:p[0].replace("<hide>",()=>`${u}?25l`).replace("<ig>",""),
// Disable tab
completer:()=>[[]]})).prompt(),p.input.setEncoding("utf8");process.stdin.on("data",e=>{c[this.inputLine-1].match(/\<ig\>/)&&this.write(null,{name:"u",ctrl:!0});const t=p._previousKey;// Handle paste(fixed /\n$/ text)
if(this.input=this.fixFakeLine(),this.emit("any",t),e.length>1&&!t.code)return p.history&&(this.write(null,{name:"up"}),p.history=[],p.historyIndex=-1),this.refreshInput(),this.lastLine=this.input,this.history[this.inputLine-1]=this.input,void this.emit("key",e);const i=`${t.ctrl?"^":""}${t.name}`;// Register Event: 'arrow' 'complete' 'submit' 'key' 'any'
completer:()=>[[]]})).prompt(),c.input.setEncoding("utf8");process.stdin.on("data",e=>{p[this.inputLine-1].match(/\<ig\>/)&&this.write(null,{name:"u",ctrl:!0});const t=c._previousKey;// Handle paste(fixed /\n$/ text)
if(this.input=this.fixFakeLine(),this.emit("any",t),e.length>1&&!t.code)return c.history&&(this.write(null,{name:"up"}),c.history=[],c.historyIndex=-1),this.refreshInput(),this.lastLine=this.input,this.history[this.inputLine-1]=this.input,void this.emit("key",e);const i=`${t.ctrl?"^":""}${t.name}`;// Register Event: 'arrow' 'complete' 'submit' 'key' 'any'
switch(i){case"^c":case"^d":this.removeAllListeners(),this.write("[?25h"),process.exit();
// Arrow key
case/(up|down|left|right)/.test(i)?i:null:if("down"===i&&t.shift){this.refresh();const e=process.stdout.columns*this.fakeLineBreak++-p.line.length;this.lineFake(e),this.emit("fakeLine");break}this.emit("arrow",i);break;case"^u":this.refresh();break;case"tab":this.emit("complete",this.input);break;case"backspace":
case/(up|down|left|right)/.test(i)?i:null:if("down"===i&&t.shift){this.refresh();const e=process.stdout.columns*this.fakeLineBreak++-c.line.length;this.lineFake(e),this.emit("fakeLine");break}this.emit("arrow",i);break;case"^u":this.refresh();break;case"tab":this.emit("complete",this.input);break;case"backspace":
// Show placeholder when input gets empty
p.line||this.writePlaceholder(f[this.inputLine-1]),this.fakeLineBreak>1&&(p.line=p.line.replace(/(\s+↵\s)$/,e=>(p.cursor=p.line.length-e.length+1,this.fakeLineBreak--,"")));break;case"return":{
c.line||this.writePlaceholder(f[this.inputLine-1]),this.fakeLineBreak>1&&(c.line=c.line.replace(/(\s+↵\s)$/,e=>(c.cursor=c.line.length-e.length+1,this.fakeLineBreak--,"")));break;case"return":{
// Disable default arrow up/down
p.history=[];const e=c[this.inputLine];if(e){this.prompt(e),this.writePlaceholder(f[this.inputLine]),this.lastLine="",this.fakeLineBreak=1,this.emit("line",++this.inputLine);break}this.refreshInput(),this.emit("closed",this.history),this.inputLine=1,p.close();break}
c.history=[];const e=p[this.inputLine];if(e){this.prompt(e),this.writePlaceholder(f[this.inputLine]),this.lastLine="",this.fakeLineBreak=1,this.emit("line",++this.inputLine);break}this.refreshInput(),this.emit("closed",this.history),this.inputLine=1,c.close();break}
// Can not detect ^return, use ^s instead
case"^s":p.write(`${u}?25h`),this.emit("submit");break;default:this.lastLine=this.input,1===p.line.length&&this.refreshInput(),this.emit("key",t.sequence)}// Set input history livly
this.inputLine&&(this.history[this.inputLine-1]=this.input)})})()),e(this,"write",(e,t)=>{p.write(e,t),this.refreshInput()}),e(this,"refresh",(e="",r)=>{const{cols:a}=p.getCursorPos(),u=p.output;let c=[];c=e?h(this.lastOutput,e):r?[!1,!0,r]:[!0];const[f,m,d]=c;// Delete last time output
// Write output, Restore cursor
if(f&&p.line&&i(u),m){"win32"===o()&&d.replace(new RegExp(l,"g"),"\n");const e=n(d).split("\n").reduce((e,t)=>e+1+Math.floor(t.length/(process.stdout.columns+.01)),0)-1;u.write(d),s(u,a),t(u,0,-e)}this.lastOutput=d}),e(this,"hl",(e,i)=>{t(p.output,-e),p.output.write(i)}),e(this,"waitClosing",()=>new Promise(e=>{this.on("closed",t=>e(t))})),this.newInstance(c,f)}
case"^s":c.write(`${u}?25h`),this.emit("submit");break;default:this.lastLine=this.input,1===c.line.length&&this.refreshInput(),this.emit("key",t.sequence)}// Set input history livly
this.inputLine&&(this.history[this.inputLine-1]=this.input)})})()),e(this,"write",(e,t)=>{c.write(e,t),this.refreshInput()}),e(this,"refresh",(e="",r)=>{const{cols:a}=c.getCursorPos(),u=c.output;let p=[];p=e?h(this.lastOutput,e):r?[!1,!0,r]:[!0];const[f,m,d]=p;// Delete last time output
if(f&&c.line){i(u);const e=c.line.length-c.cursor;e&&u.write(c.line.slice(-e))}// Write output, Restore cursor
if(m){"win32"===o()&&d.replace(new RegExp(l,"g"),"\n");const e=n(d).split("\n").reduce((e,t)=>e+1+Math.floor(t.length/(process.stdout.columns+.01)),0)-1;u.write(d),s(u,a),t(u,0,-e)}this.lastOutput=d}),e(this,"hl",(e,i)=>{t(c.output,-e),c.output.write(i)}),e(this,"waitClosing",()=>new Promise(e=>{this.on("closed",t=>e(t))})),this.newInstance(p,f)}
/**

@@ -43,11 +43,11 @@ * Write input for user

writePlaceholder(e){this.placeholder=e||"",this.placeholder&&this.refresh(!1,`${u}90m${this.placeholder}${u}39m`)}// Faking a new line(a bad practice)
lineFake(e){for(let t=0;t<e-"↵ ".length;t++)p.write(" ");p.write("↵ ")}// Refresh input, clear stdout
refreshInput(){i(p.output)}prompt(e){e&&p.setPrompt(`${e.replace("<hide>",()=>`${u}?25l`)}`),p.prompt()}fixFakeLine(){const e=p.line;return this.fakeLineBreak>1?e.replace(/\s+↵\s/g,"\n"):e}newInstance(e,t){
lineFake(e){for(let t=0;t<e-"↵ ".length;t++)c.write(" ");c.write("↵ ")}// Refresh input, clear stdout
refreshInput(){i(c.output)}prompt(e){e&&c.setPrompt(`${e.replace("<hide>",()=>`${u}?25l`)}`),c.prompt()}fixFakeLine(){const e=c.line;return this.fakeLineBreak>1?e.replace(/\s+↵\s/g,"\n"):e}newInstance(e,t){
// Reserve last time output for less reprint
this.lastOutput="",// Count input lines
this.inputLine=1,// Export readline instance
this.rl=p,// Faking line break
this.rl=c,// Faking line break
this.fakeLineBreak=1,// Recording line history
this.history=[],// Tracking prompts and placeholders
this.prompts=e,this.placeholders=t,this.writePlaceholder(t[0])}}module.exports=c;
this.prompts=e,this.placeholders=t,this.writePlaceholder(t[0])}}module.exports=p;
},{"./utils":"UOOq"}],"Focm":[function(require,module,exports) {

@@ -54,0 +54,0 @@ const e=require("./lib/replLive"),{commonPrefix:n,praseCompletion:o}=require("./lib/utils");let t=null;const i={

{
"name": "repll",
"version": "1.4.2",
"version": "1.4.3",
"description": "node repl livly implementation",

@@ -5,0 +5,0 @@ "repository": "beetcb/repll",

<p align="center">
<a href="https://github.com/beetcb/repll">
<img src="assets/demo-commitlive.svg" alt="demo" width="600">
<img src="assets/demo-commitlive.svg" alt="demo" width="600"><br><br>
<img alt="npm" src="https://img.shields.io/npm/v/repll">
<img alt="npm" src="https://img.shields.io/badge/contribute-welcome-blue">
</a>

@@ -27,2 +29,3 @@ <h3 align="center">repll: customizable & livly repl</h3>

- `livly placeholder`: can be used to give user tips on what to do, it has `livly` feature too!
- `arrow key navigation`: you can using arrow keys to edit the text you input, we currently don't support `fake line` + `arrow key navigation`, this can lead to strange behavior, but the fact that it is still working 💊 (PR is welcome)

@@ -29,0 +32,0 @@ ### Get started!

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc