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

ratty

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ratty - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

src/node/.eslintrc.yml

6

package.json
{
"name": "ratty",
"version": "0.3.0",
"version": "0.3.1",
"description": "Record and replay terminal sessions.",

@@ -10,2 +10,3 @@ "author": "Andrea Cardaci <cyrus.and@gmail.com>",

"@babel/core": "^7.12.3",
"@babel/eslint-parser": "^7.14.4",
"@babel/plugin-proposal-class-properties": "^7.12.1",

@@ -17,2 +18,4 @@ "@babel/plugin-transform-runtime": "^7.12.1",

"css-loader": "^5.2.4",
"eslint": "^7.27.0",
"eslint-plugin-react": "^7.24.0",
"file-loader": "^6.1.1",

@@ -42,2 +45,3 @@ "font-awesome": "^4.7.0",

"scripts": {
"lint": "eslint src/",
"prepack": "rm -fr dist/ && npm run package-production && rm dist/*.map",

@@ -44,0 +48,0 @@ "package-development": "webpack --mode development",

2

README.md

@@ -26,3 +26,3 @@ # ratty

```
ratty player
ratty play session.ratty
```

@@ -43,3 +43,3 @@ #!/usr/bin/env node

} catch (err) {
log.error(err.message);
log.error(`Cannot save session: ${err}`);
}

@@ -49,18 +49,31 @@ });

program
.command('player')
.description('Start the web player.')
.command('play [<file>]')
.description('Start the web player optionally autoloading a session.')
.option('--host <host>', 'Start the server on <host>', 'localhost')
.option('--port <port>', 'Start the server on <port> instead of random', 0)
.option('-s, --serve-everything', 'Serve arbitrary session files')
.option('-O, --no-open', 'Do not open the URL automatically')
.action((options) => {
.action((session, options) => {
const open = require('open');
const player = require('../lib/player');
const path = require('path');
const play = require('../lib/play');
// find the absolute path unless it is an url and add it to the hash
if (session && !/^https?:/.test(session)) {
session = path.resolve(session);
}
// serve the player
const server = player(options).on('listening', () => {
const server = play(session, options).on('listening', () => {
// compute the listening URL
const url = `http://${options.host}:${server.address().port}`;
let url = `http://${options.host}:${server.address().port}`;
log.info(`Listening on ${url}`);
// add the session if provided
if (session) {
url += `#${session}`;
}
log.info(`Player running at ${url}`);
log.info('Use Ctrl-C to exit...');
// open the browser automatically

@@ -71,3 +84,3 @@ if (options.open) {

}).on('error', (err) => {
log.error(err.message);
log.error(`Cannot start server: ${err}`);
});

@@ -74,0 +87,0 @@

const chalk = require('chalk');
function log(marker, message) {
console.log(`[${marker}] ${message}`);
console.log(`${chalk.inverse(marker)} ${message}`);
}
function info(message) {
log(chalk.green('+'), message);
log(chalk.green(' INFO '), message);
}
function error(message) {
log(chalk.red('!'), message);
log(chalk.red(' ERROR '), message);
}
module.exports = {info, error};

@@ -19,3 +19,3 @@ const fs = require('fs');

// compute the delay relative to the epoch
delay = timestamp - epoch;
const delay = timestamp - epoch;

@@ -32,2 +32,5 @@ // save the JSON representation of the record (one per line)

// flush the frame so to display the next output in the resized terminal
flush();
// resize the terminal

@@ -46,2 +49,5 @@ ptyProcess.resize(columns, rows);

// open the file for writing
const fd = fs.openSync(options.output, 'w', 0o600);
// create a compressed stream to write the data to

@@ -51,3 +57,3 @@ const session = zlib.createGzip();

// pipe it to the output file
session.pipe(fs.createWriteStream(options.output, {mode: 0o600}));
session.pipe(fs.createWriteStream(null, {fd}));

@@ -58,3 +64,9 @@ // write the header

// run the command
const ptyProcess = pty.spawn(argv[0], argv.slice(1));
const rattyLevel = (parseInt(process.env['RATTY_LEVEL'], 10) || 0) + 1;
const ptyProcess = pty.spawn(argv[0], argv.slice(1), {
env: {
...process.env,
RATTY_LEVEL: rattyLevel // similar to SHLVL
}
});

@@ -61,0 +73,0 @@ // handle the terminal resize and syntetically trigger the first time

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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