@nx/react 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba

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 (51) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/index.d.ts +3 -1
  4. package/index.js +5 -3
  5. package/migrations.json +57 -160
  6. package/package.json +11 -9
  7. package/plugins/bundle-rollup.js +1 -1
  8. package/plugins/component-testing/index.js +5 -2
  9. package/plugins/component-testing/webpack-fallback.js +1 -1
  10. package/plugins/nx-react-webpack-plugin/lib/apply-react-config.d.ts +2 -1
  11. package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +33 -5
  12. package/plugins/storybook/index.js +1 -1
  13. package/plugins/with-react.d.ts +6 -1
  14. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +5 -1
  15. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +58 -28
  16. package/src/executors/module-federation-dev-server/schema.json +25 -3
  17. package/src/generators/application/application.js +17 -4
  18. package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +3 -3
  19. package/src/generators/application/lib/add-e2e.js +7 -6
  20. package/src/generators/application/lib/normalize-options.js +31 -4
  21. package/src/generators/application/schema.d.ts +3 -0
  22. package/src/generators/application/schema.json +2 -2
  23. package/src/generators/component/files/__fileName__.tsx__tmpl__ +3 -7
  24. package/src/generators/component/schema.d.ts +1 -1
  25. package/src/generators/component/schema.json +1 -1
  26. package/src/generators/hook/schema.d.ts +1 -1
  27. package/src/generators/hook/schema.json +2 -2
  28. package/src/generators/host/host.js +11 -0
  29. package/src/generators/host/schema.json +2 -2
  30. package/src/generators/library/lib/add-rollup-build-target.js +65 -28
  31. package/src/generators/redux/schema.d.ts +1 -1
  32. package/src/generators/redux/schema.json +1 -1
  33. package/src/generators/remote/lib/update-host-with-remote.js +1 -10
  34. package/src/generators/remote/remote.js +9 -0
  35. package/src/generators/remote/schema.json +2 -2
  36. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +7 -15
  37. package/src/generators/storybook-configuration/schema.json +3 -3
  38. package/src/migrations/{update-15-6-3/webpack-config-setup.d.ts → update-18-1-1/fix-target-defaults-inputs.d.ts} +1 -1
  39. package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +53 -0
  40. package/src/module-federation/with-module-federation.js +5 -0
  41. package/src/utils/add-mf-env-to-inputs.js +4 -1
  42. package/src/utils/ct-utils.js +1 -1
  43. package/src/utils/versions.d.ts +11 -11
  44. package/src/utils/versions.js +11 -11
  45. package/webpack-plugin.d.ts +1 -0
  46. package/webpack-plugin.js +5 -0
  47. package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.d.ts +0 -3
  48. package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +0 -37
  49. package/src/migrations/update-15-3-0/update-rollup-executor.d.ts +0 -3
  50. package/src/migrations/update-15-3-0/update-rollup-executor.js +0 -15
  51. package/src/migrations/update-15-6-3/webpack-config-setup.js +0 -103
@@ -19,7 +19,6 @@ async function addRollupBuildTarget(host, options) {
19
19
  '@svgr/rollup': versions_1.svgrRollupVersion,
20
20
  }));
21
21
  }
22
- const { targets } = (0, devkit_1.readProjectConfiguration)(host, options.name);
23
22
  const external = ['react', 'react-dom'];
24
23
  if (options.style === '@emotion/styled') {
25
24
  external.push('@emotion/react/jsx-runtime');
@@ -27,33 +26,71 @@ async function addRollupBuildTarget(host, options) {
27
26
  else {
28
27
  external.push('react/jsx-runtime');
29
28
  }
30
- targets.build = {
31
- executor: '@nx/rollup:rollup',
32
- outputs: ['{options.outputPath}'],
33
- options: {
34
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot),
35
- tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
36
- project: `${options.projectRoot}/package.json`,
37
- entryFile: (0, maybe_js_1.maybeJs)(options, `${options.projectRoot}/src/index.ts`),
38
- external,
39
- rollupConfig: `@nx/react/plugins/bundle-rollup`,
40
- compiler: options.compiler ?? 'babel',
41
- assets: [
42
- {
43
- glob: `${options.projectRoot}/README.md`,
44
- input: '.',
45
- output: '.',
46
- },
47
- ],
48
- },
49
- };
50
- (0, devkit_1.updateProjectConfiguration)(host, options.name, {
51
- root: options.projectRoot,
52
- sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
53
- projectType: 'library',
54
- tags: options.parsedTags,
55
- targets,
56
- });
29
+ const nxJson = (0, devkit_1.readNxJson)(host);
30
+ const hasRollupPlugin = !!nxJson.plugins?.some((p) => typeof p === 'string'
31
+ ? p === '@nx/rollup/plugin'
32
+ : p.plugin === '@nx/rollup/plugin');
33
+ if (hasRollupPlugin) {
34
+ // New behavior, using rollup config file and inferred target.
35
+ host.write((0, devkit_1.joinPathFragments)(options.projectRoot, 'rollup.config.js'), (0, devkit_1.stripIndents) `
36
+ const { withNx } = require('@nx/rollup/with-nx');
37
+ const url = require('@rollup/plugin-url');
38
+ const svg = require('@svgr/rollup');
39
+
40
+ module.exports = withNx({
41
+ main: '${(0, maybe_js_1.maybeJs)(options, './src/index.ts')}',
42
+ outputPath: '${(0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.projectRoot), 'dist', options.projectRoot)}',
43
+ tsConfig: './tsconfig.lib.json',
44
+ compiler: '${options.compiler ?? 'babel'}',
45
+ external: ${JSON.stringify(external)},
46
+ format: ['esm'],
47
+ assets:[{ input: '.', output: '.', glob: 'README.md'}],
48
+ }, {
49
+ // Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
50
+ plugins: [
51
+ svg({
52
+ svgo: false,
53
+ titleProp: true,
54
+ ref: true,
55
+ }),
56
+ url({
57
+ limit: 10000, // 10kB
58
+ }),
59
+ ],
60
+ });
61
+ `);
62
+ }
63
+ else {
64
+ // Legacy behavior, there is a target in project.json using rollup executor.
65
+ const { targets } = (0, devkit_1.readProjectConfiguration)(host, options.name);
66
+ targets.build = {
67
+ executor: '@nx/rollup:rollup',
68
+ outputs: ['{options.outputPath}'],
69
+ options: {
70
+ outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot),
71
+ tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
72
+ project: `${options.projectRoot}/package.json`,
73
+ entryFile: (0, maybe_js_1.maybeJs)(options, `${options.projectRoot}/src/index.ts`),
74
+ external,
75
+ rollupConfig: `@nx/react/plugins/bundle-rollup`,
76
+ compiler: options.compiler ?? 'babel',
77
+ assets: [
78
+ {
79
+ glob: `${options.projectRoot}/README.md`,
80
+ input: '.',
81
+ output: '.',
82
+ },
83
+ ],
84
+ },
85
+ };
86
+ (0, devkit_1.updateProjectConfiguration)(host, options.name, {
87
+ root: options.projectRoot,
88
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
89
+ projectType: 'library',
90
+ tags: options.parsedTags,
91
+ targets,
92
+ });
93
+ }
57
94
  return (0, devkit_1.runTasksInSerial)(...tasks);
58
95
  }
59
96
  exports.addRollupBuildTarget = addRollupBuildTarget;
@@ -1,7 +1,7 @@
1
1
  export interface Schema {
2
2
  name: string;
3
3
  /**
4
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19.
4
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20.
5
5
  */
6
6
  project?: string;
7
7
  directory?: string;
@@ -22,7 +22,7 @@
22
22
  "$default": {
23
23
  "$source": "projectName"
24
24
  },
25
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
25
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20."
26
26
  },
27
27
  "directory": {
28
28
  "type": "string",
@@ -14,7 +14,6 @@ function updateHostWithRemote(host, hostName, remoteName) {
14
14
  if (!host.exists(moduleFederationConfigPath)) {
15
15
  moduleFederationConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'module-federation.config.ts');
16
16
  }
17
- const remoteDefsPath = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'remotes.d.ts');
18
17
  const appComponentPath = findAppComponentPath(host, hostConfig.sourceRoot);
19
18
  if (host.exists(moduleFederationConfigPath)) {
20
19
  // find the host project path
@@ -27,17 +26,9 @@ function updateHostWithRemote(host, hostName, remoteName) {
27
26
  // TODO(jack): Point to the nx.dev guide when ready.
28
27
  devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host"?`);
29
28
  }
30
- if (host.exists(remoteDefsPath)) {
31
- let sourceCode = host.read(remoteDefsPath).toString();
32
- const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
33
- host.write(remoteDefsPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteDefinition)(source, remoteName)));
34
- }
35
- else {
36
- devkit_1.logger.warn(`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nx/react:host"?`);
37
- }
38
29
  if (host.exists(appComponentPath)) {
39
30
  let sourceCode = host.read(appComponentPath).toString();
40
- const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
31
+ const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true, tsModule.ScriptKind.TSX);
41
32
  host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
42
33
  }
43
34
  else {
@@ -13,6 +13,7 @@ const setup_tspath_for_remote_1 = require("./lib/setup-tspath-for-remote");
13
13
  const add_remote_to_dynamic_host_1 = require("./lib/add-remote-to-dynamic-host");
14
14
  const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
15
15
  const maybe_js_1 = require("../../utils/maybe-js");
16
+ const js_1 = require("@nx/js");
16
17
  function addModuleFederationFiles(host, options) {
17
18
  const templateVariables = {
18
19
  ...(0, devkit_1.names)(options.name),
@@ -56,6 +57,14 @@ async function remoteGeneratorInternal(host, schema) {
56
57
  // TODO(colum): remove when MF works with Crystal
57
58
  addPlugin: false,
58
59
  };
60
+ if (options.dynamic) {
61
+ // Dynamic remotes generate with library { type: 'var' } by default.
62
+ // We need to ensure that the remote name is a valid variable name.
63
+ const isValidRemote = (0, js_1.isValidVariable)(options.name);
64
+ if (!isValidRemote.isValid) {
65
+ throw new Error(`Invalid remote name provided: ${options.name}. ${isValidRemote.message}`);
66
+ }
67
+ }
59
68
  const initAppTask = await (0, application_1.default)(host, {
60
69
  ...options,
61
70
  // Only webpack works with module federation for now.
@@ -109,10 +109,10 @@
109
109
  },
110
110
  "e2eTestRunner": {
111
111
  "type": "string",
112
- "enum": ["cypress", "playwright", "none"],
112
+ "enum": ["playwright", "cypress", "none"],
113
113
  "description": "Test runner to use for end to end (E2E) tests.",
114
114
  "x-prompt": "Which E2E test runner would you like to use?",
115
- "default": "cypress"
115
+ "default": "playwright"
116
116
  },
117
117
  "tags": {
118
118
  "type": "string",
@@ -2,22 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addTailwindStyleImports = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const knownLocations = [
6
- // Plain React
7
- 'src/styles.css',
8
- 'src/styles.scss',
9
- 'src/styles.less',
10
- // Next.js
11
- 'pages/styles.css',
12
- 'pages/styles.scss',
13
- 'pages/styles.less',
14
- 'app/global.css',
15
- 'app/global.scss',
16
- 'app/global.less',
17
- ];
5
+ // base directories and file types to simplify locating the stylesheet
6
+ const baseDirs = ['src', 'pages', 'src/pages', 'src/app', 'app'];
7
+ const fileNames = ['styles', 'global'];
8
+ const extensions = ['.css', '.scss', '.less'];
9
+ const knownLocations = baseDirs.flatMap((dir) => fileNames.flatMap((name) => extensions.map((ext) => `${dir}/${name}${ext}`)));
18
10
  function addTailwindStyleImports(tree, project, _options) {
19
- const candidates = knownLocations.map((x) => (0, devkit_1.joinPathFragments)(project.root, x));
20
- const stylesPath = candidates.find((x) => tree.exists(x));
11
+ const candidates = knownLocations.map((currentPath) => (0, devkit_1.joinPathFragments)(project.root, currentPath));
12
+ const stylesPath = candidates.find((currentStylePath) => tree.exists(currentStylePath));
21
13
  if (stylesPath) {
22
14
  const content = tree.read(stylesPath).toString();
23
15
  tree.write(stylesPath, `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n${content}`);
@@ -29,7 +29,7 @@
29
29
  "configureCypress": {
30
30
  "type": "boolean",
31
31
  "description": "Run the cypress-configure generator.",
32
- "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
32
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
33
33
  },
34
34
  "generateStories": {
35
35
  "type": "boolean",
@@ -41,7 +41,7 @@
41
41
  "generateCypressSpecs": {
42
42
  "type": "boolean",
43
43
  "description": "Automatically generate test files in the Cypress E2E app generated by the `cypress-configure` generator.",
44
- "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
44
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
45
45
  },
46
46
  "configureStaticServe": {
47
47
  "type": "boolean",
@@ -53,7 +53,7 @@
53
53
  "cypressDirectory": {
54
54
  "type": "string",
55
55
  "description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56
- "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
56
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
57
57
  },
58
58
  "js": {
59
59
  "type": "boolean",
@@ -1,2 +1,2 @@
1
- import { Tree } from '@nx/devkit';
1
+ import { type Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ async function default_1(tree) {
5
+ if (!hasModuleFederationProject(tree)) {
6
+ return;
7
+ }
8
+ ensureTargetDefaultsContainProductionInputs(tree);
9
+ await (0, devkit_1.formatFiles)(tree);
10
+ }
11
+ exports.default = default_1;
12
+ function ensureTargetDefaultsContainProductionInputs(tree) {
13
+ const nxJson = (0, devkit_1.readNxJson)(tree);
14
+ const webpackExecutor = '@nx/webpack:webpack';
15
+ const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
16
+ nxJson.targetDefaults[webpackExecutor] ??= {};
17
+ nxJson.targetDefaults[webpackExecutor].inputs ??= [
18
+ 'production',
19
+ '^production',
20
+ { env: mfEnvVar },
21
+ ];
22
+ if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('production')) {
23
+ nxJson.targetDefaults[webpackExecutor].inputs.push('production');
24
+ }
25
+ if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('^production')) {
26
+ nxJson.targetDefaults[webpackExecutor].inputs.push('^production');
27
+ }
28
+ let mfEnvVarExists = false;
29
+ for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
30
+ if (typeof input === 'object' && input['env'] === mfEnvVar) {
31
+ mfEnvVarExists = true;
32
+ break;
33
+ }
34
+ }
35
+ if (!mfEnvVarExists) {
36
+ nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
37
+ }
38
+ (0, devkit_1.updateNxJson)(tree, nxJson);
39
+ }
40
+ function hasModuleFederationProject(tree) {
41
+ const projects = (0, devkit_1.getProjects)(tree);
42
+ for (const project of projects.values()) {
43
+ const targets = project.targets || {};
44
+ for (const [_, target] of Object.entries(targets)) {
45
+ if (target.executor === '@nx/webpack:webpack' &&
46
+ (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
47
+ tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
48
+ return true;
49
+ }
50
+ }
51
+ }
52
+ return false;
53
+ }
@@ -23,6 +23,11 @@ async function withModuleFederation(options) {
23
23
  config.optimization = {
24
24
  runtimeChunk: false,
25
25
  };
26
+ if (config.mode === 'development' &&
27
+ Object.keys(mappedRemotes).length > 1 &&
28
+ !options.exposes) {
29
+ config.optimization.runtimeChunk = 'single';
30
+ }
26
31
  config.experiments = {
27
32
  ...config.experiments,
28
33
  outputModule: !isGlobal,
@@ -8,7 +8,10 @@ function addMfEnvToTargetDefaultInputs(tree) {
8
8
  const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
9
9
  nxJson.targetDefaults ??= {};
10
10
  nxJson.targetDefaults[webpackExecutor] ??= {};
11
- nxJson.targetDefaults[webpackExecutor].inputs ??= [];
11
+ nxJson.targetDefaults[webpackExecutor].inputs ??= [
12
+ 'production',
13
+ '^production',
14
+ ];
12
15
  let mfEnvVarExists = false;
13
16
  for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
14
17
  if (typeof input === 'object' && input['env'] === mfEnvVar) {
@@ -26,7 +26,7 @@ async function configureCypressCT(tree, options) {
26
26
  const buildTargetProject = (0, devkit_1.readProjectConfiguration)(tree, project);
27
27
  const executor = buildTargetProject.targets?.[target]?.executor;
28
28
  if (!executor || !options.validExecutorNames.has(executor)) {
29
- throw new Error(`Cypress Component Testing is not currently supported for this project. Please check https://github.com/nrwl/nx/issues/21546 for more information.`);
29
+ throw new Error(`Cypress Component Testing is not currently supported for this project. Either 'executer' is not defined in '${target} target' of '${project} project.json' or executer present is not valid one. Valid ones are ${JSON.stringify([...options.validExecutorNames])}. Please check https://github.com/nrwl/nx/issues/21546 for more information.`);
30
30
  }
31
31
  }
32
32
  const { addDefaultCTConfig, getProjectCypressConfigPath } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
@@ -1,13 +1,13 @@
1
1
  export declare const nxVersion: any;
2
2
  export declare const nxRspackVersion = "*";
3
- export declare const reactVersion = "18.2.0";
4
- export declare const reactDomVersion = "18.2.0";
5
- export declare const reactIsVersion = "18.2.0";
3
+ export declare const reactVersion = "18.3.1";
4
+ export declare const reactDomVersion = "18.3.1";
5
+ export declare const reactIsVersion = "18.3.1";
6
6
  export declare const swcLoaderVersion = "0.1.15";
7
7
  export declare const babelLoaderVersion = "^9.1.2";
8
- export declare const typesReactVersion = "18.2.33";
9
- export declare const typesReactDomVersion = "18.2.14";
10
- export declare const typesReactIsVersion = "18.2.2";
8
+ export declare const typesReactVersion = "18.3.1";
9
+ export declare const typesReactDomVersion = "18.3.0";
10
+ export declare const typesReactIsVersion = "18.3.0";
11
11
  export declare const typesNodeVersion = "18.16.9";
12
12
  export declare const babelPresetReactVersion = "^7.14.5";
13
13
  export declare const babelCoreVersion = "^7.14.5";
@@ -18,7 +18,7 @@ export declare const emotionReactVersion = "11.11.1";
18
18
  export declare const emotionBabelPlugin = "11.11.0";
19
19
  export declare const styledJsxVersion = "5.1.2";
20
20
  export declare const reactRouterDomVersion = "6.11.2";
21
- export declare const testingLibraryReactVersion = "14.0.0";
21
+ export declare const testingLibraryReactVersion = "15.0.6";
22
22
  export declare const reduxjsToolkitVersion = "1.9.3";
23
23
  export declare const reactReduxVersion = "8.0.5";
24
24
  export declare const reactTestRendererVersion = "18.2.0";
@@ -28,8 +28,8 @@ export declare const eslintPluginReactVersion = "7.32.2";
28
28
  export declare const eslintPluginReactHooksVersion = "4.6.0";
29
29
  export declare const babelPluginStyledComponentsVersion = "1.10.7";
30
30
  export declare const tsLibVersion = "^2.3.0";
31
- export declare const postcssVersion = "8.4.21";
32
- export declare const tailwindcssVersion = "3.2.7";
31
+ export declare const postcssVersion = "8.4.38";
32
+ export declare const tailwindcssVersion = "3.4.3";
33
33
  export declare const autoprefixerVersion = "10.4.13";
34
34
  export declare const expressVersion = "~4.18.2";
35
35
  export declare const typesExpressVersion = "4.17.17";
@@ -39,8 +39,8 @@ export declare const typesCorsVersion = "~2.8.12";
39
39
  export declare const moduleFederationNodeVersion = "~0.9.9";
40
40
  export declare const lessVersion = "3.12.2";
41
41
  export declare const sassVersion = "^1.55.0";
42
- export declare const rollupPluginUrlVersion = "^7.0.0";
43
- export declare const svgrRollupVersion = "^8.0.1";
42
+ export declare const rollupPluginUrlVersion = "^8.0.2";
43
+ export declare const svgrRollupVersion = "^8.1.0";
44
44
  export declare const swcPluginStyledJsxVersion = "^1.5.67";
45
45
  export declare const swcPluginEmotionVersion = "^2.5.67";
46
46
  export declare const swcPluginStyledComponentsVersion = "^1.5.67";
@@ -4,14 +4,14 @@ exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exp
4
4
  exports.nxVersion = require('../../package.json').version;
5
5
  // Always pull the latest version until we merge rspack plugin into the repo.
6
6
  exports.nxRspackVersion = '*';
7
- exports.reactVersion = '18.2.0';
8
- exports.reactDomVersion = '18.2.0';
9
- exports.reactIsVersion = '18.2.0';
7
+ exports.reactVersion = '18.3.1';
8
+ exports.reactDomVersion = '18.3.1';
9
+ exports.reactIsVersion = '18.3.1';
10
10
  exports.swcLoaderVersion = '0.1.15';
11
11
  exports.babelLoaderVersion = '^9.1.2';
12
- exports.typesReactVersion = '18.2.33';
13
- exports.typesReactDomVersion = '18.2.14';
14
- exports.typesReactIsVersion = '18.2.2';
12
+ exports.typesReactVersion = '18.3.1';
13
+ exports.typesReactDomVersion = '18.3.0';
14
+ exports.typesReactIsVersion = '18.3.0';
15
15
  exports.typesNodeVersion = '18.16.9';
16
16
  exports.babelPresetReactVersion = '^7.14.5';
17
17
  exports.babelCoreVersion = '^7.14.5';
@@ -23,7 +23,7 @@ exports.emotionBabelPlugin = '11.11.0';
23
23
  // WARNING: This needs to be in sync with Next.js' dependency or else there might be issues.
24
24
  exports.styledJsxVersion = '5.1.2';
25
25
  exports.reactRouterDomVersion = '6.11.2';
26
- exports.testingLibraryReactVersion = '14.0.0';
26
+ exports.testingLibraryReactVersion = '15.0.6';
27
27
  exports.reduxjsToolkitVersion = '1.9.3';
28
28
  exports.reactReduxVersion = '8.0.5';
29
29
  exports.reactTestRendererVersion = '18.2.0';
@@ -33,8 +33,8 @@ exports.eslintPluginReactVersion = '7.32.2';
33
33
  exports.eslintPluginReactHooksVersion = '4.6.0';
34
34
  exports.babelPluginStyledComponentsVersion = '1.10.7';
35
35
  exports.tsLibVersion = '^2.3.0';
36
- exports.postcssVersion = '8.4.21';
37
- exports.tailwindcssVersion = '3.2.7';
36
+ exports.postcssVersion = '8.4.38';
37
+ exports.tailwindcssVersion = '3.4.3';
38
38
  exports.autoprefixerVersion = '10.4.13';
39
39
  // SSR and Module Federation
40
40
  exports.expressVersion = '~4.18.2';
@@ -47,8 +47,8 @@ exports.moduleFederationNodeVersion = '~0.9.9';
47
47
  exports.lessVersion = '3.12.2';
48
48
  exports.sassVersion = '^1.55.0';
49
49
  // rollup plugins (if needed)
50
- exports.rollupPluginUrlVersion = '^7.0.0';
51
- exports.svgrRollupVersion = '^8.0.1';
50
+ exports.rollupPluginUrlVersion = '^8.0.2';
51
+ exports.svgrRollupVersion = '^8.1.0';
52
52
  exports.swcPluginStyledJsxVersion = '^1.5.67';
53
53
  exports.swcPluginEmotionVersion = '^2.5.67';
54
54
  exports.swcPluginStyledComponentsVersion = '^1.5.67';
@@ -0,0 +1 @@
1
+ export { NxReactWebpackPlugin } from './plugins/nx-react-webpack-plugin/nx-react-webpack-plugin';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NxReactWebpackPlugin = void 0;
4
+ var nx_react_webpack_plugin_1 = require("./plugins/nx-react-webpack-plugin/nx-react-webpack-plugin");
5
+ Object.defineProperty(exports, "NxReactWebpackPlugin", { enumerable: true, get: function () { return nx_react_webpack_plugin_1.NxReactWebpackPlugin; } });
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function installWebpackRollupDependencies(tree: Tree): import("@nx/devkit").GeneratorCallback;
3
- export default installWebpackRollupDependencies;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installWebpackRollupDependencies = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- const versions_1 = require("../../utils/versions");
6
- function installWebpackRollupDependencies(tree) {
7
- const projects = (0, devkit_1.getProjects)(tree);
8
- let shouldInstall = false;
9
- for (const [, project] of projects) {
10
- if (project.targets?.build?.executor === '@nrwl/webpack:webpack' ||
11
- project.targets?.build?.executor === '@nrwl/rollup:rollup' ||
12
- project.targets?.build?.executor === '@nrwl/web:rollup') {
13
- shouldInstall = true;
14
- break;
15
- }
16
- }
17
- if (shouldInstall) {
18
- // These were previously dependencies of `@nrwl/react` but we've removed them
19
- // to accommodate different bundlers and test runners.
20
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
21
- '@babel/preset-react': '^7.14.5',
22
- '@pmmmwh/react-refresh-webpack-plugin': '^0.5.7',
23
- '@svgr/webpack': '^6.1.2',
24
- 'css-loader': '^6.4.0',
25
- 'react-refresh': '^0.10.0',
26
- 'style-loader': '^3.3.0',
27
- stylus: '^0.55.0',
28
- 'stylus-loader': '^7.1.0',
29
- 'url-loader': '^4.1.1',
30
- webpack: '^5.75.0',
31
- 'webpack-merge': '^5.8.0',
32
- '@nrwl/webpack': versions_1.nxVersion,
33
- });
34
- }
35
- }
36
- exports.installWebpackRollupDependencies = installWebpackRollupDependencies;
37
- exports.default = installWebpackRollupDependencies;
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function updateRollupExecutor(tree: Tree): void;
3
- export default updateRollupExecutor;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateRollupExecutor = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- function updateRollupExecutor(tree) {
6
- const projects = (0, devkit_1.getProjects)(tree);
7
- for (const [name, project] of projects) {
8
- if (project.targets?.build?.executor === '@nrwl/web:rollup') {
9
- project.targets.build.executor = '@nrwl/rollup:rollup';
10
- (0, devkit_1.updateProjectConfiguration)(tree, name, project);
11
- }
12
- }
13
- }
14
- exports.updateRollupExecutor = updateRollupExecutor;
15
- exports.default = updateRollupExecutor;
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
5
- const path_1 = require("path");
6
- async function default_1(tree) {
7
- // Since projects can have multiple configurations, we need to know if the default options
8
- // need to be migrated or not. If so then the subsequent configurations with `webpackConfig` also need to be.
9
- const defaultOptionsUpdated = new Set();
10
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (options, projectName, targetName, configurationName) => {
11
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
12
- const defaultOptions = projectConfiguration.targets[targetName].options;
13
- const defaultWasUpdated = defaultOptionsUpdated.has(projectName);
14
- // If default was not updated (for different configurations), we don't do anything
15
- // If isolatedConfig is set, we don't need to do anything
16
- // If it is NOT React, we don't need to do anything
17
- if (!defaultWasUpdated &&
18
- (defaultOptions?.['isolatedConfig'] ||
19
- !(defaultOptions?.['main']?.match(/main\.(t|j)sx$/) ||
20
- defaultOptions?.['webpackConfig'] === '@nrwl/react/plugins/webpack'))) {
21
- return;
22
- }
23
- defaultOptionsUpdated.add(projectName);
24
- // If this is not the default options (e.g. for development, production, or something custom),
25
- // then skip it unless it specifically configures a webpackConfig file
26
- if (configurationName && !options?.webpackConfig) {
27
- return;
28
- }
29
- // If webpackConfig is set, update it with the new options
30
- // If webpackConfig is not set, we need to create a new
31
- // webpack.config.js file and set the path to it in the
32
- // executor options
33
- if (options?.['webpackConfig'] &&
34
- options['webpackConfig'] !== '@nrwl/react/plugins/webpack') {
35
- let oldName = options['webpackConfig'];
36
- if (options['webpackConfig'].endsWith('.js')) {
37
- oldName = options['webpackConfig'].replace('.js', '.old.js');
38
- }
39
- if (options['webpackConfig'].endsWith('.ts')) {
40
- oldName = options['webpackConfig'].replace('.ts', '.old.ts');
41
- }
42
- renameFile(tree, options['webpackConfig'], oldName);
43
- const justTheFileName = (0, path_1.basename)(oldName);
44
- tree.write(options['webpackConfig'], `
45
- const { composePlugins, withNx } = require('@nrwl/webpack');
46
- const { withReact } = require('@nrwl/react');
47
-
48
- // Nx plugins for webpack.
49
- module.exports = composePlugins(withNx(), withReact(), (config, { options, context }) => {
50
- // Note: This was added by an Nx migration.
51
- // You should consider inlining the logic into this file.
52
- // For more information on webpack config and Nx see:
53
- // https://nx.dev/recipes/webpack/webpack-config-setup
54
- return require('./${justTheFileName}')(config, context);
55
- });
56
- `);
57
- options['isolatedConfig'] = true;
58
- projectConfiguration.targets[targetName][configurationName ?? 'options'] = options;
59
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
60
- devkit_1.logger.info(`
61
- ${options['webpackConfig']} has been renamed to ${oldName} and a new ${options['webpackConfig']}
62
- has been created for your project ${projectName}.
63
- You should consider inlining the logic from ${oldName} into ${options['webpackConfig']}.
64
- You can read our guide on how to do this here:
65
-
66
- https://nx.dev/recipes/webpack/webpack-config-setup
67
- `);
68
- }
69
- else {
70
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
71
- if (!options) {
72
- options = {};
73
- }
74
- options['webpackConfig'] = `${projectConfiguration.root}/webpack.config.js`;
75
- options['isolatedConfig'] = true;
76
- tree.write(options['webpackConfig'], `
77
- const { composePlugins, withNx } = require('@nrwl/webpack');
78
- const { withReact } = require('@nrwl/react');
79
-
80
- // Nx plugins for webpack.
81
- module.exports = composePlugins(withNx(), withReact(), (config, { options, context }) => {
82
- // Update the webpack config as needed here.
83
- // e.g. config.plugins.push(new MyPlugin())
84
- // For more information on webpack config and Nx see:
85
- // https://nx.dev/recipes/webpack/webpack-config-setup
86
- return config;
87
- });
88
- `);
89
- projectConfiguration.targets[targetName].options = options;
90
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
91
- }
92
- });
93
- await (0, devkit_1.formatFiles)(tree);
94
- }
95
- exports.default = default_1;
96
- function renameFile(tree, from, to) {
97
- const buffer = tree.read(from);
98
- if (!buffer) {
99
- return;
100
- }
101
- tree.write(to, buffer);
102
- tree.delete(from);
103
- }