Fork me on GitHub
#clojurescript
<
2019-04-09
>
danielstockton09:04:14

Should closure-defines work in a cljsbuild build when target is nodejs?

danielstockton09:04:25

In particular goog.DEBUG

Robert Nikander11:04:22

Is *ns* supposed to be in cljs?

thheller12:04:43

at runtime no, at compile/macro time yes

mikerod13:04:27

When running CLJS tests for a project with varying versions ranging from 1.9.x-1.10.x and varying clj from 1.9 to 1.10 along with it, I’m running across this error:

SyntaxError: Invalid regular expression: range out of order in character class

  file:///My/path/to/my-project/target/js/simple.js:5467 in RegExp
TypeError: undefined is not an object (evaluating 'clara.test.run')

  undefined:2
  :3
Using compiler opts like:
{:main "my.test"
 :output-to "resources/public/js/simple.js"
 :output-dir "resources/public/js/out"
 :asset-path "js/out"
 :optimizations :none}
I know this is not a great repro, but has anyone seen an issue similar to this before? The reported line (5467) with the RegExp issue looks like it’s in the middle of the Google closure part of the compiled JS. I believe it is this line:
goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g;goog.i18n.bidi.stripHtmlIfNeeded_=function(str,opt_isStripNeeded){return opt_isStripNeeded?str.replace(goog.i18n.bidi.htmlSkipReg_,""):str};goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.hasAnyRtl=function(str,opt_isHtml){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str,opt_isHtml))};goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl;
And final note, when I use clj 1.7 and a later cljs 1.7.x I don’t see this problem. I know my version numbers and surrounding details are vague. I’m giving the high-level view to see if anything here looks like something someone else has encountered.

mikerod13:04:49

It may also be the case that this problem shows up only in running phantomjs tests. I haven’t determined that yet. If is the case though, it’s phantomjs 2.1 (the last that will be released). It could end up just being a phantomjs problem even. Perhaps something in this regex isn’t supported.

gfredericks14:04:06

does using an alias for a keyword namespace in cljs require having an empty file with (ns the.namespace.in.the.keywords)?

dnolen14:04:36

yes there's currently no way to alias without a namespace

mss16:04:14

getting a weird error in cljs 1.10.339 in closure’s i18n module with :optimizations :none via shadow-cljs:

Uncaught SyntaxError: Invalid regular expression: /[Ö'-Û¯Ûº-ࣿâ€�-��-�ï¬-ï·¿ï¹°-ﻼ]/: Range out of order in character class
which seems to be erroring on the line:
goog.i18n.bidi.rtlChars_ = "֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83b" + "יִ-﷿ﹰ-ﻼ";
anyone seen anything like this before? kind of at a loss for how to debug or move forward

thheller16:04:24

@mss likely a missing <meta charset="utf-8"> in your html <head>

mss16:04:02

that was exactly it. thanks for all the help. shadow has been pretty lovely to work with

chronno18:04:17

Hi guys! I'm trying to update cljsjs/react-popper to the latest version. In order to do so I'm following the instructions at https://github.com/cljsjs/packages/wiki/Updating-packages. Right now I'm stuck at the 'Update externs' part. As a first step I'm trying to reproduce the current react-popper.ext.js before updating any versions, but seems I'm missing something. I'm using http://jmmk.github.io/javascript-externs-generator like this:

curl -O 
curl -O 
curl -O 
curl -O 
curl -O 

generate-extern -f react.production.min.js,react-dom.production.min.js,prop-types.js,popper.js,index.umd.js -n ReactPopper -o test-extern.js
But comparing the resulting file against react-popper.ext.js mine is missing some parts:
/**********************************************************************
 * Extern for ReactPopper
 * Generated by 
 **********************************************************************/
var ReactPopper = {
  "Manager": function () {},
  "Popper": function () {},
  "Reference": function () {},
  "placements": {}
};
ReactPopper.Manager.prototype = {
  "forceUpdate": function () {},
  "isReactComponent": function () {},
  "render": function () {},
  "setState": function () {}
};
/**********************************************************************
 * End Generated Extern for ReactPopper
/**********************************************************************/
Any idea what I'm doing wrong?

mikerod18:04:40

@mss @thheller That’s odd timing. This error reported about the Regular expression is nearly the same line I just mentioned today in my question here https://clojurians.slack.com/archives/C03S1L9DN/p1554817407239700 The line I pasted with the error included this new RegExp("["+goog.i18n.bidi.rtlChars_+"]") which is probably where the error comes up. And Thomas’s suggestion solved it.

mikerod18:04:06

I also was only seeing it on “newer” cljs versions (didn’t see it in 1.7, do see it in 1.9 & 1.10 that I’ve checked). Not sure why. I guess google closure updates introduced this (assuming, haven’t investigated that track).

mikerod18:04:51

So the good part though is, this solved my problem as well… 🎉

🙌 4
lepistane19:04:13

has anyone encountered this issue? https://github.com/drapanjanas/re-natal/issues/220 generating debug apk undefined is not a valid argument for 'in' (evaluating 'StopIteration' in goog.global) src code is here https://github.com/StankovicMarko/producer and i've used this steps to generate apk https://github.com/StankovicMarko/producer#tips Does anyone have any insights? Btw app works on emulator perfectly

Jp Soares19:04:44

I would like some help to use cljs.analyzer in cljs. I can find good online resources for clojure but not clojurescript. My goal is to walk through the AST of all functions of a namespace. Would be nice to be able to use tools.analyzer.ast.query as I've seen Nicola Mometto mentioning that it's environment agnostic.