@nx/vite 20.2.2 → 20.3.0-beta.1
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.
- package/package.json +3 -3
- package/plugins/nx-tsconfig-paths.plugin.js +2 -20
- package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
- package/src/generators/vitest/schema.d.ts +1 -1
- package/src/generators/vitest/schema.json +1 -2
- package/src/generators/vitest/vitest-generator.d.ts +3 -0
- package/src/generators/vitest/vitest-generator.js +40 -10
- package/src/generators/vitest/vitest-generator.js.map +1 -1
- package/src/utils/detect-ui-framework.d.ts +1 -0
- package/src/utils/detect-ui-framework.js +35 -0
- package/src/utils/detect-ui-framework.js.map +1 -0
- package/src/utils/ensure-dependencies.d.ts +1 -1
- package/src/utils/ensure-dependencies.js +4 -0
- package/src/utils/ensure-dependencies.js.map +1 -1
- package/src/utils/generator-utils.d.ts +2 -1
- package/src/utils/generator-utils.js +12 -6
- package/src/utils/generator-utils.js.map +1 -1
- package/src/utils/nx-tsconfig-paths-find-file.d.ts +2 -0
- package/src/utils/nx-tsconfig-paths-find-file.js +28 -0
- package/src/utils/nx-tsconfig-paths-find-file.js.map +1 -0
- package/src/utils/test-utils.js +71 -0
- package/src/utils/test-utils.js.map +1 -1
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +4 -0
- package/src/utils/versions.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.3.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "20.
|
|
33
|
+
"@nx/devkit": "20.3.0-beta.1",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"@swc/helpers": "~0.5.0",
|
|
36
36
|
"enquirer": "~2.3.6",
|
|
37
|
-
"@nx/js": "20.
|
|
37
|
+
"@nx/js": "20.3.0-beta.1",
|
|
38
38
|
"tsconfig-paths": "^4.1.2",
|
|
39
39
|
"minimatch": "9.0.3"
|
|
40
40
|
},
|
|
@@ -11,6 +11,7 @@ const _nodepath = require("node:path");
|
|
|
11
11
|
const _tsconfigpaths = require("tsconfig-paths");
|
|
12
12
|
const _buildablelibsutils = require("@nx/js/src/utils/buildable-libs-utils");
|
|
13
13
|
const _nxvitebuildcoordinationplugin = require("./nx-vite-build-coordination.plugin");
|
|
14
|
+
const _nxtsconfigpathsfindfile = require("../src/utils/nx-tsconfig-paths-find-file");
|
|
14
15
|
const _tssolutionsetup = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
16
|
function nxViteTsPaths(options = {}) {
|
|
16
17
|
var _options, _options1, _options2;
|
|
@@ -157,30 +158,11 @@ There should at least be a tsconfig.base.json or tsconfig.json in the root of th
|
|
|
157
158
|
const normalizedImport = alias.replace(/\/\*$/, '');
|
|
158
159
|
if (importPath.startsWith(normalizedImport)) {
|
|
159
160
|
const joinedPath = (0, _devkit.joinPathFragments)(tsconfig.absoluteBaseUrl, paths[0].replace(/\/\*$/, ''));
|
|
160
|
-
resolvedFile = findFile(importPath.replace(normalizedImport, joinedPath));
|
|
161
|
+
resolvedFile = (0, _nxtsconfigpathsfindfile.findFile)(importPath.replace(normalizedImport, joinedPath), options.extensions);
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
return resolvedFile;
|
|
164
165
|
}
|
|
165
|
-
function findFile(path) {
|
|
166
|
-
for (const ext of options.extensions){
|
|
167
|
-
// Support file with "." in the name.
|
|
168
|
-
let resolvedPath = (0, _nodepath.resolve)(path + ext);
|
|
169
|
-
if ((0, _nodefs.existsSync)(resolvedPath)) {
|
|
170
|
-
return resolvedPath;
|
|
171
|
-
}
|
|
172
|
-
// Support file extensions such as .css and .js in the import path.
|
|
173
|
-
const { dir, name } = (0, _nodepath.parse)(path);
|
|
174
|
-
resolvedPath = (0, _nodepath.resolve)(dir, name + ext);
|
|
175
|
-
if ((0, _nodefs.existsSync)(resolvedPath)) {
|
|
176
|
-
return resolvedPath;
|
|
177
|
-
}
|
|
178
|
-
const resolvedIndexPath = (0, _nodepath.resolve)(path, `index${ext}`);
|
|
179
|
-
if ((0, _nodefs.existsSync)(resolvedIndexPath)) {
|
|
180
|
-
return resolvedIndexPath;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
166
|
}
|
|
185
167
|
|
|
186
168
|
//# sourceMappingURL=nx-tsconfig-paths.plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../packages/vite/plugins/nx-tsconfig-paths.plugin.ts"],"sourcesContent":["import {\n createProjectGraphAsync,\n joinPathFragments,\n stripIndents,\n workspaceRoot,\n} from '@nx/devkit';\nimport { copyFileSync, existsSync } from 'node:fs';\nimport { join, parse, relative, resolve } from 'node:path';\nimport {\n loadConfig,\n createMatchPath,\n MatchPath,\n ConfigLoaderSuccessResult,\n} from 'tsconfig-paths';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { Plugin } from 'vite';\nimport { nxViteBuildCoordinationPlugin } from './nx-vite-build-coordination.plugin';\nimport { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\n\nexport interface nxViteTsPathsOptions {\n /**\n * Enable debug logging\n * @default false\n **/\n debug?: boolean;\n /**\n * export fields in package.json to use for resolving\n * @default [['exports', '.', 'import'], 'module', 'main']\n *\n * fallback resolution will use ['main', 'module']\n **/\n mainFields?: (string | string[])[];\n /**\n * extensions to check when resolving files when package.json resolution fails\n * @default ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs', '.cjs']\n **/\n extensions?: string[];\n /**\n * Inform Nx whether to use the raw source or to use the built output for buildable dependencies.\n * Set to `false` to use incremental builds.\n * @default true\n */\n buildLibsFromSource?: boolean;\n}\n\nexport function nxViteTsPaths(options: nxViteTsPathsOptions = {}) {\n let matchTsPathEsm: MatchPath;\n let matchTsPathFallback: MatchPath | undefined;\n let tsConfigPathsEsm: ConfigLoaderSuccessResult;\n let tsConfigPathsFallback: ConfigLoaderSuccessResult;\n\n options.extensions ??= [\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.json',\n '.mts',\n '.mjs',\n '.cts',\n '.cjs',\n '.css',\n '.scss',\n '.less',\n ];\n options.mainFields ??= [['exports', '.', 'import'], 'module', 'main'];\n options.buildLibsFromSource ??= true;\n let projectRoot = '';\n\n return {\n name: 'nx-vite-ts-paths',\n // Ensure the resolveId aspect of the plugin is called before vite's internal resolver\n // Otherwise, issues can arise with Yarn Workspaces and Pnpm Workspaces\n enforce: 'pre',\n async configResolved(config: any) {\n projectRoot = config.root;\n const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);\n let foundTsConfigPath = getTsConfig(\n join(\n workspaceRoot,\n 'tmp',\n projectRootFromWorkspaceRoot,\n process.env.NX_TASK_TARGET_TARGET ?? 'build',\n 'tsconfig.generated.json'\n )\n );\n if (!foundTsConfigPath) {\n throw new Error(stripIndents`Unable to find a tsconfig in the workspace! \nThere should at least be a tsconfig.base.json or tsconfig.json in the root of the workspace ${workspaceRoot}`);\n }\n\n if (\n !options.buildLibsFromSource &&\n !global.NX_GRAPH_CREATION &&\n config.mode !== 'test'\n ) {\n const projectGraph = await createProjectGraphAsync({\n exitOnError: false,\n resetDaemonClient: true,\n });\n const { dependencies } = calculateProjectBuildableDependencies(\n undefined,\n projectGraph,\n workspaceRoot,\n process.env.NX_TASK_TARGET_PROJECT,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n process.env.NX_TASK_TARGET_TARGET === 'serve'\n ? 'build'\n : process.env.NX_TASK_TARGET_TARGET,\n process.env.NX_TASK_TARGET_CONFIGURATION\n );\n // This tsconfig is used via the Vite ts paths plugin.\n // It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).\n foundTsConfigPath = createTmpTsConfig(\n foundTsConfigPath,\n workspaceRoot,\n relative(workspaceRoot, projectRoot),\n dependencies,\n true\n );\n\n if (config.command === 'serve') {\n const buildableLibraryDependencies = dependencies\n .filter((dep) => dep.node.type === 'lib')\n .map((dep) => dep.node.name)\n .join(',');\n const buildCommand = `npx nx run-many --target=${process.env.NX_TASK_TARGET_TARGET} --projects=${buildableLibraryDependencies}`;\n config.plugins.push(nxViteBuildCoordinationPlugin({ buildCommand }));\n }\n }\n\n const parsed = loadConfig(foundTsConfigPath);\n\n logIt('first parsed tsconfig: ', parsed);\n if (parsed.resultType === 'failed') {\n throw new Error(`Failed loading tsconfig at ${foundTsConfigPath}`);\n }\n tsConfigPathsEsm = parsed;\n\n matchTsPathEsm = createMatchPath(\n parsed.absoluteBaseUrl,\n parsed.paths,\n options.mainFields\n );\n\n const rootLevelTsConfig = getTsConfig(\n join(workspaceRoot, 'tsconfig.base.json')\n );\n const rootLevelParsed = loadConfig(rootLevelTsConfig);\n logIt('fallback parsed tsconfig: ', rootLevelParsed);\n if (rootLevelParsed.resultType === 'success') {\n tsConfigPathsFallback = rootLevelParsed;\n matchTsPathFallback = createMatchPath(\n rootLevelParsed.absoluteBaseUrl,\n rootLevelParsed.paths,\n ['main', 'module']\n );\n }\n },\n resolveId(importPath: string) {\n let resolvedFile: string;\n try {\n resolvedFile = matchTsPathEsm(importPath);\n } catch (e) {\n logIt('Using fallback path matching.');\n resolvedFile = matchTsPathFallback?.(importPath);\n }\n\n if (!resolvedFile) {\n if (tsConfigPathsEsm || tsConfigPathsFallback) {\n logIt(\n `Unable to resolve ${importPath} with tsconfig paths. Using fallback file matching.`\n );\n resolvedFile =\n loadFileFromPaths(tsConfigPathsEsm, importPath) ||\n loadFileFromPaths(tsConfigPathsFallback, importPath);\n } else {\n logIt(`Unable to resolve ${importPath} with tsconfig paths`);\n }\n }\n\n logIt(`Resolved ${importPath} to ${resolvedFile}`);\n // Returning null defers to other resolveId functions and eventually the default resolution behavior\n // https://rollupjs.org/plugin-development/#resolveid\n return resolvedFile || null;\n },\n async writeBundle(options) {\n if (isUsingTsSolutionSetup()) return;\n const outDir = options.dir || 'dist';\n const src = resolve(projectRoot, 'package.json');\n if (existsSync(src)) {\n const dest = join(outDir, 'package.json');\n\n try {\n copyFileSync(src, dest);\n } catch (err) {\n console.error('Error copying package.json:', err);\n }\n }\n },\n } as Plugin;\n\n function getTsConfig(preferredTsConfigPath: string): string {\n return [\n resolve(preferredTsConfigPath),\n resolve(join(workspaceRoot, 'tsconfig.base.json')),\n resolve(join(workspaceRoot, 'tsconfig.json')),\n ].find((tsPath) => {\n if (existsSync(tsPath)) {\n logIt('Found tsconfig at', tsPath);\n return tsPath;\n }\n });\n }\n\n function logIt(...msg: any[]) {\n if (process.env.NX_VERBOSE_LOGGING === 'true' || options?.debug) {\n console.debug('\\n[Nx Vite TsPaths]', ...msg);\n }\n }\n\n function loadFileFromPaths(\n tsconfig: ConfigLoaderSuccessResult,\n importPath: string\n ) {\n logIt(\n `Trying to resolve file from config in ${tsconfig.configFileAbsolutePath}`\n );\n let resolvedFile: string;\n for (const alias in tsconfig.paths) {\n const paths = tsconfig.paths[alias];\n\n const normalizedImport = alias.replace(/\\/\\*$/, '');\n\n if (importPath.startsWith(normalizedImport)) {\n const joinedPath = joinPathFragments(\n tsconfig.absoluteBaseUrl,\n paths[0].replace(/\\/\\*$/, '')\n );\n\n resolvedFile = findFile(\n importPath.replace(normalizedImport, joinedPath)\n );\n }\n }\n\n return resolvedFile;\n }\n\n function findFile(path: string): string {\n for (const ext of options.extensions) {\n // Support file with \".\" in the name.\n let resolvedPath = resolve(path + ext);\n if (existsSync(resolvedPath)) {\n return resolvedPath;\n }\n\n // Support file extensions such as .css and .js in the import path.\n const { dir, name } = parse(path);\n resolvedPath = resolve(dir, name + ext);\n if (existsSync(resolvedPath)) {\n return resolvedPath;\n }\n\n const resolvedIndexPath = resolve(path, `index${ext}`);\n if (existsSync(resolvedIndexPath)) {\n return resolvedIndexPath;\n }\n }\n }\n}\n"],"names":["nxViteTsPaths","options","matchTsPathEsm","matchTsPathFallback","tsConfigPathsEsm","tsConfigPathsFallback","extensions","mainFields","buildLibsFromSource","projectRoot","name","enforce","configResolved","config","root","projectRootFromWorkspaceRoot","relative","workspaceRoot","process","foundTsConfigPath","getTsConfig","join","env","NX_TASK_TARGET_TARGET","Error","stripIndents","global","NX_GRAPH_CREATION","mode","projectGraph","createProjectGraphAsync","exitOnError","resetDaemonClient","dependencies","calculateProjectBuildableDependencies","undefined","NX_TASK_TARGET_PROJECT","NX_TASK_TARGET_CONFIGURATION","createTmpTsConfig","command","buildableLibraryDependencies","filter","dep","node","type","map","buildCommand","plugins","push","nxViteBuildCoordinationPlugin","parsed","loadConfig","logIt","resultType","createMatchPath","absoluteBaseUrl","paths","rootLevelTsConfig","rootLevelParsed","resolveId","importPath","resolvedFile","e","loadFileFromPaths","writeBundle","isUsingTsSolutionSetup","outDir","dir","src","resolve","existsSync","dest","copyFileSync","err","console","error","preferredTsConfigPath","find","tsPath","msg","NX_VERBOSE_LOGGING","debug","tsconfig","configFileAbsolutePath","alias","normalizedImport","replace","startsWith","joinedPath","joinPathFragments","findFile","path","ext","resolvedPath","parse","resolvedIndexPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BAgDgBA;;;eAAAA;;;wBA3CT;wBACkC;0BACM;+BAMxC;oCAIA;+CAEuC;iCACP;AA4BhC,SAASA,cAAcC,UAAgC,CAA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F"}
|
|
1
|
+
{"version":3,"sources":["../../../../packages/vite/plugins/nx-tsconfig-paths.plugin.ts"],"sourcesContent":["import {\n createProjectGraphAsync,\n joinPathFragments,\n stripIndents,\n workspaceRoot,\n} from '@nx/devkit';\nimport { copyFileSync, existsSync } from 'node:fs';\nimport { join, relative, resolve } from 'node:path';\nimport {\n loadConfig,\n createMatchPath,\n MatchPath,\n ConfigLoaderSuccessResult,\n} from 'tsconfig-paths';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { Plugin } from 'vite';\nimport { nxViteBuildCoordinationPlugin } from './nx-vite-build-coordination.plugin';\nimport { findFile } from '../src/utils/nx-tsconfig-paths-find-file';\nimport { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\n\nexport interface nxViteTsPathsOptions {\n /**\n * Enable debug logging\n * @default false\n **/\n debug?: boolean;\n /**\n * export fields in package.json to use for resolving\n * @default [['exports', '.', 'import'], 'module', 'main']\n *\n * fallback resolution will use ['main', 'module']\n **/\n mainFields?: (string | string[])[];\n /**\n * extensions to check when resolving files when package.json resolution fails\n * @default ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs', '.cjs']\n **/\n extensions?: string[];\n /**\n * Inform Nx whether to use the raw source or to use the built output for buildable dependencies.\n * Set to `false` to use incremental builds.\n * @default true\n */\n buildLibsFromSource?: boolean;\n}\n\nexport function nxViteTsPaths(options: nxViteTsPathsOptions = {}) {\n let matchTsPathEsm: MatchPath;\n let matchTsPathFallback: MatchPath | undefined;\n let tsConfigPathsEsm: ConfigLoaderSuccessResult;\n let tsConfigPathsFallback: ConfigLoaderSuccessResult;\n\n options.extensions ??= [\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.json',\n '.mts',\n '.mjs',\n '.cts',\n '.cjs',\n '.css',\n '.scss',\n '.less',\n ];\n options.mainFields ??= [['exports', '.', 'import'], 'module', 'main'];\n options.buildLibsFromSource ??= true;\n let projectRoot = '';\n\n return {\n name: 'nx-vite-ts-paths',\n // Ensure the resolveId aspect of the plugin is called before vite's internal resolver\n // Otherwise, issues can arise with Yarn Workspaces and Pnpm Workspaces\n enforce: 'pre',\n async configResolved(config: any) {\n projectRoot = config.root;\n const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);\n let foundTsConfigPath = getTsConfig(\n join(\n workspaceRoot,\n 'tmp',\n projectRootFromWorkspaceRoot,\n process.env.NX_TASK_TARGET_TARGET ?? 'build',\n 'tsconfig.generated.json'\n )\n );\n if (!foundTsConfigPath) {\n throw new Error(stripIndents`Unable to find a tsconfig in the workspace! \nThere should at least be a tsconfig.base.json or tsconfig.json in the root of the workspace ${workspaceRoot}`);\n }\n\n if (\n !options.buildLibsFromSource &&\n !global.NX_GRAPH_CREATION &&\n config.mode !== 'test'\n ) {\n const projectGraph = await createProjectGraphAsync({\n exitOnError: false,\n resetDaemonClient: true,\n });\n const { dependencies } = calculateProjectBuildableDependencies(\n undefined,\n projectGraph,\n workspaceRoot,\n process.env.NX_TASK_TARGET_PROJECT,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n process.env.NX_TASK_TARGET_TARGET === 'serve'\n ? 'build'\n : process.env.NX_TASK_TARGET_TARGET,\n process.env.NX_TASK_TARGET_CONFIGURATION\n );\n // This tsconfig is used via the Vite ts paths plugin.\n // It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).\n foundTsConfigPath = createTmpTsConfig(\n foundTsConfigPath,\n workspaceRoot,\n relative(workspaceRoot, projectRoot),\n dependencies,\n true\n );\n\n if (config.command === 'serve') {\n const buildableLibraryDependencies = dependencies\n .filter((dep) => dep.node.type === 'lib')\n .map((dep) => dep.node.name)\n .join(',');\n const buildCommand = `npx nx run-many --target=${process.env.NX_TASK_TARGET_TARGET} --projects=${buildableLibraryDependencies}`;\n config.plugins.push(nxViteBuildCoordinationPlugin({ buildCommand }));\n }\n }\n\n const parsed = loadConfig(foundTsConfigPath);\n\n logIt('first parsed tsconfig: ', parsed);\n if (parsed.resultType === 'failed') {\n throw new Error(`Failed loading tsconfig at ${foundTsConfigPath}`);\n }\n tsConfigPathsEsm = parsed;\n\n matchTsPathEsm = createMatchPath(\n parsed.absoluteBaseUrl,\n parsed.paths,\n options.mainFields\n );\n\n const rootLevelTsConfig = getTsConfig(\n join(workspaceRoot, 'tsconfig.base.json')\n );\n const rootLevelParsed = loadConfig(rootLevelTsConfig);\n logIt('fallback parsed tsconfig: ', rootLevelParsed);\n if (rootLevelParsed.resultType === 'success') {\n tsConfigPathsFallback = rootLevelParsed;\n matchTsPathFallback = createMatchPath(\n rootLevelParsed.absoluteBaseUrl,\n rootLevelParsed.paths,\n ['main', 'module']\n );\n }\n },\n resolveId(importPath: string) {\n let resolvedFile: string;\n try {\n resolvedFile = matchTsPathEsm(importPath);\n } catch (e) {\n logIt('Using fallback path matching.');\n resolvedFile = matchTsPathFallback?.(importPath);\n }\n\n if (!resolvedFile) {\n if (tsConfigPathsEsm || tsConfigPathsFallback) {\n logIt(\n `Unable to resolve ${importPath} with tsconfig paths. Using fallback file matching.`\n );\n resolvedFile =\n loadFileFromPaths(tsConfigPathsEsm, importPath) ||\n loadFileFromPaths(tsConfigPathsFallback, importPath);\n } else {\n logIt(`Unable to resolve ${importPath} with tsconfig paths`);\n }\n }\n\n logIt(`Resolved ${importPath} to ${resolvedFile}`);\n // Returning null defers to other resolveId functions and eventually the default resolution behavior\n // https://rollupjs.org/plugin-development/#resolveid\n return resolvedFile || null;\n },\n async writeBundle(options) {\n if (isUsingTsSolutionSetup()) return;\n const outDir = options.dir || 'dist';\n const src = resolve(projectRoot, 'package.json');\n if (existsSync(src)) {\n const dest = join(outDir, 'package.json');\n\n try {\n copyFileSync(src, dest);\n } catch (err) {\n console.error('Error copying package.json:', err);\n }\n }\n },\n } as Plugin;\n\n function getTsConfig(preferredTsConfigPath: string): string {\n return [\n resolve(preferredTsConfigPath),\n resolve(join(workspaceRoot, 'tsconfig.base.json')),\n resolve(join(workspaceRoot, 'tsconfig.json')),\n ].find((tsPath) => {\n if (existsSync(tsPath)) {\n logIt('Found tsconfig at', tsPath);\n return tsPath;\n }\n });\n }\n\n function logIt(...msg: any[]) {\n if (process.env.NX_VERBOSE_LOGGING === 'true' || options?.debug) {\n console.debug('\\n[Nx Vite TsPaths]', ...msg);\n }\n }\n\n function loadFileFromPaths(\n tsconfig: ConfigLoaderSuccessResult,\n importPath: string\n ) {\n logIt(\n `Trying to resolve file from config in ${tsconfig.configFileAbsolutePath}`\n );\n let resolvedFile: string;\n for (const alias in tsconfig.paths) {\n const paths = tsconfig.paths[alias];\n\n const normalizedImport = alias.replace(/\\/\\*$/, '');\n\n if (importPath.startsWith(normalizedImport)) {\n const joinedPath = joinPathFragments(\n tsconfig.absoluteBaseUrl,\n paths[0].replace(/\\/\\*$/, '')\n );\n\n resolvedFile = findFile(\n importPath.replace(normalizedImport, joinedPath),\n options.extensions\n );\n }\n }\n\n return resolvedFile;\n }\n}\n"],"names":["nxViteTsPaths","options","matchTsPathEsm","matchTsPathFallback","tsConfigPathsEsm","tsConfigPathsFallback","extensions","mainFields","buildLibsFromSource","projectRoot","name","enforce","configResolved","config","root","projectRootFromWorkspaceRoot","relative","workspaceRoot","process","foundTsConfigPath","getTsConfig","join","env","NX_TASK_TARGET_TARGET","Error","stripIndents","global","NX_GRAPH_CREATION","mode","projectGraph","createProjectGraphAsync","exitOnError","resetDaemonClient","dependencies","calculateProjectBuildableDependencies","undefined","NX_TASK_TARGET_PROJECT","NX_TASK_TARGET_CONFIGURATION","createTmpTsConfig","command","buildableLibraryDependencies","filter","dep","node","type","map","buildCommand","plugins","push","nxViteBuildCoordinationPlugin","parsed","loadConfig","logIt","resultType","createMatchPath","absoluteBaseUrl","paths","rootLevelTsConfig","rootLevelParsed","resolveId","importPath","resolvedFile","e","loadFileFromPaths","writeBundle","isUsingTsSolutionSetup","outDir","dir","src","resolve","existsSync","dest","copyFileSync","err","console","error","preferredTsConfigPath","find","tsPath","msg","NX_VERBOSE_LOGGING","debug","tsconfig","configFileAbsolutePath","alias","normalizedImport","replace","startsWith","joinedPath","joinPathFragments","findFile"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BAiDgBA;;;eAAAA;;;wBA5CT;wBACkC;0BACD;+BAMjC;oCAIA;+CAEuC;yCACrB;iCACc;AA4BhC,SAASA,cAAcC,UAAgC,CAAC,CAAC;QAM9DA,UAcAA,WACAA;IApBA,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;;IAEJJ,gBAAAA,WAAAA,SAAQK,oCAARL,SAAQK,aAAe;QACrB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;;IACDL,gBAAAA,YAAAA,SAAQM,oCAARN,UAAQM,aAAe;QAAC;YAAC;YAAW;YAAK;SAAS;QAAE;QAAU;KAAO;;IACrEN,yBAAAA,YAAAA,SAAQO,sDAARP,UAAQO,sBAAwB;IAChC,IAAIC,cAAc;IAElB,OAAO;QACLC,MAAM;QACN,sFAAsF;QACtF,uEAAuE;QACvEC,SAAS;QACT,MAAMC,gBAAeC,MAAW;YAC9BJ,cAAcI,OAAOC,IAAI;YACzB,MAAMC,+BAA+BC,IAAAA,kBAAQ,EAACC,qBAAa,EAAER;gBAMzDS;YALJ,IAAIC,oBAAoBC,YACtBC,IAAAA,cAAI,EACFJ,qBAAa,EACb,OACAF,8BACAG,CAAAA,qCAAAA,QAAQI,GAAG,CAACC,qBAAqB,YAAjCL,qCAAqC,SACrC;YAGJ,IAAI,CAACC,mBAAmB;gBACtB,MAAM,IAAIK,MAAMC,IAAAA,oBAAY,CAAA,CAAC;4FACuD,EAAER,qBAAa,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GeneratorSchema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* @param hasPlugin some frameworks (e.g. Nuxt) provide their own plugin. Their generators handle the plugin detection.
|
|
5
|
+
*/
|
|
3
6
|
export declare function vitestGenerator(tree: Tree, schema: VitestGeneratorSchema, hasPlugin?: boolean): Promise<GeneratorCallback>;
|
|
4
7
|
export declare function vitestGeneratorInternal(tree: Tree, schema: VitestGeneratorSchema, hasPlugin?: boolean): Promise<GeneratorCallback>;
|
|
5
8
|
export default vitestGenerator;
|
|
@@ -25,13 +25,13 @@ const _ensuredependencies = require("../../utils/ensure-dependencies");
|
|
|
25
25
|
const _generatorutils = require("../../utils/generator-utils");
|
|
26
26
|
const _versions = require("../../utils/versions");
|
|
27
27
|
const _init = require("../init/init");
|
|
28
|
+
const _detectuiframework = require("../../utils/detect-ui-framework");
|
|
28
29
|
function vitestGenerator(tree, schema, hasPlugin = false) {
|
|
29
30
|
return vitestGeneratorInternal(tree, _extends._({
|
|
30
31
|
addPlugin: false
|
|
31
32
|
}, schema), hasPlugin);
|
|
32
33
|
}
|
|
33
34
|
async function vitestGeneratorInternal(tree, schema, hasPlugin = false) {
|
|
34
|
-
var _nxJson_plugins;
|
|
35
35
|
var // Setting default to jsdom since it is the most common use case (React, Web).
|
|
36
36
|
// The @nx/js:lib generator specifically sets this to node to be more generic.
|
|
37
37
|
_schema;
|
|
@@ -41,6 +41,8 @@ async function vitestGeneratorInternal(tree, schema, hasPlugin = false) {
|
|
|
41
41
|
const { root, projectType: _projectType } = (0, _devkit.readProjectConfiguration)(tree, schema.project);
|
|
42
42
|
var _schema_projectType;
|
|
43
43
|
const projectType = (_schema_projectType = schema.projectType) != null ? _schema_projectType : _projectType;
|
|
44
|
+
var _schema_uiFramework;
|
|
45
|
+
const uiFramework = (_schema_uiFramework = schema.uiFramework) != null ? _schema_uiFramework : await (0, _detectuiframework.detectUiFramework)(schema.project);
|
|
44
46
|
const isRootProject = root === '.';
|
|
45
47
|
tasks.push(await (0, _js.initGenerator)(tree, _extends._({}, schema, {
|
|
46
48
|
skipFormat: true
|
|
@@ -50,16 +52,44 @@ async function vitestGeneratorInternal(tree, schema, hasPlugin = false) {
|
|
|
50
52
|
addPlugin: schema.addPlugin
|
|
51
53
|
});
|
|
52
54
|
tasks.push(initTask);
|
|
53
|
-
tasks.push((0, _ensuredependencies.ensureDependencies)(tree, schema
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var _schema_testTarget;
|
|
58
|
-
const testTarget = (_schema_testTarget = schema.testTarget) != null ? _schema_testTarget : 'test';
|
|
59
|
-
(0, _generatorutils.addOrChangeTestTarget)(tree, schema, testTarget);
|
|
60
|
-
}
|
|
55
|
+
tasks.push((0, _ensuredependencies.ensureDependencies)(tree, _extends._({}, schema, {
|
|
56
|
+
uiFramework
|
|
57
|
+
})));
|
|
58
|
+
(0, _generatorutils.addOrChangeTestTarget)(tree, schema, hasPlugin);
|
|
61
59
|
if (!schema.skipViteConfig) {
|
|
62
|
-
if (
|
|
60
|
+
if (uiFramework === 'angular') {
|
|
61
|
+
const relativeTestSetupPath = (0, _devkit.joinPathFragments)('src', 'test-setup.ts');
|
|
62
|
+
const setupFile = (0, _devkit.joinPathFragments)(root, relativeTestSetupPath);
|
|
63
|
+
if (!tree.exists(setupFile)) {
|
|
64
|
+
tree.write(setupFile, `import '@analogjs/vitest-angular/setup-zone';
|
|
65
|
+
|
|
66
|
+
import {
|
|
67
|
+
BrowserDynamicTestingModule,
|
|
68
|
+
platformBrowserDynamicTesting,
|
|
69
|
+
} from '@angular/platform-browser-dynamic/testing';
|
|
70
|
+
import { getTestBed } from '@angular/core/testing';
|
|
71
|
+
|
|
72
|
+
getTestBed().initTestEnvironment(
|
|
73
|
+
BrowserDynamicTestingModule,
|
|
74
|
+
platformBrowserDynamicTesting()
|
|
75
|
+
);
|
|
76
|
+
`);
|
|
77
|
+
}
|
|
78
|
+
(0, _generatorutils.createOrEditViteConfig)(tree, {
|
|
79
|
+
project: schema.project,
|
|
80
|
+
includeLib: false,
|
|
81
|
+
includeVitest: true,
|
|
82
|
+
inSourceTests: false,
|
|
83
|
+
imports: [
|
|
84
|
+
`import angular from '@analogjs/vite-plugin-angular'`
|
|
85
|
+
],
|
|
86
|
+
plugins: [
|
|
87
|
+
'angular()'
|
|
88
|
+
],
|
|
89
|
+
setupFile: relativeTestSetupPath,
|
|
90
|
+
useEsmExtension: true
|
|
91
|
+
}, true);
|
|
92
|
+
} else if (uiFramework === 'react') {
|
|
63
93
|
(0, _generatorutils.createOrEditViteConfig)(tree, {
|
|
64
94
|
project: schema.project,
|
|
65
95
|
includeLib: projectType === 'library',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/generators/vitest/vitest-generator.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n formatFiles,\n generateFiles,\n GeneratorCallback,\n joinPathFragments,\n logger,\n offsetFromRoot,\n ProjectType,\n readNxJson,\n readProjectConfiguration,\n runTasksInSerial,\n Tree,\n updateJson,\n} from '@nx/devkit';\nimport { initGenerator as jsInitGenerator } from '@nx/js';\nimport { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\nimport { join } from 'path';\nimport { ensureDependencies } from '../../utils/ensure-dependencies';\nimport {\n addOrChangeTestTarget,\n createOrEditViteConfig,\n} from '../../utils/generator-utils';\nimport {\n vitestCoverageIstanbulVersion,\n vitestCoverageV8Version,\n} from '../../utils/versions';\nimport initGenerator from '../init/init';\nimport { VitestGeneratorSchema } from './schema';\n\nexport function vitestGenerator(\n tree: Tree,\n schema: VitestGeneratorSchema,\n hasPlugin = false\n) {\n return vitestGeneratorInternal(\n tree,\n { addPlugin: false, ...schema },\n hasPlugin\n );\n}\n\nexport async function vitestGeneratorInternal(\n tree: Tree,\n schema: VitestGeneratorSchema,\n hasPlugin = false\n) {\n // Setting default to jsdom since it is the most common use case (React, Web).\n // The @nx/js:lib generator specifically sets this to node to be more generic.\n schema.testEnvironment ??= 'jsdom';\n\n const tasks: GeneratorCallback[] = [];\n\n const { root, projectType: _projectType } = readProjectConfiguration(\n tree,\n schema.project\n );\n const projectType = schema.projectType ?? _projectType;\n const isRootProject = root === '.';\n\n tasks.push(await jsInitGenerator(tree, { ...schema, skipFormat: true }));\n const initTask = await initGenerator(tree, {\n skipFormat: true,\n addPlugin: schema.addPlugin,\n });\n tasks.push(initTask);\n tasks.push(ensureDependencies(tree, schema));\n\n const nxJson = readNxJson(tree);\n const hasPluginCheck = nxJson.plugins?.some(\n (p) =>\n (typeof p === 'string'\n ? p === '@nx/vite/plugin'\n : p.plugin === '@nx/vite/plugin') || hasPlugin\n );\n if (!hasPluginCheck) {\n const testTarget = schema.testTarget ?? 'test';\n addOrChangeTestTarget(tree, schema, testTarget);\n }\n\n if (!schema.skipViteConfig) {\n if (schema.uiFramework === 'react') {\n createOrEditViteConfig(\n tree,\n {\n project: schema.project,\n includeLib: projectType === 'library',\n includeVitest: true,\n inSourceTests: schema.inSourceTests,\n rollupOptionsExternal: [\n \"'react'\",\n \"'react-dom'\",\n \"'react/jsx-runtime'\",\n ],\n imports: [\n schema.compiler === 'swc'\n ? `import react from '@vitejs/plugin-react-swc'`\n : `import react from '@vitejs/plugin-react'`,\n ],\n plugins: ['react()'],\n coverageProvider: schema.coverageProvider,\n },\n true\n );\n } else {\n createOrEditViteConfig(\n tree,\n {\n ...schema,\n includeVitest: true,\n includeLib: projectType === 'library',\n },\n true\n );\n }\n }\n\n createFiles(tree, schema, root);\n updateTsConfig(tree, schema, root, projectType);\n\n const coverageProviderDependency = getCoverageProviderDependency(\n schema.coverageProvider\n );\n\n const installCoverageProviderTask = addDependenciesToPackageJson(\n tree,\n {},\n coverageProviderDependency\n );\n tasks.push(installCoverageProviderTask);\n\n // Setup workspace config file (https://vitest.dev/guide/workspace.html)\n if (\n !isRootProject &&\n !tree.exists(`vitest.workspace.ts`) &&\n !tree.exists(`vitest.workspace.js`) &&\n !tree.exists(`vitest.workspace.json`) &&\n !tree.exists(`vitest.projects.ts`) &&\n !tree.exists(`vitest.projects.js`) &&\n !tree.exists(`vitest.projects.json`)\n ) {\n tree.write(\n 'vitest.workspace.ts',\n `export default ['**/*/vite.config.{ts,mts}', '**/*/vitest.config.{ts,mts}'];`\n );\n }\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n\n return runTasksInSerial(...tasks);\n}\n\nfunction updateTsConfig(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string,\n projectType: ProjectType\n) {\n const setupFile = tryFindSetupFile(tree, projectRoot);\n\n if (tree.exists(joinPathFragments(projectRoot, 'tsconfig.spec.json'))) {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.spec.json'),\n (json) => {\n if (!json.compilerOptions?.types?.includes('vitest')) {\n if (json.compilerOptions?.types) {\n json.compilerOptions.types.push('vitest');\n } else {\n json.compilerOptions ??= {};\n json.compilerOptions.types = ['vitest'];\n }\n }\n\n if (setupFile) {\n json.files = [...(json.files ?? []), setupFile];\n }\n\n return json;\n }\n );\n\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.json'),\n (json) => {\n if (\n json.references &&\n !json.references.some((r) => r.path === './tsconfig.spec.json')\n ) {\n json.references.push({\n path: './tsconfig.spec.json',\n });\n }\n return json;\n }\n );\n } else {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.json'),\n (json) => {\n if (!json.compilerOptions?.types?.includes('vitest')) {\n if (json.compilerOptions?.types) {\n json.compilerOptions.types.push('vitest');\n } else {\n json.compilerOptions ??= {};\n json.compilerOptions.types = ['vitest'];\n }\n }\n return json;\n }\n );\n }\n\n let runtimeTsconfigPath = joinPathFragments(\n projectRoot,\n projectType === 'application' ? 'tsconfig.app.json' : 'tsconfig.lib.json'\n );\n if (options.runtimeTsconfigFileName) {\n runtimeTsconfigPath = joinPathFragments(\n projectRoot,\n options.runtimeTsconfigFileName\n );\n if (!tree.exists(runtimeTsconfigPath)) {\n throw new Error(\n `Cannot find the specified runtimeTsConfigFileName (\"${options.runtimeTsconfigFileName}\") at the project root \"${projectRoot}\".`\n );\n }\n }\n\n if (tree.exists(runtimeTsconfigPath)) {\n updateJson(tree, runtimeTsconfigPath, (json) => {\n if (options.inSourceTests) {\n (json.compilerOptions.types ??= []).push('vitest/importMeta');\n } else {\n const uniqueExclude = new Set([\n ...(json.exclude || []),\n 'vite.config.ts',\n 'vite.config.mts',\n 'vitest.config.ts',\n 'vitest.config.mts',\n 'src/**/*.test.ts',\n 'src/**/*.spec.ts',\n 'src/**/*.test.tsx',\n 'src/**/*.spec.tsx',\n 'src/**/*.test.js',\n 'src/**/*.spec.js',\n 'src/**/*.test.jsx',\n 'src/**/*.spec.jsx',\n ]);\n json.exclude = [...uniqueExclude];\n }\n\n if (setupFile) {\n json.exclude = [...(json.exclude ?? []), setupFile];\n }\n\n return json;\n });\n } else {\n logger.warn(\n `Couldn't find a runtime tsconfig file at ${runtimeTsconfigPath} to exclude the test files from. ` +\n `If you're using a different filename for your runtime tsconfig, please provide it with the '--runtimeTsconfigFileName' flag.`\n );\n }\n}\n\nfunction createFiles(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string\n) {\n const isTsSolutionSetup = isUsingTsSolutionSetup(tree);\n const rootOffset = offsetFromRoot(projectRoot);\n\n generateFiles(tree, join(__dirname, 'files'), projectRoot, {\n tmpl: '',\n ...options,\n projectRoot,\n extendedConfig: isTsSolutionSetup\n ? `${rootOffset}tsconfig.base.json`\n : './tsconfig.json',\n outDir: isTsSolutionSetup\n ? `./out-tsc/vitest`\n : `${rootOffset}dist/out-tsc`,\n });\n}\n\nfunction getCoverageProviderDependency(\n coverageProvider: VitestGeneratorSchema['coverageProvider']\n) {\n switch (coverageProvider) {\n case 'v8':\n return {\n '@vitest/coverage-v8': vitestCoverageV8Version,\n };\n case 'istanbul':\n return {\n '@vitest/coverage-istanbul': vitestCoverageIstanbulVersion,\n };\n default:\n return {\n '@vitest/coverage-v8': vitestCoverageV8Version,\n };\n }\n}\n\nfunction tryFindSetupFile(tree: Tree, projectRoot: string) {\n const setupFile = joinPathFragments('src', 'test-setup.ts');\n if (tree.exists(joinPathFragments(projectRoot, setupFile))) {\n return setupFile;\n }\n}\n\nexport default vitestGenerator;\n"],"names":["vitestGenerator","vitestGeneratorInternal","tree","schema","hasPlugin","addPlugin","nxJson","testEnvironment","tasks","root","projectType","_projectType","readProjectConfiguration","project","isRootProject","push","jsInitGenerator","skipFormat","initTask","initGenerator","ensureDependencies","readNxJson","hasPluginCheck","plugins","some","p","plugin","testTarget","addOrChangeTestTarget","skipViteConfig","uiFramework","createOrEditViteConfig","includeLib","includeVitest","inSourceTests","rollupOptionsExternal","imports","compiler","coverageProvider","createFiles","updateTsConfig","coverageProviderDependency","getCoverageProviderDependency","installCoverageProviderTask","addDependenciesToPackageJson","exists","write","formatFiles","runTasksInSerial","options","projectRoot","setupFile","tryFindSetupFile","joinPathFragments","updateJson","json","compilerOptions","types","includes","files","references","r","path","runtimeTsconfigPath","runtimeTsconfigFileName","Error","uniqueExclude","Set","exclude","logger","warn","isTsSolutionSetup","isUsingTsSolutionSetup","rootOffset","offsetFromRoot","generateFiles","join","__dirname","tmpl","extendedConfig","outDir","vitestCoverageV8Version","vitestCoverageIstanbulVersion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IA6TA,OAA+B;eAA/B;;IA/RgBA,eAAe;eAAfA;;IAYMC,uBAAuB;eAAvBA;;;;wBA5Bf;oBAC0C;iCACV;sBAClB;oCACc;gCAI5B;0BAIA;sBACmB;AA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WAAW;oBACOI;gBAApBA,KAAKa,OAAO,GAAG;uBAAKb,CAAAA,gBAAAA,KAAKa,OAAO,YAAZb,gBAAgB,EAAE;oBAAGJ;iBAAU;YACrD;YAEA,OAAOI;QACT;IACF,OAAO;QACLc,cAAM,CAACC,IAAI,CACT,CAAC,yCAAyC,EAAEP,oBAAoB,iCAAiC,CAAC,GAChG,CAAC,4HAA4H,CAAC;IAEpI;AACF;AAEA,SAASxB,YACPrC,IAAU,EACV+C,OAA8B,EAC9BC,WAAmB;IAEnB,MAAMqB,oBAAoBC,IAAAA,uCAAsB,EAACtE;IACjD,MAAMuE,aAAaC,IAAAA,sBAAc,EAACxB;IAElCyB,IAAAA,qBAAa,EAACzE,MAAM0E,IAAAA,UAAI,EAACC,WAAW,UAAU3B,aAAa;QACzD4B,MAAM;OACH7B;QACHC;QACA6B,gBAAgBR,oBACZ,CAAC,EAAEE,WAAW,kBAAkB,CAAC,GACjC;QACJO,QAAQT,oBACJ,CAAC,gBAAgB,CAAC,GAClB,CAAC,EAAEE,WAAW,YAAY,CAAC;;AAEnC;AAEA,SAAS/B,8BACPJ,gBAA2D;IAE3D,OAAQA;QACN,KAAK;YACH,OAAO;gBACL,uBAAuB2C,iCAAuB;YAChD;QACF,KAAK;YACH,OAAO;gBACL,6BAA6BC,uCAA6B;YAC5D;QACF;YACE,OAAO;gBACL,uBAAuBD,iCAAuB;YAChD;IACJ;AACF;AAEA,SAAS7B,iBAAiBlD,IAAU,EAAEgD,WAAmB;IACvD,MAAMC,YAAYE,IAAAA,yBAAiB,EAAC,OAAO;IAC3C,IAAInD,KAAK2C,MAAM,CAACQ,IAAAA,yBAAiB,EAACH,aAAaC,aAAa;QAC1D,OAAOA;IACT;AACF;MAEA,WAAenD"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/generators/vitest/vitest-generator.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n formatFiles,\n generateFiles,\n GeneratorCallback,\n joinPathFragments,\n logger,\n offsetFromRoot,\n ProjectType,\n readNxJson,\n readProjectConfiguration,\n runTasksInSerial,\n Tree,\n updateJson,\n} from '@nx/devkit';\nimport { initGenerator as jsInitGenerator } from '@nx/js';\nimport { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\nimport { join } from 'path';\nimport { ensureDependencies } from '../../utils/ensure-dependencies';\nimport {\n addOrChangeTestTarget,\n createOrEditViteConfig,\n} from '../../utils/generator-utils';\nimport {\n vitestCoverageIstanbulVersion,\n vitestCoverageV8Version,\n} from '../../utils/versions';\nimport initGenerator from '../init/init';\nimport { VitestGeneratorSchema } from './schema';\nimport { detectUiFramework } from '../../utils/detect-ui-framework';\n\n/**\n * @param hasPlugin some frameworks (e.g. Nuxt) provide their own plugin. Their generators handle the plugin detection.\n */\nexport function vitestGenerator(\n tree: Tree,\n schema: VitestGeneratorSchema,\n hasPlugin = false\n) {\n return vitestGeneratorInternal(\n tree,\n { addPlugin: false, ...schema },\n hasPlugin\n );\n}\n\nexport async function vitestGeneratorInternal(\n tree: Tree,\n schema: VitestGeneratorSchema,\n hasPlugin = false\n) {\n // Setting default to jsdom since it is the most common use case (React, Web).\n // The @nx/js:lib generator specifically sets this to node to be more generic.\n schema.testEnvironment ??= 'jsdom';\n\n const tasks: GeneratorCallback[] = [];\n\n const { root, projectType: _projectType } = readProjectConfiguration(\n tree,\n schema.project\n );\n const projectType = schema.projectType ?? _projectType;\n const uiFramework =\n schema.uiFramework ?? (await detectUiFramework(schema.project));\n const isRootProject = root === '.';\n\n tasks.push(await jsInitGenerator(tree, { ...schema, skipFormat: true }));\n const initTask = await initGenerator(tree, {\n skipFormat: true,\n addPlugin: schema.addPlugin,\n });\n tasks.push(initTask);\n tasks.push(ensureDependencies(tree, { ...schema, uiFramework }));\n\n addOrChangeTestTarget(tree, schema, hasPlugin);\n\n if (!schema.skipViteConfig) {\n if (uiFramework === 'angular') {\n const relativeTestSetupPath = joinPathFragments('src', 'test-setup.ts');\n\n const setupFile = joinPathFragments(root, relativeTestSetupPath);\n if (!tree.exists(setupFile)) {\n tree.write(\n setupFile,\n `import '@analogjs/vitest-angular/setup-zone';\n\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting,\n} from '@angular/platform-browser-dynamic/testing';\nimport { getTestBed } from '@angular/core/testing';\n\ngetTestBed().initTestEnvironment(\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting()\n);\n`\n );\n }\n\n createOrEditViteConfig(\n tree,\n {\n project: schema.project,\n includeLib: false,\n includeVitest: true,\n inSourceTests: false,\n imports: [`import angular from '@analogjs/vite-plugin-angular'`],\n plugins: ['angular()'],\n setupFile: relativeTestSetupPath,\n useEsmExtension: true,\n },\n true\n );\n } else if (uiFramework === 'react') {\n createOrEditViteConfig(\n tree,\n {\n project: schema.project,\n includeLib: projectType === 'library',\n includeVitest: true,\n inSourceTests: schema.inSourceTests,\n rollupOptionsExternal: [\n \"'react'\",\n \"'react-dom'\",\n \"'react/jsx-runtime'\",\n ],\n imports: [\n schema.compiler === 'swc'\n ? `import react from '@vitejs/plugin-react-swc'`\n : `import react from '@vitejs/plugin-react'`,\n ],\n plugins: ['react()'],\n coverageProvider: schema.coverageProvider,\n },\n true\n );\n } else {\n createOrEditViteConfig(\n tree,\n {\n ...schema,\n includeVitest: true,\n includeLib: projectType === 'library',\n },\n true\n );\n }\n }\n\n createFiles(tree, schema, root);\n updateTsConfig(tree, schema, root, projectType);\n\n const coverageProviderDependency = getCoverageProviderDependency(\n schema.coverageProvider\n );\n\n const installCoverageProviderTask = addDependenciesToPackageJson(\n tree,\n {},\n coverageProviderDependency\n );\n tasks.push(installCoverageProviderTask);\n\n // Setup workspace config file (https://vitest.dev/guide/workspace.html)\n if (\n !isRootProject &&\n !tree.exists(`vitest.workspace.ts`) &&\n !tree.exists(`vitest.workspace.js`) &&\n !tree.exists(`vitest.workspace.json`) &&\n !tree.exists(`vitest.projects.ts`) &&\n !tree.exists(`vitest.projects.js`) &&\n !tree.exists(`vitest.projects.json`)\n ) {\n tree.write(\n 'vitest.workspace.ts',\n `export default ['**/*/vite.config.{ts,mts}', '**/*/vitest.config.{ts,mts}'];`\n );\n }\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n\n return runTasksInSerial(...tasks);\n}\n\nfunction updateTsConfig(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string,\n projectType: ProjectType\n) {\n const setupFile = tryFindSetupFile(tree, projectRoot);\n\n if (tree.exists(joinPathFragments(projectRoot, 'tsconfig.spec.json'))) {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.spec.json'),\n (json) => {\n if (!json.compilerOptions?.types?.includes('vitest')) {\n if (json.compilerOptions?.types) {\n json.compilerOptions.types.push('vitest');\n } else {\n json.compilerOptions ??= {};\n json.compilerOptions.types = ['vitest'];\n }\n }\n\n if (setupFile) {\n json.files = [...(json.files ?? []), setupFile];\n }\n\n return json;\n }\n );\n\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.json'),\n (json) => {\n if (\n json.references &&\n !json.references.some((r) => r.path === './tsconfig.spec.json')\n ) {\n json.references.push({\n path: './tsconfig.spec.json',\n });\n }\n return json;\n }\n );\n } else {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.json'),\n (json) => {\n if (!json.compilerOptions?.types?.includes('vitest')) {\n if (json.compilerOptions?.types) {\n json.compilerOptions.types.push('vitest');\n } else {\n json.compilerOptions ??= {};\n json.compilerOptions.types = ['vitest'];\n }\n }\n return json;\n }\n );\n }\n\n let runtimeTsconfigPath = joinPathFragments(\n projectRoot,\n projectType === 'application' ? 'tsconfig.app.json' : 'tsconfig.lib.json'\n );\n if (options.runtimeTsconfigFileName) {\n runtimeTsconfigPath = joinPathFragments(\n projectRoot,\n options.runtimeTsconfigFileName\n );\n if (!tree.exists(runtimeTsconfigPath)) {\n throw new Error(\n `Cannot find the specified runtimeTsConfigFileName (\"${options.runtimeTsconfigFileName}\") at the project root \"${projectRoot}\".`\n );\n }\n }\n\n if (tree.exists(runtimeTsconfigPath)) {\n updateJson(tree, runtimeTsconfigPath, (json) => {\n if (options.inSourceTests) {\n (json.compilerOptions.types ??= []).push('vitest/importMeta');\n } else {\n const uniqueExclude = new Set([\n ...(json.exclude || []),\n 'vite.config.ts',\n 'vite.config.mts',\n 'vitest.config.ts',\n 'vitest.config.mts',\n 'src/**/*.test.ts',\n 'src/**/*.spec.ts',\n 'src/**/*.test.tsx',\n 'src/**/*.spec.tsx',\n 'src/**/*.test.js',\n 'src/**/*.spec.js',\n 'src/**/*.test.jsx',\n 'src/**/*.spec.jsx',\n ]);\n json.exclude = [...uniqueExclude];\n }\n\n if (setupFile) {\n json.exclude = [...(json.exclude ?? []), setupFile];\n }\n\n return json;\n });\n } else {\n logger.warn(\n `Couldn't find a runtime tsconfig file at ${runtimeTsconfigPath} to exclude the test files from. ` +\n `If you're using a different filename for your runtime tsconfig, please provide it with the '--runtimeTsconfigFileName' flag.`\n );\n }\n}\n\nfunction createFiles(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string\n) {\n const isTsSolutionSetup = isUsingTsSolutionSetup(tree);\n const rootOffset = offsetFromRoot(projectRoot);\n\n generateFiles(tree, join(__dirname, 'files'), projectRoot, {\n tmpl: '',\n ...options,\n projectRoot,\n extendedConfig: isTsSolutionSetup\n ? `${rootOffset}tsconfig.base.json`\n : './tsconfig.json',\n outDir: isTsSolutionSetup\n ? `./out-tsc/vitest`\n : `${rootOffset}dist/out-tsc`,\n });\n}\n\nfunction getCoverageProviderDependency(\n coverageProvider: VitestGeneratorSchema['coverageProvider']\n) {\n switch (coverageProvider) {\n case 'v8':\n return {\n '@vitest/coverage-v8': vitestCoverageV8Version,\n };\n case 'istanbul':\n return {\n '@vitest/coverage-istanbul': vitestCoverageIstanbulVersion,\n };\n default:\n return {\n '@vitest/coverage-v8': vitestCoverageV8Version,\n };\n }\n}\n\nfunction tryFindSetupFile(tree: Tree, projectRoot: string) {\n const setupFile = joinPathFragments('src', 'test-setup.ts');\n if (tree.exists(joinPathFragments(projectRoot, setupFile))) {\n return setupFile;\n }\n}\n\nexport default vitestGenerator;\n"],"names":["vitestGenerator","vitestGeneratorInternal","tree","schema","hasPlugin","addPlugin","testEnvironment","tasks","root","projectType","_projectType","readProjectConfiguration","project","uiFramework","detectUiFramework","isRootProject","push","jsInitGenerator","skipFormat","initTask","initGenerator","ensureDependencies","addOrChangeTestTarget","skipViteConfig","relativeTestSetupPath","joinPathFragments","setupFile","exists","write","createOrEditViteConfig","includeLib","includeVitest","inSourceTests","imports","plugins","useEsmExtension","rollupOptionsExternal","compiler","coverageProvider","createFiles","updateTsConfig","coverageProviderDependency","getCoverageProviderDependency","installCoverageProviderTask","addDependenciesToPackageJson","formatFiles","runTasksInSerial","options","projectRoot","tryFindSetupFile","updateJson","json","compilerOptions","types","includes","files","references","some","r","path","runtimeTsconfigPath","runtimeTsconfigFileName","Error","uniqueExclude","Set","exclude","logger","warn","isTsSolutionSetup","isUsingTsSolutionSetup","rootOffset","offsetFromRoot","generateFiles","join","__dirname","tmpl","extendedConfig","outDir","vitestCoverageV8Version","vitestCoverageIstanbulVersion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IA8VA,OAA+B;eAA/B;;IA5TgBA,eAAe;eAAfA;;IAYMC,uBAAuB;eAAvBA;;;;wBAhCf;oBAC0C;iCACV;sBAClB;oCACc;gCAI5B;0BAIA;sBACmB;mCAEQ;AAK3B,SAASD,gBACdE,IAAU,EACVC,MAA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AAAA,yBAAiB,EAACuB,aAAatB,aAAa;QAC1D,OAAOA;IACT;AACF;MAEA,WAAe1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectUiFramework(project: string): Promise<'angular' | 'react' | 'none'>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "detectUiFramework", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: function() {
|
|
5
|
+
return detectUiFramework;
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const _devkit = require("@nx/devkit");
|
|
9
|
+
const ANGULAR_NPM_SCOPE = 'angular';
|
|
10
|
+
const ANGULAR_DEPS = [
|
|
11
|
+
'@nx/angular'
|
|
12
|
+
];
|
|
13
|
+
const REACT_DEPS = [
|
|
14
|
+
'react',
|
|
15
|
+
'@nx/react'
|
|
16
|
+
];
|
|
17
|
+
async function detectUiFramework(project) {
|
|
18
|
+
const graph = await (0, _devkit.createProjectGraphAsync)();
|
|
19
|
+
var _graph_dependencies_project;
|
|
20
|
+
for (const dep of (_graph_dependencies_project = graph.dependencies[project]) != null ? _graph_dependencies_project : []){
|
|
21
|
+
if (dep.source !== project || !dep.target.startsWith('npm:')) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const npmDependency = dep.target.replace('npm:', '');
|
|
25
|
+
if (dep.target.startsWith(`npm:@${ANGULAR_NPM_SCOPE}/`) || ANGULAR_DEPS.includes(npmDependency)) {
|
|
26
|
+
return 'angular';
|
|
27
|
+
}
|
|
28
|
+
if (REACT_DEPS.includes(npmDependency)) {
|
|
29
|
+
return 'react';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return 'none';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=detect-ui-framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/detect-ui-framework.ts"],"sourcesContent":["import { createProjectGraphAsync } from '@nx/devkit';\n\nconst ANGULAR_NPM_SCOPE = 'angular';\nconst ANGULAR_DEPS = ['@nx/angular'];\nconst REACT_DEPS = ['react', '@nx/react'];\n\nexport async function detectUiFramework(\n project: string\n): Promise<'angular' | 'react' | 'none'> {\n const graph = await createProjectGraphAsync();\n\n for (const dep of graph.dependencies[project] ?? []) {\n if (dep.source !== project || !dep.target.startsWith('npm:')) {\n continue;\n }\n\n const npmDependency = dep.target.replace('npm:', '');\n\n if (\n dep.target.startsWith(`npm:@${ANGULAR_NPM_SCOPE}/`) ||\n ANGULAR_DEPS.includes(npmDependency)\n ) {\n return 'angular';\n }\n\n if (REACT_DEPS.includes(npmDependency)) {\n return 'react';\n }\n }\n\n return 'none';\n}\n"],"names":["detectUiFramework","ANGULAR_NPM_SCOPE","ANGULAR_DEPS","REACT_DEPS","project","graph","createProjectGraphAsync","dep","dependencies","source","target","startsWith","npmDependency","replace","includes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BAMsBA;;;eAAAA;;;wBANkB;AAExC,MAAMC,oBAAoB;AAC1B,MAAMC,eAAe;IAAC;CAAc;AACpC,MAAMC,aAAa;IAAC;IAAS;CAAY;AAElC,eAAeH,kBACpBI,OAAe;IAEf,MAAMC,QAAQ,MAAMC,IAAAA,+BAAuB;QAEzBD;IAAlB,KAAK,MAAME,OAAOF,CAAAA,8BAAAA,MAAMG,YAAY,CAACJ,QAAQ,YAA3BC,8BAA+B,EAAE,CAAE;QACnD,IAAIE,IAAIE,MAAM,KAAKL,WAAW,CAACG,IAAIG,MAAM,CAACC,UAAU,CAAC,SAAS;YAC5D;QACF;QAEA,MAAMC,gBAAgBL,IAAIG,MAAM,CAACG,OAAO,CAAC,QAAQ;QAEjD,IACEN,IAAIG,MAAM,CAACC,UAAU,CAAC,CAAC,KAAK,EAAEV,kBAAkB,CAAC,CAAC,KAClDC,aAAaY,QAAQ,CAACF,gBACtB;YACA,OAAO;QACT;QAEA,IAAIT,WAAWW,QAAQ,CAACF,gBAAgB;YACtC,OAAO;QACT;IACF;IAEA,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
2
|
export type EnsureDependenciesOptions = {
|
|
3
|
-
uiFramework: 'react' | 'none';
|
|
3
|
+
uiFramework: 'angular' | 'react' | 'none';
|
|
4
4
|
compiler?: 'babel' | 'swc';
|
|
5
5
|
includeLib?: boolean;
|
|
6
6
|
testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;
|
|
@@ -18,6 +18,10 @@ function ensureDependencies(host, schema) {
|
|
|
18
18
|
} else if (schema.testEnvironment !== 'node' && schema.testEnvironment) {
|
|
19
19
|
_devkit.logger.info(`A custom environment was provided: ${schema.testEnvironment}. You need to install it manually.`);
|
|
20
20
|
}
|
|
21
|
+
if (schema.uiFramework === 'angular') {
|
|
22
|
+
devDependencies['@analogjs/vitest-angular'] = _versions.analogVitestAngular;
|
|
23
|
+
devDependencies['@analogjs/vite-plugin-angular'] = _versions.analogVitestAngular;
|
|
24
|
+
}
|
|
21
25
|
if (schema.uiFramework === 'react') {
|
|
22
26
|
if (schema.compiler === 'swc') {
|
|
23
27
|
devDependencies['@vitejs/plugin-react-swc'] = _versions.vitePluginReactSwcVersion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/ensure-dependencies.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n logger,\n type GeneratorCallback,\n type Tree,\n} from '@nx/devkit';\nimport {\n edgeRuntimeVmVersion,\n happyDomVersion,\n jsdomVersion,\n vitePluginDtsVersion,\n vitePluginReactSwcVersion,\n vitePluginReactVersion,\n} from './versions';\n\nexport type EnsureDependenciesOptions = {\n uiFramework: 'react' | 'none';\n compiler?: 'babel' | 'swc';\n includeLib?: boolean;\n testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;\n};\n\nexport function ensureDependencies(\n host: Tree,\n schema: EnsureDependenciesOptions\n): GeneratorCallback {\n const devDependencies: Record<string, string> = {};\n\n if (schema.testEnvironment === 'jsdom') {\n devDependencies['jsdom'] = jsdomVersion;\n } else if (schema.testEnvironment === 'happy-dom') {\n devDependencies['happy-dom'] = happyDomVersion;\n } else if (schema.testEnvironment === 'edge-runtime') {\n devDependencies['@edge-runtime/vm'] = edgeRuntimeVmVersion;\n } else if (schema.testEnvironment !== 'node' && schema.testEnvironment) {\n logger.info(\n `A custom environment was provided: ${schema.testEnvironment}. You need to install it manually.`\n );\n }\n\n if (schema.uiFramework === 'react') {\n if (schema.compiler === 'swc') {\n devDependencies['@vitejs/plugin-react-swc'] = vitePluginReactSwcVersion;\n } else {\n devDependencies['@vitejs/plugin-react'] = vitePluginReactVersion;\n }\n }\n\n if (schema.includeLib) {\n devDependencies['vite-plugin-dts'] = vitePluginDtsVersion;\n }\n\n return addDependenciesToPackageJson(host, {}, devDependencies);\n}\n"],"names":["ensureDependencies","host","schema","devDependencies","testEnvironment","jsdomVersion","happyDomVersion","edgeRuntimeVmVersion","logger","info","uiFramework","compiler","vitePluginReactSwcVersion","vitePluginReactVersion","includeLib","vitePluginDtsVersion","addDependenciesToPackageJson"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/ensure-dependencies.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n logger,\n type GeneratorCallback,\n type Tree,\n} from '@nx/devkit';\nimport {\n analogVitestAngular,\n edgeRuntimeVmVersion,\n happyDomVersion,\n jsdomVersion,\n vitePluginDtsVersion,\n vitePluginReactSwcVersion,\n vitePluginReactVersion,\n} from './versions';\n\nexport type EnsureDependenciesOptions = {\n uiFramework: 'angular' | 'react' | 'none';\n compiler?: 'babel' | 'swc';\n includeLib?: boolean;\n testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;\n};\n\nexport function ensureDependencies(\n host: Tree,\n schema: EnsureDependenciesOptions\n): GeneratorCallback {\n const devDependencies: Record<string, string> = {};\n\n if (schema.testEnvironment === 'jsdom') {\n devDependencies['jsdom'] = jsdomVersion;\n } else if (schema.testEnvironment === 'happy-dom') {\n devDependencies['happy-dom'] = happyDomVersion;\n } else if (schema.testEnvironment === 'edge-runtime') {\n devDependencies['@edge-runtime/vm'] = edgeRuntimeVmVersion;\n } else if (schema.testEnvironment !== 'node' && schema.testEnvironment) {\n logger.info(\n `A custom environment was provided: ${schema.testEnvironment}. You need to install it manually.`\n );\n }\n\n if (schema.uiFramework === 'angular') {\n devDependencies['@analogjs/vitest-angular'] = analogVitestAngular;\n devDependencies['@analogjs/vite-plugin-angular'] = analogVitestAngular;\n }\n\n if (schema.uiFramework === 'react') {\n if (schema.compiler === 'swc') {\n devDependencies['@vitejs/plugin-react-swc'] = vitePluginReactSwcVersion;\n } else {\n devDependencies['@vitejs/plugin-react'] = vitePluginReactVersion;\n }\n }\n\n if (schema.includeLib) {\n devDependencies['vite-plugin-dts'] = vitePluginDtsVersion;\n }\n\n return addDependenciesToPackageJson(host, {}, devDependencies);\n}\n"],"names":["ensureDependencies","host","schema","devDependencies","testEnvironment","jsdomVersion","happyDomVersion","edgeRuntimeVmVersion","logger","info","uiFramework","analogVitestAngular","compiler","vitePluginReactSwcVersion","vitePluginReactVersion","includeLib","vitePluginDtsVersion","addDependenciesToPackageJson"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BAuBgBA;;;eAAAA;;;wBAlBT;0BASA;AASA,SAASA,mBACdC,IAAU,EACVC,MAAiC;IAEjC,MAAMC,kBAA0C,CAAC;IAEjD,IAAID,OAAOE,eAAe,KAAK,SAAS;QACtCD,eAAe,CAAC,QAAQ,GAAGE,sBAAY;IACzC,OAAO,IAAIH,OAAOE,eAAe,KAAK,aAAa;QACjDD,eAAe,CAAC,YAAY,GAAGG,yBAAe;IAChD,OAAO,IAAIJ,OAAOE,eAAe,KAAK,gBAAgB;QACpDD,eAAe,CAAC,mBAAmB,GAAGI,8BAAoB;IAC5D,OAAO,IAAIL,OAAOE,eAAe,KAAK,UAAUF,OAAOE,eAAe,EAAE;QACtEI,cAAM,CAACC,IAAI,CACT,CAAC,mCAAmC,EAAEP,OAAOE,eAAe,CAAC,kCAAkC,CAAC;IAEpG;IAEA,IAAIF,OAAOQ,WAAW,KAAK,WAAW;QACpCP,eAAe,CAAC,2BAA2B,GAAGQ,6BAAmB;QACjER,eAAe,CAAC,gCAAgC,GAAGQ,6BAAmB;IACxE;IAEA,IAAIT,OAAOQ,WAAW,KAAK,SAAS;QAClC,IAAIR,OAAOU,QAAQ,KAAK,OAAO;YAC7BT,eAAe,CAAC,2BAA2B,GAAGU,mCAAyB;QACzE,OAAO;YACLV,eAAe,CAAC,uBAAuB,GAAGW,gCAAsB;QAClE;IACF;IAEA,IAAIZ,OAAOa,UAAU,EAAE;QACrBZ,eAAe,CAAC,kBAAkB,GAAGa,8BAAoB;IAC3D;IAEA,OAAOC,IAAAA,oCAA4B,EAAChB,MAAM,CAAC,GAAGE;AAChD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
2
|
import { ViteConfigurationGeneratorSchema } from '../generators/configuration/schema';
|
|
3
|
+
import { VitestGeneratorSchema } from '../generators/vitest/schema';
|
|
3
4
|
export type Target = 'build' | 'serve' | 'test' | 'preview';
|
|
4
5
|
export type TargetFlags = Partial<Record<Target, boolean>>;
|
|
5
6
|
export type UserProvidedTargetName = Partial<Record<Target, string>>;
|
|
@@ -10,7 +11,7 @@ export declare function findExistingJsBuildTargetInProject(targets: {
|
|
|
10
11
|
supported?: string;
|
|
11
12
|
unsupported?: string;
|
|
12
13
|
};
|
|
13
|
-
export declare function addOrChangeTestTarget(tree: Tree, options:
|
|
14
|
+
export declare function addOrChangeTestTarget(tree: Tree, options: VitestGeneratorSchema, hasPlugin: boolean): void;
|
|
14
15
|
export declare function addBuildTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
15
16
|
export declare function addServeTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
16
17
|
/**
|
|
@@ -100,9 +100,17 @@ function findExistingJsBuildTargetInProject(targets) {
|
|
|
100
100
|
}
|
|
101
101
|
return output;
|
|
102
102
|
}
|
|
103
|
-
function addOrChangeTestTarget(tree, options,
|
|
103
|
+
function addOrChangeTestTarget(tree, options, hasPlugin) {
|
|
104
|
+
var _nxJson_plugins;
|
|
104
105
|
var _project;
|
|
106
|
+
const nxJson = (0, _devkit.readNxJson)(tree);
|
|
107
|
+
hasPlugin = (_nxJson_plugins = nxJson.plugins) == null ? void 0 : _nxJson_plugins.some((p)=>typeof p === 'string' ? p === '@nx/vite/plugin' : p.plugin === '@nx/vite/plugin' || hasPlugin);
|
|
108
|
+
if (hasPlugin) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
105
111
|
const project = (0, _devkit.readProjectConfiguration)(tree, options.project);
|
|
112
|
+
var _options_testTarget;
|
|
113
|
+
const target = (_options_testTarget = options.testTarget) != null ? _options_testTarget : 'test';
|
|
106
114
|
const reportsDirectory = (0, _devkit.joinPathFragments)((0, _devkit.offsetFromRoot)(project.root), 'coverage', project.root === '.' ? options.project : project.root);
|
|
107
115
|
const testOptions = {
|
|
108
116
|
reportsDirectory
|
|
@@ -110,9 +118,7 @@ function addOrChangeTestTarget(tree, options, target) {
|
|
|
110
118
|
var _targets;
|
|
111
119
|
(_targets = (_project = project).targets) != null ? _targets : _project.targets = {};
|
|
112
120
|
if (project.targets[target]) {
|
|
113
|
-
|
|
114
|
-
project.targets[target].executor = '@nx/vite:test';
|
|
115
|
-
(_project_targets_target_options = project.targets[target].options) == null ? true : delete _project_targets_target_options.jestConfig;
|
|
121
|
+
throw new Error(`Target "${target}" already exists in the project.`);
|
|
116
122
|
} else {
|
|
117
123
|
project.targets[target] = {
|
|
118
124
|
executor: '@nx/vite:test',
|
|
@@ -294,7 +300,7 @@ function moveAndEditIndexHtml(tree, options) {
|
|
|
294
300
|
}
|
|
295
301
|
}
|
|
296
302
|
function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasViteTargets, vitestFileName) {
|
|
297
|
-
const { root: projectRoot
|
|
303
|
+
const { root: projectRoot } = (0, _devkit.readProjectConfiguration)(tree, options.project);
|
|
298
304
|
const extension = options.useEsmExtension ? 'mts' : 'ts';
|
|
299
305
|
const viteConfigPath = vitestFileName ? `${projectRoot}/vitest.config.${extension}` : `${projectRoot}/vite.config.${extension}`;
|
|
300
306
|
const isUsingTsPlugin = (0, _tssolutionsetup.isUsingTsSolutionSetup)(tree);
|
|
@@ -346,7 +352,7 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
|
|
|
346
352
|
if (!onlyVitest && options.includeLib) {
|
|
347
353
|
plugins.push(`dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })`);
|
|
348
354
|
}
|
|
349
|
-
const reportsDirectory = projectRoot === '.' ? `./coverage/${options.project}` : `${(0, _devkit.offsetFromRoot)(projectRoot)}coverage/${projectRoot}`;
|
|
355
|
+
const reportsDirectory = isUsingTsPlugin ? './test-output/vitest/coverage' : projectRoot === '.' ? `./coverage/${options.project}` : `${(0, _devkit.offsetFromRoot)(projectRoot)}coverage/${projectRoot}`;
|
|
350
356
|
var _options_testEnvironment;
|
|
351
357
|
const testOption = options.includeVitest ? ` test: {
|
|
352
358
|
watch: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/generator-utils.ts"],"sourcesContent":["import {\n joinPathFragments,\n logger,\n offsetFromRoot,\n readJson,\n readProjectConfiguration,\n TargetConfiguration,\n Tree,\n updateProjectConfiguration,\n writeJson,\n} from '@nx/devkit';\nimport { addBuildTargetDefaults } from '@nx/devkit/src/generators/target-defaults-utils';\nimport { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';\nimport { VitestExecutorOptions } from '../executors/test/schema';\nimport { ViteConfigurationGeneratorSchema } from '../generators/configuration/schema';\nimport { ensureViteConfigIsCorrect } from './vite-config-edit-utils';\n\nexport type Target = 'build' | 'serve' | 'test' | 'preview';\nexport type TargetFlags = Partial<Record<Target, boolean>>;\nexport type UserProvidedTargetName = Partial<Record<Target, string>>;\nexport type ValidFoundTargetName = Partial<Record<Target, string>>;\n\nexport function findExistingJsBuildTargetInProject(targets: {\n [targetName: string]: TargetConfiguration;\n}): {\n supported?: string;\n unsupported?: string;\n} {\n const output: {\n supported?: string;\n unsupported?: string;\n } = {};\n\n const supportedExecutors = {\n build: ['@nx/js:babel', '@nx/js:swc', '@nx/rollup:rollup'],\n };\n const unsupportedExecutors = [\n '@nx/angular:ng-packagr-lite',\n '@nx/angular:package',\n '@nx/angular:webpack-browser',\n '@nx/esbuild:esbuild',\n '@nx/react-native:run-ios',\n '@nx/react-native:start',\n '@nx/react-native:run-android',\n '@nx/react-native:bundle',\n '@nx/react-native:build-android',\n '@nx/react-native:bundle',\n '@nx/next:build',\n '@nx/js:tsc',\n '@nrwl/angular:ng-packagr-lite',\n '@nrwl/angular:package',\n '@nrwl/angular:webpack-browser',\n '@nrwl/esbuild:esbuild',\n '@nrwl/react-native:run-ios',\n '@nrwl/react-native:start',\n '@nrwl/react-native:run-android',\n '@nrwl/react-native:bundle',\n '@nrwl/react-native:build-android',\n '@nrwl/react-native:bundle',\n '@nrwl/next:build',\n '@nrwl/js:tsc',\n '@angular-devkit/build-angular:browser',\n '@angular-devkit/build-angular:browser-esbuild',\n '@angular-devkit/build-angular:application',\n ];\n\n // We try to find the target that is using the supported executors\n // for build since this is the one we will be converting\n for (const target in targets) {\n const executorName = targets[target].executor;\n if (supportedExecutors.build.includes(executorName)) {\n output.supported = target;\n } else if (unsupportedExecutors.includes(executorName)) {\n output.unsupported = target;\n }\n }\n return output;\n}\n\nexport function addOrChangeTestTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n const reportsDirectory = joinPathFragments(\n offsetFromRoot(project.root),\n 'coverage',\n project.root === '.' ? options.project : project.root\n );\n const testOptions: VitestExecutorOptions = {\n reportsDirectory,\n };\n\n project.targets ??= {};\n\n if (project.targets[target]) {\n project.targets[target].executor = '@nx/vite:test';\n delete project.targets[target].options?.jestConfig;\n } else {\n project.targets[target] = {\n executor: '@nx/vite:test',\n outputs: ['{options.reportsDirectory}'],\n options: testOptions,\n };\n }\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addBuildTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n addBuildTargetDefaults(tree, '@nx/vite:build');\n const project = readProjectConfiguration(tree, options.project);\n\n const isTsSolutionSetup = isUsingTsSolutionSetup(tree);\n const buildOptions: ViteBuildExecutorOptions = {\n outputPath: isTsSolutionSetup\n ? joinPathFragments(project.root, 'dist')\n : joinPathFragments(\n 'dist',\n project.root != '.' ? project.root : options.project\n ),\n };\n project.targets ??= {};\n project.targets[target] = {\n executor: '@nx/vite:build',\n outputs: ['{options.outputPath}'],\n defaultConfiguration: 'production',\n options: buildOptions,\n configurations: {\n development: {\n mode: 'development',\n },\n production: {\n mode: 'production',\n },\n },\n };\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addServeTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n project.targets ??= {};\n\n project.targets[target] = {\n executor: '@nx/vite:dev-server',\n defaultConfiguration: 'development',\n options: {\n buildTarget: `${options.project}:build`,\n },\n configurations: {\n development: {\n buildTarget: `${options.project}:build:development`,\n hmr: true,\n },\n production: {\n buildTarget: `${options.project}:build:production`,\n hmr: false,\n },\n },\n };\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\n/**\n * Adds a target for the preview server.\n *\n * @param tree\n * @param options\n * @param serveTarget An existing serve target.\n */\nexport function addPreviewTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n serveTarget: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n const previewOptions: VitePreviewServerExecutorOptions = {\n buildTarget: `${options.project}:build`,\n };\n\n project.targets ??= {};\n\n // Update the options from the passed serve target.\n if (project.targets[serveTarget]) {\n const target = project.targets[serveTarget];\n if (target.executor === '@nxext/vite:dev') {\n previewOptions.proxyConfig = target.options.proxyConfig;\n }\n previewOptions['https'] = target.options?.https;\n previewOptions['open'] = target.options?.open;\n }\n\n // Adds a preview target.\n project.targets.preview = {\n dependsOn: ['build'],\n executor: '@nx/vite:preview-server',\n defaultConfiguration: 'development',\n options: previewOptions,\n configurations: {\n development: {\n buildTarget: `${options.project}:build:development`,\n },\n production: {\n buildTarget: `${options.project}:build:production`,\n },\n },\n };\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function editTsConfig(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n let tsconfigPath = joinPathFragments(projectConfig.root, 'tsconfig.json');\n const isTsSolutionSetup = isUsingTsSolutionSetup(tree);\n if (isTsSolutionSetup) {\n tsconfigPath = [\n joinPathFragments(projectConfig.root, 'tsconfig.app.json'),\n joinPathFragments(projectConfig.root, 'tsconfig.lib.json'),\n ].find((p) => tree.exists(p));\n }\n const config = readJson(tree, tsconfigPath);\n\n switch (options.uiFramework) {\n case 'react':\n config.compilerOptions = {\n jsx: 'react-jsx',\n allowJs: false,\n esModuleInterop: false,\n allowSyntheticDefaultImports: true,\n strict: true,\n };\n break;\n case 'none':\n if (!isTsSolutionSetup) {\n config.compilerOptions = {\n module: 'commonjs',\n forceConsistentCasingInFileNames: true,\n strict: true,\n noImplicitOverride: true,\n noPropertyAccessFromIndexSignature: true,\n noImplicitReturns: true,\n noFallthroughCasesInSwitch: true,\n };\n }\n break;\n default:\n break;\n }\n\n writeJson(tree, tsconfigPath, config);\n}\n\nexport function deleteWebpackConfig(\n tree: Tree,\n projectRoot: string,\n webpackConfigFilePath?: string\n) {\n const webpackConfigPath =\n webpackConfigFilePath && tree.exists(webpackConfigFilePath)\n ? webpackConfigFilePath\n : tree.exists(`${projectRoot}/webpack.config.js`)\n ? `${projectRoot}/webpack.config.js`\n : tree.exists(`${projectRoot}/webpack.config.ts`)\n ? `${projectRoot}/webpack.config.ts`\n : null;\n if (webpackConfigPath) {\n tree.delete(webpackConfigPath);\n }\n}\n\nexport function moveAndEditIndexHtml(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n let indexHtmlPath = `${projectConfig.root}/src/index.html`;\n let mainPath = `${projectConfig.root}/src/main.ts${\n options.uiFramework === 'react' ? 'x' : ''\n }`;\n\n if (projectConfig.root !== '.') {\n mainPath = mainPath.replace(projectConfig.root, '');\n }\n\n if (\n !tree.exists(indexHtmlPath) &&\n tree.exists(`${projectConfig.root}/index.html`)\n ) {\n indexHtmlPath = `${projectConfig.root}/index.html`;\n }\n\n if (tree.exists(indexHtmlPath)) {\n const indexHtmlContent = tree.read(indexHtmlPath, 'utf8');\n if (\n !indexHtmlContent.includes(\n `<script type='module' src='${mainPath}'></script>`\n )\n ) {\n tree.write(\n `${projectConfig.root}/index.html`,\n indexHtmlContent.replace(\n '</body>',\n `<script type='module' src='${mainPath}'></script>\n </body>`\n )\n );\n\n if (tree.exists(`${projectConfig.root}/src/index.html`)) {\n tree.delete(`${projectConfig.root}/src/index.html`);\n }\n }\n } else {\n tree.write(\n `${projectConfig.root}/index.html`,\n `<!DOCTYPE html>\n <html lang='en'>\n <head>\n <meta charset='UTF-8' />\n <link rel='icon' href='/favicon.ico' />\n <meta name='viewport' content='width=device-width, initial-scale=1.0' />\n <title>Vite</title>\n </head>\n <body>\n <div id='root'></div>\n <script type='module' src='${mainPath}'></script>\n </body>\n </html>`\n );\n }\n}\n\nexport interface ViteConfigFileOptions {\n project: string;\n includeLib?: boolean;\n includeVitest?: boolean;\n inSourceTests?: boolean;\n testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;\n rollupOptionsExternal?: string[];\n imports?: string[];\n plugins?: string[];\n coverageProvider?: 'v8' | 'istanbul' | 'custom';\n setupFile?: string;\n useEsmExtension?: boolean;\n}\n\nexport function createOrEditViteConfig(\n tree: Tree,\n options: ViteConfigFileOptions,\n onlyVitest: boolean,\n projectAlreadyHasViteTargets?: TargetFlags,\n vitestFileName?: boolean\n) {\n const { root: projectRoot, projectType } = readProjectConfiguration(\n tree,\n options.project\n );\n\n const extension = options.useEsmExtension ? 'mts' : 'ts';\n const viteConfigPath = vitestFileName\n ? `${projectRoot}/vitest.config.${extension}`\n : `${projectRoot}/vite.config.${extension}`;\n\n const isUsingTsPlugin = isUsingTsSolutionSetup(tree);\n const buildOutDir = isUsingTsPlugin\n ? './dist'\n : projectRoot === '.'\n ? `./dist/${options.project}`\n : `${offsetFromRoot(projectRoot)}dist/${projectRoot}`;\n\n const buildOption = onlyVitest\n ? ''\n : options.includeLib\n ? ` // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n outDir: '${buildOutDir}',\n emptyOutDir: true,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: '${options.project}',\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']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: [${options.rollupOptionsExternal ?? ''}]\n },\n },`\n : ` build: {\n outDir: '${buildOutDir}',\n emptyOutDir: true,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n },`;\n\n const imports: string[] = options.imports ? [...options.imports] : [];\n const plugins: string[] = options.plugins ? [...options.plugins] : [];\n\n if (!onlyVitest && options.includeLib) {\n imports.push(\n `import dts from 'vite-plugin-dts'`,\n `import * as path from 'path'`\n );\n }\n\n if (!isUsingTsPlugin) {\n imports.push(\n `import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'`,\n `import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'`\n );\n plugins.push(`nxViteTsPaths()`, `nxCopyAssetsPlugin(['*.md'])`);\n }\n\n if (!onlyVitest && options.includeLib) {\n plugins.push(\n `dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })`\n );\n }\n\n const reportsDirectory =\n projectRoot === '.'\n ? `./coverage/${options.project}`\n : `${offsetFromRoot(projectRoot)}coverage/${projectRoot}`;\n\n const testOption = options.includeVitest\n ? ` test: {\n watch: false,\n globals: true,\n environment: '${options.testEnvironment ?? 'jsdom'}',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n${options.setupFile ? ` setupFiles: ['${options.setupFile}'],\\n` : ''}\\\n${\n options.inSourceTests\n ? ` includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\\n`\n : ''\n}\\\n reporters: ['default'],\n coverage: {\n reportsDirectory: '${reportsDirectory}',\n provider: ${\n options.coverageProvider ? `'${options.coverageProvider}'` : `'v8'`\n },\n }\n },`\n : '';\n\n const defineOption = options.inSourceTests\n ? ` define: {\n 'import.meta.vitest': undefined\n },`\n : '';\n\n const devServerOption = onlyVitest\n ? ''\n : options.includeLib\n ? ''\n : ` server:{\n port: 4200,\n host: 'localhost',\n },`;\n\n const previewServerOption = onlyVitest\n ? ''\n : options.includeLib\n ? ''\n : ` preview:{\n port: 4300,\n host: 'localhost',\n },`;\n\n const workerOption = ` // Uncomment this if you are using workers.\n // worker: {\n // plugins: [ nxViteTsPaths() ],\n // },`;\n\n const cacheDir = `cacheDir: '${normalizedJoinPaths(\n offsetFromRoot(projectRoot),\n 'node_modules',\n '.vite',\n projectRoot === '.' ? options.project : projectRoot\n )}',`;\n\n if (tree.exists(viteConfigPath)) {\n handleViteConfigFileExists(\n tree,\n viteConfigPath,\n options,\n buildOption,\n buildOutDir,\n imports,\n plugins,\n testOption,\n reportsDirectory,\n cacheDir,\n projectRoot,\n offsetFromRoot(projectRoot),\n projectAlreadyHasViteTargets\n );\n return;\n }\n\n const viteConfigContent = `/// <reference types='vitest' />\nimport { defineConfig } from 'vite';\n${imports.join(';\\n')}${imports.length ? ';' : ''}\n\nexport default defineConfig({\n root: __dirname,\n ${printOptions(\n cacheDir,\n devServerOption,\n previewServerOption,\n ` plugins: [${plugins.join(', ')}],`,\n workerOption,\n buildOption,\n defineOption,\n testOption\n )}\n});\n`.replace(/\\s+(?=(\\n|$))/gm, '\\n');\n\n tree.write(viteConfigPath, viteConfigContent);\n}\n\nfunction printOptions(...options: string[]): string {\n return options.filter(Boolean).join('\\n');\n}\n\nexport function normalizeViteConfigFilePathWithTree(\n tree: Tree,\n projectRoot: string,\n configFile?: string\n): string {\n return configFile && tree.exists(configFile)\n ? configFile\n : tree.exists(joinPathFragments(`${projectRoot}/vite.config.ts`))\n ? joinPathFragments(`${projectRoot}/vite.config.ts`)\n : tree.exists(joinPathFragments(`${projectRoot}/vite.config.js`))\n ? joinPathFragments(`${projectRoot}/vite.config.js`)\n : undefined;\n}\n\nexport function getViteConfigPathForProject(\n tree: Tree,\n projectName: string,\n target?: string\n) {\n let viteConfigPath: string | undefined;\n const { targets, root } = readProjectConfiguration(tree, projectName);\n if (target) {\n viteConfigPath = targets?.[target]?.options?.configFile;\n } else {\n const config = Object.values(targets).find(\n (config) =>\n config.executor === '@nrwl/nx:build' ||\n config.executor === '@nrwl/vite:build'\n );\n viteConfigPath = config?.options?.configFile;\n }\n\n return normalizeViteConfigFilePathWithTree(tree, root, viteConfigPath);\n}\n\nexport async function handleUnsupportedUserProvidedTargets(\n userProvidedTargetIsUnsupported: TargetFlags,\n userProvidedTargetName: UserProvidedTargetName,\n validFoundTargetName: ValidFoundTargetName\n) {\n if (userProvidedTargetIsUnsupported.build && validFoundTargetName.build) {\n await handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName.build,\n validFoundTargetName.build,\n 'build',\n 'build'\n );\n }\n\n if (userProvidedTargetIsUnsupported.serve && validFoundTargetName.serve) {\n await handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName.serve,\n validFoundTargetName.serve,\n 'serve',\n 'dev-server'\n );\n }\n\n if (userProvidedTargetIsUnsupported.test && validFoundTargetName.test) {\n await handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName.test,\n validFoundTargetName.test,\n 'test',\n 'test'\n );\n }\n}\n\nasync function handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName: string,\n validFoundTargetName: string,\n target: Target,\n executor: 'build' | 'dev-server' | 'test'\n) {\n logger.warn(\n `The custom ${target} target you provided (${userProvidedTargetName}) cannot be converted to use the @nx/vite:${executor} executor.\n However, we found the following ${target} target in your project that can be converted: ${validFoundTargetName}\n\n Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit\n your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.\n `\n );\n const { Confirm } = require('enquirer');\n const prompt = new Confirm({\n name: 'question',\n message: `Should we convert the ${validFoundTargetName} target to use the @nx/vite:${executor} executor?`,\n initial: true,\n });\n const shouldConvert = await prompt.run();\n if (!shouldConvert) {\n throw new Error(\n `The ${target} target ${userProvidedTargetName} cannot be converted to use the @nx/vite:${executor} executor.\n Please try again, either by providing a different ${target} target or by not providing a target at all (Nx will\n convert the first one it finds, most probably this one: ${validFoundTargetName})\n\n Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit\n your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.\n `\n );\n }\n}\n\nexport async function handleUnknownConfiguration(projectName: string) {\n if (process.env.NX_INTERACTIVE === 'false') {\n return;\n }\n\n logger.warn(\n `\n We could not find any configuration in project ${projectName} that \n indicates whether we can definitely convert to Vite.\n \n If you still want to convert your project to use Vite,\n please make sure to commit your changes before running this generator.\n `\n );\n\n const { Confirm } = require('enquirer');\n const prompt = new Confirm({\n name: 'question',\n message: `Should Nx convert your project to use Vite?`,\n initial: true,\n });\n const shouldConvert = await prompt.run();\n if (!shouldConvert) {\n throw new Error(`\n Nx could not verify that your project can be converted to use Vite.\n Please try again with a different project.\n `);\n }\n}\n\nfunction handleViteConfigFileExists(\n tree: Tree,\n viteConfigPath: string,\n options: ViteConfigFileOptions,\n buildOption: string,\n buildOutDir: string,\n imports: string[],\n plugins: string[],\n testOption: string,\n reportsDirectory: string,\n cacheDir: string,\n projectRoot: string,\n offsetFromRoot: string,\n projectAlreadyHasViteTargets?: TargetFlags\n) {\n if (\n projectAlreadyHasViteTargets?.build &&\n projectAlreadyHasViteTargets?.test\n ) {\n return;\n }\n\n if (process.env.NX_VERBOSE_LOGGING === 'true') {\n logger.info(\n `vite.config.ts already exists for project ${options.project}.`\n );\n }\n\n const buildOptionObject = options.includeLib\n ? {\n lib: {\n entry: 'src/index.ts',\n name: options.project,\n fileName: 'index',\n formats: ['es'],\n },\n rollupOptions: {\n external: options.rollupOptionsExternal ?? [],\n },\n outDir: buildOutDir,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n }\n : {\n outDir: buildOutDir,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n };\n\n const testOptionObject = {\n globals: true,\n environment: options.testEnvironment ?? 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n reporters: ['default'],\n coverage: {\n reportsDirectory: reportsDirectory,\n provider: `${options.coverageProvider ?? 'v8'}`,\n },\n };\n\n const changed = ensureViteConfigIsCorrect(\n tree,\n viteConfigPath,\n buildOption,\n buildOptionObject,\n imports,\n plugins,\n testOption,\n testOptionObject,\n cacheDir,\n projectAlreadyHasViteTargets ?? {}\n );\n\n if (!changed) {\n logger.warn(\n `Make sure the following setting exists in your Vite configuration file (${viteConfigPath}):\n \n ${buildOption}\n \n `\n );\n }\n}\n\nfunction normalizedJoinPaths(...paths: string[]): string {\n const path = joinPathFragments(...paths);\n\n return path.startsWith('.') ? path : `./${path}`;\n}\n"],"names":["addBuildTarget","addOrChangeTestTarget","addPreviewTarget","addServeTarget","createOrEditViteConfig","deleteWebpackConfig","editTsConfig","findExistingJsBuildTargetInProject","getViteConfigPathForProject","handleUnknownConfiguration","handleUnsupportedUserProvidedTargets","moveAndEditIndexHtml","normalizeViteConfigFilePathWithTree","targets","output","supportedExecutors","build","unsupportedExecutors","target","executorName","executor","includes","supported","unsupported","tree","options","project","readProjectConfiguration","reportsDirectory","joinPathFragments","offsetFromRoot","root","testOptions","jestConfig","outputs","updateProjectConfiguration","addBuildTargetDefaults","isTsSolutionSetup","isUsingTsSolutionSetup","buildOptions","outputPath","defaultConfiguration","configurations","development","mode","production","buildTarget","hmr","serveTarget","previewOptions","proxyConfig","https","open","preview","dependsOn","projectConfig","tsconfigPath","find","p","exists","config","readJson","uiFramework","compilerOptions","jsx","allowJs","esModuleInterop","allowSyntheticDefaultImports","strict","module","forceConsistentCasingInFileNames","noImplicitOverride","noPropertyAccessFromIndexSignature","noImplicitReturns","noFallthroughCasesInSwitch","writeJson","projectRoot","webpackConfigFilePath","webpackConfigPath","delete","indexHtmlPath","mainPath","replace","indexHtmlContent","read","write","onlyVitest","projectAlreadyHasViteTargets","vitestFileName","projectType","extension","useEsmExtension","viteConfigPath","isUsingTsPlugin","buildOutDir","buildOption","includeLib","rollupOptionsExternal","imports","plugins","push","testOption","includeVitest","testEnvironment","setupFile","inSourceTests","coverageProvider","defineOption","devServerOption","previewServerOption","workerOption","cacheDir","normalizedJoinPaths","handleViteConfigFileExists","viteConfigContent","join","length","printOptions","filter","Boolean","configFile","undefined","projectName","Object","values","userProvidedTargetIsUnsupported","userProvidedTargetName","validFoundTargetName","handleUnsupportedUserProvidedTargetsErrors","serve","test","logger","warn","Confirm","require","prompt","name","message","initial","shouldConvert","run","Error","process","env","NX_INTERACTIVE","NX_VERBOSE_LOGGING","info","buildOptionObject","lib","entry","fileName","formats","rollupOptions","external","outDir","reportCompressedSize","commonjsOptions","transformMixedEsModules","testOptionObject","globals","environment","include","reporters","coverage","provider","changed","ensureViteConfigIsCorrect","paths","path","startsWith"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAiHgBA,cAAc;eAAdA;;IAhCAC,qBAAqB;eAArBA;;IAyGAC,gBAAgB;eAAhBA;;IArCAC,cAAc;eAAdA;;IA2NAC,sBAAsB;eAAtBA;;IA9FAC,mBAAmB;eAAnBA;;IA9CAC,YAAY;eAAZA;;IA5MAC,kCAAkC;eAAlCA;;IAqiBAC,2BAA2B;eAA3BA;;IAwFMC,0BAA0B;eAA1BA;;IAnEAC,oCAAoC;eAApCA;;IA9SNC,oBAAoB;eAApBA;;I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|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/generator-utils.ts"],"sourcesContent":["import {\n joinPathFragments,\n logger,\n offsetFromRoot,\n readJson,\n readNxJson,\n readProjectConfiguration,\n TargetConfiguration,\n Tree,\n updateProjectConfiguration,\n writeJson,\n} from '@nx/devkit';\nimport { addBuildTargetDefaults } from '@nx/devkit/src/generators/target-defaults-utils';\nimport { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';\nimport { VitestExecutorOptions } from '../executors/test/schema';\nimport { ViteConfigurationGeneratorSchema } from '../generators/configuration/schema';\nimport { ensureViteConfigIsCorrect } from './vite-config-edit-utils';\nimport { VitestGeneratorSchema } from '../generators/vitest/schema';\n\nexport type Target = 'build' | 'serve' | 'test' | 'preview';\nexport type TargetFlags = Partial<Record<Target, boolean>>;\nexport type UserProvidedTargetName = Partial<Record<Target, string>>;\nexport type ValidFoundTargetName = Partial<Record<Target, string>>;\n\nexport function findExistingJsBuildTargetInProject(targets: {\n [targetName: string]: TargetConfiguration;\n}): {\n supported?: string;\n unsupported?: string;\n} {\n const output: {\n supported?: string;\n unsupported?: string;\n } = {};\n\n const supportedExecutors = {\n build: ['@nx/js:babel', '@nx/js:swc', '@nx/rollup:rollup'],\n };\n const unsupportedExecutors = [\n '@nx/angular:ng-packagr-lite',\n '@nx/angular:package',\n '@nx/angular:webpack-browser',\n '@nx/esbuild:esbuild',\n '@nx/react-native:run-ios',\n '@nx/react-native:start',\n '@nx/react-native:run-android',\n '@nx/react-native:bundle',\n '@nx/react-native:build-android',\n '@nx/react-native:bundle',\n '@nx/next:build',\n '@nx/js:tsc',\n '@nrwl/angular:ng-packagr-lite',\n '@nrwl/angular:package',\n '@nrwl/angular:webpack-browser',\n '@nrwl/esbuild:esbuild',\n '@nrwl/react-native:run-ios',\n '@nrwl/react-native:start',\n '@nrwl/react-native:run-android',\n '@nrwl/react-native:bundle',\n '@nrwl/react-native:build-android',\n '@nrwl/react-native:bundle',\n '@nrwl/next:build',\n '@nrwl/js:tsc',\n '@angular-devkit/build-angular:browser',\n '@angular-devkit/build-angular:browser-esbuild',\n '@angular-devkit/build-angular:application',\n ];\n\n // We try to find the target that is using the supported executors\n // for build since this is the one we will be converting\n for (const target in targets) {\n const executorName = targets[target].executor;\n if (supportedExecutors.build.includes(executorName)) {\n output.supported = target;\n } else if (unsupportedExecutors.includes(executorName)) {\n output.unsupported = target;\n }\n }\n return output;\n}\n\nexport function addOrChangeTestTarget(\n tree: Tree,\n options: VitestGeneratorSchema,\n hasPlugin: boolean\n) {\n const nxJson = readNxJson(tree);\n\n hasPlugin = nxJson.plugins?.some((p) =>\n typeof p === 'string'\n ? p === '@nx/vite/plugin'\n : p.plugin === '@nx/vite/plugin' || hasPlugin\n );\n\n if (hasPlugin) {\n return;\n }\n\n const project = readProjectConfiguration(tree, options.project);\n const target = options.testTarget ?? 'test';\n\n const reportsDirectory = joinPathFragments(\n offsetFromRoot(project.root),\n 'coverage',\n project.root === '.' ? options.project : project.root\n );\n const testOptions: VitestExecutorOptions = {\n reportsDirectory,\n };\n\n project.targets ??= {};\n\n if (project.targets[target]) {\n throw new Error(`Target \"${target}\" already exists in the project.`);\n } else {\n project.targets[target] = {\n executor: '@nx/vite:test',\n outputs: ['{options.reportsDirectory}'],\n options: testOptions,\n };\n }\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addBuildTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n addBuildTargetDefaults(tree, '@nx/vite:build');\n const project = readProjectConfiguration(tree, options.project);\n\n const isTsSolutionSetup = isUsingTsSolutionSetup(tree);\n const buildOptions: ViteBuildExecutorOptions = {\n outputPath: isTsSolutionSetup\n ? joinPathFragments(project.root, 'dist')\n : joinPathFragments(\n 'dist',\n project.root != '.' ? project.root : options.project\n ),\n };\n project.targets ??= {};\n project.targets[target] = {\n executor: '@nx/vite:build',\n outputs: ['{options.outputPath}'],\n defaultConfiguration: 'production',\n options: buildOptions,\n configurations: {\n development: {\n mode: 'development',\n },\n production: {\n mode: 'production',\n },\n },\n };\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addServeTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n project.targets ??= {};\n\n project.targets[target] = {\n executor: '@nx/vite:dev-server',\n defaultConfiguration: 'development',\n options: {\n buildTarget: `${options.project}:build`,\n },\n configurations: {\n development: {\n buildTarget: `${options.project}:build:development`,\n hmr: true,\n },\n production: {\n buildTarget: `${options.project}:build:production`,\n hmr: false,\n },\n },\n };\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\n/**\n * Adds a target for the preview server.\n *\n * @param tree\n * @param options\n * @param serveTarget An existing serve target.\n */\nexport function addPreviewTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n serveTarget: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n const previewOptions: VitePreviewServerExecutorOptions = {\n buildTarget: `${options.project}:build`,\n };\n\n project.targets ??= {};\n\n // Update the options from the passed serve target.\n if (project.targets[serveTarget]) {\n const target = project.targets[serveTarget];\n if (target.executor === '@nxext/vite:dev') {\n previewOptions.proxyConfig = target.options.proxyConfig;\n }\n previewOptions['https'] = target.options?.https;\n previewOptions['open'] = target.options?.open;\n }\n\n // Adds a preview target.\n project.targets.preview = {\n dependsOn: ['build'],\n executor: '@nx/vite:preview-server',\n defaultConfiguration: 'development',\n options: previewOptions,\n configurations: {\n development: {\n buildTarget: `${options.project}:build:development`,\n },\n production: {\n buildTarget: `${options.project}:build:production`,\n },\n },\n };\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function editTsConfig(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n let tsconfigPath = joinPathFragments(projectConfig.root, 'tsconfig.json');\n const isTsSolutionSetup = isUsingTsSolutionSetup(tree);\n if (isTsSolutionSetup) {\n tsconfigPath = [\n joinPathFragments(projectConfig.root, 'tsconfig.app.json'),\n joinPathFragments(projectConfig.root, 'tsconfig.lib.json'),\n ].find((p) => tree.exists(p));\n }\n const config = readJson(tree, tsconfigPath);\n\n switch (options.uiFramework) {\n case 'react':\n config.compilerOptions = {\n jsx: 'react-jsx',\n allowJs: false,\n esModuleInterop: false,\n allowSyntheticDefaultImports: true,\n strict: true,\n };\n break;\n case 'none':\n if (!isTsSolutionSetup) {\n config.compilerOptions = {\n module: 'commonjs',\n forceConsistentCasingInFileNames: true,\n strict: true,\n noImplicitOverride: true,\n noPropertyAccessFromIndexSignature: true,\n noImplicitReturns: true,\n noFallthroughCasesInSwitch: true,\n };\n }\n break;\n default:\n break;\n }\n\n writeJson(tree, tsconfigPath, config);\n}\n\nexport function deleteWebpackConfig(\n tree: Tree,\n projectRoot: string,\n webpackConfigFilePath?: string\n) {\n const webpackConfigPath =\n webpackConfigFilePath && tree.exists(webpackConfigFilePath)\n ? webpackConfigFilePath\n : tree.exists(`${projectRoot}/webpack.config.js`)\n ? `${projectRoot}/webpack.config.js`\n : tree.exists(`${projectRoot}/webpack.config.ts`)\n ? `${projectRoot}/webpack.config.ts`\n : null;\n if (webpackConfigPath) {\n tree.delete(webpackConfigPath);\n }\n}\n\nexport function moveAndEditIndexHtml(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n let indexHtmlPath = `${projectConfig.root}/src/index.html`;\n let mainPath = `${projectConfig.root}/src/main.ts${\n options.uiFramework === 'react' ? 'x' : ''\n }`;\n\n if (projectConfig.root !== '.') {\n mainPath = mainPath.replace(projectConfig.root, '');\n }\n\n if (\n !tree.exists(indexHtmlPath) &&\n tree.exists(`${projectConfig.root}/index.html`)\n ) {\n indexHtmlPath = `${projectConfig.root}/index.html`;\n }\n\n if (tree.exists(indexHtmlPath)) {\n const indexHtmlContent = tree.read(indexHtmlPath, 'utf8');\n if (\n !indexHtmlContent.includes(\n `<script type='module' src='${mainPath}'></script>`\n )\n ) {\n tree.write(\n `${projectConfig.root}/index.html`,\n indexHtmlContent.replace(\n '</body>',\n `<script type='module' src='${mainPath}'></script>\n </body>`\n )\n );\n\n if (tree.exists(`${projectConfig.root}/src/index.html`)) {\n tree.delete(`${projectConfig.root}/src/index.html`);\n }\n }\n } else {\n tree.write(\n `${projectConfig.root}/index.html`,\n `<!DOCTYPE html>\n <html lang='en'>\n <head>\n <meta charset='UTF-8' />\n <link rel='icon' href='/favicon.ico' />\n <meta name='viewport' content='width=device-width, initial-scale=1.0' />\n <title>Vite</title>\n </head>\n <body>\n <div id='root'></div>\n <script type='module' src='${mainPath}'></script>\n </body>\n </html>`\n );\n }\n}\n\nexport interface ViteConfigFileOptions {\n project: string;\n includeLib?: boolean;\n includeVitest?: boolean;\n inSourceTests?: boolean;\n testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;\n rollupOptionsExternal?: string[];\n imports?: string[];\n plugins?: string[];\n coverageProvider?: 'v8' | 'istanbul' | 'custom';\n setupFile?: string;\n useEsmExtension?: boolean;\n}\n\nexport function createOrEditViteConfig(\n tree: Tree,\n options: ViteConfigFileOptions,\n onlyVitest: boolean,\n projectAlreadyHasViteTargets?: TargetFlags,\n vitestFileName?: boolean\n) {\n const { root: projectRoot } = readProjectConfiguration(tree, options.project);\n\n const extension = options.useEsmExtension ? 'mts' : 'ts';\n const viteConfigPath = vitestFileName\n ? `${projectRoot}/vitest.config.${extension}`\n : `${projectRoot}/vite.config.${extension}`;\n\n const isUsingTsPlugin = isUsingTsSolutionSetup(tree);\n const buildOutDir = isUsingTsPlugin\n ? './dist'\n : projectRoot === '.'\n ? `./dist/${options.project}`\n : `${offsetFromRoot(projectRoot)}dist/${projectRoot}`;\n\n const buildOption = onlyVitest\n ? ''\n : options.includeLib\n ? ` // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n outDir: '${buildOutDir}',\n emptyOutDir: true,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: '${options.project}',\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']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: [${options.rollupOptionsExternal ?? ''}]\n },\n },`\n : ` build: {\n outDir: '${buildOutDir}',\n emptyOutDir: true,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n },`;\n\n const imports: string[] = options.imports ? [...options.imports] : [];\n const plugins: string[] = options.plugins ? [...options.plugins] : [];\n\n if (!onlyVitest && options.includeLib) {\n imports.push(\n `import dts from 'vite-plugin-dts'`,\n `import * as path from 'path'`\n );\n }\n\n if (!isUsingTsPlugin) {\n imports.push(\n `import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'`,\n `import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'`\n );\n plugins.push(`nxViteTsPaths()`, `nxCopyAssetsPlugin(['*.md'])`);\n }\n\n if (!onlyVitest && options.includeLib) {\n plugins.push(\n `dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })`\n );\n }\n\n const reportsDirectory = isUsingTsPlugin\n ? './test-output/vitest/coverage'\n : projectRoot === '.'\n ? `./coverage/${options.project}`\n : `${offsetFromRoot(projectRoot)}coverage/${projectRoot}`;\n\n const testOption = options.includeVitest\n ? ` test: {\n watch: false,\n globals: true,\n environment: '${options.testEnvironment ?? 'jsdom'}',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n${options.setupFile ? ` setupFiles: ['${options.setupFile}'],\\n` : ''}\\\n${\n options.inSourceTests\n ? ` includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\\n`\n : ''\n}\\\n reporters: ['default'],\n coverage: {\n reportsDirectory: '${reportsDirectory}',\n provider: ${\n options.coverageProvider ? `'${options.coverageProvider}'` : `'v8'`\n },\n }\n },`\n : '';\n\n const defineOption = options.inSourceTests\n ? ` define: {\n 'import.meta.vitest': undefined\n },`\n : '';\n\n const devServerOption = onlyVitest\n ? ''\n : options.includeLib\n ? ''\n : ` server:{\n port: 4200,\n host: 'localhost',\n },`;\n\n const previewServerOption = onlyVitest\n ? ''\n : options.includeLib\n ? ''\n : ` preview:{\n port: 4300,\n host: 'localhost',\n },`;\n\n const workerOption = ` // Uncomment this if you are using workers.\n // worker: {\n // plugins: [ nxViteTsPaths() ],\n // },`;\n\n const cacheDir = `cacheDir: '${normalizedJoinPaths(\n offsetFromRoot(projectRoot),\n 'node_modules',\n '.vite',\n projectRoot === '.' ? options.project : projectRoot\n )}',`;\n\n if (tree.exists(viteConfigPath)) {\n handleViteConfigFileExists(\n tree,\n viteConfigPath,\n options,\n buildOption,\n buildOutDir,\n imports,\n plugins,\n testOption,\n reportsDirectory,\n cacheDir,\n projectRoot,\n offsetFromRoot(projectRoot),\n projectAlreadyHasViteTargets\n );\n return;\n }\n\n const viteConfigContent = `/// <reference types='vitest' />\nimport { defineConfig } from 'vite';\n${imports.join(';\\n')}${imports.length ? ';' : ''}\n\nexport default defineConfig({\n root: __dirname,\n ${printOptions(\n cacheDir,\n devServerOption,\n previewServerOption,\n ` plugins: [${plugins.join(', ')}],`,\n workerOption,\n buildOption,\n defineOption,\n testOption\n )}\n});\n`.replace(/\\s+(?=(\\n|$))/gm, '\\n');\n\n tree.write(viteConfigPath, viteConfigContent);\n}\n\nfunction printOptions(...options: string[]): string {\n return options.filter(Boolean).join('\\n');\n}\n\nexport function normalizeViteConfigFilePathWithTree(\n tree: Tree,\n projectRoot: string,\n configFile?: string\n): string {\n return configFile && tree.exists(configFile)\n ? configFile\n : tree.exists(joinPathFragments(`${projectRoot}/vite.config.ts`))\n ? joinPathFragments(`${projectRoot}/vite.config.ts`)\n : tree.exists(joinPathFragments(`${projectRoot}/vite.config.js`))\n ? joinPathFragments(`${projectRoot}/vite.config.js`)\n : undefined;\n}\n\nexport function getViteConfigPathForProject(\n tree: Tree,\n projectName: string,\n target?: string\n) {\n let viteConfigPath: string | undefined;\n const { targets, root } = readProjectConfiguration(tree, projectName);\n if (target) {\n viteConfigPath = targets?.[target]?.options?.configFile;\n } else {\n const config = Object.values(targets).find(\n (config) =>\n config.executor === '@nrwl/nx:build' ||\n config.executor === '@nrwl/vite:build'\n );\n viteConfigPath = config?.options?.configFile;\n }\n\n return normalizeViteConfigFilePathWithTree(tree, root, viteConfigPath);\n}\n\nexport async function handleUnsupportedUserProvidedTargets(\n userProvidedTargetIsUnsupported: TargetFlags,\n userProvidedTargetName: UserProvidedTargetName,\n validFoundTargetName: ValidFoundTargetName\n) {\n if (userProvidedTargetIsUnsupported.build && validFoundTargetName.build) {\n await handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName.build,\n validFoundTargetName.build,\n 'build',\n 'build'\n );\n }\n\n if (userProvidedTargetIsUnsupported.serve && validFoundTargetName.serve) {\n await handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName.serve,\n validFoundTargetName.serve,\n 'serve',\n 'dev-server'\n );\n }\n\n if (userProvidedTargetIsUnsupported.test && validFoundTargetName.test) {\n await handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName.test,\n validFoundTargetName.test,\n 'test',\n 'test'\n );\n }\n}\n\nasync function handleUnsupportedUserProvidedTargetsErrors(\n userProvidedTargetName: string,\n validFoundTargetName: string,\n target: Target,\n executor: 'build' | 'dev-server' | 'test'\n) {\n logger.warn(\n `The custom ${target} target you provided (${userProvidedTargetName}) cannot be converted to use the @nx/vite:${executor} executor.\n However, we found the following ${target} target in your project that can be converted: ${validFoundTargetName}\n\n Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit\n your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.\n `\n );\n const { Confirm } = require('enquirer');\n const prompt = new Confirm({\n name: 'question',\n message: `Should we convert the ${validFoundTargetName} target to use the @nx/vite:${executor} executor?`,\n initial: true,\n });\n const shouldConvert = await prompt.run();\n if (!shouldConvert) {\n throw new Error(\n `The ${target} target ${userProvidedTargetName} cannot be converted to use the @nx/vite:${executor} executor.\n Please try again, either by providing a different ${target} target or by not providing a target at all (Nx will\n convert the first one it finds, most probably this one: ${validFoundTargetName})\n\n Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit\n your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.\n `\n );\n }\n}\n\nexport async function handleUnknownConfiguration(projectName: string) {\n if (process.env.NX_INTERACTIVE === 'false') {\n return;\n }\n\n logger.warn(\n `\n We could not find any configuration in project ${projectName} that \n indicates whether we can definitely convert to Vite.\n \n If you still want to convert your project to use Vite,\n please make sure to commit your changes before running this generator.\n `\n );\n\n const { Confirm } = require('enquirer');\n const prompt = new Confirm({\n name: 'question',\n message: `Should Nx convert your project to use Vite?`,\n initial: true,\n });\n const shouldConvert = await prompt.run();\n if (!shouldConvert) {\n throw new Error(`\n Nx could not verify that your project can be converted to use Vite.\n Please try again with a different project.\n `);\n }\n}\n\nfunction handleViteConfigFileExists(\n tree: Tree,\n viteConfigPath: string,\n options: ViteConfigFileOptions,\n buildOption: string,\n buildOutDir: string,\n imports: string[],\n plugins: string[],\n testOption: string,\n reportsDirectory: string,\n cacheDir: string,\n projectRoot: string,\n offsetFromRoot: string,\n projectAlreadyHasViteTargets?: TargetFlags\n) {\n if (\n projectAlreadyHasViteTargets?.build &&\n projectAlreadyHasViteTargets?.test\n ) {\n return;\n }\n\n if (process.env.NX_VERBOSE_LOGGING === 'true') {\n logger.info(\n `vite.config.ts already exists for project ${options.project}.`\n );\n }\n\n const buildOptionObject = options.includeLib\n ? {\n lib: {\n entry: 'src/index.ts',\n name: options.project,\n fileName: 'index',\n formats: ['es'],\n },\n rollupOptions: {\n external: options.rollupOptionsExternal ?? [],\n },\n outDir: buildOutDir,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n }\n : {\n outDir: buildOutDir,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n };\n\n const testOptionObject = {\n globals: true,\n environment: options.testEnvironment ?? 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n reporters: ['default'],\n coverage: {\n reportsDirectory: reportsDirectory,\n provider: `${options.coverageProvider ?? 'v8'}`,\n },\n };\n\n const changed = ensureViteConfigIsCorrect(\n tree,\n viteConfigPath,\n buildOption,\n buildOptionObject,\n imports,\n plugins,\n testOption,\n testOptionObject,\n cacheDir,\n projectAlreadyHasViteTargets ?? {}\n );\n\n if (!changed) {\n logger.warn(\n `Make sure the following setting exists in your Vite configuration file (${viteConfigPath}):\n \n ${buildOption}\n \n `\n );\n }\n}\n\nfunction normalizedJoinPaths(...paths: string[]): string {\n const path = joinPathFragments(...paths);\n\n return path.startsWith('.') ? path : `./${path}`;\n}\n"],"names":["addBuildTarget","addOrChangeTestTarget","addPreviewTarget","addServeTarget","createOrEditViteConfig","deleteWebpackConfig","editTsConfig","findExistingJsBuildTargetInProject","getViteConfigPathForProject","handleUnknownConfiguration","handleUnsupportedUserProvidedTargets","moveAndEditIndexHtml","normalizeViteConfigFilePathWithTree","targets","output","supportedExecutors","build","unsupportedExecutors","target","executorName","executor","includes","supported","unsupported","tree","options","hasPlugin","nxJson","project","readNxJson","plugins","some","p","plugin","readProjectConfiguration","testTarget","reportsDirectory","joinPathFragments","offsetFromRoot","root","testOptions","Error","outputs","updateProjectConfiguration","addBuildTargetDefaults","isTsSolutionSetup","isUsingTsSolutionSetup","buildOptions","outputPath","defaultConfiguration","configurations","development","mode","production","buildTarget","hmr","serveTarget","previewOptions","proxyConfig","https","open","preview","dependsOn","projectConfig","tsconfigPath","find","exists","config","readJson","uiFramework","compilerOptions","jsx","allowJs","esModuleInterop","allowSyntheticDefaultImports","strict","module","forceConsistentCasingInFileNames","noImplicitOverride","noPropertyAccessFromIndexSignature","noImplicitReturns","noFallthroughCasesInSwitch","writeJson","projectRoot","webpackConfigFilePath","webpackConfigPath","delete","indexHtmlPath","mainPath","replace","indexHtmlContent","read","write","onlyVitest","projectAlreadyHasViteTargets","vitestFileName","extension","useEsmExtension","viteConfigPath","isUsingTsPlugin","buildOutDir","buildOption","includeLib","rollupOptionsExternal","imports","push","testOption","includeVitest","testEnvironment","setupFile","inSourceTests","coverageProvider","defineOption","devServerOption","previewServerOption","workerOption","cacheDir","normalizedJoinPaths","handleViteConfigFileExists","viteConfigContent","join","length","printOptions","filter","Boolean","configFile","undefined","projectName","Object","values","userProvidedTargetIsUnsupported","userProvidedTargetName","validFoundTargetName","handleUnsupportedUserProvidedTargetsErrors","serve","test","logger","warn","Confirm","require","prompt","name","message","initial","shouldConvert","run","process","env","NX_INTERACTIVE","NX_VERBOSE_LOGGING","info","buildOptionObject","lib","entry","fileName","formats","rollupOptions","external","outDir","reportCompressedSize","commonjsOptions","transformMixedEsModules","testOptionObject","globals","environment","include","reporters","coverage","provider","changed","ensureViteConfigIsCorrect","paths","path","startsWith"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,sBAAsB;QACtBC,iBAAiB;YACfC,yBAAyB;QAC3B;IACF;QAIWxI,0BAKEA;IAPjB,MAAMyI,mBAAmB;QACvBC,SAAS;QACTC,aAAa3I,CAAAA,2BAAAA,QAAQmF,eAAe,YAAvBnF,2BAA2B;QACxC4I,SAAS;YAAC;SAAuD;QACjEC,WAAW;YAAC;SAAU;QACtBC,UAAU;YACRnI,kBAAkBA;YAClBoI,UAAU,CAAC,EAAE/I,CAAAA,4BAAAA,QAAQsF,gBAAgB,YAAxBtF,4BAA4B,KAAK,CAAC;QACjD;IACF;IAEA,MAAMgJ,UAAUC,IAAAA,8CAAyB,EACvClJ,MACA0E,gBACAG,aACAkD,mBACA/C,SACA1E,SACA4E,YACAwD,kBACA9C,UACAtB,uCAAAA,+BAAgC,CAAC;IAGnC,IAAI,CAAC2E,SAAS;QACZjC,cAAM,CAACC,IAAI,CACT,CAAC,wEAAwE,EAAEvC,eAAe;;QAExF,EAAEG,YAAY;;QAEd,CAAC;IAEP;AACF;AAEA,SAASgB,oBAAoB,GAAGsD,KAAe;IAC7C,MAAMC,OAAOvI,IAAAA,yBAAiB,KAAIsI;IAElC,OAAOC,KAAKC,UAAU,CAAC,OAAOD,OAAO,CAAC,EAAE,EAAEA,KAAK,CAAC;AAClD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "findFile", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: function() {
|
|
5
|
+
return findFile;
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const _nodefs = require("node:fs");
|
|
9
|
+
const _nodepath = require("node:path");
|
|
10
|
+
function findFile(path, extensions, existsSyncImpl = _nodefs.existsSync) {
|
|
11
|
+
const queryLessPath = path.replace(/\?\S*$/, '');
|
|
12
|
+
for (const ext of extensions){
|
|
13
|
+
const dir = (0, _nodepath.dirname)(path);
|
|
14
|
+
// Support file extensions such as .css and .js in the import path.
|
|
15
|
+
// While still allowing for '.suffix'
|
|
16
|
+
const name = (0, _nodepath.basename)(queryLessPath, ext);
|
|
17
|
+
const resolvedPath = (0, _nodepath.resolve)(dir, name + ext);
|
|
18
|
+
if (existsSyncImpl(resolvedPath)) {
|
|
19
|
+
return resolvedPath;
|
|
20
|
+
}
|
|
21
|
+
const resolvedIndexPath = (0, _nodepath.resolve)(path, `index${ext}`);
|
|
22
|
+
if (existsSyncImpl(resolvedIndexPath)) {
|
|
23
|
+
return resolvedIndexPath;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=nx-tsconfig-paths-find-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/nx-tsconfig-paths-find-file.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { resolve, basename, dirname } from 'node:path';\n\nexport function findFile(\n path: string,\n extensions: string[],\n existsSyncImpl: typeof existsSync = existsSync\n): string {\n const queryLessPath = path.replace(/\\?\\S*$/, '');\n\n for (const ext of extensions) {\n const dir = dirname(path);\n // Support file extensions such as .css and .js in the import path.\n // While still allowing for '.suffix'\n const name = basename(queryLessPath, ext);\n\n const resolvedPath = resolve(dir, name + ext);\n if (existsSyncImpl(resolvedPath)) {\n return resolvedPath;\n }\n\n const resolvedIndexPath = resolve(path, `index${ext}`);\n if (existsSyncImpl(resolvedIndexPath)) {\n return resolvedIndexPath;\n }\n }\n}\n"],"names":["findFile","path","extensions","existsSyncImpl","existsSync","queryLessPath","replace","ext","dir","dirname","name","basename","resolvedPath","resolve","resolvedIndexPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BAGgBA;;;eAAAA;;;wBAHW;0BACgB;AAEpC,SAASA,SACdC,IAAY,EACZC,UAAoB,EACpBC,iBAAoCC,kBAAU;IAE9C,MAAMC,gBAAgBJ,KAAKK,OAAO,CAAC,UAAU;IAE7C,KAAK,MAAMC,OAAOL,WAAY;QAC5B,MAAMM,MAAMC,IAAAA,iBAAO,EAACR;QACpB,mEAAmE;QACnE,qCAAqC;QACrC,MAAMS,OAAOC,IAAAA,kBAAQ,EAACN,eAAeE;QAErC,MAAMK,eAAeC,IAAAA,iBAAO,EAACL,KAAKE,OAAOH;QACzC,IAAIJ,eAAeS,eAAe;YAChC,OAAOA;QACT;QAEA,MAAME,oBAAoBD,IAAAA,iBAAO,EAACZ,MAAM,CAAC,KAAK,EAAEM,IAAI,CAAC;QACrD,IAAIJ,eAAeW,oBAAoB;YACrC,OAAOA;QACT;IACF;AACF"}
|
package/src/utils/test-utils.js
CHANGED
|
@@ -358,6 +358,77 @@ function mockAngularAppGenerator(tree) {
|
|
|
358
358
|
root: `apps/${appName}`,
|
|
359
359
|
projectType: 'application'
|
|
360
360
|
}));
|
|
361
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/tsconfig.json`, {
|
|
362
|
+
compilerOptions: {
|
|
363
|
+
target: 'es2022',
|
|
364
|
+
esModuleInterop: true,
|
|
365
|
+
forceConsistentCasingInFileNames: true,
|
|
366
|
+
strict: true,
|
|
367
|
+
noImplicitOverride: true,
|
|
368
|
+
noPropertyAccessFromIndexSignature: true,
|
|
369
|
+
noImplicitReturns: true,
|
|
370
|
+
noFallthroughCasesInSwitch: true
|
|
371
|
+
},
|
|
372
|
+
files: [],
|
|
373
|
+
include: [],
|
|
374
|
+
references: [
|
|
375
|
+
{
|
|
376
|
+
path: './tsconfig.editor.json'
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
path: './tsconfig.app.json'
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
path: './tsconfig.spec.json'
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
extends: '../../tsconfig.base.json',
|
|
386
|
+
angularCompilerOptions: {
|
|
387
|
+
enableI18nLegacyMessageIdFormat: false,
|
|
388
|
+
strictInjectionParameters: true,
|
|
389
|
+
strictInputAccessModifiers: true,
|
|
390
|
+
strictTemplates: true
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/tsconfig.app.json`, {
|
|
394
|
+
extends: './tsconfig.json',
|
|
395
|
+
compilerOptions: {
|
|
396
|
+
outDir: '../../dist/out-tsc',
|
|
397
|
+
types: []
|
|
398
|
+
},
|
|
399
|
+
files: [
|
|
400
|
+
'src/main.ts'
|
|
401
|
+
],
|
|
402
|
+
include: [
|
|
403
|
+
'src/**/*.d.ts'
|
|
404
|
+
],
|
|
405
|
+
exclude: [
|
|
406
|
+
'jest.config.ts',
|
|
407
|
+
'src/**/*.test.ts',
|
|
408
|
+
'src/**/*.spec.ts'
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/tsconfig.spec.json`, {
|
|
412
|
+
extends: './tsconfig.json',
|
|
413
|
+
compilerOptions: {
|
|
414
|
+
outDir: '../../dist/out-tsc',
|
|
415
|
+
module: 'commonjs',
|
|
416
|
+
target: 'es2016',
|
|
417
|
+
types: [
|
|
418
|
+
'jest',
|
|
419
|
+
'node'
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
files: [
|
|
423
|
+
'src/test-setup.ts'
|
|
424
|
+
],
|
|
425
|
+
include: [
|
|
426
|
+
'jest.config.ts',
|
|
427
|
+
'src/**/*.test.ts',
|
|
428
|
+
'src/**/*.spec.ts',
|
|
429
|
+
'src/**/*.d.ts'
|
|
430
|
+
]
|
|
431
|
+
});
|
|
361
432
|
return tree;
|
|
362
433
|
}
|
|
363
434
|
function mockUnknownAppGenerator(tree) {
|
|
@@ -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\n cacheDir: '../../node_modules/.vitest',\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 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 cacheDir: '../../node_modules/.vitest',\n plugins: [\n nxViteTsPaths(),\n react(),\n ],\n\n test: {\n globals: true,\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","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AAE,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
|
+
{"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\n cacheDir: '../../node_modules/.vitest',\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 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 writeJson(tree, `apps/${appName}/tsconfig.json`, {\n compilerOptions: {\n target: 'es2022',\n esModuleInterop: 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.editor.json',\n },\n {\n path: './tsconfig.app.json',\n },\n {\n path: './tsconfig.spec.json',\n },\n ],\n extends: '../../tsconfig.base.json',\n angularCompilerOptions: {\n enableI18nLegacyMessageIdFormat: false,\n strictInjectionParameters: true,\n strictInputAccessModifiers: true,\n strictTemplates: true,\n },\n });\n\n writeJson(tree, `apps/${appName}/tsconfig.app.json`, {\n extends: './tsconfig.json',\n compilerOptions: {\n outDir: '../../dist/out-tsc',\n types: [],\n },\n files: ['src/main.ts'],\n include: ['src/**/*.d.ts'],\n exclude: ['jest.config.ts', 'src/**/*.test.ts', 'src/**/*.spec.ts'],\n });\n\n writeJson(tree, `apps/${appName}/tsconfig.spec.json`, {\n extends: './tsconfig.json',\n compilerOptions: {\n outDir: '../../dist/out-tsc',\n module: 'commonjs',\n target: 'es2016',\n types: ['jest', 'node'],\n },\n files: ['src/test-setup.ts'],\n include: [\n 'jest.config.ts',\n 'src/**/*.test.ts',\n 'src/**/*.spec.ts',\n 'src/**/*.d.ts',\n ],\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 cacheDir: '../../node_modules/.vitest',\n plugins: [\n nxViteTsPaths(),\n react(),\n ],\n\n test: {\n globals: true,\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","compilerOptions","target","esModuleInterop","forceConsistentCasingInFileNames","strict","noImplicitOverride","noPropertyAccessFromIndexSignature","noImplicitReturns","noFallthroughCasesInSwitch","files","include","references","path","extends","angularCompilerOptions","enableI18nLegacyMessageIdFormat","strictInjectionParameters","strictInputAccessModifiers","strictTemplates","outDir","types","exclude","module","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAsYgBA,uBAAuB;eAAvBA;;IA5PAC,qBAAqB;eAArBA;;IAqWAC,+CAA+C;eAA/CA;;IA4EAC,6CAA6C;eAA7CA;;IAtVAC,0BAA0B;eAA1BA;;IAoPAC,uBAAuB;eAAvBA;;I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AqBA,CAAC;IAGJhC,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,CAAC,CAAC,EAAE+B,QAAQ,CAAC,CAAC,EAAE,eACXE;gBACH/B,MAAM,CAAC,KAAK,EAAE6B,QAAQ,CAAC;gBACvB5B,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EAACH,MAAM,CAAC,KAAK,EAAEmC,QAAQ,aAAa,CAAC,EAAE,eAC3CE;QACH/B,MAAM,CAAC,KAAK,EAAE6B,QAAQ,CAAC;QACvB5B,aAAa;;IAGf,OAAOP;AACT"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare const jsdomVersion = "~22.1.0";
|
|
|
7
7
|
export declare const vitePluginDtsVersion = "~3.8.1";
|
|
8
8
|
export declare const happyDomVersion = "~9.20.3";
|
|
9
9
|
export declare const edgeRuntimeVmVersion = "~3.0.2";
|
|
10
|
+
export declare const analogVitestAngular = "~1.10.0";
|
|
10
11
|
export declare const vitestCoverageV8Version = "^1.0.4";
|
|
11
12
|
export declare const vitestCoverageIstanbulVersion = "^1.0.4";
|
package/src/utils/versions.js
CHANGED
|
@@ -6,6 +6,9 @@ function _export(target, all) {
|
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
8
|
_export(exports, {
|
|
9
|
+
analogVitestAngular: function() {
|
|
10
|
+
return analogVitestAngular;
|
|
11
|
+
},
|
|
9
12
|
edgeRuntimeVmVersion: function() {
|
|
10
13
|
return edgeRuntimeVmVersion;
|
|
11
14
|
},
|
|
@@ -49,6 +52,7 @@ const jsdomVersion = '~22.1.0';
|
|
|
49
52
|
const vitePluginDtsVersion = '~3.8.1';
|
|
50
53
|
const happyDomVersion = '~9.20.3';
|
|
51
54
|
const edgeRuntimeVmVersion = '~3.0.2';
|
|
55
|
+
const analogVitestAngular = '~1.10.0';
|
|
52
56
|
const vitestCoverageV8Version = '^1.0.4';
|
|
53
57
|
const vitestCoverageIstanbulVersion = '^1.0.4';
|
|
54
58
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\n// Also update @nx/remix/utils/versions when changing vite 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":"
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\n// Also update @nx/remix/utils/versions when changing vite 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\nexport const analogVitestAngular = '~1.10.0';\n\n// Coverage providers\nexport const vitestCoverageV8Version = '^1.0.4';\nexport const vitestCoverageIstanbulVersion = '^1.0.4';\n"],"names":["analogVitestAngular","edgeRuntimeVmVersion","happyDomVersion","jsdomVersion","nxVersion","vitePluginDtsVersion","vitePluginReactSwcVersion","vitePluginReactVersion","viteVersion","vitestCoverageIstanbulVersion","vitestCoverageV8Version","vitestVersion","require","version"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAWaA,mBAAmB;eAAnBA;;IAFAC,oBAAoB;eAApBA;;IADAC,eAAe;eAAfA;;IAFAC,YAAY;eAAZA;;IANAC,SAAS;eAATA;;IAOAC,oBAAoB;eAApBA;;IAFAC,yBAAyB;eAAzBA;;IADAC,sBAAsB;eAAtBA;;IAFAC,WAAW;eAAXA;;IAaAC,6BAA6B;eAA7BA;;IADAC,uBAAuB;eAAvBA;;IAXAC,aAAa;eAAbA;;;AAHN,MAAMP,YAAYQ,QAAQ,sBAAsBC,OAAO;AAEvD,MAAML,cAAc;AACpB,MAAMG,gBAAgB;AACtB,MAAMJ,yBAAyB;AAC/B,MAAMD,4BAA4B;AAClC,MAAMH,eAAe;AACrB,MAAME,uBAAuB;AAC7B,MAAMH,kBAAkB;AACxB,MAAMD,uBAAuB;AAE7B,MAAMD,sBAAsB;AAG5B,MAAMU,0BAA0B;AAChC,MAAMD,gCAAgC"}
|