This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-16
Channels
- # aleph (1)
- # architecture (5)
- # beginners (43)
- # boot (23)
- # cider (5)
- # cljs-dev (143)
- # clojure (42)
- # clojure-austin (4)
- # clojure-dusseldorf (14)
- # clojure-italy (15)
- # clojure-norway (1)
- # clojure-russia (10)
- # clojure-spec (41)
- # clojure-uk (70)
- # clojurescript (262)
- # cursive (3)
- # data-science (18)
- # datomic (66)
- # figwheel (1)
- # fulcro (39)
- # hoplon (21)
- # jobs-rus (1)
- # juxt (4)
- # lein-figwheel (2)
- # leiningen (4)
- # lumo (26)
- # off-topic (4)
- # om (6)
- # onyx (19)
- # parinfer (50)
- # pedestal (9)
- # portkey (10)
- # re-frame (41)
- # schema (5)
- # spacemacs (2)
- # yada (35)
hey @sam16 pls try this https://developers.google.com/identity/sign-in/web/reference
hey, https://github.com/material-components/material-components-web uses an npm package name of @material
. This produces import errors. Is there any workaround for this?
right now, I've reverted to using the precompiled bundle, they provide, but I'd like to import it directly
@bendlas Oh, gotcha. npm-deps should be fine then. How does your cljs :require
look?
I suspect it's a gclosure fail, since you can also require [material-components-web]
, then the transitive require for @material
modules fails too
if the npm dep is material-components-web
, then the only entry point is that - so it would have to be something like (:require [material-components-web :as material])
@dominicm I've tried the first one, nope @ second one. see https://unpkg.com/[email protected]/index.js
not that it will fix your issues, but you should use the exact same name you would use in Node.js when requiring. In the case where it would not be a valid symbol or it would be munged, use string require
@dnolen i figured that. seems like closure is at fault. I'll try with the latest version and maybe report a bug ..
weāre doing far more with it than anyone else using Closure Compiler far as I can tell
when you say āimport errorsā Iām assuming Closure says itās couldnāt import some module
right, I'm not quite sure about who does what about npm deps between cljs and gclosure. the transitive modules showed up in <root>/node_modules
but not in <cljs-out>/node_modules
OK, so the error with cljs master is the same:
1) when requiring something like ["@material/card" :as mc]
, the analyzer fails with No such namespace: @material/card, could not locate _CIRCA_material_SLASH_card.cljs, _CIRCA_material_SLASH_card.cljc, or JavaScript source providing "@material/card"
2) when requiring the parent namespace [material-components-web :as mcw]
, it compiles but gclosure can't find the sources: `Uncaught Error: Undefined nameToPath for module$home$herwig$checkout$diagnosia_app$node_modules$$material$drawer$temporary
at visitNode (base.js:1357)
at visitNode (base.js:1355)
at visitNode (base.js:1355)
at visitNode (base.js:1355)
at visitNode (base.js:1355)
at Object.goog.writeScripts_ (base.js:1369)
at Object.goog.require (base.js:706)
at (index):15`
@dnolen can confirm, but I suspect cljs might not package up transitive dependencies for google closure.
is the second dollar sign in node_modules$$material
a munged @
, or is that always there?
if your code is trying to require a transitive dep that isnāt going to work and we donāt support that
funnily: cljs_deps.js
contains paths like goog.addDependency("../node_modules/@material/base/foundation.js", ['module$home$herwig$checkout$diagnosia_app$node_modules$$material$base$foundation'], []);
@dnolen as opposed when I checked before, the output folder now contains node_modules/@material
Looking through the https://github.com/material-components/material-components-web package.json, I can't actually see @material/card
or anything like it.
@dnolen so the current failure is that none of the subdirs of @material/drawer
get included: https://unpkg.com/@material/[email protected]
@dominicm https://github.com/material-components/material-components-web/blob/master/packages/mdc-card/package.json
https://github.com/material-components/material-components-web/blob/master/packages/material-components-web/package.json here's the master package.json, my bad š
@dnolen because in the index.js
, there is are lines like: export {MDCTemporaryDrawer, MDCTemporaryDrawerFoundation} from './temporary'
@dnolen the top-level index.js does: goog.addDependency("../node_modules/material-components-web/index.js", ['module$home$herwig$checkout$diagnosia_app$node_modules$material_components_web$index'], ['module$home$herwig$checkout$diagnosia_app$node_modules$$material$auto_init$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$base$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$checkbox$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$dialog$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$drawer$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$form_field$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$grid_list$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$icon_toggle$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$linear_progress$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$menu$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$radio$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$ripple$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$select$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$slider$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$snackbar$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$tabs$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$textfield$index', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$toolbar$index']);
The weird thing is, drawer depends on it's subdirs: goog.addDependency("../node_modules/@material/drawer/index.js", ['module$home$herwig$checkout$diagnosia_app$node_modules$$material$drawer$index'], ['module$home$herwig$checkout$diagnosia_app$node_modules$$material$drawer$util', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$drawer$temporary', 'module$home$herwig$checkout$diagnosia_app$node_modules$$material$drawer$persistent']);
so it seems that it indexes modules within the same directory, but subdirectories are ignored @dnolen
@bendlas https://github.com/material-components/material-components-web/tree/master/packages/mdc-card, side note, letās paste snippets to avoid flooding the channel like that
there is: https://github.com/material-components/material-components-web/tree/master/packages/mdc-drawer
but yeah, many @material
packages just have .scss
files. I was going to figure out the appropriate babel transform later
great! I can revisit this later, when I'm not on company time. for now, I'll just use the prepackaged version.
Antonió could provide some insight later when heās on as well - Iām pretty sure someone else had tried material and they had gotten further
@bendlas I can repro your issue here, it just seems weāre not properly computing the node_modules inputs that must be passed through Closure in this case
hello \o/ is there a canonical simple cljs library people like to use for using localStorage?
@daiyi I think Closure lib has something, but you can also check https://github.com/alandipert/storage-atom which hides localStorage behind an atom (not sure if good idea) and takes care of encoding/decoding using Transit
@dnolen thanks for digging into the issue. let me know, if you could use any help with the ticket
https://google.github.io/closure-library/api/goog.storage.mechanism.HTML5WebStorage.html
depending on what youāre doing storage-atom
might also work for you - but Iām generally loathe to take on dependencies for basic stuff like this
the affordances often arenāt worth the trouble - but your mileage may vary - and itās really depends on the project
Hi! I need to make simple jquery callback after a component is rendered. How can I specify that function name as an extern before running lein cljsbuild once min
? Grateful for any pointers.
I did feel like it's quite a simple task that probably doesn't need dependencies. I'll start with google closure, thank you!
@daiyi itās also just nice to get familiar with Google Closure Library - itās really a treasure trove
once you wrap your head around you realize thereās just so many cases where you donāt need third party JS dep
I've noticed lots of advanced clojurescript people using it very often, so I suspect it's a power I should unlock :D I'm surprised not more javascript people use it
@daiyi itās not straightforward to consume for JS people because itās a module convention that predates modern JS and is somewhat conceptually at odds
itās also not difficult to rewrite JS into Closure style, thatās how all this new fancy node_modules
stuff works
@bendlas I think I see the problem export ... from
JS pattern doesnāt seem to get picked up?
in index.js
for drawer I see the util
import works but not the 2 export ... from
at the bottom of the file.
yeah it seems Closure does the right thing with export ... from
statements, but those deps arenāt getting passed in as inputs
@dnolen right, i wasn't sure whether this was bc if export .. from
or because of subdirs ...
we use that to understand import
when collecting inputs, but konan
doesnāt appear to support export ... from
Hmm. I tried to switch from ClojureScript 1.9.521 to 1.9.854 and I get:
#error {
:cause com.google.protobuf.GeneratedMessageV3
:via
[{:type clojure.lang.Compiler$CompilerException
:message java.lang.NoClassDefFoundError: com/google/protobuf/GeneratedMessageV3, compiling:(cljs/closure.clj:210:3)
:at [clojure.lang.Compiler analyzeSeq Compiler.java 6926]}
{:type java.lang.NoClassDefFoundError
:message com/google/protobuf/GeneratedMessageV3
:at [java.lang.ClassLoader defineClass1 ClassLoader.java -2]}
{:type java.lang.ClassNotFoundException
:message com.google.protobuf.GeneratedMessageV3
:at [java.net.URLClassLoader$1 run URLClassLoader.java 372]}]
Does this ring a bell with anyone? I'm not sure how to even approach this.@dnolen That's actually what I meant. And it does suggest considering "[org.clojure/clojurescript "1.9.854" :exclusions [com.google.protobuf/protobuf-java]]".
I think I found it. Two packages: bouncer, which requires an older version of ClojureScript, and clj-rethinkdb, which uses protobuf-java 3.0.0-alpha-3.1 directly. I'll add an exclude to clj-rethinkdb.
@dnolen Yep, that did it. I'll work with clj-rethinkdb to update their protobuf-java version. Thanks for the help!
@dnolen I'll report to https://github.com/egoist/konan/issues, unless you're already on it ...
not sure why we needed ecmascript modules in javascript, i am personally not a fan š we could've had better number types or better data structures. instead we have async module load.
@ashnur for the same reason we need to suport .jar
s in Clojure. Interopability. If you don't need it, good for you.
i think you misunderstand. when i said "we" i mean "we humans", not some vague subset of people. i don't think we put it into js because of interop, there was no import/export before. we had commonjs and it was fine. some people were exploring other stuff, that was fine too.
Clojure always has been a pragmatic language. A core difference to other interesting, but ultimately impractical, languages is, that Clojure never tried to hold up the river by standing in the middle and pretending it wasnt there.
ES6 Modules are what javascript is converging to as a module system and clojurescript's technical direction is not the place to fight that trend.
So I'm not sure whether you're arguing that ES6 shouldn't exist or whether cljs shouldn't support its modules, but either way, unless you have a good alternative solution for interacting with npm, i project that people are not going to listen.
we had commonjs way before ESM, i did not need import export. š not sure who was not fine with commonjs and why they had to put a way more complicated stuff into the language.
it was good enough, now there is a rip in space time because of this, because if I use browserify as i did before, i there are certain possible combinations that just simply don't work, so i can't do that. then there are the ES6 modules, but those have their own problems: https://github.com/d3/d3/issues/2733
Just a heads-up with cljs master, I get async.cljs?rel=1502892032791:13 Uncaught TypeError: goog.net.jsloader.load is not a function
@bhauman
@bendlas pretty sure @tony.kay saw the same thing - Figwheel doesnāt seem to work with :modules
if somebody can come up with a theory why it doesnāt work Iāll take a look at - but Iām not going to do any initial research myself - this release has been delayed too long already
@dnolen I'm not using :modules
. Neither npm ones, nor closure ones. I wasn't suggesting to delay either, but I'd love for figwheel to fix this asap. Looks like one of the removed closure namespaces to me
Does latest Cljs update Closure-library?
@juhoteperi it did yes, you can always downgrade it manually though
Okay, probably Fighweel needs to start using safeLoad
instead of removed load
. Boot-reload has the same problem.
@juhoteperi yep: https://github.com/google/closure-library/commit/988ff900886e959a888485ee56d1540d1bf2f29d
load
has been deprecated for ages, I think, but we haven't seen deprecation warnings so there will be some broken code
Maybe because Closure only shows warnings when doing advanced build and figwheel nor boot-reload are not used in that case
@dominicm @sundarj @bendlas I'm glad David ended up finding your issue. I'll get to it soon, but will probably not be in today's release.
Just a side note: it doesn't help very much coming up with theories based on random guessing for why things don't work. In fact, we do index the entire node_modules installation (we just don't descend into nested node_modules/pkg/node_modules). We do support requires of the form @foo/bar/baz
and whatever form you can think of (like collapsing x/index.js
to x
, etc.
@anmonteiro thanks!
I try to avoid random guesses. My first theory about the @
being the problem turned out to be false, but it was based on my not seeing the folder in the output directory (for whatever reason)
Something that I find very useful when looking at things like this is to consult the tests
And we do have a bunch of tests in CLJS for all this
yeah, I get that false starts like this are frustrating from a maintainer's perspective, I have been on that side as well, but there really wasn't that much random guessing involved. I'll try to do better though. Looking at tests when diagnosing is probably a good idea.
@bendlas & others I reported the jsloader problem on figwheel with details (https://github.com/bhauman/lein-figwheel/issues/594) and pushed a new snapshot of Boot-reload with the fix
well, yeah. I tried to be more specific than "library x doesn't work" and the guess wasn't random, but I'll try to describe the actual situation, next time @dnolen @anmonteiro
@juhoteperi thanks for the heads up
@bbloom Directories that contain cljs sources? cljs.build.api/inputs
@bbloom But ClojureScript also looks for sources in classpath, if I recall correctly, only the directory which contains :main
ns needs to be in inputs
de-lurking for a moment: very glad to see that all the Cool Kids are here, now that Iāve taken up a clojure/cljs job. š
thanks! you too š
i havenāt been writing much cljs lately - just trying to help fix a fipp bug somebody reported
@bendlas I have no problem with ālibrary X doesnāt workā. the problem here was guessing that could cause misinformation to newcomers or other people looking to try out this feature
anyway, I think you get my point and nothing constructive is going to come out of this
you know, if I had a wishlist for cljs/om, itād be something like Rx. But Iāve been on an Rx kick for a few years now.
i imagine it wouldn't be too difficult to write an RxClojure-like wrapper around RxJS
I am tempted!
what do you need out of rx? iāve found it to be a pretty painful model to work with in practice
i even wrote an rx-like with cljs & decided āthis is a bad ideaā and i know a core contributor to microsoftās original rx š
what made it feel wrong?
yeah, thatās what Iād like to hear; what suffices that need. Om or bare react misses some things.
but more generally, itās a model built on incorporating time in to sequences - which is an unnecessary complication
you can add trasducers to channels, which means that all transformation remains synchronous - you can handle time with other mechanisms
yeah, except when time matters!
can I write a continuous abstraction over time that composes?
maybe a state-machine compositionā¦
oh, man, see, thatās where people start discounting user requirements in my experience.
not right this second; still on day 8 of the new job.
last job was react/redux and I really needed to throttle and debounce non-UI stuff quite a lot, and use mediated/programmatic throttling.
for high-volume interactive data-viz where the frontend had to do a lot of the crunching.
PureScript was the āpreferred fancy UI languageā but it did not meet my needs.
aggregations were map/reduce jobs and the UI had to perform a streaming reduce
redux-saga was the presumed performer for a lot of work in that area but the team was too uncomfortable with both that and Rx.
each DB shard would perform its own agg and send its results.
or ⦠partition, really.
eh, this is too much right now. Iād be happier to hear about effect types in dynamic languages, if youāre still on that @bbloom.
@juhoteperi @dnolen I just pushed the fix for the jsloader deprecation
@juhoteperi I'm changing my fix so that it's backward compatible, the current fix is only good for CLJS >= 1.9.223
@bhauman Ah, good catch, I'll copy the fix to boot-reload š
@juhoteperi updated it https://github.com/bhauman/lein-figwheel/commit/9e8e6d4504c807f8a41767075bf86cbab67df6d1