-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Remap es imports - help needed... #882
Conversation
I suspect, that I may need to armans remap dep here; But I have no idea, how... |
To add the deps you would need to add them here https://github.com/scalameta/mdoc/blob/main/mdoc-sbt/src/main/scala/mdoc/MdocPlugin.scala#L165 Though ideally can we inline the code instead of depending on a separate libary? |
Oooooh - Thankyou! I haven't yet tested it but it looks like that's the hint I needed. Hopefully I can look tomorrow.
The obvious downside of inlining the code, is that I would doubt I'm capable of maintaining or probably, understanding it... so I'd personally take advantage of the library approach. However... ... you and Arman are on a different skill level to myself :-), and if your view is inlining makes maintenance easier I'll try and do it ... it wasn't much code when I looked, but it's obviously then in two places. |
Maybe inlining is not necessary, it just felt that we didn't have any external deps before, so this could be problematic, but on the other maybe not. We can come back to it later |
Hmmm - is this for the SBT plugin? I was hoping to be able to do this out of the CLI... my understanding is that the SBT plugin is then built on top of that? |
I am pretty sure this would need to be added via option |
Wait, isn't it explained here actually https://scalameta.org/mdoc/docs/js.html#command-line <- looks like you need a properties file populated beforehand |
Yes, this was my original angle of attack;
The problem seems to be twofold - I can't get any logging information out of ScalaJsWorker. Hence, trying to get it working in context which is introspectable in the IDE... somehow! |
So I've figured out, that something is creating an mdoc.properties file as a resource that the tests are consuming. And that's how it all hangs together. As that file doesn't include the remap dep, I'm now increasingly sure that why I'm struggling. Can't figure out what is creating that file though, so some work still to do. |
Okay, I think I finally understand. Your original note on the MdocPlugin, was (predicatably) correct. I would say that I find the dependance confusing however - the sbt plugin itself depends on the CLI. So I had assumed the CLI was upstream of it. However, the CLI tests depend on correct configuration of the sbt plugin. The SBT plugin generates an This may not be how I would have chosen to structure things - it was not intuitive for me. Having understood that though, I think I can proceed. Apologies for the noise. |
Although I think this does have a compatibility implication actually - Although the API surface wouldn't change and this could appear binary compatible, someone using the CLI on "new mdoc" published with this functionality would almost certainly get unintelligible errors without updating their An SBT user would be fine to upgrade though. Awkward - to be discussed later. Ah - and now we're back to your "inline the code" suggestion. |
I've inlined that code, and I'm stuck with this on a publish local;
I think I'm going to have to down tools on this - my biggest problem is the way that mdoc configures the both CLI and its settings file, which it assumes has a fixed name and is on the class path. This combination is hard to work with. Time to take a step back. |
Looks like maybe a Scala JS version mismatch? |
This was the command used to generate the class paths;
|
I cannot for the life of me figure out, how "mdoc.properties" is getting on the class path. I can see where it's generated, and I've generated a second properties file in exactly the same place, but apparently, that one isn't on the class path. |
This is a currently messy branch which aims to remap ESmodule imports at link time.
It feels quite close to doing what I want (not near ready for merging, lots of mess atm). Unfortunately, I'm stuck. It compiles, but doesn't work, sadly. The extra test I wanted for the CLI, fails with this message
If I publish local, then I can't get any information (logs, printings etc are ignored) out of the
ScalaJSWorker
- I suspect it may be failing with a similar problem but not telling me.I've added the key dependancy
"com.armanbilge" %%% "scalajs-importmap" % "0.1.1" cross CrossVersion.for3Use2_13
to the build definition, so I'm afraid I'm stumped on why it compiles, but doesn't seem to then have the right classpath.@tgodzik Would you happen to have a clue / hint what could be happening ?