diff --git a/.changeset/clean-lemons-perform.md b/.changeset/clean-lemons-perform.md new file mode 100644 index 00000000000..fd9bce1aa87 --- /dev/null +++ b/.changeset/clean-lemons-perform.md @@ -0,0 +1,6 @@ +--- +'@module-federation/native-federation-typescript': minor +'@module-federation/native-federation-tests': minor +--- + +feat: rolldown support diff --git a/package.json b/package.json index 59995bea348..578d39ddf79 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "tsup": "7.2.0", "typedoc": "0.25.8", "undici": "5.28.3", - "unplugin": "1.7.1" + "unplugin": "1.9.0" }, "devDependencies": { "@antora/cli": "3.1.5", diff --git a/packages/native-federation-tests/README.md b/packages/native-federation-tests/README.md index a4e79566401..ef5b4253cea 100644 --- a/packages/native-federation-tests/README.md +++ b/packages/native-federation-tests/README.md @@ -177,6 +177,29 @@ module.exports = {
+
+Rolldown
+ +```ts +// rolldown.config.js +const { NativeFederationTestsHost, NativeFederationTestsRemote } = require('@module-federation/native-federation-tests/rolldown'); + +export default { + /* ... */ + plugins: [ + NativeFederationTestsRemote({ + /* options */ + }), + NativeFederationTestsHost({ + /* options */ + }), + ], +}; +``` + +
+
+ ## Examples 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). diff --git a/packages/native-federation-tests/package.json b/packages/native-federation-tests/package.json index a7ae68c1f93..881561992b6 100644 --- a/packages/native-federation-tests/package.json +++ b/packages/native-federation-tests/package.json @@ -57,6 +57,6 @@ "axios": "^1.6.7", "rambda": "^9.1.0", "tsup": "^7.0.0", - "unplugin": "^1.7.1" + "unplugin": "^1.9.0" } } diff --git a/packages/native-federation-tests/src/rolldown.ts b/packages/native-federation-tests/src/rolldown.ts new file mode 100644 index 00000000000..b2c9afa0308 --- /dev/null +++ b/packages/native-federation-tests/src/rolldown.ts @@ -0,0 +1,7 @@ +import { + NativeFederationTestsHost as GeneralHost, + NativeFederationTestsRemote as GeneralRemote, +} from '.'; + +export const NativeFederationTestsRemote = GeneralRemote.rolldown; +export const NativeFederationTestsHost = GeneralHost.rolldown; diff --git a/packages/native-federation-tests/tsup.config.ts b/packages/native-federation-tests/tsup.config.ts index 4262940e288..91fb7e30e18 100644 --- a/packages/native-federation-tests/tsup.config.ts +++ b/packages/native-federation-tests/tsup.config.ts @@ -1,7 +1,14 @@ import { join } from 'path'; import { defineConfig } from 'tsup'; -const SUPPORTED_BUNDLERS = ['esbuild', 'rollup', 'vite', 'webpack', 'rspack']; +const SUPPORTED_BUNDLERS = [ + 'esbuild', + 'rollup', + 'vite', + 'webpack', + 'rspack', + 'rolldown', +]; export default defineConfig({ entry: [ diff --git a/packages/native-federation-typescript/README.md b/packages/native-federation-typescript/README.md index dfae0b32984..098aeb32c49 100644 --- a/packages/native-federation-typescript/README.md +++ b/packages/native-federation-typescript/README.md @@ -174,6 +174,28 @@ module.exports = {
+
+Rolldown
+ +```ts +// rolldown.config.js +import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/rolldown'; + +export default { + plugins: [ + NativeFederationTypeScriptRemote({ + /* options */ + }), + NativeFederationTypeScriptHost({ + /* options */ + }), + ], +}; +``` + +
+
+ ## TypeScript configuration To have the type definitions automatically found for imports, add paths to the `compilerOptions` in the `tsconfig.json`: diff --git a/packages/native-federation-typescript/package.json b/packages/native-federation-typescript/package.json index 129d0465654..48bf0e883ca 100644 --- a/packages/native-federation-typescript/package.json +++ b/packages/native-federation-typescript/package.json @@ -56,7 +56,7 @@ "ansi-colors": "^4.1.3", "axios": "^1.6.7", "rambda": "^9.1.0", - "unplugin": "^1.7.1" + "unplugin": "^1.9.0" }, "peerDependencies": { "typescript": "^4.9.0 || ^5.0.0", diff --git a/packages/native-federation-typescript/src/rolldown.ts b/packages/native-federation-typescript/src/rolldown.ts new file mode 100644 index 00000000000..08464a98cef --- /dev/null +++ b/packages/native-federation-typescript/src/rolldown.ts @@ -0,0 +1,7 @@ +import { + NativeFederationTypeScriptHost as GeneralHost, + NativeFederationTypeScriptRemote as GeneralRemote, +} from '.'; + +export const NativeFederationTypeScriptRemote = GeneralRemote.rolldown; +export const NativeFederationTypeScriptHost = GeneralHost.rolldown; diff --git a/packages/native-federation-typescript/tsup.config.ts b/packages/native-federation-typescript/tsup.config.ts index 5c1b1b77c36..242a5162339 100644 --- a/packages/native-federation-typescript/tsup.config.ts +++ b/packages/native-federation-typescript/tsup.config.ts @@ -1,7 +1,14 @@ import { join } from 'path'; import { defineConfig } from 'tsup'; -const SUPPORTED_BUNDLERS = ['esbuild', 'rollup', 'vite', 'webpack', 'rspack']; +const SUPPORTED_BUNDLERS = [ + 'esbuild', + 'rollup', + 'vite', + 'webpack', + 'rspack', + 'rolldown', +]; export default defineConfig({ entry: [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5afc34bb245..d0bd97604ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,8 +69,8 @@ importers: specifier: 5.28.3 version: 5.28.3 unplugin: - specifier: 1.7.1 - version: 1.7.1 + specifier: 1.9.0 + version: 1.9.0 devDependencies: '@antora/cli': specifier: 3.1.5 @@ -1212,8 +1212,8 @@ importers: specifier: ^7.0.0 version: 7.2.0(@swc/core@1.3.102)(postcss@8.4.35)(ts-node@10.9.1)(typescript@5.3.3) unplugin: - specifier: ^1.7.1 - version: 1.7.1 + specifier: ^1.9.0 + version: 1.9.0 packages/native-federation-typescript: dependencies: @@ -1233,8 +1233,8 @@ importers: specifier: ^4.9.0 || ^5.0.0 version: 5.3.3 unplugin: - specifier: ^1.7.1 - version: 1.7.1 + specifier: ^1.9.0 + version: 1.9.0 vue-tsc: specifier: ^1.0.24 version: 1.8.27(typescript@5.3.3) @@ -11636,7 +11636,7 @@ packages: resolution: {integrity: sha512-xTHv9BUh3bkDVCvcbmdfVF0/e96BdrEgqPJ3G3RmKbSzWLOkQ2U9yiPfHzT0KJWPhVwj12fjfZp0zunu+pcS6Q==} dependencies: '@storybook/csf-tools': 7.6.17 - unplugin: 1.7.1 + unplugin: 1.9.0 transitivePeerDependencies: - supports-color dev: true @@ -32317,8 +32317,9 @@ packages: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} - /unplugin@1.7.1: - resolution: {integrity: sha512-JqzORDAPxxs8ErLV4x+LL7bk5pk3YlcWqpSNsIkAZj972KzFZLClc/ekppahKkOczGkwIG6ElFgdOgOlK4tXZw==} + /unplugin@1.9.0: + resolution: {integrity: sha512-14PslvMY3gNbXnQtNIRB566Q057L5Fe7f5LDEamxVi0QQVxoz5hrveBwwZLcKyHtZ09ysmipxRRj5Lv+BGz2Iw==} + engines: {node: '>=14.0.0'} dependencies: acorn: 8.11.3 chokidar: 3.6.0 @@ -33176,7 +33177,7 @@ packages: '@types/ws': 8.5.10 ansi-html-community: 0.0.8 bonjour-service: 1.2.1 - chokidar: 3.5.3 + chokidar: 3.6.0 colorette: 2.0.20 compression: 1.7.4 connect-history-api-fallback: 2.0.0