Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 23 06:34
    @sjrd banned @Rebeka58_gitlab
  • Jun 08 2020 20:43
    @sjrd banned @sw7240614
  • Sep 29 2019 08:35
    @sjrd banned @8bitpitRBX_twitter
  • May 23 2019 13:44
    @sjrd banned @BIGCRYPTO001_gitlab
  • May 01 2019 14:31
    @sjrd banned @Certificates1_gitlab
  • Apr 22 2019 15:31
    @sjrd banned @lerbatax
  • Jan 31 2019 23:04
    sjrd commented #3555
  • Jan 31 2019 22:56
    sjrd review_requested #3555
  • Jan 31 2019 22:56
    sjrd opened #3555
  • Jan 31 2019 21:06

    sjrd on 0.6.x

    Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)

  • Jan 31 2019 21:06
    sjrd closed #3554
  • Jan 31 2019 20:54
    erikvanoosten commented #2665
  • Jan 31 2019 16:33
    sjrd commented #3538
  • Jan 31 2019 15:54

    sjrd on master

    Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3552
  • Jan 31 2019 15:54

    sjrd on master

    Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3553
  • Jan 31 2019 15:33
    sjrd commented #2665
  • Jan 31 2019 15:30
    erikvanoosten commented #2665
  • Jan 31 2019 10:41
    sjrd review_requested #3554
Hanns Holger Rutz
@Sciss
/s/IdentityMap/IdentityHashMap/g
Ok. So could I just split the source, and juse j.u.IdentityHashMap on JVM and js.Map on JS, and they'd have the same semantics for insertion and look-up?
and is js.Map#size constant time operation?
Hanns Holger Rutz
@Sciss
I wish there was a type common to JVM and JS
Ah silly me, that type j.u.IdentityHashMap exists, I just had it mispelled. https://scastie.scala-lang.org/gD76eBmIScuUlwWHrnkjDw
Daniel Neades
@djneades

Having upgraded to ScalaJS 1.4.0, my previously working Sbt 1.4.6 project now falls over at the link stage:

[error] (Compile / fastLinkJS) java.lang.IllegalArgumentException: cannot generate a zero for NothingType

Any ideas?

I should mention that I am using the latest Dotty nightly.

6 replies
aappddeevv
@aappddeevv

1.4 looks great. Everything compiled cleanly for me for multiple existing projects.

Is there a dynamic module loading client+server example (all on js)?

aappddeevv
@aappddeevv
It would be cool to toss in that new reactjs server-side rendering thing if it can work with scala.js.
Jeff Lewis
@lewisjkl
Hey all! Anyone here have experience using TailwindCSS inside of a ScalaJS project? Curious if someone has experience with it since it seems a little tricky to get postcss, purge, autoprefixer, etc in place
Iurii Malchenko
@yurique

@lewisjkl I’m using it heavily. A while ago I even made a purgecss plugin that would analyze the javascript generated by Scala.js, but since then tailwindcss got built-in support for purging and now it just works.

(I’m not using the scalajs-bundler, though – I manage the webpack config manually.)

Iurii Malchenko
@yurique
Does anyone know if there's a test framework available for Scala.js+Scala-3m3? utest seems to be published for 3m3 but jvm only
Sébastien Doeraene
@sjrd
JUnit, of course.
Always there, everywhere. :)
Also maybe MUnit.
Anton Sviridov
@keynmol
@yurique weaver-test is :P
Iurii Malchenko
@yurique
hmm, will JUnit work in scala.js world? :)
weaver-test looks interesting :+1:
Anton Sviridov
@keynmol

used it to test laminar code with dom and cross-built code with node.js.

Need to upgrade it to 1.4.0 and see how things look.

Sébastien Doeraene
@sjrd

hmm, will JUnit work in scala.js world? :)

Yes, it does. enablePlugins(ScalaJSUnitPlugin) on your JS project. That's what we use for Scala.js' own test suite, so it will always be there.

Iurii Malchenko
@yurique

how nice! Thanks Sébastien!

@keynmol weaver artifacts are weird. In the sjs jar there are only *.sjsir files, and IDEA can’t resolve a single class in the weaver package.

Anton Sviridov
@keynmol

Huh, funny that both maintainers don't use IDEA :)

Our publishing is nothing special, we use sbt-projectmatrix and don't set up any settings on SJS publishing.

Should we?

Sébastien Doeraene
@sjrd
There should be nothing special to do, but you should definitely have .class files in the jar. Otherwise they're unusable, even just from the compiler, never mind IDEs.
Anton Sviridov
@keynmol

hm. That's very strange - I do have a public repo using this framework on SJS which builds with GH actions.

@yurique I'll take a look at 3.x artifacts to see if there's anything wrong with them

Iurii Malchenko
@yurique
So another bit here: the jvm jar looks empty O_o
image.png
  libraryDependencies ++= Seq(
    "com.disneystreaming" %%% "weaver-core" % "0.6.0-M5" % Test
  )
I might be doing something wrong, I suppose.
Anton Sviridov
@keynmol

o_O ok I wonder if something on sonatype went wrong - I'll check the jars, but we can move this to https://gitter.im/disneystreaming/weaver-test room if you see this weirdness even in jvm jars.

M4 was definitely fine, M5 was released today, no idea what happened

Eric K Richardson
@ekrich
@sjrd JUnit even looks better now that the new version of Scala Native will have it too :smile:
Anton Sviridov
@keynmol
(update: 'twas indeed a IDEA issue with 3.0.0-M3 specifically, the jars contain .class, .sjsir and .tasty files)
Iurii Malchenko
@yurique

JUnit works like a charm.

For anyone following, here’s how to enable it:

.enablePlugins(ScalaJSJUnitPlugin)

(there was a J missing before the Unit — doesn’t work that way =) )

I was too soon, when I ran the tests with ++3.0.0-M3, this happened:

Error while loading test class app.tulz.tuplez.TupleCompositionTests failed: java.lang.ClassNotFoundException: Cannot find app.tulz.tuplez.TupleCompositionTests$scalajs$junit$bootstrapper$,

(tests ran successfully for 2.13 and 2.12)

though I’m getting this message for both JS and JVM with 3.0.0-M3
Iurii Malchenko
@yurique
I take the last one back – I had the ScalaJSJUnitPlugin enabled for the jvm project as well. Now, I removed it and
jvm+3.0.0-M3: tests run
js+3.0.0-M3+ScalaJSJUnitPlugin: tests won’t run, with the above error
Iurii Malchenko
@yurique

oh boy, so this all came from me adding a check for scala version when setting the scalacOptions and putting this into the build.sbt:

  scalacOptions := (CrossVersion.partialVersion(scalaVersion.value) match { … }

:= instead of ++= 🤦

Jeff Lewis
@lewisjkl
@yurique re: tailwind do you have any examples on hand that I could look at? Also any reason specific why you choose webpack directly rather than using ScalaJS bundler?
And thanks for the response :)
Iurii Malchenko
@yurique

@lewisjkl as for not using the bundler – it was quite a while ago, I can barely remember… maybe I couldn’t customize something I wanted to, or something like that, and found it easier back then to handle webpack manually.

Also, as of now I like it better this way: running ~fastLinkJS in one terminal and webpack serve in another :) (thinking to try the snowpack)

I’ve made this g8 template a while ago (it’s a bit outdated – it's on my TODO, but the tailwind stuff has barely changed since then): https://github.com/yurique/scala-js-laminar-starter.g8

Jeff Lewis
@lewisjkl
Thanks for the info and the g8! I used snowpack on my last front end and it was pretty awesome. Definitely a rougher road to travel since there are less resources when something goes wrong. Cool stuff though and excited for Snowpack 3
Jack Koenig
@jackkoenig
Can Scalac or the Scala 3 compiler themselves be compiled with ScalaJS?
I'm imagining something like ScalaFiddle that runs completely in your browser
Sébastien Doeraene
@sjrd
No, they can't. They rely too much on JVM-only stuff like synchronous file access and Java libraries.
Michael Pilquist
@mpilquist

I'm running in to some issues when upgrading FS2 to sjs 1.4.0. Some are self inflicted due to use of .isInstanceOf[Int], which I've fixed. However now I'm seeing runtime exceptions like this:

Exception: scala.scalajs.js.JavaScriptException: TypeError: dest.u.set is not a function

Looking in the compiled js, I see:

$ac_I.prototype.copyTo = (function(srcPos, dest, destPos, length) {
  $arraycopyCheckBounds(this.u.length, srcPos, dest.u.length, destPos, length);
  dest.u.set(this.u.subarray(srcPos, ((srcPos + length) | 0)), destPos)
});
Sébastien Doeraene
@sjrd
Hum, you may be running into a bug in the new Array encoding.
That method you see is used for System.arraycopy calls. It seems dest might not be an Array value.
It could be our fault, but it could also be on your side if you call System.arraycopy with a 3rd parameter than is not an Array value.
Michael Pilquist
@mpilquist
thanks, I definitely have some System.arraycopy calls, I'll poke around there
stuff like:
def copyToArray[O2 >: O](xs: Array[O2], start: Int): Unit =
      if (xs.isInstanceOf[Array[AnyRef]])
        System.arraycopy(values, offset, xs, start, length)
      else {
        values.iterator.slice(offset, offset + length).copyToArray(xs, start)
        ()
      }
repeat for each primitive type -- guessing one of those isInstanceOf calls changed behavior
Sébastien Doeraene
@sjrd
They shouldn't have. If they have, that's a bug on our side.