This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-04
Channels
- # beginners (90)
- # boot (5)
- # cider (89)
- # cljsrn (27)
- # clojure (33)
- # clojure-dev (2)
- # clojure-italy (3)
- # clojure-spec (35)
- # clojure-uk (17)
- # clojurescript (93)
- # code-reviews (1)
- # datascript (2)
- # datomic (14)
- # defnpodcast (6)
- # emacs (11)
- # figwheel (8)
- # figwheel-main (6)
- # hyperfiddle (14)
- # jobs-rus (1)
- # nrepl (3)
- # off-topic (13)
- # onyx (6)
- # reagent (6)
- # reitit (4)
- # shadow-cljs (110)
- # spacemacs (1)
- # tools-deps (10)
- # vim (17)
I’m using the “promesa” lib on node.js (in an AWS lambda) and seeing an error that suggests that the release compile is obfuscating a promesa fn when it shouldn’t. Anyone seen this before or have an example of promesa being advanced compiled with shadow?
2018-08-04T02:57:14.739Z 15b1728f-9792-11e8-bf66-b982ac270145 TypeError: this.Rd is not a function
at Promise.f.promesa$protocols$IPromise$_catch$arity$2 (/var/task/handlers.js:680:71)
at zz (/var/task/handlers.js:676:641)
at Kz (/var/task/handlers.js:682:442)
at Fo (/var/task/handlers.js:778:164)
I am using deps.edn for classpath/deps. I wonder if that’s causing the problem?I just read the docs on https://shadow-cljs.github.io/docs/UsersGuide.html#_simplified_externs. I’ll see if that can fix the problem
@steveb8n turn on :compiler-options {:infer-externs :auto}
if you haven't. run shadow-cljs release your-build --pseudo-names
to figure out what .Rd
is.
@thheller: thanks! Glad to hear there is hope! 😃 Tried it now, using import * as shadowBrowser from '../lib/shadow.cljs.devtools.client.browser'
, as the first clsj import being done, but it doesn’t fix the problem. Worse, it makes the release build fail. What am I not understanding correctly?
well yeah thats the problem. the file only exists in dev builds and you must conditionally require it
typically you would if (process.env.NODE_ENV == "development") { require("../lib/shadow.cljs.devtools.client.browser"); }
are you actually running in the browser though? not exactly sure how vscode works internally. maybe its a node environment?
you should get some kind of message when the devtools either fail to load or connect
Ok, not at the computer right now, but will check ASAP. Should I be using the browser client, even though it is a node environment?
CLOSURE_DEFINES
:
var CLOSURE_DEFINES = $CLJS.CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":false,"shadow.cljs.devtools.client.env.proc_id":"2cce7108-2ff9-43b0-9469-40d5785b5f80","goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9631,"shadow.cljs.devtools.client.env.use_document_host":false,"shadow.cljs.devtools.client.env.module_format":"js","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"calva","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","goog.TRANSPILE":"never"};
so when the shadow.cljs.devtools.client.browser
is loaded it should defiinitely do something
I do have two instances running. The project I am testing my extesion with and then the watcher building the library/modules. I do not think I am connected to the wrong one.
I get SyntaxError: Unexpected token import
when just importing. At runtime, the TS compiler seems to think it is dandy.
The TS compiler rewrites it as require. (Yes, I did try the conditional require. It helps building the release build, but still this connection problem.)
But now using import (transcribed to require) I do get an error message with a hint, at last…
Now it connected! But running into a new problems
ReferenceError: SHADOW_NODE_EVAL is not defined
at Object.shadow$cljs$devtools$client$node$node_eval [as node_eval] (/Users/pez/Projects/clojure4vscode/lib/shadow.cljs.devtools.client.node.js:62:14)
I get very confused by the fact that I am using Calva for developing Calva. For Calva I use the built Calva extension, so maybe I need to build that and install before we conclude that things does not work…
I’ll package a release w/o the :runtime :node
config for now. Do you think I can fix it in shadow-cljs and send you a PR, or is it expert level stuff?
I guess you can try and set global.SHADOW_NODE_EVAL = function(js, sm) { goog.globalEval(js); }
before you load the .node
ns
the problem is identifying the platform correctly and then doing things in the correct order
global.SHADOW_NODE_EVAL = function(js, smJson) {
if (smJson) {
js += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,";
js += Buffer.from(smJson).toString('base64');
}
// console.log(js);
return VM.runInThisContext.call(global, js,
{filename: "<eval>",
lineOffset: 0,
displayErrors: true});
};
you can also try just adding that. thats the default fn used by :node-script
and :node-library
Now a new error:
ReferenceError: cljs is not defined
at <eval>:2:1
at <eval>:3:1078
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at runInThisContext (vm.js:95:38)
at global.SHADOW_NODE_EVAL (/Users/pez/Projects/clojure4vscode/out/calva/extension.js:14:32)
at Object.shadow$cljs$devtools$client$node$node_eval [as node_eval] (/Users/pez/Projects/clojure4vscode/lib/shadow.cljs.devtools.client.node.js:62:14)
This should all go in the development conditional, right? (Not that I have gotten that one to work yet, but anyway.)
I need to go now. Will be back later today. Can’t express how much I appreciate all your help.
Curious, the SHADOW_EVAL function is called with the cljs code compiled to js as a result of nrepl carrying out the eval operation?
hm, what's the flow to recompile individual files with the node-repl? Especially when e.g. I'm building a library, so don't really have an entry point that requires all the files I might want to load in the node-repl to try out
What I do is to build the cljs code toward a ‘/lib’ directory which is also symlinked to the /out
directory where the TS compiler puts it stuff. Conceptually like so:
/out/calva/*.js (generated from *.ts)
/out/lib/*.js (generated from *.cljs)
@alex340 the common workflow is to load your code via load-file
or (require 'that.ns :reload)
. Cursive has a keybind to load the current file in the REPL and thats what I use all the time. The command uses load-file
but require
also works.
I tried (require 'some.ns :reload)
, but that didn't seem to cause shadow-cljs to rebuild it
the file has an explicit typo in it, and yet
cljs.user=> (require 'verktyg.styled :reload)
nil
Hello. Sorry to bother with a noob question, but his has been puzzling me since yesterday 😃 Why does the lack of entry point prevent the use of a watcher? It seems there is something important for me to learn here.
they ARE supposed to be triggered by that. there does not need to be a watcher running for that.
totally possible, not ruling that out. if you can reproduce it in a dummy project please report it
I can push this project. it's a bit of a mess, so didn't want to publish it yet, but w/e
the package.json is a bit lazy, in that it contains irrelevant stuff (and so does the shadow-cljs.edn), but that's about it
@thheller: what is the :runtime
config supposed to do? (I don’t find it mentioned in the docs.)
@lilactown should maybe help with your CI issues
@thheller: that should mean that I can keep that part of the config even though it is not solving my problem right now, because when Calva is used “out there” it will be the REPL client of the particular projects that are in play and not the REPL client in the Calva extension?