diff --git a/.changeset/ai-eager-wolf.md b/.changeset/ai-eager-wolf.md new file mode 100644 index 00000000000..ab5fe276767 --- /dev/null +++ b/.changeset/ai-eager-wolf.md @@ -0,0 +1,12 @@ +--- +"@module-federation/runtime-core": minor +--- + +Added support for OR ranges in semantic version satisfaction logic with comprehensive unit tests. + +- Implemented parsing for OR (||) conditions in version ranges. + - Split input ranges by || to evaluate alternatives individually. + - Ensured logical handling of wildcards '*' and 'x' within ranges. +- Refactored internal parsing to support more complex range constructs. +- Added comprehensive test cases to cover diverse scenarios for OR range support. +- Introduced error handling during range processing, with console logging for tracking issues. diff --git a/.changeset/ai-happy-fox.md b/.changeset/ai-happy-fox.md new file mode 100644 index 00000000000..51821121aff --- /dev/null +++ b/.changeset/ai-happy-fox.md @@ -0,0 +1,12 @@ +--- +"@module-federation/nextjs-mf": minor +--- + +Refactor and enhance module federation support for Next.js. + +- Introduced `getShareScope` function to dynamically generate the default share scope based on the client or server environment, replacing static DEFAULT_SHARE_SCOPE declarations. +- Implemented `RscManifestInterceptPlugin` to intercept and modify client reference manifests, ensuring proper prefix handling. +- Refined server-side externals handling to ensure shared federation modules are bundled. +- Simplified and modularized sharing logic by creating distinct functions for React, React DOM, React JSX Runtime, and React JSX Dev Runtime package configurations. +- Captured the original webpack public path for potential use in plugins and adjustments. +- Enhanced logging for debug tracing of shared module resolution processes in runtimePlugin. diff --git a/.changeset/ai-hungry-bear.md b/.changeset/ai-hungry-bear.md new file mode 100644 index 00000000000..444a92082bf --- /dev/null +++ b/.changeset/ai-hungry-bear.md @@ -0,0 +1,9 @@ +"@module-federation/enhanced": minor +--- + +Enhancements to layer handling in module federation tests and configuration. + +- Improved handling of `shareKey` for layers within `ConsumeSharedPlugin` and `ProvideSharedPlugin`. + - Conditionally prepend the `shareKey` with the `layer` if applicable. +- Introduced new layer configurations to support more nuanced federation scenarios that consider multiple layers of dependency. +``` diff --git a/.changeset/ai-sleepy-fox.md b/.changeset/ai-sleepy-fox.md new file mode 100644 index 00000000000..36d84f71503 --- /dev/null +++ b/.changeset/ai-sleepy-fox.md @@ -0,0 +1,9 @@ +--- +"@module-federation/enhanced": patch +--- + +Refactored module sharing configuration handling. + +- Simplified plugin schema for better maintainability +- Improved layer-based module sharing test coverage +- Removed redundant plugin exports diff --git a/.changeset/ai-sleepy-tiger.md b/.changeset/ai-sleepy-tiger.md new file mode 100644 index 00000000000..6c11ece998e --- /dev/null +++ b/.changeset/ai-sleepy-tiger.md @@ -0,0 +1,6 @@ +--- +"@module-federation/runtime": minor +--- + +- Added a new property 'layer' of type string or null to SharedConfig. +``` diff --git a/.changeset/brown-badgers-fetch.md b/.changeset/brown-badgers-fetch.md new file mode 100644 index 00000000000..00d28f1f096 --- /dev/null +++ b/.changeset/brown-badgers-fetch.md @@ -0,0 +1,5 @@ +--- +'@module-federation/enhanced': minor +--- + +support request option on ConsumeSharePlugin. Allows matching requests like the object key of shared does diff --git a/.changeset/shy-snails-battle.md b/.changeset/shy-snails-battle.md new file mode 100644 index 00000000000..8d4fb5ec2f1 --- /dev/null +++ b/.changeset/shy-snails-battle.md @@ -0,0 +1,5 @@ +--- +'@module-federation/enhanced': minor +--- + +Layer support for Provide Share Plugin diff --git a/apps/next-app-router/next-app-router-4000/app/layout.tsx b/apps/next-app-router/next-app-router-4000/app/layout.tsx index ed79b53661a..d85b4370922 100644 --- a/apps/next-app-router/next-app-router-4000/app/layout.tsx +++ b/apps/next-app-router/next-app-router-4000/app/layout.tsx @@ -3,7 +3,7 @@ import { AddressBar } from '#/ui/address-bar'; import Byline from '#/ui/byline'; // import { GlobalNav } from 'remote_4001/GlobalNav(rsc)'; import { Metadata } from 'next'; - +console.log(require('remote_4001/Button')); export const metadata: Metadata = { title: { default: 'Next.js App Router', diff --git a/apps/next-app-router/next-app-router-4000/app/page.tsx b/apps/next-app-router/next-app-router-4000/app/page.tsx index 0c8b03c0c0e..b7ef75430ee 100644 --- a/apps/next-app-router/next-app-router-4000/app/page.tsx +++ b/apps/next-app-router/next-app-router-4000/app/page.tsx @@ -1,7 +1,8 @@ import { demos } from '#/lib/demos'; import Link from 'next/link'; +import { lazy } from 'react'; import dynamic from 'next/dynamic'; -const Button = dynamic(() => import('remote_4001/Button'), { ssr: true }); +const Button = lazy(() => import('remote_4001/Button')); export default function Page() { return ( diff --git a/apps/next-app-router/next-app-router-4000/next.config.js b/apps/next-app-router/next-app-router-4000/next.config.js index da2ee672d59..e5e47e6d24f 100644 --- a/apps/next-app-router/next-app-router-4000/next.config.js +++ b/apps/next-app-router/next-app-router-4000/next.config.js @@ -38,8 +38,8 @@ const nextConfig = { filename: 'static/chunks/remoteEntry.js', remotes: { remote_4001: remotes.remote_4001, - shop: remotes.shop, - checkout: remotes.checkout, + // shop: remotes.shop, + // checkout: remotes.checkout, }, shared: { // 'react': { diff --git a/apps/next-app-router/next-app-router-4000/project.json b/apps/next-app-router/next-app-router-4000/project.json index 63f23344afd..31ae3b8365f 100644 --- a/apps/next-app-router/next-app-router-4000/project.json +++ b/apps/next-app-router/next-app-router-4000/project.json @@ -27,8 +27,8 @@ "serve": { "executor": "nx:run-commands", "options": { - "command": "pnpm dev", - "cwd": "apps/next-app-router-4000" + "command": "npm run dev", + "cwd": "apps/next-app-router/next-app-router-4000" }, "dependsOn": [ { diff --git a/apps/next-app-router/next-app-router-4001/app/layout.tsx b/apps/next-app-router/next-app-router-4001/app/layout.tsx index ba6662a2c6a..0a34ae994e1 100644 --- a/apps/next-app-router/next-app-router-4001/app/layout.tsx +++ b/apps/next-app-router/next-app-router-4001/app/layout.tsx @@ -1,8 +1,8 @@ import '#/styles/globals.css'; -import { AddressBar } from '#/ui/address-bar'; -import Byline from '#/ui/byline'; +// import { AddressBar } from '#/ui/address-bar'; +// import Byline from '#/ui/byline'; import { GlobalNav } from '#/ui/global-nav'; -import { Metadata } from 'next'; +// import { Metadata } from 'next'; export const metadata: Metadata = { title: { @@ -36,15 +36,13 @@ export default function RootLayout({