Fork me on GitHub
#lumo
<
2017-03-20
>
dominicm20:03:52

Does lumo/cljs do anything funny with nodejs? require('asciidoctor.js')() works. ((js/require "asciidoctor.js")) results in:

TypeError: Cannot assign to read only property 'length' of object '[object String]'

anmonteiro21:03:24

@dominicm hrm, does it work in normal CLJS?

dominicm21:03:41

¯\(ツ)

dominicm21:03:46

@anmonteiro How do I check? 🙂

anmonteiro21:03:02

compile your code in the JVM compiler

anmonteiro21:03:06

with :target :nodejs

anmonteiro21:03:46

I can try it later, might even be a compiler bug

dominicm21:03:58

@anmonteiro Is it okay to use mies?

dominicm21:03:32

I was under the impression it was the preferred debug repo

anmonteiro21:03:09

(ns example.core
  (:require [cljs.nodejs :as node]))

(node/enable-util-print!)

((node/require "asciidoctor.js"))

anmonteiro21:03:20

^ that should repro it

moxaj21:03:40

@anmonteiro it seems to me that Visual Studio 2015 is required to build lumo

moxaj21:03:44

could you confirm this suspicion?

anmonteiro21:03:06

that really depends on what Node.js needs

anmonteiro21:03:16

you may wanna check their repo

moxaj21:03:46

I did, they need studio or c++ build tools; just wanted to hear your thoughts, maybe I'm doing something wrong

anmonteiro21:03:03

You need to have Microsoft Visual Studio 2013/2015 (Express edition is fine) as well as Python 2.7. Openssl is not required. Make sure that python is in your PATH.

dominicm21:03:47

@anmonteiro seems to work with mies & nodejs. Works for both advanced/simple builds.

anmonteiro21:03:29

@dominicm last thing to test out would be the self-hosted compiler

anmonteiro21:03:51

in a CLJS Node REPL

moxaj22:03:22

@anmonteiro wanted to dig into the commonjs stuff, but my visual studio is messed up somehow, so can't build my own lumo. However, google-closure-compiler-js seems to support foreign libs the same way the JVM based one does - with a simple processCommonJsModules flag, so it's probably really simple to port

dominicm22:03:43

@anmonteiro 🐦 over my head. I'll do it if you tell me how 🙂

anmonteiro22:03:34

@dominicm something like this (not tested):

(require '[cljs.js :as cljs])

(def st (cljs/empty-state))

(cljs/eval-str st “((js/require \“asciidoctor.js\”))" nil {:eval js/eval} pr-str)

anmonteiro22:03:36

@dominicm just tried it and there seems to be a Lumo problem

anmonteiro22:03:40

can you open an issue?

anmonteiro22:03:19

seems to be related to the fact that asciidoctor is compiled from ruby through opal

anmonteiro22:03:38

Lumo (even more than Node) doesn’t like globals too much 🙂

anmonteiro22:03:03

also you get a different error after:

(def v8 (js/require “v8”))
(.setFlagsFromString v8 "--nouse_strict")

dominicm22:03:00

@anmonteiro just gone afk, will try to remember tomorrow