Skip to content
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

[browser] Migrate more Blazor features, prepare JavaScript API for Blazor cleanup #87959

Merged
merged 64 commits into from
Jul 13, 2023

Conversation

maraf
Copy link
Member

@maraf maraf commented Jun 23, 2023

Goal of this PR is to prepare everything needed to clean-up startup on Blazor side to the final shape.
Changes needs to be backward compatible with Blazor.

  • GlobalizationMode & ICUDataMode merged
    • Resulting type is string based enum
    • Contains separate values for different ICU modes ("all", "sharded", "custom" instead of "icu")
    • Value "auto" has been removed
  • Integrate library initializers
    • Allows for nuget packages to hook into application startup
    • Nuget package can contains files in name pattern *.lib.module.js in wwwroot
    • Such es6 modules are imported during startup
    • They can export various callbacks
      • On runtime side we call onRuntimeConfigLoaded(config: MonoConfig) and onRuntimeReady(api: RuntimeAPI)
      • On blazor side, beforeStart and afterStarted are called
    • Library initializers can be downloaded either right after config is loaded or before runtime ready promise resolved. By default boot json generator checks for content to see if library initializer must be downloaded earlier. This behavior can be overriden by putting library initializer in @(WasmLibraryInitializerOnRuntimeConfigLoaded) or @(WasmLibraryInitializerOnRuntimeReady)
    • Library initializers can invoked using invokeLibraryInitializers
  • New set of Wasm.Build.Tests using prepared wasm app
    • The purpose is to have a coded application and test behavior/interaction with it using playwright
    • Test lazy assembly loading
    • Test loading satellite assembly
    • Test library initializer
    • Test appsettings based on app environment
  • Run all Wasm.Build.Tests in specified namespace using XunitNamespace msbuild property
  • Set debug level in Wasm SDK apps
    • Use WasmDebugLevel to specify debug level (the same as WasmApp.targets)
    • Default values (when WasmDebugLevel is not set) for .NET >= 8.0
      • Build (debug) => debugBuild=true & debugLevel=-1 => -1
      • Build (release) => debugBuild=true & debugLevel=0 => 0
      • Publish (debug) => debugBuild=false & debugLevel=-1 => 0
      • Publish (release) => debugBuild=false & debugLevel=0 => 0
  • Fix resolving URL (config, library initializer) when baseURI contains query string

Finalize

  • Run Blazor E2E to verify no breaking changes

Contributes to #70762
Contributes to #87178

@maraf maraf added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels Jun 23, 2023
@maraf maraf added this to the 8.0.0 milestone Jun 23, 2023
@maraf maraf self-assigned this Jun 23, 2023
@ghost
Copy link

ghost commented Jun 23, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

TODO

  • Migrate lazy loading
  • Test lazy loading
  • Migrate satellite assemblies
  • Test satellite assemblies
  • Properly set debug build
  • Add alternatives to withStartupOptions
Author: maraf
Assignees: maraf
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript, os-browser

Milestone: 8.0.0

maraf added 16 commits June 23, 2023 12:23
# Conflicts:
#	src/mono/wasm/runtime/loader/blazor/_Integration.ts
#	src/mono/wasm/runtime/loader/config.ts
#	src/mono/wasm/runtime/types/internal.ts
- Integrate them in a single test app
- Create base class for such tests
 Default values (when WasmDebugLevel is not set)
 - Build   (debug)    => debugBuild=true  & debugLevel=-1 => -1
 - Build   (release)  => debugBuild=true  & debugLevel=0  => 0
 - Publish (debug)    => debugBuild=false & debugLevel=-1 => 0
 - Publish (release)  => debugBuild=false & debugLevel=0  => 0
# Conflicts:
#	src/mono/wasm/runtime/loader/blazor/_Integration.ts
Comment on lines +62 to +64
public ITaskItem[] LibraryInitializerOnRuntimeConfigLoaded { get; set; }

public ITaskItem[] LibraryInitializerOnRuntimeReady { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these? Add Paths to the name since these seem to be file paths.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these are file paths. Resources and Configs also don't have paths suffix.

@maraf
Copy link
Member Author

maraf commented Jul 13, 2023

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@maraf
Copy link
Member Author

maraf commented Jul 13, 2023

Failures are unrelated.

@maraf maraf merged commit acccc01 into dotnet:main Jul 13, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2023
@maraf maraf deleted the WasmSatelliteLazyLoad branch January 18, 2024 11:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants