ANN: ClojureScript 0.0-2843, Node, Node, Node

587 views
Skip to first unread message

David Nolen

unread,
Feb 12, 2015, 12:08:39 PM2/12/15
to clojure, clojur...@googlegroups.com
ClojureScript, the Clojure compiler that emits JavaScript source code.


New release version: 0.0-2843

Leiningen dependency information:

    [org.clojure/clojurescript "0.0-2843"]

This release is primarily about outstanding Node.js target
issues. Further changes have been made to support Node.js v0.12
specifically around the deprecation of util.print. Node.js target now
supports :main same as browser based :none builds. Node.js :simple and
:advanced builds now set goog.global correctly ensuring that
core.async works properly. The Node.js REPL should now work on slower
machines. And all of these enhancements have been made with the
Windows platform in mind.

We've also solidified and documented the new generic source mapping
infrastructure for custom REPLs. Figwheel and Ambly are already taking
advantage of this to great effect.

Printing is now customizable in order to support custom printing in
Chrome DevTools, there's some prototype work based on this happening

cljs.test now supports macro inference simplifying testing at a REPL.

Full list of changes, fixes, and enhancements follows.

Feedback welcome!

## 0.0-2843

### Enhancements
* CLJS-1032: Node.js target should support :main
* require cljs.test macro ns in cljs.test to get macro inference goodness
* include :url entries to original sources in mapped stacktraces if it can be determined   from the classpath
* support custom mapped stacktrace printing
* provide data oriented stacktrace mapping api
* CLJS-1025: make REPL source mapping infrastructure generic
* CLJS-1010: Printing hook for cljs-devtools
* CLJS-1016: make "..." marker configurable

### Changes
* CLJS-887: browser repl should serve CSS
* CLJS-1031: Get Closure Compiler over https in the bootstrap script

### Fixes
* cljs.nodejscli ns needs to set `goog.global` when `COMPILED` is true, this fixes the fundamental issues for ASYNC-110
* CLJS-967: "java.net.ConnectException: Connection refused" when running node repl
* pass relevant source map options in the incremental compile case
* add some missing source-map customization flags to optimized builds
* fix missed Rhino REPL regression, the surrounding REPL infrastructure creates cljs.user for us
* util.print has been deprecated in Node.js v0.12. Switch to console.log in Node.js REPLs.
* change `cljs.closure/watch` so it correctly watches all subdirectories do not recompile unless changed path is a file with .cljs or .js extension

Boris Kourtoukov

unread,
Feb 12, 2015, 2:18:49 PM2/12/15
to clojur...@googlegroups.com, clo...@googlegroups.com
Hi David,

Thank you for the awesome release!

I have been using your helpful run.js file from mies-node-template does anything need to be updated in it, or is it now obsolete?

try {
require("source-map-support").install();
} catch(err) {
}
require("./out/goog/bootstrap/nodejs.js");
require("./out/{{sanitized}}.js");
goog.require("{{sanitized}}.core");
goog.require("cljs.nodejscli");

I am getting a 'Error: Module did not self register.' when I try to run a recompiled version of a project that used this.

Thanks again!

David Nolen

unread,
Feb 12, 2015, 2:30:54 PM2/12/15
to clojur...@googlegroups.com
run.js is obsoleted by :main support.

David


--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Roger Gilliar

unread,
Feb 12, 2015, 3:37:04 PM2/12/15
to clojur...@googlegroups.com
Are there any docs on how to use main and start the compiled ClojureScript. I tried the following

1. added :main server.core/main to project.clj
2. started the script: node out/server/server.js

But I get: ReferenceError: goog is not defined


Sebastian Bensusan

unread,
Feb 12, 2015, 6:14:16 PM2/12/15
to clojur...@googlegroups.com
Roger

I don't use Node as target so take this with a grain of salt:

When you add the :main option the compiler will add a small script that dynamically adds goog, the dependencies, and the compiled script. You need to specify in the :asset-path option the relative paths of those files.

For example, since my dev server has its root in "resources/public", my asset path looks like this:

:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/compiled"
:main server.core
:asset-path "js/compiled"

Marc Fawzi

unread,
Feb 12, 2015, 6:28:52 PM2/12/15
to clojur...@googlegroups.com

Marc Fawzi

unread,
Feb 12, 2015, 6:30:23 PM2/12/15
to clojur...@googlegroups.com
sorry, sent before looking at latest comments, 

it does! thanks.... 

David Nolen

unread,
Feb 12, 2015, 6:56:49 PM2/12/15
to clojur...@googlegroups.com
Look at the contents of the :output-to script for your Node.js project. You can see that it expects to start from the current directory and appends :output-dir to get to the compiled sources. Given what you've specified it won't work since you compiled :output-to *inside* :output-dir. I would recommend just putting your server script outside :output-dir - the requirements of web servers don't really apply to Node.js scripts. And to clarify further, :asset-path won't help you here.

David

David Nolen

unread,
Feb 13, 2015, 5:21:18 PM2/13/15
to clojure, clojur...@googlegroups.com
Just pushed out 0.0-2850. The only significant change is a critical fix for dependent namespace recompilation spotted by Bruce Hauman.

David
Reply all
Reply to author
Forward
0 new messages