Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Come and chat with us on [Discussions](https://github.com/module-federation/univ

Please read the [Contributing Guide](https://github.com/module-federation/core/blob/main/CONTRIBUTING.md).

![Alt](https://repobeats.axiom.co/api/embed/856dc1d4a6965d225232b1bd2da5d54549dc169e.svg "Repobeats analytics image")
![Alt](https://repobeats.axiom.co/api/embed/856dc1d4a6965d225232b1bd2da5d54549dc169e.svg 'Repobeats analytics image')

## 🙌 Code of Conduct

Expand Down
2 changes: 1 addition & 1 deletion apps/rslib-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nx serve rslib-module

Dev package

1.
1.

```
nx dev rslib-module
Expand Down
22 changes: 9 additions & 13 deletions packages/assemble-release-plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Assemble a release plan for changesets from data about a repository.
Usage

```ts
import assembleReleasePlan from "@changesets/assemble-release-plan";
import readChangesets from "@changesets/read";
import { read } from "@changesets/config";
import { getPackages } from "@manypkg/get-packages";
import { readPreState } from "@changesets/pre";
import assembleReleasePlan from '@changesets/assemble-release-plan';
import readChangesets from '@changesets/read';
import { read } from '@changesets/config';
import { getPackages } from '@manypkg/get-packages';
import { readPreState } from '@changesets/pre';

const packages = await getPackages(cwd);
const preState = await readPreState(cwd);
Expand All @@ -24,14 +24,10 @@ const releasePlan = assembleReleasePlan(changesets, packages, config, preState);
Signature

```ts
import { NewChangeset, Config, ReleasePlan } from "@changesets/types";
import { Packages } from "@manypkg/get-packages";

assembleReleasePlan = (
changesets: NewChangeset[],
packages: Packages,
config: Config
) => ReleasePlan;
import { NewChangeset, Config, ReleasePlan } from '@changesets/types';
import { Packages } from '@manypkg/get-packages';

assembleReleasePlan = (changesets: NewChangeset[], packages: Packages, config: Config) => ReleasePlan;
```

This package exists so assembling a release plan can be done without reading from disc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pnpm build

Dev package

1.
1.

```
pnpm mf-dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ pnpm build

Dev package


```
pnpm mf-dev
```

10 changes: 4 additions & 6 deletions packages/data-prefetch/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ export const prefetchPlugin = (): ModuleFederationRuntimePlugin => ({
return options;
}

// Check if prefetch is already initiated by initContainer
const inited = loadingArray.some((info) => info.id === id);
if (!inited) {
if (inited) {
// Prefetch already set up by initContainer, don't interfere
return options;
}

Expand All @@ -125,11 +127,7 @@ export const prefetchPlugin = (): ModuleFederationRuntimePlugin => ({
prefetchUrl = getResourceUrl(snapshot, snapshot.prefetchEntry as string);
}

const index = loadingArray.findIndex((loading) => loading.id === id);
// clear cache
if (index !== -1) {
loadingArray.splice(index, 1);
}
// Only set up prefetch if not already done by initContainer
const promise = instance.loadEntry(prefetchUrl).then(async () => {
const projectExports = instance!.getProjectExports();
if (projectExports instanceof Promise) {
Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild/src/adapters/lib/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const writeRemoteManifest = async (config: any, result: BuildResult) => {
const envType =
process.env['NODE_ENV'] === 'development'
? 'local'
: process.env['NODE_ENV'] ?? '';
: (process.env['NODE_ENV'] ?? '');
const publicPath = config.publicPath || 'auto';
let containerName: string = '';

Expand Down
6 changes: 4 additions & 2 deletions packages/rsbuild-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ npm install @module-federation/enhanced
```

### Rsbuild App
``` js

```js
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
Expand All @@ -34,7 +35,8 @@ export default defineConfig({
```

### Rslib Module
``` js

```js
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
import { defineConfig } from '@rslib/core';

Expand Down
2 changes: 1 addition & 1 deletion packages/rspress-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nx serve rslib-module

Dev package

1.
1.

```
nx dev rslib-module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `@module-federation/inject-external-runtime-core-plugin`
# `@module-federation/inject-external-runtime-core-plugin`

This runtime plugin will inject `@module-federation/runtime-core` .
This runtime plugin will inject `@module-federation/runtime-core` .

And the plugin will be automatic applied when set `experiments.externalRuntime: 'provide'` by build plugin.
And the plugin will be automatic applied when set `experiments.externalRuntime: 'provide'` by build plugin.

The provider can use host's runtime when set `experiments.externalRuntime: true`.
15 changes: 13 additions & 2 deletions tools/rslib-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ An Nx plugin that provides executors for building and developing with [Rslib](ht
Builds your library using Rslib.

**Options:**

- `configFile` (string): Path to the rslib config file (default: `rslib.config.ts`)
- `outputPath` (string): Output directory for build artifacts
- `watch` (boolean): Enable watch mode (default: `false`)
Expand Down Expand Up @@ -36,6 +37,7 @@ Builds your library using Rslib.
Runs Rslib in development mode with hot reloading.

**Options:**

- `configFile` (string): Path to the rslib config file (default: `rslib.config.ts`)
- `port` (number): Port to serve on (default: `3001`)
- `host` (string): Host to serve on (default: `localhost`)
Expand Down Expand Up @@ -65,25 +67,29 @@ Runs Rslib in development mode with hot reloading.
Simple echo executor for testing the plugin.

**Options:**

- `message` (string): Message to echo (default: `"Hello from rslib executor!"`)

## Usage

To use this plugin in your Nx workspace:

1. Install the required dependencies:

```bash
npm install @rslib/core
```

2. Register the plugin in your `nx.json`:

```json
{
"plugins": ["tools/rslib-plugin"]
}
```

3. Configure your project's `project.json` to use the rslib executors:

```json
{
"targets": {
Expand All @@ -98,6 +104,7 @@ To use this plugin in your Nx workspace:
```

4. Create an `rslib.config.ts` file in your project root:

```typescript
import { defineConfig } from '@rslib/core';

Expand All @@ -109,29 +116,33 @@ To use this plugin in your Nx workspace:
},
{
format: 'cjs',
}
},
],
});
```

## Examples

### Building a library

```bash
nx run my-lib:build
```

### Running in development mode

```bash
nx run my-lib:dev
```

### Building with custom config

```bash
nx run my-lib:build --configFile=custom.rslib.config.ts
```

### Running in watch mode

```bash
nx run my-lib:dev --mode=watch
```
Expand All @@ -158,4 +169,4 @@ This plugin supports Rslib's Module Federation capabilities. Use the `mf-dev` mo

- Nx >= 21.0.0
- @rslib/core >= 0.5.0
- Node.js >= 18.0.0
- Node.js >= 18.0.0
Loading