create-module-federation 0.0.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -0
  3. package/dist/LICENSE +21 -0
  4. package/dist/index.js +366 -0
  5. package/package.json +44 -8
  6. package/templates/consumer-modern-ts/modern.config.ts +15 -0
  7. package/templates/consumer-modern-ts/module-federation.config.ts.handlebars +12 -0
  8. package/templates/consumer-modern-ts/src/routes/page.tsx +21 -0
  9. package/templates/consumer-rsbuild-ts/module-federation.config.ts.handlebars +12 -0
  10. package/templates/consumer-rsbuild-ts/rsbuild.config.ts +8 -0
  11. package/templates/consumer-rsbuild-ts/src/App.tsx +12 -0
  12. package/templates/lib-common/module-federation.config.ts.handlebars +17 -0
  13. package/templates/lib-common/rslib.config.ts +52 -0
  14. package/templates/lib-common/src/index.css +53 -0
  15. package/templates/lib-common/src/index.tsx +19 -0
  16. package/templates/lib-common/tsconfig.json +14 -0
  17. package/templates/modern-common/.browserslistrc +5 -0
  18. package/templates/modern-common/.nvmrc +1 -0
  19. package/templates/modern-common/.vscode/extensions.json +14 -0
  20. package/templates/modern-common/.vscode/settings.json +88 -0
  21. package/templates/modern-common/README.md +37 -0
  22. package/templates/modern-common/biome.json +34 -0
  23. package/templates/modern-common/package.json.handlebars +45 -0
  24. package/templates/modern-common/src/modern-app-env.d.ts +3 -0
  25. package/templates/modern-common/src/modern.runtime.ts +3 -0
  26. package/templates/modern-common/src/routes/index.css +41 -0
  27. package/templates/modern-common/src/routes/layout.tsx +9 -0
  28. package/templates/modern-common/tsconfig.json +15 -0
  29. package/templates/provider-modern-ts/modern.config.ts +18 -0
  30. package/templates/provider-modern-ts/module-federation.config.ts.handlebars +12 -0
  31. package/templates/provider-modern-ts/src/components/ProviderComponent.css +52 -0
  32. package/templates/provider-modern-ts/src/components/ProviderComponent.tsx +19 -0
  33. package/templates/provider-modern-ts/src/routes/page.tsx +21 -0
  34. package/templates/provider-rsbuild-ts/module-federation.config.ts.handlebars +12 -0
  35. package/templates/provider-rsbuild-ts/rsbuild.config.ts +11 -0
  36. package/templates/provider-rsbuild-ts/src/App.tsx +12 -0
  37. package/templates/provider-rsbuild-ts/src/components/ProviderComponent.css +52 -0
  38. package/templates/provider-rsbuild-ts/src/components/ProviderComponent.tsx +19 -0
  39. package/templates/provider-rslib-storybook-ts/.storybook/main.ts.handlebars +41 -0
  40. package/templates/provider-rslib-storybook-ts/README.md +27 -0
  41. package/templates/provider-rslib-storybook-ts/package.json.handlebars +50 -0
  42. package/templates/provider-rslib-storybook-ts/stories/Index.stories.tsx +11 -0
  43. package/templates/provider-rslib-ts/README.md +19 -0
  44. package/templates/provider-rslib-ts/package.json.handlebars +35 -0
  45. package/templates/rsbuild-common/README.md +29 -0
  46. package/templates/rsbuild-common/package.json.handlebars +22 -0
  47. package/templates/rsbuild-common/public/.gitkeep +0 -0
  48. package/templates/rsbuild-common/src/App.css +15 -0
  49. package/templates/rsbuild-common/src/bootstrap.tsx +13 -0
  50. package/templates/rsbuild-common/src/env.d.ts +1 -0
  51. package/templates/rsbuild-common/src/index.tsx +1 -0
  52. package/templates/rsbuild-common/tsconfig.json +26 -0
@@ -0,0 +1,27 @@
1
+ # Rslib MF Project
2
+
3
+ This example demonstrates how to use Rslib to build a simple Module Federation React component.
4
+
5
+ ### Command
6
+
7
+ Build package
8
+
9
+ ```
10
+ pnpm build
11
+ ```
12
+
13
+ Dev package
14
+
15
+ 1.
16
+
17
+ ```
18
+ pnpm mf-dev
19
+ ```
20
+
21
+ 2.
22
+
23
+ ```
24
+ pnpm storybook
25
+ ```
26
+
27
+ visit http://localhost:6006
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "{{ mfName }}",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "rslib build",
18
+ "build:storybook": "storybook build",
19
+ "dev": "rslib build --watch",
20
+ "storybook": "storybook dev -p 6006",
21
+ "mf-dev": "rslib mf-dev"
22
+ },
23
+ "devDependencies": {
24
+ "@rsbuild/core": "^1.2.15",
25
+ "@rsbuild/plugin-react": "^1.1.1",
26
+ "@rslib/core": ">=0.5.3",
27
+ "@storybook/addon-essentials": "^8.4.7",
28
+ "@storybook/addon-interactions": "^8.4.7",
29
+ "@storybook/addon-links": "^8.4.7",
30
+ "@storybook/addon-onboarding": "^8.4.7",
31
+ "@storybook/blocks": "^8.4.7",
32
+ "@storybook/react": "^8.4.7",
33
+ "@storybook/test": "^8.4.7",
34
+ "@types/react": "^18.3.11",
35
+ "@types/react-dom": "~18.3.1",
36
+ "react": "^18.3.1",
37
+ "react-dom": "^18.3.1",
38
+ "storybook": "^8.4.7",
39
+ "storybook-addon-rslib": "^0.1.7",
40
+ "storybook-react-rsbuild": "^0.1.7",
41
+ "typescript": "^5.7.3",
42
+ "@types/node": "^22.13.9",
43
+ "@module-federation/rsbuild-plugin":"^{{mfVersion}}",
44
+ "@module-federation/storybook-addon":"^4.0.1"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=16.9.0",
48
+ "react-dom": ">=16.9.0"
49
+ }
50
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Provider from 'provider';
3
+
4
+ const Component = () => <Provider />;
5
+
6
+ export default {
7
+ title: 'Provider Component',
8
+ component: Component,
9
+ };
10
+
11
+ export const Basic = {};
@@ -0,0 +1,19 @@
1
+ # Rslib MF Project
2
+
3
+ This example demonstrates how to use Rslib to build a simple Module Federation React component.
4
+
5
+ ### Command
6
+
7
+ Build package
8
+
9
+ ```
10
+ pnpm build
11
+ ```
12
+
13
+ Dev package
14
+
15
+
16
+ ```
17
+ pnpm mf-dev
18
+ ```
19
+
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "{{ mfName }}",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "rslib build",
18
+ "dev": "rslib build --watch",
19
+ "mf-dev": "rslib mf-dev"
20
+ },
21
+ "devDependencies": {
22
+ "@rsbuild/core": "^1.2.15",
23
+ "@rsbuild/plugin-react": "^1.1.1",
24
+ "@rslib/core": ">=0.5.3",
25
+ "@types/react": "^18.3.11",
26
+ "react": "^18.3.1",
27
+ "typescript": "^5.7.3",
28
+ "@types/node": "^22.13.9",
29
+ "@module-federation/rsbuild-plugin":"^{{mfVersion}}"
30
+ },
31
+ "peerDependencies": {
32
+ "react": ">=16.9.0",
33
+ "react-dom": ">=16.9.0"
34
+ }
35
+ }
@@ -0,0 +1,29 @@
1
+ # Rsbuild Project
2
+
3
+ ## Setup
4
+
5
+ Install the dependencies:
6
+
7
+ ```bash
8
+ pnpm install
9
+ ```
10
+
11
+ ## Get Started
12
+
13
+ Start the dev server:
14
+
15
+ ```bash
16
+ pnpm dev
17
+ ```
18
+
19
+ Build the app for production:
20
+
21
+ ```bash
22
+ pnpm build
23
+ ```
24
+
25
+ Preview the production build locally:
26
+
27
+ ```bash
28
+ pnpm preview
29
+ ```
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "{{ mfName }}",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev --open",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "react": "^18.3.1",
12
+ "react-dom": "^18.3.1"
13
+ },
14
+ "devDependencies": {
15
+ "@rsbuild/core": "^1.2.15",
16
+ "@rsbuild/plugin-react": "^1.1.1",
17
+ "@types/react": "^18.3.11",
18
+ "@types/react-dom": "~18.3.1",
19
+ "typescript": "^5.7.2",
20
+ "@module-federation/rsbuild-plugin":"^{{mfVersion}}"
21
+ }
22
+ }
File without changes
@@ -0,0 +1,15 @@
1
+ body {
2
+ margin: 0;
3
+ color: #fff;
4
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
5
+ background-image: linear-gradient(to bottom, #020917, #101725);
6
+ }
7
+
8
+ .content {
9
+ display: flex;
10
+ min-height: 100vh;
11
+ line-height: 1.1;
12
+ text-align: center;
13
+ flex-direction: column;
14
+ justify-content: center;
15
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import App from './App';
4
+
5
+ const rootEl = document.getElementById('root');
6
+ if (rootEl) {
7
+ const root = ReactDOM.createRoot(rootEl);
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>,
12
+ );
13
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="@rsbuild/core/types" />
@@ -0,0 +1 @@
1
+ import('./bootstrap');
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["DOM", "ES2020"],
4
+ "jsx": "react-jsx",
5
+ "target": "ES2020",
6
+ "noEmit": true,
7
+ "skipLibCheck": true,
8
+ "useDefineForClassFields": true,
9
+
10
+ /* modules */
11
+ "module": "ESNext",
12
+ "isolatedModules": true,
13
+ "resolveJsonModule": true,
14
+ "moduleResolution": "Bundler",
15
+ "allowImportingTsExtensions": true,
16
+
17
+ /* type checking */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "paths": {
22
+ "*": ["./@mf-types/*"]
23
+ }
24
+ },
25
+ "include": ["src"]
26
+ }