Skip to content

[browser] move loader JS code#124606

Draft
pavelsavara wants to merge 2 commits intodotnet:mainfrom
pavelsavara:move_browser_host
Draft

[browser] move loader JS code#124606
pavelsavara wants to merge 2 commits intodotnet:mainfrom
pavelsavara:move_browser_host

Conversation

@pavelsavara
Copy link
Member

Preparation for code reuse with Mono

@pavelsavara pavelsavara added this to the 11.0.0 milestone Feb 19, 2026
@pavelsavara pavelsavara requested a review from maraf February 19, 2026 17:17
@pavelsavara pavelsavara self-assigned this Feb 19, 2026
Copilot AI review requested due to automatic review settings February 19, 2026 17:17
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Feb 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Moves the browserhost loader/host JavaScript/TypeScript sources into src/native/libs/Common/JavaScript to enable reuse across runtime flavors (prepping for Mono), while updating the native build (Rollup + CMake/MSBuild wiring) to consume the new locations and pass runtime flavor information.

Changes:

  • Repoint Rollup inputs (dotnet loader + libBrowserHost) and generated .d.ts output paths to libs/Common/JavaScript/*.
  • Introduce RuntimeFlavor plumbed from MSBuild → CMake → Rollup environment for flavor-aware bundling.
  • Add the relocated loader/host source set under src/native/libs/Common/JavaScript/{loader,host} and update internal imports accordingly.

Reviewed changes

Copilot reviewed 15 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/native/rollup.config.js Updates Rollup inputs to new Common/JavaScript paths; imports runtimeFlavor.
src/native/rollup.config.defines.js Adds runtimeFlavor env define and logs it; exposes it to consts plugin.
src/native/package.json Updates local rollup scripts to pass RuntimeFlavor.
src/native/libs/Common/JavaScript/types/exchange.ts Rewrites type-only imports to new relative loader/host paths.
src/native/libs/Common/JavaScript/loader/types.ts Re-exports shared public types for loader.
src/native/libs/Common/JavaScript/loader/run.ts Adds relocated runtime creation/startup orchestration.
src/native/libs/Common/JavaScript/loader/promise-completion-source.ts Adds relocated promise completion source utilities.
src/native/libs/Common/JavaScript/loader/polyfills.ts Adds relocated polyfills (fetch/fs/url/crypto/perf).
src/native/libs/Common/JavaScript/loader/per-module.ts Adjusts re-export path for per-module constants.
src/native/libs/Common/JavaScript/loader/logging.ts Adds relocated logging + exception normalization.
src/native/libs/Common/JavaScript/loader/lib-initializers.ts Adds loader entrypoint for library initializers (currently stubbed).
src/native/libs/Common/JavaScript/loader/index.ts Sets up dotnetInitializeModule and wires loader exports/tables.
src/native/libs/Common/JavaScript/loader/icu.ts Adds ICU resource selection logic (missing standard header).
src/native/libs/Common/JavaScript/loader/host-builder.ts Adds HostBuilder for configuring/starting/running runtime.
src/native/libs/Common/JavaScript/loader/exit.ts Adds runtime exit handling and integration with Emscripten hooks.
src/native/libs/Common/JavaScript/loader/dotnet.ts New root ES module for dotnet.js with top-level init and exports.
src/native/libs/Common/JavaScript/loader/dotnet.d.ts Generated type surface now located under Common/JavaScript/loader.
src/native/libs/Common/JavaScript/loader/cross-module.ts Adjusts re-export path for cross-module exchange.
src/native/libs/Common/JavaScript/loader/config.ts Adds loader config normalization/merge/validation logic.
src/native/libs/Common/JavaScript/loader/bootstrap.ts Adds WASM feature checks and locateFile helpers.
src/native/libs/Common/JavaScript/loader/assets.ts Adds relocated asset/module loading, throttling, and fetch logic.
src/native/libs/Common/JavaScript/host/types.ts Re-exports shared public types for host.
src/native/libs/Common/JavaScript/host/per-module.ts Adjusts re-export path for per-module constants.
src/native/libs/Common/JavaScript/host/index.ts Updates ems-ambient import path for host module.
src/native/libs/Common/JavaScript/host/host.ts Updates imports to shared Common/JavaScript paths.
src/native/libs/Common/JavaScript/host/cross-module.ts Adjusts re-export path for cross-module exchange.
src/native/libs/Common/JavaScript/host/assets.ts Updates imports to shared Common/JavaScript paths.
src/native/libs/Common/JavaScript/CMakeLists.txt Switches Rollup TS source list to new Common/JavaScript sources; passes runtime flavor; CoreCLR-only outputs for libBrowserHost.
src/native/.eslintignore Updates ignored generated .d.ts path to new location.
eng/native.wasm.targets Passes -DCMAKE_BUILD_RUNTIME_FLAVOR=$(RuntimeFlavor) into native CMake args.
.gitattributes Updates LF normalization entry for moved dotnet.d.ts.

@dotnet-policy-service
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments