Skip to content

Commit

Permalink
chore: format all files (#2982)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy authored Sep 22, 2024
1 parent 0bae844 commit b2bfa48
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 85 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ You can consider the module federation capabilities provided by this repository

## ✨ What new features does Module Federation provide?

* 🎨 Module Federation Runtime
* 🧩 Runtime Plugins System
* 📝 Manifest
* 🚀 Dynamic type prompt
* 🛠️ Chrome Devtool
- 🎨 Module Federation Runtime
- 🧩 Runtime Plugins System
- 📝 Manifest
- 🚀 Dynamic type prompt
- 🛠️ Chrome Devtool

## 📚 Getting Started

Expand Down
6 changes: 3 additions & 3 deletions apps/manifest-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

This example demos manifest

- `manifest-webpack-host` consumes remote and generate manifest.
- `3009-webpack-provider` exposes a blue button component and generate manifest.
- `3010-rspack-provider` exposes a red button component and generate manifest.
- `manifest-webpack-host` consumes remote and generate manifest.
- `3009-webpack-provider` exposes a blue button component and generate manifest.
- `3010-rspack-provider` exposes a red button component and generate manifest.
- `3011-rspack-manifest-provider`: expose component and generate manifest.
- `3012-rspack-js-entry-provider`: expose component and not generate manifest.

Expand Down
6 changes: 3 additions & 3 deletions apps/modernjs-ssr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

```bash
# Root directory
pnpm i
pnpm i

nx build modern-js-plugin
nx build modern-js-plugin

pnpm run app:modern:dev
pnpm run app:modern:dev

open http://localhost:3050/
```
6 changes: 3 additions & 3 deletions apps/router-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ open http://localhost:2100/

> Scenario description
* This demo mainly demonstrates how to use the mf bridge library to load a module with routing
* How to load modules between vue and react projects
- This demo mainly demonstrates how to use the mf bridge library to load a module with routing
- How to load modules between vue and react projects

## Test run

* nx e2e router-host-2000 --watch
- nx e2e router-host-2000 --watch
11 changes: 6 additions & 5 deletions apps/router-demo/router-host-2000/src/pages/Remote1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
type PackageType<T, R = any> = T extends RemoteKeys_0
? PackageType_0<T>
: T extends RemoteKeys_1
? PackageType_1<T>
: R;
? PackageType_1<T>
: R;
type GetType<T, Y extends keyof T> = T[Y];
type GetProvderComponentType<
T extends RemoteKeys,
Y extends keyof PackageType<T>,
> = GetType<PackageType<T>, Y> extends (...args: Array<any>) => any
? ReturnType<GetType<PackageType<T>, Y>>
: any;
> =
GetType<PackageType<T>, Y> extends (...args: Array<any>) => any
? ReturnType<GetType<PackageType<T>, Y>>
: any;

type GetObjectVal<
T extends Record<string, any>,
Expand Down
11 changes: 6 additions & 5 deletions apps/router-demo/router-host-v5-2200/src/pages/Remote1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
type PackageType<T, R = any> = T extends RemoteKeys_0
? PackageType_0<T>
: T extends RemoteKeys_1
? PackageType_1<T>
: R;
? PackageType_1<T>
: R;
type GetType<T, Y extends keyof T> = T[Y];
type GetProvderComponentType<
T extends RemoteKeys,
Y extends keyof PackageType<T>,
> = GetType<PackageType<T>, Y> extends (...args: Array<any>) => any
? ReturnType<GetType<PackageType<T>, Y>>
: any;
> =
GetType<PackageType<T>, Y> extends (...args: Array<any>) => any
? ReturnType<GetType<PackageType<T>, Y>>
: any;

type GetObjectVal<
T extends Record<string, any>,
Expand Down
7 changes: 2 additions & 5 deletions packages/bridge/bridge-react-webpack-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ React bridge is used to load the routing module in mf, so that the routing modul

> When to use
* Load the route module
* Load across the front end framework

- Load the route module
- Load across the front end framework

## How to use

Expand Down Expand Up @@ -130,5 +129,3 @@ root.render(
<App />
);
```
7 changes: 2 additions & 5 deletions packages/bridge/bridge-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ React bridge is used to load the routing module in mf, so that the routing modul

> When to use
* Load the route module
* Load across the front end framework

- Load the route module
- Load across the front end framework

## How to use

Expand Down Expand Up @@ -130,5 +129,3 @@ root.render(
<App />
);
```
6 changes: 3 additions & 3 deletions packages/bridge/bridge-shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
```js
// browser
localStorage.setItem('debug','true');
localStorage.setItem('debug:stack','true');
localStorage.setItem('debug', 'true');
localStorage.setItem('debug:stack', 'true');

// node
process.env.DEBUG = 'true';
```
```
5 changes: 3 additions & 2 deletions packages/chrome-devtools/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Module Federation Chrome Devtools

## Ability
* Proxy online Module Federation remote module to local
* Let proxied remote module get hmr

- Proxy online Module Federation remote module to local
- Let proxied remote module get hmr

https://module-federation.io/
4 changes: 2 additions & 2 deletions packages/esbuild/.swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
".*\\.spec.tsx?$",
".*\\.test.tsx?$",
"./src/jest-setup.ts$",
"./**/jest-setup.ts$",
// ".*.js$"
"./**/jest-setup.ts$"
// ".*.js$"
]
}
5 changes: 1 addition & 4 deletions packages/esbuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports = withFederation({
}),
},
});

```

The `moduleFederationPlugin` accepts a configuration object with the following properties:
Expand Down Expand Up @@ -110,7 +109,5 @@ Creates an esbuild plugin for Module Federation.
- `remotes` (object, optional): An object specifying the remote applications and their entry points.
- `exposes` (object, optional): An object specifying the modules to be exposed by the host application.
- `shared` (array, optional): An array of package names to be shared between the host and remote applications.

Returns an esbuild plugin instance.


Returns an esbuild plugin instance.
4 changes: 2 additions & 2 deletions packages/esbuild/src/adapters/lib/commonjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export function commonjs({
typeof ignore === 'function'
? ignore
: Array.isArray(ignore)
? (path: string) => ignore.includes(path)
: () => false;
? (path: string) => ignore.includes(path)
: () => false;

return {
name: 'commonjs',
Expand Down
9 changes: 4 additions & 5 deletions packages/manifest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ containerManager.init(options);
options.exposes = containerManager.containerPluginExposesOptions;
```

2. use StatsPlugin in webpack.config.js
2. use StatsPlugin in webpack.config.js

```js
import { StatsPlugin } from '@module-federation/manifest';

new StatsPlugin(mfOptions, {
pluginVersion: pkg.version,
bundler: 'webpack',
}).apply(compiler);

pluginVersion: pkg.version,
bundler: 'webpack',
}).apply(compiler);
```
4 changes: 2 additions & 2 deletions packages/native-federation-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ const config: UserConfig = {
NativeFederationTestsHost({
/* options */
}),
]
}
],
};
```

<br>
Expand Down
4 changes: 2 additions & 2 deletions packages/native-federation-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ const config: UserConfig = {
NativeFederationTypeScriptHost({
/* options */
}),
]
}
],
};
```

<br>
Expand Down
14 changes: 7 additions & 7 deletions packages/nextjs-mf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,26 +277,26 @@ new NextFederationPlugin({

Ive added a util for dynamic chunk loading, in the event you need to load remote containers dynamically.


```js
import { loadRemote, init } from '@module-federation/runtime';
// if i have remotes in my federation plugin, i can pass the name of the remote
loadRemote('home/exposedModule')
loadRemote('home/exposedModule');
// if i want to load a custom remote not known at build time.
init({
name: 'hostname',
remotes: [
{
name: 'home',
entry: 'http://somthing.com/remoteEntry.js'
}
entry: 'http://somthing.com/remoteEntry.js',
},
],
force: true // may be needed to sideload remotes after the fact.
})
loadRemote('home/exposedModule')
force: true, // may be needed to sideload remotes after the fact.
});
loadRemote('home/exposedModule');
```

**revalidate**

### Hot Reloading with `revalidate` in Production Environments

In production environments, ensuring that your server can dynamically reload and update without requiring a full restart is crucial for maintaining uptime and providing the latest features to your users without disruption. The `revalidate` utility from `@module-federation/nextjs-mf/utils` facilitates this by enabling hot reloading of the node server (not the client). This section outlines two implementations for integrating `revalidate` into your Next.js application to leverage hot reloading capabilities.
Expand Down
38 changes: 18 additions & 20 deletions packages/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,50 +35,48 @@ yarn add @module-federation/node
## 🚀 Usage

There are two approaches to using the plugins exported from this package, dependent on your use case.

### Use as Runtime Plugin

`module-federation/enhanced` supports runtime plugins.
`module-federation/enhanced` supports runtime plugins.

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

const options = {
target: 'async-node',
output: {
chunkFilename: '[id]-[chunkhash].js' // important to hash chunks
chunkFilename: '[id]-[chunkhash].js', // important to hash chunks
},
plugins: [
new ModuleFederationPlugin({
name: 'app1',
exposes: {},
remotes: {
app2: 'app2@http://'
app2: 'app2@http://',
},
runtimePlugins: [
require.resolve('@module-federation/node/runtimePlugin')
],
runtimePlugins: [require.resolve('@module-federation/node/runtimePlugin')],
remoteType: 'script',
library: { type: 'commonjs-module', name: 'app1' }
})
]
library: { type: 'commonjs-module', name: 'app1' },
}),
],
};

```

or you can enable it with some presets via UniversalFederation

```js
new UniversalFederationPlugin({
name: 'website2',
library: { type: 'commonjs-module' },
isServer: true, // or false
remotes: {},
filename: 'remoteEntry.js',
useRuntimePlugin: true, // uses the module-federation/enhanced runtime plugin api
exposes: {
'./SharedComponent': './remoteServer/SharedComponent',
},
})
name: 'website2',
library: { type: 'commonjs-module' },
isServer: true, // or false
remotes: {},
filename: 'remoteEntry.js',
useRuntimePlugin: true, // uses the module-federation/enhanced runtime plugin api
exposes: {
'./SharedComponent': './remoteServer/SharedComponent',
},
});
```

### UniversalFederationPlugin
Expand Down
2 changes: 0 additions & 2 deletions packages/retry-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export default defineConfig({

```



## Documentation

See [https://module-federation.io/plugin/plugins/retry-plugin.html](https://module-federation.io/plugin/plugins/retry-plugin.html) for details.
Expand Down

0 comments on commit b2bfa48

Please sign in to comment.