This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-31
Channels
- # beginners (9)
- # boot (38)
- # cider (7)
- # cljs-dev (181)
- # cljsrn (49)
- # clojure (136)
- # clojure-italy (44)
- # clojure-losangeles (1)
- # clojure-news (1)
- # clojure-russia (3)
- # clojure-sanfrancisco (1)
- # clojure-serbia (2)
- # clojure-spec (28)
- # clojure-uk (41)
- # clojure-ukraine (1)
- # clojurescript (103)
- # core-async (6)
- # core-logic (46)
- # cursive (5)
- # data-science (8)
- # datascript (6)
- # datomic (5)
- # emacs (35)
- # events (3)
- # jobs (2)
- # jobs-rus (2)
- # juxt (6)
- # lumo (7)
- # off-topic (101)
- # om (6)
- # onyx (6)
- # parinfer (38)
- # pedestal (5)
- # perun (1)
- # planck (4)
- # protorepl (4)
- # re-frame (62)
- # reagent (20)
- # remote-jobs (1)
- # ring-swagger (1)
- # spacemacs (16)
- # unrepl (43)
- # vim (13)
i.e. (.log js/console (str "Body Response: " (:body response)))
prints Body Response:
to console, and nothing else
(I am seeing the HTML str in the console now, after doing (prn "response was: " response)
)
It seems that, using console-log or Clojure's prn, I can see (in the browser console) the html str I want
getResponseBody
and getResponseText
appear to be methods of the goog.net.XhrIo
's parent class, but calling them on response
also just produces 'null'
all you polymer geeks who are dying to help out: see the stuff in index.html
and src/shell
(except the driver.js bit). driver in ES6, implementation delegated to clojurescript.
👋 I'm setting up a simple form with reagent and I can't figure out how to correctly set a default-value on the input. The default-value comes from an api call whose results are eventually sent into this EntryEditor function. Any thoughts on how I can get this to work?
Got it! I found what I was looking for in the todomvc example for anyone interested: https://github.com/tastejs/todomvc/blob/gh-pages/examples/reagent/src/cljs/todomvc/components/todo_edit.cljs
the example from https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules should work by having 1.9.854 in the classpath, right?
@bensu I guess you might be missing :install-deps true
in your compiler options
we ended up changing the default behavior last minute and the example should account for it, I’ll edit it
let me know if that doesn’t fix it
@bensu I submitted the PR above to correct the post
sorry for the waste of time
btw, we don’t install deps by default because of this reason: you may choose to install deps yourself (e.g. with yarn
, and not even pass :npm-deps
)
and we’ll know that you’re requiring a node module 🙂
as long as they’re installed before CLJS compilation begins, the compiler can figure it out
hey guys, I'm trying out the new :npm-deps
and stumbled upon an java.lang.RuntimeException : INTERNAL COMPILER ERROR.
at this JS code:
node_modules/dom-helpers/transition/properties.js:17:4
animationEnd = void 0;
node_modules/dom-helpers/transition/properties.js:15:0
var prefix = void 0,
Is this a bug within the closure compiler?Stacktrace:
java.lang.NullPointerException: null
at com.google.javascript.rhino.Node.replaceWith (Node.java:872)
com.google.javascript.jscomp.ProcessCommonJSModules$RewriteModule.updateNameReference (ProcessCommonJSModules.java:1075)
com.google.javascript.jscomp.ProcessCommonJSModules$RewriteModule.maybeUpdateName (ProcessCommonJSModules.java:954)
com.google.javascript.jscomp.ProcessCommonJSModules$RewriteModule.visit (ProcessCommonJSModules.java:712)
com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:730)
com.google.javascript.jscomp.NodeTraversal.traverseChildren (NodeTraversal.java:802)
com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:726)
com.google.javascript.jscomp.NodeTraversal.traverseChildren (NodeTraversal.java:802)
com.google.javascript.jscomp.NodeTraversal.handleScript (NodeTraversal.java:680)
com.google.javascript.jscomp.NodeTraversal.traverseBranch (NodeTraversal.java:705)
com.google.javascript.jscomp.NodeTraversal.traverse (NodeTraversal.java:307)
com.google.javascript.jscomp.NodeTraversal.traverseEs6 (NodeTraversal.java:647)
com.google.javascript.jscomp.ProcessCommonJSModules.process (ProcessCommonJSModules.java:134)
com.google.javascript.jscomp.Compiler.processAMDAndCommonJSModules (Compiler.java:2106)
com.google.javascript.jscomp.Compiler.parseInputs (Compiler.java:1792)
com.google.javascript.jscomp.Compiler.parse (Compiler.java:1007)
will be in the next version of Closure which we’ll hopefully be able to squeeze into the next release of ClojureScript
@anmonteiro awesome, thanks! 🙂
How do I require the spec.gen namespace in ClojureScript now that we have cljs.spec.alpha
? I had [cljs.spec.impl.gen :as gen]
earlier.
@dnolen Sorry about that, I had something else wrong! I think I also got a bit confused by what has been fixed in a later cljs version than what I'm using: CLJS-2242: Lots of undeclared Var warns in cljs.spec.gen.alpha
yes - it should work, there are some minor things we need to fix, but I think no deal breakers
Hi there, following my questions of yesterday, I have a dozen definitions/modules, I load one during the macro expansion phase. I expect the output javascript to NOT include the other modules (compilation :advanced)
@dnolen I have a macro that reads an env variable, and require the corresponding module
but there’s no such thing as requiring a module that way, I’m not sure how you tried to accomplish that
is this completely wrong: https://clojurians.slack.com/archives/C03S1L9DN/p1501417046949044 ?
if anything you’re trying doesn’t take these assumptions into account - it’s not going to work
so in "clojure mode" I read the env variable, require the module and load a variable from it, to produce a simple (def preloaded {:my-def [{:a 1} {:b 2} ...]})
still I would rewind - it’s very hard for me to understand what you are trying to accomplish
I have a evaluator that process a bot definition and user input and produces an output
I want to avoid loading a dozen definitions every time my cloud function starts. I'm hoping to get a quick win by just picking ONE definition at compile time, that'd produce a smaller js and I'd use it without changing the rest of my code.
So I try the macro route, since I know that's eval'd during the clojure phase,
I wrote a macro that loads a module and pull a variable from it.
Instead of loading 12 modules, I have a single (def preload {:bot-001 CONTENT-OF-MODULE-DEFINITION})
but why do you need to bother with all this? advanced compilation includes whole program tree shaking / dead code elimination
@lsenta you are bitten by the fact that CLJS includes ALL files it found in your :source-paths
in the :advanced
compilation
that is no longer true if you use :modules
though which only includes what is reached by your :entries
@lsenta maybe :closure-defines
could help? see https://cljs.github.io/api/cljs.core/goog-define
I didn't know about this one, thanks! The clojure macro can use the env which is more handy for me
@dnolen that's what I'm trying to get, I load a single module so that dead code elimination gets rid of the unused 11 modules
but @thheller do you have a reference for this? it sounds like dead code elimination would work only for imported libraries then
Same issue with modules & closure defines,
the cond
over the goog-define value is optimized (I copied the example with identical?
in https://cljs.github.io/api/cljs.core/goog-define)
but all the modules are included in the javascript output. Even the one that are never accessed.
if someone is never accessed it will be DCE’ed, if it’s not being DCE’ed something is wrong with the code
@dnolen My experiments show something different, I pushed a minimal repos that demonstrate the issue
Hi -- I’m trying to migrate from consuming an external bundle to consuming node_modules
or :npm-deps
directly, using cljs master and closure-compiler master. Files using require('assert')
fail with JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert".
Do I need to pass an option to clojurescript related to the node API? Alternatively, adding the commonjs assert
package to package.json
or :npm-deps
doesn’t remove the error -- if using this package is the right solution, should I be adding something to my namespace as well?
@wcohen that needs more investigation, can you please open a JIRA ticket?
I think I know what’s wrong but need to have a more in-depth look later
Issue is here: https://dev.clojure.org/jira/browse/CLJS-2290. This is my first bug report, so please let me know if additional or different information would be useful
thanks
Using cljs :infer-externs true
I get
WARNING - name goog is not defined in the externs
coming from the prefix goog.string;
and some longer paths under goog.string
there should be no reason to create externs for goog closure stuff, so this seems harmless. However, what is causing it? in v1.9.671
I tried searching and best I found was a similar question asked on slack quite a while back.
@mikerod not enough information to understand what you are saying - come up with something minimal and report an issue in JIRA
@dnolen yeah, not sure how to recreate it so was first checking if this is just a “known thing”. I’ll see about coming up with something that reproduces it
is there a clojurescript equivalent to alter-var-root? trying to figure how to get https://github.com/bhb/expound printer to be pervasic in a cljs repl