@nx/vite 17.0.2 → 17.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -4
  3. package/generators.json +3 -3
  4. package/migrations.json +90 -0
  5. package/package.json +9 -7
  6. package/plugin.d.ts +1 -0
  7. package/plugin.js +21 -0
  8. package/plugin.js.map +1 -0
  9. package/plugins/nx-tsconfig-paths.plugin.js +9 -5
  10. package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
  11. package/plugins/rollup-replace-files.plugin.d.ts +3 -3
  12. package/plugins/rollup-replace-files.plugin.js +2 -2
  13. package/plugins/rollup-replace-files.plugin.js.map +1 -1
  14. package/src/executors/build/build.impl.d.ts +5 -1
  15. package/src/executors/build/build.impl.js +90 -21
  16. package/src/executors/build/build.impl.js.map +1 -1
  17. package/src/executors/build/schema.d.ts +5 -18
  18. package/src/executors/build/schema.json +4 -106
  19. package/src/executors/dev-server/dev-server.impl.js +74 -9
  20. package/src/executors/dev-server/dev-server.impl.js.map +1 -1
  21. package/src/executors/dev-server/schema.d.ts +0 -10
  22. package/src/executors/dev-server/schema.json +0 -63
  23. package/src/executors/preview-server/preview-server.impl.d.ts +1 -1
  24. package/src/executors/preview-server/preview-server.impl.js +79 -15
  25. package/src/executors/preview-server/preview-server.impl.js.map +1 -1
  26. package/src/executors/preview-server/schema.d.ts +0 -7
  27. package/src/executors/preview-server/schema.json +1 -51
  28. package/src/executors/test/lib/nx-reporter.d.ts +14 -0
  29. package/src/executors/test/lib/nx-reporter.js +40 -0
  30. package/src/executors/test/lib/nx-reporter.js.map +1 -0
  31. package/src/executors/test/lib/utils.d.ts +4 -0
  32. package/src/executors/test/lib/utils.js +77 -0
  33. package/src/executors/test/lib/utils.js.map +1 -0
  34. package/src/executors/test/schema.d.ts +3 -8
  35. package/src/executors/test/schema.json +11 -43
  36. package/src/executors/test/vitest.impl.js +20 -112
  37. package/src/executors/test/vitest.impl.js.map +1 -1
  38. package/src/generators/configuration/configuration.d.ts +2 -1
  39. package/src/generators/configuration/configuration.js +49 -87
  40. package/src/generators/configuration/configuration.js.map +1 -1
  41. package/src/generators/configuration/lib/convert-non-vite.d.ts +5 -0
  42. package/src/generators/configuration/lib/convert-non-vite.js +62 -0
  43. package/src/generators/configuration/lib/convert-non-vite.js.map +1 -0
  44. package/src/generators/configuration/schema.d.ts +1 -3
  45. package/src/generators/configuration/schema.json +0 -12
  46. package/src/generators/init/init.d.ts +4 -3
  47. package/src/generators/init/init.js +50 -67
  48. package/src/generators/init/init.js.map +1 -1
  49. package/src/generators/init/lib/utils.d.ts +6 -0
  50. package/src/generators/init/lib/utils.js +80 -0
  51. package/src/generators/init/lib/utils.js.map +1 -0
  52. package/src/generators/init/schema.d.ts +5 -5
  53. package/src/generators/init/schema.json +17 -20
  54. package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +2 -1
  55. package/src/generators/vitest/schema.d.ts +2 -1
  56. package/src/generators/vitest/schema.json +2 -2
  57. package/src/generators/vitest/vitest-generator.d.ts +2 -1
  58. package/src/generators/vitest/vitest-generator.js +34 -10
  59. package/src/generators/vitest/vitest-generator.js.map +1 -1
  60. package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +1 -1
  61. package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js +3 -17
  62. package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js.map +1 -1
  63. package/src/migrations/update-17-1-0/move-target-defaults.d.ts +2 -0
  64. package/src/migrations/update-17-1-0/move-target-defaults.js +77 -0
  65. package/src/migrations/update-17-1-0/move-target-defaults.js.map +1 -0
  66. package/src/migrations/update-17-2-0/lib/add-file-replacements.d.ts +2 -0
  67. package/src/migrations/update-17-2-0/lib/add-file-replacements.js +67 -0
  68. package/src/migrations/update-17-2-0/lib/add-file-replacements.js.map +1 -0
  69. package/src/migrations/update-17-2-0/lib/edit-build-config.d.ts +2 -0
  70. package/src/migrations/update-17-2-0/lib/edit-build-config.js +121 -0
  71. package/src/migrations/update-17-2-0/lib/edit-build-config.js.map +1 -0
  72. package/src/migrations/update-17-2-0/lib/edit-test-config.d.ts +2 -0
  73. package/src/migrations/update-17-2-0/lib/edit-test-config.js +83 -0
  74. package/src/migrations/update-17-2-0/lib/edit-test-config.js.map +1 -0
  75. package/src/migrations/update-17-2-0/update-vite-config.d.ts +5 -0
  76. package/src/migrations/update-17-2-0/update-vite-config.js +68 -0
  77. package/src/migrations/update-17-2-0/update-vite-config.js.map +1 -0
  78. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.d.ts +3 -0
  79. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js +117 -0
  80. package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js.map +1 -0
  81. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.d.ts +2 -0
  82. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js +45 -0
  83. package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js.map +1 -0
  84. package/src/plugins/plugin.d.ts +10 -0
  85. package/src/plugins/plugin.js +226 -0
  86. package/src/plugins/plugin.js.map +1 -0
  87. package/src/utils/ensure-dependencies.d.ts +8 -0
  88. package/src/utils/ensure-dependencies.js +34 -0
  89. package/src/utils/ensure-dependencies.js.map +1 -0
  90. package/src/utils/executor-utils.d.ts +2 -0
  91. package/src/utils/executor-utils.js +22 -7
  92. package/src/utils/executor-utils.js.map +1 -1
  93. package/src/utils/find-vite-config.d.ts +3 -0
  94. package/src/utils/find-vite-config.js +46 -0
  95. package/src/utils/find-vite-config.js.map +1 -0
  96. package/src/utils/generator-utils.d.ts +10 -12
  97. package/src/utils/generator-utils.js +135 -213
  98. package/src/utils/generator-utils.js.map +1 -1
  99. package/src/utils/options-utils.d.ts +3 -19
  100. package/src/utils/options-utils.js +25 -68
  101. package/src/utils/options-utils.js.map +1 -1
  102. package/src/utils/test-files/react-lib-non-buildable-jest.json +1 -4
  103. package/src/utils/test-files/react-lib-non-buildable-vitest.json +1 -4
  104. package/src/utils/test-files/react-mixed-project.config.json +1 -6
  105. package/src/utils/test-files/react-vite-project.config.json +1 -4
  106. package/src/utils/test-files/unknown-project.config.json +1 -4
  107. package/src/utils/test-utils.d.ts +1 -1
  108. package/src/utils/test-utils.js +10 -18
  109. package/src/utils/test-utils.js.map +1 -1
  110. package/src/utils/versions.d.ts +7 -9
  111. package/src/utils/versions.js +7 -15
  112. package/src/utils/versions.js.map +1 -1
  113. package/src/utils/vite-config-edit-utils.js +1 -1
  114. package/src/utils/vite-config-edit-utils.js.map +1 -1
  115. package/src/utils/test-files/react-project.config.json +0 -85
  116. package/src/utils/test-files/web-project.config.json +0 -72
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/test-utils.ts"],"sourcesContent":["import { Tree, writeJson } from '@nx/devkit';\nimport * as reactAppConfig from './test-files/react-project.config.json';\nimport * as reactViteConfig from './test-files/react-vite-project.config.json';\nimport * as webAppConfig from './test-files/web-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): Tree {\n const appName = '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(\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-react-app': {\n ...reactAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactAppConfig,\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(\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(\n tree,\n 'workspace.json',\n\n {\n projects: {\n 'my-test-web-app': {\n ...webAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n }\n );\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...webAppConfig,\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","reactAppConfig","mixedAppConfig","webAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"mappings":";;;;;;;;IAUgBA,yBAAyB;eAAzBA;;IAmIAC,qBAAqB;eAArBA;;IAoGAC,0BAA0B;eAA1BA;;IAqGAC,mBAAmB;eAAnBA;;IAiEAC,uBAAuB;eAAvBA;;IAsBAC,uBAAuB;eAAvBA;;IAsBAC,+CAA+C;eAA/CA;;IA4EAC,6CAA6C;eAA7CA;;;;wBA/gBgB;wCACA;4CACC;sCACH;0CACI;0CACD;6CACD;8CACA;gDACE;AAE3B,SAASP,0BAA0BQ,IAAU;IAClD,MAAMC,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W,QAAQ,kBAAkB,CAAC,EACnC,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBA,CAAC;IAGJV,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,CAAC,CAAC,EAAES,QAAQ,CAAC,CAAC,EAAE,eACXE;gBACHT,MAAM,CAAC,KAAK,EAAEO,QAAQ,CAAC;gBACvBN,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EAACH,MAAM,CAAC,KAAK,EAAEa,QAAQ,aAAa,CAAC,EAAE,eAC3CE;QACHT,MAAM,CAAC,KAAK,EAAEO,QAAQ,CAAC;QACvBN,aAAa;;IAGf,OAAOP;AACT"}
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;IAEL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,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,13 +1,11 @@
1
1
  export declare const nxVersion: any;
2
- export declare const viteVersion = "~4.3.9";
3
- export declare const vitestVersion = "~0.32.0";
4
- export declare const vitestUiVersion = "~0.32.0";
5
- export declare const vitePluginReactVersion = "~4.0.0";
6
- export declare const vitePluginReactSwcVersion = "~3.3.2";
2
+ export declare const viteVersion = "~5.0.0";
3
+ export declare const vitestVersion = "^1.3.1";
4
+ export declare const vitePluginReactVersion = "^4.2.0";
5
+ export declare const vitePluginReactSwcVersion = "^3.5.0";
7
6
  export declare const jsdomVersion = "~22.1.0";
8
- export declare const vitePluginDtsVersion = "~2.3.0";
7
+ export declare const vitePluginDtsVersion = "~3.8.1";
9
8
  export declare const happyDomVersion = "~9.20.3";
10
9
  export declare const edgeRuntimeVmVersion = "~3.0.2";
11
- export declare const vitestCoverageC8Version = "~0.32.0";
12
- export declare const vitestCoverageV8Version = "~0.32.0";
13
- export declare const vitestCoverageIstanbulVersion = "~0.32.0";
10
+ export declare const vitestCoverageV8Version = "^1.0.4";
11
+ export declare const vitestCoverageIstanbulVersion = "^1.0.4";
@@ -15,9 +15,6 @@ _export(exports, {
15
15
  vitestVersion: function() {
16
16
  return vitestVersion;
17
17
  },
18
- vitestUiVersion: function() {
19
- return vitestUiVersion;
20
- },
21
18
  vitePluginReactVersion: function() {
22
19
  return vitePluginReactVersion;
23
20
  },
@@ -36,9 +33,6 @@ _export(exports, {
36
33
  edgeRuntimeVmVersion: function() {
37
34
  return edgeRuntimeVmVersion;
38
35
  },
39
- vitestCoverageC8Version: function() {
40
- return vitestCoverageC8Version;
41
- },
42
36
  vitestCoverageV8Version: function() {
43
37
  return vitestCoverageV8Version;
44
38
  },
@@ -47,17 +41,15 @@ _export(exports, {
47
41
  }
48
42
  });
49
43
  const nxVersion = require('../../package.json').version;
50
- const viteVersion = '~4.3.9';
51
- const vitestVersion = '~0.32.0';
52
- const vitestUiVersion = '~0.32.0';
53
- const vitePluginReactVersion = '~4.0.0';
54
- const vitePluginReactSwcVersion = '~3.3.2';
44
+ const viteVersion = '~5.0.0';
45
+ const vitestVersion = '^1.3.1';
46
+ const vitePluginReactVersion = '^4.2.0';
47
+ const vitePluginReactSwcVersion = '^3.5.0';
55
48
  const jsdomVersion = '~22.1.0';
56
- const vitePluginDtsVersion = '~2.3.0';
49
+ const vitePluginDtsVersion = '~3.8.1';
57
50
  const happyDomVersion = '~9.20.3';
58
51
  const edgeRuntimeVmVersion = '~3.0.2';
59
- const vitestCoverageC8Version = '~0.32.0';
60
- const vitestCoverageV8Version = '~0.32.0';
61
- const vitestCoverageIstanbulVersion = '~0.32.0';
52
+ const vitestCoverageV8Version = '^1.0.4';
53
+ const vitestCoverageIstanbulVersion = '^1.0.4';
62
54
 
63
55
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\nexport const viteVersion = '~4.3.9';\nexport const vitestVersion = '~0.32.0';\nexport const vitestUiVersion = '~0.32.0';\nexport const vitePluginReactVersion = '~4.0.0';\nexport const vitePluginReactSwcVersion = '~3.3.2';\nexport const jsdomVersion = '~22.1.0';\nexport const vitePluginDtsVersion = '~2.3.0';\nexport const happyDomVersion = '~9.20.3';\nexport const edgeRuntimeVmVersion = '~3.0.2';\n\n// Coverage providers\nexport const vitestCoverageC8Version = '~0.32.0';\nexport const vitestCoverageV8Version = '~0.32.0';\nexport const vitestCoverageIstanbulVersion = '~0.32.0';\n"],"names":["nxVersion","viteVersion","vitestVersion","vitestUiVersion","vitePluginReactVersion","vitePluginReactSwcVersion","jsdomVersion","vitePluginDtsVersion","happyDomVersion","edgeRuntimeVmVersion","vitestCoverageC8Version","vitestCoverageV8Version","vitestCoverageIstanbulVersion","require","version"],"mappings":";;;;;;;;IAAaA,SAAS;eAATA;;IACAC,WAAW;eAAXA;;IACAC,aAAa;eAAbA;;IACAC,eAAe;eAAfA;;IACAC,sBAAsB;eAAtBA;;IACAC,yBAAyB;eAAzBA;;IACAC,YAAY;eAAZA;;IACAC,oBAAoB;eAApBA;;IACAC,eAAe;eAAfA;;IACAC,oBAAoB;eAApBA;;IAGAC,uBAAuB;eAAvBA;;IACAC,uBAAuB;eAAvBA;;IACAC,6BAA6B;eAA7BA;;;AAdN,MAAMZ,YAAYa,QAAQ,sBAAsBC,OAAO;AACvD,MAAMb,cAAc;AACpB,MAAMC,gBAAgB;AACtB,MAAMC,kBAAkB;AACxB,MAAMC,yBAAyB;AAC/B,MAAMC,4BAA4B;AAClC,MAAMC,eAAe;AACrB,MAAMC,uBAAuB;AAC7B,MAAMC,kBAAkB;AACxB,MAAMC,uBAAuB;AAG7B,MAAMC,0BAA0B;AAChC,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":["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"}
@@ -37,7 +37,7 @@ function handleBuildOrTestNode(updatedFileContent, configContentString, configCo
37
37
  let updatedPropsString = '';
38
38
  for (const prop of existingProperties){
39
39
  const propName = prop.name.getText();
40
- if (!configContentObject[propName] && propName !== 'dir') {
40
+ if (!configContentObject[propName] && propName !== 'dir' && propName !== 'reportsDirectory' && propName !== 'provider') {
41
41
  updatedPropsString += `'${propName}': ${prop.initializer.getText()},\n`;
42
42
  }
43
43
  }
@@ -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 (!configContentObject[propName] && propName !== 'dir') {\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,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AsBpB,QAAQG,KAAK,CACvCc,iBAAiB,CAAC,EAAE,EACpB;gBAGF,IAAIG,oBAAoB9B,MAAM,EAAE;oBAC9B2C,iBAAiBZ,IAAAA,4BAAoB,EAACY,gBAAgB;wBACpD;4BACEX,MAAMC,kBAAU,CAACC,MAAM;4BACvBC,OAAOL,mBAAmB,CAAC,EAAE,CAACM,QAAQ;4BACtCC,MAAM5C;wBACR;qBACD;gBACH,OAAO;oBACLkD,iBAAiBZ,IAAAA,4BAAoB,EAACY,gBAAgB;wBACpD;4BACEX,MAAMC,kBAAU,CAACC,MAAM;4BACvBC,OAAOR,iBAAiB,CAAC,EAAE,CAACS,QAAQ,KAAK;4BACzCC,MAAM5C;wBACR;qBACD;gBACH;YACF;QACF,OAAO;YACL,8DAA8D;YAC9D,yDAAyD;YACzD,IAAI;gBACF,MAAM6C,gBAAgB5B,QAAQG,KAAK,CAACsD,MAAM;gBAC1C,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"],"mappings":";+BAUgBA;;;eAAAA;;;wBAVuC;oBAC7B;AASnB,SAASA,0BACdC,IAAU,EACVC,IAAY,EACZC,iBAAyB,EACzBC,iBAAqB,EACrBC,OAAiB,EACjB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ACrCc,iBAAiB,CAAC,EAAE,EACpB;YAGF,IAAIC,kBAAkB5B,MAAM,EAAE;YAC5B,iDAAiD;YACjD,gBAAgB;YAClB,OAAO;gBACL,MAAM8B,sBAAsBpB,QAAQG,KAAK,CACvCc,iBAAiB,CAAC,EAAE,EACpB;gBAGF,IAAIG,oBAAoB9B,MAAM,EAAE;oBAC9B2C,iBAAiBZ,IAAAA,4BAAoB,EAACY,gBAAgB;wBACpD;4BACEX,MAAMC,kBAAU,CAACC,MAAM;4BACvBC,OAAOL,mBAAmB,CAAC,EAAE,CAACM,QAAQ;4BACtCC,MAAM5C;wBACR;qBACD;gBACH,OAAO;oBACLkD,iBAAiBZ,IAAAA,4BAAoB,EAACY,gBAAgB;wBACpD;4BACEX,MAAMC,kBAAU,CAACC,MAAM;4BACvBC,OAAOR,iBAAiB,CAAC,EAAE,CAACS,QAAQ,KAAK;4BACzCC,MAAM5C;wBACR;qBACD;gBACH;YACF;QACF,OAAO;YACL,8DAA8D;YAC9D,yDAAyD;YACzD,IAAI;gBACF,MAAM6C,gBAAgB5B,QAAQG,KAAK,CAACsD,MAAM;gBAC1C,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,85 +0,0 @@
1
- {
2
- "name": "my-test-react-app",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "root": "apps/my-test-react-app",
5
- "sourceRoot": "apps/my-test-react-app/src",
6
- "projectType": "application",
7
- "targets": {
8
- "build": {
9
- "executor": "@nx/webpack:webpack",
10
- "outputs": ["{options.outputPath}"],
11
- "defaultConfiguration": "production",
12
- "options": {
13
- "compiler": "babel",
14
- "outputPath": "dist/apps/my-test-react-app",
15
- "index": "apps/my-test-react-app/src/index.html",
16
- "baseHref": "/",
17
- "main": "apps/my-test-react-app/src/main.tsx",
18
- "polyfills": "apps/my-test-react-app/src/polyfills.ts",
19
- "tsConfig": "apps/my-test-react-app/tsconfig.app.json",
20
- "assets": [
21
- "apps/my-test-react-app/src/favicon.ico",
22
- "apps/my-test-react-app/src/assets"
23
- ],
24
- "styles": ["apps/my-test-react-app/src/styles.css"],
25
- "scripts": [],
26
- "webpackConfig": "@nx/react/plugins/webpack"
27
- },
28
- "configurations": {
29
- "development": {
30
- "extractLicenses": false,
31
- "optimization": false,
32
- "sourceMap": true,
33
- "vendorChunk": true
34
- },
35
- "production": {
36
- "fileReplacements": [
37
- {
38
- "replace": "apps/my-test-react-app/src/environments/environment.ts",
39
- "with": "apps/my-test-react-app/src/environments/environment.prod.ts"
40
- }
41
- ],
42
- "optimization": true,
43
- "outputHashing": "all",
44
- "sourceMap": false,
45
- "namedChunks": false,
46
- "extractLicenses": true,
47
- "vendorChunk": false
48
- }
49
- }
50
- },
51
- "serve": {
52
- "executor": "@nx/webpack:dev-server",
53
- "defaultConfiguration": "development",
54
- "options": {
55
- "buildTarget": "my-test-react-app:build",
56
- "hmr": true
57
- },
58
- "configurations": {
59
- "development": {
60
- "buildTarget": "my-test-react-app:build:development"
61
- },
62
- "production": {
63
- "buildTarget": "my-test-react-app:build:production",
64
- "hmr": false
65
- }
66
- }
67
- },
68
- "lint": {
69
- "executor": "@nx/eslint:lint",
70
- "outputs": ["{options.outputFile}"],
71
- "options": {
72
- "lintFilePatterns": ["apps/my-test-react-app/**/*.{ts,tsx,js,jsx}"]
73
- }
74
- },
75
- "test": {
76
- "executor": "@nx/jest:jest",
77
- "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
78
- "options": {
79
- "jestConfig": "apps/my-test-react-app/jest.config.ts",
80
- "passWithNoTests": true
81
- }
82
- }
83
- },
84
- "tags": []
85
- }
@@ -1,72 +0,0 @@
1
- {
2
- "name": "my-test-web-app",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "projectType": "application",
5
- "root": "apps/my-test-web-app",
6
- "sourceRoot": "apps/my-test-web-app/src",
7
- "tags": [],
8
- "targets": {
9
- "build": {
10
- "executor": "@nx/webpack:webpack",
11
- "outputs": ["{options.outputPath}"],
12
- "defaultConfiguration": "production",
13
- "options": {
14
- "outputPath": "dist/apps/my-test-web-app",
15
- "compiler": "babel",
16
- "main": "apps/my-test-web-app/src/main.ts",
17
- "tsConfig": "apps/my-test-web-app/tsconfig.app.json",
18
- "assets": [
19
- "apps/my-test-web-app/src/favicon.ico",
20
- "apps/my-test-web-app/src/assets"
21
- ],
22
- "index": "apps/my-test-web-app/src/index.html",
23
- "baseHref": "/",
24
- "polyfills": "apps/my-test-web-app/src/polyfills.ts",
25
- "styles": ["apps/my-test-web-app/src/styles.css"],
26
- "scripts": []
27
- },
28
- "configurations": {
29
- "production": {
30
- "optimization": true,
31
- "outputHashing": "all",
32
- "sourceMap": false,
33
- "namedChunks": false,
34
- "extractLicenses": true,
35
- "vendorChunk": false,
36
- "fileReplacements": [
37
- {
38
- "replace": "apps/my-test-web-app/src/environments/environment.ts",
39
- "with": "apps/my-test-web-app/src/environments/environment.prod.ts"
40
- }
41
- ]
42
- }
43
- }
44
- },
45
- "serve": {
46
- "executor": "@nx/webpack:dev-server",
47
- "options": {
48
- "buildTarget": "my-test-web-app:build"
49
- },
50
- "configurations": {
51
- "production": {
52
- "buildTarget": "my-test-web-app:build:production"
53
- }
54
- }
55
- },
56
- "lint": {
57
- "executor": "@nx/eslint:lint",
58
- "outputs": ["{options.outputFile}"],
59
- "options": {
60
- "lintFilePatterns": ["apps/my-test-web-app/**/*.ts"]
61
- }
62
- },
63
- "test": {
64
- "executor": "@nx/jest:jest",
65
- "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
66
- "options": {
67
- "jestConfig": "apps/my-test-web-app/jest.config.ts",
68
- "passWithNoTests": true
69
- }
70
- }
71
- }
72
- }