Skip to content

Commit

Permalink
Merge branch 'main' into revert-chunk-integration
Browse files Browse the repository at this point in the history
# Conflicts:
#	pnpm-lock.yaml
  • Loading branch information
ScriptedAlchemy committed Apr 5, 2024
2 parents 7709196 + a7a148d commit 6d38429
Show file tree
Hide file tree
Showing 240 changed files with 11,781 additions and 3,329 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[
"@module-federation/runtime",
"@module-federation/enhanced",
"@module-federation/enhanced-rspack",
"@module-federation/rspack",
"@module-federation/webpack-bundler-runtime",
"@module-federation/sdk",
"@module-federation/runtime-tools",
Expand Down
6 changes: 0 additions & 6 deletions .changeset/happy-mugs-fail.md

This file was deleted.

11 changes: 0 additions & 11 deletions .changeset/late-mice-hope.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/light-tomatoes-camp.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pretty-olives-poke.md

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Build affected packages

on:
push:
branches: ['main']
pull_request:
branches: [main]

push:
branches: [main]

jobs:
main:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3
Expand Down
81 changes: 0 additions & 81 deletions .github/workflows/deploy-website.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .github/workflows/devtools.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Devtools

on:
push:
branches: ['main']
pull_request:
branches: [main]

push:
branches: [main]

env:
PLAYWRIGHT_BROWSERS_PATH: 0 # Places binaries to node_modules/@playwright/test

jobs:
main:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3
Expand All @@ -26,7 +25,7 @@ jobs:
- name: Setup Node.js 18
uses: actions/setup-node@v3
with:
node-version: '17'
node-version: '18'
cache: 'pnpm'

- name: Set Nx SHA
Expand All @@ -36,7 +35,7 @@ jobs:
run: pnpm install

- name: Run Affected Build
run: npx nx affected -t build --parallel=10 --exclude='*,!tag:package'
run: npx nx build --parallel=10 --exclude='*,!tag:package'

- name: Configuration xvfb
shell: bash
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ on:
schedule:
- cron: '0 0 * * *'

permissions:
contents: read

jobs:
close-issues:
if: github.repository == 'vitejs/vite'
issue-close-require:
permissions:
issues: write
runs-on: ubuntu-latest
if: github.repository == 'module-federation/universe'
steps:
- name: need reproduction
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need reproduction'
inactive-day: 5
body: |
As the issue was labelled with `need reproduction`, but no response in 5 days. This issue will be closed. Feel free to comment and reopen it if you have any further questions. For background, see [Why reproductions are required](https://antfu.me/posts/why-reproductions-are-required).
由于该 issue 被标记为 "需要重现",但在 5 天内没有回应,因此该 issue 将被关闭。如果你有任何进一步的问题,请随时发表评论并重新打开该 issue。背景请参考 [为什么需要最小重现](https://antfu.me/posts/why-reproductions-are-required-zh)。
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
*.md
!README.md
pnpm-lock.yaml
**/dist/**
**/dist/**
apps/website-new/docs
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"diffEditor.wordWrap": "on"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson)
Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson) Zhou Shaw (zhouxiao)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,34 @@

- Module Federation reuses common dependencies between modules as much as possible

[Learn more](https://module-federation.io/docs/en/mf-docs/0.2/getting-started/)
[Learn more](https://module-federation.io/)

## 🔥 What does universe offer?

The universe repository provides a set of tools to enhance module federation's capabilities. These include:

- [Next.js Module Federation](./packages/nextjs-mf)
- [Module Federation Runtime](https://module-federation.io/guide/basic/runtime.html)
- [Rspack Module Federation](https://module-federation.io/guide/basic/rspack.html)
- [Webpack Module Federation](https://module-federation.io/guide/basic/webpack.html)
- [Next.js Module Federation](https://module-federation.io/guide/framework/nextjs.html)

## 📚 Getting Started

To get started with Module Federation, see the [Quick Start](https://module-federation.io/guide/start/quick-start.html).


## 📦 Packages

Some of the underlying dependencies of the past are listed here, and [enhanced](https://module-federation.io/) access is recommended for direct use.

- [Node Module Federation](./packages/node)
- [Storybook addon for Module Federation](./packages/storybook-addon)
- [Native federation typescript](./packages/native-federation-typescript)
- [Utilities](./packages/utilities)

# 🧑‍💻 Community

Come and chat with us on [Discord](https://discord.com/invite/T8c6yAxkbv)! The Module federation team and users are active there, and we're always looking for contributions.
Come and chat with us on [Discussions](https://github.com/module-federation/universe/discussions)! The Module federation team and users are active there, and we're always looking for contributions.

# 🤝 Contribution

Expand Down
19 changes: 19 additions & 0 deletions apps/manifest-demo/3008-webpack-host/@mf-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { PackageType as PackageType_0,RemoteKeys as RemoteKeys_0 } from './manifest-provider/apis.d.ts';
import type { PackageType as PackageType_1,RemoteKeys as RemoteKeys_1 } from './js-entry-provider/apis.d.ts';
declare module "@module-federation/runtime" {
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
type PackageType<T, Y=any> = T extends RemoteKeys_0 ? PackageType_0<T> :
T extends RemoteKeys_1 ? PackageType_1<T> :
Y ;
export function loadRemote<T extends RemoteKeys,Y>(packageName: T): Promise<PackageType<T, Y>>;
export function loadRemote<T extends string,Y>(packageName: T): Promise<PackageType<T, Y>>;
}
declare module "@module-federation/runtime-tools" {
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
type PackageType<T, Y=any> = T extends RemoteKeys_0 ? PackageType_0<T> :
T extends RemoteKeys_1 ? PackageType_1<T> :
Y ;
export function loadRemote<T extends RemoteKeys,Y>(packageName: T): Promise<PackageType<T, Y>>;
export function loadRemote<T extends string,Y>(packageName: T): Promise<PackageType<T, Y>>;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './compiled-types/apps/manifest-demo/3012-rspack-js-entry-provider/src/App';
export { default } from './compiled-types/apps/manifest-demo/3012-rspack-js-entry-provider/src/App';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

export type RemoteKeys = 'js-entry-provider/Component';
type PackageType<T> = T extends 'js-entry-provider/Component' ? typeof import('js-entry-provider/Component') :any;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export default App;
declare function App(): import("react/jsx-runtime").JSX.Element;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: "async file";
export default _default;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './compiled-types/apps/manifest-demo/3011-rspack-manifest-provider/src/App';
export { default } from './compiled-types/apps/manifest-demo/3011-rspack-manifest-provider/src/App';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

export type RemoteKeys = 'manifest-provider/Component';
type PackageType<T> = T extends 'manifest-provider/Component' ? typeof import('manifest-provider/Component') :any;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export default App;
declare function App(): import("react/jsx-runtime").JSX.Element;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: "async file";
export default _default;
4 changes: 3 additions & 1 deletion apps/manifest-demo/3008-webpack-host/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const path = require('path');
const { registerPluginTSTranspiler } = require('nx/src/utils/nx-plugin.js');
registerPluginTSTranspiler();
const { ModuleFederationPlugin } = require('@module-federation/enhanced');
const {
ModuleFederationPlugin,
} = require('@module-federation/enhanced/webpack');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import png from '../../public/webpack.png';

export default function WebpackPng() {
return <img className="remote1-webpack-png" src={png} alt="webpack png" />;
return (
<div>
<img className="remote1-webpack-png" src={png} alt="webpack png" />
</div>
);
}
4 changes: 3 additions & 1 deletion apps/manifest-demo/3009-webpack-provider/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ registerPluginTSTranspiler();
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');

const { ModuleFederationPlugin } = require('@module-federation/enhanced');
const {
ModuleFederationPlugin,
} = require('@module-federation/enhanced/webpack');

module.exports = composePlugins(
withNx(),
Expand Down
10 changes: 10 additions & 0 deletions apps/modernjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @module-federation/modernjs

## 0.1.7

### Patch Changes

- Updated dependencies [c1efbbf]
- Updated dependencies [c8c0ad2]
- Updated dependencies [1bb03d1]
- Updated dependencies [1bb03d1]
- @module-federation/enhanced@0.1.2

## 0.1.6

### Patch Changes
Expand Down
7 changes: 6 additions & 1 deletion apps/modernjs/modern.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export default defineConfig({
exposes: {
'./thing': './src/test.ts',
},
runtimePlugins: ['./runtimePlugin.ts'],
runtimePlugins: [
{
import: './runtimePlugin.ts',
async: true,
},
],
shared: {
react: { singleton: true },
'react-dom': { singleton: true },
Expand Down
2 changes: 1 addition & 1 deletion apps/modernjs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@module-federation/modernjs",
"private": true,
"version": "0.1.6",
"version": "0.1.7",
"scripts": {
"reset": "npx rimraf ./**/node_modules",
"dev": "modern dev",
Expand Down
Loading

0 comments on commit 6d38429

Please sign in to comment.