Git Product home page Git Product logo

austin's People

Contributors

bltavares avatar cemerick avatar cldwalker avatar danielsz avatar deg avatar gtrak avatar hugoduncan avatar magomimmo avatar noidi avatar peeja avatar sritchie avatar twashing avatar xeqi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

austin's Issues

Eliminate use of CrossPageChannel

This would address #17, #49, and #47, and beyond that, likely make any remaining mysterious connection/stalling problems either go away or be much easier to diagnose.

Implies writing a full replacement for clojure.browser.repl, though that's hardly onerous.

Options include:

  1. SSEs + XHRs
  2. websockets, e.g. https://github.com/tomjakubowski/weasel

Personally leaning towards (1) (easier to debug, accessible to more tools, etc), but that's not a done deal yet.

Biggest impact of this is Austin will cut its last connection to the stock ClojureScript browser REPL. Probably a wash in terms of maximizing stability vs. inheriting bugs / compiler API changes.

tools.logging aot issue

This is a weird issue! I am not sure everyone can reproduce but if i use autin in a project, tool.logging's impl records do not get compiled! causing a failure in even require or use. i.e. java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory.
Now just comment the plugins line and everything works.

(defproject bug "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.3.1"]]
  :plugins [[com.cemerick/austin "0.1.5"]]
  :aot [bug.core])
(ns bug.core
  (:require [clojure.tools.logging :as log]))

(defn -main []
  (log/info "foo"))

Client-side projects

Client-side projects don't necessarily have a server component (and shouldn't be required to have one).
Take for example the basic tutorial for om: https://github.com/swannodette/om/wiki/Basic-Tutorial
That tutorial has instructions for starting a Clojurescript repl in LightTable.

"Type the key chord Control-SPACE to open up the command list. Start typing Add Connection, press enter to select it. In the list of options select Browser (External). Copy and paste the script tag into index.html before the div tag."

And that's all there is to it.

I tried to emulate that tutorial for Austin. I started an Austin repl like so:

(def repl-env (reset! cemerick.austin.repls/browser-repl-env
                      (cemerick.austin/repl-env)))

Then I looked at the value of

(cemerick.austin.repls/browser-connected-repl-js)

and used it for manual inclusion in the index.html.

I made sure that the cljs source requires

:require [clojure.browser.repl]

Loading index.html does initiates a connection, but errors out with this message:

Uncaught Error: URI file://localhost/robots.txt is invalid for field ppu

Can this be fixed?

If LightTable can do it, I'm hopeful Austin can too.

Including Austin plugin before cljx plugin causes ClojureScript REPL failure

This in :plugins works:

[com.keminglabs/cljx "0.3.2"]
[com.cemerick/austin "0.1.4-SNAPSHOT"]

this fails:

[com.cemerick/austin "0.1.4-SNAPSHOT"]
[com.keminglabs/cljx "0.3.2"]

with this oh-so-helpful message:

Browser-REPL ready @ http://localhost:34126/5567/repl/start

NullPointerException   clojure.core/deref-future (core.clj:2136)

I looked into this for ~an hour, without any solid leads. I'd love some help in tracking down whatever miserable confluence of circumstances is producing this.

Connecting to Browser REPL fails with Fireplace

The Browser REPL fails to evaluate any forms on Fireplace with VIM.

Leiningen 2.2.0 on Java 1.6.0_51 Java HotSpot(TM) 64-Bit Server VM
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 5 2012 11:32:03)
Fireplace latest available on GitHub

Using the current example project repeat the following steps to reproduce:

lein do cljsbuild once, repl
vim src/
(comment
  ; 1. Connect to the nREPL
  ; 2. eval
    (run)
    (def repl-env (reset! 
           cemerick.austin.repls/browser-repl-env 
          (cemerick.austin/repl-env)))
  ; 2. open the localhost:8080 page on the browser
  ; 3. eval
    (cemerick.austin.repls/cljs-repl repl-env)
  ; 4. eval
  (+ 2 2))

Outputs an error:

; "Error evaluating:" (try (clojure.core/eval (quote (do (+ 2 2)))) (catch Exception e (clojure.core/print (clojure.core/apply clojure.core/str (clojure.core/interleave (clojure.core/repeat "\b") (clojure.core/map clojure.core/str (.getStackTrace e))))) (throw e))) :as "try{cljs.core.eval.call(null,cljs.core.list(new cljs.core.Symbol(null,\"do\",\"do\",-1640528316,null),cljs.core.list(new cljs.core.Symbol(null,\"+\",\"+\",-1640531484,null),2,2)));\n}catch (e13604){if((e13604 instanceof cemerick.austin.bcrepl_sample.Exception))\n{var e_13605 = e13604;\ncljs.core.print.call(null,cljs.core.apply.call(null,cljs.core.str,cljs.core.interleave.call(null,cljs.core.repeat.call(null,\"\\b\"),cljs.core.map.call(null,cljs.core.str,e_13605.getStackTrace()))));\nthrow e_13605;\n} else\n{if(\"\\uFDD0:else\")\n{throw e13604;\n} else\n{}\n}\n}"
; #<TypeError: Expecting a function in instanceof check, but got TypeError: Cannot call method 'call' of undefined>
; TypeError: Expecting a function in instanceof check, but got TypeError: Cannot call method 'call' of undefined
;    at eval (eval at <anonymous> (http://localhost:8080/app.js:19440:129), <anonymous>:2:68)
;    at eval (eval at <anonymous> (http://localhost:8080/app.js:19440:129), <anonymous>:13:4)
;    at eval (eval at <anonymous> (http://localhost:8080/app.js:19440:129), <anonymous>:18:3)
;    at http://localhost:8080/app.js:19440:124
;    at clojure.browser.repl.evaluate_javascript (http://localhost:8080/app.js:19447:4)
;    at Object.callback (http://localhost:8080/app.js:19503:118)
;    at goog.messaging.AbstractChannel.deliver (http://localhost:8080/app.js:17853:34)
;    at goog.net.xpc.CrossPageChannel.xpcDeliver (http://localhost:8080/app.js:18736:307)
;    at Function.goog.net.xpc.NativeMessagingTransport.messageReceived_ (http://localhost:8080/app.js:18363:14)
;    at goog.events.Listener.handleEvent (http://localhost:8080/app.js:14021:51)

Add a `require` macro

It sucks to have to write a dummy ns form, just to compile/load some ClojureScript into the current REPL. ClojureScript should have a require form, just like Clojure (but of course only for REPL use, since require at runtime doesn't make sense in cljs). It doesn't yet, so add one (it has to be a macro) to Austin. This would allow you to write (require 'foo) on an Austin REPL, rather than (ns *your-current-ns* (:require foo)).

clojure.browser.repl breaks the browser's hashchange event

Here is the relevant code:

(def history (History.))

(events/listen history EventType/NAVIGATE
  (fn [e] (.log js/console "Route changed!")))

(.setEnabled history true)

With clojure.browser.repl required, this callback does not fire, but when I comment it out, all works swimmingly.

I have no idea why it would conflict with the hashchange event. Any ideas?

Typing (cemerick.austin/repl-env) in Clojure REPL causes OutOfMemoryError

Example session: https://www.refheap.com/7d37150b0fbe017920682f9ee/raw

It took me some time to figure out that the problem was caused by the printing of the object, not due to some problem with the repl-env itself.

Not sure if this deserves some kind of warning in the README or a fix to not try to print an infinite amount of text.

If this does not reproduce on your machine, try this on Ubuntu 13.10

git clone https://github.com/ludios/reworld
cd reworld
git checkout 1483b1a6350ef2c950cf2447d940ad308a273b2c
lein repl
(cemerick.austin/repl-env)

Incompatibility with cljs 2173

Austin seems to be incompatible with cljs 2173. Worked fine with the previous version (2156).

user> (cemerick.austin/repl-env)
NullPointerException   clojure.core/complement/fn--4048 (core.clj:1357)
user> (pst)
java.lang.NullPointerException: null
            core.clj:1357 clojure.core/complement[fn]
            core.clj:2529 clojure.core/filter[fn]
          LazySeq.java:42 clojure.lang.LazySeq.sval
          LazySeq.java:60 clojure.lang.LazySeq.seq
              RT.java:484 clojure.lang.RT.seq
             core.clj:133 clojure.core/seq
            core.clj:2479 clojure.core/map[fn]
          LazySeq.java:42 clojure.lang.LazySeq.sval
          LazySeq.java:60 clojure.lang.LazySeq.seq
              RT.java:484 clojure.lang.RT.seq
             core.clj:133 clojure.core/seq
            core.clj:2523 clojure.core/filter[fn]
          LazySeq.java:42 clojure.lang.LazySeq.sval
          LazySeq.java:60 clojure.lang.LazySeq.seq
              RT.java:484 clojure.lang.RT.seq
             core.clj:133 clojure.core/seq
            core.clj:3712 clojure.core/set
          closure.clj:666 cljs.closure/cljs-dependencies
           austin.clj:359 cemerick.austin/always-preload
           austin.clj:407 cemerick.austin/repl-env
          RestFn.java:397 clojure.lang.RestFn.invoke
form-init7624460201605039120.clj:1 user/eval11264
       Compiler.java:6619 clojure.lang.Compiler.eval
       Compiler.java:6582 clojure.lang.Compiler.eval
            core.clj:2852 clojure.core/eval
             main.clj:259 clojure.main/repl[fn]
             main.clj:259 clojure.main/repl[fn]
             main.clj:277 clojure.main/repl[fn]
             main.clj:277 clojure.main/repl
         RestFn.java:1096 clojure.lang.RestFn.invoke
interruptible_eval.clj:56 clojure.tools.nrepl.middleware.interruptible-eval/evaluate[fn]
             AFn.java:159 clojure.lang.AFn.applyToHelper
             AFn.java:151 clojure.lang.AFn.applyTo
             core.clj:617 clojure.core/apply
            core.clj:1788 clojure.core/with-bindings*
          RestFn.java:425 clojure.lang.RestFn.invoke
interruptible_eval.clj:41 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj:171 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval[fn]
            core.clj:2330 clojure.core/comp[fn]
interruptible_eval.clj:138 clojure.tools.nrepl.middleware.interruptible-eval/run-next[fn]
              AFn.java:24 clojure.lang.AFn.run
ThreadPoolExecutor.java:1145 java.util.concurrent.ThreadPoolExecutor.runWorker
ThreadPoolExecutor.java:615 java.util.concurrent.ThreadPoolExecutor$Worker.run
          Thread.java:744 java.lang.Thread.run
nil

NPE in repl-client-js

This happens on a page reload every so often, and I can't recover:

java.lang.NullPointerException
    at clojure.core$deref_future.invoke(core.clj:2108)
    at clojure.core$deref.invoke(core.clj:2129)
    at cemerick.austin$repl_client_js.invoke(austin.clj:143)
    at cemerick.austin$send_repl_client_page.invoke(austin.clj:157)
    at cemerick.austin$eval5899$fn__5901.invoke(austin.clj:268)
    at clojure.lang.MultiFn.invoke(MultiFn.java:227)
    at cemerick.austin$handle_request.invoke(austin.clj:276)
    at cemerick.austin$create_server$reify__5780.handle(austin.clj:24)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
    at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
    at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:677)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:649)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

Intermittent failure of repl connection

Most of the time, I can't get browser-connected-repl-sample to work. But, I have seen it work occasionally, so I know my config is not totally wedged. Unfortunately, I haven't been able to get it to work at all recently, so I can't compare working vs broken cases to see what's going wrong.

The problem seems to be that the long-poll gets answered and the next one is not posted.

Until just now I've been using only Chrome, and the problem occurred most of the time. I just installed and tried with Firefox and things work on the first attempt. So, the problem may be chrome specific. I'll continue to debug, but just wanted to check in to see if this rings any bells.

After loading (cemerick.austin.repls/exec), forms hang at repl prompt

Emacs 24, ; CIDER 0.9.0alpha (package: 20150320.1353) (Java 1.8.0_40, Clojure 1.5.1, nREPL 0.2.7)

After cider-jack-in to create REPL, forms entered at the REPL prompt work fine. After loading austin, any attempt to enter a form hangs.
I've also discovered that a C-c C-c at the prompt will break and return java.lang.ThreadDeath. After this action, autocompletion is not working.

NPE against org.clojure/clojurescript "0.0-2173"

I get an NPE when evaluating (cemerick.austin/repl-env) using CLJS 0.0-2173, previous versions seem to work fine. The stack trace is

java.lang.NullPointerException
at clojure.core$complement$fn__4048.invoke(core.clj:1357)
at clojure.core$filter$fn__4226.invoke(core.clj:2529)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$map$fn__4207.invoke(core.clj:2479)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$filter$fn__4226.invoke(core.clj:2523)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$set.invoke(core.clj:3712)
at cljs.closure$cljs_dependencies.invoke(closure.clj:666)
at cemerick.austin$always_preload.invoke(austin.clj:359)
at cemerick.austin$repl_env.doInvoke(austin.clj:407)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at user$browser_repl.invoke(form-init3431646630870208142.clj:1)
at user$eval6356.invoke(form-init3431646630870208142.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$repl$read_eval_print__6588$fn__6591.invoke(main.clj:259)
at clojure.main$repl$read_eval_print__6588.invoke(main.clj:259)
at clojure.main$repl$fn__6597.invoke(main.clj:277)
at clojure.main$repl.doInvoke(main.clj:277)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__597.invoke(interruptible_eval.clj:56)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:41)
at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__638$fn__641.invoke(interruptible_eval.clj:171)
at clojure.core$comp$fn__4154.invoke(core.clj:2330)
at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__631.invoke(interruptible_eval.clj:138)
at clojure.lang.AFn.run(AFn.java:24)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

Add support for adding JS dependencies.

When using a browser-connected REPL for Om, I'd love to be able to invoke Om functions to investigate their outputs and so forth. However this would require having the React object from react.js avaliable in the page. The default HTML generated by send-repl-index however is pretty minimal (by design).

I can think of a few ways to accomplish this:

  • have some kind of additional config/hook in profiles.clj to specify additional URLs (http or file system) for libs to include;
  • read from :preamble and add the paths specified there as <script> tags;
  • same as above but just add those libs to the client.js

Cljs compiler env doesn't correspond to a refreshed browser env, with (disastrous!) consequences

Had an interesting conversation about it http://clojure-log.n01se.net/date/2014-03-01.html#21:08

Symptoms:
load-file in the piggieback repl doesn't seem to be loading transitive deps due to stale compiler state, however my tooling/auto-complete stuff still thinks things exist.

This was on my fork of austin + clojurescript master.

Normal functioning:

cljs-app.core> body
#<function body(){return (goog.dom.getElemfentsByTagNameAndClass("body")[0]);
}>
nil

After a refresh:

cljs-app.core> body
"Error evaluating:" body :as ""
#<ReferenceError: cljs_app is not defined>
ReferenceError: cljs_app is not defined
    at eval (repl-1393737033414.js:1:65)
    at eval (repl-1393737033414.js:5:3)
    at http://localhost:54162/6802/repl/start:1480:313
    at clojure.browser.repl.evaluate_javascript (http://localhost:54162/6802/repl/start:1481:238)
    at Object.callback (http://localhost:54162/6802/repl/start:1489:111)
    at goog.messaging.AbstractChannel.deliver (http://localhost:54162/6802/repl/start:1354:393)
    at goog.net.xpc.CrossPageChannel.xpcDeliver (http://localhost:54162/6802/repl/start:1450:350)
    at Function.goog.net.xpc.NativeMessagingTransport.messageReceived_ (http://localhost:54162/6802/repl/start:1409:389)
    at goog.events.Listener.handleEvent (http://localhost:54162/6802/repl/start:1089:102)
    at Object.goog.events.fireListener (http://localhost:54162/6802/repl/start:1104:448)

I think there are two obvious solutions.

  1. Re-initialize the compiler state for the session on a reconnect to a clean state, fixing reloads.
  2. Emit a JS string corresponding to the CLJS compiler state via internal compiler stuffs, and use that as the browser's client-js string upon a refresh.

I feel like 2 would be more awesome than ill-conceived.

Further investigation reveals:
Seems like compiled-cljs files are enumerated and stored in the compiler state map, we could load those up. This doesn't address normal eval'd code, though. No biggie.

In closure.clj

(defprotocol Compilable
  (-compile [this opts] "Returns one or more IJavaScripts."))

Seems like this could be specified to return the pre-existing compiled sources that are already on disk (in dependency order) via closure/compiled-file, then clojurescript/closure's build function can continue to handle bundling everything up.

lein do cljsbuild once, repl vs M-x nrepl from Emacs

Hi,

On the exact same machine, when I do "M-x nrepl", I get the following:

; nrepl.el 0.2.0 (Clojure 1.5.1, nREPL 0.2.3)
user> (def repl-env (reset! cemerick.austin.repls/browser-repl-env
                (cemerick.austin/repl-env)))
Browser-REPL ready @ http://localhost:35229/6081/repl/start
#'user/repl-env
user> (cemerick.austin.repls/cljs-repl repl-env)
IllegalStateException Can't change/establish root binding of: *cljs-repl-options* with set  clojure.lang.Var.set (Var.java:233)

Yet, if I do "lein do cljsbuild once, repl" I get:

lein do cljsbuild once, repl
Compiling ClojureScript.
nREPL server started on port 32794
REPL-y 0.2.0
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)

bcrepl=> (def repl-env (reset! cemerick.austin.repls/browser-repl-env     (cemerick.austin/repl-env)))
Browser-REPL ready @ http://localhost:51098/5677/repl/start
#'bcrepl/repl-env

Clearly, "M-x nrepl" is not setting up something correctly. What should I read up on / try?

Thanks!

clojurescript 0.0-2665 cannot compile austin 0.1.5

I have no idea at whose door to lay this, so apologies if this is nothing to with austin, but It currently fails with:

java.lang.IllegalArgumentException: Can't define method not in interfaces: _setup, compiling:(cemerick/austin.clj:315:1)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6651)
    at clojure.lang.Compiler.analyze(Compiler.java:6445)
    at clojure.lang.Compiler.analyze(Compiler.java:6406)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
    at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6100)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6644)
    at clojure.lang.Compiler.analyze(Compiler.java:6445)
    at clojure.lang.Compiler.analyze(Compiler.java:6406)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5217)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3846)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6642)
    at clojure.lang.Compiler.analyze(Compiler.java:6445)
    at clojure.lang.Compiler.eval(Compiler.java:6700)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$require.doInvoke(core.clj:5607)
    at clojure.lang.RestFn.invoke(RestFn.java:457)
    at cemerick.austin.repls$eval14250$loading__4958__auto____14251.invoke(repls.clj:1)
    at cemerick.austin.repls$eval14250.invoke(repls.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6692)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$require.doInvoke(core.clj:5607)
    at clojure.lang.RestFn.invoke(RestFn.java:805)
    at health.core.handler$eval12490$loading__4958__auto____12491.invoke(handler.clj:1)
    at health.core.handler$eval12490.invoke(handler.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6692)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
    at clojure.core$load_lib.doInvoke(core.clj:5485)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$load_libs.doInvoke(core.clj:5524)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$require.doInvoke(core.clj:5607)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at figwheel_sidecar.core$resolve_ring_handler.invoke(core.clj:362)
    at figwheel_sidecar.core$start_server.invoke(core.clj:368)
    at figwheel_sidecar.auto_builder$autobuild.invoke(auto_builder.clj:40)
    at user$eval12482.invoke(form-init7327376784435165373.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6693)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: Can't define method not in interfaces: _setup
    at clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:7984)
    at clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:7544)
    at clojure.lang.Compiler$NewInstanceExpr$DeftypeParser.parse(Compiler.java:7425)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6644)
    ... 93 more

js/document.write hangs, js/console.log returns nil, js/alert works

With apologies for posting 4 questions in < 4 hours:

cljs.user> (js/alert "Hello World") ;; works fine


cljs.user> (js/console.log "Hello World") ;; returns nil, does not see anything in Chrome's console


cljs.user> (js/document.write "Hello World") ;; hangs, needs to ctrl-c + reload browser

Anyone else run into these problems? And if so, how to resolve them.

Pass through ClojureScript compiler options added to REPL environments

Use case: be able to specify options like :libs, :externs, and :foreign-libs via the REPL environment, and have them affect the ClojureScript compiler. Without this, ClojureScript REPLs are very much second-class citizens compared to whole-program compilation.

This is equivalent to CLJS-521. It's not yet clear whether:

  1. core ClojureScript support (i.e. addressing CLJS-521) will be necessary to close this for Austin, or maybe
  2. Austin + Piggieback can take care of this, at least for nREPL toolchains.

Austin should not declare its own ClojureScript dependency

0.1.4 requires an explicit clojurescript dep in the project or dies weirdly:

gary@gary-stinkpad:/dev/austin-test$ lein repl
Exception in thread "main" java.lang.Exception: namespace 'cemerick.piggieback' not found
at clojure.core$load_lib.doInvoke(core.clj:5380)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at cemerick.austin.repls$eval4442$loading__4910__auto____4443.invoke(repls.clj:1)
at cemerick.austin.repls$eval4442.invoke(repls.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval4438.invoke(form-init5394806333945426544.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.Compiler.loadFile(Compiler.java:7020)
at clojure.main$load_script.invoke(main.clj:294)
at clojure.main$init_opt.invoke(main.clj:299)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
^Cgary@gary-stinkpad:
/dev/austin-test$ lein deps :tree
Possibly confusing dependencies found:
[com.cemerick/austin "0.1.4"] -> [org.clojure/clojurescript "0.0-2014"]
overrides
[com.cemerick/austin "0.1.4"] -> [com.cemerick/piggieback "0.1.3"] -> [org.clojure/clojurescript "0.0-2080"]

Consider using these exclusions:
[com.cemerick/austin "0.1.4" :exclusions [org.clojure/clojurescript]]

[cider/cider-nrepl "0.1.0-SNAPSHOT"]
[cljs-tooling "0.1.2-20140131.044332-1"]
[org.clojure/java.classpath "0.2.0"]
[org.clojure/tools.namespace "0.2.3"]
[clojure-complete "0.2.3" :exclusions [[org.clojure/clojure]]]
[com.cemerick/austin "0.1.4"]
[com.cemerick/piggieback "0.1.3"]
[org.clojure/clojurescript "0.0-2014"]
[com.google.javascript/closure-compiler "v20130603"]
[args4j "2.0.16"]
[com.google.code.findbugs/jsr305 "1.3.9"]
[com.google.guava/guava "14.0.1"]
[com.google.protobuf/protobuf-java "2.4.1"]
[org.json/json "20090211"]
[org.clojure/data.json "0.2.3"]
[org.clojure/google-closure-library "0.0-20130212-95c19e7f0f5f"]
[org.clojure/google-closure-library-third-party "0.0-20130212-95c19e7f0f5f"]
[org.clojure/tools.reader "0.7.10"]
[org.mozilla/rhino "1.7R4"]
[org.clojure/clojure "1.5.1"]
[org.clojure/tools.nrepl "0.2.3" :exclusions [[org.clojure/clojure]]]

Removing cider-nrepl from the ~/.lein/profiles.clj :user profile makes no difference.

Blank /repl/start page looks like it's broken

"Awesome. A ClojureScript REPL in my browser. Too bad it's completely blank, so it must not be working."

It took me a while to realize /repl/start serves only as an engine for cemerick.piggieback/cljs-repl or cljs.repl/repl. Maybe this could be made more obvious, with either:

  1. Text on the page that indicate that it's loaded successfully

  2. A longer message REPL ready: "Browser-REPL ready @ http://localhost:44048/7599/repl/start - expect this to be blank"

Inexplicable problems with sample project

With a fresh clone of the the austin project, the sample project fails for me with the following:

$ lein cljsbuild once      
Compiling ClojureScript. 
Duplicate key: org.clojure/clojure

Commenting out [org.clojure/clojure "1.5.1"] in the project temporarily allows cljsbuild to work. However, when I try to load the repl I get the following:

$  lein repl
nREPL server started on port 53743
REPL-y 0.1.0-beta10
Clojure 1.5.1
…
FileNotFoundException Could not locate cemerick/austin/repls__init.class or cemerick/austin/repls.clj on classpath:   clojure.lang.RT.load (RT.java:443)

After loading (cemerick.austin.repls/exec), austin fails with "No value supplied for key:"

Found the magic to get austin, piggieback and cljs to compile, but when running (cemeric.austin.repls/exec) it fails with the following error in the repl.

Please let me know what I can do to help track this down.

IllegalArgumentException No value supplied for key: cemerick.austin.DelegatingExecEnv@4fd7d1f4  clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77)

Austin in the wrong profile causes AOT crash

mea culpa for leaving [com.cemerick/austin "0.1.1"] in the general plugins section of my project.clj, but it caused some pretty difficult to track down problems with AOT (specifically with the clojure.tools.reader.edn reader-types class). Not sure how to fix this more generally - austin shouldn't be involved in production cljs, since it wouldn't work anyway, but it would be nice if it errored-out or warned when used in production profiles.

Here is the example output that I had when tracking down the issue:

$ lein clean; DEBUG=true lein with-profile +uberjar uberjar; java -jar target/jida-0.1.1-standalone.jar 6543
Leiningen's classpath: :/Users/sgrove/.lein/self-installs/leiningen-2.3.3-standalone.jar
Applying task with-profile to (+uberjar uberjar)
Performing task 'uberjar' with profile(s): 'default,uberjar'
Applying task uberjar to nil
Applying task javac to nil
Running javac with [@/var/folders/39/47_0ln1n3q31k_p7zf4cq8l80000gq/T/.leiningen-cmdline1966769186414931876.tmp]
Applying task compile to nil
Compiling jida.datomic
Compiling jida.db
Compiling jida.models.query
Compiling jida.models.repo
Compiling jida.queries
Compiling jida.queue
Compiling jida.routes.api
Compiling jida.routes.content
Compiling jida.server
Compiling jida.support.cors
Compiling jida.views.common
Compiling jida.views.welcome
Warning: skipped duplicate file: config.clj
Created /Users/sgrove/code/clojure/jida/target/jida-0.1.1.jar
Including jida-0.1.1.jar
Including jsr305-1.3.9.jar
Including guava-14.0.1.jar
Including core.match-0.2.0.jar
Including jetty-io-7.6.8.v20121106.jar
Including args4j-2.0.16.jar
Including core.async-0.1.242.0-44b1e3-alpha.jar
Including servlet-api-2.5.jar
Including log4j-over-slf4j-1.7.5.jar
Including jcl-over-slf4j-1.7.5.jar
Including netty-3.6.6.Final.jar
Including javax.servlet-2.5.0.v201103041518.jar
Including slf4j-api-1.7.5.jar
Including slf4j-nop-1.7.5.jar
Including closure-compiler-v20130603.jar
Including tools.trace-0.7.6.jar
Including jetty-continuation-7.6.8.v20121106.jar
Including aws-java-sdk-1.5.5.jar
Including ring-codec-1.0.0.jar
Including data.json-0.2.3.jar
Including clout-1.0.1.jar
Including jackson-mapper-asl-1.8.9.jar
Including core.incubator-0.1.0.jar
Including jackson-dataformat-smile-2.2.1.jar
Including jackson-core-2.2.1.jar
Including korma-0.3.0-RC4.jar
Including java.jdbc-0.3.0-alpha5.jar
Including protobuf-java-2.4.1.jar
Including piggieback-0.1.0.jar
Including clojurescript.test-0.1.0.jar
Including ring-core-1.2.0.jar
Including dommy-0.1.2.jar
Including tools.macro-0.1.0.jar
Including ring-jetty-adapter-1.2.0.jar
Including tomcat-jdbc-7.0.27.jar
Including google-closure-library-0.0-20130212-95c19e7f0f5f.jar
Including cheshire-5.2.0.jar
Including clj-time-0.4.4.jar
Including austin-0.1.1.jar
Including ring-json-0.2.0.jar
Including commons-io-2.4.jar
Including crate-0.2.3.jar
Including tools.logging-0.2.6.jar
Including commons-codec-1.3.jar
Including cljs-ajax-0.2.1.jar
Including clojurescript-0.0-1934.jar
Including clojure-1.5.1.jar
Including cljs-test-0.0.6.jar
Including tools.cli-0.2.2.jar
Including rhino-1.7R4.jar
Including hiccup-1.0.4.jar
Including tigris-0.1.1.jar
Including compojure-1.1.5.jar
Including joda-time-2.1.jar
Including commons-compiler-jdk-2.6.1.jar
Including google-closure-library-third-party-0.0-2029-2.jar
Including lucene-core-3.3.0.jar
Including jetty-http-7.6.8.v20121106.jar
Including datomic-free-0.8.4218.jar
Including tools.nrepl-0.2.3.jar
Including hornetq-core-2.2.21.Final.jar
Including jackson-core-asl-1.8.9.jar
Including commons-fileupload-1.3.jar
Including jetty-util-7.6.8.v20121106.jar
Including fressian-0.6.3.jar
Including json-20090211.jar
Including h2-1.3.171.jar
Including commons-compiler-2.6.1.jar
Including ring-servlet-1.2.0.jar
Including tomcat-juli-7.0.27.jar
Including jul-to-slf4j-1.7.5.jar
Including c3p0-0.9.1.2.jar
Including postgresql-9.1-901-1.jdbc4.jar
Including tools.reader-0.7.10.jar
Including jetty-server-7.6.8.v20121106.jar
Including carica-1.0.3.jar
Created /Users/sgrove/code/clojure/jida/target/jida-0.1.1-standalone.jar
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/reader/reader_types/Reader
          at clojure.tools.reader.edn__init.load(Unknown Source)
          at clojure.tools.reader.edn__init.<clinit>(Unknown Source)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:266)
          at clojure.lang.RT.loadClassForName(RT.java:2098)
          at clojure.lang.RT.load(RT.java:430)
          at clojure.lang.RT.load(RT.java:411)
          at clojure.core$load$fn__5018.invoke(core.clj:5530)
          at clojure.core$load.doInvoke(core.clj:5529)
          at clojure.lang.RestFn.invoke(RestFn.java:408)
          at clojure.core$load_one.invoke(core.clj:5336)
          at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
          at clojure.core$load_lib.doInvoke(core.clj:5374)
          at clojure.lang.RestFn.applyTo(RestFn.java:142)
          at clojure.core$apply.invoke(core.clj:619)
          at clojure.core$load_libs.doInvoke(core.clj:5413)
          at clojure.lang.RestFn.applyTo(RestFn.java:137)
          at clojure.core$apply.invoke(core.clj:619)
          at clojure.core$require.doInvoke(core.clj:5496)
          at clojure.lang.RestFn.invoke(RestFn.java:421)
          at jida.datomic$loading__4910__auto__.invoke(datomic.clj:1)
          at jida.datomic__init.load(Unknown Source)
          at jida.datomic__init.<clinit>(Unknown Source)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:266)
          at clojure.lang.RT.loadClassForName(RT.java:2098)
          at clojure.lang.RT.load(RT.java:430)
          at clojure.lang.RT.load(RT.java:411)
          at clojure.core$load$fn__5018.invoke(core.clj:5530)
          at clojure.core$load.doInvoke(core.clj:5529)
          at clojure.lang.RestFn.invoke(RestFn.java:408)
          at clojure.core$load_one.invoke(core.clj:5336)
          at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
          at clojure.core$load_lib.doInvoke(core.clj:5374)
          at clojure.lang.RestFn.applyTo(RestFn.java:142)
          at clojure.core$apply.invoke(core.clj:619)
          at clojure.core$load_libs.doInvoke(core.clj:5413)
          at clojure.lang.RestFn.applyTo(RestFn.java:137)
          at clojure.core$apply.invoke(core.clj:619)
          at clojure.core$require.doInvoke(core.clj:5496)
          at clojure.lang.RestFn.invoke(RestFn.java:619)
          at jida.server$loading__4910__auto__.invoke(server.clj:1)
          at jida.server__init.load(Unknown Source)
          at jida.server__init.<clinit>(Unknown Source)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:266)
          at clojure.lang.RT.loadClassForName(RT.java:2098)
          at clojure.lang.RT.load(RT.java:430)
          at clojure.lang.RT.load(RT.java:411)
          at clojure.core$load$fn__5018.invoke(core.clj:5530)
          at clojure.core$load.doInvoke(core.clj:5529)
          at clojure.lang.RestFn.invoke(RestFn.java:408)
          at clojure.lang.Var.invoke(Var.java:415)
          at jida.server.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.tools.reader.reader_types.Reader
       at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
       at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
       ... 54 more

As a question though, how do you go about disabling austin when compiling for production? Do you simple comment-out the line in the :require ns-form?

can not execute inserted script

When loading my page with the script generated by (browser-connected-repl-js) i get the following error in the js-console

ReferenceError: goog is not defined

I'm totally new to cljs (and js, that is), so please be patient if this is kind of a stupid question or the totally wrong place to ask.

Printed output isn't returned to REPL until an expression is send for evaluation

e.g. if a callback is printing to *out* via println, prn, etc., that output isn't returned to the REPL until another expression is sent for evaluation. This is due to the synchronous request/response model of the communication channel…a very reasonable thing for evaluation results, but very counterproductive w.r.t. printed output.

Not sure this can be readily addressed as long as we're using the CrossPageChannel, with agents server-side to serialize responses. SSE + regular XHR (as discussed in #47 and elsewhere) would solve this, though that implies significant re-work.

Add production profile to browser-connected-repl-sample

I'm getting started with ClojureScript development and this sample is quite a useful resource to set up a development environment.

However, I think it would be also good to add a :production profile with the appropriate cljsbuild.

(I'm not sending a PR because I'm not sure exactly how I would do that, but I'm pretty sure you are :) )

Hardcode port of repl-env

Consider the following blob:

lein do cljsbuild once, repl
Compiling ClojureScript.
nREPL server started on port 32794
REPL-y 0.2.0
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)

bcrepl=> (def repl-env (reset! cemerick.austin.repls/browser-repl-env     (cemerick.austin/repl-env)))
Browser-REPL ready @ http://localhost:51098/5677/repl/start
#'bcrepl/repl-env

In particular, the following line:

http://localhost:51098/5677/repl/start

Is there a way to hard code the port that cemerick/austin opens up?

The server I'm talking to is behind a firewall. Thus, I need to either (1) tell iptables ot open up 51098 or (2) do port forwarding over ssh. I'm okay with this, but I'd prefer the port stay constant.

Question: is there a way to hardcode the port cemerick/austin opens up on?

Thanks!

Initial namespace not setup properly

For some reason, when using exec-env through cljs.repl/repl
the default namespace isn't initially set-up correctly causing syntax
errors in the generated code.

[com.cemerick/austin "0.1.4"]
[org.clojure/clojurescript "0.0-2156"]

nREPL server started on port 61111 on host 127.0.0.1 - nrepl://127.0.0.1:61111
REPL-y 0.3.1
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (cljs.repl/repl (cemerick.austin/exec-env))
Browser-REPL ready @ http://localhost:61114/2222/repl/start
To quit, type: :cljs/quit
ClojureScript:cljs.user> (def n 1)
"Error evaluating:" (def n 1) :as ".n = 1"
#<SyntaxError: Parse error>
No stacktrace available.
nil
nREPL server started on port 61126 on host 127.0.0.1 - nrepl://127.0.0.1:61126
REPL-y 0.3.1
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (def env (cljs.repl.rhino/repl-env))
#'user/env
user=> (cljs.repl/repl env)
To quit, type: :cljs/quit
ClojureScript:cljs.user> (def n 1)
1

Hot reloading of HTML files not working in example project

This might be one of those things that are simply "working as intended", but I realized that hot reloading of HTML isn't working.

As a Clojure newbie I just wanted to find a ClojureScript template that would just work to get my hands dirty with cljs. I tried to figure out why, but I only discovered that Ring technically supports hot reloading.

Is there a way around it?

help on none compilation option

Hi Chas, I'm not able to make austin sample to work with the :none compilation. I did not find any information about austin non supporting it in the browser connected REPL scenario.
It seems to me that austin has the same limitations of clojurescript.test about :none option. Is it true?
Have you any clue about it?

Thanks so much.

(run) fails with #<SyntaxError: Parse error> from ClojureScript repl

Hi Chas,
I realize that this may be related to the other open clojurescript bug but here's a report anyway.

I get the following when evaluating `(run) from the ClojureScript repl :

nREPL server started on port 62401 on host 127.0.0.1
REPL-y 0.2.1
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (cemerick.austin.repls/exec)
Browser-REPL ready @ http://localhost:62404/8890/repl/start
Type `:cljs/quit` to stop the ClojureScript REPL
nil
cljs.user=> (run)
"Error evaluating:" (run) :as ".run.call(null);\n"
#<SyntaxError: Parse error>
No stacktrace available.
nil
cljs.user=>

my config:

clojure 1.5.1
clojurescript 0.0-2080
lein-cljsbuild 1.0.0
austin 0.1.3

Austin creates ambiguously named directories

Austin creates new files in directories named .repl and out. It's not clear from their names who created them, and especially with out there's a risk of a name clash with an existing file or directory.

I suggest moving all Austin-generated files under a single directory named .austin, i.e. .austin/repl and .austin/out.

Mention that cljs sources need to be in project :source-paths

Austin fails to load libraries unless the ClojureScript source directory is in the top-level :source-paths property as well as the :cljsbuild :source-paths property.

This took me a while to figure out, so might be worth mentioning in the README.

Obscure error when PhantomJS is not installed

The repl gives a thoroughly obscure error when PhantomJS has not been installed:

(cemerick.austin.repls/exec)
Browser-REPL ready @ http://localhost:43505/2789/repl/start

IOException error=2, No such file or directory  java.lang.UNIXProcess.forkAndExec (UNIXProcess.java:-2)

The readme does already have enough hints to realize what the problem was, but I suggest adding a few more lines of setup instructions.

austin/exec-env fails w/ cljs 0.0-2173

Tested with a minimal project setup (only tried clojure 1.5.1, 1.6.0-beta1/2/RC1, latest stable cljs version above & austin 0.1.4). Same result for all CLJ versions...

user=> (cemerick.austin/exec-env)
NullPointerException   clojure.core/complement/fn--4082 (core.clj:1370)

user=> (.printStackTrace *e)
java.lang.NullPointerException
    at clojure.core$complement$fn__4082.invoke(core.clj:1370)
    at clojure.core$filter$fn__4264.invoke(core.clj:2601)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$map$fn__4245.invoke(core.clj:2551)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$filter$fn__4264.invoke(core.clj:2595)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$set.invoke(core.clj:3782)
    at cljs.closure$cljs_dependencies.invoke(closure.clj:666)
    at cemerick.austin$always_preload.invoke(austin.clj:359)
    at cemerick.austin$repl_env.doInvoke(austin.clj:407)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.core$apply.invoke(core.clj:624)
    at cemerick.austin$exec_env.doInvoke(austin.clj:485)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at user$eval8062.invoke(form-init1442561189772541762.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6666)
    at clojure.core$eval.invoke(core.clj:2927)
    at clojure.main$repl$read_eval_print__6625$fn__6628.invoke(main.clj:239)
    at clojure.main$repl$read_eval_print__6625.invoke(main.clj:239)
    at clojure.main$repl$fn__6634.invoke(main.clj:257)
    at clojure.main$repl.doInvoke(main.clj:257)
    at clojure.lang.RestFn.invoke(RestFn.java:1096)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__591.invoke(interruptible_eval.clj:56)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:624)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:41)
    at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__632$fn__635.invoke(interruptible_eval.clj:171)
    at clojure.core$comp$fn__4192.invoke(core.clj:2402)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__625.invoke(interruptible_eval.clj:138)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

Switching back to cljs 0.0-2156 works fine, with the caveat that Clojure 1.6.0-RC1 now is also throwing a warning when executing exec-env:

WARNING: unsigned-bit-shift-right already refers to: #'clojure.core/unsigned-bit-shift-right in namespace: cljs.core, being replaced by: #'cljs.core/unsigned-bit-shift-right

Spurious warning

(I'm not quite sure who's issue this is (austin / nrepl / cider / etc.) but reporting it here since Austin is the top of the tool chain).

I have cljs code that is running in a page in my browser. The source is also loaded in an emacs buffer. I use austin to connect with the browser page and try to evaluate code. It evaluates properly but first gives me a warning "WARNING: Use of undeclared Var...". The warning goes away if I do M-x cider-load-current-buffer or M-x eval-expression-at-point.

I don't really understand what's going on.

  1. If the repl knows how to find the code in the page's env, then why is it giving me a warning?
  2. Is evaluating in the buffer doing something different than load javascript directly from the html? If not, then why does the warning go away when I eval code directly into the repl?

Details (skip the rest of this if everything above makes sense)

What I did

; CIDER 0.4.0alpha (package: 20131030.852) (Clojure 1.5.1, nREPL 0.2.3)
user> 
#<Namespace degel.webol.server>
degel.webol.server> (-main)
#<Server org.eclipse.jetty.server.Server@1bf0b4a>
degel.webol.server> (muxx/run-client-repl)
;; NOTES
;; run-client-repl does
;;   (let [repl-env (reset! austin-repls/browser-repl-env (austin/repl-env))]
;;      (austin-repls/cljs-repl repl-env))
Browser-REPL ready @ http://localhost:50958/5833/repl/start
Type `:cljs/quit` to stop the ClojureScript REPL
nil
cljs.user> (+ 3 4)
7
cljs.user> 
degel.webol.page
degel.webol.page> (webol-menu-bar)
WARNING: Use of undeclared Var degel.webol.page/webol-menu-bar at line 1 
[:div.control-group [:div.controls ([:button.btn {:type "submit", :id :list-program, :class "btn-large"} "List"] [:button.btn {:type "submit", :id :save-program, :class "btn-large"} "Save"] [:button.btn {:type "submit", :id :clear-program, :class "btn-large"} "Clear"] [:button.btn {:type "submit", :id :run-program, :class "btn-large"} "Run"] [:button.btn {:type "submit", :id :abort-program, :class "btn-large"} "Abort"] [:button.btn {:type "submit", :id :step-program, :class "btn-large"} "Step"] [:button.btn {:type "submit", :id :help-program, :class "btn-large"} "Help"])]]

Integration with third party nrepl middleware

I'm not sure if this is the right place to submit this, but I'm looking for a solution to use both austin and ritz in the same project. I would like to debug server code with ritz, and work with an austin repl when developing client-side code.
I'm not asking to run them at the same time, the ability to alternate between the two would be good enough. If I understand correctly, the automatic nrepl middleware injections carried by both projects don't agree somehow.
This is error I get when I issue the command nrepl-ritz-jack-in in a project configured with austin, like the sample app.

WARNING] No nREPL middleware descriptor in metadata of clojure.core$comp$fn__4154@511ad529, see clojure.tools.middleware/set-descriptor![WARNING] No nREPL middleware descriptor in metadata of clojure.core$comp$fn__4154@397f0e73, see clojure.tools.middleware/set-descriptor![WARNING] No nREPL middleware descriptor in metadata of clojure.core$comp$fn__4154@448dbd82, see clojure.tools.middleware/set-descriptor!ERROR: Unhandled REPL handler exception processing message {:id 1, :op clone}

This brings up a question of nrepl middleware interplay, so I'm sorry if I inflict this issue on austin, but if anyone has a workaround, I'd love to learn about it.

Austin not compatible with cljs-2356

Hi Chas,

In the following Clojurescript commit, the macro cljs.compiler/with-core-cljs macro was changed to a function of [opts body] where body is a no-arg fn.
clojure/clojurescript@80ea15e#diff-57a98267a70154befa3b47a95ec43ec8R861

This causes https://github.com/cemerick/austin/blob/master/src/clj/cemerick/austin.clj#L321 to fail with an ArityException.

I'm not sure what that line does (there's no body at all), but changing the line to (comp/with-core-cljs nil (fn []) seemed to solve the problem.

Do you want me to submit a patch for this?

multiple (prn "something") produces a NPE

I have discovered that when my onchange handler on an input elementet that uses prn to debug, was fired many times.

That will raise an exception

java.lang.RuntimeException: Agent is failed, needs restart
    at clojure.lang.Util.runtimeException(Util.java:223)
    at clojure.lang.Agent.dispatch(Agent.java:238)
    at clojure.core$send_via.doInvoke(core.clj:1915)
    at clojure.lang.RestFn.applyTo(RestFn.java:146)
    at clojure.core$apply.invoke(core.clj:623)
    at clojure.core$send_off.doInvoke(core.clj:1937)
    at clojure.lang.RestFn.invoke(RestFn.java:464)
    at cemerick.austin$constrain_order.invoke(austin.clj:238)
    at cemerick.austin$eval3275$fn__3277.invoke(austin.clj:244)
    at clojure.lang.MultiFn.invoke(MultiFn.java:227)
    at cemerick.austin$handle_request.invoke(austin.clj:282)
    at cemerick.austin$create_server$reify__3178.handle(austin.clj:25)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
    at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
    at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:677)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:649)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
    at clojure.core$fn__5420.invoke(core_print.clj:187)
    at clojure.lang.MultiFn.invoke(MultiFn.java:231)
    at clojure.core$pr_on.invoke(core.clj:3322)
    at clojure.core$pr.invoke(core.clj:3334)
    at clojure.lang.AFn.applyToHelper(AFn.java:161)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.core$apply.invoke(core.clj:617)
    at clojure.core$print.doInvoke(core.clj:3379)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at cemerick.austin$eval3275$fn__3277$fn__3279$fn__3280.invoke(austin.clj:247)
    at cemerick.austin$eval3275$fn__3277$fn__3279.invoke(austin.clj:246)
    at cemerick.austin$run_in_order.invoke(austin.clj:230)
    at clojure.core$binding_conveyor_fn$fn__4107.invoke(core.clj:1839)
    at clojure.lang.AFn.applyToHelper(AFn.java:161)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.lang.Agent$Action.doRun(Agent.java:114)
    at clojure.lang.Agent$Action.run(Agent.java:163)

Can't require namespaces

When trying to require a namespace from my project, I get:

cljs.user=> (ns foo (:require [my-namespacel]))
WARNING: Required namespace not provided for my-namespace

And then my-namespace is not defined.

Cljs version 0.0-2202, austin 0.1.4

Can I get a browser REPL without running a HTTP server?

What I wonder is, once I get a running REPL by

(def repl-env (reset! cemerick.austin.repls/browser-repl-env (cemerick.austin/repl-env)))

can I connect to it in a file:/// plain HTML page?

So far what I got is:

Blocked a frame with origin "http://localhost:60473" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "file". Protocols must match.

Any idea how to get around this annoying same-origin policy?

reload a *.cljs file

With apologies for my excitement of getting cemerick/austin to work:

The following currently works:

cljs.user=> (js/alert (+ 1 2))

the browser pops up a window with "3"

Question:

Is there a way I can reload a *.cljs file from the cljs.user=> ?

  • My *.clj work flow goes something like this: edit *.clj file, reload *.clj file
  • My past *.cljs work flow goes somethign like this:
    • edit *.cljs file
    • curse while "lein cljsbuild auto" slowly recompiles
    • then hit browser reload
  • I would like my future *.cljs work flow to go like this:
    • edit *.cljs file
    • have cljs.user=> reload the edited *.cljs file in currently running browser

Is there anyway, using cemerick/austin, to get the desired workflow above?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.