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

WIP: feat: support SSR data loader #2820

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

WIP: feat: support SSR data loader #2820

wants to merge 3 commits into from

Conversation

2heal1
Copy link
Member

@2heal1 2heal1 commented Aug 5, 2024

Description

  • Support data fetch with app level provider in Modern.js
  • Support partial route SSR by setting specific route id , include remote provider

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Copy link

changeset-bot bot commented Aug 5, 2024

⚠️ No Changeset found

Latest commit: 5ec54c7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

netlify bot commented Aug 5, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 5ec54c7
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/672c23eecb0dd90008144e12
😎 Deploy Preview https://deploy-preview-2820--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@2heal1 2heal1 force-pushed the feat/data-loader branch 2 times, most recently from 1d849e7 to 494f102 Compare August 27, 2024 06:37
@2heal1 2heal1 force-pushed the feat/data-loader branch 2 times, most recently from 86cee8a to 120fa83 Compare September 6, 2024 06:30
Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This pull request introduces a new feature to support server-side rendering (SSR) data loading. The key changes include:

  • Adds a new console log statement in the packages/runtime/src/index.ts file to log the runtime initialization process, including the name of the federation instance and whether an instance already exists. This provides better visibility into the runtime initialization process.
  • Integrates the new data loader functionality with the existing codebase, ensuring seamless compatibility and enabling server-side rendering of data.
  • The new feature is expected to improve the overall performance and user experience of the application by allowing data to be loaded on the server-side, reducing the initial load time for the client.
File Summaries
File Summary
packages/runtime/src/index.ts The code changes introduce a new console log statement to log the runtime initialization process, including the name of the federation instance and whether an instance already exists.

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incremental Review

Comments posted: 0

Configuration

Squadron Mode: essential

Commits Reviewed

9b6fc42d20d2a775def3419fb1ec0ec908346c95...4b7e155b668cba969b248fcb7cb62070f5d593a5

Files Reviewed
  • packages/sdk/src/types/plugins/ModuleFederationPlugin.ts
Files Ignored

These files were ignored due to the filter in the squadron.yaml file.

  • apps/modernjs-ssr-data-loader/host/CHANGELOG.md
  • apps/modernjs-ssr-data-loader/host/modern.config.ts
  • apps/modernjs-ssr-data-loader/host/module-federation.config.ts
  • apps/modernjs-ssr-data-loader/host/package.json
  • apps/modernjs-ssr-data-loader/host/project.json
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/Content.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/stuff.module.css
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/stuff.module.css.d.ts
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/index.css
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/pathname/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/pathname/mf.json
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/federation/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/federation/mf.json
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/modern-app-env.d.ts
  • apps/modernjs-ssr-data-loader/host/tsconfig.app.json
  • apps/modernjs-ssr-data-loader/host/tsconfig.json
  • apps/modernjs-ssr-data-loader/host/tsconfig.spec.json
  • apps/modernjs-ssr-data-loader/remote/CHANGELOG.md
  • apps/modernjs-ssr-data-loader/remote/modern.config.ts
  • apps/modernjs-ssr-data-loader/remote/module-federation.config.ts
  • apps/modernjs-ssr-data-loader/remote/package.json
  • apps/modernjs-ssr-data-loader/remote/project.json
  • apps/modernjs-ssr-data-loader/remote/src/.eslintrc.js
  • apps/modernjs-ssr-data-loader/remote/src/components/Button.tsx
  • apps/modernjs-ssr-data-loader/remote/src/components/Image.tsx
  • apps/modernjs-ssr-data-loader/remote/src/components/stuff.module.css
  • apps/modernjs-ssr-data-loader/remote/src/components/stuff.module.css.d.ts
  • apps/modernjs-ssr-data-loader/remote/src/modern-app-env.d.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/a/page.data.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/a/page.tsx
  • apps/modernjs-ssr-data-loader/remote/src/routes/index.css
  • apps/modernjs-ssr-data-loader/remote/src/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/remote/src/routes/page.data.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/page.tsx
  • apps/modernjs-ssr-data-loader/remote/tsconfig.app.json
  • apps/modernjs-ssr-data-loader/remote/tsconfig.json
  • apps/modernjs-ssr-data-loader/remote/tsconfig.spec.json
  • apps/modernjs-ssr/dynamic-nested-remote/package.json
  • apps/modernjs-ssr/dynamic-remote-new-version/package.json
  • apps/modernjs-ssr/dynamic-remote/package.json
  • apps/modernjs-ssr/host/package.json
  • apps/modernjs-ssr/nested-remote/package.json
  • apps/modernjs-ssr/remote-new-version/package.json
  • apps/modernjs-ssr/remote/package.json
  • packages/modernjs/package.json
  • packages/modernjs/src/cli/configPlugin.ts
  • packages/modernjs/src/cli/dataLoader/ast/constant.ts
  • packages/modernjs/src/cli/dataLoader/ast/generateRoutes.ts
  • packages/modernjs/src/cli/dataLoader/ast/index.ts
  • packages/modernjs/src/cli/dataLoader/generateRouteFile.ts
  • packages/modernjs/src/cli/dataLoader/patchMFConfig.ts
  • packages/modernjs/src/cli/dataLoader/plugin.ts
  • packages/modernjs/src/cli/index.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/inject-node-fetch.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/node.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/resolve-entry-ipv4.ts
  • packages/modernjs/src/cli/server/dataLoaderPlugin.ts
  • packages/modernjs/src/cli/server/fetchRemoteFullRoutesMap.ts
  • packages/modernjs/src/cli/ssrPlugin.ts
  • packages/modernjs/src/cli/utils.spec.ts
  • packages/modernjs/src/cli/utils.ts
  • packages/modernjs/src/constant.ts
  • packages/modernjs/src/interfaces/route.ts
  • packages/modernjs/src/runtime/dataLoader/plugin.tsx
  • packages/modernjs/src/runtime/dataLoader/utils.ts
  • packages/modernjs/src/runtime/index.ts
  • packages/modernjs/src/runtime/utils.ts
  • packages/modernjs/src/runtime/withMFRouteId.ts
  • packages/modernjs/src/ssr-runtime/plugin.tsx
  • packages/modernjs/src/types/index.ts
  • pnpm-lock.yaml
  • pnpm-workspace.yaml

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incremental Review

Comments posted: 1

Configuration

Squadron Mode: essential

Commits Reviewed

3ffd8ff5fbfc0511411dddc69fb3c46a7589957e...0d1b3504147a1c60b3abdcb7098c1c12610fec8b

Files Reviewed
  • packages/runtime/src/index.ts
Files Ignored

These files were ignored due to the filter in the squadron.yaml file.

  • apps/modernjs-ssr-data-loader/host/CHANGELOG.md
  • apps/modernjs-ssr-data-loader/host/modern.config.ts
  • apps/modernjs-ssr-data-loader/host/module-federation.config.ts
  • apps/modernjs-ssr-data-loader/host/package.json
  • apps/modernjs-ssr-data-loader/host/project.json
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/Content.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/stuff.module.css
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/stuff.module.css.d.ts
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/index.css
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/pathname/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/pathname/mf.json
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/federation/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/federation/mf.json
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/modern-app-env.d.ts
  • apps/modernjs-ssr-data-loader/host/tsconfig.app.json
  • apps/modernjs-ssr-data-loader/host/tsconfig.json
  • apps/modernjs-ssr-data-loader/host/tsconfig.spec.json
  • apps/modernjs-ssr-data-loader/remote/CHANGELOG.md
  • apps/modernjs-ssr-data-loader/remote/modern.config.ts
  • apps/modernjs-ssr-data-loader/remote/module-federation.config.ts
  • apps/modernjs-ssr-data-loader/remote/package.json
  • apps/modernjs-ssr-data-loader/remote/project.json
  • apps/modernjs-ssr-data-loader/remote/src/.eslintrc.js
  • apps/modernjs-ssr-data-loader/remote/src/components/Button.tsx
  • apps/modernjs-ssr-data-loader/remote/src/components/Image.tsx
  • apps/modernjs-ssr-data-loader/remote/src/components/stuff.module.css
  • apps/modernjs-ssr-data-loader/remote/src/components/stuff.module.css.d.ts
  • apps/modernjs-ssr-data-loader/remote/src/modern-app-env.d.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/a/page.data.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/a/page.tsx
  • apps/modernjs-ssr-data-loader/remote/src/routes/index.css
  • apps/modernjs-ssr-data-loader/remote/src/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/remote/src/routes/page.data.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/page.tsx
  • apps/modernjs-ssr-data-loader/remote/tsconfig.app.json
  • apps/modernjs-ssr-data-loader/remote/tsconfig.json
  • apps/modernjs-ssr-data-loader/remote/tsconfig.spec.json
  • apps/modernjs-ssr/dynamic-nested-remote/package.json
  • apps/modernjs-ssr/dynamic-remote-new-version/package.json
  • apps/modernjs-ssr/dynamic-remote/package.json
  • apps/modernjs-ssr/host/package.json
  • apps/modernjs-ssr/nested-remote/package.json
  • apps/modernjs-ssr/remote-new-version/package.json
  • apps/modernjs-ssr/remote/package.json
  • packages/modernjs/package.json
  • packages/modernjs/src/cli/configPlugin.ts
  • packages/modernjs/src/cli/dataLoader/ast/constant.ts
  • packages/modernjs/src/cli/dataLoader/ast/generateRoutes.ts
  • packages/modernjs/src/cli/dataLoader/ast/index.ts
  • packages/modernjs/src/cli/dataLoader/clearMFCache.ts
  • packages/modernjs/src/cli/dataLoader/generateRouteFile.ts
  • packages/modernjs/src/cli/dataLoader/patchMFConfig.ts
  • packages/modernjs/src/cli/dataLoader/plugin.ts
  • packages/modernjs/src/cli/index.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/node-fetch.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/node.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/resolve-entry-ipv4.ts
  • packages/modernjs/src/cli/server/dataLoaderPlugin.ts
  • packages/modernjs/src/cli/server/fetchRemoteFullRoutesMap.ts
  • packages/modernjs/src/cli/ssrPlugin.ts
  • packages/modernjs/src/cli/utils.spec.ts
  • packages/modernjs/src/cli/utils.ts
  • packages/modernjs/src/constant.ts
  • packages/modernjs/src/global.d.ts
  • packages/modernjs/src/interfaces/route.ts
  • packages/modernjs/src/runtime/dataLoader/plugin-inject-assets.tsx
  • packages/modernjs/src/runtime/dataLoader/plugin.tsx
  • packages/modernjs/src/runtime/dataLoader/utils.ts
  • packages/modernjs/src/runtime/index.ts
  • packages/modernjs/src/runtime/withMFRouteId.ts
  • packages/modernjs/src/ssr-runtime/plugin.tsx
  • packages/modernjs/src/types/index.ts
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • webpack/types.d.ts

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incremental Review

Comments posted: 0

Configuration

Squadron Mode: essential

Commits Reviewed

13975e1793d1e1eda4b3aed0ed919fddcff02aaf...25e106b347f8adb299a4dbd0f090fe3789c589ce

Files Reviewed
  • packages/runtime/src/index.ts
Files Ignored

These files were ignored due to the filter in the squadron.yaml file.

  • apps/modernjs-ssr-data-loader/host/CHANGELOG.md
  • apps/modernjs-ssr-data-loader/host/modern.config.ts
  • apps/modernjs-ssr-data-loader/host/module-federation.config.ts
  • apps/modernjs-ssr-data-loader/host/package.json
  • apps/modernjs-ssr-data-loader/host/project.json
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/Content.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/stuff.module.css
  • apps/modernjs-ssr-data-loader/host/src/entry-one/components/stuff.module.css.d.ts
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/index.css
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/pathname/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/nested-routes/pathname/mf.json
  • apps/modernjs-ssr-data-loader/host/src/entry-one/routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/federation/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/federation/mf.json
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/host/src/entry-two/routes/page.tsx
  • apps/modernjs-ssr-data-loader/host/src/modern-app-env.d.ts
  • apps/modernjs-ssr-data-loader/host/tsconfig.app.json
  • apps/modernjs-ssr-data-loader/host/tsconfig.json
  • apps/modernjs-ssr-data-loader/host/tsconfig.spec.json
  • apps/modernjs-ssr-data-loader/remote/CHANGELOG.md
  • apps/modernjs-ssr-data-loader/remote/modern.config.ts
  • apps/modernjs-ssr-data-loader/remote/module-federation.config.ts
  • apps/modernjs-ssr-data-loader/remote/package.json
  • apps/modernjs-ssr-data-loader/remote/project.json
  • apps/modernjs-ssr-data-loader/remote/src/.eslintrc.js
  • apps/modernjs-ssr-data-loader/remote/src/components/Button.tsx
  • apps/modernjs-ssr-data-loader/remote/src/components/Image.tsx
  • apps/modernjs-ssr-data-loader/remote/src/components/stuff.module.css
  • apps/modernjs-ssr-data-loader/remote/src/components/stuff.module.css.d.ts
  • apps/modernjs-ssr-data-loader/remote/src/modern-app-env.d.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/a/page.data.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/a/page.tsx
  • apps/modernjs-ssr-data-loader/remote/src/routes/index.css
  • apps/modernjs-ssr-data-loader/remote/src/routes/layout.tsx
  • apps/modernjs-ssr-data-loader/remote/src/routes/page.data.ts
  • apps/modernjs-ssr-data-loader/remote/src/routes/page.tsx
  • apps/modernjs-ssr-data-loader/remote/tsconfig.app.json
  • apps/modernjs-ssr-data-loader/remote/tsconfig.json
  • apps/modernjs-ssr-data-loader/remote/tsconfig.spec.json
  • apps/modernjs-ssr/dynamic-nested-remote/package.json
  • apps/modernjs-ssr/dynamic-remote-new-version/package.json
  • apps/modernjs-ssr/dynamic-remote/package.json
  • apps/modernjs-ssr/host/package.json
  • apps/modernjs-ssr/nested-remote/package.json
  • apps/modernjs-ssr/remote-new-version/package.json
  • apps/modernjs-ssr/remote/package.json
  • packages/modernjs/package.json
  • packages/modernjs/src/cli/configPlugin.ts
  • packages/modernjs/src/cli/dataLoader/ast/constant.ts
  • packages/modernjs/src/cli/dataLoader/ast/generateRoutes.ts
  • packages/modernjs/src/cli/dataLoader/ast/index.ts
  • packages/modernjs/src/cli/dataLoader/clearMFCache.ts
  • packages/modernjs/src/cli/dataLoader/generateRouteFile.ts
  • packages/modernjs/src/cli/dataLoader/patchMFConfig.ts
  • packages/modernjs/src/cli/dataLoader/plugin.ts
  • packages/modernjs/src/cli/index.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/node-fetch.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/node.ts
  • packages/modernjs/src/cli/mfRuntimePlugins/resolve-entry-ipv4.ts
  • packages/modernjs/src/cli/server/dataLoaderPlugin.ts
  • packages/modernjs/src/cli/server/fetchRemoteFullRoutesMap.ts
  • packages/modernjs/src/cli/ssrPlugin.ts
  • packages/modernjs/src/cli/utils.spec.ts
  • packages/modernjs/src/cli/utils.ts
  • packages/modernjs/src/constant.ts
  • packages/modernjs/src/global.d.ts
  • packages/modernjs/src/interfaces/route.ts
  • packages/modernjs/src/runtime/dataLoader/plugin-inject-assets.tsx
  • packages/modernjs/src/runtime/dataLoader/plugin.tsx
  • packages/modernjs/src/runtime/dataLoader/utils.ts
  • packages/modernjs/src/runtime/index.ts
  • packages/modernjs/src/runtime/withMFRouteId.ts
  • packages/modernjs/src/ssr-runtime/plugin.tsx
  • packages/modernjs/src/types/index.ts
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • webpack/types.d.ts

@2heal1 2heal1 force-pushed the feat/data-loader branch 2 times, most recently from b09a7f5 to b319a4e Compare September 19, 2024 06:56
@2heal1 2heal1 force-pushed the feat/data-loader branch 2 times, most recently from 9d56403 to d445dfc Compare September 30, 2024 08:27
@module-federation module-federation deleted a comment from squadronai bot Oct 8, 2024
@2heal1 2heal1 changed the title WIP: feat: support SSR data loader feat: support SSR data loader Oct 11, 2024
@2heal1 2heal1 force-pushed the feat/data-loader branch 2 times, most recently from d9242ab to aed4556 Compare October 16, 2024 07:56
@2heal1
Copy link
Member Author

2heal1 commented Dec 20, 2024

it will be merged in next two weeks

@2heal1 2heal1 changed the title feat: support SSR data loader WIP: feat: support SSR data loader Dec 20, 2024
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