-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[wasm] dotnet.js modularization #38721
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
Conversation
c75d9df
to
ea7f1ae
Compare
cc @lewing |
947b7d5
to
aa2ce47
Compare
c180d9e
to
e9bf748
Compare
- updated createEmscriptenModuleInstance to use the new createDotnetRuntime() API - removed @types/emscripten type definitions - added src/Components/Web.JS/@types/dotnet temporarily, until we figure out how to pull this out of Microsoft.NETCore.App.Runtime.Mono.browser-wasm.7.0.0-dev.nupkg - fixed usages of addRunDependency, removeRunDependency - mapped System_Object and other types to MonoObject etc - global Module is no longer needed by runtime - therefore removed __wasmmodulecallback__ - removed few cwrap calls and replaced them with API usage
1229563
to
6ba858e
Compare
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.
LGTM from a build perspective, but it'd be good to get approval from someone on Blazor too
# Conflicts: # src/Components/Web.JS/dist/Release/blazor.server.js # src/Components/Web.JS/dist/Release/blazor.webview.js # src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts # src/Components/Web.JS/src/Platform/Platform.ts
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.
Looking good, some minor nits.
Tried resolving the merge conflicts, but I don't have perms to push onto your fork.
Thanks @pavelsavara - I think we're just about there! I added a couple of substantive comments about the new link modulepreload code, plus a bunch of trivial syntax tweak suggestions. Hope that's OK. Once that's resolved I think this can be merged! |
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
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.
Awesome, thanks so much for the updates!
Hello @SteveSandersonMS! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
There is some issue with IIS test, I think it's unrelated and it could be merged. |
Context
After dotnet.js was modularized, Blazor could start using the new API we expose.
This PR updates Blazor to use new API createDotnetRuntime()
The current default output of runtime is CommonJS module, which is at the same time backward compatible with .NET 6.0
globalThis.Module
style. In the future ES6 would be default module format. This change also makes Blazor future-compatible with ES6 runtime module.Changes
use dynamic
import
instead of HTML<script>
tag to load dotnetupdated
createEmscriptenModuleInstance
to use the newcreateDotnetRuntime()
APImade import of dotnet.js parallel with loading other assets.
added
src/Components/Web.JS/@types/dotnet
temporarily, until we figure out how to pull this out ofMicrosoft.NETCore.App.Runtime.Mono.browser-wasm.7.0.0-dev.nupkg
removed @types/emscripten type definitions
fixed usages of
addRunDependency
,removeRunDependency
mapped
System_Object
and other types toMonoObject
etcglobal
Module
is no longer needed by runtime__wasmmodulecallback__
because it's not ES6 yet
__onDotnetRuntimeLoaded
to get the API when the CJS module is loadedremoved few
cwrap
calls and replaced them with API usageImplemented DRI for dynamic import via link
modulepreload
Feedback
This is also opportunity for Blazor team to give feedback about the new API.
There are more samples of the API usage here dotnet/runtime#62292
Fixes #39283
Fixes: #36805