This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-13
Channels
- # beginners (67)
- # boot (18)
- # cider (28)
- # clara (11)
- # cljs-dev (1)
- # cljsrn (7)
- # clojure (134)
- # clojure-dev (2)
- # clojure-dusseldorf (1)
- # clojure-greece (1)
- # clojure-italy (13)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-russia (2)
- # clojure-spec (2)
- # clojure-uk (52)
- # clojurebridge-ams (1)
- # clojurescript (78)
- # core-async (1)
- # core-matrix (2)
- # cursive (12)
- # data-science (22)
- # emacs (10)
- # events (1)
- # fulcro (28)
- # graphql (4)
- # hoplon (16)
- # jobs (1)
- # lein-figwheel (3)
- # leiningen (3)
- # nyc (1)
- # off-topic (19)
- # onyx (70)
- # parinfer (2)
- # pedestal (1)
- # portkey (9)
- # protorepl (2)
- # re-frame (16)
- # reagent (39)
- # ring-swagger (5)
- # rum (1)
- # schema (2)
- # shadow-cljs (216)
- # specter (5)
- # sql (1)
- # uncomplicate (4)
- # unrepl (6)
- # vim (25)
- # yada (5)
ah right. I only tested with foo.html
which automatically sets content-type based on file ext 😛
fixed in [email protected]
probably a really bad idea but I’m gonna test the size difference on my work project to check how bad
one question, how do transitive JS deps work? eg. I have a commands library that will depend on keypress.js
as a github dependency in package.json
, and am wondering what I do in that library so that I can depend on it elsewhere
CLJS wants to do it this way: deps.cljs
in your src root, {:npm-deps {"name-of-dep" "version"}]
shadow-cljs npm-deps
will attempt to install them but that needs work, I’m not happy with how that works
Ever seen something like this? cljs.core.async
is compiling with a trailing js.map
:
cljs.core.async.partition_by.cljs$lang$maxFixedArity = 3;
//# sourceMappingURL=cljs.core.async.js.map
js.map
saw it for the first time now in 2.0.13is there a wiki page or sth where i should make notes of these JS related Q&A’s / stubs for documentation?
for now just my own notes to remember: https://github.com/mhuebert/shadow-eval/wiki
that should cover almost all externs … as long as you dont use :resolve
:target :global
working at the right depth in the stack / layer of abstraction can make things so simple
need to work out how to do this for node but for the browser it seems to actually work reasonably well
/* @constructor */ function ShadowJS() {};
ShadowJS.prototype.$$typeof;
ShadowJS.prototype.Children;
ShadowJS.prototype.Component;
ShadowJS.prototype.PureComponent;
ShadowJS.prototype.ReactCurrentOwner;
ShadowJS.prototype.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
ShadowJS.prototype.__self;
ShadowJS.prototype.__source;
ShadowJS.prototype._owner;
ShadowJS.prototype.assign;
ShadowJS.prototype.children;
ShadowJS.prototype.cloneAndReplaceKey;
ShadowJS.prototype.cloneElement;
ShadowJS.prototype.constructor;
ShadowJS.prototype.context;
ShadowJS.prototype.count;
ShadowJS.prototype.createElement;
ShadowJS.prototype.createFactory;
ShadowJS.prototype.current;
ShadowJS.prototype.enqueueForceUpdate;
ShadowJS.prototype.enqueueReplaceState;
ShadowJS.prototype.enqueueSetState;
ShadowJS.prototype.forEach;
ShadowJS.prototype.forceUpdate;
ShadowJS.prototype.framesToPop;
ShadowJS.prototype.func;
ShadowJS.prototype.isMounted;
ShadowJS.prototype.isPureReactComponent;
ShadowJS.prototype.isReactComponent;
ShadowJS.prototype.isValidElement;
ShadowJS.prototype.key;
ShadowJS.prototype.keyPrefix;
ShadowJS.prototype.map;
ShadowJS.prototype.name;
ShadowJS.prototype.only;
ShadowJS.prototype.props;
ShadowJS.prototype.prototype;
ShadowJS.prototype.ref;
ShadowJS.prototype.refs;
ShadowJS.prototype.render;
ShadowJS.prototype.result;
ShadowJS.prototype.setState;
ShadowJS.prototype.thatReturns;
ShadowJS.prototype.thatReturnsArgument;
ShadowJS.prototype.thatReturnsFalse;
ShadowJS.prototype.thatReturnsNull;
ShadowJS.prototype.thatReturnsThis;
ShadowJS.prototype.thatReturnsTrue;
ShadowJS.prototype.toArray;
ShadowJS.prototype.type;
ShadowJS.prototype.unstable_AsyncComponent;
ShadowJS.prototype.unstable_isAsyncReactComponent;
ShadowJS.prototype.updater;
ShadowJS.prototype.version;
;; auto
Flushing: base.js (181706 bytes)
Flushing: react.js (111923 bytes)
Flushing: demo.js (195720 bytes)
Flushing: extra.js (136 bytes)
Flushing: worker.js (75 bytes)
;; manual
Flushing: base.js (181233 bytes)
Flushing: react.js (111923 bytes)
Flushing: demo.js (195684 bytes)
Flushing: extra.js (136 bytes)
Flushing: worker.js (75 bytes)
not at all bad, auto is using the generated externs, manual is using the default react externs
@mhuebert [email protected]
has this enabled by default, if you feel like testing.
decided to try importing firebase, eg. yarn install firebase
and then ["firebase/app" :as firebase]
. it is supposed to work with webpack etc.; I get:
ExceptionInfo: no source by name: node_modules/@firebase/util/dist/cjs/src/constants.ts
adding something to :npm-deps
in deps.cljs
does not appear to have any effect, with or without :lein true
@mhuebert yes :npm-deps
is not finished. you can try shadow-cljs npm-deps
but it has some issues
does it somehow need to end up being installed in maria/node_modules
or would it also be picked up in commands/node_modules
so ultimately shadow-cljs npm-deps
could crawl other projects’ deps.cljs
and install all the listed :npm-deps
into the current project
the firebase files have source maps, which apparently causes it to return constants.ts
instead of constants.js
when asking which filename it is processing currently
SEVERE: node_modules/@firebase/util/dist/cjs/src/constants.js:26:
Originally at:
node_modules/@firebase/util/dist/cjs/src/constants.ts:26: ERROR - @define variable assignment must be global
Oct 13, 2017 3:28:12 PM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: node_modules/@firebase/util/dist/cjs/src/constants.js:30:
Originally at:
node_modules/@firebase/util/dist/cjs/src/constants.ts:31: ERROR - @define variable assignment must be global
@mhuebert should be fixed in [email protected]
can you please check the line count of target/shadow-cljs/builds/browser/release/shadow.js.auto_externs.js
?
no source by name: node_modules/@firebase/util/dist/cjs/src/constants.ts
{:name "node_modules/@firebase/util/dist/cjs/src/constants.ts"}
ExceptionInfo: no source by name: node_modules/@firebase/util/dist/cjs/src/constants.ts
it still says 2.0.15 when loading the script, this could be confusing, but maybe there is no way to easily catch if the version is different in project.clj
can you send me the target/shadow-cljs/builds/browser/release/shadow-js/*
files zipped or so?
there is probably a closure minified thing in there, want to see if I can somehow detect that
in a namespace with this required:
["firebase/app" :as firebase]
["firebase/auth"]
try (js/console.log (.auth firebase))
i think whatever they have + a simple way to add additional properties might be decent
the automation part is hard yes, thats why I was surprised why the generation thing worked so well
the only part I didn’t like about :infer-externs
was that you sometimes have to annotate your code
hmm. could it make sense that firebase’s externs don’t work when firebase is required via npm vs. included in a script tag
they were recently open sourced: https://github.com/firebase/firebase-js-sdk
i wouldn’t worry too much about firebase in particular. i just thought it might be a good one to try because google usually annotates everything etc… but i guess that is more relevant for things handled by closure compiler
i guess externs on short names wouldn’t make a big file impact, because you can’t rename these things shorter anyway? its not preventing the closure compiler from reducing the size of $some_long_name$
but instead of turning some_long_name
into a
its forced to turn it into abc
or whatever
I’ll test a few things with :infer-externs
, maybe I can find a solution that is more reliable
should have done that in the first place, just got too excited by this idea of collecting all properties 😛
I mean it’s a pretty big win that a library like React ‘just works’ with this generate-externs option
with React + Firebase, difference is only 2kb adding :generate-externs in addition to the ‘real’ externs for both libs
generated externs appear to totally solve ‘React’ but fail with firebase due to auth
issue mentioned above
I agree this is an important thing though, and worth the effort. has been one of the most frustrating aspects of ClojureScript, this gulf between dev and production where suddenly new bugs appear, and extremely slow feedback cycles with advanced compilation. (well: i am very surprised/impressed at how much faster it is with shadow. i thought the slowness was somehow necessary part of the process)
well shadow-cljs caches more aggressively so the only thing you pay for is the actual :advanced
compilation
other CLJS tools do not cache at all for :advanced
builds, so it always recompiles all CLJS as well
small thing, if we could make the debugging statements in shadow.cljs.bootstrap.browser
optional 🙂
@jiyinyiyong those things don’t really apply to shadow-cljs 😉