Fork me on GitHub
#cljs-dev
<
2021-11-29
>
orestis14:11:22

I think there's a bug with CLJS 1.10.891 regarding importing the top-level goog ns

orestis14:11:33

(ns main.goog-issue
  (:require [goog]))

(goog/typeOf "")

orestis14:11:04

clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}}' -M --main cljs.main --compile main.goog-issue yields

// Compiled by ClojureScript 1.10.758 {}
goog.provide('main.goog_issue');
goog.require('cljs.core');
goog.typeOf("");

//# sourceMappingURL=goog_issue.js.map

orestis14:11:31

clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.891"}}}' -M --main cljs.main --compile main.goog-issue blows up with

Unexpected error (ExceptionInfo) compiling at (REPL:1).
No such namespace: goog, could not locate goog.cljs, goog.cljc, or JavaScript source providing "goog" in file /Users/orestis/dev/clj-kondo-cljs-bug/src/main/goog_issue.cljs

Full report at:
/var/folders/5d/6gc_14214js5lwj2j8llw0vm0000gn/T/clojure-8016216251114526219.edn

dnolen15:11:33

@orestis you don't need to require top level goog btw, it's kind of anti pattern since it's not a thing

🤯 1
dnolen15:11:19

that it is not a namespace

dnolen15:11:39

that said, it might be a regression though I thought we had internal tests for that already

orestis16:11:46

Oh so I could just directly use goog/typeOf? Like we do js/console?

dnolen16:11:23

perfectly valid

dnolen16:11:35

@orestis what happened is that Google Closure dropped deps.js from Closure Library

dnolen16:11:46

and so now we generate it and we've had to recreate the various quirks

dnolen16:11:55

I think goog used to be in there - so it happened to work

dnolen16:11:12

if more people report it can think about reintroducing it - but again it's not necessary

orestis16:11:39

Funny thing is that shadow-cljs accepts it happily (using the same cljs version) so it's not really a regression for our project. Just something we happened to notice by accident.

borkdude16:11:35

$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.891"}}}' -M -m cljs.main -re node
Downloading: org/clojure/clojurescript/1.10.891/clojurescript-1.10.891.pom from central
Downloading: org/clojure/clojurescript/1.10.891/clojurescript-1.10.891.jar from central
ClojureScript 1.10.891
cljs.user=> goog/typeOf
This hangs for me.

borkdude16:11:53

But perhaps REPL is a special beast.

borkdude16:11:00

Oh, eventually it came back: #object[Function]

borkdude16:11:55

I did notice one regression I mentioned here or in #clojurescript but didn't get feedback on yet:

cljs.user=> (require '[clojure.string :as str] :reload)
Execution error (TypeError) at (<cljs repl>:1).
Cannot read property 'remove' of undefined

borkdude16:11:59

This used to work

borkdude16:11:52

(clojure.string is just a random example here, it happens with any namespace I try to reload)

borkdude16:11:08

This shows that it used to work:

$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.879"}}}' -M -m cljs.main -re node
ClojureScript 1.10.879
cljs.user=> (require '[clojure.string :as str] :reload)
nil

orestis16:11:09

@dnolen should there be a mention of goog like http://cljs.github.io/api/syntax/#js-namespace

👍 1
dnolen16:11:06

it's a simple fix and not to ClojureScript actually, just the GCL custom build we do - so will patch it up

dnolen17:11:49

@borkdude thanks for bringing that up again fixing

dnolen17:11:34

it was a bit specific to Node.js - so didn't notice

borkdude17:11:39

@dnolen that was fast. confirming:

$ clj -Sdeps '{:deps {org.clojure/clojurescript {:git/url "" :git/sha "02b450af9c5f3a1fa2ee949c28c3a671987d7e54"}}}' -M -m cljs.main -re node
Cloning: 
Checking out:  at 02b450af9c5f3a1fa2ee949c28c3a671987d7e54
ClojureScript 0.0.1828047738
cljs.user=> (require '[clojure.string :as str] :reload)
nil
cljs.user=>

borkdude17:11:05

thanks 🎉

dnolen17:11:25

@orestis very strange it works in a REPL

dnolen17:11:38

Hrm, ok I've reproduced it and added some details to the ticket

orestis18:11:11

I can't find how the http://cljs.github.io/api/ is generated. Nor clojure/clojurescript or clojure/clojurescript-site bring up any results...

dominicm18:11:45

It seems that closure-compiler-unshaded is no longer unshaded, closure-compiler-unshaded-v20210808.jar contains jsr250-api, jsr305, guava, etc.

dominicm18:11:44

Which means it conflicts with org.apache.maven/maven-core (dependency of tdeps).

dominicm18:11:02

I don't think there's any solution

dnolen18:11:18

Should probably be reported. There also a new release to check.

dnolen18:11:39

@orestis those docs are external

dominicm20:11:02

Where would I report that?