@nx/react 24.0.0-beta.2 → 24.0.0-beta.3
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.
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -5
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/plugins/component-testing/index.js +92 -33
- package/dist/plugins/storybook/index.js +18 -18
- package/dist/plugins/with-react.d.ts +3 -7
- package/dist/plugins/with-react.js +5 -19
- package/dist/src/generators/application/application.js +1 -36
- package/dist/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +1 -24
- package/dist/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +1 -26
- package/dist/src/generators/application/lib/add-e2e.js +5 -6
- package/dist/src/generators/application/lib/add-linting.js +0 -1
- package/dist/src/generators/application/lib/add-project.js +0 -167
- package/dist/src/generators/application/lib/bundlers/add-rsbuild.js +0 -1
- package/dist/src/generators/application/lib/bundlers/add-vite.js +0 -2
- package/dist/src/generators/application/lib/bundlers/add-webpack.js +0 -1
- package/dist/src/generators/application/lib/create-application-files.d.ts +0 -1
- package/dist/src/generators/application/lib/create-application-files.js +2 -11
- package/dist/src/generators/application/lib/normalize-options.js +0 -4
- package/dist/src/generators/application/schema.d.ts +0 -2
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +1 -9
- package/dist/src/generators/cypress-component-configuration/schema.d.ts +0 -1
- package/dist/src/generators/init/init.js +3 -5
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/generators/library/lib/add-linting.js +0 -1
- package/dist/src/generators/library/lib/add-rollup-build-target.js +3 -47
- package/dist/src/generators/library/lib/normalize-options.js +0 -4
- package/dist/src/generators/library/library.js +1 -4
- package/dist/src/generators/library/schema.d.ts +0 -1
- package/dist/src/generators/storybook-configuration/configuration.js +1 -9
- package/dist/src/generators/storybook-configuration/schema.d.ts +0 -1
- package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.js +2 -1
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.js +13 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.md +40 -0
- package/dist/src/plugins/router-plugin.d.ts +0 -1
- package/dist/src/plugins/router-plugin.js +5 -42
- package/dist/src/utils/ast-utils.d.ts +0 -1
- package/dist/src/utils/ast-utils.js +0 -23
- package/dist/src/utils/ct-utils.js +54 -14
- package/dist/src/utils/deprecation.d.ts +1 -1
- package/dist/src/utils/deprecation.js +3 -5
- package/dist/src/utils/versions.d.ts +0 -7
- package/dist/src/utils/versions.js +2 -9
- package/executors.json +1 -17
- package/generators.json +0 -27
- package/migrations.json +6 -0
- package/package.json +17 -47
- package/dist/mf/dynamic-federation.d.ts +0 -69
- package/dist/mf/dynamic-federation.js +0 -141
- package/dist/mf/index.d.ts +0 -1
- package/dist/mf/index.js +0 -8
- package/dist/module-federation.d.ts +0 -5
- package/dist/module-federation.js +0 -20
- package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -4
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -19
- package/dist/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/start-remotes.js +0 -33
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -6
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -80
- package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -19
- package/dist/src/executors/module-federation-dev-server/schema.json +0 -142
- package/dist/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-ssr-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -4
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -23
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +0 -34
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -3
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -83
- package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -29
- package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -81
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +0 -12
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js +0 -244
- package/dist/src/executors/module-federation-static-server/schema.d.ts +0 -3
- package/dist/src/executors/module-federation-static-server/schema.json +0 -16
- package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
- package/dist/src/generators/federate-module/federate-module.js +0 -67
- package/dist/src/generators/federate-module/lib/utils.d.ts +0 -23
- package/dist/src/generators/federate-module/lib/utils.js +0 -99
- package/dist/src/generators/federate-module/schema.d.ts +0 -15
- package/dist/src/generators/federate-module/schema.json +0 -89
- package/dist/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +0 -40
- package/dist/src/generators/host/files/common/src/main.js__tmpl__ +0 -13
- package/dist/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +0 -41
- package/dist/src/generators/host/files/common-ts/src/main.ts__tmpl__ +0 -13
- package/dist/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +0 -42
- package/dist/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +0 -13
- package/dist/src/generators/host/files/rspack-common/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -24
- package/dist/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -42
- package/dist/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -66
- package/dist/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -27
- package/dist/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -68
- package/dist/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -49
- package/dist/src/generators/host/files/rspack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -22
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -68
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -49
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -67
- package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -42
- package/dist/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -24
- package/dist/src/generators/host/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -39
- package/dist/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -19
- package/dist/src/generators/host/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -16
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -40
- package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -18
- package/dist/src/generators/host/host.d.ts +0 -4
- package/dist/src/generators/host/host.js +0 -174
- package/dist/src/generators/host/lib/add-module-federation-files.d.ts +0 -6
- package/dist/src/generators/host/lib/add-module-federation-files.js +0 -92
- package/dist/src/generators/host/lib/normalize-host-name.d.ts +0 -2
- package/dist/src/generators/host/lib/normalize-host-name.js +0 -12
- package/dist/src/generators/host/lib/setup-ssr-for-host.d.ts +0 -6
- package/dist/src/generators/host/lib/setup-ssr-for-host.js +0 -59
- package/dist/src/generators/host/lib/update-module-federation-e2e-project.d.ts +0 -3
- package/dist/src/generators/host/lib/update-module-federation-e2e-project.js +0 -19
- package/dist/src/generators/host/lib/update-module-federation-tsconfig.d.ts +0 -3
- package/dist/src/generators/host/lib/update-module-federation-tsconfig.js +0 -34
- package/dist/src/generators/host/schema.d.ts +0 -44
- package/dist/src/generators/host/schema.json +0 -173
- package/dist/src/generators/remote/files/common/src/main.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-common/src/main.jsx__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-common/src/remote-entry.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -12
- package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -15
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -71
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -19
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -71
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
- package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -12
- package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -9
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -13
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
- package/dist/src/generators/remote/files/webpack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -17
- package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +0 -2
- package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.js +0 -12
- package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.d.ts +0 -3
- package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.js +0 -30
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.d.ts +0 -4
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.js +0 -61
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.d.ts +0 -3
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.js +0 -14
- package/dist/src/generators/remote/lib/update-host-with-remote.d.ts +0 -2
- package/dist/src/generators/remote/lib/update-host-with-remote.js +0 -79
- package/dist/src/generators/remote/remote.d.ts +0 -6
- package/dist/src/generators/remote/remote.js +0 -201
- package/dist/src/generators/remote/schema.d.ts +0 -39
- package/dist/src/generators/remote/schema.json +0 -173
- package/dist/src/generators/setup-ssr/files/server.ts__tmpl__ +0 -28
- package/dist/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +0 -47
- package/dist/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/setup-ssr/schema.d.ts +0 -8
- package/dist/src/generators/setup-ssr/schema.json +0 -54
- package/dist/src/generators/setup-ssr/setup-ssr.d.ts +0 -4
- package/dist/src/generators/setup-ssr/setup-ssr.js +0 -198
- package/dist/src/module-federation/ast-utils.d.ts +0 -8
- package/dist/src/module-federation/ast-utils.js +0 -101
- package/dist/src/rules/update-module-federation-project.d.ts +0 -11
- package/dist/src/rules/update-module-federation-project.js +0 -72
- package/dist/src/utils/add-mf-env-to-inputs.d.ts +0 -2
- package/dist/src/utils/add-mf-env-to-inputs.js +0 -29
- package/dist/src/utils/module-federation-deprecation.d.ts +0 -12
- package/dist/src/utils/module-federation-deprecation.js +0 -46
- package/dist/src/utils/normalize-remote.d.ts +0 -8
- package/dist/src/utils/normalize-remote.js +0 -31
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "GeneratorReactHost",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "Generate Module Federation Setup for React Consumer (Host) App",
|
|
6
|
-
"description": "Create Module Federation configuration files for given React Consumer (Host) Application.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"directory": {
|
|
10
|
-
"description": "The directory of the new application.",
|
|
11
|
-
"type": "string",
|
|
12
|
-
"alias": "dir",
|
|
13
|
-
"$default": {
|
|
14
|
-
"$source": "argv",
|
|
15
|
-
"index": 0
|
|
16
|
-
},
|
|
17
|
-
"x-prompt": "Which directory do you want to create the application in?"
|
|
18
|
-
},
|
|
19
|
-
"name": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "The name of the Consumer (host) application to generate the Module Federation configuration",
|
|
22
|
-
"pattern": "^[a-zA-Z][^:]*$",
|
|
23
|
-
"x-priority": "important"
|
|
24
|
-
},
|
|
25
|
-
"style": {
|
|
26
|
-
"description": "The file extension to be used for style files.",
|
|
27
|
-
"type": "string",
|
|
28
|
-
"default": "css",
|
|
29
|
-
"alias": "s",
|
|
30
|
-
"enum": ["css", "scss", "none"],
|
|
31
|
-
"x-prompt": {
|
|
32
|
-
"message": "Which stylesheet format would you like to use?",
|
|
33
|
-
"type": "list",
|
|
34
|
-
"items": [
|
|
35
|
-
{
|
|
36
|
-
"value": "css",
|
|
37
|
-
"label": "CSS"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"value": "scss",
|
|
41
|
-
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"value": "none",
|
|
45
|
-
"label": "None"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"linter": {
|
|
51
|
-
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
52
|
-
"type": "string",
|
|
53
|
-
"enum": ["eslint", "oxlint", "none"]
|
|
54
|
-
},
|
|
55
|
-
"dynamic": {
|
|
56
|
-
"type": "boolean",
|
|
57
|
-
"description": "Should the Consumer (host) application use dynamic federation?",
|
|
58
|
-
"default": false
|
|
59
|
-
},
|
|
60
|
-
"skipFormat": {
|
|
61
|
-
"description": "Skip formatting files.",
|
|
62
|
-
"type": "boolean",
|
|
63
|
-
"default": false,
|
|
64
|
-
"x-priority": "internal"
|
|
65
|
-
},
|
|
66
|
-
"skipNxJson": {
|
|
67
|
-
"description": "Skip updating nx.json with default options based on values provided to this app (e.g. babel, style).",
|
|
68
|
-
"type": "boolean",
|
|
69
|
-
"default": false,
|
|
70
|
-
"x-priority": "internal"
|
|
71
|
-
},
|
|
72
|
-
"unitTestRunner": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"enum": ["jest", "vitest", "none"],
|
|
75
|
-
"description": "Test runner to use for unit tests.",
|
|
76
|
-
"default": "jest"
|
|
77
|
-
},
|
|
78
|
-
"e2eTestRunner": {
|
|
79
|
-
"type": "string",
|
|
80
|
-
"enum": ["playwright", "cypress", "none"],
|
|
81
|
-
"description": "Test runner to use for end to end (E2E) tests.",
|
|
82
|
-
"x-prompt": "Which E2E test runner would you like to use?",
|
|
83
|
-
"default": "playwright"
|
|
84
|
-
},
|
|
85
|
-
"tags": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"description": "Add tags to the application (used for linting).",
|
|
88
|
-
"alias": "t"
|
|
89
|
-
},
|
|
90
|
-
"classComponent": {
|
|
91
|
-
"type": "boolean",
|
|
92
|
-
"description": "Use class components instead of functional component.",
|
|
93
|
-
"alias": "C",
|
|
94
|
-
"default": false
|
|
95
|
-
},
|
|
96
|
-
"js": {
|
|
97
|
-
"type": "boolean",
|
|
98
|
-
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
99
|
-
"default": false
|
|
100
|
-
},
|
|
101
|
-
"globalCss": {
|
|
102
|
-
"type": "boolean",
|
|
103
|
-
"description": "Default is false. When true, the component is generated with *.css/*.scss instead of *.module.css/*.module.scss",
|
|
104
|
-
"default": false
|
|
105
|
-
},
|
|
106
|
-
"strict": {
|
|
107
|
-
"type": "boolean",
|
|
108
|
-
"description": "Creates an application with strict mode and strict type checking",
|
|
109
|
-
"default": true
|
|
110
|
-
},
|
|
111
|
-
"enableTypedLinting": {
|
|
112
|
-
"type": "boolean",
|
|
113
|
-
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
114
|
-
"default": false
|
|
115
|
-
},
|
|
116
|
-
"setParserOptionsProject": {
|
|
117
|
-
"type": "boolean",
|
|
118
|
-
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
119
|
-
"default": false,
|
|
120
|
-
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
121
|
-
},
|
|
122
|
-
"compiler": {
|
|
123
|
-
"type": "string",
|
|
124
|
-
"description": "The compiler to use",
|
|
125
|
-
"enum": ["babel", "swc"],
|
|
126
|
-
"default": "babel"
|
|
127
|
-
},
|
|
128
|
-
"remotes": {
|
|
129
|
-
"type": "array",
|
|
130
|
-
"description": "A list of Producer (remote) application names that the Consumer (host) application should consume.",
|
|
131
|
-
"default": [],
|
|
132
|
-
"x-priority": "important",
|
|
133
|
-
"alias": "producers"
|
|
134
|
-
},
|
|
135
|
-
"port": {
|
|
136
|
-
"type": "number",
|
|
137
|
-
"description": "The port at which the Consumer (host) application should be served. Defaults to 4200.",
|
|
138
|
-
"aliases": ["devServerPort"],
|
|
139
|
-
"x-priority": "important"
|
|
140
|
-
},
|
|
141
|
-
"ssr": {
|
|
142
|
-
"description": "Whether to configure SSR for the Consumer (host) application",
|
|
143
|
-
"type": "boolean",
|
|
144
|
-
"default": false
|
|
145
|
-
},
|
|
146
|
-
"minimal": {
|
|
147
|
-
"description": "Generate a React app with a minimal setup. No nx starter template.",
|
|
148
|
-
"type": "boolean",
|
|
149
|
-
"default": false
|
|
150
|
-
},
|
|
151
|
-
"typescriptConfiguration": {
|
|
152
|
-
"type": "boolean",
|
|
153
|
-
"description": "Whether the module federation configuration and webpack configuration files should use TS. When --js is used, this flag is ignored.",
|
|
154
|
-
"default": true
|
|
155
|
-
},
|
|
156
|
-
"skipPackageJson": {
|
|
157
|
-
"description": "Do not add dependencies to `package.json`.",
|
|
158
|
-
"type": "boolean",
|
|
159
|
-
"default": false,
|
|
160
|
-
"x-priority": "internal"
|
|
161
|
-
},
|
|
162
|
-
"bundler": {
|
|
163
|
-
"description": "The bundler to use.",
|
|
164
|
-
"type": "string",
|
|
165
|
-
"enum": ["rspack", "webpack"],
|
|
166
|
-
"x-prompt": "Which bundler do you want to use to build the application?",
|
|
167
|
-
"default": "rspack",
|
|
168
|
-
"x-priority": "important"
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
"required": ["directory"],
|
|
172
|
-
"additionalProperties": false
|
|
173
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import('./bootstrap');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './app/app';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import('./bootstrap');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './app/app';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import('./bootstrap');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './app/app';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
3
|
-
**/
|
|
4
|
-
module.exports = {
|
|
5
|
-
name: '<%= projectName %>',
|
|
6
|
-
<%_ if (dynamic) { _%>
|
|
7
|
-
library: { type: 'var', name: '<%= projectName %>'},
|
|
8
|
-
<%_ } _%>
|
|
9
|
-
exposes: {
|
|
10
|
-
'./Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
|
|
2
|
-
const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
|
|
3
|
-
const { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } = require('@nx/module-federation/rspack');
|
|
4
|
-
const { join } = require('path');
|
|
5
|
-
|
|
6
|
-
const config = require('./module-federation.config');
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
// rspack-cli dev mode defaults this on; it breaks module federation.
|
|
10
|
-
lazyCompilation: false,
|
|
11
|
-
output: {
|
|
12
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>'),
|
|
13
|
-
publicPath: 'auto'
|
|
14
|
-
},
|
|
15
|
-
devServer: {
|
|
16
|
-
port: <%= port %>,
|
|
17
|
-
headers: {
|
|
18
|
-
"Access-Control-Allow-Origin": "*"
|
|
19
|
-
},
|
|
20
|
-
historyApiFallback: {
|
|
21
|
-
index: '/index.html',
|
|
22
|
-
disableDotRule: true,
|
|
23
|
-
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
plugins: [
|
|
27
|
-
new NxAppRspackPlugin({
|
|
28
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
29
|
-
main: '<%= rspackPluginOptions.main %>',
|
|
30
|
-
index: '<%= rspackPluginOptions.index %>',
|
|
31
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
32
|
-
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
33
|
-
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
34
|
-
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
35
|
-
optimization: process.env['NODE_ENV'] === 'production',
|
|
36
|
-
}),
|
|
37
|
-
new NxReactRspackPlugin({
|
|
38
|
-
// Uncomment this line if you don't want to use SVGR
|
|
39
|
-
// See: https://react-svgr.com/
|
|
40
|
-
// svgr: false
|
|
41
|
-
}),
|
|
42
|
-
new NxModuleFederationPlugin({ config }, { dts: false }),
|
|
43
|
-
new NxModuleFederationDevServerPlugin({ config }),
|
|
44
|
-
],
|
|
45
|
-
};
|
package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.prod.js__tmpl__
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./rspack.config');
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
3
|
-
**/
|
|
4
|
-
module.exports = {
|
|
5
|
-
name: '<%= projectName %>',
|
|
6
|
-
exposes: {
|
|
7
|
-
'./Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
|
|
8
|
-
},
|
|
9
|
-
shared: (libraryName, libraryConfig) => {
|
|
10
|
-
return {
|
|
11
|
-
...libraryConfig,
|
|
12
|
-
eager: true
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
};
|
package/dist/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
|
|
2
|
-
const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
|
|
3
|
-
const { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } = require('@nx/module-federation/rspack');
|
|
4
|
-
const { join } = require('path');
|
|
5
|
-
|
|
6
|
-
const browserMfConfig = require('./module-federation.config');
|
|
7
|
-
const serverMfConfig = require('./module-federation.server.config');
|
|
8
|
-
|
|
9
|
-
const browserRspackConfig = {
|
|
10
|
-
name: 'browser',
|
|
11
|
-
// rspack-cli dev mode defaults this on; it breaks module federation.
|
|
12
|
-
lazyCompilation: false,
|
|
13
|
-
output: {
|
|
14
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'browser'),
|
|
15
|
-
publicPath: 'auto'
|
|
16
|
-
},
|
|
17
|
-
devServer: {
|
|
18
|
-
port: <%= port %>,
|
|
19
|
-
headers: {
|
|
20
|
-
"Access-Control-Allow-Origin": "*"
|
|
21
|
-
},
|
|
22
|
-
historyApiFallback: {
|
|
23
|
-
index: '/index.html',
|
|
24
|
-
disableDotRule: true,
|
|
25
|
-
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
26
|
-
},
|
|
27
|
-
devMiddleware: {
|
|
28
|
-
writeToDisk: (file: string) => !file.includes('.hot-update.'),
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
plugins: [
|
|
32
|
-
new NxAppRspackPlugin({
|
|
33
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
34
|
-
main: '<%= rspackPluginOptions.main %>',
|
|
35
|
-
index: '<%= rspackPluginOptions.index %>',
|
|
36
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
37
|
-
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
38
|
-
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
39
|
-
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
40
|
-
optimization: process.env['NODE_ENV'] === 'production',
|
|
41
|
-
}),
|
|
42
|
-
new NxReactRspackPlugin({
|
|
43
|
-
// Uncomment this line if you don't want to use SVGR
|
|
44
|
-
// See: https://react-svgr.com/
|
|
45
|
-
// svgr: false
|
|
46
|
-
}),
|
|
47
|
-
new NxModuleFederationPlugin({ config: browserMfConfig }, { dts: false }),
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const serverRspackConfig = {
|
|
52
|
-
name: 'server',
|
|
53
|
-
target: 'async-node',
|
|
54
|
-
output: {
|
|
55
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'server'),
|
|
56
|
-
filename: 'server.js'
|
|
57
|
-
},
|
|
58
|
-
plugins: [
|
|
59
|
-
new NxAppRspackPlugin({
|
|
60
|
-
outputPath: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'server'),
|
|
61
|
-
outputFileName: 'server.js',
|
|
62
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
63
|
-
main: '<%= rspackPluginOptions.mainServer %>',
|
|
64
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
65
|
-
}),
|
|
66
|
-
new NxModuleFederationPlugin({ config: serverMfConfig, isServer: true }, { dts: false }),
|
|
67
|
-
new NxModuleFederationSSRDevServerPlugin({ config: serverMfConfig }),
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
module.exports = [browserRspackConfig, serverRspackConfig];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import express from 'express';
|
|
3
|
-
import cors from 'cors';
|
|
4
|
-
|
|
5
|
-
import { handleRequest } from './src/main.server';
|
|
6
|
-
|
|
7
|
-
const port = process.env['PORT'] || <%= port %>;
|
|
8
|
-
const app = express();
|
|
9
|
-
|
|
10
|
-
const browserDist = path.join(process.cwd(), '<%= rspackPluginOptions.outputPath %>', 'browser');
|
|
11
|
-
const serverDist = path.join(process.cwd(), '<%= rspackPluginOptions.outputPath %>', 'server');
|
|
12
|
-
const indexPath = path.join(browserDist, 'index.html');
|
|
13
|
-
|
|
14
|
-
app.use(cors());
|
|
15
|
-
|
|
16
|
-
// Client-side static bundles
|
|
17
|
-
app.get(
|
|
18
|
-
'*.*',
|
|
19
|
-
express.static(browserDist, {
|
|
20
|
-
maxAge: '1y',
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// Static bundles for server-side module federation
|
|
25
|
-
app.use('/server',
|
|
26
|
-
express.static(serverDist, {
|
|
27
|
-
maxAge: '1y'
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
app.use('*', handleRequest(indexPath));
|
|
32
|
-
|
|
33
|
-
const server = app.listen(port, () => {
|
|
34
|
-
console.log(`Express server listening on http://localhost:${port}`);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* DO NOT REMOVE IF USING @nx/react:module-federation-dev-ssr executor
|
|
38
|
-
* to serve your Host application with this Remote application.
|
|
39
|
-
* This message allows Nx to determine when the Remote is ready to be
|
|
40
|
-
* consumed by the Host.
|
|
41
|
-
*/
|
|
42
|
-
process.send?.('nx.server.ready');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
server.on('error', console.error);
|
package/dist/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as ReactDOMServer from 'react-dom/server';
|
|
4
|
-
import isbot from 'isbot';
|
|
5
|
-
|
|
6
|
-
import App from './app/app';
|
|
7
|
-
|
|
8
|
-
let indexHtml: null | string = null;
|
|
9
|
-
|
|
10
|
-
export function handleRequest(indexPath: string) {
|
|
11
|
-
return function render(req: Request, res: Response) {
|
|
12
|
-
let didError = false;
|
|
13
|
-
|
|
14
|
-
if (!indexHtml) {
|
|
15
|
-
indexHtml = fs.readFileSync(indexPath).toString();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const [htmlStart, htmlEnd] = indexHtml.split(`<div id="root"></div>`);
|
|
19
|
-
|
|
20
|
-
// For bots (e.g. search engines), the content will not be streamed but render all at once.
|
|
21
|
-
// For users, content should be streamed to the user as they are ready.
|
|
22
|
-
const callbackName = isbot(req.headers['user-agent'])
|
|
23
|
-
? 'onAllReady'
|
|
24
|
-
: 'onShellReady';
|
|
25
|
-
|
|
26
|
-
const stream = ReactDOMServer.renderToPipeableStream(<App />, {
|
|
27
|
-
[callbackName]() {
|
|
28
|
-
res.statusCode = didError ? 500 : 200;
|
|
29
|
-
res.setHeader('Content-type', 'text/html; charset=utf-8');
|
|
30
|
-
res.write(`${htmlStart}<div id="root">`);
|
|
31
|
-
stream.pipe(res);
|
|
32
|
-
res.write(`</div>${htmlEnd}`);
|
|
33
|
-
},
|
|
34
|
-
onShellError(error) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
res.statusCode = 500;
|
|
37
|
-
res.send('<!doctype html><h1>Server Error</h1>');
|
|
38
|
-
},
|
|
39
|
-
onError(error) {
|
|
40
|
-
didError = true;
|
|
41
|
-
console.error(error);
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type {ModuleFederationConfig} from '@nx/module-federation';
|
|
2
|
-
|
|
3
|
-
const config: ModuleFederationConfig = {
|
|
4
|
-
name: '<%= projectName %>',
|
|
5
|
-
exposes: {
|
|
6
|
-
'./Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
|
|
7
|
-
},
|
|
8
|
-
shared: (libraryName, libraryConfig) => {
|
|
9
|
-
return {
|
|
10
|
-
...libraryConfig,
|
|
11
|
-
eager: true
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
18
|
-
**/
|
|
19
|
-
export default config;
|
package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
|
-
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
|
|
6
|
-
import browserMfConfig from './module-federation.config';
|
|
7
|
-
import serverMfConfig from './module-federation.server.config';
|
|
8
|
-
|
|
9
|
-
const browserRspackConfig = {
|
|
10
|
-
name: 'browser',
|
|
11
|
-
// rspack-cli dev mode defaults this on; it breaks module federation.
|
|
12
|
-
lazyCompilation: false,
|
|
13
|
-
output: {
|
|
14
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'browser'),
|
|
15
|
-
publicPath: 'auto'
|
|
16
|
-
},
|
|
17
|
-
devServer: {
|
|
18
|
-
port: <%= port %>,
|
|
19
|
-
headers: {
|
|
20
|
-
"Access-Control-Allow-Origin": "*"
|
|
21
|
-
},
|
|
22
|
-
historyApiFallback: {
|
|
23
|
-
index: '/index.html',
|
|
24
|
-
disableDotRule: true,
|
|
25
|
-
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
26
|
-
},
|
|
27
|
-
devMiddleware: {
|
|
28
|
-
writeToDisk: (file: string) => !file.includes('.hot-update.'),
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
plugins: [
|
|
32
|
-
new NxAppRspackPlugin({
|
|
33
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
34
|
-
main: '<%= rspackPluginOptions.main %>',
|
|
35
|
-
index: '<%= rspackPluginOptions.index %>',
|
|
36
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
37
|
-
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
38
|
-
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
39
|
-
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
40
|
-
optimization: process.env['NODE_ENV'] === 'production',
|
|
41
|
-
}),
|
|
42
|
-
new NxReactRspackPlugin({
|
|
43
|
-
// Uncomment this line if you don't want to use SVGR
|
|
44
|
-
// See: https://react-svgr.com/
|
|
45
|
-
// svgr: false
|
|
46
|
-
}),
|
|
47
|
-
new NxModuleFederationPlugin({ config: browserMfConfig }, { dts: false }),
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const serverRspackConfig = {
|
|
52
|
-
name: 'server',
|
|
53
|
-
target: 'async-node',
|
|
54
|
-
output: {
|
|
55
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'server'),
|
|
56
|
-
filename: 'server.js'
|
|
57
|
-
},
|
|
58
|
-
plugins: [
|
|
59
|
-
new NxAppRspackPlugin({
|
|
60
|
-
outputPath: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'server'),
|
|
61
|
-
outputFileName: 'server.js',
|
|
62
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
63
|
-
main: '<%= rspackPluginOptions.mainServer %>',
|
|
64
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
65
|
-
}),
|
|
66
|
-
new NxModuleFederationPlugin({ config: serverMfConfig, isServer: true }, { dts: false }),
|
|
67
|
-
new NxModuleFederationSSRDevServerPlugin({ config: serverMfConfig }),
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export default [browserRspackConfig, serverRspackConfig];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import express from 'express';
|
|
3
|
-
import cors from 'cors';
|
|
4
|
-
|
|
5
|
-
import { handleRequest } from './src/main.server';
|
|
6
|
-
|
|
7
|
-
const port = process.env['PORT'] || <%= port %>;
|
|
8
|
-
const app = express();
|
|
9
|
-
|
|
10
|
-
const browserDist = path.join(process.cwd(), '<%= rspackPluginOptions.outputPath %>', 'browser');
|
|
11
|
-
const serverDist = path.join(process.cwd(), '<%= rspackPluginOptions.outputPath %>', 'server');
|
|
12
|
-
const indexPath = path.join(browserDist, 'index.html');
|
|
13
|
-
|
|
14
|
-
app.use(cors());
|
|
15
|
-
|
|
16
|
-
// Client-side static bundles
|
|
17
|
-
app.get(
|
|
18
|
-
'*.*',
|
|
19
|
-
express.static(browserDist, {
|
|
20
|
-
maxAge: '1y',
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// Static bundles for server-side module federation
|
|
25
|
-
app.use('/server',
|
|
26
|
-
express.static(serverDist, {
|
|
27
|
-
maxAge: '1y'
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
app.use('*', handleRequest(indexPath));
|
|
32
|
-
|
|
33
|
-
const server = app.listen(port, () => {
|
|
34
|
-
console.log(`Express server listening on http://localhost:${port}`);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* DO NOT REMOVE IF USING @nx/react:module-federation-dev-ssr executor
|
|
38
|
-
* to serve your Host application with this Remote application.
|
|
39
|
-
* This message allows Nx to determine when the Remote is ready to be
|
|
40
|
-
* consumed by the Host.
|
|
41
|
-
*/
|
|
42
|
-
process.send?.('nx.server.ready');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
server.on('error', console.error);
|
package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as ReactDOMServer from 'react-dom/server';
|
|
4
|
-
import isbot from 'isbot';
|
|
5
|
-
|
|
6
|
-
import App from './app/app';
|
|
7
|
-
|
|
8
|
-
let indexHtml: null | string = null;
|
|
9
|
-
|
|
10
|
-
export function handleRequest(indexPath: string) {
|
|
11
|
-
return function render(req: Request, res: Response) {
|
|
12
|
-
let didError = false;
|
|
13
|
-
|
|
14
|
-
if (!indexHtml) {
|
|
15
|
-
indexHtml = fs.readFileSync(indexPath).toString();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const [htmlStart, htmlEnd] = indexHtml.split(`<div id="root"></div>`);
|
|
19
|
-
|
|
20
|
-
// For bots (e.g. search engines), the content will not be streamed but render all at once.
|
|
21
|
-
// For users, content should be streamed to the user as they are ready.
|
|
22
|
-
const callbackName = isbot(req.headers['user-agent'])
|
|
23
|
-
? 'onAllReady'
|
|
24
|
-
: 'onShellReady';
|
|
25
|
-
|
|
26
|
-
const stream = ReactDOMServer.renderToPipeableStream(<App />, {
|
|
27
|
-
[callbackName]() {
|
|
28
|
-
res.statusCode = didError ? 500 : 200;
|
|
29
|
-
res.setHeader('Content-type', 'text/html; charset=utf-8');
|
|
30
|
-
res.write(`${htmlStart}<div id="root">`);
|
|
31
|
-
stream.pipe(res);
|
|
32
|
-
res.write(`</div>${htmlEnd}`);
|
|
33
|
-
},
|
|
34
|
-
onShellError(error) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
res.statusCode = 500;
|
|
37
|
-
res.send('<!doctype html><h1>Server Error</h1>');
|
|
38
|
-
},
|
|
39
|
-
onError(error) {
|
|
40
|
-
didError = true;
|
|
41
|
-
console.error(error);
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"types": [
|
|
6
|
-
"node",
|
|
7
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
8
|
-
"@nx/react/typings/image.d.ts"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*.js",
|
|
13
|
-
"src/**/*.jsx",
|
|
14
|
-
"src/**/*.ts",
|
|
15
|
-
"src/**/*.tsx",
|
|
16
|
-
"rspack.config.ts",
|
|
17
|
-
"rspack.prod.config.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type {ModuleFederationConfig} from '@nx/module-federation';
|
|
2
|
-
|
|
3
|
-
const config: ModuleFederationConfig = {
|
|
4
|
-
name: '<%= projectName %>',
|
|
5
|
-
<%_ if (dynamic) { _%>
|
|
6
|
-
library: { type: 'var', name: '<%= projectName %>'},
|
|
7
|
-
<%_ } _%>
|
|
8
|
-
exposes: {
|
|
9
|
-
'./Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
15
|
-
**/
|
|
16
|
-
export default config;
|
package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default require('./rspack.config');
|