Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 29 08:35
    @sjrd banned @8bitpitRBX_twitter
  • May 23 13:44
    @sjrd banned @BIGCRYPTO001_gitlab
  • May 01 14:31
    @sjrd banned @Certificates1_gitlab
  • Apr 22 15:31
    @sjrd banned @lerbatax
  • Jan 31 23:04
    sjrd commented #3555
  • Jan 31 22:56
    sjrd review_requested #3555
  • Jan 31 22:56
    sjrd opened #3555
  • Jan 31 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 21:06
    sjrd closed #3554
  • Jan 31 20:54
    erikvanoosten commented #2665
  • Jan 31 16:33
    sjrd commented #3538
  • Jan 31 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 15:54
    sjrd closed #3552
  • Jan 31 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 15:54
    sjrd closed #3553
  • Jan 31 15:33
    sjrd commented #2665
  • Jan 31 15:30
    erikvanoosten commented #2665
  • Jan 31 10:41
    sjrd review_requested #3554
  • Jan 31 10:41
    sjrd opened #3554
  • Jan 31 10:05
    gzm0 synchronize #3552
Sébastien Doeraene
@sjrd
Or with sbt's new style: Compile / fastOptJS / artifactPath := ...
The Compile is important to specify the appropriate configuration. The Test configuration uses a different file/artifact name.
:P
Sébastien Doeraene
@sjrd
Ah ah :p
Matt Hughes
@matthughes
The dead tree shaker in ScalaJS is done in the fastOptJS stage right? Would there be any way to make that print out all the dead code it dropped in a certain package?
I would love similar functionality in server-side apps where I could annotate various entrypoints to my code (Main / http routes) and run some analyzer that spit out all the unreachable code.
Sébastien Doeraene
@sjrd
There's no built-in option to do that. You'd probably have to introduce it and build a local version to doing that.
Matt Hughes
@matthughes
Is that code based on the sjs format or class format? Just wondering how complex it would be to tease apart those depencies and use that existing code for a standalone SBT plugin that would report unused code.
Sébastien Doeraene
@sjrd
It's based on the sjsir format.
If you want something for the JVM, start looking at sbt-missinglink.
Matt Hughes
@matthughes
thx
Brian P. Holt
@bpholt

It looks like exporting an object under a namespace (x.y.myObject) is deprecated when done via @JSExportTopLevel. Is there a workaround in 1.0 if that's really what I want to do?

(For context, I'm writing an AWS Lambda function that will be deployable via either JVM or JS. It'd be nice to have a common entrypoint for both platforms… com.bpholt.my.great.Function should theoretically work, if supported, I think?)

Sébastien Doeraene
@sjrd
@bpholt There is a workaround (or rather, the right way to do it) in the release notes of 0.6.26 which introduced the deprecation: https://www.scala-js.org/news/2018/11/29/announcing-scalajs-0.6.26/
Brian P. Holt
@bpholt
Thanks @sjrd, I will have a look!
Josef
@Josef-Vonasek
I threw an exception from scala and in JS it manifested with : uncaught exception: Object.
Why doesn't javascript also print the exception message?
Sébastien Doeraene
@sjrd
Because Scala's Throwables are not true subclasses or JavaScript's Error.
Some engines display them well, some don't.
This is all fixed in Scala.js 1.x.
Josef
@Josef-Vonasek
Why this doesn't work?
window.__ScalaJSEnv = { global: window };

export * from "/scala-es-module.js";
I still end up with TypeError: $g is undefined
Sébastien Doeraene
@sjrd
Because with that code, the contents of scala-es-module.js will be evaluated before the contents of that snippet are executed, and in particular before window.__ScalaJSEnv is assigned. This is due to how ES modules are evaluated: all their dependencies are evaluated before the module's code starts to execute.
Josef
@Josef-Vonasek
Makes sense. I suppose there is no workaround then, apart from using html or editing the scala module directly.
Sébastien Doeraene
@sjrd
Probably not, no.
FWIW that also is fixed in Scala.js 1.x.
Josef
@Josef-Vonasek
I know, but I depend on circe, which is compatiable with scalajs 0.6
¤ Robert Walker ¤
@WalkingOlof_twitter
Hi guys, I'm resurrecting an old ScalaJS project of mine and while updating to 1.0.0-RC1 I see that the compiler complains that not found: value packageScalaJSLauncher , has this task changed name again ?
Sébastien Doeraene
@sjrd
What version are you upgrading from?
¤ Robert Walker ¤
@WalkingOlof_twitter
0.6.26
Sébastien Doeraene
@sjrd
packageScalaJSLauncher has been deprecated for a very long time. You should already use its replacement scalaJSUseMainModuleInitializer := true in 0.6.26.
You should also upgrade to 0.6.31 and address all deprecation warnings, including in the build itself, before jumping to 1.0.0-RC1, as recommended by the release notes.
¤ Robert Walker ¤
@WalkingOlof_twitter
@sjrd Thank you, I'll do that stepwise upgrade!
Also, Scala.JS is such an amazing project, thanks!!!!
Sébastien Doeraene
@sjrd
Thanks :)
¤ Robert Walker ¤
@WalkingOlof_twitter
@sjrd one more question if you have a minute, how would you copy resource files in 1.0.0-RC1, I saw this answer on SO, but that cant work right? https://stackoverflow.com/questions/35958078/how-can-i-copy-scala-js-source-maps-using-resourcegenerators/35959137#35959137
Sébastien Doeraene
@sjrd
Just remove/ignore f2 and f3 from that answer. They are not relevant anymore.
¤ Robert Walker ¤
@WalkingOlof_twitter
ok
Thanks!
Mariano Gappa
@marianogappa

Hey guys, has anyone figured out how to make npm packages out of scala.js cross builds? @sjrd recommended me to ask here for help on this Github issue for my project: marianogappa/ostinato#9

Ostinato is the only chess library written in Scala that works in the browser (http://marianogappa.github.io/ostinato-examples/convert.html) and it's quite successful. Would anyone be able to help me make it approachable to the JS community? Cheers :)

brinklec
@brinklec
Hello, I'm a senior back end developer/architect, doing pure scala about 2 years now, close to deploying a large typeclass-based API, interested in scala.js. I have major dependency on doobie, which seems to have no scala.js branch. My typeclasses use doobie types at both abstract and instance level. Can these be integrated in some reasonable way with typeclass-driven scala.js components indexed by the same set of case classes, or is this a nonstarter?
brinklec
@brinklec
I'm assuming my original dream of having server API calls directly executed from the client is unrealizable with no scala.js port for the main library used by the server API. Would be delighted to be wrong, but mainly hoping to understand if there is middle ground between that and the other extreme of having the types that index the typeclasses be the only cross-compiled content.
Li Haoyi
@lihaoyi
@marianogappa haha for Sjsonnet I just give people a raw .js file and let people figure out how to use it themselves...
I figure enough web folks have had experience with old-school script tag dependency management that it shouldn’t be a shock to anyone
Martijn Hoekstra
@martijnhoekstra
@brinklec do I understand correctly that you want the JS engine in the browser connect to some SQL server? That's going to be a pipedream I'm afraid. JS in the browser doesn't have the raw networking capability required to do that
brinklec
@brinklec

@martijnhoekstra Thanks for confirming that suspicion. I never did serious work with JS before, just knew there was a huge ecosystem out there and hoped I could leverage from the scala side. For other purposes I'll need to add a REST API over the scala DB API anyway, so I can reuse that.

Anyone, the other part of my question has to do with refactoring of current scala typeclasses for integration/allocation across scala and scala.js for a coherent typeclass-based architecture. I would like to use scala.js typeclasses to drive a generic lightweight browser/editor for tabular data from my API. I think can move non-DB-oriented elements to separate typeclasses over the same set of non-DB-oriented types, make those shared, and keep the DB-oriented elements scala only. Are there any special potential issues or helps with such an approach that I should be aware of? Many thanks!

ritschwumm
@ritschwumm
@brinklec i wouldn't want database-related code on the client anyway...
Domas Poliakas
@disblader
Hello, in js you can do new Date() - new Date(), but in scala.js the Date does not have a - member; is there a way to do subtraction like in the first expression?
Sébastien Doeraene
@sjrd
Sure, you can just explicitly call .getTime() on both dates, as in date1.getTime() - date2.getTime() instead of date1 - date2. This is what JavaScript's - between Dates does behind the scenes.
Domas Poliakas
@disblader
Ah, I see, thanks