@nx/vite 19.1.0 → 19.1.2

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 (71) hide show
  1. package/README.md +1 -1
  2. package/executors.js.map +1 -1
  3. package/index.js +3 -3
  4. package/index.js.map +1 -1
  5. package/package.json +4 -4
  6. package/plugin.js +3 -3
  7. package/plugin.js.map +1 -1
  8. package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
  9. package/plugins/nx-vite-build-coordination.plugin.js.map +1 -1
  10. package/plugins/rollup-replace-files.plugin.js.map +1 -1
  11. package/src/executors/build/build.impl.js +5 -5
  12. package/src/executors/build/build.impl.js.map +1 -1
  13. package/src/executors/build/compat.js.map +1 -1
  14. package/src/executors/build/schema.d.js.map +1 -1
  15. package/src/executors/dev-server/compat.js.map +1 -1
  16. package/src/executors/dev-server/dev-server.impl.js +3 -3
  17. package/src/executors/dev-server/dev-server.impl.js.map +1 -1
  18. package/src/executors/dev-server/schema.d.js.map +1 -1
  19. package/src/executors/preview-server/compat.js.map +1 -1
  20. package/src/executors/preview-server/preview-server.impl.js +3 -3
  21. package/src/executors/preview-server/preview-server.impl.js.map +1 -1
  22. package/src/executors/preview-server/schema.d.js.map +1 -1
  23. package/src/executors/test/compat.js.map +1 -1
  24. package/src/executors/test/lib/nx-reporter.js.map +1 -1
  25. package/src/executors/test/lib/utils.js.map +1 -1
  26. package/src/executors/test/schema.d.js.map +1 -1
  27. package/src/executors/test/vitest.impl.js +3 -3
  28. package/src/executors/test/vitest.impl.js.map +1 -1
  29. package/src/generators/configuration/configuration.js +3 -3
  30. package/src/generators/configuration/configuration.js.map +1 -1
  31. package/src/generators/configuration/lib/convert-non-vite.js.map +1 -1
  32. package/src/generators/configuration/schema.d.js.map +1 -1
  33. package/src/generators/init/init.js +4 -4
  34. package/src/generators/init/init.js.map +1 -1
  35. package/src/generators/init/lib/utils.js +3 -3
  36. package/src/generators/init/lib/utils.js.map +1 -1
  37. package/src/generators/init/schema.d.js.map +1 -1
  38. package/src/generators/vitest/schema.d.js.map +1 -1
  39. package/src/generators/vitest/vitest-generator.js +3 -3
  40. package/src/generators/vitest/vitest-generator.js.map +1 -1
  41. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -1
  42. package/src/migrations/update-16-4-1-update-test-file-config/update-16-4-1-test-file-config.js.map +1 -1
  43. package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js.map +1 -1
  44. package/src/migrations/update-17-1-0/move-target-defaults.js.map +1 -1
  45. package/src/migrations/update-17-2-0/lib/add-file-replacements.js.map +1 -1
  46. package/src/migrations/update-17-2-0/lib/edit-build-config.js +0 -1
  47. package/src/migrations/update-17-2-0/lib/edit-build-config.js.map +1 -1
  48. package/src/migrations/update-17-2-0/lib/edit-test-config.js +0 -1
  49. package/src/migrations/update-17-2-0/lib/edit-test-config.js.map +1 -1
  50. package/src/migrations/update-17-2-0/lib/vite-config-with-additional-js.fixture.js.map +1 -1
  51. package/src/migrations/update-17-2-0/update-vite-config.js +0 -1
  52. package/src/migrations/update-17-2-0/update-vite-config.js.map +1 -1
  53. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js.map +1 -1
  54. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js.map +1 -1
  55. package/src/plugins/plugin.js.map +1 -1
  56. package/src/utils/ensure-dependencies.js.map +1 -1
  57. package/src/utils/executor-utils.js +3 -3
  58. package/src/utils/executor-utils.js.map +1 -1
  59. package/src/utils/find-vite-config.js.map +1 -1
  60. package/src/utils/generator-utils.js +19 -18
  61. package/src/utils/generator-utils.js.map +1 -1
  62. package/src/utils/options-utils.js +8 -8
  63. package/src/utils/options-utils.js.map +1 -1
  64. package/src/utils/test-files/test-vite-configs.js +21 -21
  65. package/src/utils/test-files/test-vite-configs.js.map +1 -1
  66. package/src/utils/test-utils.js +12 -12
  67. package/src/utils/test-utils.js.map +1 -1
  68. package/src/utils/versions.d.ts +1 -1
  69. package/src/utils/versions.js +20 -20
  70. package/src/utils/versions.js.map +1 -1
  71. package/src/utils/vite-config-edit-utils.js.map +1 -1
@@ -6,14 +6,11 @@ function _export(target, all) {
6
6
  });
7
7
  }
8
8
  _export(exports, {
9
- noBuildOptions: function() {
10
- return noBuildOptions;
11
- },
12
- someBuildOptions: function() {
13
- return someBuildOptions;
9
+ buildOption: function() {
10
+ return buildOption;
14
11
  },
15
- noContentDefineConfig: function() {
16
- return noContentDefineConfig;
12
+ buildOptionObject: function() {
13
+ return buildOptionObject;
17
14
  },
18
15
  conditionalConfig: function() {
19
16
  return conditionalConfig;
@@ -21,32 +18,35 @@ _export(exports, {
21
18
  configNoDefineConfig: function() {
22
19
  return configNoDefineConfig;
23
20
  },
21
+ hasEverything: function() {
22
+ return hasEverything;
23
+ },
24
+ imports: function() {
25
+ return imports;
26
+ },
27
+ noBuildOptions: function() {
28
+ return noBuildOptions;
29
+ },
24
30
  noBuildOptionsHasTestOption: function() {
25
31
  return noBuildOptionsHasTestOption;
26
32
  },
27
- someBuildOptionsSomeTestOption: function() {
28
- return someBuildOptionsSomeTestOption;
33
+ noContentDefineConfig: function() {
34
+ return noContentDefineConfig;
29
35
  },
30
- hasEverything: function() {
31
- return hasEverything;
36
+ plugins: function() {
37
+ return plugins;
32
38
  },
33
- buildOption: function() {
34
- return buildOption;
39
+ someBuildOptions: function() {
40
+ return someBuildOptions;
35
41
  },
36
- buildOptionObject: function() {
37
- return buildOptionObject;
42
+ someBuildOptionsSomeTestOption: function() {
43
+ return someBuildOptionsSomeTestOption;
38
44
  },
39
45
  testOption: function() {
40
46
  return testOption;
41
47
  },
42
48
  testOptionObject: function() {
43
49
  return testOptionObject;
44
- },
45
- imports: function() {
46
- return imports;
47
- },
48
- plugins: function() {
49
- return plugins;
50
50
  }
51
51
  });
52
52
  const noBuildOptions = `
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/vite/src/utils/test-files/test-vite-configs.ts"],"sourcesContent":["export const noBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n });\n `;\n\nexport const someBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n build: {\n my: 'option',\n }\n\n });\n `;\n\nexport const noContentDefineConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({});\n `;\n\nexport const conditionalConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n export default defineConfig(({ command, mode, ssrBuild }) => {\n if (command === 'serve') {\n return {\n port: 4200,\n host: 'localhost',\n }\n } else {\n // command === 'build'\n return {\n my: 'option',\n }\n }\n })\n `;\n\nexport const configNoDefineConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default {\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n };\n `;\n\nexport const noBuildOptionsHasTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n });\n `;\n\nexport const someBuildOptionsSomeTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n my: 'option',\n },\n\n build: {\n my: 'option',\n }\n\n });\n `;\n\nexport const hasEverything = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n cache: {\n dir: '../../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `;\n\nexport const buildOption = `\n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime']\n }\n },`;\nexport const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n};\n\nexport const testOption = `test: {\n globals: true,\n cache: {\n dir: '../node_modules/.vitest'\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },`;\n\nexport const testOptionObject = {\n globals: true,\n cache: {\n dir: `../node_modules/.vitest`,\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n};\n\nexport const imports = [\n `import dts from 'vite-plugin-dts'`,\n `import { joinPathFragments } from '@nx/devkit'`,\n];\n\nexport const plugins = [`react()`, `nxViteTsPaths()`];\n"],"names":["noBuildOptions","someBuildOptions","noContentDefineConfig","conditionalConfig","configNoDefineConfig","noBuildOptionsHasTestOption","someBuildOptionsSomeTestOption","hasEverything","buildOption","buildOptionObject","testOption","testOptionObject","imports","plugins","lib","entry","name","fileName","formats","rollupOptions","external","globals","cache","dir","environment","include"],"mappings":";;;;;;;;IAAaA,cAAc;eAAdA;;IAwBAC,gBAAgB;eAAhBA;;IA4BAC,qBAAqB;eAArBA;;IASAC,iBAAiB;eAAjBA;;IAkBAC,oBAAoB;eAApBA;;IAcAC,2BAA2B;eAA3BA;;IAwBAC,8BAA8B;eAA9BA;;IAuBAC,aAAa;eAAbA;;IA4CAC,WAAW;eAAXA;;IAkB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/test-files/test-vite-configs.ts"],"sourcesContent":["export const noBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n });\n `;\n\nexport const someBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n build: {\n my: 'option',\n }\n\n });\n `;\n\nexport const noContentDefineConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({});\n `;\n\nexport const conditionalConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n export default defineConfig(({ command, mode, ssrBuild }) => {\n if (command === 'serve') {\n return {\n port: 4200,\n host: 'localhost',\n }\n } else {\n // command === 'build'\n return {\n my: 'option',\n }\n }\n })\n `;\n\nexport const configNoDefineConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default {\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n };\n `;\n\nexport const noBuildOptionsHasTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n });\n `;\n\nexport const someBuildOptionsSomeTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n my: 'option',\n },\n\n build: {\n my: 'option',\n }\n\n });\n `;\n\nexport const hasEverything = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n cache: {\n dir: '../../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `;\n\nexport const buildOption = `\n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime']\n }\n },`;\nexport const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n};\n\nexport const testOption = `test: {\n globals: true,\n cache: {\n dir: '../node_modules/.vitest'\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },`;\n\nexport const testOptionObject = {\n globals: true,\n cache: {\n dir: `../node_modules/.vitest`,\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n};\n\nexport const imports = [\n `import dts from 'vite-plugin-dts'`,\n `import { joinPathFragments } from '@nx/devkit'`,\n];\n\nexport const plugins = [`react()`, `nxViteTsPaths()`];\n"],"names":["buildOption","buildOptionObject","conditionalConfig","configNoDefineConfig","hasEverything","imports","noBuildOptions","noBuildOptionsHasTestOption","noContentDefineConfig","plugins","someBuildOptions","someBuildOptionsSomeTestOption","testOption","testOptionObject","lib","entry","name","fileName","formats","rollupOptions","external","globals","cache","dir","environment","include"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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YAAS;YAAa;SAAoB;IACvD;AACF;AAEO,MAAMR,aAAa,CAAC;;;;;;;MAOrB,CAAC;AAEA,MAAMC,mBAAmB;IAC9BQ,SAAS;IACTC,OAAO;QACLC,KAAK,CAAC,uBAAuB,CAAC;IAChC;IACAC,aAAa;IACbC,SAAS;QAAC;KAAuD;AACnE;AAEO,MAAMpB,UAAU;IACrB,CAAC,iCAAiC,CAAC;IACnC,CAAC,8CAA8C,CAAC;CACjD;AAEM,MAAMI,UAAU;IAAC,CAAC,OAAO,CAAC;IAAE,CAAC,eAAe,CAAC;CAAC"}
@@ -6,29 +6,29 @@ function _export(target, all) {
6
6
  });
7
7
  }
8
8
  _export(exports, {
9
- mockViteReactAppGenerator: function() {
10
- return mockViteReactAppGenerator;
9
+ mockAngularAppGenerator: function() {
10
+ return mockAngularAppGenerator;
11
11
  },
12
12
  mockReactAppGenerator: function() {
13
13
  return mockReactAppGenerator;
14
14
  },
15
- mockReactMixedAppGenerator: function() {
16
- return mockReactMixedAppGenerator;
15
+ mockReactLibNonBuildableJestTestRunnerGenerator: function() {
16
+ return mockReactLibNonBuildableJestTestRunnerGenerator;
17
17
  },
18
- mockWebAppGenerator: function() {
19
- return mockWebAppGenerator;
18
+ mockReactLibNonBuildableVitestRunnerGenerator: function() {
19
+ return mockReactLibNonBuildableVitestRunnerGenerator;
20
20
  },
21
- mockAngularAppGenerator: function() {
22
- return mockAngularAppGenerator;
21
+ mockReactMixedAppGenerator: function() {
22
+ return mockReactMixedAppGenerator;
23
23
  },
24
24
  mockUnknownAppGenerator: function() {
25
25
  return mockUnknownAppGenerator;
26
26
  },
27
- mockReactLibNonBuildableJestTestRunnerGenerator: function() {
28
- return mockReactLibNonBuildableJestTestRunnerGenerator;
27
+ mockViteReactAppGenerator: function() {
28
+ return mockViteReactAppGenerator;
29
29
  },
30
- mockReactLibNonBuildableVitestRunnerGenerator: function() {
31
- return mockReactLibNonBuildableVitestRunnerGenerator;
30
+ mockWebAppGenerator: function() {
31
+ return mockWebAppGenerator;
32
32
  }
33
33
  });
34
34
  const _extends = require("@swc/helpers/_/_extends");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/test-utils.ts"],"sourcesContent":["import { Tree, writeJson } from '@nx/devkit';\nimport * as reactViteConfig from './test-files/react-vite-project.config.json';\nimport * as angularAppConfig from './test-files/angular-project.config.json';\nimport * as randomAppConfig from './test-files/unknown-project.config.json';\nimport * as mixedAppConfig from './test-files/react-mixed-project.config.json';\nimport * as reactLibNBJest from './test-files/react-lib-non-buildable-jest.json';\nimport * as reactLibNBVitest from './test-files/react-lib-non-buildable-vitest.json';\n\nexport function mockViteReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-vite-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true,\n \"types\": [\"vite/client\"]\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Rv1</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n <link rel=\"stylesheet\" href=\"/src/styles.css\" />\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n </html>`\n );\n\n tree.write(\n `apps/${appName}/vite.config.ts`,\n ` /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import tsconfigPaths from 'vite-tsconfig-paths';\n \n export default defineConfig({\n server: {\n port: 4200,\n host: 'localhost',\n },\n plugins: [\n react(),\n tsconfigPaths({\n root: '../../',\n projects: ['tsconfig.base.json'],\n }),\n ],\n \n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-vite-app': {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactAppGenerator(tree: Tree, userAppName?: string): Tree {\n const appName = userAppName ?? 'my-test-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(`apps/${appName}/webpack.config.ts`, ``);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, `apps/${appName}/project.json`, {\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\nexport function mockReactMixedAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-mixed-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-mixed-react-app': {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockWebAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-web-app';\n\n tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n } \n `\n );\n\n tree.write(`apps/${appName}/webpack.config.ts`, ``);\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>WebappPure</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <workspace-root></workspace-root>\n </body>\n </html>\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-web-app': {\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n root: `apps/${appName}`,\n projectType: 'application',\n });\n return tree;\n}\n\nexport function mockAngularAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-angular-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-angular-app': {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockUnknownAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-random-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-random-app': {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableJestTestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-jest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableVitestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-vitest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/vite.config.ts`,\n `/// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n\n plugins: [\n nxViteTsPaths(),\n react(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n"],"names":["mockViteReactAppGenerator","mockReactAppGenerator","mockReactMixedAppGenerator","mockWebAppGenerator","mockAngularAppGenerator","mockUnknownAppGenerator","mockReactLibNonBuildableJestTestRunnerGenerator","mockReactLibNonBuildableVitestRunnerGenerator","tree","appName","write","writeJson","projects","reactViteConfig","root","projectType","userAppName","mixedAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"mappings":";;;;;;;;IAQgBA,yBAAyB;eAAzBA;;IAmIAC,qBAAqB;eAArBA;;IA2FAC,0BAA0B;eAA1BA;;IAqGAC,mBAAmB;eAAnBA;;IA4DAC,uBAAuB;eAAvBA;;IAsBAC,uBAAuB;eAAvBA;;IAsBAC,+CAA+C;eAA/CA;;IA4EAC,6CAA6C;eAA7CA;;;;wBA/fgB;4CACC;0CACC;0CACD;6CACD;8CACA;gDACE;AAE3B,SAASP,0BAA0BQ,IAAU;IAClD,MAAMC,UAAU;IAEhBD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,aAAa,CAAC,EAC9B,CAAC,mCAAmC,CAAC;IAGvCD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,cAAc,CAAC,EAC/B,CAAC;;;;;;;;;;;;;;;;;;;;;MAqBC,CAAC;IAELD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,kBAAkB,CAAC,EACnC,CAAC;;;;;;;;;;;;;;;;;;;;;;MAsBC,CAAC;IAGLD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,WAAW,CAAC,EAC5B,CAAC;;;;;;;;;;;;;;;WAeM,CAAC;IAGVD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,eAAe,CAAC,EAChC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BD,CAAC;IAGHE,IAAAA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port * as reactViteConfig from './test-files/react-vite-project.config.json';\nimport * as angularAppConfig from './test-files/angular-project.config.json';\nimport * as randomAppConfig from './test-files/unknown-project.config.json';\nimport * as mixedAppConfig from './test-files/react-mixed-project.config.json';\nimport * as reactLibNBJest from './test-files/react-lib-non-buildable-jest.json';\nimport * as reactLibNBVitest from './test-files/react-lib-non-buildable-vitest.json';\n\nexport function mockViteReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-vite-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true,\n \"types\": [\"vite/client\"]\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Rv1</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n <link rel=\"stylesheet\" href=\"/src/styles.css\" />\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n </html>`\n );\n\n tree.write(\n `apps/${appName}/vite.config.ts`,\n ` /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import tsconfigPaths from 'vite-tsconfig-paths';\n \n export default defineConfig({\n server: {\n port: 4200,\n host: 'localhost',\n },\n plugins: [\n react(),\n tsconfigPaths({\n root: '../../',\n projects: ['tsconfig.base.json'],\n }),\n ],\n \n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-vite-app': {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactAppGenerator(tree: Tree, userAppName?: string): Tree {\n const appName = userAppName ?? 'my-test-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(`apps/${appName}/webpack.config.ts`, ``);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, `apps/${appName}/project.json`, {\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\nexport function mockReactMixedAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-mixed-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-mixed-react-app': {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockWebAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-web-app';\n\n tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n } \n `\n );\n\n tree.write(`apps/${appName}/webpack.config.ts`, ``);\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>WebappPure</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <workspace-root></workspace-root>\n </body>\n </html>\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-web-app': {\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n root: `apps/${appName}`,\n projectType: 'application',\n });\n return tree;\n}\n\nexport function mockAngularAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-angular-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-angular-app': {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockUnknownAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-random-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-random-app': {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableJestTestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-jest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableVitestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-vitest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/vite.config.ts`,\n `/// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n\n plugins: [\n nxViteTsPaths(),\n react(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n"],"names":["mockAngularAppGenerator","mockReactAppGenerator","mockReactLibNonBuildableJestTestRunnerGenerator","mockReactLibNonBuildableVitestRunnerGenerator","mockReactMixedAppGenerator","mockUnknownAppGenerator","mockViteReactAppGenerator","mockWebAppGenerator","tree","appName","write","writeJson","projects","reactViteConfig","root","projectType","userAppName","mixedAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAuYgBA,uBAAuB;eAAvBA;;IA5PAC,qBAAqB;eAArBA;;IAwSAC,+CAA+C;eAA/CA;;IA4EAC,6CAA6C;eAA7CA;;IAzRAC,0BAA0B;eAA1BA;;IAuLAC,uBAAuB;eAAvBA;;IArZAC,yBAAyB;eAAzBA;;IAmUAC,mBAAmB;eAAnBA;;;;wBA3UgB;4CACC;0CACC;0CACD;6CACD;8CACA;gDACE;AAE3B,SAASD,0BAA0BE,IAAU;IAClD,MAAMC,UAAU;IAEhBD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,aAAa,CAAC,EAC9B,CAAC,mCAAmC,CA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;;;;;;;;;;;;;;KAqBA,CAAC;IAGJT,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,CAAC,CAAC,EAAEQ,QAAQ,CAAC,CAAC,EAAE,eACXE;gBACHR,MAAM,CAAC,KAAK,EAAEM,QAAQ,CAAC;gBACvBL,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EAACH,MAAM,CAAC,KAAK,EAAEY,QAAQ,aAAa,CAAC,EAAE,eAC3CE;QACHR,MAAM,CAAC,KAAK,EAAEM,QAAQ,CAAC;QACvBL,aAAa;;IAGf,OAAOP;AACT"}
@@ -1,5 +1,5 @@
1
1
  export declare const nxVersion: any;
2
- export declare const viteVersion = "~5.0.0";
2
+ export declare const viteVersion = "^5.0.0";
3
3
  export declare const vitestVersion = "^1.3.1";
4
4
  export declare const vitePluginReactVersion = "^4.2.0";
5
5
  export declare const vitePluginReactSwcVersion = "^3.5.0";
@@ -6,42 +6,42 @@ function _export(target, all) {
6
6
  });
7
7
  }
8
8
  _export(exports, {
9
- nxVersion: function() {
10
- return nxVersion;
11
- },
12
- viteVersion: function() {
13
- return viteVersion;
14
- },
15
- vitestVersion: function() {
16
- return vitestVersion;
17
- },
18
- vitePluginReactVersion: function() {
19
- return vitePluginReactVersion;
9
+ edgeRuntimeVmVersion: function() {
10
+ return edgeRuntimeVmVersion;
20
11
  },
21
- vitePluginReactSwcVersion: function() {
22
- return vitePluginReactSwcVersion;
12
+ happyDomVersion: function() {
13
+ return happyDomVersion;
23
14
  },
24
15
  jsdomVersion: function() {
25
16
  return jsdomVersion;
26
17
  },
18
+ nxVersion: function() {
19
+ return nxVersion;
20
+ },
27
21
  vitePluginDtsVersion: function() {
28
22
  return vitePluginDtsVersion;
29
23
  },
30
- happyDomVersion: function() {
31
- return happyDomVersion;
24
+ vitePluginReactSwcVersion: function() {
25
+ return vitePluginReactSwcVersion;
32
26
  },
33
- edgeRuntimeVmVersion: function() {
34
- return edgeRuntimeVmVersion;
27
+ vitePluginReactVersion: function() {
28
+ return vitePluginReactVersion;
35
29
  },
36
- vitestCoverageV8Version: function() {
37
- return vitestCoverageV8Version;
30
+ viteVersion: function() {
31
+ return viteVersion;
38
32
  },
39
33
  vitestCoverageIstanbulVersion: function() {
40
34
  return vitestCoverageIstanbulVersion;
35
+ },
36
+ vitestCoverageV8Version: function() {
37
+ return vitestCoverageV8Version;
38
+ },
39
+ vitestVersion: function() {
40
+ return vitestVersion;
41
41
  }
42
42
  });
43
43
  const nxVersion = require('../../package.json').version;
44
- const viteVersion = '~5.0.0';
44
+ const viteVersion = '^5.0.0';
45
45
  const vitestVersion = '^1.3.1';
46
46
  const vitePluginReactVersion = '^4.2.0';
47
47
  const vitePluginReactSwcVersion = '^3.5.0';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\nexport const viteVersion = '~5.0.0';\nexport const vitestVersion = '^1.3.1';\nexport const vitePluginReactVersion = '^4.2.0';\nexport const vitePluginReactSwcVersion = '^3.5.0';\nexport const jsdomVersion = '~22.1.0';\nexport const vitePluginDtsVersion = '~3.8.1';\nexport const happyDomVersion = '~9.20.3';\nexport const edgeRuntimeVmVersion = '~3.0.2';\n\n// Coverage providers\nexport const vitestCoverageV8Version = '^1.0.4';\nexport const vitestCoverageIstanbulVersion = '^1.0.4';\n"],"names":["nxVersion","viteVersion","vitestVersion","vitePluginReactVersion","vitePluginReactSwcVersion","jsdomVersion","vitePluginDtsVersion","happyDomVersion","edgeRuntimeVmVersion","vitestCoverageV8Version","vitestCoverageIstanbulVersion","require","version"],"mappings":";;;;;;;;IAAaA,SAAS;eAATA;;IACAC,WAAW;eAAXA;;IACAC,aAAa;eAAbA;;IACAC,sBAAsB;eAAtBA;;IACAC,yBAAyB;eAAzBA;;IACAC,YAAY;eAAZA;;IACAC,oBAAoB;eAApBA;;IACAC,eAAe;eAAfA;;IACAC,oBAAoB;eAApBA;;IAGAC,uBAAuB;eAAvBA;;IACAC,6BAA6B;eAA7BA;;;AAZN,MAAMV,YAAYW,QAAQ,sBAAsBC,OAAO;AACvD,MAAMX,cAAc;AACpB,MAAMC,gBAAgB;AACtB,MAAMC,yBAAyB;AAC/B,MAAMC,4BAA4B;AAClC,MAAMC,eAAe;AACrB,MAAMC,uBAAuB;AAC7B,MAAMC,kBAAkB;AACxB,MAAMC,uBAAuB;AAG7B,MAAMC,0BAA0B;AAChC,MAAMC,gCAAgC"}
1
+ {"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\nexport const viteVersion = '^5.0.0';\nexport const vitestVersion = '^1.3.1';\nexport const vitePluginReactVersion = '^4.2.0';\nexport const vitePluginReactSwcVersion = '^3.5.0';\nexport const jsdomVersion = '~22.1.0';\nexport const vitePluginDtsVersion = '~3.8.1';\nexport const happyDomVersion = '~9.20.3';\nexport const edgeRuntimeVmVersion = '~3.0.2';\n\n// Coverage providers\nexport const vitestCoverageV8Version = '^1.0.4';\nexport const vitestCoverageIstanbulVersion = '^1.0.4';\n"],"names":["edgeRuntimeVmVersion","happyDomVersion","jsdomVersion","nxVersion","vitePluginDtsVersion","vitePluginReactSwcVersion","vitePluginReactVersion","viteVersion","vitestCoverageIstanbulVersion","vitestCoverageV8Version","vitestVersion","require","version"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAQaA,oBAAoB;eAApBA;;IADAC,eAAe;eAAfA;;IAFAC,YAAY;eAAZA;;IALAC,SAAS;eAATA;;IAMAC,oBAAoB;eAApBA;;IAFAC,yBAAyB;eAAzBA;;IADAC,sBAAsB;eAAtBA;;IAFAC,WAAW;eAAXA;;IAWAC,6BAA6B;eAA7BA;;IADAC,uBAAuB;eAAvBA;;IATAC,aAAa;eAAbA;;;AAFN,MAAMP,YAAYQ,QAAQ,sBAAsBC,OAAO;AACvD,MAAML,cAAc;AACpB,MAAMG,gBAAgB;AACtB,MAAMJ,yBAAyB;AAC/B,MAAMD,4BAA4B;AAClC,MAAMH,eAAe;AACrB,MAAME,uBAAuB;AAC7B,MAAMH,kBAAkB;AACxB,MAAMD,uBAAuB;AAG7B,MAAMS,0BAA0B;AAChC,MAAMD,gCAAgC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/vite-config-edit-utils.ts"],"sourcesContent":["import { applyChangesToString, ChangeType, Tree } from '@nx/devkit';\nimport { findNodes } from '@nx/js';\nimport { TargetFlags } from './generator-utils';\nimport type {\n ArrayLiteralExpression,\n Node,\n PropertyAssignment,\n ReturnStatement,\n} from 'typescript';\n\nexport function ensureViteConfigIsCorrect(\n tree: Tree,\n path: string,\n buildConfigString: string,\n buildConfigObject: {},\n imports: string[],\n plugins: string[],\n testConfigString: string,\n testConfigObject: {},\n cacheDir: string,\n projectAlreadyHasViteTargets?: TargetFlags\n): boolean {\n const fileContent = tree.read(path, 'utf-8');\n\n let updatedContent = undefined;\n\n if (!projectAlreadyHasViteTargets?.test && testConfigString?.length) {\n updatedContent = handleBuildOrTestNode(\n fileContent,\n testConfigString,\n testConfigObject,\n 'test'\n );\n }\n\n if (!projectAlreadyHasViteTargets?.build && buildConfigString?.length) {\n updatedContent = handleBuildOrTestNode(\n updatedContent ?? fileContent,\n buildConfigString,\n buildConfigObject,\n 'build'\n );\n }\n\n updatedContent =\n handlePluginNode(updatedContent ?? fileContent, imports, plugins) ??\n updatedContent;\n\n if (cacheDir?.length) {\n updatedContent = handleCacheDirNode(\n updatedContent ?? fileContent,\n cacheDir\n );\n }\n\n if (updatedContent) {\n tree.write(path, updatedContent);\n return true;\n } else {\n return false;\n }\n}\n\nfunction handleBuildOrTestNode(\n updatedFileContent: string,\n configContentString: string,\n configContentObject: {},\n name: 'build' | 'test'\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const buildOrTestNode = tsquery.query(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`\n );\n\n if (buildOrTestNode.length) {\n return tsquery.replace(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`,\n (node: PropertyAssignment) => {\n const existingProperties = tsquery.query(\n node.initializer,\n 'PropertyAssignment'\n ) as PropertyAssignment[];\n let updatedPropsString = '';\n for (const prop of existingProperties) {\n const propName = prop.name.getText();\n if (\n !configContentObject[propName] &&\n propName !== 'dir' &&\n propName !== 'reportsDirectory' &&\n propName !== 'provider'\n ) {\n updatedPropsString += `'${propName}': ${prop.initializer.getText()},\\n`;\n }\n }\n for (const [propName, propValue] of Object.entries(\n configContentObject\n )) {\n updatedPropsString += `'${propName}': ${JSON.stringify(\n propValue\n )},\\n`;\n }\n return `${name}: {\n ${updatedPropsString}\n }`;\n }\n );\n } else {\n const foundDefineConfig = tsquery.query(\n updatedFileContent,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n if (name === 'build') {\n return transformConditionalConfig(\n conditionalConfig,\n updatedFileContent,\n configContentString\n );\n } else {\n // no test config in conditional config\n return updatedFileContent;\n }\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: configContentString,\n },\n ]);\n } else {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: configContentString,\n },\n ]);\n }\n }\n } else {\n // build config does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(\n updatedFileContent,\n 'ExportAssignment'\n );\n const found = tsquery.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: configContentString,\n },\n ]);\n } catch {\n return updatedFileContent;\n }\n }\n }\n}\n\nfunction transformCurrentBuildObject(\n index: number,\n returnStatements: ReturnStatement[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n if (!returnStatements?.[index]) {\n return undefined;\n }\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const currentBuildObject = tsquery\n .query(returnStatements[index], 'ObjectLiteralExpression')?.[0]\n .getText();\n\n const currentBuildObjectStart = returnStatements[index].getStart();\n const currentBuildObjectEnd = returnStatements[index].getEnd();\n const newReturnObject = tsquery.replace(\n returnStatements[index].getText(),\n 'ObjectLiteralExpression',\n (_node: Node) => {\n return `{\n ...${currentBuildObject},\n ...${JSON.stringify(buildConfigObject)}\n }`;\n }\n );\n\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Delete,\n start: currentBuildObjectStart,\n length: currentBuildObjectEnd - currentBuildObjectStart,\n },\n {\n type: ChangeType.Insert,\n index: currentBuildObjectStart,\n text: newReturnObject,\n },\n ]);\n\n return newContents;\n}\n\nfunction transformConditionalConfig(\n conditionalConfig: Node[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const { SyntaxKind } = require('typescript');\n const functionBlock = tsquery.query(conditionalConfig[0], 'Block');\n const ifStatement = tsquery.query(functionBlock?.[0], 'IfStatement');\n\n const binaryExpressions = tsquery.query(ifStatement?.[0], 'BinaryExpression');\n\n const buildExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const buildExistsExpressionIndex = binaryExpressions?.findIndex(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const serveExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'serve'`\n );\n\n const elseKeywordExists = findNodes(ifStatement?.[0], SyntaxKind.ElseKeyword);\n const returnStatements: ReturnStatement[] = tsquery.query(\n ifStatement[0],\n 'ReturnStatement'\n );\n\n if (!buildExists) {\n if (serveExists && elseKeywordExists) {\n // build options live inside the else block\n return (\n transformCurrentBuildObject(\n returnStatements?.length - 1,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n } else {\n // no build options exist yet\n const functionBlockStart = functionBlock?.[0].getStart();\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: functionBlockStart + 1,\n text: `\n if (command === 'build') {\n return ${JSON.stringify(buildConfigObject)}\n }\n `,\n },\n ]);\n return newContents;\n }\n } else {\n // build already exists\n // it will be the return statement which lives\n // at the buildExistsExpressionIndex\n\n return (\n transformCurrentBuildObject(\n buildExistsExpressionIndex,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n }\n}\n\nfunction handlePluginNode(\n appFileContent: string,\n imports: string[],\n plugins: string[]\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const file = tsquery.ast(appFileContent);\n const pluginsNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])'\n );\n\n let writeFile = false;\n\n if (pluginsNode.length) {\n appFileContent = tsquery.replace(\n file.getText(),\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])',\n (node: Node) => {\n const found = tsquery.query(\n node,\n 'ArrayLiteralExpression'\n ) as ArrayLiteralExpression[];\n let updatedPluginsString = '';\n\n const existingPluginNodes = found?.[0].elements ?? [];\n\n for (const plugin of existingPluginNodes) {\n updatedPluginsString += `${plugin.getText()},\\n`;\n }\n\n for (const plugin of plugins) {\n if (\n !existingPluginNodes?.some((node) =>\n node.getText().includes(plugin)\n )\n ) {\n updatedPluginsString += `${plugin},\\n`;\n }\n }\n\n return `plugins: [${updatedPluginsString}]`;\n }\n );\n writeFile = true;\n } else {\n // Plugins node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with plugins\n writeFile = false;\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: `plugins: [${plugins.join(',\\n')}],`,\n },\n ]);\n writeFile = true;\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: `plugins: [${plugins.join(',\\n')}],`,\n },\n ]);\n writeFile = true;\n }\n }\n } else {\n // Plugins option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: `plugins: [${plugins.join(',\\n')}],`,\n },\n ]);\n writeFile = true;\n } catch {\n writeFile = false;\n }\n }\n }\n if (writeFile) {\n const filteredImports = filterImport(appFileContent, imports);\n return filteredImports.join(';') + '\\n' + appFileContent;\n }\n}\n\nfunction filterImport(appFileContent: string, imports: string[]): string[] {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const file = tsquery.ast(appFileContent);\n const importNodes = tsquery.query(\n file,\n ':matches(ImportDeclaration, VariableStatement)'\n );\n\n const importsArrayExisting = importNodes?.map((node) => {\n return node.getText().slice(0, -1);\n });\n\n return imports.filter((importString) => {\n return !importsArrayExisting?.includes(importString);\n });\n}\n\nfunction handleCacheDirNode(appFileContent: string, cacheDir: string): string {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n\n const file = tsquery.ast(appFileContent);\n const cacheDirNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"cacheDir\"])'\n );\n\n if (!cacheDirNode?.length || cacheDirNode?.length === 0) {\n // cacheDir node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with cacheDir\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: cacheDir,\n },\n ]);\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: cacheDir,\n },\n ]);\n }\n }\n } else {\n // cacheDir option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: cacheDir,\n },\n ]);\n } catch {}\n }\n }\n\n return appFileContent;\n}\n"],"names":["ensureViteConfigIsCorrect","tree","path","buildConfigString","buildConfigObject","imports","plugins","testConfigString","testConfigObject","cacheDir","projectAlreadyHasViteTargets","fileContent","read","updatedContent","undefined","test","length","handleBuildOrTestNode","build","handlePluginNode","handleCacheDirNode","write","updatedFileContent","configContentString","configContentObject","name","tsquery","require","buildOrTestNode","query","replace","node","existingProperties","initializer","updatedPropsString","prop","propName","getText","propValue","Object","entries","JSON","stringify","foundDefineConfig","conditionalConfig","transformConditionalConfig","propertyAssignments","applyChangesToString","type","ChangeType","Insert","index","getStart","text","defaultExport","found","startOfObject","transformCurrentBuildObject","returnStatements","appFileContent","currentBuildObject","currentBuildObjectStart","currentBuildObjectEnd","getEnd","newReturnObject","_node","newContents","Delete","start","SyntaxKind","functionBlock","ifStatement","binaryExpressions","buildExists","find","binaryExpression","buildExistsExpressionIndex","findIndex","serveExists","elseKeywordExists","findNodes","ElseKeyword","functionBlockStart","file","ast","pluginsNode","writeFile","updatedPluginsString","existingPluginNodes","elements","plugin","some","includes","join","filteredImports","filterImport","importNodes","importsArrayExisting","map","slice","filter","importString","cacheDirNode"],"mappings":";+BAUgBA;;;eAAAA;;;wBAVuC;oBAC7B;AASnB,SAASA,0BACdC,IAAU,EACVC,IAAY,EACZC,iBAAyB,EACzBC,iBAAqB,EACrBC,OAAiB,EACjBC,OAAiB,EACjBC,gBAAwB,EACxBC,gBAAoB,EACpBC,QAAgB,EAChBC,4BAA0C;IAE1C,MAAMC,cAAcV,KAAKW,IAAI,CAACV,MAAM;IAEpC,IAAIW,iBAAiBC;IAErB,IAAI,EAACJ,gDAAAA,6BAA8BK,IAAI,MAAIR,oCAAAA,iBAAkBS,MAAM,GAAE;QACnEH,iBAAiBI,sBACfN,aACAJ,kBACAC,kBACA;IAEJ;IAEA,IAAI,EAACE,gDAAAA,6BAA8BQ,KAAK,MAAIf,qCAAAA,kBAAmBa,MAAM,GAAE;QACrEH,iBAAiBI,sBACfJ,yBAAAA,iBAAkBF,aAClBR,mBACAC,mBACA;IAEJ;QAGEe;IADFN,iBACEM,CAAAA,oBAAAA,iBAAiBN,yBAAAA,iBAAkBF,aAAaN,SAASC,oBAAzDa,oBACAN;IAEF,IAAIJ,4BAAAA,SAAUO,MAAM,EAAE;QACpBH,iBAAiBO,mBACfP,yBAAAA,iBAAkBF,aAClBF;IAEJ;IAEA,IAAII,gBAAgB;QAClBZ,KAAKoB,KAAK,CAACnB,MAAMW;QACjB,OAAO;IACT,OAAO;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,MAAM5B,QAAQ7B,2BAAAA,QAASG,KAAK,CAC1ByB,iCAAAA,aAAe,CAAC,EAAE,EAClB;gBAEF,MAAME,gBAAgBD,yBAAAA,KAAO,CAAC,EAAE,CAACH,QAAQ;gBACzCO,iBAAiBZ,IAAAA,4BAAoB,EAACY,gBAAgB;oBACpD;wBACEX,MAAMC,kBAAU,CAACC,MAAM;wBACvBC,OAAOK,gBAAgB;wBACvBH,MAAM5C;oBACR;iBACD;YACH,EAAE,UAAM,CAAC;QACX;IACF;IAEA,OAAOkD;AACT"}
1
+ {"version":3,"sources":["../../../../../packages/vite/src/utils/vite-config-edit-utils.ts"],"sourcesContent":["import { applyChangesToString, ChangeType, Tree } from '@nx/devkit';\nimport { findNodes } from '@nx/js';\nimport { TargetFlags } from './generator-utils';\nimport type {\n ArrayLiteralExpression,\n Node,\n PropertyAssignment,\n ReturnStatement,\n} from 'typescript';\n\nexport function ensureViteConfigIsCorrect(\n tree: Tree,\n path: string,\n buildConfigString: string,\n buildConfigObject: {},\n imports: string[],\n plugins: string[],\n testConfigString: string,\n testConfigObject: {},\n cacheDir: string,\n projectAlreadyHasViteTargets?: TargetFlags\n): boolean {\n const fileContent = tree.read(path, 'utf-8');\n\n let updatedContent = undefined;\n\n if (!projectAlreadyHasViteTargets?.test && testConfigString?.length) {\n updatedContent = handleBuildOrTestNode(\n fileContent,\n testConfigString,\n testConfigObject,\n 'test'\n );\n }\n\n if (!projectAlreadyHasViteTargets?.build && buildConfigString?.length) {\n updatedContent = handleBuildOrTestNode(\n updatedContent ?? fileContent,\n buildConfigString,\n buildConfigObject,\n 'build'\n );\n }\n\n updatedContent =\n handlePluginNode(updatedContent ?? fileContent, imports, plugins) ??\n updatedContent;\n\n if (cacheDir?.length) {\n updatedContent = handleCacheDirNode(\n updatedContent ?? fileContent,\n cacheDir\n );\n }\n\n if (updatedContent) {\n tree.write(path, updatedContent);\n return true;\n } else {\n return false;\n }\n}\n\nfunction handleBuildOrTestNode(\n updatedFileContent: string,\n configContentString: string,\n configContentObject: {},\n name: 'build' | 'test'\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const buildOrTestNode = tsquery.query(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`\n );\n\n if (buildOrTestNode.length) {\n return tsquery.replace(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`,\n (node: PropertyAssignment) => {\n const existingProperties = tsquery.query(\n node.initializer,\n 'PropertyAssignment'\n ) as PropertyAssignment[];\n let updatedPropsString = '';\n for (const prop of existingProperties) {\n const propName = prop.name.getText();\n if (\n !configContentObject[propName] &&\n propName !== 'dir' &&\n propName !== 'reportsDirectory' &&\n propName !== 'provider'\n ) {\n updatedPropsString += `'${propName}': ${prop.initializer.getText()},\\n`;\n }\n }\n for (const [propName, propValue] of Object.entries(\n configContentObject\n )) {\n updatedPropsString += `'${propName}': ${JSON.stringify(\n propValue\n )},\\n`;\n }\n return `${name}: {\n ${updatedPropsString}\n }`;\n }\n );\n } else {\n const foundDefineConfig = tsquery.query(\n updatedFileContent,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n if (name === 'build') {\n return transformConditionalConfig(\n conditionalConfig,\n updatedFileContent,\n configContentString\n );\n } else {\n // no test config in conditional config\n return updatedFileContent;\n }\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: configContentString,\n },\n ]);\n } else {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: configContentString,\n },\n ]);\n }\n }\n } else {\n // build config does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(\n updatedFileContent,\n 'ExportAssignment'\n );\n const found = tsquery.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: configContentString,\n },\n ]);\n } catch {\n return updatedFileContent;\n }\n }\n }\n}\n\nfunction transformCurrentBuildObject(\n index: number,\n returnStatements: ReturnStatement[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n if (!returnStatements?.[index]) {\n return undefined;\n }\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const currentBuildObject = tsquery\n .query(returnStatements[index], 'ObjectLiteralExpression')?.[0]\n .getText();\n\n const currentBuildObjectStart = returnStatements[index].getStart();\n const currentBuildObjectEnd = returnStatements[index].getEnd();\n const newReturnObject = tsquery.replace(\n returnStatements[index].getText(),\n 'ObjectLiteralExpression',\n (_node: Node) => {\n return `{\n ...${currentBuildObject},\n ...${JSON.stringify(buildConfigObject)}\n }`;\n }\n );\n\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Delete,\n start: currentBuildObjectStart,\n length: currentBuildObjectEnd - currentBuildObjectStart,\n },\n {\n type: ChangeType.Insert,\n index: currentBuildObjectStart,\n text: newReturnObject,\n },\n ]);\n\n return newContents;\n}\n\nfunction transformConditionalConfig(\n conditionalConfig: Node[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const { SyntaxKind } = require('typescript');\n const functionBlock = tsquery.query(conditionalConfig[0], 'Block');\n const ifStatement = tsquery.query(functionBlock?.[0], 'IfStatement');\n\n const binaryExpressions = tsquery.query(ifStatement?.[0], 'BinaryExpression');\n\n const buildExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const buildExistsExpressionIndex = binaryExpressions?.findIndex(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const serveExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'serve'`\n );\n\n const elseKeywordExists = findNodes(ifStatement?.[0], SyntaxKind.ElseKeyword);\n const returnStatements: ReturnStatement[] = tsquery.query(\n ifStatement[0],\n 'ReturnStatement'\n );\n\n if (!buildExists) {\n if (serveExists && elseKeywordExists) {\n // build options live inside the else block\n return (\n transformCurrentBuildObject(\n returnStatements?.length - 1,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n } else {\n // no build options exist yet\n const functionBlockStart = functionBlock?.[0].getStart();\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: functionBlockStart + 1,\n text: `\n if (command === 'build') {\n return ${JSON.stringify(buildConfigObject)}\n }\n `,\n },\n ]);\n return newContents;\n }\n } else {\n // build already exists\n // it will be the return statement which lives\n // at the buildExistsExpressionIndex\n\n return (\n transformCurrentBuildObject(\n buildExistsExpressionIndex,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n }\n}\n\nfunction handlePluginNode(\n appFileContent: string,\n imports: string[],\n plugins: string[]\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const file = tsquery.ast(appFileContent);\n const pluginsNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])'\n );\n\n let writeFile = false;\n\n if (pluginsNode.length) {\n appFileContent = tsquery.replace(\n file.getText(),\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])',\n (node: Node) => {\n const found = tsquery.query(\n node,\n 'ArrayLiteralExpression'\n ) as ArrayLiteralExpression[];\n let updatedPluginsString = '';\n\n const existingPluginNodes = found?.[0].elements ?? [];\n\n for (const plugin of existingPluginNodes) {\n updatedPluginsString += `${plugin.getText()},\\n`;\n }\n\n for (const plugin of plugins) {\n if (\n !existingPluginNodes?.some((node) =>\n node.getText().includes(plugin)\n )\n ) {\n updatedPluginsString += `${plugin},\\n`;\n }\n }\n\n return `plugins: [${updatedPluginsString}]`;\n }\n );\n writeFile = true;\n } else {\n // Plugins node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with plugins\n writeFile = false;\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: `plugins: [${plugins.join(',\\n')}],`,\n },\n ]);\n writeFile = true;\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: `plugins: [${plugins.join(',\\n')}],`,\n },\n ]);\n writeFile = true;\n }\n }\n } else {\n // Plugins option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: `plugins: [${plugins.join(',\\n')}],`,\n },\n ]);\n writeFile = true;\n } catch {\n writeFile = false;\n }\n }\n }\n if (writeFile) {\n const filteredImports = filterImport(appFileContent, imports);\n return filteredImports.join(';') + '\\n' + appFileContent;\n }\n}\n\nfunction filterImport(appFileContent: string, imports: string[]): string[] {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const file = tsquery.ast(appFileContent);\n const importNodes = tsquery.query(\n file,\n ':matches(ImportDeclaration, VariableStatement)'\n );\n\n const importsArrayExisting = importNodes?.map((node) => {\n return node.getText().slice(0, -1);\n });\n\n return imports.filter((importString) => {\n return !importsArrayExisting?.includes(importString);\n });\n}\n\nfunction handleCacheDirNode(appFileContent: string, cacheDir: string): string {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n\n const file = tsquery.ast(appFileContent);\n const cacheDirNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"cacheDir\"])'\n );\n\n if (!cacheDirNode?.length || cacheDirNode?.length === 0) {\n // cacheDir node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with cacheDir\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: cacheDir,\n },\n ]);\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: cacheDir,\n },\n ]);\n }\n }\n } else {\n // cacheDir option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: cacheDir,\n },\n ]);\n } catch {}\n }\n }\n\n return appFileContent;\n}\n"],"names":["ensureViteConfigIsCorrect","tree","path","buildConfigString","buildConfigObject","imports","plugins","testConfigString","testConfigObject","cacheDir","projectAlreadyHasViteTargets","fileContent","read","updatedContent","undefined","test","length","handleBuildOrTestNode","build","handlePluginNode","handleCacheDirNode","write","updatedFileContent","configContentString","configContentObject","name","tsquery","require","buildOrTestNode","query","replace","node","existingProperties","initializer","updatedPropsString","prop","propName","getText","propValue","Object","entries","JSON","stringify","foundDefineConfig","conditionalConfig","transformConditionalConfig","propertyAssignments","applyChangesToString","type","ChangeType","Insert","index","getStart","text","defaultExport","found","startOfObject","transformCurrentBuildObject","returnStatements","appFileContent","currentBuildObject","currentBuildObjectStart","currentBuildObjectEnd","getEnd","newReturnObject","_node","newContents","Delete","start","SyntaxKind","functionBlock","ifStatement","binaryExpressions","buildExists","find","binaryExpression","buildExistsExpressionIndex","findIndex","serveExists","elseKeywordExists","findNodes","ElseKeyword","functionBlockStart","file","ast","pluginsNode","writeFile","updatedPluginsString","existingPluginNodes","elements","plugin","some","includes","join","filteredImports","filterImport","importNodes","importsArrayExisting","map","slice","filter","importString","cacheDirNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BAUgBA;;;eAAAA;;;wBAVuC;oBAC7B;AASnB,SAASA,0BACdC,IAAU,EACVC,IAAY,EACZC,iBAAyB,EACzBC,iBAAqB,EACrBC,OAAiB,EACjBC,OAAiB,EACjBC,gBAAwB,EACxBC,gBAAoB,EACpBC,QAAgB,EAChBC,4BAA0C;IAE1C,MAAMC,cAAcV,KAAKW,IAAI,CAACV,MAAM;IAEpC,IAAIW,iBAAiBC;IAErB,IAAI,EAACJ,gDAAAA,6BAA8BK,IAAI,M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