npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rinore

v2.3.0

Published

Rich Node.js REPL

Downloads

1,811

Readme

npm version test Coverage Status

Rinore

Rich Node.js REPL

Rinore was extracted from CORMO. CORMO console provided an interactive shell like Rails console or django shell.

Features

Rinore has following features additional to the original Node.js REPL.

  • can select JavaScript or CoffeeScript or TypeScript
  • expose modules to the REPL
  • support Promise
  • show function arguments for Tab completion
  • reload local module if its content is changed

Usages

Run

$ rinore
rinore> path.extname('index.html')
'.html'

For CoffeeScript:

$ rinore -l coffeescript
rinore> path.extname 'index.html'
'.html'

For TypeScript:

$ rinore -l typescript
rinore> path.extname('index.html')
'.html'

Load modules

Use '-r' or '--require' to load modules:

$ rinore -r lodash
Loading module 'lodash'...
rinore> lodash([1, 2, 3]).map(v => v * 2).reverse().value()
[ 6, 4, 2 ]

You can specify an another name using ::

$ rinore -r lodash:l
Loading module 'lodash' as 'l'...
rinore> l([1, 2, 3]).map(v => v * 2).reverse().value()
[ 6, 4, 2 ]

If you give a name *, all exported objects are spread to the global:

$ cat util.js
exports.add = (a, b) => a + b
exports.sub = (a, b) => a - b
$ rinore -r util:*
Loading module 'util' as '*'...
rinore> add(1, 2)
3
rinore> sub(10, 3)
7

Or you can use rinore.context to expose your objects:

$ cat util.js
const rinore = require('rinore');
rinore.context.add = (a, b) => a + b
$ rinore -r util
Loading module 'util'...
rinore> add(1, 2)
3

Promise support

If an expression returns Promise, Rinore waits until it resolves:

rinore> new Promise(resolve => resolve('done'))
'done'

You can assign the result of Promise to a variable:

rinore> result = new Promise(resolve => resolve('done'))
'done'
rinore> result.length
4

If you are using TypeScript, you should use await keyword:

$ rinore -l typescript
rinore> const result = await new Promise<string>(resolve => resolve('done'))
undefined
rinore> result.length
4

Runtime invocation

Rinore can be started in the middle of a running program.

$ cat util.js
const rinore = require('.');
rinore.context.add = (a, b) => a + b
rinore.start();
$ node util.js
rinore> add(1, 2)
3

Show function arguments

Rinore shows function arguments when Tab is pressed.

rinore> util.inspect<Tab>
util.inspect(obj, opts)
rinore> console.log(url.parse(<Tab>
url.parse(url, parseQueryString, slashesDenoteHost)

package.json

You can specify CLI arguments in the package.json

{
  "rinore": {
    "language": "coffeescript",
    "require": [
      "bluebird:Promise",
      "lodash"
    ]
  }
}

Running Rinore server

You can run a Rinore server via --listen argument.

$ rinore --listen 5678
Rinore is listening on 5678
rinore>

Or you can programmatically.

const net = require('net');
const rinore = require('.');
net.createServer((socket) => {
  console.log('Starting new session...');
  rinore.start({input: socket, output: socket, terminal: true})
  .on('exit', () => {
    console.log('Session closed.');
    socket.end();
  });
}).listen(2000, (error) => {
  if (error) {
    console.log(error);
  } else {
    console.log('Rinore is listening on 2000');
  }
});

You can connect to this server via telnet or rinore-remote.

$ telnet localhost 2000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
rinore> 1+1
1+1
2
rinore> ^]
telnet> quit
Connection closed.
$ rinore-remote 2000
rinore> 1+1
2

Inspiration

To find best REPL experience, Rinore has referred some projects:

License

MIT licenses. See LICENSE for more details.