Move JSInterop under Components - #69052
Conversation
|
Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at. |
1f4c2cf to
7582724
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The relocated JS object reference implementations call SetValue via Invoke/InvokeAsync using the value type as the expected return type, which can cause runtime deserialization failures for void SetValue calls.
Pull request overview
This PR relocates JSInterop (managed Microsoft.JSInterop and its JavaScript implementation) under the Components area to align ownership/build boundaries, while preserving existing NuGet and npm package outputs and updating repo wiring accordingly.
Changes:
- Moved
Microsoft.JSInteropsources/tests tosrc/Components/JSInteropand updated solution filters, build reference lists, and repo metadata to point at the new paths. - Moved the JS implementation into
src/Components/Web.JSand updated Web.JS sources/tests to import the local module instead of@microsoft/dotnet-js-interop. - Updated npm workspace/build output tracking for the relocated JSInterop workspace and adjusted Components web-assets reference conditions to allow opting out.
File summaries
| File | Description |
|---|---|
| src/Tools/Tools.slnf | Update JSInterop project path to relocated location. |
| src/Mvc/Mvc.slnf | Update JSInterop project path to relocated location. |
| src/Middleware/Middleware.slnf | Update JSInterop project path to relocated location. |
| src/JSInterop/startvs.cmd | Remove obsolete JSInterop VS launcher script. |
| src/JSInterop/Microsoft.JSInterop.JS/src/jest.config.mjs | Remove obsolete Jest config (JS moved). |
| src/JSInterop/Microsoft.JSInterop.JS/src/babel.config.js | Remove obsolete Babel config (JS moved). |
| src/JSInterop/Microsoft.JSInterop.JS/src/.eslintrc.json | Remove obsolete ESLint config (JS moved). |
| src/JSInterop/JSInterop.slnf | Remove obsolete solution filter (projects moved). |
| src/JSInterop/build.sh | Remove obsolete build wrapper (projects moved). |
| src/JSInterop/build.cmd | Remove obsolete build wrapper (projects moved). |
| src/Identity/Identity.slnf | Update JSInterop project path to relocated location. |
| src/Framework/Framework.slnf | Update JSInterop project path to relocated location. |
| src/Components/Web.JS/test/JSInterop/findObjectMember.test.ts | Update tests to import local JSInterop module. |
| src/Components/Web.JS/test/JSInterop/CallDispatcher.test.ts | Update tests to import local JSInterop module; tighten TS typing. |
| src/Components/Web.JS/src/Virtualize.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/StreamingInterop.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Services/NavigationManager.ts | Replace side-effect import with local JSInterop module import. |
| src/Components/Web.JS/src/Rendering/WebRendererInteropMethods.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Rendering/JSRootComponents.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Rendering/ElementReferenceCapture.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/JSInterop/index.ts | Add JSInterop package entry point that re-exports DotNet. |
| src/Components/Web.JS/src/DomWrapper.ts | Replace side-effect import with local JSInterop module import. |
| src/Components/Web.JS/src/Boot.WebView.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Boot.WebAssembly.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Boot.WebAssembly.Common.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Boot.Web.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/src/Boot.Server.ts | Switch from workspace dependency import to local module import. |
| src/Components/Web.JS/package.json | Remove @microsoft/dotnet-js-interop dependency from Web.JS package. |
| src/Components/Web.JS/JSInterop/tsconfig.json | Repoint TS build to Web.JS/src/JSInterop sources and adjust outputs. |
| src/Components/Web.JS/JSInterop/package.json | Update JSInterop workspace entry points to index and new homepage path. |
| src/Components/Web.JS/JSInterop/.gitignore | Add ignores for workspace-local node_modules and dist. |
| src/Components/JSInterop/test/xunit.runner.json | Add xUnit runner settings for relocated test project. |
| src/Components/JSInterop/test/TestJSRuntime.cs | Add test helper runtime for relocated tests. |
| src/Components/JSInterop/test/Microsoft.JSInterop.Tests.csproj | Opt tests out of Components web-assets reference. |
| src/Components/JSInterop/test/JSRuntimeUnionTests.cs | Add/relocate union round-trip tests for JSRuntime serialization options. |
| src/Components/JSInterop/test/JSRuntimeExtensionsTest.cs | Add/relocate tests for JSRuntime extension methods. |
| src/Components/JSInterop/test/JSObjectReferenceTest.cs | Add/relocate JS object reference behavior tests. |
| src/Components/JSInterop/test/JSInProcessRuntimeTest.cs | Add/relocate in-process runtime behavior tests. |
| src/Components/JSInterop/test/JSInProcessRuntimeExtensionsTest.cs | Add/relocate tests for in-process runtime extension methods. |
| src/Components/JSInterop/test/JSInProcessObjectReferenceExtensionsTest.cs | Add/relocate tests for in-process object reference extensions. |
| src/Components/JSInterop/test/Infrastructure/JSStreamReferenceJsonConverterTest.cs | Add/relocate converter tests. |
| src/Components/JSInterop/test/Infrastructure/JSObjectReferenceJsonConverterTest.cs | Add/relocate converter tests. |
| src/Components/JSInterop/test/Infrastructure/DotNetStreamReferenceJsonConverterTest.cs | Add/relocate converter tests. |
| src/Components/JSInterop/test/Infrastructure/DotNetObjectReferenceJsonConverterTest.cs | Add/relocate converter tests and type-info coverage. |
| src/Components/JSInterop/test/Infrastructure/DotNetDispatcherUnionTests.cs | Add/relocate union tests for JSInvokable dispatch path. |
| src/Components/JSInterop/test/Infrastructure/ByteArrayJsonConverterTest.cs | Add/relocate byte[] converter tests. |
| src/Components/JSInterop/test/DotNetObjectReferenceTest.cs | Add/relocate DotNetObjectReference tests. |
| src/Components/JSInterop/src/PublicAPI.Unshipped.txt | Initialize Unshipped API tracking for relocated project. |
| src/Components/JSInterop/src/PublicAPI.Shipped.txt | Add shipped API baseline for relocated project. |
| src/Components/JSInterop/src/Microsoft.JSInterop.WarningSuppressions.xml | Move/linker suppression file for relocated assembly. |
| src/Components/JSInterop/src/Microsoft.JSInterop.csproj | Opt project out of Components web-assets reference. |
| src/Components/JSInterop/src/JSRuntimeExtensions.cs | Add/relocate JSRuntime extension methods into Components/JSInterop. |
| src/Components/JSInterop/src/JSRuntime.cs | Add/relocate JSRuntime implementation into Components/JSInterop. |
| src/Components/JSInterop/src/JSObjectReferenceExtensions.cs | Add/relocate JS object reference extension methods. |
| src/Components/JSInterop/src/JSInvokableAttribute.cs | Add/relocate JSInvokable attribute. |
| src/Components/JSInterop/src/JSInProcessRuntimeExtensions.cs | Add/relocate in-process runtime extension methods. |
| src/Components/JSInterop/src/JSInProcessRuntime.cs | Add/relocate JSInProcessRuntime implementation. |
| src/Components/JSInterop/src/JSInProcessObjectReferenceExtensions.cs | Add/relocate in-process object reference extension methods. |
| src/Components/JSInterop/src/JSException.cs | Add/relocate JSException type. |
| src/Components/JSInterop/src/JSDisconnectedException.cs | Add/relocate JSDisconnectedException type. |
| src/Components/JSInterop/src/JSCallResultType.cs | Add/relocate JS call result enum. |
| src/Components/JSInterop/src/Infrastructure/TaskGenericsUtil.cs | Add/relocate internal task utilities. |
| src/Components/JSInterop/src/Infrastructure/PendingAsyncCall.cs | Add/relocate pending async call implementation. |
| src/Components/JSInterop/src/Infrastructure/JSStreamReferenceJsonConverter.cs | Add/relocate JS stream reference converter. |
| src/Components/JSInterop/src/Infrastructure/JSObjectReferenceJsonConverter.cs | Add/relocate JS object reference converter. |
| src/Components/JSInterop/src/Infrastructure/JSInvocationInfo.cs | Add/relocate JS invocation info struct. |
| src/Components/JSInterop/src/Infrastructure/JSInteropJsonTypeInfoResolver.cs | Add/relocate resolver for converter-backed JSON metadata. |
| src/Components/JSInterop/src/Infrastructure/JSCallType.cs | Add/relocate JS call type enum. |
| src/Components/JSInterop/src/Infrastructure/IPendingAsyncCall.cs | Add/relocate pending call interface. |
| src/Components/JSInterop/src/Infrastructure/IJSVoidResult.cs | Add/relocate internal void-result marker interface. |
| src/Components/JSInterop/src/Infrastructure/IDotNetObjectReference.cs | Add/relocate internal object reference abstraction. |
| src/Components/JSInterop/src/Infrastructure/DotNetStreamReferenceJsonConverter.cs | Add/relocate .NET stream reference converter. |
| src/Components/JSInterop/src/Infrastructure/DotNetObjectReferenceJsonConverterFactory.cs | Add/relocate converter factory. |
| src/Components/JSInterop/src/Infrastructure/DotNetObjectReferenceJsonConverter.cs | Add/relocate DotNetObjectReference converter. |
| src/Components/JSInterop/src/Infrastructure/DotNetInvocationResult.cs | Add/relocate invocation result struct. |
| src/Components/JSInterop/src/Infrastructure/DotNetInvocationInfo.cs | Add/relocate invocation info struct. |
| src/Components/JSInterop/src/Infrastructure/ByteArrayJsonConverter.cs | Add/relocate byte[] converter. |
| src/Components/JSInterop/src/Implementation/JSStreamReference.cs | Add/relocate stream reference implementation. |
| src/Components/JSInterop/src/Implementation/JSObjectReferenceJsonWorker.cs | Add/relocate shared JSON read/write worker. |
| src/Components/JSInterop/src/Implementation/JSObjectReference.cs | Add/relocate JSObjectReference implementation. |
| src/Components/JSInterop/src/Implementation/JSInProcessObjectReference.cs | Add/relocate JSInProcessObjectReference implementation. |
| src/Components/JSInterop/src/IJSStreamReference.cs | Add/relocate IJSStreamReference public interface. |
| src/Components/JSInterop/src/IJSRuntime.cs | Add/relocate IJSRuntime public interface. |
| src/Components/JSInterop/src/IJSObjectReference.cs | Add/relocate IJSObjectReference public interface. |
| src/Components/JSInterop/src/IJSInProcessRuntime.cs | Add/relocate IJSInProcessRuntime public interface. |
| src/Components/JSInterop/src/IJSInProcessObjectReference.cs | Add/relocate IJSInProcessObjectReference public interface. |
| src/Components/JSInterop/src/DotNetStreamReference.cs | Add/relocate DotNetStreamReference public type. |
| src/Components/JSInterop/src/DotNetObjectReferenceOfT.cs | Add/relocate DotNetObjectReference public type. |
| src/Components/JSInterop/src/DotNetObjectReference.cs | Add/relocate DotNetObjectReference factory. |
| src/Components/JSInterop/README.md | Update docs for new layout and build instructions. |
| src/Components/Directory.Build.targets | Gate Components web-assets references on IncludeComponentsWebAssets. |
| src/Components/ComponentsNoDeps.slnf | Add relocated JSInterop projects to Components filter. |
| src/Components/Components.slnf | Add relocated JSInterop projects; remove old JSInterop path. |
| src/Azure/Azure.slnf | Update JSInterop project path to relocated location. |
| package.json | Update npm workspace path for JSInterop workspace. |
| eng/TrimmableProjects.props | Move Microsoft.JSInterop into Components grouping. |
| eng/ShippingAssemblies.props | Move Microsoft.JSInterop into Components shipping list grouping. |
| eng/SharedFramework.Local.props | Move Microsoft.JSInterop into Components shared-framework list grouping. |
| eng/ProjectReferences.props | Update ProjectReferenceProvider for Microsoft.JSInterop to new path. |
| eng/Npm.Workspace.nodeproj | Update tracked JSInterop build outputs to new workspace location/shape. |
| eng/Build.props | Remove old JSInterop globs from previous area grouping. |
| AspNetCore.slnx | Add new Components/JSInterop folder; remove old JSInterop folder entries. |
| .github/workflows/labeler-area-paths.yml | Remove old src/JSInterop/ path mapping for area labels. |
| .github/workflows/issue-triage-agent.md | Update area-blazor code path description to include JSInterop under Components. |
| .github/CODEOWNERS | Remove old JSInterop path ownership entry (moved under Components). |
Review details
- Files reviewed: 52/113 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Regarding the Copilot review note about |
Why
Microsoft.JSInteropand its JavaScript counterpart are part of the Components stack, but currently live in a separate top-level area andWeb.JSconsumes the JavaScript implementation through its workspace package. Co-locating these sources keeps their build and ownership boundaries aligned while preserving both package outputs.What changed
Microsoft.JSInteropsource and tests tosrc/Components/JSInteropand updated project, solution-filter, ownership, and build references.src/Components/Web.JSand converted the TypeScript internalDotNetmodule to regular ES-module exports.Web.JSto import the local source directly instead of depending on@microsoft/dotnet-js-interop.@microsoft/dotnet-js-interopas a separately buildable/packageable npm workspace through a compatibility entry point, and preserved theMicrosoft.JSInteropNuGet package.How to verify
npm test --workspace @microsoft/microsoft.aspnetcore.components.web.js -- --runInBand— 281 tests passed.npm run build --workspace @microsoft/microsoft.aspnetcore.components.web.js— Debug and Release bundles built.npm run build --workspace @microsoft/dotnet-js-interopandnpm pack --workspace @microsoft/dotnet-js-interop --dry-run --json.. .\activate.ps1; dotnet test src\Components\JSInterop\test\Microsoft.JSInterop.Tests.csproj --no-restore -v:q -p:UseIisNativeAssets=false— 167 tests passed..\eng\build.cmd -pack -projects src\Components\JSInterop\src\Microsoft.JSInterop.csproj -NoBuildNodeJS -NoBuildNative /p:UseIisNativeAssets=false.AspNetCore.slnxagainst every solution filter.Risks / follow-ups
The main risk is stale path or package-build wiring after the relocation. The repository references, solution filters, npm package contents, Web.JS bundles, managed tests, and NuGet pack output were validated. No follow-up is currently required.