This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-21
Channels
- # beginners (38)
- # boot (88)
- # cljs-dev (142)
- # cljsrn (2)
- # clojars (1)
- # clojure (107)
- # clojure-berlin (2)
- # clojure-italy (8)
- # clojure-russia (76)
- # clojure-spec (325)
- # clojure-taiwan (3)
- # clojure-uk (28)
- # clojurescript (80)
- # clojurewest (2)
- # core-async (36)
- # core-logic (1)
- # cursive (21)
- # datomic (16)
- # dirac (18)
- # docs (2)
- # emacs (1)
- # euroclojure (3)
- # garden (3)
- # gsoc (2)
- # hoplon (3)
- # immutant (4)
- # jobs-discuss (16)
- # lein-figwheel (5)
- # liberator (17)
- # lumo (19)
- # off-topic (2)
- # om (20)
- # onyx (28)
- # pedestal (50)
- # planck (4)
- # re-frame (5)
- # reagent (3)
- # ring-swagger (13)
- # spacemacs (1)
- # specter (43)
- # testing (3)
- # timbre (3)
- # uncomplicate (1)
- # vim (2)
- # yada (4)
Is there a reason why clj->js
uses doseq
to build up #js arrays instead of reduce
which is faster ?
@superstructor probably historical reasons. if you see reduce
is faster, please create a ticket with benchmarks
if we verify it's faster I'm sure it'll be considered
i wanted them for a build tool i'm writing in cljs. async/await will be supported in node soon and this is a stepping stone towards that
given that google closure supports transpiling them to es3, i'm not sure what the problem is
@jjl one issue is that while in development most people are using :none
which does not go through closure
nod. my use case was for node. i don't think it's such a compelling feature in the browser
people tend to use things they read about .. so if someone reads that CLJS does support await they will start using it
maybe once it supported everywhere ... until then you'd require the user to always use Closure even in development
"if your project (or a dependency thereof) uses this feature, you need to add this to your compiler options"
actually i think being able to tell closure what version of es to compile for would be nice
okay, so if the user has that and :optimizations :simple
in dev, they would be able to use this feature with this patch and still run it on ie10
but FWIW I think it would be far more valuable to have everyone use core.async
instead of adopting the many different async patterns there are in JS land
but given that the JS world will still do its thing we have do adopt it anyways in some form
i definitely don't want cljs to get left behind new features because despite being so futuristic we stick to generating code that is N major versions behind
I have a completely different (ns ...)
handling than the default CLJS in shadow-build
sure, but i'm not feeling like maintaining a fork just to get features i can have in javascript
my compelling reason is "we're gonna have es7 soon, why can't we have things javascript can have?"
have you used core.async? beyond the basics? I mean transducers in channels, alt!
, etc?
Personally, I'd love to see async/yield/await support in cljs. I primarily use Promises for async stuff.
yeah might be useful. I don't know. I'm working with about 50/50 CLJ/CLJS and haven't used a single promise, so I'm obviously biased towards core.async.
@dnolen https://github.com/clojure/clojurescript/blob/2171ae9859a2e982497764a04de10916aae68307/src/main/cljs/cljs/core.cljs#L1272-L1293 I got curious on this piece of code. I saw your comment like "TODO: we should remove this", what was the plan about that?
@jjl on second though: you may only yield
in generator functions right? that will be problematic with some constructs in CLJS as they introduce inner functions for scoping reasons
@jjl we need to step back, what actually problem is this solving for most users - why do they need a JS feature
no rationale, it’s not going to happen - “I want to use it for something I’m doing in Node.js” is not a rationale
Hi I played around with the new js-modules support, pretty awesome stuff. But I seem to hit a bug when I add this library: https://github.com/styled-components/styled-components I would think this is probably an issue with the google-closure-compiler instead of the clojurescript compiler? I am trying to figure out where it's best to put this bugreport...
Where are you encountering the bug?
I get the following warnings when compiling:
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "supports-color" at /home/mitchel/Development/styled-om-components/node_modules/styled-components/lib/vendor/postcss/css-syntax-error.js line 9 : 4
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "supports-color" at /home/mitchel/Development/styled-om-components/node_modules/styled-components/lib/vendor/postcss/css-syntax-error.js line 9 : 21
And this pretty much seems to break the rest of the stuff that styled-components need
And when I open it in the browser I get errors like this:
Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$container is not defined
at at-rule.js:6
rule.js:4 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$container is not defined
at rule.js:4
comment.js:5 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$node is not defined
at comment.js:5
declaration.js:5 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$node is not defined
at declaration.js:5
parser.js:9 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$root is not defined
at parser.js:9
parse.js:5 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$input is not defined
at parse.js:5
root.js:6 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$container is not defined
at root.js:6
input.js:4 Uncaught ReferenceError: module$$home$mitchel$Development$styled_om_components$node_modules$styled_components$lib$vendor$postcss$css_syntax_error is not defined
Which all seem to be a result of not being able to load supports-color. The first thing that I can think of is that google-closure does not use the browser field in package.jsonYou're using the new :npm-dpes
compiler option right?
And I am running from master
It looks like a failure running cljs.closure/node-inputs
try requiring styled-components
manually (see here https://clojurescript.org/guides/javascript-modules for guide)
You'll need to replace cljs.build.api/node-inputs
with cljs.closure/node-inputs
node-inputs
will process all your node module dependencies in foreign-libs
to pass to ClojureScript
This is necessary to see if this a clojurescript or closure bug?
Yep we want to see if the supports-color
module is getting passed in when ClojureScript is importing node modules
Sure I'll try it out do I need to follow the Node Modules Chapter?
You'll want to have this JavaScript file
var Styled = require('styled-components');
module.exports = {
Styled: Styled
};
and then run this Clojure code
(require '[cljs.closure :as cc])
(require '[ :as io])
(def entry {:file (.getAbsolutePath (io/file "path/to/npm_stuff.js"))
:provides ["libs.npm-stuff"]
:module-type :commonjs}])
(def foreign-libs
(into [entry] (cc/node-inputs [entry]))
Then check foreign-libs
(it'll be a large vector of files to pass into ClojureScript) for the supports-color
module
I've got to get to work I hope this helps
Thank you I am trying it out and will report back
That is weird it seems to do the correct thing:
{:file
"/home/mitchel/Development/hello-cjs/node_modules/supports-color/browser.js",
:module-type :commonjs,
:provides ["supports-color"]}
But when I try this:
(b/build
(b/inputs "src")
{:main 'hello-cjs.core
:output-to "main.js"
:output-dir "out"
:externs ["process.js"]
:foreign-libs foreign-libs
:optimizations :none
:closure-warnings {:non-standard-jsdoc :off
:global-this :off}})
It still gives the same warning
I also checked the contents of "/home/mitchel/Development/hello-cjs/node_modules/supports-color/browser.js"
:
'use strict';
module.exports = false;
Which seems fine to me
@mitchelkuijpers CLJS does respect the browser field
Yeah I noticed ^^ @anmonteiro the output above proofs it
Is the problem requiring styled-components?
I'll try it out once I get to work
The problem is that once I try to load it in the browser it wont load styled components because it cannot load that module and then everything fails
It's probably too soon to judge whether it's a Closure or CLJS bug
Do you want me to push a minimal reproducible case?
We need to figure out why you're getting the warning in the first place
btw I also put this in the compiler options:
:language-in :ecmascript5
Then you will only get the 2 above warnings
@mitchelkuijpers what version of supports-color
is that trying to require?
You can check it by going to your node_modules folder and inspecting the pckage.json
Hrm I may have a hunch, need to confirm in front of a computer
Cool, if you need anything from me let me know
@mitchelkuijpers trying it right now
can you tell me the styled-components version?
Yes 1.4.4 @anmonteiro
thanks
@mitchelkuijpers so the problem seems to be with 'use strict’;
Woa that's weird, was that your hunch?
actually..
hrm I might have spoken too early
I just realized I’m probably not running the right version of Closure
Whoops, I have just tried it without use strict and it still breaks
@mitchelkuijpers can’t figure it out right now, and also can’t afford to spend any more time on it today
No problem, thank you for trying @anmonteiro