@nx/vite 19.5.2 → 19.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/plugins/nx-tsconfig-paths.plugin.js +3 -0
- package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
- package/src/executors/build/build.impl.js +3 -1
- package/src/executors/build/build.impl.js.map +1 -1
- package/src/executors/test/lib/utils.d.ts +4 -1
- package/src/executors/test/lib/utils.js +5 -2
- package/src/executors/test/lib/utils.js.map +1 -1
- package/src/executors/test/vitest.impl.js +4 -2
- package/src/executors/test/vitest.impl.js.map +1 -1
- package/src/utils/generator-utils.js +0 -3
- package/src/utils/generator-utils.js.map +1 -1
- package/src/utils/test-files/test-vite-configs.d.ts +5 -8
- package/src/utils/test-files/test-vite-configs.js +5 -18
- package/src/utils/test-files/test-vite-configs.js.map +1 -1
- package/src/utils/test-utils.js +3 -6
- package/src/utils/test-utils.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "19.5.
|
|
3
|
+
"version": "19.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "19.5.
|
|
33
|
+
"@nx/devkit": "19.5.4",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"@swc/helpers": "~0.5.0",
|
|
36
36
|
"enquirer": "~2.3.6",
|
|
37
|
-
"@nx/js": "19.5.
|
|
37
|
+
"@nx/js": "19.5.4",
|
|
38
38
|
"tsconfig-paths": "^4.1.2",
|
|
39
|
-
"@nrwl/vite": "19.5.
|
|
39
|
+
"@nrwl/vite": "19.5.4"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"vite": "^5.0.0",
|
|
@@ -42,6 +42,9 @@ function nxViteTsPaths(options = {}) {
|
|
|
42
42
|
let projectRoot = '';
|
|
43
43
|
return {
|
|
44
44
|
name: 'nx-vite-ts-paths',
|
|
45
|
+
// Ensure the resolveId aspect of the plugin is called before vite's internal resolver
|
|
46
|
+
// Otherwise, issues can arise with Yarn Workspaces and Pnpm Workspaces
|
|
47
|
+
enforce: 'pre',
|
|
45
48
|
async configResolved (config) {
|
|
46
49
|
projectRoot = config.root;
|
|
47
50
|
const projectRootFromWorkspaceRoot = (0, _nodepath.relative)(_devkit.workspaceRoot, projectRoot);
|
|
@@ -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 { relative, join, 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';\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 '.mjs',\n '.cjs',\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 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 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 const resolvedPath = resolve(path + 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","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","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","resolvedIndexPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BA+CgBA;;;eAAAA;;;wBA1CT;wBACkC;0BACD;+BAMjC;oCAIA;+CAEuC;AA4BvC,SAASA,cAAcC,UAAgC,CAAC,CAAC;QAM9DA,UASAA,WACAA;IAfA,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;;IAEJJ,gBAAAA,WAAAA,SAAQK,oCAARL,SAAQK,aAAe;QACrB;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,MAAMC,gBAAeC,MAAW;YAC9BH,cAAcG,OAAOC,IAAI;YACzB,MAAM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AAK,CAAC,EAAE,CAAC6B,OAAO,CAAC,SAAS;gBAG5BxB,eAAe4B,SACb7B,WAAWyB,OAAO,CAACD,kBAAkBG;YAEzC;QACF;QAEA,OAAO1B;IACT;IAEA,SAAS4B,SAASC,IAAY;QAC5B,KAAK,MAAMC,OAAOzF,QAAQK,UAAU,CAAE;YACpC,MAAMqF,eAAexB,IAAAA,iBAAO,EAACsB,OAAOC;YACpC,IAAItB,IAAAA,kBAAU,EAACuB,eAAe;gBAC5B,OAAOA;YACT;YAEA,MAAMC,oBAAoBzB,IAAAA,iBAAO,EAACsB,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC;YACrD,IAAItB,IAAAA,kBAAU,EAACwB,oBAAoB;gBACjC,OAAOA;YACT;QACF;IACF;AACF"}
|
|
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 { relative, join, 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';\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 '.mjs',\n '.cjs',\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 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 const resolvedPath = resolve(path + 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","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","resolvedIndexPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";+BA+CgBA;;;eAAAA;;;wBA1CT;wBACkC;0BACD;+BAMjC;oCAIA;+CAEuC;AA4BvC,SAASA,cAAcC,UAAgC,CAAC,CAAC;QAM9DA,UASAA,WACAA;IAfA,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;;IAEJJ,gBAAAA,WAAAA,SAAQK,oCAARL,SAAQK,aAAe;QACrB;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,U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;YAEnC,MAAMC,mBAAmBD,MAAME,OAAO,CAAC,SAAS;YAEhD,IAAIzB,WAAW0B,UAAU,CAACF,mBAAmB;gBAC3C,MAAMG,aAAaC,IAAAA,yBAAiB,EAClCP,SAAS1B,eAAe,EACxBC,KAAK,CAAC,EAAE,CAAC6B,OAAO,CAAC,SAAS;gBAG5BxB,eAAe4B,SACb7B,WAAWyB,OAAO,CAACD,kBAAkBG;YAEzC;QACF;QAEA,OAAO1B;IACT;IAEA,SAAS4B,SAASC,IAAY;QAC5B,KAAK,MAAMC,OAAO1F,QAAQK,UAAU,CAAE;YACpC,MAAMsF,eAAexB,IAAAA,iBAAO,EAACsB,OAAOC;YACpC,IAAItB,IAAAA,kBAAU,EAACuB,eAAe;gBAC5B,OAAOA;YACT;YAEA,MAAMC,oBAAoBzB,IAAAA,iBAAO,EAACsB,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC;YACrD,IAAItB,IAAAA,kBAAU,EAACwB,oBAAoB;gBACjC,OAAOA;YACT;QACF;IACF;AACF"}
|
|
@@ -69,6 +69,7 @@ async function* viteBuildExecutor(options, context) {
|
|
|
69
69
|
const distPackageJson = (0, _path.resolve)(outDirRelativeToWorkspaceRoot, 'package.json');
|
|
70
70
|
// Generate a package.json if option has been set.
|
|
71
71
|
if (options.generatePackageJson) {
|
|
72
|
+
var _builtPackageJson;
|
|
72
73
|
if (context.projectGraph.nodes[context.projectName].type !== 'app') {
|
|
73
74
|
_devkit.logger.warn((0, _devkit.stripIndents)`The project ${context.projectName} is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.
|
|
74
75
|
For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/nx-api/eslint-plugin/documents/dependency-checks).`);
|
|
@@ -78,7 +79,8 @@ async function* viteBuildExecutor(options, context) {
|
|
|
78
79
|
root: context.root,
|
|
79
80
|
isProduction: !options.includeDevDependenciesInPackageJson
|
|
80
81
|
});
|
|
81
|
-
|
|
82
|
+
var _type;
|
|
83
|
+
(_type = (_builtPackageJson = builtPackageJson).type) != null ? _type : _builtPackageJson.type = 'module';
|
|
82
84
|
(0, _devkit.writeJsonFile)(`${outDirRelativeToWorkspaceRoot}/package.json`, builtPackageJson);
|
|
83
85
|
const packageManager = (0, _devkit.detectPackageManager)(context.root);
|
|
84
86
|
const lockFile = (0, _js.createLockFile)(builtPackageJson, context.projectGraph, packageManager);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"sourcesContent":["import {\n detectPackageManager,\n ExecutorContext,\n joinPathFragments,\n logger,\n offsetFromRoot,\n stripIndents,\n writeJsonFile,\n} from '@nx/devkit';\nimport {\n getProjectTsConfigPath,\n normalizeViteConfigFilePath,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from './schema';\nimport {\n copyAssets,\n createLockFile,\n createPackageJson,\n getLockFileName,\n} from '@nx/js';\nimport { existsSync, writeFileSync } from 'fs';\nimport { relative, resolve } from 'path';\nimport { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';\nimport {\n createBuildableTsConfig,\n loadViteDynamicImport,\n validateTypes,\n} from '../../utils/executor-utils';\nimport { type Plugin } from 'vite';\n\nexport async function* viteBuildExecutor(\n options: Record<string, any> & ViteBuildExecutorOptions,\n context: ExecutorContext\n) {\n process.env.VITE_CJS_IGNORE_WARNING = 'true';\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, build, loadConfigFromFile } =\n await loadViteDynamicImport();\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n const tsConfigForBuild = createBuildableTsConfig(\n projectRoot,\n options,\n context\n );\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { buildOptions, otherOptions } = await getBuildExtraArgs(options);\n\n const resolved = await loadConfigFromFile(\n {\n mode: otherOptions?.mode ?? 'production',\n command: 'build',\n },\n viteConfigPath\n );\n\n const outDir =\n joinPathFragments(offsetFromRoot(projectRoot), options.outputPath) ??\n resolved?.config?.build?.outDir;\n\n const buildConfig = mergeConfig(\n {\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n configFile: viteConfigPath,\n },\n {\n build: {\n outDir,\n ...buildOptions,\n },\n ...otherOptions,\n }\n );\n\n if (!options.skipTypeCheck) {\n await validateTypes({\n workspaceRoot: context.root,\n tsconfig: tsConfigForBuild,\n isVueProject: Boolean(\n resolved.config.plugins?.find(\n (plugin: Plugin) =>\n typeof plugin === 'object' && plugin?.name === 'vite:vue'\n )\n ),\n });\n }\n\n const watcherOrOutput = await build(buildConfig);\n\n const libraryPackageJson = resolve(projectRoot, 'package.json');\n const rootPackageJson = resolve(context.root, 'package.json');\n\n // Here, we want the outdir relative to the workspace root.\n // So, we calculate the relative path from the workspace root to the outdir.\n const outDirRelativeToWorkspaceRoot = outDir.replaceAll('../', '');\n const distPackageJson = resolve(\n outDirRelativeToWorkspaceRoot,\n 'package.json'\n );\n\n // Generate a package.json if option has been set.\n if (options.generatePackageJson) {\n if (context.projectGraph.nodes[context.projectName].type !== 'app') {\n logger.warn(\n stripIndents`The project ${context.projectName} is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.\n For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/nx-api/eslint-plugin/documents/dependency-checks).`\n );\n }\n\n const builtPackageJson = createPackageJson(\n context.projectName,\n context.projectGraph,\n {\n target: context.targetName,\n root: context.root,\n isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.\n }\n );\n\n builtPackageJson.type = 'module';\n\n writeJsonFile(\n `${outDirRelativeToWorkspaceRoot}/package.json`,\n builtPackageJson\n );\n const packageManager = detectPackageManager(context.root);\n\n const lockFile = createLockFile(\n builtPackageJson,\n context.projectGraph,\n packageManager\n );\n writeFileSync(\n `${outDirRelativeToWorkspaceRoot}/${getLockFileName(packageManager)}`,\n lockFile,\n {\n encoding: 'utf-8',\n }\n );\n }\n // For buildable libs, copy package.json if it exists.\n else if (\n options.generatePackageJson !== false &&\n !existsSync(distPackageJson) &&\n existsSync(libraryPackageJson) &&\n rootPackageJson !== libraryPackageJson\n ) {\n await copyAssets(\n {\n outputPath: outDirRelativeToWorkspaceRoot,\n assets: [\n {\n input: projectRoot,\n output: '.',\n glob: 'package.json',\n },\n ],\n },\n context\n );\n }\n\n if ('on' in watcherOrOutput) {\n const iterable = createAsyncIterable<{ success: boolean }>(({ next }) => {\n let success = true;\n watcherOrOutput.on('event', (event) => {\n if (event.code === 'START') {\n success = true;\n } else if (event.code === 'ERROR') {\n success = false;\n } else if (event.code === 'END') {\n next({ success });\n }\n // result must be closed when present.\n // see https://rollupjs.org/guide/en/#rollupwatch\n if ('result' in event && event.result) {\n event.result.close();\n }\n });\n });\n yield* iterable;\n } else {\n const output = watcherOrOutput?.['output'] || watcherOrOutput?.[0]?.output;\n const fileName = output?.[0]?.fileName || 'main.cjs';\n const outfile = resolve(outDirRelativeToWorkspaceRoot, fileName);\n yield { success: true, outfile };\n }\n}\n\nexport async function getBuildExtraArgs(\n options: ViteBuildExecutorOptions\n): Promise<{\n // vite BuildOptions\n buildOptions: Record<string, unknown>;\n otherOptions: Record<string, any>;\n}> {\n // support passing extra args to vite cli\n const schema = await import('./schema.json');\n const extraArgs = {};\n for (const key of Object.keys(options)) {\n if (!schema.properties[key]) {\n extraArgs[key] = options[key];\n }\n }\n\n const buildOptions = {};\n const buildSchemaKeys = [\n 'target',\n 'polyfillModulePreload',\n 'modulePreload',\n 'outDir',\n 'assetsDir',\n 'assetsInlineLimit',\n 'cssCodeSplit',\n 'cssTarget',\n 'cssMinify',\n 'sourcemap',\n 'minify',\n 'terserOptions',\n 'rollupOptions',\n 'commonjsOptions',\n 'dynamicImportVarsOptions',\n 'write',\n 'emptyOutDir',\n 'copyPublicDir',\n 'manifest',\n 'lib',\n 'ssr',\n 'ssrManifest',\n 'ssrEmitAssets',\n 'reportCompressedSize',\n 'chunkSizeWarningLimit',\n 'watch',\n ];\n const otherOptions = {};\n for (const key of Object.keys(extraArgs)) {\n if (buildSchemaKeys.includes(key)) {\n buildOptions[key] = extraArgs[key];\n } else {\n otherOptions[key] = extraArgs[key];\n }\n }\n\n buildOptions['watch'] = options.watch ?? undefined;\n\n return {\n buildOptions,\n otherOptions,\n };\n}\n\nexport default viteBuildExecutor;\n"],"names":["getBuildExtraArgs","viteBuildExecutor","options","context","resolved","process","env","VITE_CJS_IGNORE_WARNING","mergeConfig","build","loadConfigFromFile","loadViteDynamicImport","projectRoot","projectsConfigurations","projects","projectName","root","tsConfigForBuild","createBuildableTsConfig","viteConfigPath","normalizeViteConfigFilePath","configFile","cwd","relative","joinPathFragments","buildOptions","otherOptions","mode","command","outDir","offsetFromRoot","outputPath","config","buildConfig","skipTypeCheck","validateTypes","workspaceRoot","tsconfig","isVueProject","Boolean","plugins","find","plugin","name","watcherOrOutput","libraryPackageJson","resolve","rootPackageJson","outDirRelativeToWorkspaceRoot","replaceAll","distPackageJson","generatePackageJson","projectGraph","nodes","type","logger","warn","stripIndents","builtPackageJson","createPackageJson","target","targetName","isProduction","includeDevDependenciesInPackageJson","writeJsonFile","packageManager","detectPackageManager","lockFile","createLockFile","writeFileSync","getLockFileName","encoding","existsSync","copyAssets","assets","input","output","glob","iterable","createAsyncIterable","next","success","on","event","code","result","close","fileName","outfile","schema","extraArgs","key","Object","keys","properties","buildSchemaKeys","includes","watch","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BgC,MAAM;QAC1E,MAAMW,WAAWX,CAAAA,2BAAAA,WAAAA,MAAQ,CAAC,EAAE,qBAAXA,SAAaW,QAAQ,KAAI;QAC1C,MAAMC,UAAU1C,IAAAA,aAAO,EAACE,+BAA+BuC;QACvD,MAAM;YAAEN,SAAS;YAAMO;QAAQ;IACjC;AACF;AAEO,eAAexF,kBACpBE,OAAiC;IAMjC,yCAAyC;IACzC,MAAMuF,SAAS,MAAM,2BAAA,QAAO;IAC5B,MAAMC,YAAY,CAAC;IACnB,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC3F,SAAU;QACtC,IAAI,CAACuF,OAAOK,UAAU,CAACH,IAAI,EAAE;YAC3BD,SAAS,CAACC,IAAI,GAAGzF,OAAO,CAACyF,IAAI;QAC/B;IACF;IAEA,MAAMlE,eAAe,CAAC;IACtB,MAAMsE,kBAAkB;QACtB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IACD,MAAMrE,eAAe,CAAC;IACtB,KAAK,MAAMiE,OAAOC,OAAOC,IAAI,CAACH,WAAY;QACxC,IAAIK,gBAAgBC,QAAQ,CAACL,MAAM;YACjClE,YAAY,CAACkE,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC,OAAO;YACLjE,YAAY,CAACiE,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC;IACF;QAEwBzF;IAAxBuB,YAAY,CAAC,QAAQ,GAAGvB,CAAAA,iBAAAA,QAAQ+F,KAAK,YAAb/F,iBAAiBgG;IAEzC,OAAO;QACLzE;QACAC;IACF;AACF;MAEA,WAAezB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"sourcesContent":["import {\n detectPackageManager,\n ExecutorContext,\n joinPathFragments,\n logger,\n offsetFromRoot,\n stripIndents,\n writeJsonFile,\n} from '@nx/devkit';\nimport {\n getProjectTsConfigPath,\n normalizeViteConfigFilePath,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from './schema';\nimport {\n copyAssets,\n createLockFile,\n createPackageJson,\n getLockFileName,\n} from '@nx/js';\nimport { existsSync, writeFileSync } from 'fs';\nimport { relative, resolve } from 'path';\nimport { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';\nimport {\n createBuildableTsConfig,\n loadViteDynamicImport,\n validateTypes,\n} from '../../utils/executor-utils';\nimport { type Plugin } from 'vite';\n\nexport async function* viteBuildExecutor(\n options: Record<string, any> & ViteBuildExecutorOptions,\n context: ExecutorContext\n) {\n process.env.VITE_CJS_IGNORE_WARNING = 'true';\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, build, loadConfigFromFile } =\n await loadViteDynamicImport();\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n const tsConfigForBuild = createBuildableTsConfig(\n projectRoot,\n options,\n context\n );\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { buildOptions, otherOptions } = await getBuildExtraArgs(options);\n\n const resolved = await loadConfigFromFile(\n {\n mode: otherOptions?.mode ?? 'production',\n command: 'build',\n },\n viteConfigPath\n );\n\n const outDir =\n joinPathFragments(offsetFromRoot(projectRoot), options.outputPath) ??\n resolved?.config?.build?.outDir;\n\n const buildConfig = mergeConfig(\n {\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n configFile: viteConfigPath,\n },\n {\n build: {\n outDir,\n ...buildOptions,\n },\n ...otherOptions,\n }\n );\n\n if (!options.skipTypeCheck) {\n await validateTypes({\n workspaceRoot: context.root,\n tsconfig: tsConfigForBuild,\n isVueProject: Boolean(\n resolved.config.plugins?.find(\n (plugin: Plugin) =>\n typeof plugin === 'object' && plugin?.name === 'vite:vue'\n )\n ),\n });\n }\n\n const watcherOrOutput = await build(buildConfig);\n\n const libraryPackageJson = resolve(projectRoot, 'package.json');\n const rootPackageJson = resolve(context.root, 'package.json');\n\n // Here, we want the outdir relative to the workspace root.\n // So, we calculate the relative path from the workspace root to the outdir.\n const outDirRelativeToWorkspaceRoot = outDir.replaceAll('../', '');\n const distPackageJson = resolve(\n outDirRelativeToWorkspaceRoot,\n 'package.json'\n );\n\n // Generate a package.json if option has been set.\n if (options.generatePackageJson) {\n if (context.projectGraph.nodes[context.projectName].type !== 'app') {\n logger.warn(\n stripIndents`The project ${context.projectName} is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.\n For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/nx-api/eslint-plugin/documents/dependency-checks).`\n );\n }\n\n const builtPackageJson = createPackageJson(\n context.projectName,\n context.projectGraph,\n {\n target: context.targetName,\n root: context.root,\n isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.\n }\n );\n\n builtPackageJson.type ??= 'module';\n\n writeJsonFile(\n `${outDirRelativeToWorkspaceRoot}/package.json`,\n builtPackageJson\n );\n const packageManager = detectPackageManager(context.root);\n\n const lockFile = createLockFile(\n builtPackageJson,\n context.projectGraph,\n packageManager\n );\n writeFileSync(\n `${outDirRelativeToWorkspaceRoot}/${getLockFileName(packageManager)}`,\n lockFile,\n {\n encoding: 'utf-8',\n }\n );\n }\n // For buildable libs, copy package.json if it exists.\n else if (\n options.generatePackageJson !== false &&\n !existsSync(distPackageJson) &&\n existsSync(libraryPackageJson) &&\n rootPackageJson !== libraryPackageJson\n ) {\n await copyAssets(\n {\n outputPath: outDirRelativeToWorkspaceRoot,\n assets: [\n {\n input: projectRoot,\n output: '.',\n glob: 'package.json',\n },\n ],\n },\n context\n );\n }\n\n if ('on' in watcherOrOutput) {\n const iterable = createAsyncIterable<{ success: boolean }>(({ next }) => {\n let success = true;\n watcherOrOutput.on('event', (event) => {\n if (event.code === 'START') {\n success = true;\n } else if (event.code === 'ERROR') {\n success = false;\n } else if (event.code === 'END') {\n next({ success });\n }\n // result must be closed when present.\n // see https://rollupjs.org/guide/en/#rollupwatch\n if ('result' in event && event.result) {\n event.result.close();\n }\n });\n });\n yield* iterable;\n } else {\n const output = watcherOrOutput?.['output'] || watcherOrOutput?.[0]?.output;\n const fileName = output?.[0]?.fileName || 'main.cjs';\n const outfile = resolve(outDirRelativeToWorkspaceRoot, fileName);\n yield { success: true, outfile };\n }\n}\n\nexport async function getBuildExtraArgs(\n options: ViteBuildExecutorOptions\n): Promise<{\n // vite BuildOptions\n buildOptions: Record<string, unknown>;\n otherOptions: Record<string, any>;\n}> {\n // support passing extra args to vite cli\n const schema = await import('./schema.json');\n const extraArgs = {};\n for (const key of Object.keys(options)) {\n if (!schema.properties[key]) {\n extraArgs[key] = options[key];\n }\n }\n\n const buildOptions = {};\n const buildSchemaKeys = [\n 'target',\n 'polyfillModulePreload',\n 'modulePreload',\n 'outDir',\n 'assetsDir',\n 'assetsInlineLimit',\n 'cssCodeSplit',\n 'cssTarget',\n 'cssMinify',\n 'sourcemap',\n 'minify',\n 'terserOptions',\n 'rollupOptions',\n 'commonjsOptions',\n 'dynamicImportVarsOptions',\n 'write',\n 'emptyOutDir',\n 'copyPublicDir',\n 'manifest',\n 'lib',\n 'ssr',\n 'ssrManifest',\n 'ssrEmitAssets',\n 'reportCompressedSize',\n 'chunkSizeWarningLimit',\n 'watch',\n ];\n const otherOptions = {};\n for (const key of Object.keys(extraArgs)) {\n if (buildSchemaKeys.includes(key)) {\n buildOptions[key] = extraArgs[key];\n } else {\n otherOptions[key] = extraArgs[key];\n }\n }\n\n buildOptions['watch'] = options.watch ?? undefined;\n\n return {\n buildOptions,\n otherOptions,\n };\n}\n\nexport default viteBuildExecutor;\n"],"names":["getBuildExtraArgs","viteBuildExecutor","options","context","resolved","process","env","VITE_CJS_IGNORE_WARNING","mergeConfig","build","loadConfigFromFile","loadViteDynamicImport","projectRoot","projectsConfigurations","projects","projectName","root","tsConfigForBuild","createBuildableTsConfig","viteConfigPath","normalizeViteConfigFilePath","configFile","cwd","relative","joinPathFragments","buildOptions","otherOptions","mode","command","outDir","offsetFromRoot","outputPath","config","buildConfig","skipTypeCheck","validateTypes","workspaceRoot","tsconfig","isVueProject","Boolean","plugins","find","plugin","name","watcherOrOutput","libraryPackageJson","resolve","rootPackageJson","outDirRelativeToWorkspaceRoot","replaceAll","distPackageJson","generatePackageJson","builtPackageJson","projectGraph","nodes","type","logger","warn","stripIndents","createPackageJson","target","targetName","isProduction","includeDevDependenciesInPackageJson","writeJsonFile","packageManager","detectPackageManager","lockFile","createLockFile","writeFileSync","getLockFileName","encoding","existsSync","copyAssets","assets","input","output","glob","iterable","createAsyncIterable","next","success","on","event","code","result","close","fileName","outfile","schema","extraArgs","key","Object","keys","properties","buildSchemaKeys","includes","watch","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAuQA,OAAiC;eAAjC;;IA9DsBA,iBAAiB;eAAjBA;;IA3KCC,iBAAiB;eAAjBA;;;;wBAtBhB;8BAIA;oBAOA;oBACmC;sBACR;+BACE;+BAK7B;AAGA,gBAAgBA,kBACrBC,OAAuD,EACvDC,OAAwB;QAoCtBC,wBAAAA;IAlCFC,QAAQC,GAAG,CAACC,uBAAuB,GAAG;IACtC,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,kBAAkB,EAAE,GAC9C,MAAMC,IAAAA,oCAAqB;IAC7B,MAAMC,cACJT,QAAQU,sBAAsB,CAACC,QAAQ,CAACX,QAAQY,WAAW,CA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OK,UAAU,CAACH,IAAI,EAAE;YAC3BD,SAAS,CAACC,IAAI,GAAGzF,OAAO,CAACyF,IAAI;QAC/B;IACF;IAEA,MAAMlE,eAAe,CAAC;IACtB,MAAMsE,kBAAkB;QACtB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IACD,MAAMrE,eAAe,CAAC;IACtB,KAAK,MAAMiE,OAAOC,OAAOC,IAAI,CAACH,WAAY;QACxC,IAAIK,gBAAgBC,QAAQ,CAACL,MAAM;YACjClE,YAAY,CAACkE,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC,OAAO;YACLjE,YAAY,CAACiE,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC;IACF;QAEwBzF;IAAxBuB,YAAY,CAAC,QAAQ,GAAGvB,CAAAA,iBAAAA,QAAQ+F,KAAK,YAAb/F,iBAAiBgG;IAEzC,OAAO;QACLzE;QACAC;IACF;AACF;MAEA,WAAezB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import { VitestExecutorOptions } from '../schema';
|
|
3
|
-
export declare function getOptions(options: VitestExecutorOptions, context: ExecutorContext, projectRoot: string): Promise<
|
|
3
|
+
export declare function getOptions(options: VitestExecutorOptions, context: ExecutorContext, projectRoot: string): Promise<{
|
|
4
|
+
resolvedOptions: Record<string, any>;
|
|
5
|
+
plugins: import("vite").PluginOption[];
|
|
6
|
+
}>;
|
|
4
7
|
export declare function getOptionsAsArgv(obj: Record<string, any>): string[];
|
|
@@ -20,7 +20,7 @@ const _optionsutils = require("../../../utils/options-utils");
|
|
|
20
20
|
const _path = require("path");
|
|
21
21
|
const _executorutils = require("../../../utils/executor-utils");
|
|
22
22
|
async function getOptions(options, context, projectRoot) {
|
|
23
|
-
var _resolved_config, _resolved_config1;
|
|
23
|
+
var _resolved_config, _resolved_config1, _resolved_config2;
|
|
24
24
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
25
25
|
const { loadConfigFromFile, mergeConfig } = await (0, _executorutils.loadViteDynamicImport)();
|
|
26
26
|
const viteConfigPath = (0, _optionsutils.normalizeViteConfigFilePath)(context.root, projectRoot, options.configFile);
|
|
@@ -65,7 +65,10 @@ async function getOptions(options, context, projectRoot) {
|
|
|
65
65
|
configFile: viteConfigPath
|
|
66
66
|
});
|
|
67
67
|
var _resolved_config_test;
|
|
68
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
resolvedOptions: mergeConfig((_resolved_config_test = resolved == null ? void 0 : (_resolved_config1 = resolved.config) == null ? void 0 : _resolved_config1['test']) != null ? _resolved_config_test : {}, settings),
|
|
70
|
+
plugins: resolved == null ? void 0 : (_resolved_config2 = resolved.config) == null ? void 0 : _resolved_config2.plugins
|
|
71
|
+
};
|
|
69
72
|
}
|
|
70
73
|
function getOptionsAsArgv(obj) {
|
|
71
74
|
const argv = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/vite/src/executors/test/lib/utils.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n logger,\n stripIndents,\n} from '@nx/devkit';\nimport { VitestExecutorOptions } from '../schema';\nimport { normalizeViteConfigFilePath } from '../../../utils/options-utils';\nimport { relative } from 'path';\nimport {\n loadViteDynamicImport,\n loadVitestDynamicImport,\n} from '../../../utils/executor-utils';\n\nexport async function getOptions(\n options: VitestExecutorOptions,\n context: ExecutorContext,\n projectRoot: string\n) {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { loadConfigFromFile, mergeConfig } = await loadViteDynamicImport();\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n\n if (!viteConfigPath) {\n throw new Error(\n stripIndents`\n Unable to load test config from config file ${viteConfigPath}.\n \n Please make sure that vitest is configured correctly, \n or use the @nx/vite:vitest generator to configure it for you.\n You can read more here: https://nx.dev/nx-api/vite/generators/vitest\n `\n );\n }\n\n const resolved = await loadConfigFromFile(\n {\n mode: options?.mode ?? 'production',\n command: 'serve',\n },\n viteConfigPath\n );\n\n if (!viteConfigPath || !resolved?.config?.['test']) {\n logger.warn(stripIndents`Unable to load test config from config file ${\n resolved?.path ?? viteConfigPath\n }\n Some settings may not be applied as expected.\n You can manually set the config in the project, ${\n context.projectName\n }, configuration.\n `);\n }\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { parseCLI } = await loadVitestDynamicImport();\n\n const {\n options: { watch, ...normalizedExtraArgs },\n } = parseCLI(['vitest', ...getOptionsAsArgv(options)]);\n\n const settings = {\n // Explicitly set watch mode to false if not provided otherwise vitest\n // will enable watch mode by default for non CI environments\n watch: watch ?? false,\n ...normalizedExtraArgs,\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n configFile: viteConfigPath,\n };\n\n return mergeConfig(resolved?.config?.['test'] ?? {}, settings);\n}\n\nexport function getOptionsAsArgv(obj: Record<string, any>): string[] {\n const argv: string[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n if (Array.isArray(value)) {\n value.forEach((item) => argv.push(`--${key}=${item}`));\n } else if (typeof value === 'object' && value !== null) {\n argv.push(`--${key}='${JSON.stringify(value)}'`);\n } else {\n argv.push(`--${key}=${value}`);\n }\n }\n\n return argv;\n}\n"],"names":["getOptions","getOptionsAsArgv","options","context","projectRoot","resolved","loadConfigFromFile","mergeConfig","loadViteDynamicImport","viteConfigPath","normalizeViteConfigFilePath","root","configFile","Error","stripIndents","mode","command","config","logger","warn","path","projectName","process","cwd","relative","joinPathFragments","parseCLI","loadVitestDynamicImport","watch","normalizedExtraArgs","settings","obj","argv","key","value","Object","entries","Array","isArray","forEach","item","push","JSON","stringify"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/vite/src/executors/test/lib/utils.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n logger,\n stripIndents,\n} from '@nx/devkit';\nimport { VitestExecutorOptions } from '../schema';\nimport { normalizeViteConfigFilePath } from '../../../utils/options-utils';\nimport { relative } from 'path';\nimport {\n loadViteDynamicImport,\n loadVitestDynamicImport,\n} from '../../../utils/executor-utils';\n\nexport async function getOptions(\n options: VitestExecutorOptions,\n context: ExecutorContext,\n projectRoot: string\n) {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { loadConfigFromFile, mergeConfig } = await loadViteDynamicImport();\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n\n if (!viteConfigPath) {\n throw new Error(\n stripIndents`\n Unable to load test config from config file ${viteConfigPath}.\n \n Please make sure that vitest is configured correctly, \n or use the @nx/vite:vitest generator to configure it for you.\n You can read more here: https://nx.dev/nx-api/vite/generators/vitest\n `\n );\n }\n\n const resolved = await loadConfigFromFile(\n {\n mode: options?.mode ?? 'production',\n command: 'serve',\n },\n viteConfigPath\n );\n\n if (!viteConfigPath || !resolved?.config?.['test']) {\n logger.warn(stripIndents`Unable to load test config from config file ${\n resolved?.path ?? viteConfigPath\n }\n Some settings may not be applied as expected.\n You can manually set the config in the project, ${\n context.projectName\n }, configuration.\n `);\n }\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { parseCLI } = await loadVitestDynamicImport();\n\n const {\n options: { watch, ...normalizedExtraArgs },\n } = parseCLI(['vitest', ...getOptionsAsArgv(options)]);\n\n const settings = {\n // Explicitly set watch mode to false if not provided otherwise vitest\n // will enable watch mode by default for non CI environments\n watch: watch ?? false,\n ...normalizedExtraArgs,\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n configFile: viteConfigPath,\n };\n\n return {\n resolvedOptions: mergeConfig(resolved?.config?.['test'] ?? {}, settings),\n plugins: resolved?.config?.plugins,\n };\n}\n\nexport function getOptionsAsArgv(obj: Record<string, any>): string[] {\n const argv: string[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n if (Array.isArray(value)) {\n value.forEach((item) => argv.push(`--${key}=${item}`));\n } else if (typeof value === 'object' && value !== null) {\n argv.push(`--${key}='${JSON.stringify(value)}'`);\n } else {\n argv.push(`--${key}=${value}`);\n }\n }\n\n return argv;\n}\n"],"names":["getOptions","getOptionsAsArgv","options","context","projectRoot","resolved","loadConfigFromFile","mergeConfig","loadViteDynamicImport","viteConfigPath","normalizeViteConfigFilePath","root","configFile","Error","stripIndents","mode","command","config","logger","warn","path","projectName","process","cwd","relative","joinPathFragments","parseCLI","loadVitestDynamicImport","watch","normalizedExtraArgs","settings","resolvedOptions","plugins","obj","argv","key","value","Object","entries","Array","isArray","forEach","item","push","JSON","stringify"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAcsBA,UAAU;eAAVA;;IAwENC,gBAAgB;eAAhBA;;;;;wBAjFT;8BAEqC;sBACnB;+BAIlB;AAEA,eAAeD,WACpBE,OAA8B,EAC9BC,OAAwB,EACxBC,WAAmB;QA+BKC,kBAiCOA,mBACpBA;IA/DX,yFAAyF;IACzF,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,EAAE,GAAG,MAAMC,IAAAA,oCAAqB;IAEvE,MAAMC,iBAAiBC,IAAAA,yCAA2B,EAChDP,QAAQQ,IAAI,EACZP,aACAF,QAAQU,UAAU;IAGpB,IAAI,CAACH,gBAAgB;QACnB,MAAM,IAAII,MACRC,IAAAA,oBAAY,CAAA,CAAC;oDACiC,EAAEL,eAAe;;;;;QAK7D,CAAC;IAEP;QAIUP;IAFV,MAAMG,WAAW,MAAMC,mBACrB;QACES,MAAMb,CAAA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,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,KAAM;QAC9C,IAAIM,MAAMC,OAAO,CAACJ,QAAQ;YACxBA,MAAMK,OAAO,CAAC,CAACC,OAASR,KAAKS,IAAI,CAAC,CAAC,EAAE,EAAER,IAAI,CAAC,EAAEO,KAAK,CAAC;QACtD,OAAO,IAAI,OAAON,UAAU,YAAYA,UAAU,MAAM;YACtDF,KAAKS,IAAI,CAAC,CAAC,EAAE,EAAER,IAAI,EAAE,EAAES,KAAKC,SAAS,CAACT,OAAO,CAAC,CAAC;QACjD,OAAO;YACLF,KAAKS,IAAI,CAAC,CAAC,EAAE,EAAER,IAAI,CAAC,EAAEC,MAAM,CAAC;QAC/B;IACF;IAEA,OAAOF;AACT"}
|
|
@@ -26,7 +26,7 @@ async function* vitestExecutor(options, context) {
|
|
|
26
26
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
27
27
|
const { startVitest } = await (0, _executorutils.loadVitestDynamicImport)();
|
|
28
28
|
var _ref;
|
|
29
|
-
const resolvedOptions = (_ref = await (0, _utils.getOptions)(options, context, projectRoot)) != null ? _ref : {};
|
|
29
|
+
const { resolvedOptions, plugins } = (_ref = await (0, _utils.getOptions)(options, context, projectRoot)) != null ? _ref : {};
|
|
30
30
|
const watch = resolvedOptions['watch'] === true;
|
|
31
31
|
const nxReporter = new _nxreporter.NxReporter(watch);
|
|
32
32
|
if (resolvedOptions['reporters'] === undefined) {
|
|
@@ -40,7 +40,9 @@ async function* vitestExecutor(options, context) {
|
|
|
40
40
|
var _options_testFiles;
|
|
41
41
|
const cliFilters = (_options_testFiles = options.testFiles) != null ? _options_testFiles : [];
|
|
42
42
|
var _resolvedOptions_mode;
|
|
43
|
-
const ctx = await startVitest((_resolvedOptions_mode = resolvedOptions['mode']) != null ? _resolvedOptions_mode : 'test', cliFilters, resolvedOptions
|
|
43
|
+
const ctx = await startVitest((_resolvedOptions_mode = resolvedOptions['mode']) != null ? _resolvedOptions_mode : 'test', cliFilters, resolvedOptions, {
|
|
44
|
+
plugins
|
|
45
|
+
});
|
|
44
46
|
let hasErrors = false;
|
|
45
47
|
const processExit = ()=>{
|
|
46
48
|
ctx.exit();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/test/vitest.impl.ts"],"sourcesContent":["import { ExecutorContext, workspaceRoot } from '@nx/devkit';\nimport { VitestExecutorOptions } from './schema';\nimport { resolve } from 'path';\nimport { registerTsConfigPaths } from '@nx/js/src/internal';\nimport { NxReporter } from './lib/nx-reporter';\nimport { getOptions } from './lib/utils';\nimport { loadVitestDynamicImport } from '../../utils/executor-utils';\n\nexport async function* vitestExecutor(\n options: VitestExecutorOptions,\n context: ExecutorContext\n) {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n registerTsConfigPaths(resolve(workspaceRoot, projectRoot, 'tsconfig.json'));\n\n process.env.VITE_CJS_IGNORE_WARNING = 'true';\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { startVitest } = await loadVitestDynamicImport();\n\n const resolvedOptions =\n (await getOptions(options, context, projectRoot)) ?? {};\n\n const watch = resolvedOptions['watch'] === true;\n\n const nxReporter = new NxReporter(watch);\n if (resolvedOptions['reporters'] === undefined) {\n resolvedOptions['reporters'] = [];\n } else if (typeof resolvedOptions['reporters'] === 'string') {\n resolvedOptions['reporters'] = [resolvedOptions['reporters']];\n }\n resolvedOptions['reporters'].push(nxReporter);\n\n const cliFilters = options.testFiles ?? [];\n\n const ctx = await startVitest(\n resolvedOptions['mode'] ?? 'test',\n cliFilters,\n resolvedOptions\n );\n\n let hasErrors = false;\n\n const processExit = () => {\n ctx.exit();\n if (hasErrors) {\n process.exit(1);\n } else {\n process.exit(0);\n }\n };\n\n if (watch) {\n process.on('SIGINT', processExit);\n process.on('SIGTERM', processExit);\n process.on('exit', processExit);\n }\n\n for await (const report of nxReporter) {\n // vitest sets the exitCode = 1 when code coverage isn't met\n hasErrors =\n report.hasErrors || (process.exitCode && process.exitCode !== 0);\n }\n\n return {\n success: !hasErrors,\n };\n}\n\nexport default vitestExecutor;\n"],"names":["vitestExecutor","options","context","projectRoot","projectsConfigurations","projects","projectName","root","registerTsConfigPaths","resolve","workspaceRoot","process","env","VITE_CJS_IGNORE_WARNING","startVitest","loadVitestDynamicImport","resolvedOptions","getOptions","watch","nxReporter","NxReporter","undefined","push","cliFilters","testFiles","ctx","hasErrors","processExit","exit","on","report","exitCode","success"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/test/vitest.impl.ts"],"sourcesContent":["import { ExecutorContext, workspaceRoot } from '@nx/devkit';\nimport { VitestExecutorOptions } from './schema';\nimport { resolve } from 'path';\nimport { registerTsConfigPaths } from '@nx/js/src/internal';\nimport { NxReporter } from './lib/nx-reporter';\nimport { getOptions } from './lib/utils';\nimport { loadVitestDynamicImport } from '../../utils/executor-utils';\n\nexport async function* vitestExecutor(\n options: VitestExecutorOptions,\n context: ExecutorContext\n) {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n registerTsConfigPaths(resolve(workspaceRoot, projectRoot, 'tsconfig.json'));\n\n process.env.VITE_CJS_IGNORE_WARNING = 'true';\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { startVitest } = await loadVitestDynamicImport();\n\n const { resolvedOptions, plugins } =\n (await getOptions(options, context, projectRoot)) ?? {};\n\n const watch = resolvedOptions['watch'] === true;\n\n const nxReporter = new NxReporter(watch);\n if (resolvedOptions['reporters'] === undefined) {\n resolvedOptions['reporters'] = [];\n } else if (typeof resolvedOptions['reporters'] === 'string') {\n resolvedOptions['reporters'] = [resolvedOptions['reporters']];\n }\n resolvedOptions['reporters'].push(nxReporter);\n\n const cliFilters = options.testFiles ?? [];\n\n const ctx = await startVitest(\n resolvedOptions['mode'] ?? 'test',\n cliFilters,\n resolvedOptions,\n { plugins }\n );\n\n let hasErrors = false;\n\n const processExit = () => {\n ctx.exit();\n if (hasErrors) {\n process.exit(1);\n } else {\n process.exit(0);\n }\n };\n\n if (watch) {\n process.on('SIGINT', processExit);\n process.on('SIGTERM', processExit);\n process.on('exit', processExit);\n }\n\n for await (const report of nxReporter) {\n // vitest sets the exitCode = 1 when code coverage isn't met\n hasErrors =\n report.hasErrors || (process.exitCode && process.exitCode !== 0);\n }\n\n return {\n success: !hasErrors,\n };\n}\n\nexport default vitestExecutor;\n"],"names":["vitestExecutor","options","context","projectRoot","projectsConfigurations","projects","projectName","root","registerTsConfigPaths","resolve","workspaceRoot","process","env","VITE_CJS_IGNORE_WARNING","startVitest","loadVitestDynamicImport","resolvedOptions","plugins","getOptions","watch","nxReporter","NxReporter","undefined","push","cliFilters","testFiles","ctx","hasErrors","processExit","exit","on","report","exitCode","success"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAuEA,OAA8B;eAA9B;;IA/DuBA,cAAc;eAAdA;;;wBARwB;sBAEvB;0BACc;4BACX;uBACA;+BACa;AAEjC,gBAAgBA,eACrBC,OAA8B,EAC9BC,OAAwB;IAExB,MAAMC,cACJD,QAAQE,sBAAsB,CAACC,QAAQ,CAACH,QAAQI,WAAW,CAAC,CAACC,IAAI;IAEnEC,IAAAA,+BAAqB,EAACC,IAAAA,aAAO,EAACC,qBAAa,EAAEP,aAAa;IAE1DQ,QAAQC,GAAG,CAACC,uBAAuB,GAAG;IACtC,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAMC,IAAAA,sCAAuB;QAGlD;IADH,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAChC,CAAC,OAAA,MAAMC,IAAAA,iBAAU,EAACjB,SAASC,SAASC,wBAAnC,OAAoD,CAAC;IAExD,MAAMgB,QAAQH,eAAe,CAAC,QAAQ,KAAK;IAE3C,MAAMI,aAAa,IAAIC,sBAAU,CAACF;IAClC,IAAIH,eAAe,CAAC,YAAY,KAAKM,WAAW;QAC9CN,eAAe,CAAC,YAAY,GAAG,EAAE;IACnC,OAAO,IAAI,OAAOA,eAAe,CAAC,YAAY,KAAK,UAAU;QAC3DA,eAAe,CAAC,YAAY,GAAG;YAACA,eAAe,CAAC,YAAY;SAAC;IAC/D;IACAA,eAAe,CAAC,YAAY,CAACO,IAAI,CAACH;QAEfnB;IAAnB,MAAMuB,aAAavB,CAAAA,qBAAAA,QAAQwB,SAAS,YAAjBxB,qBAAqB,EAAE;QAGxCe;IADF,MAAMU,MAAM,MAAMZ,YAChBE,CAAAA,wBAAAA,eAAe,CAAC,OAAO,YAAvBA,wBAA2B,QAC3BQ,YACAR,iBACA;QAAEC;IAAQ;IAGZ,IAAIU,YAAY;IAEhB,MAAMC,cAAc;QAClBF,IAAIG,IAAI;QACR,IAAIF,WAAW;YACbhB,QAAQkB,IAAI,CAAC;QACf,OAAO;YACLlB,QAAQkB,IAAI,CAAC;QACf;IACF;IAEA,IAAIV,OAAO;QACTR,QAAQmB,EAAE,CAAC,UAAUF;QACrBjB,QAAQmB,EAAE,CAAC,WAAWF;QACtBjB,QAAQmB,EAAE,CAAC,QAAQF;IACrB;IAEA,WAAW,MAAMG,UAAUX,WAAY;QACrC,4DAA4D;QAC5DO,YACEI,OAAOJ,SAAS,IAAKhB,QAAQqB,QAAQ,IAAIrB,QAAQqB,QAAQ,KAAK;IAClE;IAEA,OAAO;QACLC,SAAS,CAACN;IACZ;AACF;MAEA,WAAe3B"}
|
|
@@ -499,9 +499,6 @@ function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption,
|
|
|
499
499
|
var _options_testEnvironment, _options_coverageProvider;
|
|
500
500
|
const testOptionObject = {
|
|
501
501
|
globals: true,
|
|
502
|
-
cache: {
|
|
503
|
-
dir: normalizedJoinPaths(offsetFromRoot, 'node_modules', '.vitest', projectRoot === '.' ? options.project : projectRoot)
|
|
504
|
-
},
|
|
505
502
|
environment: (_options_testEnvironment = options.testEnvironment) != null ? _options_testEnvironment : 'jsdom',
|
|
506
503
|
include: [
|
|
507
504
|
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
|
|
@@ -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 { 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 { addBuildTargetDefaults } from '@nx/devkit/src/generators/add-build-target-defaults';\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 const buildOptions: ViteBuildExecutorOptions = {\n outputPath: 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 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 const config = readJson(tree, `${projectConfig.root}/tsconfig.json`);\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 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 break;\n default:\n break;\n }\n\n writeJson(tree, `${projectConfig.root}/tsconfig.json`, 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}\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 viteConfigPath = vitestFileName\n ? `${projectRoot}/vitest.config.ts`\n : `${projectRoot}/vite.config.ts`;\n\n const buildOutDir =\n projectRoot === '.'\n ? `./dist/${options.project}`\n : `${offsetFromRoot(projectRoot)}dist/${projectRoot}`;\n\n const buildOption = onlyVitest\n ? ''\n : options.includeLib\n ? `\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', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: [${options.rollupOptionsExternal ?? ''}]\n },\n },`\n : `\n build: {\n outDir: '${buildOutDir}',\n emptyOutDir: true,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n },\n `;\n\n const imports: string[] = options.imports ? options.imports : [];\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 let viteConfigContent = '';\n\n const plugins = options.plugins\n ? [...options.plugins, `nxViteTsPaths()`]\n : [`nxViteTsPaths()`];\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 ${\n options.inSourceTests\n ? `includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],`\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 : `\n server:{\n port: 4200,\n host: 'localhost',\n },`;\n\n const previewServerOption = onlyVitest\n ? ''\n : options.includeLib\n ? ''\n : `\n preview:{\n port: 4300,\n host: 'localhost',\n },`;\n\n const workerOption = `\n // 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 viteConfigContent = `\n /// <reference types='vitest' />\n import { defineConfig } from 'vite';\n ${imports.join(';\\n')}${imports.length ? ';' : ''}\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n \n export default defineConfig({\n root: __dirname,\n ${cacheDir}\n ${devServerOption}\n ${previewServerOption}\n \n plugins: [${plugins.join(',\\n')}],\n ${workerOption}\n ${buildOption}\n ${defineOption}\n ${testOption}\n });`;\n\n tree.write(viteConfigPath, viteConfigContent);\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', 'cjs'],\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 cache: {\n dir: normalizedJoinPaths(\n offsetFromRoot,\n 'node_modules',\n '.vitest',\n projectRoot === '.' ? options.project : projectRoot\n ),\n },\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","buildOptions","outputPath","defaultConfiguration","configurations","development","mode","production","buildTarget","hmr","serveTarget","previewOptions","proxyConfig","https","open","preview","projectConfig","config","readJson","uiFramework","compilerOptions","jsx","allowJs","esModuleInterop","allowSyntheticDefaultImports","strict","module","forceConsistentCasingInFileNames","noImplicitOverride","noPropertyAccessFromIndexSignature","noImplicitReturns","noFallthroughCasesInSwitch","writeJson","projectRoot","webpackConfigFilePath","webpackConfigPath","exists","delete","indexHtmlPath","mainPath","replace","indexHtmlContent","read","write","onlyVitest","projectAlreadyHasViteTargets","vitestFileName","viteConfigPath","buildOutDir","buildOption","includeLib","rollupOptionsExternal","imports","push","viteConfigContent","plugins","testOption","includeVitest","testEnvironment","inSourceTests","coverageProvider","defineOption","devServerOption","previewServerOption","workerOption","cacheDir","normalizedJoinPaths","handleViteConfigFileExists","join","length","configFile","undefined","projectName","Object","values","find","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","cache","dir","environment","include","reporters","coverage","provider","changed","ensureViteConfigIsCorrect","paths","path","startsWith"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AEA,SAASiB,oBAAoB,GAAGsD,KAAe;IAC7C,MAAMC,OAAOhI,IAAAA,yBAAiB,KAAI+H;IAElC,OAAOC,KAAKC,UAAU,CAAC,OAAOD,OAAO,CAAC,EAAE,EAAEA,KAAK,CAAC;AAClD"}
|
|
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 { 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 { addBuildTargetDefaults } from '@nx/devkit/src/generators/add-build-target-defaults';\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 const buildOptions: ViteBuildExecutorOptions = {\n outputPath: 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 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 const config = readJson(tree, `${projectConfig.root}/tsconfig.json`);\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 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 break;\n default:\n break;\n }\n\n writeJson(tree, `${projectConfig.root}/tsconfig.json`, 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}\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 viteConfigPath = vitestFileName\n ? `${projectRoot}/vitest.config.ts`\n : `${projectRoot}/vite.config.ts`;\n\n const buildOutDir =\n projectRoot === '.'\n ? `./dist/${options.project}`\n : `${offsetFromRoot(projectRoot)}dist/${projectRoot}`;\n\n const buildOption = onlyVitest\n ? ''\n : options.includeLib\n ? `\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', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: [${options.rollupOptionsExternal ?? ''}]\n },\n },`\n : `\n build: {\n outDir: '${buildOutDir}',\n emptyOutDir: true,\n reportCompressedSize: true,\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n },\n `;\n\n const imports: string[] = options.imports ? options.imports : [];\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 let viteConfigContent = '';\n\n const plugins = options.plugins\n ? [...options.plugins, `nxViteTsPaths()`]\n : [`nxViteTsPaths()`];\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 ${\n options.inSourceTests\n ? `includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],`\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 : `\n server:{\n port: 4200,\n host: 'localhost',\n },`;\n\n const previewServerOption = onlyVitest\n ? ''\n : options.includeLib\n ? ''\n : `\n preview:{\n port: 4300,\n host: 'localhost',\n },`;\n\n const workerOption = `\n // 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 viteConfigContent = `\n /// <reference types='vitest' />\n import { defineConfig } from 'vite';\n ${imports.join(';\\n')}${imports.length ? ';' : ''}\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n \n export default defineConfig({\n root: __dirname,\n ${cacheDir}\n ${devServerOption}\n ${previewServerOption}\n \n plugins: [${plugins.join(',\\n')}],\n ${workerOption}\n ${buildOption}\n ${defineOption}\n ${testOption}\n });`;\n\n tree.write(viteConfigPath, viteConfigContent);\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', 'cjs'],\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","buildOptions","outputPath","defaultConfiguration","configurations","development","mode","production","buildTarget","hmr","serveTarget","previewOptions","proxyConfig","https","open","preview","projectConfig","config","readJson","uiFramework","compilerOptions","jsx","allowJs","esModuleInterop","allowSyntheticDefaultImports","strict","module","forceConsistentCasingInFileNames","noImplicitOverride","noPropertyAccessFromIndexSignature","noImplicitReturns","noFallthroughCasesInSwitch","writeJson","projectRoot","webpackConfigFilePath","webpackConfigPath","exists","delete","indexHtmlPath","mainPath","replace","indexHtmlContent","read","write","onlyVitest","projectAlreadyHasViteTargets","vitestFileName","viteConfigPath","buildOutDir","buildOption","includeLib","rollupOptionsExternal","imports","push","viteConfigContent","plugins","testOption","includeVitest","testEnvironment","inSourceTests","coverageProvider","defineOption","devServerOption","previewServerOption","workerOption","cacheDir","normalizedJoinPaths","handleViteConfigFileExists","join","length","configFile","undefined","projectName","Object","values","find","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
|
|
1
|
-
export declare const noBuildOptions = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n
|
|
2
|
-
export declare const someBuildOptions = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n
|
|
1
|
+
export declare const noBuildOptions = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\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 ";
|
|
2
|
+
export declare const someBuildOptions = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\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 build: {\n my: 'option',\n }\n\n });\n ";
|
|
3
3
|
export declare const noContentDefineConfig = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({});\n ";
|
|
4
4
|
export declare const conditionalConfig = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n export default defineConfig(({ command, mode, ssrBuild }) => {\n if (command === 'serve') {\n return {\n port: 4200,\n host: 'localhost',\n }\n } else {\n // command === 'build'\n return {\n my: 'option',\n }\n }\n })\n ";
|
|
5
5
|
export declare const configNoDefineConfig = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default {\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n };\n ";
|
|
6
|
-
export declare const noBuildOptionsHasTestOption = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n
|
|
6
|
+
export declare const noBuildOptionsHasTestOption = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n \n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\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 ";
|
|
7
7
|
export declare const someBuildOptionsSomeTestOption = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n my: 'option',\n },\n\n build: {\n my: 'option',\n }\n\n });\n ";
|
|
8
|
-
export declare const hasEverything = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n
|
|
8
|
+
export declare const hasEverything = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n ";
|
|
9
9
|
export declare const buildOption = "\n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime']\n }\n },";
|
|
10
10
|
export declare const buildOptionObject: {
|
|
11
11
|
lib: {
|
|
@@ -18,12 +18,9 @@ export declare const buildOptionObject: {
|
|
|
18
18
|
external: string[];
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export declare const testOption = "test: {\n globals: true,\n
|
|
21
|
+
export declare const testOption = "test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },";
|
|
22
22
|
export declare const testOptionObject: {
|
|
23
23
|
globals: boolean;
|
|
24
|
-
cache: {
|
|
25
|
-
dir: string;
|
|
26
|
-
};
|
|
27
24
|
environment: string;
|
|
28
25
|
include: string[];
|
|
29
26
|
};
|
|
@@ -56,6 +56,7 @@ const noBuildOptions = `
|
|
|
56
56
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
57
57
|
|
|
58
58
|
export default defineConfig({
|
|
59
|
+
cacheDir: '../../node_modules/.vitest',
|
|
59
60
|
plugins: [
|
|
60
61
|
react(),
|
|
61
62
|
nxViteTsPaths(),
|
|
@@ -63,9 +64,6 @@ const noBuildOptions = `
|
|
|
63
64
|
|
|
64
65
|
test: {
|
|
65
66
|
globals: true,
|
|
66
|
-
cache: {
|
|
67
|
-
dir: '../../node_modules/.vitest',
|
|
68
|
-
},
|
|
69
67
|
environment: 'jsdom',
|
|
70
68
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
71
69
|
},
|
|
@@ -79,6 +77,7 @@ const someBuildOptions = `
|
|
|
79
77
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
80
78
|
|
|
81
79
|
export default defineConfig({
|
|
80
|
+
cacheDir: '../../node_modules/.vitest',
|
|
82
81
|
plugins: [
|
|
83
82
|
react(),
|
|
84
83
|
nxViteTsPaths(),
|
|
@@ -86,9 +85,6 @@ const someBuildOptions = `
|
|
|
86
85
|
|
|
87
86
|
test: {
|
|
88
87
|
globals: true,
|
|
89
|
-
cache: {
|
|
90
|
-
dir: '../../node_modules/.vitest',
|
|
91
|
-
},
|
|
92
88
|
environment: 'jsdom',
|
|
93
89
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
94
90
|
},
|
|
@@ -144,6 +140,8 @@ const noBuildOptionsHasTestOption = `
|
|
|
144
140
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
145
141
|
|
|
146
142
|
export default defineConfig({
|
|
143
|
+
|
|
144
|
+
cacheDir: '../../node_modules/.vitest',
|
|
147
145
|
plugins: [
|
|
148
146
|
react(),
|
|
149
147
|
nxViteTsPaths(),
|
|
@@ -151,9 +149,6 @@ const noBuildOptionsHasTestOption = `
|
|
|
151
149
|
|
|
152
150
|
test: {
|
|
153
151
|
globals: true,
|
|
154
|
-
cache: {
|
|
155
|
-
dir: '../../node_modules/.vitest',
|
|
156
|
-
},
|
|
157
152
|
environment: 'jsdom',
|
|
158
153
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
159
154
|
},
|
|
@@ -191,6 +186,7 @@ const hasEverything = `
|
|
|
191
186
|
import { joinPathFragments } from '@nx/devkit';
|
|
192
187
|
|
|
193
188
|
export default defineConfig({
|
|
189
|
+
cacheDir: '../../node_modules/.vitest',
|
|
194
190
|
plugins: [
|
|
195
191
|
dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),
|
|
196
192
|
react(),
|
|
@@ -217,9 +213,6 @@ const hasEverything = `
|
|
|
217
213
|
|
|
218
214
|
test: {
|
|
219
215
|
globals: true,
|
|
220
|
-
cache: {
|
|
221
|
-
dir: '../../../node_modules/.vitest',
|
|
222
|
-
},
|
|
223
216
|
environment: 'jsdom',
|
|
224
217
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
225
218
|
},
|
|
@@ -263,17 +256,11 @@ const buildOptionObject = {
|
|
|
263
256
|
};
|
|
264
257
|
const testOption = `test: {
|
|
265
258
|
globals: true,
|
|
266
|
-
cache: {
|
|
267
|
-
dir: '../node_modules/.vitest'
|
|
268
|
-
},
|
|
269
259
|
environment: 'jsdom',
|
|
270
260
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
271
261
|
},`;
|
|
272
262
|
const testOptionObject = {
|
|
273
263
|
globals: true,
|
|
274
|
-
cache: {
|
|
275
|
-
dir: `../node_modules/.vitest`
|
|
276
|
-
},
|
|
277
264
|
environment: 'jsdom',
|
|
278
265
|
include: [
|
|
279
266
|
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/utils/test-files/test-vite-configs.ts"],"sourcesContent":["export const noBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/utils/test-files/test-vite-configs.ts"],"sourcesContent":["export const noBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\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\nexport const someBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\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 build: {\n my: 'option',\n }\n\n });\n `;\n\nexport const noContentDefineConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({});\n `;\n\nexport const conditionalConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n export default defineConfig(({ command, mode, ssrBuild }) => {\n if (command === 'serve') {\n return {\n port: 4200,\n host: 'localhost',\n }\n } else {\n // command === 'build'\n return {\n my: 'option',\n }\n }\n })\n `;\n\nexport const configNoDefineConfig = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default {\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n };\n `;\n\nexport const noBuildOptionsHasTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n \n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\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\nexport const someBuildOptionsSomeTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n my: 'option',\n },\n\n build: {\n my: 'option',\n }\n\n });\n `;\n\nexport const hasEverything = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `;\n\nexport const buildOption = `\n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime']\n }\n },`;\nexport const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n};\n\nexport const testOption = `test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },`;\n\nexport const testOptionObject = {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n};\n\nexport const imports = [\n `import dts from 'vite-plugin-dts'`,\n `import { joinPathFragments } from '@nx/devkit'`,\n];\n\nexport const plugins = [`react()`, `nxViteTsPaths()`];\n"],"names":["buildOption","buildOptionObject","conditionalConfig","configNoDefineConfig","hasEverything","imports","noBuildOptions","noBuildOptionsHasTestOption","noContentDefineConfig","plugins","someBuildOptions","someBuildOptionsSomeTestOption","testOption","testOptionObject","lib","entry","name","fileName","formats","rollupOptions","external","globals","environment","include"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAAC;KAAuD;AACnE;AAEO,MAAMlB,UAAU;IACrB,CAAC,iCAAiC,CAAC;IACnC,CAAC,8CAA8C,CAAC;CACjD;AAEM,MAAMI,UAAU;IAAC,CAAC,OAAO,CAAC;IAAE,CAAC,eAAe,CAAC;CAAC"}
|
package/src/utils/test-utils.js
CHANGED
|
@@ -109,6 +109,8 @@ function mockViteReactAppGenerator(tree) {
|
|
|
109
109
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
110
110
|
|
|
111
111
|
export default defineConfig({
|
|
112
|
+
|
|
113
|
+
cacheDir: '../../node_modules/.vitest',
|
|
112
114
|
server: {
|
|
113
115
|
port: 4200,
|
|
114
116
|
host: 'localhost',
|
|
@@ -123,9 +125,6 @@ function mockViteReactAppGenerator(tree) {
|
|
|
123
125
|
|
|
124
126
|
test: {
|
|
125
127
|
globals: true,
|
|
126
|
-
cache: {
|
|
127
|
-
dir: '../../node_modules/.vitest',
|
|
128
|
-
},
|
|
129
128
|
environment: 'jsdom',
|
|
130
129
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
131
130
|
},
|
|
@@ -447,6 +446,7 @@ function mockReactLibNonBuildableVitestRunnerGenerator(tree) {
|
|
|
447
446
|
|
|
448
447
|
export default defineConfig({
|
|
449
448
|
|
|
449
|
+
cacheDir: '../../node_modules/.vitest',
|
|
450
450
|
plugins: [
|
|
451
451
|
nxViteTsPaths(),
|
|
452
452
|
react(),
|
|
@@ -454,9 +454,6 @@ function mockReactLibNonBuildableVitestRunnerGenerator(tree) {
|
|
|
454
454
|
|
|
455
455
|
test: {
|
|
456
456
|
globals: true,
|
|
457
|
-
cache: {
|
|
458
|
-
dir: '../../node_modules/.vitest',
|
|
459
|
-
},
|
|
460
457
|
environment: 'jsdom',
|
|
461
458
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
462
459
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/test-utils.ts"],"sourcesContent":["import { Tree, writeJson } from '@nx/devkit';\nimport * as reactViteConfig from './test-files/react-vite-project.config.json';\nimport * as angularAppConfig from './test-files/angular-project.config.json';\nimport * as randomAppConfig from './test-files/unknown-project.config.json';\nimport * as mixedAppConfig from './test-files/react-mixed-project.config.json';\nimport * as reactLibNBJest from './test-files/react-lib-non-buildable-jest.json';\nimport * as reactLibNBVitest from './test-files/react-lib-non-buildable-vitest.json';\n\nexport function mockViteReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-vite-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true,\n \"types\": [\"vite/client\"]\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Rv1</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n <link rel=\"stylesheet\" href=\"/src/styles.css\" />\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n </html>`\n );\n\n tree.write(\n `apps/${appName}/vite.config.ts`,\n ` /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import tsconfigPaths from 'vite-tsconfig-paths';\n \n export default defineConfig({\n server: {\n port: 4200,\n host: 'localhost',\n },\n plugins: [\n react(),\n tsconfigPaths({\n root: '../../',\n projects: ['tsconfig.base.json'],\n }),\n ],\n \n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-vite-app': {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactAppGenerator(tree: Tree, userAppName?: string): Tree {\n const appName = userAppName ?? 'my-test-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(`apps/${appName}/webpack.config.ts`, ``);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, `apps/${appName}/project.json`, {\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\nexport function mockReactMixedAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-mixed-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-mixed-react-app': {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockWebAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-web-app';\n\n tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n } \n `\n );\n\n tree.write(`apps/${appName}/webpack.config.ts`, ``);\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>WebappPure</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <workspace-root></workspace-root>\n </body>\n </html>\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-web-app': {\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n root: `apps/${appName}`,\n projectType: 'application',\n });\n return tree;\n}\n\nexport function mockAngularAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-angular-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-angular-app': {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockUnknownAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-random-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-random-app': {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableJestTestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-jest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableVitestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-vitest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/vite.config.ts`,\n `/// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n\n plugins: [\n nxViteTsPaths(),\n react(),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n"],"names":["mockAngularAppGenerator","mockReactAppGenerator","mockReactLibNonBuildableJestTestRunnerGenerator","mockReactLibNonBuildableVitestRunnerGenerator","mockReactMixedAppGenerator","mockUnknownAppGenerator","mockViteReactAppGenerator","mockWebAppGenerator","tree","appName","write","writeJson","projects","reactViteConfig","root","projectType","userAppName","mixedAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAuYgBA,uBAAuB;eAAvBA;;IA5PAC,qBAAqB;eAArBA;;IAwSAC,+CAA+C;eAA/CA;;IA4EAC,6CAA6C;eAA7CA;;IAzRAC,0BAA0B;eAA1BA;;IAuLAC,uBAAuB;eAAvBA;;IArZAC,yBAAyB;eAAzBA;;IAmUAC,mBAAmB;eAAnBA;;;;wBA3UgB;4CACC;0CACC;0CACD;6CACD;8CACA;gDACE;AAE3B,SAASD,0BAA0BE,IAAU;IAClD,MAAMC,UAAU;IAEh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JZ,KAAKE,KAAK,CACR,CAAC,KAAK,EAAEU,QAAQ,kBAAkB,CAAC,EACnC,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBA,CAAC;IAGJT,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,CAAC,CAAC,EAAEQ,QAAQ,CAAC,CAAC,EAAE,eACXE;gBACHR,MAAM,CAAC,KAAK,EAAEM,QAAQ,CAAC;gBACvBL,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EAACH,MAAM,CAAC,KAAK,EAAEY,QAAQ,aAAa,CAAC,EAAE,eAC3CE;QACHR,MAAM,CAAC,KAAK,EAAEM,QAAQ,CAAC;QACvBL,aAAa;;IAGf,OAAOP;AACT"}
|
|
1
|
+
{"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","userAppName","mixedAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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