• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 11 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[Experimental] Lightweight JavaScript VM and stepping debugger in JavaScript

debugjs

Lightweight JavaScript VM and stepping debugger in JavaScript.
Demo app
Blog post

Installation

With component(1):

$ component install amasad/debugjs

With npm

$ npm install amasad/debugjs

Or grab dist/bundle.js for a standalone library.

API

debugjs.createDebugger(options)

Creates and returns a Debugger. options will be passed to the Machine constructor. options.sandbox will be passed as the sandbox option -- see Machine

Debugger

new Debugger(machine)

Creates a Debugger on top of the passed machine.

Debugger#addBreakpoints(filename, linenos)

filename string of the filename. liennos array of linenumbers to add breakpoints to.

Debugger#removeBreakpoint(filename, linenos)

filename string of the filename. liennos array of linenumbers to remove breakpoints to.

Debugger#getBreakpoints(filename)

Gets an array of breakpoints on the file filename.

Debugger#getCallStack(options)

Gets a sanitized call stack, with nothing but stack frames. Pass in { raw: true } to get meta call stack info.

Debugger#run()

Runs the code until it hits a breakpoint.

Debugger#stepOver()

Steps over an instruction.

Debugger#stepIn()

Steps into a function call.

Debugger#stepOut()

Steps out of a function call.

Debugger#load(code, filename)

Loads a file of code into the machine.

Debugger#paused()

Boolean for if the machine is paused.

Debugger#halted()

Boolean for if the machine is halted.

Debugger#getCurrentStackFrame()

Current stsack frame.

Machine

new Machine(sandbox, options)

sandbox object with references to be copied into the context. options:

  • iframeParentElement to attach the context iframe to a parent element

Machine#evaluate(code, filename)

Compiles code as file filename and gets it ready to run.

Machine#step()

Steps through the evaluateed code.

Machine#run()

Calls step continuously until machine is halted

Machine#pause()

Will not let run() do anymore steps.

Machine#resume()

run() could continue running.

Machine#getCallStack()

Gets the call stack. Note that this will include meta call stack information, like thunks etc. See Debugger#getCallStack on how to filter non stack frame information.

Machine#getCurrentStackFrame()

Gets the current stack frame

Machine#getState()

Returns an object the latest step information (whether halted and what was yielded).

Machine#getCurrentLoc()

Line and column of the latest instruction ran by the machine.

Machine#paused

Boolean stating if the machine is paused. See pause()

Machine#halted

Boolean stating if the machine has no more instructions to run and is in idle state.

License

AAL. See LICENSE

More Repositories

1

debug_utils

Advanced JavaScript Debugging Utility Library
JavaScript
642
star
2

sane

sane aims to be fast, small, and reliable filesystem watcher. No bells and whistles, just change events.
JavaScript
386
star
3

debugjs.com

Debug your JavaScript in the browser
JavaScript
98
star
4

learnable-programming-demo

Implementation of demos from Learnable Programming
JavaScript
52
star
5

DOMQL

Web development for DBAs
JavaScript
48
star
6

eHistory

A Google Chrome extensions that enhances the browser's history search and management in many ways.
JavaScript
41
star
7

soundofjs

Listen to your JavaScript code on an 808 drum machine
CSS
36
star
8

arabish

Arabic Transliteration in Python
Python
32
star
9

static-here

A command-line tool for creating a static file server from the current working directory.
JavaScript
21
star
10

pg-basic

JavaScript
19
star
11

context-eval

Simple execution context for node and the browser.
JavaScript
16
star
12

generator-supported

Check if JS harmony generators is supported in environment
JavaScript
7
star
13

simple-counter

dead simple stats counter that flushes to disk
JavaScript
6
star
14

SpaceTime

Chrome History Visualization
CoffeeScript
5
star
15

github-slideshow

A robot powered training repository πŸ€–
Ruby
4
star
16

build_your_own_js_infra_starter

Some unit tests and boilerplate
JavaScript
4
star
17

nextjs-template

for replit
JavaScript
4
star
18

component-app-seed

Seed project for Component apps
JavaScript
4
star
19

testing_with_zeb

HTML
2
star
20

test

EJS
2
star
21

amasad.github.com

gh page
HTML
2
star
22

esparse

Go
2
star
23

timer

Timer countdown component
JavaScript
2
star
24

jest-playground

Play around with jest
JavaScript
2
star
25

django-template

Python
2
star
26

test_repo

Python
1
star
27

console

textarea-based browser console, similar to Chrome dev tools console
JavaScript
1
star
28

enzyme-playground

JavaScript
1
star
29

hello_yc

Python
1
star
30

fdsa

1
star
31

biwascheme_clone

JavaScript
1
star
32

psut-demo

Python
1
star
33

bootstrap-css

Bootstrap css and font for Component
1
star
34

busygo

busybox docker image with golang installed.
1
star