-
Notifications
You must be signed in to change notification settings - Fork 214
Use dart2wasm
support-detection scripts
#3845
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
Use dart2wasm
support-detection scripts
#3845
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A few comments.
I'll be the main person working on build_runner
for a while, I'm focused on performance first but will also need to learn all the other things :) ... hopefully my comments make some kind of sense ;)
if (loaderExtension == null || wasmCompiler == null) { | ||
if (loaderExtension == null || | ||
wasmCompiler == null || | ||
dart2WasmResult == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it will now do nothing in cases where previously it might have done something? When dart2WasmResult
is null and the others are not null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add context here: When we're compiling with both dart2js
and dart2wasm
, we don't let dart2js
emit a .dart.js
file like normally but instead make it .dart2js.js
.
Then, we emit our own .dart.js
loader file that includes this check to determine whether we use the program emitted by dart2js
or the module emitted by dart2wasm
. This script is necessary whenever dart2wasm
is enabled because that compiler doesn't emit a ready entrypoint but rather just a JS module bundle that can't be added to a <script>
tag directly.
There's an issue in the current logic when one (but not both) of the compilers fail to compile a program. We don't currently react to this and will try to load scripts that don't exist. This additional check doesn't fix that properly though, I've reverted them (maybe something for a different PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good, thanks.
Will wait to see if anyone from the US side wants to review as well.
Unrelated, we have a discussion section now, it might be useful for more general discussion about the work / direction.
if (loaderExtension == null || wasmCompiler == null) { | ||
if (loaderExtension == null || | ||
wasmCompiler == null || | ||
dart2WasmResult == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks :)
There is some issue with CI that I'm trying to fix, as part of it it seems there might already be a failure in this code on Windows, any ideas please? https://github.com/dart-lang/build/actions/runs/13284718347/job/37090779528?pr=3851 |
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. |
Was that the first time it has failed or has this been broken for a while? It looks like |
It's the first time I've seen it. Possibly it's caused by an SDK change; there was a new "unused element" warning for But it could also be that the CI has not been working smoothly. I think the next thing to try is to repro with different SDK versions, I'll try to get to that today/tomorrow. |
Dusting off my Windows VM now, let's see if I can figure it out :) |
Yes it's due to an SDK change: I can repro on |
Looks like https://dart-review.googlesource.com/c/sdk/+/397721 is probably the cause as it's the only dart2wasm commit in the range; I'll try to verify. |
Hmm actually let me pin the SDK version so we can have working CI and get unstuck #3856 |
Please merge in #3856 so we get a good CI run, then let's land this--thanks for your patience! |
How are we handling older SDKs that DON'T have the feature? We're not bumping the min SDK |
It just falls back to the existing behaviour. |
@simolus3 it turns out I can merge in the CI fix :) and it passes. So I'll merge this now. I wanted to get it in before my #3854 because that's relatively disruptive. I have no idea how this usually works--does it make sense for me to release |
@simolus3 – you're a MACHINE! Thanks! |
FYI @mkustermann 😄 |
Thanks for your help getting this merged!
I actually don't know what the typical workflow is, but since the SDK change is very recent and won't land in stable for a while, I think it's fine to not bother with a release right now. |
Noted, thanks. Feel free to ping me any time you feel a release is overdue. |
Are the |
Hmmm yes it does need the
Thanks. |
Oh ... but actually it's only a dev dependency, I think it should work fine to release. Let me try it :) |
@simolus3 I think that worked :) |
Unfortunately it looks like the publishing action might be broken :( I don't see the version on pub.dev either. edit Aaand it got fixed the millisecond I wrote that comment. Thanks! |
Coincidentally I checked and someone helped me make it actually publish, so, yup, now I think it worked ;) thanks! |
dart2wasm
started emitting a.support.js
file which contains a JavaScript expression evaluating totrue
if the browser supports the WebAssembly module emitted bydart2wasm
: dart-lang/sdk#59951.With this PR, we start reading that file and use that as a feature detection if available.