@nx/react 20.1.0-canary.20241030-62f58eb → 20.1.0-canary.20241101-d4f4dac

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 (61) hide show
  1. package/package.json +5 -5
  2. package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  3. package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +24 -4
  4. package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +1 -1
  5. package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  6. package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +31 -6
  7. package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +1 -1
  8. package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  9. package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +22 -2
  10. package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +1 -1
  11. package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +3 -3
  12. package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +26 -16
  13. package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +29 -20
  14. package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +26 -16
  15. package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +31 -22
  16. package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +30 -21
  17. package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +30 -18
  18. package/src/generators/application/lib/get-app-tests.js +8 -9
  19. package/src/generators/component/files/__fileName__.tsx__tmpl__ +55 -56
  20. package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +5 -5
  21. package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +3 -4
  22. package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +20 -20
  23. package/src/generators/host/files/common/src/main.js__tmpl__ +9 -9
  24. package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +27 -27
  25. package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +9 -9
  26. package/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +13 -13
  27. package/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +9 -9
  28. package/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +4 -4
  29. package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +3 -1
  30. package/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -4
  31. package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +1 -1
  32. package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -6
  33. package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +1 -1
  34. package/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +18 -18
  35. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +23 -21
  36. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
  37. package/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +4 -4
  38. package/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +23 -21
  39. package/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -6
  40. package/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +1 -1
  41. package/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -6
  42. package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
  43. package/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +18 -18
  44. package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +23 -21
  45. package/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
  46. package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +1 -1
  47. package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +1 -1
  48. package/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +7 -7
  49. package/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +4 -4
  50. package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +1 -1
  51. package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +4 -4
  52. package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +1 -1
  53. package/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +7 -7
  54. package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
  55. package/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +7 -7
  56. package/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +4 -4
  57. package/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +1 -1
  58. package/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +4 -4
  59. package/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
  60. package/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +7 -7
  61. package/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
@@ -5,27 +5,29 @@ const { withModuleFederation } = require('@nx/react/module-federation');
5
5
  const baseConfig = require('./module-federation.config');
6
6
 
7
7
  const prodConfig = {
8
- ...baseConfig,
9
- /*
10
- * Remote overrides for production.
11
- * Each entry is a pair of a unique name and the URL where it is deployed.
12
- *
13
- * e.g.
14
- * remotes: [
15
- * ['app1', 'http://app1.example.com'],
16
- * ['app2', 'http://app2.example.com'],
17
- * ]
18
- *
19
- * You can also use a full path to the remoteEntry.js file if desired.
20
- *
21
- * remotes: [
22
- * ['app1', 'http://example.com/path/to/app1/remoteEntry.js'],
23
- * ['app2', 'http://example.com/path/to/app2/remoteEntry.js'],
24
- * ]
25
- */
26
- remotes: [
27
- <% remotes.forEach(function(r) {%>['<%= r.fileName %>', 'http://localhost:<%= r.port %>/'],<% }); %>
28
- ],
8
+ ...baseConfig,
9
+ /*
10
+ * Remote overrides for production.
11
+ * Each entry is a pair of a unique name and the URL where it is deployed.
12
+ *
13
+ * e.g.
14
+ * remotes: [
15
+ * ['app1', 'http://app1.example.com'],
16
+ * ['app2', 'http://app2.example.com'],
17
+ * ]
18
+ *
19
+ * You can also use a full path to the remoteEntry.js file if desired.
20
+ *
21
+ * remotes: [
22
+ * ['app1', 'http://example.com/path/to/app1/remoteEntry.js'],
23
+ * ['app2', 'http://example.com/path/to/app2/remoteEntry.js'],
24
+ * ]
25
+ */
26
+ remotes: [
27
+ <%_ remotes.forEach(function(r) { _%>
28
+ ['<%= r.fileName %>', 'http://localhost:<%= r.port %>/'],
29
+ <%_ }); _%>
30
+ ],
29
31
  };
30
32
 
31
33
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -4,12 +4,12 @@
4
4
  * @type {import('@nx/webpack').ModuleFederationConfig}
5
5
  **/
6
6
  const moduleFederationConfig = {
7
- name: '<%= projectName %>',
8
- remotes: [
9
- <% if (static) {
10
- remotes.forEach(function(r) { %> "<%= r.fileName %>", <% });
11
- }
12
- %>
7
+ name: '<%= projectName %>',
8
+ remotes: [
9
+ <%_ if (static) {
10
+ remotes.forEach(function(r) { _%>
11
+ "<%= r.fileName %>",
12
+ <%_ }); } _%>
13
13
  ],
14
14
  };
15
15
 
@@ -5,7 +5,7 @@ const {withModuleFederationForSSR} = require('@nx/react/module-federation');
5
5
  const baseConfig = require('./module-federation.config');
6
6
 
7
7
  const defaultConfig = {
8
- ...baseConfig
8
+ ...baseConfig
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,12 +1,12 @@
1
1
  import { ModuleFederationConfig } from '@nx/webpack';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
- name: '<%= projectName %>',
5
- remotes: [
6
- <% if (static) {
7
- remotes.forEach(function(r) { %> "<%= r.fileName %>", <% });
8
- }
9
- %>
4
+ name: '<%= projectName %>',
5
+ remotes: [
6
+ <%_ if (static) {
7
+ remotes.forEach(function(r) { _%>
8
+ "<%= r.fileName %>",
9
+ <%_ }); } _%>
10
10
  ],
11
11
  };
12
12
 
@@ -5,7 +5,7 @@ import {withModuleFederationForSSR} from '@nx/react/module-federation';
5
5
  import baseConfig from './module-federation.config';
6
6
 
7
7
  const defaultConfig = {
8
- ...baseConfig
8
+ ...baseConfig
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,24 +1,24 @@
1
1
  import { ModuleFederationConfig } from '@nx/webpack';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
- name: '<%= projectName %>',
5
- /**
6
- * To use a remote that does not exist in your current Nx Workspace
7
- * You can use the tuple-syntax to define your remote
8
- *
9
- * remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
10
- *
11
- * You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
12
- * following content:
13
- *
14
- * declare module 'my-external-remote';
15
- *
16
- */
17
- remotes: [
18
- <% if (static) {
19
- remotes.forEach(function(r) { %> "<%= r.fileName %>", <% });
20
- }
21
- %>
4
+ name: '<%= projectName %>',
5
+ /**
6
+ * To use a remote that does not exist in your current Nx Workspace
7
+ * You can use the tuple-syntax to define your remote
8
+ *
9
+ * remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
10
+ *
11
+ * You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
12
+ * following content:
13
+ *
14
+ * declare module 'my-external-remote';
15
+ *
16
+ */
17
+ remotes: [
18
+ <%_ if (static) {
19
+ remotes.forEach(function(r) { _%>
20
+ "<%= r.fileName %>",
21
+ <%_ }); } _%>
22
22
  ],
23
23
  };
24
24
 
@@ -6,27 +6,29 @@ import { ModuleFederationConfig } from '@nx/webpack';
6
6
  import baseConfig from './module-federation.config';
7
7
 
8
8
  const prodConfig: ModuleFederationConfig = {
9
- ...baseConfig,
10
- /*
11
- * Remote overrides for production.
12
- * Each entry is a pair of a unique name and the URL where it is deployed.
13
- *
14
- * e.g.
15
- * remotes: [
16
- * ['app1', 'http://app1.example.com'],
17
- * ['app2', 'http://app2.example.com'],
18
- * ]
19
- *
20
- * You can also use a full path to the remoteEntry.js file if desired.
21
- *
22
- * remotes: [
23
- * ['app1', 'http://example.com/path/to/app1/remoteEntry.js'],
24
- * ['app2', 'http://example.com/path/to/app2/remoteEntry.js'],
25
- * ]
26
- */
27
- remotes: [
28
- <% remotes.forEach(function(r) {%>['<%= r.fileName %>', 'http://localhost:<%= r.port %>/'],<% }); %>
29
- ],
9
+ ...baseConfig,
10
+ /*
11
+ * Remote overrides for production.
12
+ * Each entry is a pair of a unique name and the URL where it is deployed.
13
+ *
14
+ * e.g.
15
+ * remotes: [
16
+ * ['app1', 'http://app1.example.com'],
17
+ * ['app2', 'http://app2.example.com'],
18
+ * ]
19
+ *
20
+ * You can also use a full path to the remoteEntry.js file if desired.
21
+ *
22
+ * remotes: [
23
+ * ['app1', 'http://example.com/path/to/app1/remoteEntry.js'],
24
+ * ['app2', 'http://example.com/path/to/app2/remoteEntry.js'],
25
+ * ]
26
+ */
27
+ remotes: [
28
+ <%_ remotes.forEach(function(r) { _%>
29
+ ['<%= r.fileName %>', 'http://localhost:<%= r.port %>/'],
30
+ <%_ }); _%>
31
+ ],
30
32
  };
31
33
 
32
34
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -5,7 +5,7 @@ import {withModuleFederation} from '@nx/react/module-federation';
5
5
  import baseConfig from './module-federation.config';
6
6
 
7
7
  const config: ModuleFederationConfig = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -4,7 +4,7 @@
4
4
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
5
  "types": [
6
6
  "node",
7
- <% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
7
+ <%_ if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } _%>
8
8
  "@nx/react/typings/cssmodule.d.ts",
9
9
  "@nx/react/typings/image.d.ts"
10
10
  ]
@@ -4,7 +4,7 @@
4
4
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
5
  "types": [
6
6
  "node",
7
- <% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
7
+ <%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
8
8
  "@nx/react/typings/cssmodule.d.ts",
9
9
  "@nx/react/typings/image.d.ts"
10
10
  ]
@@ -2,11 +2,11 @@
2
2
  * Nx requires a default export of the config to allow correct resolution of the module federation graph.
3
3
  **/
4
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
- },
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
12
  };
@@ -2,8 +2,8 @@
2
2
  * Nx requires a default export of the config to allow correct resolution of the module federation graph.
3
3
  **/
4
4
  module.exports = {
5
- name: '<%= projectName %>',
6
- exposes: {
7
- './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
8
- },
5
+ name: '<%= projectName %>',
6
+ exposes: {
7
+ './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
8
+ },
9
9
  };
@@ -4,7 +4,7 @@ const {withModuleFederationForSSR} = require('@nx/rspack/module-federation');
4
4
  const baseConfig = require("./module-federation.server.config");
5
5
 
6
6
  const defaultConfig = {
7
- ...baseConfig,
7
+ ...baseConfig,
8
8
  };
9
9
 
10
10
  // Nx plugins for rspack to build config object from Nx options and context.
@@ -1,10 +1,10 @@
1
1
  import {ModuleFederationConfig} from '@nx/rspack/module-federation';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
- name: '<%= projectName %>',
5
- exposes: {
6
- './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
7
- },
4
+ name: '<%= projectName %>',
5
+ exposes: {
6
+ './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
7
+ },
8
8
  };
9
9
 
10
10
  /**
@@ -4,7 +4,7 @@ import {withModuleFederationForSSR} from '@nx/rspack/module-federation';
4
4
  import baseConfig from "./module-federation.server.config";
5
5
 
6
6
  const defaultConfig = {
7
- ...baseConfig,
7
+ ...baseConfig,
8
8
  };
9
9
 
10
10
  // Nx plugins for rspack to build config object from Nx options and context.
@@ -1,13 +1,13 @@
1
1
  import {ModuleFederationConfig} from '@nx/rspack/module-federation';
2
2
 
3
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
- },
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
11
  };
12
12
 
13
13
  /**
@@ -4,7 +4,7 @@ import {withModuleFederation} from '@nx/rspack/module-federation';
4
4
  import baseConfig from './module-federation.config';
5
5
 
6
6
  const config = {
7
- ...baseConfig,
7
+ ...baseConfig,
8
8
  };
9
9
 
10
10
  // Nx plugins for rspack to build config object from Nx options and context.
@@ -2,11 +2,11 @@
2
2
  * Nx requires a default export of the config to allow correct resolution of the module federation graph.
3
3
  **/
4
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
- },
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
12
  };
@@ -2,8 +2,8 @@
2
2
  * Nx requires a default export of the config to allow correct resolution of the module federation graph.
3
3
  **/
4
4
  module.exports = {
5
- name: '<%= projectName %>',
6
- exposes: {
7
- './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
8
- },
5
+ name: '<%= projectName %>',
6
+ exposes: {
7
+ './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
8
+ },
9
9
  };
@@ -5,7 +5,7 @@ const {withModuleFederationForSSR} = require('@nx/react/module-federation');
5
5
  const baseConfig = require("./module-federation.server.config");
6
6
 
7
7
  const defaultConfig = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,10 +1,10 @@
1
1
  import {ModuleFederationConfig} from '@nx/webpack';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
- name: '<%= projectName %>',
5
- exposes: {
6
- './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
7
- },
4
+ name: '<%= projectName %>',
5
+ exposes: {
6
+ './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
7
+ },
8
8
  };
9
9
 
10
10
  /**
@@ -5,7 +5,7 @@ import {withModuleFederationForSSR} from '@nx/react/module-federation';
5
5
  import baseConfig from "./module-federation.server.config";
6
6
 
7
7
  const defaultConfig = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,13 +1,13 @@
1
1
  import {ModuleFederationConfig} from '@nx/webpack';
2
2
 
3
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
- },
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
11
  };
12
12
 
13
13
  /**
@@ -5,7 +5,7 @@ import {withModuleFederation} from '@nx/react/module-federation';
5
5
  import baseConfig from './module-federation.config';
6
6
 
7
7
  const config = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.