ClojureScript

Create a cljs.repl/*repl-env* dynamic var and bind it around cljs repl loops

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

This will enable tooling to easily eval things on the client.

For example a macro that can watch a CSS file and ping the client when it changes. And you could require and use this CSS tooling directly at the CLJS REPL.

A larger example of using a bound repl-env to make a simple figwheel:
https://gist.github.com/bhauman/d731eb4cb54fa187c341aec75f62dd83

  1. CLJS-2581.patch
    28/Feb/18 1:26 PM
    3 kB
    Bruce Hauman
  2. CLJS-2581.patch
    27/Feb/18 6:15 PM
    2 kB
    Bruce Hauman
  3. CLJS-2581-with-cli-main-bindings.patch
    27/Feb/18 6:52 PM
    3 kB
    Bruce Hauman
  4. CLJS-2581-with-watcher-thread-bound.patch
    28/Feb/18 9:11 AM
    4 kB
    Bruce Hauman

Activity

Hide
Bruce Hauman added a comment -

Oh shoot it looks like it needs to go around cljs.cli/main as well ...

Show
Bruce Hauman added a comment - Oh shoot it looks like it needs to go around cljs.cli/main as well ...
Hide
Bruce Hauman added a comment -

I added a second patch with binds around cli.main execution and also establishes a root binding for ana/warning-handlers

Show
Bruce Hauman added a comment - I added a second patch with binds around cli.main execution and also establishes a root binding for ana/warning-handlers
Hide
Bruce Hauman added a comment - - edited

Actually, the root binding for warning handlers is off topic here. I'm going to get rid of it.

Establishing root bindings is something that cli.main may want to think about.

But I do to forward the repl-env binding to the watcher process, perhaps with bound-fn?

Show
Bruce Hauman added a comment - - edited Actually, the root binding for warning handlers is off topic here. I'm going to get rid of it. Establishing root bindings is something that cli.main may want to think about. But I do to forward the repl-env binding to the watcher process, perhaps with bound-fn?
Hide
David Nolen added a comment -

The patch is not quite right, the binding around the dispatch loop is not right because `repl-env` there is the ctor fn. Let's get rid of that. Just bind in default-main, the REPL case is already covered obviously.

Show
David Nolen added a comment - The patch is not quite right, the binding around the dispatch loop is not right because `repl-env` there is the ctor fn. Let's get rid of that. Just bind in default-main, the REPL case is already covered obviously.
Hide
Bruce Hauman added a comment -

Added the final patch, CLJS-2581.patch 28/Feb/18 1:26 PM

Tested it out with my figwheel implementation and it worked very well from cljs.main.

Show
Bruce Hauman added a comment - Added the final patch, CLJS-2581.patch 28/Feb/18 1:26 PM Tested it out with my figwheel implementation and it worked very well from cljs.main.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: