Locus is a debugging module for node.js

Overview

ʆ Locus

Locus is a debugging module which allows you to execute commands at runtime via a REPL.

asciicast

Installing

npm install locus --save-dev

Using

require('locus');

var myVar = 123;
var myObj = {
  key: 'value'
};

function makeSomething() {
  var some = 'some value';

  // will start a repl session
  // you can manipulate the program at runtime
  eval(locus);

  // another option
  eval(require('locus'))

  return some;
}

makeSomething();

Use exit command to leave.

Comments
  • Added cross-platform post-install script

    Added cross-platform post-install script

    I ran into problems with the existing post install script, mkdir ./histories, when running this command repeatedly. Running mkdir twice without -p set causes an error to be thrown, making re-installs unreliable.

    I rewrote the script in node.js for better cross-platform compatibility with Windows, which I unfortunately need to debug on in work.

    If you have any suggested edits let me know & I'll apply them quickly. Thanks for creating such a useful library!

    opened by rgrannell1 3
  • Consider replacement for sync-prompt?

    Consider replacement for sync-prompt?

    This looks great (I love and dearly rely on binding.pry in ruby. However as far as I can tell, sync-prompt has build issues with node 0.11, 0.12 and iojs 1.8.1. So it's sort of a barrier to use. Thanks.

    Related issues: shovon/sync-prompt#11 shovon/sync-prompt#15

    opened by thom-nic 3
  • Feature Request ↑

    Feature Request ↑

    Hello, great tool. I use it every day. However, it would be nice to do an arrow up to get back to the code you just tested to modify so we don't need to type it again!

    opened by imcodingideas 2
  • TypeError: Generator is already running

    TypeError: Generator is already running

    I get this whenever I try to type anything after the REPL is shown. Not in all places of the script, but in many. I don't know why, perhaps because I'm calling it inside callback functions or some other async magic?

    Here's an example:

     /home/fiatjaf/comp/wft/trelew/index.js - Line: 194 
    ————————————————————————————————————————————————————
    186 : 
    187 :     // list comments
    188 :     var comments = vorpal.find('comments')
    189 :     if (comments) comments.remove()
    190 :     vorpal
    191 :       .command('comments', "list this card's comments.")
    192 :       .alias('ls comments')
    193 :       .action(function (_, cb) {
    ʆ: readline.js:924
                throw err;
                ^
    
    TypeError: Generator is already running
        at next (native)
        at ReadStream.onData (readline.js:918:36)
        at emitOne (events.js:77:13)
        at ReadStream.emit (events.js:169:7)
        at readableAddChunk (_stream_readable.js:146:16)
        at ReadStream.Readable.push (_stream_readable.js:110:10)
        at TTY.onread (net.js:523:20)
        at Function.module.exports.loopWhile (/home/fiatjaf/comp/wft/trelew/node_modules/deasync/index.js:64:21)
        at CommandInstance.listener (eval at <anonymous> (/home/fiatjaf/comp/wft/trelew/index.js:195:14), <anonymous>:95:11)
        at eval (eval at <anonymous> (/home/fiatjaf/comp/wft/trelew/index.js:195:14), <anonymous>:96:4)
    fiatjaf@spooner ~/c/w/trelew> 
    
    opened by fiatjaf 2
  • Autocompletion Support

    Autocompletion Support

    Hey,

    I think it's possible and useful to add autocompletion to locus, I really like the idea, a true debugging assistant.

    I'm a little busy with a few open-source projects and some other work, but I will definitely take a look, what do you think @alidavut?

    opened by mdibaiee 2
  • Usage ?

    Usage ?

    I'm not even sure of what your lib does (since doc is so short). I guessed it is a debug tool.

    I try to follow the README and can't see any effect.

    npm install locus

    var locus = require('locus')
    
    console.log('Hello world !');
    var foo = 'bar';
    
    eval(locus);
    

    Would you mind enhancing the README a little ?

    opened by Offirmo 2
  • Bump lodash from 4.17.15 to 4.17.19

    Bump lodash from 4.17.15 to 4.17.19

    Bumps lodash from 4.17.15 to 4.17.19.

    Release notes

    Sourced from lodash's releases.

    4.17.16

    Commits
    Maintainer changes

    This version was pushed to npm by mathias, a new releaser for lodash since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • fix empty trace crash

    fix empty trace crash

    Hello. Awesome project! I hope it's not dead.

    I don't know why(I just launched locus first time), but I get an empty trace in my project(in some files). So I just add this guard and it works.

    opened by slavaGanzin 1
  • Unable to define new variables

    Unable to define new variables

    First off, this is amazing! I'm trying to debug an electron app, and the built in debugger sucks and crashes all the time. The pryjs package won't load at all. I installed this, and it did exactly what I expected right away.

    Now, when I try to define a new variable in the console (like you can with pry), I just get undefined returns.

    ʆ: var i = 0;
    undefined
    ʆ: i
    ReferenceError: i is not defined
    
    opened by jwoertink 1
  • Is it possible to use locus in node console?

    Is it possible to use locus in node console?

    Got following error when calling a function containing "eval(locus)": Error: ENOENT: no such file or directory, open 'repl'

    It would be great if it is possible to debug inside node console.

    opened by laseryuan 0
  • Bump i from 0.3.6 to 0.3.7

    Bump i from 0.3.6 to 0.3.7

    Bumps i from 0.3.6 to 0.3.7.

    Commits
    • 71961bd Version bump v0.3.7
    • a9a0a8e Fix CVE-2021-3820
    • c025e15 Fix formatting
    • dace42b Move away from travis
    • 22fa473 Merge pull request #30 from pksunkara/dependabot/add-v2-config-file
    • e84c23a Upgrade to GitHub-native Dependabot
    • b267d23 Merge pull request #28 from brimworks/patch-1
    • 2f47b1c Please add copyright information to the license
    • da50027 Fixed "Custom human" example in README (#27)
    • 4d62cfe Fixed "Custom human" example in README
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump lodash from 4.17.15 to 4.17.21

    Bump lodash from 4.17.15 to 4.17.21

    Bumps lodash from 4.17.15 to 4.17.21.

    Commits
    • f299b52 Bump to v4.17.21
    • c4847eb Improve performance of toNumber, trim and trimEnd on large input strings
    • 3469357 Prevent command injection through _.template's variable option
    • ded9bc6 Bump to v4.17.20.
    • 63150ef Documentation fixes.
    • 00f0f62 test.js: Remove trailing comma.
    • 846e434 Temporarily use a custom fork of lodash-cli.
    • 5d046f3 Re-enable Travis tests on 4.17 branch.
    • aa816b3 Remove /npm-package.
    • d7fbc52 Bump to v4.17.19
    • Additional commits viewable in compare view
    Maintainer changes

    This version was pushed to npm by bnjmnt4n, a new releaser for lodash since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Does not work on Windows

    Does not work on Windows

    I am using WSL, but it seems like this issue is more general for Windows. Installation works, and the first run of locus appears to work fine as well. However, after exiting, all subsequent calls to locus produce something like this

    File : /home/kloughead/projects/API_demo/app.js @ line: 12
    
         6: const request = require('request');
         7: require('locus');
         8: 
         9: 
        10: request('https://jsonplaceholder.typicode.com/users/1', function(error, response, body) {
        11:     if (!error && response.statusCode == 200) {
     => 12:         eval(locus)
        13:         var parsedData = JSON.parse(body);
        14:         console.log(parsedData);
        15:     }
    
    internal/fs/streams.js:59
        throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos);
        ^
    
    RangeError [ERR_OUT_OF_RANGE]: The value of "start" is out of range. It must be >= 0 and <= 2 ** 53 - 1. Received -25580
        at checkPosition (internal/fs/streams.js:59:11)
        at new ReadStream (internal/fs/streams.js:115:5)
        at Object.createReadStream (fs.js:1835:10)
        at onLoad (/home/kloughead/projects/API_demo/node_modules/readline-history/readline-history.js:55:25)
        at ReadStream.onend (/home/kloughead/projects/API_demo/node_modules/readline-history/readline-history.js:48:21)
        at ReadStream.emit (events.js:333:22)
        at endReadableNT (_stream_readable.js:1201:12)
        at processTicksAndRejections (internal/process/task_queues.js:84:21)
        at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:66:3)
        at Function.module.exports.loopWhile (/home/kloughead/projects/API_demo/node_modules/deasync/index.js:70:11) {
      code: 'ERR_OUT_OF_RANGE'
    }
    

    I am taking a course on Udemy and there are others having similar issues. We were told by the teaching assistant to try installing version 2.0.0, but that fails also. Installation works, all calls stop just for the interactive portion. That is, you see something like this:

         6: const request = require('request');
         7: require('locus');
         8: 
         9: 
        10: request('https://jsonplaceholder.typicode.com/users/1', function(error, response, body) {
        11:     if (!error && response.statusCode == 200) {
     => 12:         eval(locus)
        13:         var parsedData = JSON.parse(body);
        14:         console.log(parsedData);
        15:     }
    
    $
    
    opened by kvnloughead 1
  • Documentation unclear

    Documentation unclear

    What does this module do? All I can tel from the readme is that this is meant to be used on a REPL, but opening a REPL with "with access to all variables" means literally nothing to me. Please clarify. The example with a screenshot didn't help..

    opened by fresheneesz 9
Owner
Ali Davut
Ali Davut
ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools

ndb ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools Installation Compatibility: ndb requires Node >=8.0.0. It works be

null 10.8k Dec 28, 2022
Streamline Your Node.js Debugging Workflow with Chromium (Chrome, Edge, More) DevTools.

NiM (Node.js --inspector Manager) Streamlines your development process Google Chrome Web Store (works with any Chromium browsers: Google's Chrome, Mic

Will 188 Dec 28, 2022
📡 Encrypt and authenticate DevTools to use it securely remotely. Add HTTPS, and authentication to --remote-debugging-port to debug, inspect and automate from anywhere and collaborate securely on bugs.

?? Encrypt and authenticate DevTools to use it securely remotely. Add HTTPS, and authentication to --remote-debugging-port to debug, inspect and automate from anywhere and collaborate securely on bugs.

Cris 9 May 5, 2022
Node is running but you don't know why? why-is-node-running is here to help you.

why-is-node-running Node is running but you don't know why? why-is-node-running is here to help you. Installation Node 8 and above: npm i why-is-node-

Mathias Buus 1.5k Dec 30, 2022
An lldb plugin for Node.js and V8, which enables inspection of JavaScript states for insights into Node.js processes and their core dumps.

Node.js v10.x+ C++ plugin for the LLDB debugger. The llnode plugin adds the ability to inspect JavaScript stack frames, objects, source code and more

Node.js 1k Dec 14, 2022
Node.js debugger based on Blink Developer Tools

Node Inspector Overview Node Inspector is a debugger interface for Node.js applications that uses the Blink Developer Tools (formerly WebKit Web Inspe

null 12.6k Dec 29, 2022
[OBSOLETE] runs Node.js programs through Chromium DevTools

devtool ⚠️ Update: This tool is mostly obsolete as much of the philosophy has been brought into Node/DevTool core, see here for details. If you wish t

Jam3 3.8k Dec 20, 2022
Debug Node.js code with Chrome Developer Tools.

Debug Node.js code with Chrome Developer Tools on Linux, Windows and OS X. This software aims to make things easier ?? . With ironNode you have the fu

Stephan Ahlf 2.3k Dec 30, 2022
🐛 Memory leak testing for node.

Leakage - Memory Leak Testing for Node Write leakage tests using Mocha or another test runner of your choice. Does not only support spotting and fixin

Andy Wermke 1.6k Dec 28, 2022
Long stack traces for node.js inspired by https://github.com/tlrobinson/long-stack-traces

longjohn Long stack traces for node.js with configurable call trace length Inspiration I wrote this while trying to add long-stack-traces to my server

Matt Insler 815 Dec 23, 2022
API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.

swagger-stats | API Observability https://swaggerstats.io | Guide Trace API calls and Monitor API performance, health and usage statistics in Node.js

slana.tech 773 Jan 4, 2023
A Node.js tracing and instrumentation utility

njsTrace - Instrumentation and Tracing njstrace lets you easily instrument and trace you code, see all function calls, arguments, return values, as we

Yuval 354 Dec 29, 2022
He is like Batman, but for Node.js stack traces

Stackman Give Stackman an error and he will give an array of stack frames with extremely detailed information for each frame in the stack trace. With

Thomas Watson 242 Jan 1, 2023
thetool is a CLI tool to capture different cpu, memory and other profiles for your node app in Chrome DevTools friendly format

thetool thetool is a CLI tool to capture different cpu, memory and other profiles for your node app in Chrome DevTools friendly format. Quick start np

null 200 Oct 28, 2022
A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers

debug A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers. Installation $ npm ins

Sloth 10.5k Dec 30, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

Snyk Labs 57 Dec 28, 2022
ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools

ndb ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools Installation Compatibility: ndb requires Node >=8.0.0. It works be

null 10.8k Dec 28, 2022