Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(enhanced): support shared module layers #3276

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5b107fa
feat(enhanced): support layers
ScriptedAlchemy Nov 17, 2024
062706f
feat(enhanced): support layers
ScriptedAlchemy Nov 17, 2024
cfd9d01
feat(enhanced): layers for consume shared module
ScriptedAlchemy Nov 21, 2024
3e59c55
Merge branch 'main' into layers-support
ScriptedAlchemy Nov 21, 2024
536b110
Merge branch 'main' into layers-support
ScriptedAlchemy Nov 21, 2024
aed08e9
feat(enhanced): add issuerLayer support to consume shared
ScriptedAlchemy Nov 22, 2024
9fb164b
chore(enhanced): update test
ScriptedAlchemy Nov 25, 2024
a9d899c
chore(enhanced): update test
ScriptedAlchemy Nov 25, 2024
33a36d1
feat(enhanced): ConsumeSharedPlugin issuerLayer support
ScriptedAlchemy Nov 25, 2024
f0c5c50
chore: update tests for layer combos
ScriptedAlchemy Nov 25, 2024
578adbb
chore: update tests for layer combos
ScriptedAlchemy Nov 25, 2024
31f08d0
chore: update tests for layer combos
ScriptedAlchemy Nov 25, 2024
066ffa6
feat(enhanced): support direct layer
ScriptedAlchemy Nov 25, 2024
b70eb8d
Merge branch 'main' into layers-support
ScriptedAlchemy Nov 25, 2024
358ba00
fix(enhanced): update share options of share plugin
ScriptedAlchemy Nov 25, 2024
94d72ed
fix(enhanced): update share options of share plugin
ScriptedAlchemy Nov 25, 2024
91dbb12
chore(enhanced): refactor layers tests
ScriptedAlchemy Nov 25, 2024
514cf03
chore(enhanced): remove layer options from provider
ScriptedAlchemy Nov 25, 2024
359b0ca
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Nov 25, 2024
24ef6d0
Delete .cursorrules
ScriptedAlchemy Nov 25, 2024
9d9bff2
feat(enhanced): support layers in consume share
ScriptedAlchemy Nov 26, 2024
40ae817
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Nov 26, 2024
d1c68b3
fix(enhanced): rename requiredLayer to layer
ScriptedAlchemy Dec 2, 2024
22964f8
Merge remote-tracking branch 'origin/consume-share-layers' into consu…
ScriptedAlchemy Dec 2, 2024
9884030
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Dec 2, 2024
3d8fa21
refactor(enhanced): pr review of consume share layering
ScriptedAlchemy Dec 3, 2024
69a2a52
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Dec 3, 2024
04b8ffd
chore: locks
ScriptedAlchemy Dec 3, 2024
7852878
feat(enhanced): add request to consume share (#3307)
ScriptedAlchemy Dec 5, 2024
f35b1b1
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Dec 5, 2024
b8df73e
chore: remove tt
ScriptedAlchemy Dec 9, 2024
b4b5a7b
chore: remove unused share
ScriptedAlchemy Dec 9, 2024
6f8f45e
refactor(enhanced): refactor type locations
ScriptedAlchemy Dec 10, 2024
875f516
feat(enhanced): ProvideSharedPlugin loader layer support (#3334)
ScriptedAlchemy Dec 12, 2024
673f6ca
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Dec 12, 2024
20bae5b
chore: locks
ScriptedAlchemy Dec 12, 2024
a5774c8
chore(enhanced): add share plugin test
ScriptedAlchemy Dec 13, 2024
d44acbd
chore(enhanced): add share plugin test
ScriptedAlchemy Dec 13, 2024
1a33ac7
chore(enhanced): add share plugin test
ScriptedAlchemy Dec 13, 2024
1fc2b05
thing
ScriptedAlchemy Dec 13, 2024
29f6d73
thing
ScriptedAlchemy Dec 13, 2024
22127ee
chore(node): lint
ScriptedAlchemy Dec 13, 2024
8f9fb99
chore(node): lint
ScriptedAlchemy Dec 13, 2024
243f1bc
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Dec 13, 2024
0c665be
feat(enhanced): layers support in module code generation (#3371)
ScriptedAlchemy Dec 29, 2024
ffdaf0b
chore: changeset
ScriptedAlchemy Dec 31, 2024
687365f
feat(enhanced): Layer via composite shareKey (#3415)
ScriptedAlchemy Dec 31, 2024
4ef6efb
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Dec 31, 2024
81d2365
chore: locks
ScriptedAlchemy Dec 31, 2024
6f952fd
Merge branch 'main' into consume-share-layers
ScriptedAlchemy Jan 1, 2025
5fce760
chore: locks
ScriptedAlchemy Jan 1, 2025
1fba24f
fix(enhanced): cache consume module layer
ScriptedAlchemy Jan 2, 2025
7af571f
fix(nextjs-mf): enable app router shares and disable hard fail
ScriptedAlchemy Jan 2, 2025
7a178c0
chore: add host remote app router
ScriptedAlchemy Jan 2, 2025
10f2b73
feat(nextjs-mf): update module share for rsc
ScriptedAlchemy Jan 3, 2025
e122bf4
feat(nextjs-mf): update module share for rsc
ScriptedAlchemy Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .changeset/ai-hungry-bear.md
Original file line number Diff line number Diff line change
@@ -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.
```
9 changes: 9 additions & 0 deletions .changeset/ai-sleepy-fox.md
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .changeset/ai-sleepy-tiger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@module-federation/runtime": minor
---

- Added a new property 'layer' of type string or null to SharedConfig.
```
5 changes: 5 additions & 0 deletions .changeset/brown-badgers-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/enhanced': minor
---

support request option on ConsumeSharePlugin. Allows matching requests like the object key of shared does
5 changes: 5 additions & 0 deletions .changeset/shy-snails-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/enhanced': minor
---

Layer support for Provide Share Plugin
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/.nx
# dependencies
node_modules

next.js
# IDEs and editors
/.idea
.project
Expand Down Expand Up @@ -70,4 +70,7 @@ packages/enhanced/test/js
# storybook cases
!apps/rslib-module/@mf-types/**

**/vite.config.{js,ts,mjs,mts,cjs,cts}.timestamp*
**/vite.config.{js,ts,mjs,mts,cjs,cts}.timestamp*

# Federation
**/.federation
3 changes: 3 additions & 0 deletions apps/next-app-router-4000/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
37 changes: 37 additions & 0 deletions apps/next-app-router-4000/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
/.yarn

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*
!.env*.example

# vercel
.vercel

# typescript
*.tsbuildinfo
1 change: 1 addition & 0 deletions apps/next-app-router-4000/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
2 changes: 2 additions & 0 deletions apps/next-app-router-4000/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
pnpm-lock.yaml
6 changes: 6 additions & 0 deletions apps/next-app-router-4000/app/api/categories/category.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type Category = {
name: string;
slug: string;
count: number;
parent: string | null;
};
52 changes: 52 additions & 0 deletions apps/next-app-router-4000/app/api/categories/getCategories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { notFound } from 'next/navigation';
import type { Category } from './category';

// `server-only` guarantees any modules that import code in file
// will never run on the client. Even though this particular API
// doesn't currently use sensitive environment variables, it's
// good practice to add `server-only` preemptively.
import 'server-only';

export async function getCategories({ parent }: { parent?: string } = {}) {
const res = await fetch(
`https://app-playground-api.vercel.app/api/categories${
parent ? `?parent=${parent}` : ''
}`,
);

if (!res.ok) {
// Render the closest `error.js` Error Boundary
throw new Error('Something went wrong!');
}

const categories = (await res.json()) as Category[];

if (categories.length === 0) {
// Render the closest `not-found.js` Error Boundary
notFound();
}

return categories;
}

export async function getCategory({ slug }: { slug: string }) {
const res = await fetch(
`https://app-playground-api.vercel.app/api/categories${
slug ? `?slug=${slug}` : ''
}`,
);

if (!res.ok) {
// Render the closest `error.js` Error Boundary
throw new Error('Something went wrong!');
}

const category = (await res.json()) as Category;

if (!category) {
// Render the closest `not-found.js` Error Boundary
notFound();
}

return category;
}
Binary file not shown.
Loading
Loading