@nx/react 17.0.3 → 17.0.4

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 (154) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -4
  3. package/generators.json +1 -1
  4. package/index.d.ts +1 -0
  5. package/index.js +3 -1
  6. package/mf/dynamic-federation.d.ts +4 -0
  7. package/mf/dynamic-federation.js +75 -0
  8. package/mf/index.d.ts +1 -0
  9. package/mf/index.js +7 -0
  10. package/migrations.json +21 -0
  11. package/package.json +7 -7
  12. package/plugins/component-testing/index.js +52 -24
  13. package/plugins/component-testing/webpack-fallback.js +1 -1
  14. package/plugins/nx-react-webpack-plugin/lib/apply-react-config.d.ts +4 -0
  15. package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +86 -0
  16. package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.d.ts +8 -0
  17. package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.js +13 -0
  18. package/plugins/storybook/index.js +6 -2
  19. package/plugins/storybook/merge-plugins.d.ts +1 -1
  20. package/plugins/webpack.d.ts +1 -3
  21. package/plugins/webpack.js +3 -11
  22. package/plugins/with-react.d.ts +2 -4
  23. package/plugins/with-react.js +2 -58
  24. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +12 -0
  25. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +149 -51
  26. package/src/executors/module-federation-dev-server/schema.json +9 -1
  27. package/src/generators/application/application.js +41 -18
  28. package/src/generators/application/files/base-vite/index.html__tmpl__ +1 -1
  29. package/src/generators/application/files/base-webpack/src/index.html +0 -2
  30. package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +46 -5
  31. package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +54 -13
  32. package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +33 -0
  33. package/src/generators/application/files/style-tailwind/src/styles.css +1 -0
  34. package/src/generators/application/lib/add-e2e.js +25 -7
  35. package/src/generators/application/lib/add-jest.js +2 -2
  36. package/src/generators/application/lib/add-project.d.ts +2 -2
  37. package/src/generators/application/lib/add-project.js +12 -15
  38. package/src/generators/application/lib/add-routing.d.ts +1 -1
  39. package/src/generators/application/lib/add-routing.js +4 -8
  40. package/src/generators/application/lib/create-application-files.js +30 -1
  41. package/src/generators/application/lib/install-common-dependencies.js +15 -1
  42. package/src/generators/application/lib/normalize-options.js +35 -1
  43. package/src/generators/application/lib/set-defaults.js +1 -0
  44. package/src/generators/application/lib/update-jest-config.js +8 -8
  45. package/src/generators/application/schema.d.ts +5 -0
  46. package/src/generators/application/schema.json +7 -3
  47. package/src/generators/component/files/__fileName__.tsx__tmpl__ +39 -22
  48. package/src/generators/component/lib/normalize-options.js +4 -2
  49. package/src/generators/component/schema.d.ts +6 -4
  50. package/src/generators/component/schema.json +7 -7
  51. package/src/generators/component-cypress-spec/schema.json +1 -1
  52. package/src/generators/component-story/schema.json +1 -1
  53. package/src/generators/component-test/schema.json +1 -1
  54. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +2 -1
  55. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +18 -7
  56. package/src/generators/cypress-component-configuration/lib/add-files.js +1 -6
  57. package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
  58. package/src/generators/federate-module/federate-module.js +2 -2
  59. package/src/generators/federate-module/schema.d.ts +1 -1
  60. package/src/generators/federate-module/schema.json +4 -3
  61. package/src/generators/hook/files/__fileName__.ts__tmpl__ +15 -15
  62. package/src/generators/hook/schema.d.ts +4 -4
  63. package/src/generators/hook/schema.json +5 -5
  64. package/src/generators/host/files/common/src/main.js__tmpl__ +10 -0
  65. package/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +19 -0
  66. package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +41 -0
  67. package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +10 -0
  68. package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +17 -2
  69. package/src/generators/host/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +5 -2
  70. package/src/generators/host/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +5 -2
  71. package/src/generators/host/files/module-federation-ts/module-federation.config.ts__tmpl__ +17 -2
  72. package/src/generators/host/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +2 -1
  73. package/src/generators/host/files/module-federation-ts/webpack.config.ts__tmpl__ +2 -2
  74. package/src/generators/host/host.js +15 -1
  75. package/src/generators/host/lib/add-module-federation-files.d.ts +2 -1
  76. package/src/generators/host/lib/add-module-federation-files.js +24 -11
  77. package/src/generators/host/lib/setup-ssr-for-host.js +1 -0
  78. package/src/generators/host/lib/update-module-federation-e2e-project.js +7 -5
  79. package/src/generators/host/schema.d.ts +5 -2
  80. package/src/generators/host/schema.json +16 -6
  81. package/src/generators/init/init.d.ts +1 -1
  82. package/src/generators/init/init.js +10 -49
  83. package/src/generators/init/schema.d.ts +1 -6
  84. package/src/generators/init/schema.json +5 -22
  85. package/src/generators/library/lib/add-linting.js +2 -2
  86. package/src/generators/library/lib/add-rollup-build-target.d.ts +2 -1
  87. package/src/generators/library/lib/add-rollup-build-target.js +16 -8
  88. package/src/generators/library/lib/install-common-dependencies.js +13 -5
  89. package/src/generators/library/lib/normalize-options.js +34 -5
  90. package/src/generators/library/lib/update-app-routes.js +1 -1
  91. package/src/generators/library/library.js +17 -6
  92. package/src/generators/library/schema.d.ts +1 -0
  93. package/src/generators/library/schema.json +3 -3
  94. package/src/generators/redux/schema.d.ts +1 -1
  95. package/src/generators/redux/schema.json +2 -2
  96. package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +4 -1
  97. package/src/generators/remote/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +1 -1
  98. package/src/generators/remote/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +1 -1
  99. package/src/generators/remote/files/module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +19 -0
  100. package/src/generators/remote/files/module-federation-ts/module-federation.config.ts__tmpl__ +4 -1
  101. package/src/generators/remote/files/module-federation-ts/tsconfig.lint.json__tmpl__ +19 -0
  102. package/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +2 -0
  103. package/src/generators/remote/lib/add-remote-to-dynamic-host.js +11 -0
  104. package/src/generators/remote/lib/setup-ssr-for-remote.js +5 -1
  105. package/src/generators/remote/lib/setup-tspath-for-remote.js +2 -1
  106. package/src/generators/remote/lib/update-host-with-remote.js +10 -1
  107. package/src/generators/remote/remote.js +22 -2
  108. package/src/generators/remote/schema.d.ts +3 -2
  109. package/src/generators/remote/schema.json +17 -6
  110. package/src/generators/setup-ssr/schema.json +1 -1
  111. package/src/generators/setup-ssr/setup-ssr.js +23 -7
  112. package/src/generators/setup-tailwind/schema.json +1 -1
  113. package/src/generators/stories/schema.json +1 -1
  114. package/src/generators/stories/stories.js +17 -5
  115. package/src/generators/storybook-configuration/configuration.d.ts +2 -0
  116. package/src/generators/storybook-configuration/configuration.js +37 -15
  117. package/src/generators/storybook-configuration/schema.d.ts +2 -1
  118. package/src/generators/storybook-configuration/schema.json +7 -7
  119. package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +2 -0
  120. package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +26 -0
  121. package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +2 -0
  122. package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +53 -0
  123. package/src/module-federation/ast-utils.js +1 -1
  124. package/src/module-federation/utils.js +8 -1
  125. package/src/module-federation/with-module-federation-ssr.js +3 -0
  126. package/src/module-federation/with-module-federation.d.ts +3 -3
  127. package/src/module-federation/with-module-federation.js +14 -4
  128. package/src/rules/update-module-federation-project.d.ts +2 -0
  129. package/src/rules/update-module-federation-project.js +12 -3
  130. package/src/utils/add-mf-env-to-inputs.d.ts +2 -0
  131. package/src/utils/add-mf-env-to-inputs.js +27 -0
  132. package/src/utils/assertion.js +1 -0
  133. package/src/utils/ct-utils.d.ts +6 -1
  134. package/src/utils/ct-utils.js +39 -9
  135. package/src/utils/get-in-source-vitest-tests-template.js +1 -1
  136. package/src/utils/has-vite-plugin.d.ts +2 -0
  137. package/src/utils/has-vite-plugin.js +11 -0
  138. package/src/utils/has-webpack-plugin.d.ts +2 -0
  139. package/src/utils/has-webpack-plugin.js +11 -0
  140. package/src/utils/maybe-js.d.ts +3 -0
  141. package/src/utils/versions.d.ts +1 -1
  142. package/src/utils/versions.js +1 -1
  143. package/typings/style.d.ts +1 -0
  144. package/src/generators/application/files/base-webpack/src/environments/environment.prod.ts__tmpl__ +0 -3
  145. package/src/generators/application/files/base-webpack/src/environments/environment.ts__tmpl__ +0 -6
  146. package/src/generators/host/files/module-federation/src/main.ts__tmpl__ +0 -1
  147. package/src/generators/host/files/module-federation-ts/src/main.ts__tmpl__ +0 -1
  148. package/src/generators/library/lib/maybe-js.d.ts +0 -2
  149. /package/src/generators/host/files/common/src/app/{__fileName__.tsx__tmpl__ → __fileName__.js__tmpl__} +0 -0
  150. /package/src/generators/remote/files/{module-federation/src/main.ts__tmpl__ → common/src/main.js__tmpl__} +0 -0
  151. /package/src/generators/remote/files/{module-federation/src/remote-entry.ts__tmpl__ → common/src/remote-entry.js__tmpl__} +0 -0
  152. /package/src/generators/remote/files/{module-federation-ts → common-ts}/src/main.ts__tmpl__ +0 -0
  153. /package/src/generators/remote/files/{module-federation-ts → common-ts}/src/remote-entry.ts__tmpl__ +0 -0
  154. /package/src/{generators/library/lib → utils}/maybe-js.js +0 -0
@@ -5,9 +5,16 @@ const module_federation_1 = require("@nx/webpack/src/utils/module-federation");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const project_graph_1 = require("nx/src/project-graph/project-graph");
7
7
  function getFunctionDeterminateRemoteUrl(isServer = false) {
8
- const target = isServer ? 'serve-server' : 'serve';
8
+ const target = 'serve';
9
9
  const remoteEntry = isServer ? 'server/remoteEntry.js' : 'remoteEntry.js';
10
10
  return function (remote) {
11
+ const mappedStaticRemotesFromEnv = process.env
12
+ .NX_MF_DEV_SERVER_STATIC_REMOTES
13
+ ? JSON.parse(process.env.NX_MF_DEV_SERVER_STATIC_REMOTES)
14
+ : undefined;
15
+ if (mappedStaticRemotesFromEnv && mappedStaticRemotesFromEnv[remote]) {
16
+ return `${mappedStaticRemotesFromEnv[remote]}/${remoteEntry}`;
17
+ }
11
18
  let remoteConfiguration = null;
12
19
  try {
13
20
  remoteConfiguration = (0, project_graph_1.readCachedProjectConfiguration)(remote);
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withModuleFederationForSSR = void 0;
4
4
  const utils_1 = require("./utils");
5
5
  async function withModuleFederationForSSR(options) {
6
+ if (global.NX_GRAPH_CREATION) {
7
+ return (config) => config;
8
+ }
6
9
  const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options, {
7
10
  isServer: true,
8
11
  });
@@ -1,7 +1,7 @@
1
1
  import { ModuleFederationConfig } from '@nx/webpack/src/utils/module-federation';
2
- import type { AsyncNxWebpackPlugin } from '@nx/webpack';
2
+ import type { AsyncNxComposableWebpackPlugin } from '@nx/webpack';
3
3
  /**
4
4
  * @param {ModuleFederationConfig} options
5
- * @return {Promise<AsyncNxWebpackPlugin>}
5
+ * @return {Promise<AsyncNxComposableWebpackPlugin>}
6
6
  */
7
- export declare function withModuleFederation(options: ModuleFederationConfig): Promise<AsyncNxWebpackPlugin>;
7
+ export declare function withModuleFederation(options: ModuleFederationConfig): Promise<AsyncNxComposableWebpackPlugin>;
@@ -3,24 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withModuleFederation = void 0;
4
4
  const utils_1 = require("./utils");
5
5
  const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
6
+ const isVarOrWindow = (libType) => libType === 'var' || libType === 'window';
6
7
  /**
7
8
  * @param {ModuleFederationConfig} options
8
- * @return {Promise<AsyncNxWebpackPlugin>}
9
+ * @return {Promise<AsyncNxComposableWebpackPlugin>}
9
10
  */
10
11
  async function withModuleFederation(options) {
12
+ if (global.NX_GRAPH_CREATION) {
13
+ return (config) => config;
14
+ }
11
15
  const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options);
16
+ const isGlobal = isVarOrWindow(options.library?.type);
12
17
  return (config, ctx) => {
13
18
  config.output.uniqueName = options.name;
14
19
  config.output.publicPath = 'auto';
15
- if (options.library?.type === 'var') {
20
+ if (isGlobal) {
16
21
  config.output.scriptType = 'text/javascript';
17
22
  }
18
23
  config.optimization = {
19
24
  runtimeChunk: false,
20
25
  };
26
+ if (config.mode === 'development' &&
27
+ Object.keys(mappedRemotes).length > 1 &&
28
+ !options.exposes) {
29
+ config.optimization.runtimeChunk = 'single';
30
+ }
21
31
  config.experiments = {
22
32
  ...config.experiments,
23
- outputModule: !(options.library?.type === 'var'),
33
+ outputModule: !isGlobal,
24
34
  };
25
35
  config.plugins.push(new ModuleFederationPlugin({
26
36
  name: options.name,
@@ -37,7 +47,7 @@ async function withModuleFederation(options) {
37
47
  * { appX: 'appX@http://localhost:3001/remoteEntry.js' }
38
48
  * { appY: 'appY@http://localhost:3002/remoteEntry.js' }
39
49
  */
40
- ...(options.library?.type === 'var' ? { remoteType: 'script' } : {}),
50
+ ...(isGlobal ? { remoteType: 'script' } : {}),
41
51
  }), sharedLibraries.getReplacementPlugin());
42
52
  return config;
43
53
  };
@@ -1,7 +1,9 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  export declare function updateModuleFederationProject(host: Tree, options: {
3
+ js?: boolean;
3
4
  projectName: string;
4
5
  appProjectRoot: string;
5
6
  devServerPort?: number;
6
7
  typescriptConfiguration?: boolean;
8
+ dynamic?: boolean;
7
9
  }): GeneratorCallback;
@@ -3,17 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateModuleFederationProject = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../utils/versions");
6
+ const maybe_js_1 = require("../utils/maybe-js");
6
7
  function updateModuleFederationProject(host, options) {
7
8
  const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
8
9
  projectConfig.targets.build.options = {
9
10
  ...projectConfig.targets.build.options,
10
- main: `${options.appProjectRoot}/src/main.ts`,
11
- webpackConfig: `${options.appProjectRoot}/webpack.config.${options.typescriptConfiguration ? 'ts' : 'js'}`,
11
+ main: (0, maybe_js_1.maybeJs)(options, `${options.appProjectRoot}/src/main.ts`),
12
+ webpackConfig: `${options.appProjectRoot}/webpack.config.${options.typescriptConfiguration && !options.js ? 'ts' : 'js'}`,
12
13
  };
13
14
  projectConfig.targets.build.configurations.production = {
14
15
  ...projectConfig.targets.build.configurations.production,
15
- webpackConfig: `${options.appProjectRoot}/webpack.config.prod.${options.typescriptConfiguration ? 'ts' : 'js'}`,
16
+ webpackConfig: `${options.appProjectRoot}/webpack.config.prod.${options.typescriptConfiguration && !options.js ? 'ts' : 'js'}`,
16
17
  };
18
+ // If host should be configured to use dynamic federation
19
+ if (options.dynamic) {
20
+ const pathToProdWebpackConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, `webpack.prod.config.${options.typescriptConfiguration && !options.js ? 'ts' : 'js'}`);
21
+ if (host.exists(pathToProdWebpackConfig)) {
22
+ host.delete(pathToProdWebpackConfig);
23
+ }
24
+ delete projectConfig.targets.build.configurations.production?.webpackConfig;
25
+ }
17
26
  projectConfig.targets.serve.executor =
18
27
  '@nx/react:module-federation-dev-server';
19
28
  projectConfig.targets.serve.options.port = options.devServerPort;
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function addMfEnvToTargetDefaultInputs(tree: Tree): void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addMfEnvToTargetDefaultInputs = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function addMfEnvToTargetDefaultInputs(tree) {
6
+ const nxJson = (0, devkit_1.readNxJson)(tree);
7
+ const webpackExecutor = '@nx/webpack:webpack';
8
+ const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
9
+ nxJson.targetDefaults ??= {};
10
+ nxJson.targetDefaults[webpackExecutor] ??= {};
11
+ nxJson.targetDefaults[webpackExecutor].inputs ??= [
12
+ 'production',
13
+ '^production',
14
+ ];
15
+ let mfEnvVarExists = false;
16
+ for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
17
+ if (typeof input === 'object' && input['env'] === mfEnvVar) {
18
+ mfEnvVarExists = true;
19
+ break;
20
+ }
21
+ }
22
+ if (!mfEnvVarExists) {
23
+ nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
24
+ (0, devkit_1.updateNxJson)(tree, nxJson);
25
+ }
26
+ }
27
+ exports.addMfEnvToTargetDefaultInputs = addMfEnvToTargetDefaultInputs;
@@ -5,6 +5,7 @@ const VALID_STYLES = [
5
5
  'css',
6
6
  'scss',
7
7
  'less',
8
+ 'tailwind',
8
9
  'styled-components',
9
10
  '@emotion/styled',
10
11
  'styled-jsx',
@@ -1,9 +1,14 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { type FoundTarget } from '@nx/cypress/src/utils/find-target-options';
3
- export declare function addCTTargetWithBuildTarget(tree: Tree, options: {
3
+ export declare function configureCypressCT(tree: Tree, options: {
4
4
  project: string;
5
5
  buildTarget: string;
6
+ bundler: 'vite' | 'webpack';
6
7
  validExecutorNames: Set<string>;
7
8
  }): Promise<FoundTarget>;
8
9
  export declare function getBundlerFromTarget(found: FoundTarget, tree: Tree): Promise<'vite' | 'webpack'>;
10
+ export declare function getActualBundler(tree: Tree, options: {
11
+ buildTarget?: string;
12
+ bundler?: 'vite' | 'webpack';
13
+ }, found: FoundTarget): Promise<"vite" | "webpack">;
9
14
  export declare function isComponent(tree: Tree, filePath: string): boolean;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isComponent = exports.getBundlerFromTarget = exports.addCTTargetWithBuildTarget = void 0;
3
+ exports.isComponent = exports.getActualBundler = exports.getBundlerFromTarget = exports.configureCypressCT = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
6
6
  const ast_utils_1 = require("./ast-utils");
7
7
  let tsModule;
8
8
  const allowedFileExt = new RegExp(/\.[jt]sx?/);
9
9
  const isSpecFile = new RegExp(/(spec|test)\./);
10
- async function addCTTargetWithBuildTarget(tree, options) {
10
+ async function configureCypressCT(tree, options) {
11
11
  let found = { target: options.buildTarget, config: undefined };
12
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
12
13
  // Specifically undefined as a workaround for Remix to pass an empty string as the buildTarget
13
14
  if (options.buildTarget === undefined) {
14
15
  const { findBuildConfig } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/find-target-options'));
@@ -19,16 +20,37 @@ async function addCTTargetWithBuildTarget(tree, options) {
19
20
  });
20
21
  assertValidConfig(found?.config);
21
22
  }
22
- const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
23
- projectConfig.targets['component-test'].options = {
24
- ...projectConfig.targets['component-test'].options,
25
- devServerTarget: found.target,
26
- skipServe: true,
23
+ else if (options.buildTarget) {
24
+ const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
25
+ const { project, target } = (0, devkit_1.parseTargetString)(options.buildTarget, projectGraph);
26
+ const buildTargetProject = (0, devkit_1.readProjectConfiguration)(tree, project);
27
+ const executor = buildTargetProject.targets?.[target]?.executor;
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.`);
30
+ }
31
+ }
32
+ const { addDefaultCTConfig, getProjectCypressConfigPath } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
33
+ const ctConfigOptions = {
34
+ bundler: options.bundler ?? (await getActualBundler(tree, options, found)),
27
35
  };
28
- (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
36
+ if (projectConfig.targets?.['component-test']?.executor ===
37
+ '@nx/cypress:cypress') {
38
+ projectConfig.targets['component-test'].options = {
39
+ ...projectConfig.targets['component-test'].options,
40
+ devServerTarget: found.target,
41
+ skipServe: true,
42
+ };
43
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
44
+ }
45
+ else {
46
+ ctConfigOptions.buildTarget = found.target;
47
+ }
48
+ const cypressConfigFilePath = getProjectCypressConfigPath(tree, projectConfig.root);
49
+ const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigFilePath, 'utf-8'), ctConfigOptions);
50
+ tree.write(cypressConfigFilePath, `import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';\n${updatedCyConfig}`);
29
51
  return found;
30
52
  }
31
- exports.addCTTargetWithBuildTarget = addCTTargetWithBuildTarget;
53
+ exports.configureCypressCT = configureCypressCT;
32
54
  function assertValidConfig(config) {
33
55
  if (!config) {
34
56
  throw new Error('Unable to find a valid build configuration. Try passing in a target for an app. --build-target=<project>:<target>[:<configuration>]');
@@ -49,6 +71,14 @@ async function getBundlerFromTarget(found, tree) {
49
71
  : 'webpack';
50
72
  }
51
73
  exports.getBundlerFromTarget = getBundlerFromTarget;
74
+ async function getActualBundler(tree, options, found) {
75
+ // Specifically undefined to allow Remix workaround of passing an empty string
76
+ const actualBundler = options.buildTarget !== undefined && options.bundler
77
+ ? options.bundler
78
+ : await getBundlerFromTarget(found, tree);
79
+ return actualBundler;
80
+ }
81
+ exports.getActualBundler = getActualBundler;
52
82
  function isComponent(tree, filePath) {
53
83
  if (!tsModule) {
54
84
  tsModule = (0, ensure_typescript_1.ensureTypescript)();
@@ -8,7 +8,7 @@ if (import.meta.vitest) {
8
8
  // For more information please visit the Vitest docs site here: https://vitest.dev/guide/in-source.html
9
9
 
10
10
  const { it, expect, beforeEach } = import.meta.vitest;
11
- let render: any;
11
+ let render: typeof import('@testing-library/react').render;
12
12
 
13
13
  beforeEach(async () => {
14
14
  render = (await import('@testing-library/react')).render;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function hasVitePlugin(tree: Tree): boolean;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasVitePlugin = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function hasVitePlugin(tree) {
6
+ const nxJson = (0, devkit_1.readNxJson)(tree);
7
+ return !!nxJson.plugins?.some((p) => typeof p === 'string'
8
+ ? p === '@nx/vite/plugin'
9
+ : p.plugin === '@nx/vite/plugin');
10
+ }
11
+ exports.hasVitePlugin = hasVitePlugin;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function hasWebpackPlugin(tree: Tree): boolean;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasWebpackPlugin = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function hasWebpackPlugin(tree) {
6
+ const nxJson = (0, devkit_1.readNxJson)(tree);
7
+ return !!nxJson.plugins?.some((p) => typeof p === 'string'
8
+ ? p === '@nx/webpack/plugin'
9
+ : p.plugin === '@nx/webpack/plugin');
10
+ }
11
+ exports.hasWebpackPlugin = hasWebpackPlugin;
@@ -0,0 +1,3 @@
1
+ export declare function maybeJs(options: {
2
+ js?: boolean;
3
+ }, path: string): string;
@@ -8,7 +8,7 @@ export declare const babelLoaderVersion = "^9.1.2";
8
8
  export declare const typesReactVersion = "18.2.33";
9
9
  export declare const typesReactDomVersion = "18.2.14";
10
10
  export declare const typesReactIsVersion = "18.2.2";
11
- export declare const typesNodeVersion = "18.14.2";
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";
14
14
  export declare const styledComponentsVersion = "5.3.6";
@@ -12,7 +12,7 @@ exports.babelLoaderVersion = '^9.1.2';
12
12
  exports.typesReactVersion = '18.2.33';
13
13
  exports.typesReactDomVersion = '18.2.14';
14
14
  exports.typesReactIsVersion = '18.2.2';
15
- exports.typesNodeVersion = '18.14.2';
15
+ exports.typesNodeVersion = '18.16.9';
16
16
  exports.babelPresetReactVersion = '^7.14.5';
17
17
  exports.babelCoreVersion = '^7.14.5';
18
18
  exports.styledComponentsVersion = '5.3.6';
@@ -2,6 +2,7 @@ export type SupportedStyles =
2
2
  | 'css'
3
3
  | 'scss'
4
4
  | 'less'
5
+ | 'tailwind'
5
6
  | 'styled-components'
6
7
  | '@emotion/styled'
7
8
  | 'styled-jsx'
@@ -1,3 +0,0 @@
1
- export const environment = {
2
- production: true
3
- };
@@ -1,6 +0,0 @@
1
- // This file can be replaced during build by using the `fileReplacements` array.
2
- // When building for production, this file is replaced with `environment.prod.ts`.
3
-
4
- export const environment = {
5
- production: false
6
- };
@@ -1 +0,0 @@
1
- import('./bootstrap');
@@ -1 +0,0 @@
1
- import('./bootstrap');
@@ -1,2 +0,0 @@
1
- import { NormalizedSchema } from '../schema';
2
- export declare function maybeJs(options: NormalizedSchema, path: string): string;