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
Sébastien Doeraene
@sjrd
Not as a language feature, no, because ECMAScript modules have no language feature to do that.
This is a CommonJS-specific thing. If you emit a CommonJS module, nothing prevents you from writing the same kind of code in your main method:
js.Dynamic.global.module.exports = { (foo: Int, bar: Int) => foo + bar }
Alex Habich
@alex5nader
Thanks a bunch! That worked perfectly.
Tobias Schlatter
@gzm0
Isn't what @alex5nader is looking for just a default export?
Hah, I never realized that :) We do have a compatibility feature for default imports, but not for exports :)
Sébastien Doeraene
@sjrd
We have a compatibility mode for imports because that's what Node does in an ECMAScript module when we import a CommonJS module.
But even Node doesn't offer a way for an ECMAScript module to export as module.exports.
Tobias Schlatter
@gzm0
Ah, ah, of course :)
Yuriy Yarosh
@yuriy-yarosh

o/

So, I've been looking for a way to separate my scala.js deps with %%% into a separate file.
How to import %%% operator from PlatformDepsGroupID to be used in a Dependencies.scala file ?

Matt Hicks
@darkfrog26
are there any post fullLinkJS steps to minify the JavaScript files further?
or perhaps something to reduce the amount of JS generated?
My JS file is 2.5 meg and I'm trying to reduce it
Sébastien Doeraene
@sjrd
Ouch.
No, after fullLinkJS there's nothing more you can do. It's already gone through dce, optimizations, re-dce, and minification.
Matt Hicks
@darkfrog26
To be fair, it's a fairly large client application (https://app.courio.com)
Sébastien Doeraene
@sjrd
If not all of the code is necessary at startup, then perhaps the dynamic module loading feature we just released in 1.4.0 can help you.
Matt Hicks
@darkfrog26
yeah, I just changed to using Link instead of Opt, but have I haven't modularized it yet
is there any way to see what is taking up space in my resulting JS file so I could perhaps trim it further?
Sébastien Doeraene
@sjrd
There isn't anything built-in.
Matt Hicks
@darkfrog26
that would be a useful tool
Sébastien Doeraene
@sjrd
On the fullOpt output it's difficult to judge, but it's possible to script something on the fastOpt .js file.
Identifying all the function $c_ at the beginning of lines will give you the starting offset of each class, which can be a clue.
Matt Hicks
@darkfrog26
what's currently in production is 3.9 meg, so I've already trimmed the size down quite a bit. ;)
nafg
@nafg
@yuriy-yarosh I use import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
Jason Pickens
@steinybot
What is the source virtualfile:%3Cmacro%3E which is appearing in my source map? Is that something coming from Zinc?
Nikita Gazarov
@raquo

is there any way to see what is taking up space in my resulting JS file so I could perhaps trim it further?

@darkfrog26 Yes, you can use https://www.npmjs.com/package/source-map-explorer to see how much individual scala classes contribute to your bundle size, it works with scala.js-produced bundles just as well. Example output

Nikita Gazarov
@raquo
You can definitely find some stuff to trim that way. For example in my personal scala.js app codebase a nontrivial amount of space is used by macro-generated json codecs. I could shave off 100KB+ if I solved that. Then there's stuff like including huge sets of svg icons, localizations, etc. when using only a few; this tool will help uncover these kinds of issues too.
aappddeevv
@aappddeevv
There is also https://www.npmjs.com/package/webpack-bundle-analyzer if you use webpack.
Anton Sviridov
@keynmol
@raquo do you need any special flags to run it on Scala.js bundles? I've tested three projects and I always get variations of
➜  laminar-static-gh-pages git:(master) source-map-explorer target/scala-2.13/laminar-static-fastopt/main.js
target/scala-2.13/laminar-static-fastopt/main.js
  Your source map refers to generated column 39 on line 363, but the source only contains 38 column(s) on that line.
  Check that you are using the correct source map.
Eric K Richardson
@ekrich
When porting java.time to Scala.js 3.0.0-M3 I ran into the fact that in Scala I can't call an enums static method values() with the parens. I am not sure this is correct based on the fact that I get warning in 2.13. Discussion is here - https://gitter.im/lampepfl/dotty
Carlos Quiroz
@cquiroz
On scala-java-time I have a separate version of the enums for scala 3.0
Eric K Richardson
@ekrich
Yes, me too. I put in a ticket. lampepfl/dotty#11248 This is important that they are defined the same because in sconfig I use "provided" so that the end user can pick the java.time API of their choosing.
@cquiroz :point_up:
Eric K Richardson
@ekrich
Sorry, I don't think that will matter because we link against the JDK - I think I got it right this time because Denys and Seb have told me this many times.
Eric K Richardson
@ekrich

This works in Scastie but doesn't when compiled for Scala.js
https://scastie.scala-lang.org/ekrich/utZ047bZRqG48UlVscnbyw/3
When compiling I get the following:

[info] compiling 1 Scala source to /Users/eric/workspace/sjavatime/testSuite/native/target/scala-2.13/test-classes ...
[error] -- [E007] Type Mismatch Error: /Users/eric/workspace/sjavatime/testSuite/shared/src/test/scala/org/scalajs/testsuite/javalib/time/DurationTest.scala:31:9 
[error] 31 |    for (d: Duration <- samples) {
[error]    |         ^
[error]    |Found:    java.time.Duration => Unit
[error]    |Required: java.time.temporal.TemporalAmount => Unit
[error]    |
[error]    |One of the following imports might make progress towards fixing the problem:
[error]    |
[error]    |  import scalajs.js.Any.fromFunction1
[error]    |  import scalajs.js.ThisFunction.fromFunction1
[error]    |
[error] 32 |      assertEquals(d.getSeconds(), d.get(SECONDS))
[error] 33 |      assertEquals(d.getNano().toLong, d.get(NANOS))
[error] 34 |    }
[error] -- [E008] Not Found Error: /Users/eric/workspace/sjavatime/testSuite/shared/src/test/scala/org/scalajs/testsuite/javalib/time/DurationTest.scala:39:16 
[error] 39 |      assert(!d.isZero)
[error]    |              ^^^^^^^^
[error]    |       value isZero is not a member of java.time.temporal.TemporalAmount

I added the type ascription and then it shows me why it won't compile anyway - not the cause.

Nikita Gazarov
@raquo
@keynmol Apparently it only works in fullOpt, not fastOpt, for some reason, so do fullOptJS and then source-map-explorer target/scala-2.13/laminar-static-opt/main.js
Eric K Richardson
@ekrich
Hi JS developers, let me know if I need to put in an issue on the Scala.js side on the Dotty side for the above.
Sébastien Doeraene
@sjrd
No, it's the same code that handles JVM and JS.
Eric K Richardson
@ekrich
I ran the code in Scastie 3.0.0-M3 and I swear it worked.
Late here, I can followup later.
João Costa
@JD557
Say that I have an object from scala-js-dom and I want to call a method that's not implemented in the library. Can I just do .asInstanceOf[js.Dynamic] and call the method taht I need?
or is there a more idiomatic way?
Eric K Richardson
@ekrich
@sjrd I got it working with the additions in this commit - ekrich/sjavatime@989e798
Do you know of any reason why only 284 tests are run on 3.0.0-M3 vs 354 on all the other versions? I will dig in nut if you have an intuition that would be great.
Sébastien Doeraene
@sjrd
@JD557 Yes, you can.
@ekrich Are there, by any chance, @Test methods in traits?
vonchav
@voonchav_gitlab
Hiya, are webpackDevServerExtraArgs and webpackDevServerExtraArgs valid? I got an sbt warning saying "there are 4 keys that are not used by any other settings/tasks." Are there any new settings superseding these?