Skip to content

Commit 8941ef4

Browse files
authored
Feat/support farm (#2666)
1 parent 4978742 commit 8941ef4

File tree

10 files changed

+176
-51
lines changed

10 files changed

+176
-51
lines changed

.changeset/dry-shoes-kick.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@module-federation/native-federation-typescript': minor
3+
'@module-federation/native-federation-tests': minor
4+
---
5+
6+
feat: support for farm, drop support for node < 16

packages/native-federation-tests/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,28 @@ export default {
200200
<br>
201201
</details>
202202

203+
<details>
204+
<summary>Farm</summary><br>
205+
206+
```ts
207+
// farm.config.ts
208+
import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/farm';
209+
210+
const config: UserConfig = {
211+
plugins: [
212+
NativeFederationTestsRemote({
213+
/* options */
214+
}),
215+
NativeFederationTestsHost({
216+
/* options */
217+
}),
218+
]
219+
}
220+
```
221+
222+
<br>
223+
</details>
224+
203225
## Examples
204226

205227
To use it in a `host` module, refer to [this example](https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/host).

packages/native-federation-tests/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
"author": "Matteo Pietro Dazzi <[email protected]> (https://github.com/ilteoood)",
5353
"license": "MIT",
5454
"dependencies": {
55-
"adm-zip": "^0.5.10",
55+
"adm-zip": "^0.5.14",
5656
"ansi-colors": "^4.1.3",
57-
"axios": "^1.6.7",
58-
"rambda": "^9.1.0",
59-
"tsup": "^7.0.0",
60-
"unplugin": "^1.9.0"
57+
"axios": "^1.7.2",
58+
"rambda": "^9.2.1",
59+
"tsup": "^8.1.0",
60+
"unplugin": "^1.10.1"
6161
}
6262
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {
2+
NativeFederationTestsHost as GeneralHost,
3+
NativeFederationTestsRemote as GeneralRemote,
4+
} from '.';
5+
6+
export const NativeFederationTestsRemote = GeneralRemote.farm;
7+
export const NativeFederationTestsHost = GeneralHost.farm;

packages/native-federation-tests/tsup.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const SUPPORTED_BUNDLERS = [
88
'webpack',
99
'rspack',
1010
'rolldown',
11+
'farm',
1112
];
1213

1314
export default defineConfig({

packages/native-federation-typescript/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,28 @@ export default {
196196
<br>
197197
</details>
198198

199+
<details>
200+
<summary>Farm</summary><br>
201+
202+
```ts
203+
// farm.config.ts
204+
import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/farm';
205+
206+
const config: UserConfig = {
207+
plugins: [
208+
NativeFederationTypeScriptRemote({
209+
/* options */
210+
}),
211+
NativeFederationTypeScriptHost({
212+
/* options */
213+
}),
214+
]
215+
}
216+
```
217+
218+
<br>
219+
</details>
220+
199221
## TypeScript configuration
200222

201223
To have the type definitions automatically found for imports, add paths to the `compilerOptions` in the `tsconfig.json`:

packages/native-federation-typescript/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
"author": "Matteo Pietro Dazzi <[email protected]> (https://github.com/ilteoood)",
5353
"license": "MIT",
5454
"dependencies": {
55-
"adm-zip": "^0.5.10",
55+
"adm-zip": "^0.5.14",
5656
"ansi-colors": "^4.1.3",
57-
"axios": "^1.6.7",
58-
"rambda": "^9.1.0",
59-
"unplugin": "^1.9.0"
57+
"axios": "^1.7.2",
58+
"rambda": "^9.2.1",
59+
"unplugin": "^1.10.1"
6060
},
6161
"peerDependencies": {
6262
"typescript": "^4.9.0 || ^5.0.0",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {
2+
NativeFederationTypeScriptHost as GeneralHost,
3+
NativeFederationTypeScriptRemote as GeneralRemote,
4+
} from '.';
5+
6+
export const NativeFederationTypeScriptRemote = GeneralRemote.farm;
7+
export const NativeFederationTypeScriptHost = GeneralHost.farm;

packages/native-federation-typescript/tsup.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const SUPPORTED_BUNDLERS = [
88
'webpack',
99
'rspack',
1010
'rolldown',
11+
'farm',
1112
];
1213

1314
export default defineConfig({

0 commit comments

Comments
 (0)