Skip to content

fix(manifest,managers): support Rspack layered shared metadata - #5039

Draft
ScriptedAlchemy wants to merge 7 commits into
mainfrom
feat/rspack-layered-shared-metadata
Draft

fix(manifest,managers): support Rspack layered shared metadata#5039
ScriptedAlchemy wants to merge 7 commits into
mainfrom
feat/rspack-layered-shared-metadata

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

Preserve layer-aware shared and exposed module metadata from Rspack and webpack through stats collection and manifest generation. Public expose aliases retain their imports, requirements, layers, and assets, including multi-import exposes and disabled asset analysis. The wrapper forwards exposes.*.layer, including an empty string.

Shared rows keep their existing unlayered fields. An optional providers array records multiple concrete version/import pairs and their assets; single-provider and consumer-only rows omit it. Layered and ordered-scope identities remain separate. The reader handles the existing webpack identifier layout, Rspack's structural suffix, nullable expose names, and webpack's omitted-layer sentinels.

The SDK types and manifest regeneration preserve optional provider, layer, scope, identity, and expose-requirement metadata. A patch changeset covers the affected packages.

Related links

Companion to the Rspack layers stack: #12977#14911#14912#14913.

Compatibility

Unlayered applications remain compatible with older Federation readers in both directions. Tests compare the published @module-federation/manifest@2.8.2 reader with current source, including exact legacy shared fields and manifests without provider metadata. Layer-aware metadata requires this companion support.

Fresh Rspack output was checked through both readers: legacy fields agree, and the new reader's provider versions, resolved imports, and assets match the native manifest. Actual webpack compilations cover multiple providers and expose aliases. Tests also instantiate enhanced webpack's consume module to distinguish omitted layers from explicit empty layers.

Testing

The manifest package pins the Rspack layers preview at 843bab005b as a development dependency. One real compiler test covers two named exposes of the same source in different layers, distinct assets/shared identities, ordered scopes, and requiredShared through stats-to-manifest conversion. The root compiler and unrelated lockfile entries are unchanged. Frozen install and the manifest build passed.

  • Manifest tests: 48 passed, including complete stats-to-manifest generation
  • SDK tests: 69 passed, one existing skipped test
  • ContainerManager focused tests: 12 passed
  • SDK and manifest builds/declarations and package lint passed
  • Repository Prettier check and commit hooks passed

Rspack's layer-aware Module Federation stack (web-infra-dev/rspack#12977,
#14912, #14913) changes what the public v2 wrapper receives:

- ContainerManager.containerPluginExposesOptions rebuilt exposes from
  import/name only and dropped exposes.*.layer, so a layered expose was
  silently built unlayered. Preserve layer, including the empty string.
- The manifest reader extracted the shared package/version from a fixed
  space-delimited position, which the structural identifiers
  (provide shared module [<key>]@<version> = ...) move; it also cast the
  container-entry bracket payload to an expose-pair array, which the
  layered [exposes, layers] tuple breaks with a TypeError. Decode the
  structural key by its length-prefixed components and validate both
  container payload generations (and array share-scope prefixes),
  keeping the legacy formats working.

Shared records are still aggregated by package name only; representing
concrete provider variants is coordinated separately with the native
manifest producer.
@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a5aa440

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 48 packages
Name Type
@module-federation/sdk Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/devtools Patch
@module-federation/cli Patch
@module-federation/dts-plugin Patch
@module-federation/enhanced Patch
@module-federation/esbuild Patch
@module-federation/metro Patch
@module-federation/modern-js-v3 Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/observability-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspack Patch
@module-federation/rspress-plugin Patch
@module-federation/rstest Patch
@module-federation/runtime-core Patch
@module-federation/runtime Patch
@module-federation/storybook-addon Patch
@module-federation/utilities Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch
@module-federation/playground Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/runtime-tools Patch
@module-federation/inject-external-runtime-core-plugin Patch
create-module-federation Patch
@module-federation/error-codes Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/treeshake-frontend Patch
@module-federation/treeshake-server Patch
@module-federation/bridge-shared Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@a5aa440

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@a5aa440

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@a5aa440

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@a5aa440

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@a5aa440

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@a5aa440

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@a5aa440

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@a5aa440

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@a5aa440

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@a5aa440

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@a5aa440

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@a5aa440

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@a5aa440

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@a5aa440

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@a5aa440

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@a5aa440

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@a5aa440

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@a5aa440

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@a5aa440

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@a5aa440

@module-federation/playground

pnpm add https://pkg.pr.new/@module-federation/playground@a5aa440

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@a5aa440

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@a5aa440

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@a5aa440

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@a5aa440

@module-federation/rstest

pnpm add https://pkg.pr.new/@module-federation/rstest@a5aa440

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@a5aa440

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@a5aa440

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@a5aa440

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@a5aa440

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@a5aa440

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@a5aa440

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@a5aa440

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@a5aa440

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@a5aa440

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@a5aa440

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@a5aa440

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@a5aa440

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@a5aa440

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@a5aa440

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@a5aa440

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@a5aa440

commit: a5aa440

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

10 package(s) changed, 33 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/managers 71.2 kB +516 B (+0.7%) 244 B no change
@module-federation/manifest 157.6 kB +25.7 kB (+19.5%) 106 B no change
@module-federation/playground 28.91 MB -613 B (-0.0%) 45.7 kB no change
@module-federation/sdk 129.9 kB +1005 B (+0.8%) 785 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/cli 2.3 kB +1 B (+0.0%) 2.4 kB -35 B (-1.4%)
@module-federation/core 1.0 kB -3 B (-0.3%) 1.0 kB -35 B (-3.2%)
@module-federation/devtools 30.3 kB -12 B (-0.0%) 30.3 kB -36 B (-0.1%)
@module-federation/enhanced 2.7 kB +4 B (+0.1%) 2.8 kB -45 B (-1.6%)
@module-federation/managers 2.4 kB +24 B (+1.0%) 2.4 kB +24 B (+1.0%)
@module-federation/manifest 7.4 kB +1.9 kB (+33.6%) 7.4 kB +1.9 kB (+33.6%)
@module-federation/metro-plugin-rnc-cli 416 B -1 B (-0.2%) 435 B -27 B (-5.8%)
@module-federation/node 9.1 kB no change 9.2 kB -30 B (-0.3%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 22.3 kB -16 B (-0.1%) 23.8 kB -15 B (-0.1%) +1.6 kB +1 B

Total dist (raw): 36.19 MB (+26.6 kB (+0.1%))
Total ESM gzip: 111.4 kB (no change)
Total web bundle (gzip): 255.0 kB (+1.9 kB (+0.7%))
Total node bundle (gzip): 257.2 kB (+1.7 kB (+0.7%))
Tracked ./bundler entry gzip: 563 B (no change)
Tracked ./bundler web bundle (gzip): 4.9 kB (no change)
Tracked ./bundler node bundle (gzip): 4.9 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

…ayers

Rspack's layer-aware stack now emits the same identifier layouts as
webpack's enhanced plugin: shared modules insert a ' (layer)' segment
after the '(scope)' segment and keep 'name@version' at its legacy token
position; container entries keep the '[[key, options]]' payload with a
'layer' inside the expose options when present. Drop the structural-key
and tuple decoding that the earlier draft anticipated and parse the
layer segment instead (for webpack provide identifiers too).

Add a compatibility suite that runs the last published reader
(@module-federation/manifest@2.8.2, aliased as a dev dependency) and the
current source against the same Rspack-shaped identifiers: unlayered
shares and containers (with or without a layered expose) read
identically, layered shares are skipped by the old reader without
failing, and the superseded structural/tuple shapes are documented as
breaking it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant