ANN: ClojureScript 1.9.854

297 views
Skip to first unread message

David Nolen

unread,
Jul 28, 2017, 5:54:42 PM7/28/17
to clojure, clojur...@googlegroups.com
ClojureScript, the Clojure compiler that emits JavaScript source code.


Leiningen dependency information:

[org.clojure/clojurescript "1.9.854"]

This is a significant feature release. Notable new features include
comprehensive NPM dependency support, overhauled code splitting,
enhanced JavaScript module preprocessing, declared global exports for
foreign libs, and checked array operations. There are also a large
number of fixes, changes, and minor enhancementes. For more detailed
descriptions of the major enhancements, please refer to the last month

As always, feedback welcome!

## 1.9.854

### Enhancements
* CLJS-2280: Provide process.env :preload and auto-configure
* CLJS-2279: Infer `:module-type ` for provided `node_modules`
* CLJS-2250: Support :foreign-libs overrides via :provides
* CLJS-2243: Self-host: Add support for :global-exports
* CLJS-2232: Self-host: Add support for string-based requires
* add *print-fn-bodies* knob, set to false
* CLJS-2198: Safe array operations
* CLJS-2217: Support `:rename` for JS modules
* CLJS-2214: Support :global-exports for foreign libraries
* CLJS-1428: Add a cljs.core/*command-line-args* var
* CLJS-2061: Support ns :require for JS libs, allow strings along with symbol
* CLJS-2148: Add warnings for invalid use of aget and aset
* CLJS-2143: Add support for symbol preprocess values

### Changes
* CLJS-2273: Bump tools.reader to 1.0.3 and development dependencies
* CLJS-2235: Allow passing extra maven opts to build scripts
* CLJS-2267: Allow ^:const inlined vars to affect if emission
* CLJS-2245: Add support for using a local `node_modules` installation through a new `:node-modules` compiler flag
* CLJS-2002: Don't throw when no *print-fn* is set
* support Clojure primitive array type hints, core.async no longer
  gives warnings
* CLJS-2213: Node.js target should use node_modules index to emit platform specific require
* CLJS-2200: bump to tools.reader 1.0.2
* CLJS-2135: require macro prints last result of loaded-libs
* CLJS-2192: Add ChakraCore testing facilities
* CLJS-1800: Defer to tools.reader for cljs.reader functionality
* CLJS-2163: Clean up uses of aget / aset on objects
* CLJS-2184: Add `ns-publics` and `ns-imports`
* CLJS-2183: Assert arguments are quoted symbols in some core macros
* CLJS-2182: Assert argument to resolve is a quoted symbol
* CLJS-2186: Update docstrings for aget/aset to be consistent with Clojure
* CLJS-2180: Allow compiling `:modules` with whitespace optimizations
* CLJS-1822: Use `:file-min` when processing JS modules with advanced optimizations
* CLJS-2169: Error when compiling with :source-map and advanced optimizations
* CLJS-2037: Throw if overwriting alias in current namespace
* CLJS-2160: Add loaded? and prefetch functions to cljs.loader
* CLJS-2148: Add unsafe-get and use goog.object
* CLJS-2161: Bump Closure Compiler to June 2017 release

### Fixes
* CLJS-1854: Self-host: Reload ns with const
* CLJS-2278: JavaScript object literals are printed wth keys that cannot be read
* CLJS-2276: Self-host: Need test.check dep for CLJS-2275
* CLJS-2275: cljs.spec.alpha/fdef resolves eagerly
* CLJS-2259: Extra .cljs_node_repl directory containing cljs.core output
* CLJS-2274: Update CI script to install deps
* CLJS-2269: Warn on top level code split loads
* CLJS-2272: Tests that depended on default install deps behavior failing
* CLJS-2255: Clean up :npm-deps
* CLJS-2263: Docstring for neg-int? backwards
* CLJS-2262: Correct comment that *warn-on-infer* is file-scope
* CLJS-2258: Stack overflow regression for sequence xform applied to eduction
* CLJS-2256: Generated code doesn't add newline after sourceMappingURL comment
* CLJS-2254: Module Indexing: Provide relative paths for a package's main module
* CLJS-2248: Build API tests rely on Yarn
* CLJS-2239: Self-host: Add `:target :nodejs` to the docstrings in cljs.js
* CLJS-2251: Follow-up fix to CLJS-2249 and related commit
* CLJS-2249: Provide a test for d4b871cce73
* CLJS-2246: Revert CLJS-2245 and CLJS-2240 and fix `lein test`
* CLJS-2244: Orphaned processed JS modules breaks :modules
* CLJS-2242: Lots of undeclared Var warns in cljs.spec.gen.alpha
* CLJS-2241: Multiple requires of Node.js modules in non :nodejs target are not idempotent at the REPL
* CLJS-2229: Ensure that new modules work works correctly with REPLs
* CLJS-2238: Perf regression with node module indexing
* CLJS-2240: don't shell out to module_deps.js if `:npm-deps` not specified
* CLJS-2230: Double checked arrays
* CLJS-2227: Squelch some of the array access tests
* CLJS-2228: Port CLJS-2226 to module_deps.js
* CLJS-1955: data_readers.cljc can't reference handlers in user code
* CLJS-2225: Need to add :checked-arrays to known compiler opts
* CLJS-2226: :npm-deps can't index scoped packages
* CLJS-2224: Resolve-var is wrong wrt. module resolution
* CLJS-2223: Self-host: Undeclared Var deps/native-node-modules
* CLJS-2222: CI failing after CLJS-2217
* CLJS-2219: Enable JSC under test-simple
* CLJS-2218: Make ClojureScript aware of native node modules
* CLJS-2220: Add runtime :npm-deps tests
* CLJS-2212: Replace missing-js-modules with new index-node-modules-dir
* CLJS-2211: Add function to index a top-level node_modules installation
* CLJS-2208: module_deps.js is not compatible with older JS implementations
* CLJS-2207: cljs.test/js-filename is using non-portable .endsWith
* CLJS-1764: Double warning for undeclared Var (REPL only)
* CLJS-2204: Tests failing with respect to lodash/array namespace
* CLJS-2205: NPM deps: Correctly compute `:provides` if file ends in `index.js`
* CLJS-2203: REPL is turning on all warnings by default (including :invalid-array-access)
* CLJS-2201: Self-host: test-js-filename failing
* CLJS-2202: String requires should work from Cljs files in classpath
* CLJS-2199: String requires broken after recompile
* CLJS-2172: memfn docstring refers to Java and reflection
* CLJS-1959: under :nodejs target we should provide __dirname and __filename constants
* CLJS-1966: cljs.test assumes the output directory is '/out/' when determining the filename for a failed or errored test result.
* CLJS-2191: Clean up doc references to clojure.spec.* in favor of cljs.spec.*
* CLJS-2194: cljs.util/relative-name bug
* CLJS-2195: npm-deps tests are not idempotent
* CLJS-2179: Add test for preprocess JS module as symbol
* CLJS-2152: "is not a relative path" exception thrown when `:libs` directory is provided.
* CLJS-2193: :npm-deps dependencies are implicit
* CLJS-1797: Update aot_core to support build with MINGW on Windows
* CLJS-2189: Add test for :preloads
* CLJS-2188: Use :invalid-array-access instead of :invalid-aget / :invalid-aset
* CLJS-2181: Can't compile string sources with modules
* CLJS-2185: Self-host: Docstrings for bootstrap helpers
* CLJS-2178: Add tests for `:npm-deps`
* CLJS-2177: NPM deps & JS modules fixes for Windows
* CLJS-2175: ES6 Module processing broken with Closure v20170626
* CLJS-2175: Add test to check ES6 module processing works
* CLJS-2176: module_deps.js: fix regexes for Windows paths
* CLJS-2173: Fix `npm install` when `:npm-deps` in Windows
* CLJS-2164: Require cljs.js results in warning about new unsafe-get macro
* CLJS-1998: Printing an Object with a null prototype throws an error
* CLJS-2158: cljs_base module generates empty goog.require
* CLJS-2157: Automatically generate cljs.loader/set-loaded! call
* CLJS-2154: Provide compiler info & timing when compiling modules
* CLJS-2151: Rollback removal of dependency information for node targeted compilation
* CLJS-2141: Self-host: cljs.js is using undeclared symbol lib
* CLJS-2145: inode_find issue with hash-map
* CLJS-2142: Can't instrument a namespace containing constants

Rangel Spasov

unread,
Jul 29, 2017, 1:24:33 AM7/29/17
to Clojure, clojur...@googlegroups.com
Works for me on iOS JavaScriptCore 👍 (RN 0.45). 

Thanks David and all ClojureScript contributors!

Rangel


Invalid :refer, var cljs.reader/reader-error does not exist 

I assume this is on the library side to fix with the latest ClojureScript update but just FYI if anyone runs into it.

Alan Moore

unread,
Jul 29, 2017, 8:46:17 PM7/29/17
to ClojureScript
Wow! Nice work... thanks so very much! Hoping to have some time soon to contribute/give back.

Alan

Charles Loomis

unread,
Jul 30, 2017, 1:06:40 PM7/30/17
to clojur...@googlegroups.com
I’ve encountered a problem when running unit tests with doo (phantomjs) and the 1.9.854 release.

With the new release, the problem is that doo always fails _after_ running the defined tests with:

WARNING: doo's init function was not set
#object[TypeError TypeError: undefined is not an object
(evaluating 'process_exit.call')]
TypeError: undefined is not an object (evaluating 'process_exit.call’)

This is caused by doo not finding the correct exit function.

To distinguish between browser/nodejs targets, doo checks for the existence of js/process. If it exists, it assumes that nodejs is being used and tries to extract the exit function from from the js/process object. Otherwise it uses the *exit-fn* dynamic variable. This logic works as expected in 1.9.671.

In 1.9.854, a shim for the nodejs process library was added (src/main/cljs/process/env.cljs). This creates a js/process object which looks like:

{
"env": {
"NODE_ENV": "development"
}
}

even when nodejs is not being targeted. This causes the doo logic for looking up the exit function to fail.

It looks like either:

1) doo needs to be updated to use a more precise test when targeting nodejs or
2) clojurescript should define the js/process shim only when nodejs is targeted

I’d like some feedback on this to understand where to follow up with this issue.


Cal

David Nolen

unread,
Jul 30, 2017, 2:31:27 PM7/30/17
to clojur...@googlegroups.com
The shim is intentionally present regardless of target. You can disable this behavior with `:process-shim false`.

If there's a more robust way for doo to determine the environment that's probably a good idea too.

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 clojurescript+unsubscribe@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Leon Grapenthin

unread,
Jul 30, 2017, 2:47:18 PM7/30/17
to ClojureScript, clo...@googlegroups.com
Amazing release, trying it out right now.

Just wanted to see if including this works: https://github.com/coopermaruyama/react-web3

I try to :require it via [react-web3 :as w3]

Unfortunately this gives me a not-found error. Also I noticed that CLJS indeed downloaded react-web3 to "node_modules", but the folder is missing from the node_modules folder in the compilers output.

Am I requiring it wrong, or is it not supported for some reason?

Kind regards,
 Leon.

David Nolen

unread,
Jul 30, 2017, 2:54:04 PM7/30/17
to clojur...@googlegroups.com
No idea, make something minimal without any tooling besides ClojureScript and report the issue in JIRA.

Thanks,
David

Leon Grapenthin

unread,
Jul 30, 2017, 4:02:00 PM7/30/17
to Clojure, clojur...@googlegroups.com
Yes, it does make CLJSJS obsolete and the new method is to include Node modules from NPM.

CLJSJS was never the one true way, especially for production. It lacked deduplication of transitive dependencies that were not packed per CLJSJS and of course support for dependencies that where are not included in CLJSJS. 
It was nice to get started quickly, but in production one compiled its own bundle of js deps e. g. via webpack, and handwritten (or handcopypasted) externs.

As a newcomer, you won't have to deal with all that in the future, which is one of the many benefits of this release.

Nonetheless this new functionality will probably take an iteration or two until its stable.

On Sunday, July 30, 2017 at 9:42:32 PM UTC+2, Daniel wrote:
For someone who is new to clojurescript and pretty confused by clojurescript dependency management in general, does this release obsolete cljsjs for new projects and what is the new method?

David Nolen

unread,
Jul 30, 2017, 4:07:39 PM7/30/17
to clojure, clojur...@googlegroups.com
The ability to consume node_modules is just an additional feature - it makes no existing features obsolete.

David

On Sun, Jul 30, 2017 at 3:42 PM, Daniel <double...@gmail.com> wrote:
For someone who is new to clojurescript and pretty confused by clojurescript dependency management in general, does this release obsolete cljsjs for new projects and what is the new method?


On Friday, July 28, 2017 at 4:55:04 PM UTC-5, David Nolen wrote:

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com

Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Nolen

unread,
Jul 30, 2017, 4:15:43 PM7/30/17
to clojur...@googlegroups.com
On Sun, Jul 30, 2017 at 4:01 PM, Leon Grapenthin <grapent...@gmail.com> wrote:
Yes, it does make CLJSJS obsolete and the new method is to include Node modules from NPM.


This is not true and we should avoid disseminating such claims.
 
CLJSJS was never the one true way, especially for production. It lacked deduplication of transitive dependencies that were not packed per CLJSJS and of course support for dependencies that where are not included in CLJSJS. 
It was nice to get started quickly, but in production one compiled its own bundle of js deps e. g. via webpack, and handwritten (or handcopypasted) externs.

As a newcomer, you won't have to deal with all that in the future, which is one of the many benefits of this release.

Nonetheless this new functionality will probably take an iteration or two until its stable.

Total elimination of externs is just a non-goal. In some cases you will either need to engage with a JavaScript library maintainer to avoid needlessly dynamic code or supply externs. For example React still needs like 6 externs to work from node_modules under advanced compilation. This could be avoided with a diplomatic PR.

Part of the rationale for this change is encourage ClojureScript developers to engage more directly with the wider JavaScript ecosystem and push library maintainers to make their libraries Closure compatible as the changes are often trivial, especially for modern JS libraries written in ES6.

David

Charles Loomis

unread,
Jul 31, 2017, 4:22:37 AM7/31/17
to clojur...@googlegroups.com

Thanks for the feedback. I can verify that the `:process-shim false` option works around the problem. I’m following up with the doo developer and have proposed a patch (https://github.com/bensu/doo/pull/141).

Cal
> 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 https://groups.google.com/group/clojurescript.
>
>
> --
> 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.

marcs....@gmail.com

unread,
Jul 31, 2017, 6:45:30 PM7/31/17
to ClojureScript, clo...@googlegroups.com
Great release, nice to see npm support more stable now, just started testing, seems fine for now.
Reply all
Reply to author
Forward
0 new messages