<< Back to previous view

[CLJS-1313] REPL support for libs compiler opts Created: 17/Jun/15  Updated: 22/Dec/15  Resolved: 22/Dec/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3308
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Mike Fikes Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1313-v1.patch    

 Description   

Today, module processing and the lib dependency index setup occurs only when cljs.closure/build is invoked. This ticket asks for the same setup to occur if either :libs or :foreign-libs options are passed when a REPL is launched (without an explicit build step occurring first, as is done in the Quick Start examples involving cljs.repl/repl).

An example:

(cljs.repl/repl (cljs.repl.node/repl-env)
  :foreign-libs [{:file "libs/greeting.js"
                  :provides ["greeting"]
                  :module-type :commonjs}
                 {:file "libs/german.js"
                  :provides ["german"]
                  :module-type :commonjs}])

The above would be sufficient to cause, for example, CommonJS module processing to occur, and the results to be available within the REPL.

Additionally, the implementation should defer processing to after REPL -setup has been called, in case the REPL establishes an :output-dir for :merge-opts during -setup, thereby ensuring that any module processing output goes to the correct :output-dir.



 Comments   
Comment by Mike Fikes [ 17/Jun/15 6:51 PM ]

The attached CLJS-1313-v1.patch is working fine for Ambly, but it fails for the Node REPL. Interestingly, Maria Neise was finding that CommonJS processing was not quite working properly under Node, even with an explicit build step, when compared to Nashorn. Apart from general discussion that could be had about suitability of such a patch, there is a specific concern with Node that needs to be sorted.

Comment by Mike Fikes [ 17/Jun/15 8:45 PM ]

So, with further investigation, it looks like the issue with using this patch with Node is actually a separate problem with Node: CLJS-1314

Additionally, I can confirm that the patch functions properly for Nashorn.

Comment by David Nolen [ 10/Nov/15 8:46 AM ]

Does this patch still apply to master?

Comment by Mike Fikes [ 14/Nov/15 10:14 AM ]

I took a look and there might be a regression that we need to sort first (see CLJS-1314).

Comment by David Nolen [ 22/Dec/15 5:04 PM ]

Is this patch up-to-date?

Comment by Mike Fikes [ 22/Dec/15 8:05 PM ]

Yes, David. I applied the patch to master and tested it with the slight revision that Maria suggested to the greetings.js in CLJS-1314 and it worked perfectly in the Node REPL, the Nashorn REPL, and also in the Ambly REPL (thus addressing the possibility that REPLs might use :output-dir. It also still passes unit tests.

Comment by David Nolen [ 22/Dec/15 9:36 PM ]

fixed https://github.com/clojure/clojurescript/commit/2fa6fcad7bbf2375d3dc7dba669c65b06269b8b3

Generated at Sat Dec 15 10:48:35 CST 2018 using JIRA 4.4#649-r158309.