Skip to content

feat(runtime-core): introduce Effect-based runtime with structural consolidation#4339

Closed
ScriptedAlchemy wants to merge 47 commits intomainfrom
feat/effect-ts
Closed

feat(runtime-core): introduce Effect-based runtime with structural consolidation#4339
ScriptedAlchemy wants to merge 47 commits intomainfrom
feat/effect-ts

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

@ScriptedAlchemy ScriptedAlchemy commented Feb 1, 2026

Summary

  • introduce Effect-oriented runtime-core internals and structural consolidation updates
  • include Metro compatibility, runtime tooling, docs/workflow updates, and package build alignment present on this branch
  • refresh changeset coverage to reflect all touched publishable packages in the branch diff

Changed Packages

  • @module-federation/cli
  • @module-federation/data-prefetch
  • @module-federation/devtools
  • @module-federation/dts-plugin
  • @module-federation/enhanced
  • @module-federation/error-codes
  • @module-federation/esbuild
  • @module-federation/inject-external-runtime-core-plugin
  • @module-federation/managers
  • @module-federation/manifest
  • @module-federation/metro
  • @module-federation/micro-effect
  • @module-federation/nextjs-mf
  • @module-federation/retry-plugin
  • @module-federation/rsbuild-plugin
  • @module-federation/rspack
  • @module-federation/rspress-plugin
  • @module-federation/runtime
  • @module-federation/runtime-core
  • @module-federation/runtime-tools
  • @module-federation/sdk
  • @module-federation/utilities
  • @module-federation/webpack-bundler-runtime

Changesets

  • .changeset/effect-runtime-consolidation.md
  • .changeset/config.json (changeset tooling config update)

Base

  • main

Single-PR Review Guide (No Additional PRs)

This PR will remain a single PR. Improvements are being done in-place (no stacked or follow-up PR splitting).

Suggested Review Order

  1. Core behavior/runtime changes first.
  2. Build/tooling and workflow updates second.
  3. Docs/examples/app fixtures last.

In-Place Scope Trim Checklist

  • Remove unrelated churn not required for this PR goal.
  • Keep lockfile and generated changes only when strictly needed.
  • Confirm acceptance criteria and regression tests are explicit in this PR.
  • Resolve merge conflict status and required CI checks before final re-review.

ScriptedAlchemy and others added 2 commits January 31, 2026 16:12
- Fix catch_ dual-form detection to use 'pipe' instead of '_tag' for robust MFEffect detection
- Remove unused _extraOptions parameter from getManifestJsonEffect
- Remove noop .then((res) => res) in SnapshotHandler manifest loading
- Restore domain comments across module, remote, shared, and snapshot files
- Add vitest test suite for micro-effect package (18 test cases)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…uce bundle size

Consolidate runtime-core source by ~400 LOC across 6 phases:
- Collapse 6 hook files into single unified Hook class with typed subclasses
- Extract attachLinks/attachScripts helpers in preload, replacing 4 duplicate blocks
- Deduplicate share loading with resolveRegistered/loadFoundAsync/loadNotFoundAsync helpers
- Convert module Effect programs to private class methods, inline defineModuleId
- Merge 3 global init functions into single initGlobalFederation
- Tighten semver parser (parseHyphen/parseCarets) and extract buildAtom in satisfy

ESM bundle: 134,880 → 128,738 bytes (-4.6%), gzipped: 26,823 → 25,840 (-3.7%)
All 182 tests pass (micro-effect: 31, runtime-core: 61, runtime: 90).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 1, 2026

🦋 Changeset detected

Latest commit: 4ff3e8a

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

This PR includes changesets to release 44 packages
Name Type
@module-federation/cli Patch
@module-federation/data-prefetch Patch
@module-federation/devtools Patch
@module-federation/dts-plugin Patch
@module-federation/enhanced Patch
@module-federation/error-codes Patch
@module-federation/esbuild Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/metro Patch
@module-federation/micro-effect Patch
@module-federation/nextjs-mf Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspack Patch
@module-federation/rspress-plugin Patch
@module-federation/runtime Patch
@module-federation/runtime-core Patch
@module-federation/runtime-tools Patch
@module-federation/sdk Patch
@module-federation/utilities Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/modern-js-v3 Patch
@module-federation/modern-js Patch
@module-federation/node Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
website-new Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
remote5 Patch
remote6 Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-react-webpack-plugin Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/bridge-shared Patch
create-module-federation Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend 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

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 1, 2026

Deploy Preview for module-federation-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 4ff3e8a
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69a937742893ed0008fb168f

ScriptedAlchemy and others added 7 commits January 31, 2026 20:22
Phase 6: Move Effect programs from Module to RemoteHandler, inline
createRemoteEntryInitOptions, simplify wraperFactory with tag helper.
Module reduced from 283 to 75 LOC as a thin delegate.

Delete unused semver re-export stubs (constants.ts, utils.ts, compare.ts).

All 182 tests pass (micro-effect:31, runtime-core:61, runtime:90).
ESM bundle: 121,753 bytes (was 128,738, -5.4%).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…OC reduction)

Reduce runtime-core source from 5,332 to 4,266 LOC (1,066 lines, ~20%) across
all 6 consolidation phases while preserving public API and all 182 tests:

- Phase 1: Snapshot/preload unification — compact walkSnapshot, collectModuleAssets,
  collectLoadedSharedAssets, resolvePreloadConfig helpers
- Phase 2: Remote pipeline compression — collapse _getModule, compact registerRemote,
  removeRemote, preloadRemoteEffect, loadRemote, getRemoteModuleAndOptions
- Phase 3: Share resolution simplification — merge loadFoundAsync/loadNotFoundAsync
  into loadSharedAsync, compact formatShare, setShared, initializeSharing, getTargetSharedOptions
- Phase 4: Hook system compression — compact emit strategies, applyPlugin, removePlugin
- Phase 5: Core/global/helpers folding — typeof inference for interfaces, compact
  matchRemote, formatOptions, initGlobalFederation, processModuleAlias
- Phase 6: Misc tightening — compact parseXRanges, remove unused hooks, tighten
  error recovery in load.ts and SnapshotHandler.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
# Conflicts:
#	packages/runtime-core/src/module/index.ts
#	pnpm-lock.yaml
#	scripts/bundle-size-report.mjs
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 6, 2026

Bundle Size Report

21 package(s) changed, 21 unchanged.

Package Total dist Delta ESM gzip Delta
esbuild 157.5 kB -110101 B (-40.6%) 60 B -56 B (-48.3%)
runtime-core 190.4 kB -76040 B (-28.1%) 19.9 kB -5716 B (-21.9%)
utils 44.0 kB -68225 B (-60.2%) 0 B -328 B (-100.0%)
data-prefetch 54.8 kB -59420 B (-51.5%) 131 B +26 B (+24.8%)
bridge-react 405.1 kB +45.6 kB (+12.7%) 1.3 kB +1 B (+0.1%)
manifest 95.5 kB -40294 B (-29.2%) 9.2 kB +9.1 kB (+5096.2%)
managers 33.6 kB -31911 B (-48.1%) 3.4 kB +3.0 kB (+928.7%)
rspack 32.1 kB -26807 B (-44.9%) 190 B -21 B (-10.0%)
sdk 96.4 kB +24.3 kB (+33.8%) 11.1 kB +2.9 kB (+36.2%)
rsbuild-plugin 94.9 kB -17863 B (-15.5%) 6.1 kB +6.0 kB (+6744.0%)
cli 10.2 kB -17705 B (-63.0%) 2.8 kB +2.0 kB (+259.9%)
micro-effect 12.1 kB +12.1 kB (+∞%) 1.5 kB +1.5 kB (+∞%)
metro-core 241.0 kB +3.7 kB (+1.6%) 147 B no change
vue3-bridge 161.4 kB +2.5 kB (+1.6%) 23.9 kB +664 B (+2.8%)
webpack-bundler-runtime 64.9 kB -809 B (-1.2%) 5.8 kB -49 B (-0.8%)
runtime-tools 2.9 kB -428 B (-12.7%) 132 B no change
inject-external-runtime-core-plugin 4.2 kB -338 B (-7.4%) 489 B -56 B (-10.3%)
runtime 13.1 kB -323 B (-2.4%) 758 B no change
rspress-plugin 10.7 kB -105 B (-0.9%) 2.8 kB -9 B (-0.3%)
dts-plugin 627.1 kB +12 B (+0.0%) 23.4 kB no change
retry-plugin 48.1 kB +12 B (+0.0%) 3.2 kB no change

Total dist: 4.87 MB (-359924 B (-6.6%))
Total ESM gzip: 157.7 kB (+19.1 kB (+13.8%))

@ScriptedAlchemy ScriptedAlchemy changed the title feat(micro-effect, runtime-core): Effect-based runtime with structural consolidation feat(runtime-core): introduce Effect-based runtime with structural consolidation Feb 12, 2026
ScriptedAlchemy and others added 3 commits February 13, 2026 23:51
# Conflicts:
#	.github/actions/android-e2e/action.yaml
#	.github/actions/ios-e2e/action.yaml
#	.github/workflows/e2e-metro.yml
#	packages/cli/rslib.config.ts
#	packages/data-prefetch/rslib.config.ts
#	packages/managers/rslib.config.ts
#	packages/manifest/rslib.config.ts
#	packages/rspack/rslib.config.ts
#	pnpm-lock.yaml
ScriptedAlchemy and others added 9 commits February 15, 2026 18:14
# Conflicts:
#	apps/metro-example-host/ios/Podfile.lock
#	packages/metro-core/src/plugin/serializer.ts
#	packages/metro-core/tsconfig.json
#	pnpm-lock.yaml
Update pnpm-lock.yaml to match package manifest changes on this branch.
This restores frozen-lockfile installs in GitHub Actions.

Co-authored-by: Cursor <cursoragent@cursor.com>
Correct sdk/error-codes/managers entrypoints and update RawSource usage so
dts-plugin TYPE-001 and module resolution failures are eliminated.

Co-authored-by: Cursor <cursoragent@cursor.com>
Restore sdk and error-codes package entrypoints to match emitted dist files
and keep lockfile metadata in sync after install checks on this branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cast pluginPublint in utilities rslib config so CI builds do not fail when
mixed rsbuild versions produce incompatible plugin type signatures.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/devtools@9cc0d5b

@module-federation/cli

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/cli@9cc0d5b

create-module-federation

pnpm add https://pkg.pr.new/module-federation/core/create-module-federation@9cc0d5b

@module-federation/data-prefetch

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/data-prefetch@9cc0d5b

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/dts-plugin@9cc0d5b

@module-federation/enhanced

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/enhanced@9cc0d5b

@module-federation/error-codes

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/error-codes@9cc0d5b

@module-federation/managers

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/managers@9cc0d5b

@module-federation/manifest

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/manifest@9cc0d5b

@module-federation/metro

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro@9cc0d5b

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

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

@module-federation/metro-plugin-rnef

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

@module-federation/micro-effect

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/micro-effect@9cc0d5b

@module-federation/modern-js-v3

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

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/retry-plugin@9cc0d5b

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rsbuild-plugin@9cc0d5b

@module-federation/rspack

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rspack@9cc0d5b

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rspress-plugin@9cc0d5b

@module-federation/runtime

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

@module-federation/runtime-core

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

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime-tools@9cc0d5b

@module-federation/sdk

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/sdk@9cc0d5b

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

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

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/treeshake-frontend@9cc0d5b

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/treeshake-server@9cc0d5b

@module-federation/webpack-bundler-runtime

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

@module-federation/bridge-react

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-react@9cc0d5b

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

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

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-shared@9cc0d5b

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-vue3@9cc0d5b

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

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

commit: 9cc0d5b

@zhoushaw zhoushaw closed this Mar 9, 2026
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.

2 participants