Skip to content

0.2.0

Compare
Choose a tag to compare
@darwin darwin released this 20 Apr 22:44
· 3535 commits to master since this release

Solid foundation

I have invested two months and produced whopping 350+ commits since the last release. Most of the work will be invisible to you because it was spent on building robust testing infrastructure for exercising various Dirac scenarios in real Chrome. It ended up to be much harder task than anticipated. I'm not sure if it was worth it but at least we have now solid foundation for keeping Dirac up-to-date with rolling DevTools and Chrome versions underneath it.

DevTools

Embedded DevTools rolled to ea1001a which should work best with Chrome ~52.0.2713.

Dirac Runtime

Originally Dirac in-page support was implemented as part of cljs-devtools. Using Dirac without cljs-devtools and its custom formatters was not expected and also it was a historical decision to implement it this way (because originally this whole REPL idea started as figwheel REPL integration with cljs-devtools).

For this release I decided to decouple those libraries and include "Dirac Runtime" into the dirac library itself. So from version 0.2.0 the binaryage/dirac library published on clojars contains Dirac Agent + nREPL middleware (Clojure) and Dirac Runtime (ClojureScript) files. This has a nice effect that it will likely help you keep versions of those Dirac components in sync in your (leiningen) project. You will be upgrading just one binaryage/dirac dependency plus one Chrome extension (which should auto-update anyways).

Focus REPL prompt with a global keyboard shortcut

I have added support to quickly focus Dirac REPL (or JavaScript Console) using a global keyboard shortcut. That's handy because it will not only focus existing prompt but it will also open the console if it is not already opened.

For security/usability reasons, you have to set it up manually via chrome://extensions/ -> "Keyboard shortcuts" -> "Focus Console Prompt". I recommend setting it to CTRL+SHIFT+P.

Robust javascript context selection

When you execute some ClojureScript code into the REPL prompt, Dirac will send it to the nREPL server for compilation into Javascript. The nREPL process then sends compiled Javascript code back for evaluation in your page. At this point Dirac has to decide how to evaluate the code. This could be quite tricky, because there may be multiple javascript contexts available (imagine iframes in the page, content scripts, breakpoint contexts, etc.).

In previous version Dirac was quite stupid about this and took the first available context which might not be the right choice. Now Dirac tries to implement smarter heuristics and pick the right context for Javascript evaluation. In cases when your code is stopped on a breakpoint, it should eval the code in the context of current stack frame in the debugger. In other cases it should pick the context with Dirac Runtime installed.

Advanced mode compilation

Previous Dirac releases compiled only ClojureScript pieces in advanced mode. For this release I managed to integrate official DevTools build pipeline into Dirac release scripts. That means that DevTools code itself (which is written in Javascript) gets compiled and minified by Closure compiler before embedded into released Dirac Chrome Extension. This might sound as not that big win but it should help us keep exact parity between Dirac DevTools and embedded DevTools. I was already exposed to DevTools bugs which were present in dev mode and went away after compiled with advanced optimizations.

Sample project

I have created an example leiningen-based project for you to demo the features. Give it a spin here:
https://github.com/binaryage/dirac-sample