@nx/vite 17.0.4 → 17.0.6

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 (116) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -9
  3. package/generators.json +3 -3
  4. package/migrations.json +0 -90
  5. package/package.json +7 -9
  6. package/plugins/nx-tsconfig-paths.plugin.js +5 -9
  7. package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
  8. package/plugins/rollup-replace-files.plugin.d.ts +3 -3
  9. package/plugins/rollup-replace-files.plugin.js +2 -2
  10. package/plugins/rollup-replace-files.plugin.js.map +1 -1
  11. package/src/executors/build/build.impl.d.ts +1 -5
  12. package/src/executors/build/build.impl.js +21 -90
  13. package/src/executors/build/build.impl.js.map +1 -1
  14. package/src/executors/build/schema.d.ts +18 -5
  15. package/src/executors/build/schema.json +106 -4
  16. package/src/executors/dev-server/dev-server.impl.js +9 -74
  17. package/src/executors/dev-server/dev-server.impl.js.map +1 -1
  18. package/src/executors/dev-server/schema.d.ts +10 -0
  19. package/src/executors/dev-server/schema.json +63 -0
  20. package/src/executors/preview-server/preview-server.impl.d.ts +1 -1
  21. package/src/executors/preview-server/preview-server.impl.js +15 -79
  22. package/src/executors/preview-server/preview-server.impl.js.map +1 -1
  23. package/src/executors/preview-server/schema.d.ts +7 -0
  24. package/src/executors/preview-server/schema.json +51 -1
  25. package/src/executors/test/schema.d.ts +8 -3
  26. package/src/executors/test/schema.json +43 -11
  27. package/src/executors/test/vitest.impl.js +112 -20
  28. package/src/executors/test/vitest.impl.js.map +1 -1
  29. package/src/generators/configuration/configuration.d.ts +1 -2
  30. package/src/generators/configuration/configuration.js +87 -49
  31. package/src/generators/configuration/configuration.js.map +1 -1
  32. package/src/generators/configuration/schema.d.ts +3 -1
  33. package/src/generators/configuration/schema.json +12 -0
  34. package/src/generators/init/init.d.ts +3 -4
  35. package/src/generators/init/init.js +67 -50
  36. package/src/generators/init/init.js.map +1 -1
  37. package/src/generators/init/schema.d.ts +5 -5
  38. package/src/generators/init/schema.json +20 -17
  39. package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +1 -2
  40. package/src/generators/vitest/schema.d.ts +1 -2
  41. package/src/generators/vitest/schema.json +2 -2
  42. package/src/generators/vitest/vitest-generator.d.ts +1 -2
  43. package/src/generators/vitest/vitest-generator.js +10 -34
  44. package/src/generators/vitest/vitest-generator.js.map +1 -1
  45. package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +1 -1
  46. package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js +17 -3
  47. package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js.map +1 -1
  48. package/src/utils/executor-utils.d.ts +0 -2
  49. package/src/utils/executor-utils.js +7 -22
  50. package/src/utils/executor-utils.js.map +1 -1
  51. package/src/utils/generator-utils.d.ts +12 -10
  52. package/src/utils/generator-utils.js +213 -134
  53. package/src/utils/generator-utils.js.map +1 -1
  54. package/src/utils/options-utils.d.ts +19 -3
  55. package/src/utils/options-utils.js +68 -25
  56. package/src/utils/options-utils.js.map +1 -1
  57. package/src/utils/test-files/react-lib-non-buildable-jest.json +4 -1
  58. package/src/utils/test-files/react-lib-non-buildable-vitest.json +4 -1
  59. package/src/utils/test-files/react-mixed-project.config.json +6 -1
  60. package/src/utils/test-files/react-project.config.json +85 -0
  61. package/src/utils/test-files/react-vite-project.config.json +4 -1
  62. package/src/utils/test-files/unknown-project.config.json +4 -1
  63. package/src/utils/test-files/web-project.config.json +72 -0
  64. package/src/utils/test-utils.d.ts +1 -1
  65. package/src/utils/test-utils.js +18 -10
  66. package/src/utils/test-utils.js.map +1 -1
  67. package/src/utils/versions.d.ts +9 -7
  68. package/src/utils/versions.js +15 -7
  69. package/src/utils/versions.js.map +1 -1
  70. package/src/utils/vite-config-edit-utils.js +1 -1
  71. package/src/utils/vite-config-edit-utils.js.map +1 -1
  72. package/plugin.d.ts +0 -1
  73. package/plugin.js +0 -21
  74. package/plugin.js.map +0 -1
  75. package/src/executors/test/lib/nx-reporter.d.ts +0 -14
  76. package/src/executors/test/lib/nx-reporter.js +0 -40
  77. package/src/executors/test/lib/nx-reporter.js.map +0 -1
  78. package/src/executors/test/lib/utils.d.ts +0 -4
  79. package/src/executors/test/lib/utils.js +0 -77
  80. package/src/executors/test/lib/utils.js.map +0 -1
  81. package/src/generators/configuration/lib/convert-non-vite.d.ts +0 -5
  82. package/src/generators/configuration/lib/convert-non-vite.js +0 -62
  83. package/src/generators/configuration/lib/convert-non-vite.js.map +0 -1
  84. package/src/generators/init/lib/utils.d.ts +0 -6
  85. package/src/generators/init/lib/utils.js +0 -80
  86. package/src/generators/init/lib/utils.js.map +0 -1
  87. package/src/migrations/update-17-1-0/move-target-defaults.d.ts +0 -2
  88. package/src/migrations/update-17-1-0/move-target-defaults.js +0 -77
  89. package/src/migrations/update-17-1-0/move-target-defaults.js.map +0 -1
  90. package/src/migrations/update-17-2-0/lib/add-file-replacements.d.ts +0 -2
  91. package/src/migrations/update-17-2-0/lib/add-file-replacements.js +0 -67
  92. package/src/migrations/update-17-2-0/lib/add-file-replacements.js.map +0 -1
  93. package/src/migrations/update-17-2-0/lib/edit-build-config.d.ts +0 -2
  94. package/src/migrations/update-17-2-0/lib/edit-build-config.js +0 -121
  95. package/src/migrations/update-17-2-0/lib/edit-build-config.js.map +0 -1
  96. package/src/migrations/update-17-2-0/lib/edit-test-config.d.ts +0 -2
  97. package/src/migrations/update-17-2-0/lib/edit-test-config.js +0 -83
  98. package/src/migrations/update-17-2-0/lib/edit-test-config.js.map +0 -1
  99. package/src/migrations/update-17-2-0/update-vite-config.d.ts +0 -5
  100. package/src/migrations/update-17-2-0/update-vite-config.js +0 -68
  101. package/src/migrations/update-17-2-0/update-vite-config.js.map +0 -1
  102. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.d.ts +0 -3
  103. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js +0 -117
  104. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js.map +0 -1
  105. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.d.ts +0 -2
  106. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js +0 -45
  107. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js.map +0 -1
  108. package/src/plugins/plugin.d.ts +0 -10
  109. package/src/plugins/plugin.js +0 -226
  110. package/src/plugins/plugin.js.map +0 -1
  111. package/src/utils/ensure-dependencies.d.ts +0 -8
  112. package/src/utils/ensure-dependencies.js +0 -34
  113. package/src/utils/ensure-dependencies.js.map +0 -1
  114. package/src/utils/find-vite-config.d.ts +0 -3
  115. package/src/utils/find-vite-config.js +0 -46
  116. package/src/utils/find-vite-config.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"sourcesContent":["import { printDiagnostics, runTypeCheck } from '@nx/js';\nimport { join } from 'path';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { ExecutorContext } from '@nx/devkit';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { getProjectTsConfigPath } from './options-utils';\n\nexport async function validateTypes(opts: {\n workspaceRoot: string;\n projectRoot: string;\n tsconfig: string;\n}): Promise<void> {\n const result = await runTypeCheck({\n workspaceRoot: opts.workspaceRoot,\n tsConfigPath: join(opts.workspaceRoot, opts.tsconfig),\n mode: 'noEmit',\n });\n\n await printDiagnostics(result.errors, result.warnings);\n\n if (result.errors.length > 0) {\n throw new Error('Found type errors. See above.');\n }\n}\n\nexport function createBuildableTsConfig(\n projectRoot: string,\n options: ViteBuildExecutorOptions | ViteDevServerExecutorOptions,\n context: ExecutorContext\n) {\n const tsConfig = getProjectTsConfigPath(projectRoot);\n options['buildLibsFromSource'] ??= true;\n\n if (!options['buildLibsFromSource']) {\n const { dependencies } = calculateProjectBuildableDependencies(\n context.taskGraph,\n context.projectGraph,\n context.root,\n context.projectName,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n context.targetName === 'serve' ? 'build' : context.targetName,\n context.configurationName\n );\n // This tsconfig is used via the Vite ts paths plugin.\n // It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).\n const tmpTsConfigPath = createTmpTsConfig(\n tsConfig,\n context.root,\n projectRoot,\n dependencies\n );\n process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;\n }\n}\n\nexport function loadViteDynamicImport() {\n return Function('return import(\"vite\")')() as Promise<typeof import('vite')>;\n}\n\nexport function loadVitestDynamicImport() {\n return Function('return import(\"vitest/node\")')() as Promise<\n typeof import('vitest/node')\n >;\n}\n"],"names":["validateTypes","createBuildableTsConfig","loadViteDynamicImport","loadVitestDynamicImport","opts","result","runTypeCheck","workspaceRoot","tsConfigPath","join","tsconfig","mode","printDiagnostics","errors","warnings","length","Error","projectRoot","options","context","tsConfig","getProjectTsConfigPath","dependencies","calculateProjectBuildableDependencies","taskGraph","projectGraph","root","projectName","targetName","configurationName","tmpTsConfigPath","createTmpTsConfig","process","env","NX_TSCONFIG_PATH","Function"],"mappings":";;;;;;;;IAWsBA,aAAa;eAAbA;;IAkBNC,uBAAuB;eAAvBA;;IA+BAC,qBAAqB;eAArBA;;IAIAC,uBAAuB;eAAvBA;;;oBAhE+B;sBAC1B;oCAOd;8BACgC;AAEhC,eAAeH,cAAcI,IAInC;IACC,MAAMC,SAAS,MAAMC,IAAAA,gBAAY,EAAC;QAChCC,eAAeH,KAAKG,aAAa;QACjCC,cAAcC,IAAAA,UAAI,EAACL,KAAKG,aAAa,EAAEH,KAAKM,QAAQ;QACpDC,MAAM;IACR;IAEA,MAAMC,IAAAA,oBAAgB,EAACP,OAAOQ,MAAM,EAAER,OAAOS,QAAQ;IAErD,IAAIT,OAAOQ,MAAM,CAACE,MAAM,GAAG,GAAG;QAC5B,MAAM,IAAIC,MAAM;IAClB;AACF;AAEO,SAASf,wBACdgB,WAAmB,EACnBC,OAAgE,EAChEC,OAAwB;QAGxBD,UAAQ;IADR,MAAME,WAAWC,IAAAA,oCAAsB,EAACJ;;IACxCC,MAAAA,WAAAA,QAAO,CAAC,uBAAA,sBAAsB,gBAA9BA,QAAO,CAAC,qBAAsB,GAAK;IAEnC,IAAI,CAACA,OAAO,CAAC,sBAAsB,EAAE;QACnC,MAAM,EAAEI,YAAY,EAAE,GAAGC,IAAAA,yDAAqC,EAC5DJ,QAAQK,SAAS,EACjBL,QAAQM,YAAY,EACpBN,QAAQO,IAAI,EACZP,QAAQQ,WAAW,EACnB,iEAAiE;QACjE,0DAA0D;QAC1DR,QAAQS,UAAU,KAAK,UAAU,UAAUT,QAAQS,UAAU,EAC7DT,QAAQU,iBAAiB;QAE3B,sDAAsD;QACtD,qGAAqG;QACrG,MAAMC,kBAAkBC,IAAAA,qCAAiB,EACvCX,UACAD,QAAQO,IAAI,EACZT,aACAK;QAEFU,QAAQC,GAAG,CAACC,gBAAgB,GAAGJ;IACjC;AACF;AAEO,SAAS5B;IACd,OAAOiC,SAAS;AAClB;AAEO,SAAShC;IACd,OAAOgC,SAAS;AAGlB"}
1
+ {"version":3,"sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"sourcesContent":["import { printDiagnostics, runTypeCheck } from '@nx/js';\nimport { join, resolve } from 'path';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { ExecutorContext } from '@nx/devkit';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\n\nexport async function validateTypes(opts: {\n workspaceRoot: string;\n projectRoot: string;\n tsconfig: string;\n}): Promise<void> {\n const result = await runTypeCheck({\n workspaceRoot: opts.workspaceRoot,\n tsConfigPath: join(opts.workspaceRoot, opts.tsconfig),\n mode: 'noEmit',\n });\n\n await printDiagnostics(result.errors, result.warnings);\n\n if (result.errors.length > 0) {\n throw new Error('Found type errors. See above.');\n }\n}\n\nexport function createBuildableTsConfig(\n projectRoot: string,\n options: ViteBuildExecutorOptions | ViteDevServerExecutorOptions,\n context: ExecutorContext\n) {\n const tsConfig = resolve(projectRoot, 'tsconfig.json');\n options.buildLibsFromSource ??= true;\n\n if (!options.buildLibsFromSource) {\n const { dependencies } = calculateProjectBuildableDependencies(\n context.taskGraph,\n context.projectGraph,\n context.root,\n context.projectName,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n context.targetName === 'serve' ? 'build' : context.targetName,\n context.configurationName\n );\n // this tsconfig is used via the vite ts paths plugin\n createTmpTsConfig(tsConfig, context.root, projectRoot, dependencies);\n }\n}\n"],"names":["validateTypes","createBuildableTsConfig","opts","result","runTypeCheck","workspaceRoot","tsConfigPath","join","tsconfig","mode","printDiagnostics","errors","warnings","length","Error","projectRoot","options","context","tsConfig","resolve","buildLibsFromSource","dependencies","calculateProjectBuildableDependencies","taskGraph","projectGraph","root","projectName","targetName","configurationName","createTmpTsConfig"],"mappings":";;;;;;;;IAUsBA,aAAa;eAAbA;;IAkBNC,uBAAuB;eAAvBA;;;oBA5B+B;sBACjB;oCAOvB;AAEA,eAAeD,cAAcE,IAInC;IACC,MAAMC,SAAS,MAAMC,IAAAA,gBAAY,EAAC;QAChCC,eAAeH,KAAKG,aAAa;QACjCC,cAAcC,IAAAA,UAAI,EAACL,KAAKG,aAAa,EAAEH,KAAKM,QAAQ;QACpDC,MAAM;IACR;IAEA,MAAMC,IAAAA,oBAAgB,EAACP,OAAOQ,MAAM,EAAER,OAAOS,QAAQ;IAErD,IAAIT,OAAOQ,MAAM,CAACE,MAAM,GAAG,GAAG;QAC5B,MAAM,IAAIC,MAAM;IAClB;AACF;AAEO,SAASb,wBACdc,WAAmB,EACnBC,OAAgE,EAChEC,OAAwB;QAGxBD;IADA,MAAME,WAAWC,IAAAA,aAAO,EAACJ,aAAa;;IACtCC,yBAAAA,WAAAA,SAAQI,sDAARJ,SAAQI,sBAAwB;IAEhC,IAAI,CAACJ,QAAQI,mBAAmB,EAAE;QAChC,MAAM,EAAEC,YAAY,EAAE,GAAGC,IAAAA,yDAAqC,EAC5DL,QAAQM,SAAS,EACjBN,QAAQO,YAAY,EACpBP,QAAQQ,IAAI,EACZR,QAAQS,WAAW,EACnB,iEAAiE;QACjE,0DAA0D;QAC1DT,QAAQU,UAAU,KAAK,UAAU,UAAUV,QAAQU,UAAU,EAC7DV,QAAQW,iBAAiB;QAE3B,qDAAqD;QACrDC,IAAAA,qCAAiB,EAACX,UAAUD,QAAQQ,IAAI,EAAEV,aAAaM;IACzD;AACF"}
@@ -4,26 +4,29 @@ export type Target = 'build' | 'serve' | 'test' | 'preview';
4
4
  export type TargetFlags = Partial<Record<Target, boolean>>;
5
5
  export type UserProvidedTargetName = Partial<Record<Target, string>>;
6
6
  export type ValidFoundTargetName = Partial<Record<Target, string>>;
7
- export declare function findExistingJsBuildTargetInProject(targets: {
7
+ export declare function findExistingTargetsInProject(targets: {
8
8
  [targetName: string]: TargetConfiguration;
9
- }): {
10
- supported?: string;
11
- unsupported?: string;
9
+ }, userProvidedTargets?: UserProvidedTargetName): {
10
+ validFoundTargetName: ValidFoundTargetName;
11
+ projectContainsUnsupportedExecutor: boolean;
12
+ userProvidedTargetIsUnsupported: TargetFlags;
13
+ alreadyHasNxViteTargets: TargetFlags;
12
14
  };
13
15
  export declare function addOrChangeTestTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
14
- export declare function addBuildTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
15
- export declare function addServeTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
16
+ export declare function addOrChangeBuildTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
17
+ export declare function addOrChangeServeTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
16
18
  /**
17
19
  * Adds a target for the preview server.
18
20
  *
19
21
  * @param tree
20
22
  * @param options
21
23
  * @param serveTarget An existing serve target.
24
+ * @param previewTarget The preview target to create.
22
25
  */
23
26
  export declare function addPreviewTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, serveTarget: string): void;
24
27
  export declare function editTsConfig(tree: Tree, options: ViteConfigurationGeneratorSchema): void;
25
28
  export declare function deleteWebpackConfig(tree: Tree, projectRoot: string, webpackConfigFilePath?: string): void;
26
- export declare function moveAndEditIndexHtml(tree: Tree, options: ViteConfigurationGeneratorSchema): void;
29
+ export declare function moveAndEditIndexHtml(tree: Tree, options: ViteConfigurationGeneratorSchema, buildTarget: string): void;
27
30
  export interface ViteConfigFileOptions {
28
31
  project: string;
29
32
  includeLib?: boolean;
@@ -33,10 +36,9 @@ export interface ViteConfigFileOptions {
33
36
  rollupOptionsExternal?: string[];
34
37
  imports?: string[];
35
38
  plugins?: string[];
36
- coverageProvider?: 'v8' | 'istanbul' | 'custom';
37
39
  }
38
- export declare function createOrEditViteConfig(tree: Tree, options: ViteConfigFileOptions, onlyVitest: boolean, projectAlreadyHasViteTargets?: TargetFlags, vitestFileName?: boolean): void;
40
+ export declare function createOrEditViteConfig(tree: Tree, options: ViteConfigFileOptions, onlyVitest: boolean, projectAlreadyHasViteTargets?: TargetFlags): void;
39
41
  export declare function normalizeViteConfigFilePathWithTree(tree: Tree, projectRoot: string, configFile?: string): string;
40
42
  export declare function getViteConfigPathForProject(tree: Tree, projectName: string, target?: string): string;
41
43
  export declare function handleUnsupportedUserProvidedTargets(userProvidedTargetIsUnsupported: TargetFlags, userProvidedTargetName: UserProvidedTargetName, validFoundTargetName: ValidFoundTargetName): Promise<void>;
42
- export declare function handleUnknownConfiguration(projectName: string): Promise<void>;
44
+ export declare function handleUnknownExecutors(projectName: string): Promise<void>;
@@ -6,17 +6,17 @@ function _export(target, all) {
6
6
  });
7
7
  }
8
8
  _export(exports, {
9
- findExistingJsBuildTargetInProject: function() {
10
- return findExistingJsBuildTargetInProject;
9
+ findExistingTargetsInProject: function() {
10
+ return findExistingTargetsInProject;
11
11
  },
12
12
  addOrChangeTestTarget: function() {
13
13
  return addOrChangeTestTarget;
14
14
  },
15
- addBuildTarget: function() {
16
- return addBuildTarget;
15
+ addOrChangeBuildTarget: function() {
16
+ return addOrChangeBuildTarget;
17
17
  },
18
- addServeTarget: function() {
19
- return addServeTarget;
18
+ addOrChangeServeTarget: function() {
19
+ return addOrChangeServeTarget;
20
20
  },
21
21
  addPreviewTarget: function() {
22
22
  return addPreviewTarget;
@@ -42,20 +42,42 @@ _export(exports, {
42
42
  handleUnsupportedUserProvidedTargets: function() {
43
43
  return handleUnsupportedUserProvidedTargets;
44
44
  },
45
- handleUnknownConfiguration: function() {
46
- return handleUnknownConfiguration;
45
+ handleUnknownExecutors: function() {
46
+ return handleUnknownExecutors;
47
47
  }
48
48
  });
49
+ const _extends = require("@swc/helpers/_/_extends");
49
50
  const _devkit = require("@nx/devkit");
50
51
  const _viteconfigeditutils = require("./vite-config-edit-utils");
51
- const _addbuildtargetdefaults = require("@nx/devkit/src/generators/add-build-target-defaults");
52
- function findExistingJsBuildTargetInProject(targets) {
53
- const output = {};
52
+ function findExistingTargetsInProject(targets, userProvidedTargets) {
53
+ const output = {
54
+ validFoundTargetName: {},
55
+ projectContainsUnsupportedExecutor: false,
56
+ userProvidedTargetIsUnsupported: {},
57
+ alreadyHasNxViteTargets: {}
58
+ };
54
59
  const supportedExecutors = {
55
60
  build: [
61
+ '@nxext/vite:build',
56
62
  '@nx/js:babel',
57
63
  '@nx/js:swc',
58
- '@nx/rollup:rollup'
64
+ '@nx/webpack:webpack',
65
+ '@nx/rollup:rollup',
66
+ '@nrwl/js:babel',
67
+ '@nrwl/js:swc',
68
+ '@nrwl/webpack:webpack',
69
+ '@nrwl/rollup:rollup',
70
+ '@nrwl/web:rollup'
71
+ ],
72
+ serve: [
73
+ '@nxext/vite:dev',
74
+ '@nx/webpack:dev-server',
75
+ '@nrwl/webpack:dev-server'
76
+ ],
77
+ test: [
78
+ '@nx/jest:jest',
79
+ '@nrwl/jest:jest',
80
+ '@nxext/vitest:vitest'
59
81
  ]
60
82
  };
61
83
  const unsupportedExecutors = [
@@ -70,6 +92,7 @@ function findExistingJsBuildTargetInProject(targets) {
70
92
  '@nx/react-native:build-android',
71
93
  '@nx/react-native:bundle',
72
94
  '@nx/next:build',
95
+ '@nx/next:server',
73
96
  '@nx/js:tsc',
74
97
  '@nrwl/angular:ng-packagr-lite',
75
98
  '@nrwl/angular:package',
@@ -82,29 +105,63 @@ function findExistingJsBuildTargetInProject(targets) {
82
105
  '@nrwl/react-native:build-android',
83
106
  '@nrwl/react-native:bundle',
84
107
  '@nrwl/next:build',
108
+ '@nrwl/next:server',
85
109
  '@nrwl/js:tsc',
86
110
  '@angular-devkit/build-angular:browser',
87
- '@angular-devkit/build-angular:browser-esbuild',
88
- '@angular-devkit/build-angular:application'
111
+ '@angular-devkit/build-angular:dev-server'
89
112
  ];
90
- // We try to find the target that is using the supported executors
91
- // for build since this is the one we will be converting
113
+ // First, we check if the user has provided a target
114
+ // If they have, we check if the executor the target is using is supported
115
+ // If it's not supported, then we set the unsupported flag to true for that target
116
+ function checkUserProvidedTarget(target) {
117
+ if (userProvidedTargets == null ? void 0 : userProvidedTargets[target]) {
118
+ var _targets_userProvidedTargets_target;
119
+ if (supportedExecutors[target].includes((_targets_userProvidedTargets_target = targets[userProvidedTargets[target]]) == null ? void 0 : _targets_userProvidedTargets_target.executor)) {
120
+ output.validFoundTargetName[target] = userProvidedTargets[target];
121
+ } else {
122
+ output.userProvidedTargetIsUnsupported[target] = true;
123
+ }
124
+ }
125
+ }
126
+ checkUserProvidedTarget('build');
127
+ checkUserProvidedTarget('serve');
128
+ checkUserProvidedTarget('test');
129
+ // Returns early when we have a build, serve, and test targets.
130
+ if (output.validFoundTargetName.build && output.validFoundTargetName.serve && output.validFoundTargetName.test) {
131
+ return output;
132
+ }
133
+ // We try to find the targets that are using the supported executors
134
+ // for build, serve and test, since these are the ones we will be converting
92
135
  for(const target in targets){
136
+ var _hasViteTargets, _hasViteTargets1, _hasViteTargets2, _hasViteTargets3, _output;
93
137
  const executorName = targets[target].executor;
94
- if (supportedExecutors.build.includes(executorName)) {
95
- output.supported = target;
96
- } else if (unsupportedExecutors.includes(executorName)) {
97
- output.unsupported = target;
138
+ const hasViteTargets = output.alreadyHasNxViteTargets;
139
+ (_hasViteTargets = hasViteTargets).build || (_hasViteTargets.build = executorName === '@nx/vite:build' || executorName === '@nrwl/vite:build');
140
+ (_hasViteTargets1 = hasViteTargets).serve || (_hasViteTargets1.serve = executorName === '@nx/vite:dev-server' || executorName === '@nrwl/vite:dev-server');
141
+ (_hasViteTargets2 = hasViteTargets).test || (_hasViteTargets2.test = executorName === '@nx/vite:test' || executorName === '@nrwl/vite:test');
142
+ (_hasViteTargets3 = hasViteTargets).preview || (_hasViteTargets3.preview = executorName === '@nx/vite:preview-server' || executorName === '@nrwl/vite:preview-server');
143
+ const foundTargets = output.validFoundTargetName;
144
+ if (!foundTargets.build && supportedExecutors.build.includes(executorName)) {
145
+ foundTargets.build = target;
146
+ }
147
+ if (!foundTargets.serve && supportedExecutors.serve.includes(executorName)) {
148
+ foundTargets.serve = target;
98
149
  }
150
+ if (!foundTargets.test && supportedExecutors.test.includes(executorName)) {
151
+ foundTargets.test = target;
152
+ }
153
+ (_output = output).projectContainsUnsupportedExecutor || (_output.projectContainsUnsupportedExecutor = unsupportedExecutors.includes(executorName));
99
154
  }
100
155
  return output;
101
156
  }
102
157
  function addOrChangeTestTarget(tree, options, target) {
103
158
  var _project;
104
159
  const project = (0, _devkit.readProjectConfiguration)(tree, options.project);
105
- const reportsDirectory = (0, _devkit.joinPathFragments)((0, _devkit.offsetFromRoot)(project.root), 'coverage', project.root === '.' ? options.project : project.root);
160
+ const coveragePath = (0, _devkit.joinPathFragments)('coverage', project.root === '.' ? options.project : project.root);
106
161
  const testOptions = {
107
- reportsDirectory
162
+ passWithNoTests: true,
163
+ // vitest runs in the project root so we have to offset to the workspaceRoot
164
+ reportsDirectory: (0, _devkit.joinPathFragments)((0, _devkit.offsetFromRoot)(project.root), coveragePath)
108
165
  };
109
166
  var _targets;
110
167
  (_targets = (_project = project).targets) != null ? _targets : _project.targets = {};
@@ -123,55 +180,82 @@ function addOrChangeTestTarget(tree, options, target) {
123
180
  }
124
181
  (0, _devkit.updateProjectConfiguration)(tree, options.project, project);
125
182
  }
126
- function addBuildTarget(tree, options, target) {
183
+ function addOrChangeBuildTarget(tree, options, target) {
127
184
  var _project;
128
- (0, _addbuildtargetdefaults.addBuildTargetDefaults)(tree, '@nx/vite:build');
129
185
  const project = (0, _devkit.readProjectConfiguration)(tree, options.project);
130
186
  const buildOptions = {
131
187
  outputPath: (0, _devkit.joinPathFragments)('dist', project.root != '.' ? project.root : options.project)
132
188
  };
133
189
  var _targets;
134
190
  (_targets = (_project = project).targets) != null ? _targets : _project.targets = {};
135
- project.targets[target] = {
136
- executor: '@nx/vite:build',
137
- outputs: [
138
- '{options.outputPath}'
139
- ],
140
- defaultConfiguration: 'production',
141
- options: buildOptions,
142
- configurations: {
143
- development: {
144
- mode: 'development'
145
- },
146
- production: {
147
- mode: 'production'
148
- }
191
+ if (project.targets[target]) {
192
+ var _project_targets_target_options;
193
+ buildOptions.fileReplacements = (_project_targets_target_options = project.targets[target].options) == null ? void 0 : _project_targets_target_options.fileReplacements;
194
+ if (project.targets[target].executor === '@nxext/vite:build') {
195
+ var _project_targets_target_options1, _project_targets_target_options2;
196
+ buildOptions.base = (_project_targets_target_options1 = project.targets[target].options) == null ? void 0 : _project_targets_target_options1.baseHref;
197
+ buildOptions.sourcemap = (_project_targets_target_options2 = project.targets[target].options) == null ? void 0 : _project_targets_target_options2.sourcemaps;
149
198
  }
150
- };
199
+ project.targets[target].options = _extends._({}, buildOptions);
200
+ project.targets[target].executor = '@nx/vite:build';
201
+ } else {
202
+ project.targets[target] = {
203
+ executor: '@nx/vite:build',
204
+ outputs: [
205
+ '{options.outputPath}'
206
+ ],
207
+ defaultConfiguration: 'production',
208
+ options: buildOptions,
209
+ configurations: {
210
+ development: {
211
+ mode: 'development'
212
+ },
213
+ production: {
214
+ mode: 'production'
215
+ }
216
+ }
217
+ };
218
+ }
151
219
  (0, _devkit.updateProjectConfiguration)(tree, options.project, project);
152
220
  }
153
- function addServeTarget(tree, options, target) {
221
+ function addOrChangeServeTarget(tree, options, target) {
154
222
  var _project;
155
223
  const project = (0, _devkit.readProjectConfiguration)(tree, options.project);
156
224
  var _targets;
157
225
  (_targets = (_project = project).targets) != null ? _targets : _project.targets = {};
158
- project.targets[target] = {
159
- executor: '@nx/vite:dev-server',
160
- defaultConfiguration: 'development',
161
- options: {
162
- buildTarget: `${options.project}:build`
163
- },
164
- configurations: {
165
- development: {
166
- buildTarget: `${options.project}:build:development`,
167
- hmr: true
226
+ if (project.targets[target]) {
227
+ var _project_targets_target_options, _project_targets_target_options1, _project_targets_target_options2;
228
+ const serveTarget = project.targets[target];
229
+ const serveOptions = {
230
+ buildTarget: `${options.project}:build`,
231
+ https: (_project_targets_target_options = project.targets[target].options) == null ? void 0 : _project_targets_target_options.https,
232
+ hmr: (_project_targets_target_options1 = project.targets[target].options) == null ? void 0 : _project_targets_target_options1.hmr,
233
+ open: (_project_targets_target_options2 = project.targets[target].options) == null ? void 0 : _project_targets_target_options2.open
234
+ };
235
+ if (serveTarget.executor === '@nxext/vite:dev') {
236
+ serveOptions.proxyConfig = project.targets[target].options.proxyConfig;
237
+ }
238
+ serveTarget.executor = '@nx/vite:dev-server';
239
+ serveTarget.options = serveOptions;
240
+ } else {
241
+ project.targets[target] = {
242
+ executor: '@nx/vite:dev-server',
243
+ defaultConfiguration: 'development',
244
+ options: {
245
+ buildTarget: `${options.project}:build`
168
246
  },
169
- production: {
170
- buildTarget: `${options.project}:build:production`,
171
- hmr: false
247
+ configurations: {
248
+ development: {
249
+ buildTarget: `${options.project}:build:development`,
250
+ hmr: true
251
+ },
252
+ production: {
253
+ buildTarget: `${options.project}:build:production`,
254
+ hmr: false
255
+ }
172
256
  }
173
- }
174
- };
257
+ };
258
+ }
175
259
  (0, _devkit.updateProjectConfiguration)(tree, options.project, project);
176
260
  }
177
261
  function addPreviewTarget(tree, options, serveTarget) {
@@ -189,8 +273,8 @@ function addPreviewTarget(tree, options, serveTarget) {
189
273
  if (target.executor === '@nxext/vite:dev') {
190
274
  previewOptions.proxyConfig = target.options.proxyConfig;
191
275
  }
192
- previewOptions['https'] = (_target_options = target.options) == null ? void 0 : _target_options.https;
193
- previewOptions['open'] = (_target_options1 = target.options) == null ? void 0 : _target_options1.open;
276
+ previewOptions.https = (_target_options = target.options) == null ? void 0 : _target_options.https;
277
+ previewOptions.open = (_target_options1 = target.options) == null ? void 0 : _target_options1.open;
194
278
  }
195
279
  // Adds a preview target.
196
280
  project.targets.preview = {
@@ -211,26 +295,56 @@ function addPreviewTarget(tree, options, serveTarget) {
211
295
  function editTsConfig(tree, options) {
212
296
  const projectConfig = (0, _devkit.readProjectConfiguration)(tree, options.project);
213
297
  const config = (0, _devkit.readJson)(tree, `${projectConfig.root}/tsconfig.json`);
298
+ const commonCompilerOptions = {
299
+ target: 'ESNext',
300
+ useDefineForClassFields: true,
301
+ module: 'ESNext',
302
+ strict: true,
303
+ moduleResolution: 'Node',
304
+ resolveJsonModule: true,
305
+ isolatedModules: true,
306
+ types: [
307
+ 'vite/client'
308
+ ],
309
+ noEmit: true
310
+ };
214
311
  switch(options.uiFramework){
215
312
  case 'react':
216
- config.compilerOptions = {
217
- jsx: 'react-jsx',
313
+ config.compilerOptions = _extends._({}, commonCompilerOptions, {
314
+ lib: [
315
+ 'DOM',
316
+ 'DOM.Iterable',
317
+ 'ESNext'
318
+ ],
218
319
  allowJs: false,
219
320
  esModuleInterop: false,
321
+ skipLibCheck: true,
220
322
  allowSyntheticDefaultImports: true,
221
- strict: true
222
- };
323
+ forceConsistentCasingInFileNames: true,
324
+ jsx: 'react-jsx'
325
+ });
326
+ config.include = [
327
+ ...config.include,
328
+ 'src'
329
+ ];
223
330
  break;
224
331
  case 'none':
225
- config.compilerOptions = {
226
- module: 'commonjs',
227
- forceConsistentCasingInFileNames: true,
332
+ config.compilerOptions = _extends._({}, commonCompilerOptions, {
333
+ lib: [
334
+ 'ESNext',
335
+ 'DOM'
336
+ ],
337
+ skipLibCheck: true,
338
+ esModuleInterop: true,
228
339
  strict: true,
229
- noImplicitOverride: true,
230
- noPropertyAccessFromIndexSignature: true,
231
- noImplicitReturns: true,
232
- noFallthroughCasesInSwitch: true
233
- };
340
+ noUnusedLocals: true,
341
+ noUnusedParameters: true,
342
+ noImplicitReturns: true
343
+ });
344
+ config.include = [
345
+ ...config.include,
346
+ 'src'
347
+ ];
234
348
  break;
235
349
  default:
236
350
  break;
@@ -243,10 +357,13 @@ function deleteWebpackConfig(tree, projectRoot, webpackConfigFilePath) {
243
357
  tree.delete(webpackConfigPath);
244
358
  }
245
359
  }
246
- function moveAndEditIndexHtml(tree, options) {
360
+ function moveAndEditIndexHtml(tree, options, buildTarget) {
361
+ var _projectConfig_targets_buildTarget_options, _projectConfig_targets_buildTarget, _projectConfig_targets, _projectConfig_targets_buildTarget_options1, _projectConfig_targets_buildTarget1, _projectConfig_targets1;
247
362
  const projectConfig = (0, _devkit.readProjectConfiguration)(tree, options.project);
248
- let indexHtmlPath = `${projectConfig.root}/src/index.html`;
249
- let mainPath = `${projectConfig.root}/src/main.ts${options.uiFramework === 'react' ? 'x' : ''}`;
363
+ var _projectConfig_targets_buildTarget_options_index;
364
+ let indexHtmlPath = (_projectConfig_targets_buildTarget_options_index = (_projectConfig_targets = projectConfig.targets) == null ? void 0 : (_projectConfig_targets_buildTarget = _projectConfig_targets[buildTarget]) == null ? void 0 : (_projectConfig_targets_buildTarget_options = _projectConfig_targets_buildTarget.options) == null ? void 0 : _projectConfig_targets_buildTarget_options.index) != null ? _projectConfig_targets_buildTarget_options_index : `${projectConfig.root}/src/index.html`;
365
+ var _projectConfig_targets_buildTarget_options_main;
366
+ let mainPath = (_projectConfig_targets_buildTarget_options_main = (_projectConfig_targets1 = projectConfig.targets) == null ? void 0 : (_projectConfig_targets_buildTarget1 = _projectConfig_targets1[buildTarget]) == null ? void 0 : (_projectConfig_targets_buildTarget_options1 = _projectConfig_targets_buildTarget1.options) == null ? void 0 : _projectConfig_targets_buildTarget_options1.main) != null ? _projectConfig_targets_buildTarget_options_main : `${projectConfig.root}/src/main.ts${options.uiFramework === 'react' ? 'x' : ''}`;
250
367
  if (projectConfig.root !== '.') {
251
368
  mainPath = mainPath.replace(projectConfig.root, '');
252
369
  }
@@ -278,20 +395,14 @@ function moveAndEditIndexHtml(tree, options) {
278
395
  </html>`);
279
396
  }
280
397
  }
281
- function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasViteTargets, vitestFileName) {
282
- const { root: projectRoot } = (0, _devkit.readProjectConfiguration)(tree, options.project);
283
- const viteConfigPath = vitestFileName ? `${projectRoot}/vitest.config.ts` : `${projectRoot}/vite.config.ts`;
284
- const buildOutDir = projectRoot === '.' ? `./dist/${options.project}` : `${(0, _devkit.offsetFromRoot)(projectRoot)}dist/${projectRoot}`;
398
+ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasViteTargets) {
399
+ const projectConfig = (0, _devkit.readProjectConfiguration)(tree, options.project);
400
+ const viteConfigPath = `${projectConfig.root}/vite.config.ts`;
285
401
  var _options_rollupOptionsExternal;
286
402
  const buildOption = onlyVitest ? '' : options.includeLib ? `
287
403
  // Configuration for building your library.
288
404
  // See: https://vitejs.dev/guide/build.html#library-mode
289
405
  build: {
290
- outDir: '${buildOutDir}',
291
- reportCompressedSize: true,
292
- commonjsOptions: {
293
- transformMixedEsModules: true,
294
- },
295
406
  lib: {
296
407
  // Could also be a dictionary or array of multiple entry points.
297
408
  entry: 'src/index.ts',
@@ -304,16 +415,8 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
304
415
  rollupOptions: {
305
416
  // External packages that should not be bundled into your library.
306
417
  external: [${(_options_rollupOptionsExternal = options.rollupOptionsExternal) != null ? _options_rollupOptionsExternal : ''}]
307
- },
308
- },` : `
309
- build: {
310
- outDir: '${buildOutDir}',
311
- reportCompressedSize: true,
312
- commonjsOptions: {
313
- transformMixedEsModules: true,
314
- },
315
- },
316
- `;
418
+ }
419
+ },` : ``;
317
420
  const imports = options.imports ? options.imports : [];
318
421
  if (!onlyVitest && options.includeLib) {
319
422
  imports.push(`import dts from 'vite-plugin-dts'`, `import * as path from 'path'`);
@@ -326,23 +429,17 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
326
429
  `nxViteTsPaths()`
327
430
  ];
328
431
  if (!onlyVitest && options.includeLib) {
329
- plugins.push(`dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })`);
432
+ plugins.push(`dts({ entryRoot: 'src', tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true })`);
330
433
  }
331
- const reportsDirectory = projectRoot === '.' ? `./coverage/${options.project}` : `${(0, _devkit.offsetFromRoot)(projectRoot)}coverage/${projectRoot}`;
332
434
  var _options_testEnvironment;
333
435
  const testOption = options.includeVitest ? `test: {
334
436
  globals: true,
335
437
  cache: {
336
- dir: '${(0, _devkit.offsetFromRoot)(projectRoot)}node_modules/.vitest'
438
+ dir: '${(0, _devkit.offsetFromRoot)(projectConfig.root)}node_modules/.vitest'
337
439
  },
338
440
  environment: '${(_options_testEnvironment = options.testEnvironment) != null ? _options_testEnvironment : 'jsdom'}',
339
441
  include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
340
- ${options.inSourceTests ? `includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],` : ''}
341
- reporters: ['default'],
342
- coverage: {
343
- reportsDirectory: '${reportsDirectory}',
344
- provider: ${options.coverageProvider ? `'${options.coverageProvider}'` : `'v8'`},
345
- }
442
+ ${options.inSourceTests ? `includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']` : ''}
346
443
  },` : '';
347
444
  const defineOption = options.inSourceTests ? `define: {
348
445
  'import.meta.vitest': undefined
@@ -362,9 +459,9 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
362
459
  // worker: {
363
460
  // plugins: [ nxViteTsPaths() ],
364
461
  // },`;
365
- const cacheDir = `cacheDir: '${(0, _devkit.offsetFromRoot)(projectRoot)}node_modules/.vite/${projectRoot}',`;
462
+ const cacheDir = `cacheDir: '${(0, _devkit.offsetFromRoot)(projectConfig.root)}node_modules/.vite/${options.project}',`;
366
463
  if (tree.exists(viteConfigPath)) {
367
- handleViteConfigFileExists(tree, viteConfigPath, options, buildOption, buildOutDir, imports, plugins, testOption, reportsDirectory, cacheDir, (0, _devkit.offsetFromRoot)(projectRoot), projectAlreadyHasViteTargets);
464
+ handleViteConfigFileExists(tree, viteConfigPath, options, buildOption, imports, plugins, testOption, cacheDir, (0, _devkit.offsetFromRoot)(projectConfig.root), projectAlreadyHasViteTargets);
368
465
  return;
369
466
  }
370
467
  viteConfigContent = `
@@ -374,7 +471,6 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
374
471
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
375
472
 
376
473
  export default defineConfig({
377
- root: __dirname,
378
474
  ${cacheDir}
379
475
  ${devServerOption}
380
476
  ${previewServerOption}
@@ -438,32 +534,33 @@ async function handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName
438
534
  `);
439
535
  }
440
536
  }
441
- async function handleUnknownConfiguration(projectName) {
442
- if (process.env.NX_INTERACTIVE === 'false') {
443
- return;
444
- }
537
+ async function handleUnknownExecutors(projectName) {
445
538
  _devkit.logger.warn(`
446
- We could not find any configuration in project ${projectName} that
447
- indicates whether we can definitely convert to Vite.
539
+ We could not find any targets in project ${projectName} that use executors which
540
+ can be converted to the @nx/vite executors.
541
+
542
+ This either means that your project may not have a target
543
+ for building, serving, or testing at all, or that your targets are
544
+ using executors that are not known to Nx.
448
545
 
449
- If you still want to convert your project to use Vite,
546
+ If you still want to convert your project to use the @nx/vite executors,
450
547
  please make sure to commit your changes before running this generator.
451
548
  `);
452
549
  const { Confirm } = require('enquirer');
453
550
  const prompt = new Confirm({
454
551
  name: 'question',
455
- message: `Should Nx convert your project to use Vite?`,
552
+ message: `Should Nx convert your project to use the @nx/vite executors?`,
456
553
  initial: true
457
554
  });
458
555
  const shouldConvert = await prompt.run();
459
556
  if (!shouldConvert) {
460
557
  throw new Error(`
461
- Nx could not verify that your project can be converted to use Vite.
558
+ Nx could not verify that the executors you are using can be converted to the @nx/vite executors.
462
559
  Please try again with a different project.
463
560
  `);
464
561
  }
465
562
  }
466
- function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption, buildOutDir, imports, plugins, testOption, reportsDirectory, cacheDir, offsetFromRoot, projectAlreadyHasViteTargets) {
563
+ function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption, imports, plugins, testOption, cacheDir, offsetFromRoot, projectAlreadyHasViteTargets) {
467
564
  if ((projectAlreadyHasViteTargets == null ? void 0 : projectAlreadyHasViteTargets.build) && (projectAlreadyHasViteTargets == null ? void 0 : projectAlreadyHasViteTargets.test)) {
468
565
  return;
469
566
  }
@@ -471,7 +568,7 @@ function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption,
471
568
  _devkit.logger.info(`vite.config.ts already exists for project ${options.project}.`);
472
569
  }
473
570
  var _options_rollupOptionsExternal;
474
- const buildOptionObject = options.includeLib ? {
571
+ const buildOptionObject = {
475
572
  lib: {
476
573
  entry: 'src/index.ts',
477
574
  name: options.project,
@@ -483,20 +580,9 @@ function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption,
483
580
  },
484
581
  rollupOptions: {
485
582
  external: (_options_rollupOptionsExternal = options.rollupOptionsExternal) != null ? _options_rollupOptionsExternal : []
486
- },
487
- outDir: buildOutDir,
488
- reportCompressedSize: true,
489
- commonjsOptions: {
490
- transformMixedEsModules: true
491
- }
492
- } : {
493
- outDir: buildOutDir,
494
- reportCompressedSize: true,
495
- commonjsOptions: {
496
- transformMixedEsModules: true
497
583
  }
498
584
  };
499
- var _options_testEnvironment, _options_coverageProvider;
585
+ var _options_testEnvironment;
500
586
  const testOptionObject = {
501
587
  globals: true,
502
588
  cache: {
@@ -505,14 +591,7 @@ function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption,
505
591
  environment: (_options_testEnvironment = options.testEnvironment) != null ? _options_testEnvironment : 'jsdom',
506
592
  include: [
507
593
  'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
508
- ],
509
- reporters: [
510
- 'default'
511
- ],
512
- coverage: {
513
- reportsDirectory: reportsDirectory,
514
- provider: `${(_options_coverageProvider = options.coverageProvider) != null ? _options_coverageProvider : 'v8'}`
515
- }
594
+ ]
516
595
  };
517
596
  const changed = (0, _viteconfigeditutils.ensureViteConfigIsCorrect)(tree, viteConfigPath, buildOption, buildOptionObject, imports, plugins, testOption, testOptionObject, cacheDir, projectAlreadyHasViteTargets != null ? projectAlreadyHasViteTargets : {});
518
597
  if (!changed) {