Skip to content

fix: stop the build-time FederationManifest shadowing the runtime one - #136

Merged
Aukevanoost merged 2 commits into
mainfrom
fix/stale-core-re-exports
Sep 16, 2026
Merged

Aukevanoost merged 2 commits into
mainfrom
fix/stale-core-re-exports

Conversation

@Aukevanoost

Copy link
Copy Markdown
Contributor

What

src/index.ts opens with export * from "@softarc/native-federation/domain". That barrel is the core's build-time contract surface, and it includes a FederationManifest that won over the orchestrator's at the public boundary:

// what consumers got (core, build-time)
Record<string, string | { url: string; integrity?: string; main?: string }>

// what initFederation() actually takes (orchestrator)
Record<string, string | { url: string; integrity?: string }>

So the published type advertised a main field that initFederation() ignores — nothing in the core reads it in a manifest context either. 722e88a fixed this for the internal import; the star-export still shadowed it on the consumer-facing side. This re-exports the orchestrator's explicitly so the explicit export wins.

Second, ./config exports withNativeFederation(cfg: FederationConfig) but not FederationConfig itself, so anyone typing their federation.config.js object had to reach for the runtime root entry. Now it sits next to the function that takes it.

Non-breaking

Nothing removed. The manifest swap only narrows an object type by an optional field that never did anything, so existing consumer code still compiles.

Verification

  • tsc --noEmit clean, knip clean, lint 0 errors (34 pre-existing warnings in unrelated files)
  • 241/241 tests pass
  • Throwaway probe with @ts-expect-error on a manifest entry carrying main: tsc consumed the directive rather than flagging it unused, confirming the orchestrator's shape now wins at the boundary

Deliberately left for the next major

Both are breaking, so not in this PR:

  • Imports / Scopes / ImportMap (src/index.ts) are dead — byte-identical copies of the orchestrator's internal import-map.contract, used nowhere in src/ and absent from the README. Leftovers from when the adapter built import maps itself.
  • Narrowing the star-export. Of its 32 names, only ~6 (FederationInfo, SharedInfo, DenseSharedInfo, ExposesInfo, ChunkInfo, IntegrityMap) are runtime-relevant — the orchestrator imports those itself. The other ~24 are build-time contracts on the entry point an app's main.ts imports.

`export * from "@softarc/native-federation/domain"` re-exports the core's
build-time FederationManifest, which won over the orchestrator's at the
public boundary. Consumers got a shape with an extra `main` field that
initFederation() ignores. Re-export the orchestrator's explicitly so it
shadows the star-export, completing 722e88a on the consumer-facing side.

Also export FederationConfig from ./config, next to the
withNativeFederation that takes it -- it previously only reached users
through the runtime root entry.
@Aukevanoost
Aukevanoost merged commit b4bd731 into main Sep 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant