@nx/vite 16.4.0-beta.0 → 16.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/migrations.json +46 -4
  2. package/package.json +5 -5
  3. package/src/executors/build/build.impl.js +9 -2
  4. package/src/executors/build/build.impl.js.map +1 -1
  5. package/src/executors/build/schema.d.ts +2 -0
  6. package/src/executors/build/schema.json +10 -0
  7. package/src/executors/dev-server/dev-server.impl.js +2 -3
  8. package/src/executors/dev-server/dev-server.impl.js.map +1 -1
  9. package/src/executors/dev-server/schema.d.ts +1 -0
  10. package/src/executors/dev-server/schema.json +5 -0
  11. package/src/executors/test/vitest.impl.js +10 -7
  12. package/src/executors/test/vitest.impl.js.map +1 -1
  13. package/src/generators/configuration/configuration.js +7 -2
  14. package/src/generators/configuration/configuration.js.map +1 -1
  15. package/src/generators/configuration/schema.d.ts +1 -0
  16. package/src/generators/configuration/schema.json +7 -1
  17. package/src/generators/init/init.js +9 -2
  18. package/src/generators/init/init.js.map +1 -1
  19. package/src/generators/init/schema.d.ts +1 -0
  20. package/src/generators/init/schema.json +6 -0
  21. package/src/generators/vitest/schema.d.ts +1 -0
  22. package/src/generators/vitest/schema.json +5 -0
  23. package/src/generators/vitest/vitest-generator.js +4 -1
  24. package/src/generators/vitest/vitest-generator.js.map +1 -1
  25. package/src/utils/executor-utils.d.ts +9 -0
  26. package/src/utils/executor-utils.js +45 -0
  27. package/src/utils/executor-utils.js.map +1 -0
  28. package/src/utils/generator-utils.js +5 -4
  29. package/src/utils/generator-utils.js.map +1 -1
  30. package/src/utils/options-utils.d.ts +1 -0
  31. package/src/utils/options-utils.js +7 -1
  32. package/src/utils/options-utils.js.map +1 -1
  33. package/src/utils/test-files/test-vite-configs.d.ts +2 -2
  34. package/src/utils/test-files/test-vite-configs.js +2 -2
  35. package/src/utils/test-files/test-vite-configs.js.map +1 -1
  36. package/src/utils/versions.d.ts +12 -13
  37. package/src/utils/versions.js +18 -22
  38. package/src/utils/versions.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/vite/src/generators/vitest/vitest-generator.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n convertNxGenerator,\n formatFiles,\n generateFiles,\n GeneratorCallback,\n joinPathFragments,\n offsetFromRoot,\n readProjectConfiguration,\n runTasksInSerial,\n Tree,\n updateJson,\n} from '@nx/devkit';\nimport {\n addOrChangeTestTarget,\n createOrEditViteConfig,\n findExistingTargetsInProject,\n} from '../../utils/generator-utils';\nimport { VitestGeneratorSchema } from './schema';\n\nimport initGenerator from '../init/init';\nimport {\n vitestCoverageC8Version,\n vitestCoverageIstanbulVersion,\n} from '../../utils/versions';\n\nexport async function vitestGenerator(\n tree: Tree,\n schema: VitestGeneratorSchema\n) {\n const tasks: GeneratorCallback[] = [];\n\n const { targets, root, projectType } = readProjectConfiguration(\n tree,\n schema.project\n );\n let testTarget =\n schema.testTarget ??\n findExistingTargetsInProject(targets).validFoundTargetName.test ??\n 'test';\n\n addOrChangeTestTarget(tree, schema, testTarget);\n\n const initTask = await initGenerator(tree, {\n uiFramework: schema.uiFramework,\n });\n tasks.push(initTask);\n\n if (!schema.skipViteConfig) {\n createOrEditViteConfig(\n tree,\n {\n ...schema,\n includeVitest: true,\n includeLib: projectType === 'library',\n },\n true\n );\n }\n\n createFiles(tree, schema, root);\n updateTsConfig(tree, schema, root);\n\n const installCoverageProviderTask = addDependenciesToPackageJson(\n tree,\n {},\n schema.coverageProvider === 'istanbul'\n ? {\n '@vitest/coverage-istanbul': vitestCoverageIstanbulVersion,\n }\n : {\n '@vitest/coverage-c8': vitestCoverageC8Version,\n }\n );\n tasks.push(installCoverageProviderTask);\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n\n return runTasksInSerial(...tasks);\n}\n\nfunction updateTsConfig(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string\n) {\n updateJson(tree, joinPathFragments(projectRoot, 'tsconfig.json'), (json) => {\n if (\n json.references &&\n !json.references.some((r) => r.path === './tsconfig.spec.json')\n ) {\n json.references.push({\n path: './tsconfig.spec.json',\n });\n }\n\n if (!json.compilerOptions?.types?.includes('vitest')) {\n if (json.compilerOptions?.types) {\n json.compilerOptions.types.push('vitest');\n } else {\n json.compilerOptions ??= {};\n json.compilerOptions.types = ['vitest'];\n }\n }\n return json;\n });\n\n if (options.inSourceTests) {\n const tsconfigLibPath = joinPathFragments(projectRoot, 'tsconfig.lib.json');\n const tsconfigAppPath = joinPathFragments(projectRoot, 'tsconfig.app.json');\n if (tree.exists(tsconfigLibPath)) {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.lib.json'),\n (json) => {\n (json.compilerOptions.types ??= []).push('vitest/importMeta');\n return json;\n }\n );\n } else if (tree.exists(tsconfigAppPath)) {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.app.json'),\n (json) => {\n (json.compilerOptions.types ??= []).push('vitest/importMeta');\n return json;\n }\n );\n }\n }\n}\n\nfunction createFiles(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string\n) {\n generateFiles(tree, joinPathFragments(__dirname, 'files'), projectRoot, {\n tmpl: '',\n ...options,\n projectRoot,\n offsetFromRoot: offsetFromRoot(projectRoot),\n });\n}\n\nexport default vitestGenerator;\nexport const vitestSchematic = convertNxGenerator(vitestGenerator);\n"],"names":["vitestGenerator","vitestSchematic","tree","schema","tasks","targets","root","projectType","readProjectConfiguration","project","testTarget","findExistingTargetsInProject","validFoundTargetName","test","addOrChangeTestTarget","initTask","initGenerator","uiFramework","push","skipViteConfig","createOrEditViteConfig","includeVitest","includeLib","createFiles","updateTsConfig","installCoverageProviderTask","addDependenciesToPackageJson","coverageProvider","vitestCoverageIstanbulVersion","vitestCoverageC8Version","skipFormat","formatFiles","runTasksInSerial","options","projectRoot","updateJson","joinPathFragments","json","references","some","r","path","compilerOptions","types","includes","inSourceTests","tsconfigLibPath","tsconfigAppP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AU,EACRjC,MACAkC,IAAAA,yBAAiB,EAACF,aAAa,sBAC/B,CAACG,OAAS;oBACPA;;gBAAAA,CAAAA,WAAAA,wBAAAA,KAAKK,eAAe,EAACC,0BAArBN,sBAAqBM,QAAU,EAAE,AAAD,EAAGzB,IAAI,CAAC;gBACzC,OAAOmB;YACT;QAEJ,CAAC;IACH,CAAC;AACH;AAEA,SAASd,YACPrB,IAAU,EACV+B,OAA8B,EAC9BC,WAAmB,EACnB;IACAe,IAAAA,qBAAa,EAAC/C,MAAMkC,IAAAA,yBAAiB,EAACc,WAAW,UAAUhB,aAAa;QACtEiB,MAAM;OACHlB;QACHC;QACAkB,gBAAgBA,IAAAA,sBAAc,EAAClB;;AAEnC;MAEA,WAAelC;AACR,MAAMC,kBAAkBoD,IAAAA,0BAAkB,EAACrD"}
1
+ {"version":3,"sources":["../../../../../../packages/vite/src/generators/vitest/vitest-generator.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n convertNxGenerator,\n formatFiles,\n generateFiles,\n GeneratorCallback,\n joinPathFragments,\n offsetFromRoot,\n readProjectConfiguration,\n runTasksInSerial,\n Tree,\n updateJson,\n} from '@nx/devkit';\nimport {\n addOrChangeTestTarget,\n createOrEditViteConfig,\n findExistingTargetsInProject,\n} from '../../utils/generator-utils';\nimport { VitestGeneratorSchema } from './schema';\n\nimport initGenerator from '../init/init';\nimport {\n vitestCoverageC8Version,\n vitestCoverageIstanbulVersion,\n} from '../../utils/versions';\n\nimport { addTsLibDependencies } from '@nx/js';\n\nexport async function vitestGenerator(\n tree: Tree,\n schema: VitestGeneratorSchema\n) {\n const tasks: GeneratorCallback[] = [];\n\n const { targets, root, projectType } = readProjectConfiguration(\n tree,\n schema.project\n );\n let testTarget =\n schema.testTarget ??\n findExistingTargetsInProject(targets).validFoundTargetName.test ??\n 'test';\n\n addOrChangeTestTarget(tree, schema, testTarget);\n\n const initTask = await initGenerator(tree, {\n uiFramework: schema.uiFramework,\n testEnvironment: schema.testEnvironment,\n });\n tasks.push(initTask);\n\n if (!schema.skipViteConfig) {\n createOrEditViteConfig(\n tree,\n {\n ...schema,\n includeVitest: true,\n includeLib: projectType === 'library',\n },\n true\n );\n }\n\n createFiles(tree, schema, root);\n updateTsConfig(tree, schema, root);\n\n const installCoverageProviderTask = addDependenciesToPackageJson(\n tree,\n {},\n schema.coverageProvider === 'istanbul'\n ? {\n '@vitest/coverage-istanbul': vitestCoverageIstanbulVersion,\n }\n : {\n '@vitest/coverage-c8': vitestCoverageC8Version,\n }\n );\n tasks.push(installCoverageProviderTask);\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n\n return runTasksInSerial(...tasks);\n}\n\nfunction updateTsConfig(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string\n) {\n updateJson(tree, joinPathFragments(projectRoot, 'tsconfig.json'), (json) => {\n if (\n json.references &&\n !json.references.some((r) => r.path === './tsconfig.spec.json')\n ) {\n json.references.push({\n path: './tsconfig.spec.json',\n });\n }\n\n if (!json.compilerOptions?.types?.includes('vitest')) {\n if (json.compilerOptions?.types) {\n json.compilerOptions.types.push('vitest');\n } else {\n json.compilerOptions ??= {};\n json.compilerOptions.types = ['vitest'];\n }\n }\n return json;\n });\n\n if (options.inSourceTests) {\n const tsconfigLibPath = joinPathFragments(projectRoot, 'tsconfig.lib.json');\n const tsconfigAppPath = joinPathFragments(projectRoot, 'tsconfig.app.json');\n if (tree.exists(tsconfigLibPath)) {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.lib.json'),\n (json) => {\n (json.compilerOptions.types ??= []).push('vitest/importMeta');\n return json;\n }\n );\n } else if (tree.exists(tsconfigAppPath)) {\n updateJson(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.app.json'),\n (json) => {\n (json.compilerOptions.types ??= []).push('vitest/importMeta');\n return json;\n }\n );\n }\n\n addTsLibDependencies(tree);\n }\n}\n\nfunction createFiles(\n tree: Tree,\n options: VitestGeneratorSchema,\n projectRoot: string\n) {\n generateFiles(tree, joinPathFragments(__dirname, 'files'), projectRoot, {\n tmpl: '',\n ...options,\n projectRoot,\n offsetFromRoot: offsetFromRoot(projectRoot),\n });\n}\n\nexport default vitestGenerator;\nexport const vitestSchematic = convertNxGenerator(vitestGenerator);\n"],"names":["vitestGenerator","vitestSchematic","tree","schema","tasks","targets","root","projectType","readProjectConfiguration","project","testTarget","findExistingTargetsInProject","validFoundTargetName","test","addOrChangeTestTarget","initTask","initGenerator","uiFramework","testEnvironment","push","skipViteConfig","createOrEditViteConfig","includeVitest","includeLib","createFiles","updateTsConfig","installCoverageProviderTask","addDependenciesToPackageJson","coverageProvider","vitestCoverageIstanbulVersion","vitestCoverageC8Version","skipFormat","formatFiles","runTasksInSerial","options","projectRoot","updateJson","joinPathFragments","json","references","some","r","path","compilerOptions","types","includes","inSourceTests","tsconfigLibPath","tsconfigAppPath","exists","addTsLibDependencies","generateFiles","__dirname","tmpl","offsetFromRoot","convertNxGenerator"],"mappings":";;;;;;;;IA4BsBA,eAAe;eAAfA;;IA4HtB,OAA+B;eAA/B;;IACaC,eAAe;eAAfA;;;;wBA7IN;gCAKA;sBAGmB;0BAInB;oBAE8B;AAE9B,eAAeD,gBACpBE,IAAU,EACVC,MAA6B,EAC7B;IACA,MAAMC,QAA6B,EAAE;IAErC,MAAM,EAAEC,QAAO,EAAEC,KAAI,EAAEC,YAAW,EAAE,GAAGC,IAAAA,gCAAwB,EAC7DN,MACAC,OAAOM,OAAO;QAGdN,oBAAAA;IADF,IAAIO,aACFP,CAAAA,OAAAA,CAAAA,qBAAAA,OAAOO,UAAU,YAAjBP,qBACAQ,IAAAA,4CAA4B,EAACN,SAASO,oBAAoB,CAACC,IAAI,YAD/DV,OAEA,MAAM;IAERW,IAAAA,qCAAqB,EAACZ,MAAMC,QAAQO;IAEpC,MAAMK,WAAW,MAAMC,IAAAA,aAAa,EAACd,MAAM;QACzCe,aAAad,OAAOc,WAAW;QAC/BC,iBAAiBf,OAAOe,eAAe;IACzC;IACAd,M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MAAKK,kBAAoB,CAAC,CAAC;gBAC3BL,KAAKK,eAAe,CAACC,KAAK,GAAG;oBAAC;iBAAS;YACzC,CAAC;QACH,CAAC;QACD,OAAON;IACT;IAEA,IAAIJ,QAAQY,aAAa,EAAE;QACzB,MAAMC,kBAAkBV,IAAAA,yBAAiB,EAACF,aAAa;QACvD,MAAMa,kBAAkBX,IAAAA,yBAAiB,EAACF,aAAa;QACvD,IAAIjC,KAAK+C,MAAM,CAACF,kBAAkB;YAChCX,IAAAA,kBAAU,EACRlC,MACAmC,IAAAA,yBAAiB,EAACF,aAAa,sBAC/B,CAACG,OAAS;oBACPA;;gBAAAA,CAAAA,WAAAA,wBAAAA,KAAKK,eAAe,EAACC,0BAArBN,sBAAqBM,QAAU,EAAE,AAAD,EAAGzB,IAAI,CAAC;gBACzC,OAAOmB;YACT;QAEJ,OAAO,IAAIpC,KAAK+C,MAAM,CAACD,kBAAkB;YACvCZ,IAAAA,kBAAU,EACRlC,MACAmC,IAAAA,yBAAiB,EAACF,aAAa,sBAC/B,CAACG,OAAS;oBACPA;;gBAAAA,CAAAA,WAAAA,wBAAAA,KAAKK,eAAe,EAACC,0BAArBN,sBAAqBM,QAAU,EAAE,AAAD,EAAGzB,IAAI,CAAC;gBACzC,OAAOmB;YACT;QAEJ,CAAC;QAEDY,IAAAA,wBAAoB,EAAChD;IACvB,CAAC;AACH;AAEA,SAASsB,YACPtB,IAAU,EACVgC,OAA8B,EAC9BC,WAAmB,EACnB;IACAgB,IAAAA,qBAAa,EAACjD,MAAMmC,IAAAA,yBAAiB,EAACe,WAAW,UAAUjB,aAAa;QACtEkB,MAAM;OACHnB;QACHC;QACAmB,gBAAgBA,IAAAA,sBAAc,EAACnB;;AAEnC;MAEA,WAAenC;AACR,MAAMC,kBAAkBsD,IAAAA,0BAAkB,EAACvD"}
@@ -0,0 +1,9 @@
1
+ import { ViteBuildExecutorOptions } from '../executors/build/schema';
2
+ import { ExecutorContext } from '@nx/devkit';
3
+ import { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';
4
+ export declare function validateTypes(opts: {
5
+ workspaceRoot: string;
6
+ projectRoot: string;
7
+ tsconfig: string;
8
+ }): Promise<void>;
9
+ export declare function registerPaths(projectRoot: string, options: ViteBuildExecutorOptions | ViteDevServerExecutorOptions, context: ExecutorContext): void;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ function _export(target, all) {
3
+ for(var name in all)Object.defineProperty(target, name, {
4
+ enumerable: true,
5
+ get: all[name]
6
+ });
7
+ }
8
+ _export(exports, {
9
+ validateTypes: function() {
10
+ return validateTypes;
11
+ },
12
+ registerPaths: function() {
13
+ return registerPaths;
14
+ }
15
+ });
16
+ const _js = require("@nx/js");
17
+ const _path = require("path");
18
+ const _buildablelibsutils = require("@nx/js/src/utils/buildable-libs-utils");
19
+ const _internal = require("@nx/js/src/internal");
20
+ async function validateTypes(opts) {
21
+ const result = await (0, _js.runTypeCheck)({
22
+ workspaceRoot: opts.workspaceRoot,
23
+ tsConfigPath: (0, _path.join)(opts.workspaceRoot, opts.tsconfig),
24
+ mode: 'noEmit'
25
+ });
26
+ await (0, _js.printDiagnostics)(result.errors, result.warnings);
27
+ if (result.errors.length > 0) {
28
+ throw new Error('Found type errors. See above.');
29
+ }
30
+ }
31
+ function registerPaths(projectRoot, options, context) {
32
+ var _options;
33
+ const tsConfig = (0, _path.resolve)(projectRoot, 'tsconfig.json');
34
+ var _buildLibsFromSource;
35
+ (_buildLibsFromSource = (_options = options).buildLibsFromSource) != null ? _buildLibsFromSource : _options.buildLibsFromSource = true;
36
+ if (!options.buildLibsFromSource) {
37
+ const { dependencies } = (0, _buildablelibsutils.calculateProjectDependencies)(context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
38
+ const tmpTsConfig = (0, _buildablelibsutils.createTmpTsConfig)(tsConfig, context.root, projectRoot, dependencies);
39
+ (0, _internal.registerTsConfigPaths)(tmpTsConfig);
40
+ } else {
41
+ (0, _internal.registerTsConfigPaths)(tsConfig);
42
+ }
43
+ }
44
+
45
+ //# sourceMappingURL=executor-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"sourcesContent":["import { printDiagnostics, runTypeCheck } from '@nx/js';\nimport { join, resolve } from 'path';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { ExecutorContext } from '@nx/devkit';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport {\n calculateProjectDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { registerTsConfigPaths } from '@nx/js/src/internal';\n\nexport async function validateTypes(opts: {\n workspaceRoot: string;\n projectRoot: string;\n tsconfig: string;\n}): Promise<void> {\n const result = await runTypeCheck({\n workspaceRoot: opts.workspaceRoot,\n tsConfigPath: join(opts.workspaceRoot, opts.tsconfig),\n mode: 'noEmit',\n });\n\n await printDiagnostics(result.errors, result.warnings);\n\n if (result.errors.length > 0) {\n throw new Error('Found type errors. See above.');\n }\n}\n\nexport function registerPaths(\n projectRoot: string,\n options: ViteBuildExecutorOptions | ViteDevServerExecutorOptions,\n context: ExecutorContext\n) {\n const tsConfig = resolve(projectRoot, 'tsconfig.json');\n options.buildLibsFromSource ??= true;\n\n if (!options.buildLibsFromSource) {\n const { dependencies } = calculateProjectDependencies(\n context.projectGraph,\n context.root,\n context.projectName,\n context.targetName,\n context.configurationName\n );\n const tmpTsConfig = createTmpTsConfig(\n tsConfig,\n context.root,\n projectRoot,\n dependencies\n );\n\n registerTsConfigPaths(tmpTsConfig);\n } else {\n registerTsConfigPaths(tsConfig);\n }\n}\n"],"names":["validateTypes","registerPaths","opts","result","runTypeCheck","workspaceRoot","tsConfigPath","join","tsconfig","mode","printDiagnostics","errors","warnings","length","Error","projectRoot","options","context","tsConfig","resolve","buildLibsFromSource","dependencies","calculateProjectDependencies","projectGraph","root","projectName","targetName","configurationName","tmpTsConfig","createTmpTsConfig","registerTsConfigPaths"],"mappings":";;;;;;;;IAWsBA,aAAa;eAAbA;;IAkBNC,aAAa;eAAbA;;;oBA7B+B;sBACjB;oCAOvB;0BAC+B;AAE/B,eAAeD,cAAcE,IAInC,EAAiB;IAChB,MAAMC,SAAS,MAAMC,IAAAA,gBAAY,EAAC;QAChCC,eAAeH,KAAKG,aAAa;QACjCC,cAAcC,IAAAA,UAAI,EAACL,KAAKG,aAAa,EAAEH,KAAKM,QAAQ;QACpDC,MAAM;IACR;IAEA,MAAMC,IAAAA,oBAAgB,EAACP,OAAOQ,MAAM,EAAER,OAAOS,QAAQ;IAErD,IAAIT,OAAOQ,MAAM,CAACE,MAAM,GAAG,GAAG;QAC5B,MAAM,IAAIC,MAAM,iCAAiC;IACnD,CAAC;AACH;AAEO,SAASb,cACdc,WAAmB,EACnBC,OAAgE,EAChEC,OAAwB,EACxB;QAEAD;IADA,MAAME,WAAWC,IAAAA,aAAO,EAACJ,aAAa;;IACtCC,yBAAAA,WAAAA,SAAQI,sDAARJ,SAAQI,sBAAwB,IAAI;IAEpC,IAAI,CAACJ,QAAQI,mBAAmB,EAAE;QAChC,MAAM,EAAEC,aAAY,EAAE,GAAGC,IAAAA,gDAA4B,EACnDL,QAAQM,YAAY,EACpBN,QAAQO,IAAI,EACZP,QAAQQ,WAAW,EACnBR,QAAQS,UAAU,EAClBT,QAAQU,iBAAiB;QAE3B,MAAMC,cAAcC,IAAAA,qCAAiB,EACnCX,UACAD,QAAQO,IAAI,EACZT,aACAM;QAGFS,IAAAA,+BAAqB,EAACF;IACxB,OAAO;QACLE,IAAAA,+BAAqB,EAACZ;IACxB,CAAC;AACH"}
@@ -408,7 +408,7 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
408
408
  name: '${options.project}',
409
409
  fileName: 'index',
410
410
  // Change this to the formats you want to support.
411
- // Don't forgot to update your package.json as well.
411
+ // Don't forget to update your package.json as well.
412
412
  formats: ['es', 'cjs']
413
413
  },
414
414
  rollupOptions: {
@@ -418,17 +418,18 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
418
418
  },` : ``;
419
419
  const dtsPlugin = onlyVitest ? '' : options.includeLib ? `dts({
420
420
  entryRoot: 'src',
421
- tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),
421
+ tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
422
422
  skipDiagnostics: true,
423
423
  }),` : '';
424
- const dtsImportLine = onlyVitest ? '' : options.includeLib ? `import dts from 'vite-plugin-dts';\nimport { joinPathFragments } from '@nx/devkit';` : '';
424
+ const dtsImportLine = onlyVitest ? '' : options.includeLib ? `import dts from 'vite-plugin-dts';\nimport * as path from 'path';` : '';
425
425
  let viteConfigContent = '';
426
+ var _options_testEnvironment;
426
427
  const testOption = options.includeVitest ? `test: {
427
428
  globals: true,
428
429
  cache: {
429
430
  dir: '${(0, _devkit.offsetFromRoot)(projectConfig.root)}node_modules/.vitest'
430
431
  },
431
- environment: 'jsdom',
432
+ environment: '${(_options_testEnvironment = options.testEnvironment) != null ? _options_testEnvironment : 'jsdom'}',
432
433
  include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
433
434
  ${options.inSourceTests ? `includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']` : ''}
434
435
  },` : '';
@@ -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 { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';\nimport { VitestExecutorOptions } from '../executors/test/schema';\nimport { ViteConfigurationGeneratorSchema } from '../generators/configuration/schema';\nimport { ensureViteConfigIsCorrect } from './vite-config-edit-utils';\n\nexport type Target = 'build' | 'serve' | 'test' | 'preview';\nexport type TargetFlags = Partial<Record<Target, boolean>>;\nexport type UserProvidedTargetName = Partial<Record<Target, string>>;\nexport type ValidFoundTargetName = Partial<Record<Target, string>>;\n\nexport function findExistingTargetsInProject(\n targets: {\n [targetName: string]: TargetConfiguration;\n },\n userProvidedTargets?: UserProvidedTargetName\n): {\n validFoundTargetName: ValidFoundTargetName;\n projectContainsUnsupportedExecutor: boolean;\n userProvidedTargetIsUnsupported: TargetFlags;\n alreadyHasNxViteTargets: TargetFlags;\n} {\n const output: ReturnType<typeof findExistingTargetsInProject> = {\n validFoundTargetName: {},\n projectContainsUnsupportedExecutor: false,\n userProvidedTargetIsUnsupported: {},\n alreadyHasNxViteTargets: {},\n };\n\n const supportedExecutors = {\n build: [\n '@nxext/vite:build',\n '@nx/js:babel',\n '@nx/js:swc',\n '@nx/webpack:webpack',\n '@nx/rollup:rollup',\n '@nrwl/js:babel',\n '@nrwl/js:swc',\n '@nrwl/webpack:webpack',\n '@nrwl/rollup:rollup',\n '@nrwl/web:rollup',\n ],\n serve: [\n '@nxext/vite:dev',\n '@nx/webpack:dev-server',\n '@nrwl/webpack:dev-server',\n ],\n test: ['@nx/jest:jest', '@nrwl/jest:jest', '@nxext/vitest:vitest'],\n };\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/next:server',\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/next:server',\n '@nrwl/js:tsc',\n '@angular-devkit/build-angular:browser',\n '@angular-devkit/build-angular:dev-server',\n ];\n\n // First, we check if the user has provided a target\n // If they have, we check if the executor the target is using is supported\n // If it's not supported, then we set the unsupported flag to true for that target\n\n function checkUserProvidedTarget(target: Target) {\n if (userProvidedTargets?.[target]) {\n if (\n supportedExecutors[target].includes(\n targets[userProvidedTargets[target]]?.executor\n )\n ) {\n output.validFoundTargetName[target] = userProvidedTargets[target];\n } else {\n output.userProvidedTargetIsUnsupported[target] = true;\n }\n }\n }\n\n checkUserProvidedTarget('build');\n checkUserProvidedTarget('serve');\n checkUserProvidedTarget('test');\n\n // Returns early when we have a build, serve, and test targets.\n if (\n output.validFoundTargetName.build &&\n output.validFoundTargetName.serve &&\n output.validFoundTargetName.test\n ) {\n return output;\n }\n\n // We try to find the targets that are using the supported executors\n // for build, serve and test, since these are the ones we will be converting\n for (const target in targets) {\n const executorName = targets[target].executor;\n\n const hasViteTargets = output.alreadyHasNxViteTargets;\n hasViteTargets.build ||=\n executorName === '@nx/vite:build' || executorName === '@nrwl/vite:build';\n hasViteTargets.serve ||=\n executorName === '@nx/vite:dev-server' ||\n executorName === '@nrwl/vite:dev-server';\n hasViteTargets.test ||=\n executorName === '@nx/vite:test' || executorName === '@nrwl/vite:test';\n hasViteTargets.preview ||=\n executorName === '@nx/vite:preview-server' ||\n executorName === '@nrwl/vite:preview-server';\n\n const foundTargets = output.validFoundTargetName;\n if (\n !foundTargets.build &&\n supportedExecutors.build.includes(executorName)\n ) {\n foundTargets.build = target;\n }\n if (\n !foundTargets.serve &&\n supportedExecutors.serve.includes(executorName)\n ) {\n foundTargets.serve = target;\n }\n if (!foundTargets.test && supportedExecutors.test.includes(executorName)) {\n foundTargets.test = target;\n }\n\n output.projectContainsUnsupportedExecutor ||=\n unsupportedExecutors.includes(executorName);\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 coveragePath = joinPathFragments(\n 'coverage',\n project.root === '.' ? options.project : project.root\n );\n const testOptions: VitestExecutorOptions = {\n passWithNoTests: true,\n // vitest runs in the project root so we have to offset to the workspaceRoot\n reportsDirectory: joinPathFragments(\n offsetFromRoot(project.root),\n coveragePath\n ),\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: [coveragePath],\n options: testOptions,\n };\n }\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addOrChangeBuildTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\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\n project.targets ??= {};\n\n if (project.targets[target]) {\n buildOptions.fileReplacements =\n project.targets[target].options?.fileReplacements;\n\n if (project.targets[target].executor === '@nxext/vite:build') {\n buildOptions.base = project.targets[target].options?.baseHref;\n buildOptions.sourcemap = project.targets[target].options?.sourcemaps;\n }\n project.targets[target].options = { ...buildOptions };\n project.targets[target].executor = '@nx/vite:build';\n } else {\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\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addOrChangeServeTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n project.targets ??= {};\n\n if (project.targets[target]) {\n const serveTarget = project.targets[target];\n const serveOptions: ViteDevServerExecutorOptions = {\n buildTarget: `${options.project}:build`,\n https: project.targets[target].options?.https,\n hmr: project.targets[target].options?.hmr,\n open: project.targets[target].options?.open,\n };\n if (serveTarget.executor === '@nxext/vite:dev') {\n serveOptions.proxyConfig = project.targets[target].options.proxyConfig;\n }\n serveTarget.executor = '@nx/vite:dev-server';\n serveTarget.options = serveOptions;\n } else {\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\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 * @param previewTarget The preview target to create.\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 const commonCompilerOptions = {\n target: 'ESNext',\n useDefineForClassFields: true,\n module: 'ESNext',\n strict: true,\n moduleResolution: 'Node',\n resolveJsonModule: true,\n isolatedModules: true,\n types: ['vite/client'],\n noEmit: true,\n };\n\n switch (options.uiFramework) {\n case 'react':\n config.compilerOptions = {\n ...commonCompilerOptions,\n lib: ['DOM', 'DOM.Iterable', 'ESNext'],\n allowJs: false,\n esModuleInterop: false,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n forceConsistentCasingInFileNames: true,\n jsx: 'react-jsx',\n };\n config.include = [...config.include, 'src'];\n break;\n case 'none':\n config.compilerOptions = {\n ...commonCompilerOptions,\n lib: ['ESNext', 'DOM'],\n skipLibCheck: true,\n esModuleInterop: true,\n strict: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n noImplicitReturns: true,\n };\n config.include = [...config.include, 'src'];\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 buildTarget: string\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n let indexHtmlPath =\n projectConfig.targets?.[buildTarget]?.options?.index ??\n `${projectConfig.root}/src/index.html`;\n let mainPath =\n projectConfig.targets?.[buildTarget]?.options?.main ??\n `${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 function createOrEditViteConfig(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n onlyVitest: boolean,\n projectAlreadyHasViteTargets?: TargetFlags\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n const viteConfigPath = `${projectConfig.root}/vite.config.ts`;\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 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 forgot 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: [${\n options.uiFramework === 'react'\n ? \"'react', 'react-dom', 'react/jsx-runtime'\"\n : ''\n }]\n }\n },`\n : ``;\n\n const dtsPlugin = onlyVitest\n ? ''\n : options.includeLib\n ? `dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),`\n : '';\n\n const dtsImportLine = onlyVitest\n ? ''\n : options.includeLib\n ? `import dts from 'vite-plugin-dts';\\nimport { joinPathFragments } from '@nx/devkit';`\n : '';\n\n let viteConfigContent = '';\n\n const testOption = options.includeVitest\n ? `test: {\n globals: true,\n cache: {\n dir: '${offsetFromRoot(projectConfig.root)}node_modules/.vitest'\n },\n environment: '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 },`\n : '';\n\n const defineOption = options.inSourceTests\n ? `define: {\n 'import.meta.vitest': undefined\n },`\n : '';\n\n const reactPluginImportLine =\n options.uiFramework === 'react'\n ? options.compiler === 'swc'\n ? `import react from '@vitejs/plugin-react-swc';`\n : `import react from '@vitejs/plugin-react';`\n : '';\n\n const reactPlugin = options.uiFramework === 'react' ? `react(),` : '';\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 pluginOption = `\n plugins: [\n ${dtsPlugin}\n ${reactPlugin}\n viteTsConfigPaths({\n root: '${offsetFromRoot(projectConfig.root)}',\n }),\n ],\n `;\n\n const workerOption = `\n // Uncomment this if you are using workers. \n // worker: {\n // plugins: [\n // viteTsConfigPaths({\n // root: '${offsetFromRoot(projectConfig.root)}',\n // }),\n // ],\n // },`;\n\n const cacheDir = `cacheDir: '${offsetFromRoot(\n projectConfig.root\n )}node_modules/.vite/${options.project}',`;\n\n if (tree.exists(viteConfigPath)) {\n handleViteConfigFileExists(\n tree,\n viteConfigPath,\n options,\n buildOption,\n dtsPlugin,\n dtsImportLine,\n pluginOption,\n testOption,\n cacheDir,\n offsetFromRoot(projectConfig.root),\n projectAlreadyHasViteTargets\n );\n return;\n }\n\n viteConfigContent = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n ${reactPluginImportLine}\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n ${dtsImportLine}\n \n export default defineConfig({\n ${cacheDir}\n ${devServerOption}\n ${previewServerOption}\n ${pluginOption}\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 handleUnknownExecutors(projectName: string) {\n logger.warn(\n `\n We could not find any targets in project ${projectName} that use executors which \n can be converted to the @nx/vite executors.\n\n This either means that your project may not have a target \n for building, serving, or testing at all, or that your targets are \n using executors that are not known to Nx.\n \n If you still want to convert your project to use the @nx/vite executors,\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 the @nx/vite executors?`,\n initial: true,\n });\n const shouldConvert = await prompt.run();\n if (!shouldConvert) {\n throw new Error(`\n Nx could not verify that the executors you are using can be converted to the @nx/vite executors.\n Please try again with a different project.\n `);\n }\n}\n\nfunction handleViteConfigFileExists(\n tree: Tree,\n viteConfigPath: string,\n options: ViteConfigurationGeneratorSchema,\n buildOption: string,\n dtsPlugin: string,\n dtsImportLine: string,\n pluginOption: string,\n testOption: string,\n cacheDir: string,\n offsetFromRoot: string,\n projectAlreadyHasViteTargets?: TargetFlags\n) {\n if (projectAlreadyHasViteTargets.build && projectAlreadyHasViteTargets.test) {\n return;\n }\n\n logger.info(`vite.config.ts already exists for project ${options.project}.`);\n const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: options.project,\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external:\n options.uiFramework === 'react'\n ? ['react', 'react-dom', 'react/jsx-runtime']\n : [],\n },\n };\n\n const testOptionObject = {\n globals: true,\n cache: {\n dir: `${offsetFromRoot}node_modules/.vitest`,\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n };\n\n const changed = ensureViteConfigIsCorrect(\n tree,\n viteConfigPath,\n buildOption,\n buildOptionObject,\n dtsPlugin,\n dtsImportLine,\n pluginOption,\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 } else {\n logger.info(`\n Vite configuration file (${viteConfigPath}) has been updated with the required settings for the new target(s).\n `);\n }\n}\n"],"names":["findExistingTargetsInProject","addOrChangeTestTarget","addOrChangeBuildTarget","addOrChangeServeTarget","addPreviewTarget","editTsConfig","deleteWebpackConfig","moveAndEditIndexHtml","createOrEditViteConfig","normalizeViteConfigFilePathWithTree","getViteConfigPathForProject","handleUnsupportedUserProvidedTargets","handleUnknownExecutors","targets","userProvidedTargets","output","validFoundTargetName","projectContainsUnsupportedExecutor","userProvidedTargetIsUnsupported","alreadyHasNxViteTargets","supportedExecutors","build","serve","test","unsupportedExecutors","checkUserProvidedTarget","target","includes","executor","hasViteTargets","executorName","preview","foundTargets","tree","options","project","readProjectConfiguration","coveragePath","joinPathFragments","root","testOptions","passWithNoTests","reportsDirectory","offsetFromRoot","jestConfig","outputs","updateProjectConfiguration","buildOptions","outputPath","fileReplacements","base","baseHref","sourcemap","sourcemaps","defaultConfiguration","configurations","development","mode","production","serveTarget","serveOptions","buildTarget","https","hmr","open","proxyConfig","previewOptions","projectConfig","config","readJson","commonCompilerOptions","useDefineForClassFields","module","strict","moduleResolution","resolveJsonModule","isolatedModules","types","noEmit","uiFramework","compilerOptions","lib","allowJs","esModuleInterop","skipLibCheck","allowSyntheticDefaultImports","forceConsistentCasingInFileNames","jsx","include","noUnusedLocals","noUnusedParameters","noImplicitReturns","writeJson","projectRoot","webpackConfigFilePath","webpackConfigPath","exists","delete","indexHtmlPath","index","mainPath","main","replace","indexHtmlContent","read","write","onlyVitest","projectAlreadyHasViteTargets","viteConfigPath","buildOption","includeLib","dtsPlugin","dtsImportLine","viteConfigContent","testOption","includeVitest","inSourceTests","defineOption","reactPluginImportLine","compiler","reactPlugin","devServerOption","previewServerOption","pluginOption","workerOption","cacheDir","handleViteConfigFileExists","configFile","undefined","projectName","Object","values","find","userProvidedTargetName","handleUnsupportedUserProvidedTargetsErrors","logger","warn","Confirm","require","prompt","name","message","initial","shouldConvert","run","Error","info","buildOptionObject","entry","fileName","formats","rollupOptions","external","testOptionObject","globals","cache","dir","environment","changed","ensureViteConfigIsCorrect"],"mappings":";;;;;;;;IAuBgBA,4BAA4B;eAA5BA;;IA8IAC,qBAAqB;eAArBA;;IAoCAC,sBAAsB;eAAtBA;;IA6CAC,sBAAsB;eAAtBA;;IAqDAC,gBAAgB;eAAhBA;;IAyCAC,YAAY;eAAZA;;IAsDAC,mBAAmB;eAAnBA;;IAkBAC,oBAAoB;eAApBA;;IAmEAC,sBAAsB;eAA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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 { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';\nimport { VitestExecutorOptions } from '../executors/test/schema';\nimport { ViteConfigurationGeneratorSchema } from '../generators/configuration/schema';\nimport { ensureViteConfigIsCorrect } from './vite-config-edit-utils';\n\nexport type Target = 'build' | 'serve' | 'test' | 'preview';\nexport type TargetFlags = Partial<Record<Target, boolean>>;\nexport type UserProvidedTargetName = Partial<Record<Target, string>>;\nexport type ValidFoundTargetName = Partial<Record<Target, string>>;\n\nexport function findExistingTargetsInProject(\n targets: {\n [targetName: string]: TargetConfiguration;\n },\n userProvidedTargets?: UserProvidedTargetName\n): {\n validFoundTargetName: ValidFoundTargetName;\n projectContainsUnsupportedExecutor: boolean;\n userProvidedTargetIsUnsupported: TargetFlags;\n alreadyHasNxViteTargets: TargetFlags;\n} {\n const output: ReturnType<typeof findExistingTargetsInProject> = {\n validFoundTargetName: {},\n projectContainsUnsupportedExecutor: false,\n userProvidedTargetIsUnsupported: {},\n alreadyHasNxViteTargets: {},\n };\n\n const supportedExecutors = {\n build: [\n '@nxext/vite:build',\n '@nx/js:babel',\n '@nx/js:swc',\n '@nx/webpack:webpack',\n '@nx/rollup:rollup',\n '@nrwl/js:babel',\n '@nrwl/js:swc',\n '@nrwl/webpack:webpack',\n '@nrwl/rollup:rollup',\n '@nrwl/web:rollup',\n ],\n serve: [\n '@nxext/vite:dev',\n '@nx/webpack:dev-server',\n '@nrwl/webpack:dev-server',\n ],\n test: ['@nx/jest:jest', '@nrwl/jest:jest', '@nxext/vitest:vitest'],\n };\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/next:server',\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/next:server',\n '@nrwl/js:tsc',\n '@angular-devkit/build-angular:browser',\n '@angular-devkit/build-angular:dev-server',\n ];\n\n // First, we check if the user has provided a target\n // If they have, we check if the executor the target is using is supported\n // If it's not supported, then we set the unsupported flag to true for that target\n\n function checkUserProvidedTarget(target: Target) {\n if (userProvidedTargets?.[target]) {\n if (\n supportedExecutors[target].includes(\n targets[userProvidedTargets[target]]?.executor\n )\n ) {\n output.validFoundTargetName[target] = userProvidedTargets[target];\n } else {\n output.userProvidedTargetIsUnsupported[target] = true;\n }\n }\n }\n\n checkUserProvidedTarget('build');\n checkUserProvidedTarget('serve');\n checkUserProvidedTarget('test');\n\n // Returns early when we have a build, serve, and test targets.\n if (\n output.validFoundTargetName.build &&\n output.validFoundTargetName.serve &&\n output.validFoundTargetName.test\n ) {\n return output;\n }\n\n // We try to find the targets that are using the supported executors\n // for build, serve and test, since these are the ones we will be converting\n for (const target in targets) {\n const executorName = targets[target].executor;\n\n const hasViteTargets = output.alreadyHasNxViteTargets;\n hasViteTargets.build ||=\n executorName === '@nx/vite:build' || executorName === '@nrwl/vite:build';\n hasViteTargets.serve ||=\n executorName === '@nx/vite:dev-server' ||\n executorName === '@nrwl/vite:dev-server';\n hasViteTargets.test ||=\n executorName === '@nx/vite:test' || executorName === '@nrwl/vite:test';\n hasViteTargets.preview ||=\n executorName === '@nx/vite:preview-server' ||\n executorName === '@nrwl/vite:preview-server';\n\n const foundTargets = output.validFoundTargetName;\n if (\n !foundTargets.build &&\n supportedExecutors.build.includes(executorName)\n ) {\n foundTargets.build = target;\n }\n if (\n !foundTargets.serve &&\n supportedExecutors.serve.includes(executorName)\n ) {\n foundTargets.serve = target;\n }\n if (!foundTargets.test && supportedExecutors.test.includes(executorName)) {\n foundTargets.test = target;\n }\n\n output.projectContainsUnsupportedExecutor ||=\n unsupportedExecutors.includes(executorName);\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 coveragePath = joinPathFragments(\n 'coverage',\n project.root === '.' ? options.project : project.root\n );\n const testOptions: VitestExecutorOptions = {\n passWithNoTests: true,\n // vitest runs in the project root so we have to offset to the workspaceRoot\n reportsDirectory: joinPathFragments(\n offsetFromRoot(project.root),\n coveragePath\n ),\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: [coveragePath],\n options: testOptions,\n };\n }\n\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addOrChangeBuildTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\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\n project.targets ??= {};\n\n if (project.targets[target]) {\n buildOptions.fileReplacements =\n project.targets[target].options?.fileReplacements;\n\n if (project.targets[target].executor === '@nxext/vite:build') {\n buildOptions.base = project.targets[target].options?.baseHref;\n buildOptions.sourcemap = project.targets[target].options?.sourcemaps;\n }\n project.targets[target].options = { ...buildOptions };\n project.targets[target].executor = '@nx/vite:build';\n } else {\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\n updateProjectConfiguration(tree, options.project, project);\n}\n\nexport function addOrChangeServeTarget(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n target: string\n) {\n const project = readProjectConfiguration(tree, options.project);\n\n project.targets ??= {};\n\n if (project.targets[target]) {\n const serveTarget = project.targets[target];\n const serveOptions: ViteDevServerExecutorOptions = {\n buildTarget: `${options.project}:build`,\n https: project.targets[target].options?.https,\n hmr: project.targets[target].options?.hmr,\n open: project.targets[target].options?.open,\n };\n if (serveTarget.executor === '@nxext/vite:dev') {\n serveOptions.proxyConfig = project.targets[target].options.proxyConfig;\n }\n serveTarget.executor = '@nx/vite:dev-server';\n serveTarget.options = serveOptions;\n } else {\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\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 * @param previewTarget The preview target to create.\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 const commonCompilerOptions = {\n target: 'ESNext',\n useDefineForClassFields: true,\n module: 'ESNext',\n strict: true,\n moduleResolution: 'Node',\n resolveJsonModule: true,\n isolatedModules: true,\n types: ['vite/client'],\n noEmit: true,\n };\n\n switch (options.uiFramework) {\n case 'react':\n config.compilerOptions = {\n ...commonCompilerOptions,\n lib: ['DOM', 'DOM.Iterable', 'ESNext'],\n allowJs: false,\n esModuleInterop: false,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n forceConsistentCasingInFileNames: true,\n jsx: 'react-jsx',\n };\n config.include = [...config.include, 'src'];\n break;\n case 'none':\n config.compilerOptions = {\n ...commonCompilerOptions,\n lib: ['ESNext', 'DOM'],\n skipLibCheck: true,\n esModuleInterop: true,\n strict: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n noImplicitReturns: true,\n };\n config.include = [...config.include, 'src'];\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 buildTarget: string\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n let indexHtmlPath =\n projectConfig.targets?.[buildTarget]?.options?.index ??\n `${projectConfig.root}/src/index.html`;\n let mainPath =\n projectConfig.targets?.[buildTarget]?.options?.main ??\n `${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 function createOrEditViteConfig(\n tree: Tree,\n options: ViteConfigurationGeneratorSchema,\n onlyVitest: boolean,\n projectAlreadyHasViteTargets?: TargetFlags\n) {\n const projectConfig = readProjectConfiguration(tree, options.project);\n\n const viteConfigPath = `${projectConfig.root}/vite.config.ts`;\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 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: [${\n options.uiFramework === 'react'\n ? \"'react', 'react-dom', 'react/jsx-runtime'\"\n : ''\n }]\n }\n },`\n : ``;\n\n const dtsPlugin = onlyVitest\n ? ''\n : options.includeLib\n ? `dts({\n entryRoot: 'src',\n tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),`\n : '';\n\n const dtsImportLine = onlyVitest\n ? ''\n : options.includeLib\n ? `import dts from 'vite-plugin-dts';\\nimport * as path from 'path';`\n : '';\n\n let viteConfigContent = '';\n\n const testOption = options.includeVitest\n ? `test: {\n globals: true,\n cache: {\n dir: '${offsetFromRoot(projectConfig.root)}node_modules/.vitest'\n },\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 },`\n : '';\n\n const defineOption = options.inSourceTests\n ? `define: {\n 'import.meta.vitest': undefined\n },`\n : '';\n\n const reactPluginImportLine =\n options.uiFramework === 'react'\n ? options.compiler === 'swc'\n ? `import react from '@vitejs/plugin-react-swc';`\n : `import react from '@vitejs/plugin-react';`\n : '';\n\n const reactPlugin = options.uiFramework === 'react' ? `react(),` : '';\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 pluginOption = `\n plugins: [\n ${dtsPlugin}\n ${reactPlugin}\n viteTsConfigPaths({\n root: '${offsetFromRoot(projectConfig.root)}',\n }),\n ],\n `;\n\n const workerOption = `\n // Uncomment this if you are using workers. \n // worker: {\n // plugins: [\n // viteTsConfigPaths({\n // root: '${offsetFromRoot(projectConfig.root)}',\n // }),\n // ],\n // },`;\n\n const cacheDir = `cacheDir: '${offsetFromRoot(\n projectConfig.root\n )}node_modules/.vite/${options.project}',`;\n\n if (tree.exists(viteConfigPath)) {\n handleViteConfigFileExists(\n tree,\n viteConfigPath,\n options,\n buildOption,\n dtsPlugin,\n dtsImportLine,\n pluginOption,\n testOption,\n cacheDir,\n offsetFromRoot(projectConfig.root),\n projectAlreadyHasViteTargets\n );\n return;\n }\n\n viteConfigContent = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n ${reactPluginImportLine}\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n ${dtsImportLine}\n \n export default defineConfig({\n ${cacheDir}\n ${devServerOption}\n ${previewServerOption}\n ${pluginOption}\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 handleUnknownExecutors(projectName: string) {\n logger.warn(\n `\n We could not find any targets in project ${projectName} that use executors which \n can be converted to the @nx/vite executors.\n\n This either means that your project may not have a target \n for building, serving, or testing at all, or that your targets are \n using executors that are not known to Nx.\n \n If you still want to convert your project to use the @nx/vite executors,\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 the @nx/vite executors?`,\n initial: true,\n });\n const shouldConvert = await prompt.run();\n if (!shouldConvert) {\n throw new Error(`\n Nx could not verify that the executors you are using can be converted to the @nx/vite executors.\n Please try again with a different project.\n `);\n }\n}\n\nfunction handleViteConfigFileExists(\n tree: Tree,\n viteConfigPath: string,\n options: ViteConfigurationGeneratorSchema,\n buildOption: string,\n dtsPlugin: string,\n dtsImportLine: string,\n pluginOption: string,\n testOption: string,\n cacheDir: string,\n offsetFromRoot: string,\n projectAlreadyHasViteTargets?: TargetFlags\n) {\n if (projectAlreadyHasViteTargets.build && projectAlreadyHasViteTargets.test) {\n return;\n }\n\n logger.info(`vite.config.ts already exists for project ${options.project}.`);\n const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: options.project,\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external:\n options.uiFramework === 'react'\n ? ['react', 'react-dom', 'react/jsx-runtime']\n : [],\n },\n };\n\n const testOptionObject = {\n globals: true,\n cache: {\n dir: `${offsetFromRoot}node_modules/.vitest`,\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n };\n\n const changed = ensureViteConfigIsCorrect(\n tree,\n viteConfigPath,\n buildOption,\n buildOptionObject,\n dtsPlugin,\n dtsImportLine,\n pluginOption,\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 } else {\n logger.info(`\n Vite configuration file (${viteConfigPath}) has been updated with the required settings for the new target(s).\n `);\n }\n}\n"],"names":["findExistingTargetsInProject","addOrChangeTestTarget","addOrChangeBuildTarget","addOrChangeServeTarget","addPreviewTarget","editTsConfig","deleteWebpackConfig","moveAndEditIndexHtml","createOrEditViteConfig","normalizeViteConfigFilePathWithTree","getViteConfigPathForProject","handleUnsupportedUserProvidedTargets","handleUnknownExecutors","targets","userProvidedTargets","output","validFoundTargetName","projectContainsUnsupportedExecutor","userProvidedTargetIsUnsupported","alreadyHasNxViteTargets","supportedExecutors","build","serve","test","unsupportedExecutors","checkUserProvidedTarget","target","includes","executor","hasViteTargets","executorName","preview","foundTargets","tree","options","project","readProjectConfiguration","coveragePath","joinPathFragments","root","testOptions","passWithNoTests","reportsDirectory","offsetFromRoot","jestConfig","outputs","updateProjectConfiguration","buildOptions","outputPath","fileReplacements","base","baseHref","sourcemap","sourcemaps","defaultConfiguration","configurations","development","mode","production","serveTarget","serveOptions","buildTarget","https","hmr","open","proxyConfig","previewOptions","projectConfig","config","readJson","commonCompilerOptions","useDefineForClassFields","module","strict","moduleResolution","resolveJsonModule","isolatedModules","types","noEmit","uiFramework","compilerOptions","lib","allowJs","esModuleInterop","skipLibCheck","allowSyntheticDefaultImports","forceConsistentCasingInFileNames","jsx","include","noUnusedLocals","noUnusedParameters","noImplicitReturns","writeJson","projectRoot","webpackConfigFilePath","webpackConfigPath","exists","delete","indexHtmlPath","index","mainPath","main","replace","indexHtmlContent","read","write","onlyVitest","projectAlreadyHasViteTargets","viteConfigPath","buildOption","includeLib","dtsPlugin","dtsImportLine","viteConfigContent","testOption","includeVitest","testEnvironment","inSourceTests","defineOption","reactPluginImportLine","compiler","reactPlugin","devServerOption","previewServerOption","pluginOption","workerOption","cacheDir","handleViteConfigFileExists","configFile","undefined","projectName","Object","values","find","userProvidedTargetName","handleUnsupportedUserProvidedTargetsErrors","logger","warn","Confirm","require","prompt","name","message","initial","shouldConvert","run","Error","info","buildOptionObject","entry","fileName","formats","rollupOptions","external","testOptionObject","globals","cache","dir","environment","changed","ensureViteConfigIsCorrect"],"mappings":";;;;;;;;IAuBgBA,4BAA4B;eAA5BA;;IA8IAC,qBAAqB;eAArBA;;IAoCAC,sBAAsB;eAAtBA;;IA6CAC,sBAAsB;eAAtBA;;IAqDAC,gBAAgB;eAAhBA;;IAyCAC,YAAY;eAAZA;;IAsDAC,mBAAmB;eAAnBA;;IAkBAC,oBAAoB;eAApBA;;IAmEAC,sBAAsB;eAAtBA;;IAwKAC,mCAAmC;eAAnCA;;IAcAC,2BAA2B;eAA3BA;;IAqBMC,oCAAoC;eAApCA;;IAmEAC,sBAAsB;eAAtBA;;;;wBAnuBf;qCAMmC;AAOnC,SAASZ,6BACda,OAEC,EACDC,mBAA4C,EAM5C;IACA,MAAMC,SAA0D;QAC9DC,sBAAsB,CAAC;QACvBC,oCAAoC,KAAK;QACzCC,iCAAiC,CAAC;QAClCC,yBAAyB,CAAC;IAC5B;IAEA,MAAMC,qBAAqB;QACzBC,OAAO;YACL;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YACL;YACA;YACA;SACD;QACDC,MAAM;YAAC;YAAiB;YAAmB;SAAuB;IACpE;IAEA,MAAMC,uBAAuB;QAC3B;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;QACA;QACA;KACD;IAED,oDAAoD;IACpD,0EAA0E;IAC1E,kFAAkF;IAElF,SAASC,wBAAwBC,MAAc,EAAE;QAC/C,IAAIZ,8BAAAA,KAAAA,IAAAA,mBAAqB,CAACY,OAAO,EAAE;gBAG7Bb;YAFJ,IACEO,kBAAkB,CAACM,OAAO,CAACC,QAAQ,CACjCd,CAAAA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B;QACvBC,SAAS,IAAI;QACbC,OAAO;YACLC,KAAK,CAAC,EAAElH,eAAe,oBAAoB,CAAC;QAC9C;QACAmH,aAAa;QACbtE,SAAS;YAAC;SAAuD;IACnE;IAEA,MAAMuE,UAAUC,IAAAA,8CAAyB,EACvC/H,MACA2E,gBACAC,aACAuC,mBACArC,WACAC,eACAY,cACAV,YACAwC,kBACA5B,UACAnB;IAGF,IAAI,CAACoD,SAAS;QACZvB,cAAM,CAACC,IAAI,CACT,CAAC,wEAAwE,EAAE7B,eAAe;;QAExF,EAAEC,YAAY;;QAEd,CAAC;IAEP,OAAO;QACL2B,cAAM,CAACW,IAAI,CAAC,CAAC;+BACc,EAAEvC,eAAe;MAC1C,CAAC;IACL,CAAC;AACH"}
@@ -7,6 +7,7 @@ import { ViteBuildExecutorOptions } from '../executors/build/schema';
7
7
  * Returns the path to the vite config file or undefined when not found.
8
8
  */
9
9
  export declare function normalizeViteConfigFilePath(projectRoot: string, configFile?: string): string | undefined;
10
+ export declare function getProjectTsConfigPath(projectRoot: string): string | undefined;
10
11
  /**
11
12
  * Returns the path to the proxy configuration file or undefined when not found.
12
13
  */
@@ -9,6 +9,9 @@ _export(exports, {
9
9
  normalizeViteConfigFilePath: function() {
10
10
  return normalizeViteConfigFilePath;
11
11
  },
12
+ getProjectTsConfigPath: function() {
13
+ return getProjectTsConfigPath;
14
+ },
12
15
  getViteServerProxyConfigPath: function() {
13
16
  return getViteServerProxyConfigPath;
14
17
  },
@@ -41,7 +44,10 @@ function normalizeViteConfigFilePath(projectRoot, configFile) {
41
44
  }
42
45
  return normalized;
43
46
  }
44
- return (0, _fs.existsSync)((0, _devkit.joinPathFragments)(`${projectRoot}/vite.config.ts`)) ? (0, _devkit.joinPathFragments)(`${projectRoot}/vite.config.ts`) : (0, _fs.existsSync)((0, _devkit.joinPathFragments)(`${projectRoot}/vite.config.js`)) ? (0, _devkit.joinPathFragments)(`${projectRoot}/vite.config.js`) : undefined;
47
+ return (0, _fs.existsSync)((0, _devkit.joinPathFragments)(projectRoot, 'vite.config.ts')) ? (0, _devkit.joinPathFragments)(projectRoot, 'vite.config.ts') : (0, _fs.existsSync)((0, _devkit.joinPathFragments)(projectRoot, 'vite.config.js')) ? (0, _devkit.joinPathFragments)(projectRoot, 'vite.config.js') : undefined;
48
+ }
49
+ function getProjectTsConfigPath(projectRoot) {
50
+ return (0, _fs.existsSync)((0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.app.json')) ? (0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.app.json') : (0, _fs.existsSync)((0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.lib.json')) ? (0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.lib.json') : (0, _fs.existsSync)((0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.json')) ? (0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.json') : undefined;
45
51
  }
46
52
  function getViteServerProxyConfigPath(nxProxyConfig, context) {
47
53
  if (nxProxyConfig) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/utils/options-utils.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n logger,\n parseTargetString,\n readTargetOptions,\n} from '@nx/devkit';\nimport { existsSync } from 'fs';\nimport { relative } from 'path';\nimport {\n BuildOptions,\n InlineConfig,\n PluginOption,\n PreviewOptions,\n searchForWorkspaceRoot,\n ServerOptions,\n} from 'vite';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';\nimport replaceFiles from '../../plugins/rollup-replace-files.plugin';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\n\n/**\n * Returns the path to the vite config file or undefined when not found.\n */\nexport function normalizeViteConfigFilePath(\n projectRoot: string,\n configFile?: string\n): string | undefined {\n if (configFile) {\n const normalized = joinPathFragments(configFile);\n if (!existsSync(normalized)) {\n throw new Error(\n `Could not find vite config at provided path \"${normalized}\".`\n );\n }\n return normalized;\n }\n return existsSync(joinPathFragments(`${projectRoot}/vite.config.ts`))\n ? joinPathFragments(`${projectRoot}/vite.config.ts`)\n : existsSync(joinPathFragments(`${projectRoot}/vite.config.js`))\n ? joinPathFragments(`${projectRoot}/vite.config.js`)\n : undefined;\n}\n\n/**\n * Returns the path to the proxy configuration file or undefined when not found.\n */\nexport function getViteServerProxyConfigPath(\n nxProxyConfig: string | undefined,\n context: ExecutorContext\n): string | undefined {\n if (nxProxyConfig) {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n const proxyConfigPath = nxProxyConfig\n ? joinPathFragments(context.root, nxProxyConfig)\n : joinPathFragments(projectRoot, 'proxy.conf.json');\n\n if (existsSync(proxyConfigPath)) {\n return proxyConfigPath;\n }\n }\n}\n\n/**\n * Builds the shared options for vite.\n *\n * Most shared options are derived from the build target.\n */\nexport function getViteSharedConfig(\n options: ViteBuildExecutorOptions,\n clearScreen: boolean | undefined,\n context: ExecutorContext\n): InlineConfig {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n const root = relative(\n context.cwd,\n joinPathFragments(context.root, projectRoot)\n );\n\n return {\n mode: options.mode,\n root,\n base: options.base,\n configFile: normalizeViteConfigFilePath(projectRoot, options.configFile),\n plugins: [replaceFiles(options.fileReplacements) as PluginOption],\n optimizeDeps: { force: options.force },\n clearScreen: clearScreen,\n logLevel: options.logLevel,\n };\n}\n\n/**\n * Builds the options for the vite dev server.\n */\nexport function getViteServerOptions(\n options: ViteDevServerExecutorOptions,\n context: ExecutorContext\n): ServerOptions {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n const serverOptions: ServerOptions = {\n host: options.host,\n port: options.port,\n https: options.https,\n hmr: options.hmr,\n open: options.open,\n cors: options.cors,\n fs: {\n allow: [\n searchForWorkspaceRoot(joinPathFragments(projectRoot)),\n joinPathFragments(context.root, 'node_modules/vite'),\n ],\n },\n };\n\n const proxyConfigPath = getViteServerProxyConfigPath(\n options.proxyConfig,\n context\n );\n if (proxyConfigPath) {\n logger.info(`Loading proxy configuration from: ${proxyConfigPath}`);\n serverOptions.proxy = require(proxyConfigPath);\n }\n\n return serverOptions;\n}\n\n/**\n * Builds the build options for the vite.\n */\nexport function getViteBuildOptions(\n options: ViteBuildExecutorOptions,\n context: ExecutorContext\n): BuildOptions {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n return {\n outDir: relative(projectRoot, options.outputPath),\n emptyOutDir: options.emptyOutDir,\n reportCompressedSize: true,\n cssCodeSplit: options.cssCodeSplit,\n target: options.target ?? 'esnext',\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n sourcemap: options.sourcemap,\n minify: options.minify,\n manifest: options.manifest,\n ssrManifest: options.ssrManifest,\n ssr: options.ssr,\n watch: options.watch as BuildOptions['watch'],\n };\n}\n\n/**\n * Builds the options for the vite preview server.\n */\nexport function getVitePreviewOptions(\n options: VitePreviewServerExecutorOptions,\n context: ExecutorContext\n): PreviewOptions {\n const serverOptions: ServerOptions = {\n host: options.host,\n port: options.port,\n https: options.https,\n open: options.open,\n };\n\n const proxyConfigPath = getViteServerProxyConfigPath(\n options.proxyConfig,\n context\n );\n if (proxyConfigPath) {\n logger.info(`Loading proxy configuration from: ${proxyConfigPath}`);\n serverOptions.proxy = require(proxyConfigPath);\n }\n\n return serverOptions;\n}\n\nexport function getNxTargetOptions(target: string, context: ExecutorContext) {\n const targetObj = parseTargetString(target, context.projectGraph);\n return readTargetOptions(targetObj, context);\n}\n"],"names":["normalizeViteConfigFilePath","getViteServerProxyConfigPath","getViteSharedConfig","getViteServerOptions","getViteBuildOptions","getVitePreviewOptions","getNxTargetOptions","projectRoot","configFile","normalized","joinPathFragments","existsSync","Error","undefined","nxProxyConfig","context","projectsConfigurations","projects","projectName","root","proxyConfigPath","options","clearScreen","relative","cwd","mode","base","plugins","replaceFiles","fileReplacements","optimizeDeps","force","logLevel","serverOptions","host","port","https","hmr","open","cors","fs","allow","searchForWorkspaceRoot","proxyConfig","logger","info","proxy","require","outDir","outputPath","emptyOutDir","reportCompressedSize","cssCodeSplit","target","commonjsOptions","transformMixedEsModules","sourcemap","minify","manifest","ssrManifest","ssr","watch","targetObj","parseTargetString","projectGraph","readTargetOptions"],"mappings":";;;;;;;;IAyBgBA,2BAA2B;eAA3BA;;IAuBAC,4BAA4B;eAA5BA;;IAuBAC,mBAAmB;eAAnBA;;IA4BAC,oBAAoB;eAApBA;;IAoCAC,mBAAmB;eAAnBA;;IA4BAC,qBAAqB;eAArBA;;IAuBAC,kBAAkB;eAAlBA;;;wBApLT;oBACoB;sBACF;sBAQlB;0CAGkB;AAMlB,SAASN,4BACdO,WAAmB,EACnBC,UAAmB,EACC;IACpB,IAAIA,YAAY;QACd,MAAMC,aAAaC,IAAAA,yBAAiB,EAACF;QACrC,IAAI,CAACG,IAAAA,cAAU,EAACF,aAAa;YAC3B,MAAM,IAAIG,MACR,CAAC,6CAA6C,EAAEH,WAAW,EAAE,CAAC,EAC9D;QACJ,CAAC;QACD,OAAOA;IACT,CAAC;IACD,OAAOE,IAAAA,cAAU,EAACD,IAAAA,yBAAiB,EAAC,CAAC,EAAEH,YAAY,eAAe,CAAC,KAC/DG,IAAAA,yBAAiB,EAAC,CAAC,EAAEH,YAAY,eAAe,CAAC,IACjDI,IAAAA,cAAU,EAACD,IAAAA,yBAAiB,EAAC,CAAC,EAAEH,YAAY,eAAe,CAAC,KAC5DG,IAAAA,yBAAiB,EAAC,CAAC,EAAEH,YAAY,eAAe,CAAC,IACjDM,SAAS;AACf;AAKO,SAASZ,6BACda,aAAiC,EACjCC,OAAwB,EACJ;IACpB,IAAID,eAAe;QACjB,MAAMP,cACJQ,QAAQC,sBAAsB,CAACC,QAAQ,CAACF,QAAQG,WAAW,CAAC,CAACC,IAAI;QAEnE,MAAMC,kBAAkBN,gBACpBJ,IAAAA,yBAAiB,EAACK,QAAQI,IAAI,EAAEL,iBAChCJ,IAAAA,yBAAiB,EAACH,aAAa,kBAAkB;QAErD,IAAII,I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AACtC"}
1
+ {"version":3,"sources":["../../../../../packages/vite/src/utils/options-utils.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n logger,\n parseTargetString,\n readTargetOptions,\n} from '@nx/devkit';\nimport { existsSync } from 'fs';\nimport { relative } from 'path';\nimport {\n BuildOptions,\n InlineConfig,\n PluginOption,\n PreviewOptions,\n searchForWorkspaceRoot,\n ServerOptions,\n} from 'vite';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';\nimport replaceFiles from '../../plugins/rollup-replace-files.plugin';\nimport { ViteBuildExecutorOptions } from '../executors/build/schema';\n\n/**\n * Returns the path to the vite config file or undefined when not found.\n */\nexport function normalizeViteConfigFilePath(\n projectRoot: string,\n configFile?: string\n): string | undefined {\n if (configFile) {\n const normalized = joinPathFragments(configFile);\n if (!existsSync(normalized)) {\n throw new Error(\n `Could not find vite config at provided path \"${normalized}\".`\n );\n }\n return normalized;\n }\n return existsSync(joinPathFragments(projectRoot, 'vite.config.ts'))\n ? joinPathFragments(projectRoot, 'vite.config.ts')\n : existsSync(joinPathFragments(projectRoot, 'vite.config.js'))\n ? joinPathFragments(projectRoot, 'vite.config.js')\n : undefined;\n}\n\nexport function getProjectTsConfigPath(\n projectRoot: string\n): string | undefined {\n return existsSync(joinPathFragments(projectRoot, 'tsconfig.app.json'))\n ? joinPathFragments(projectRoot, 'tsconfig.app.json')\n : existsSync(joinPathFragments(projectRoot, 'tsconfig.lib.json'))\n ? joinPathFragments(projectRoot, 'tsconfig.lib.json')\n : existsSync(joinPathFragments(projectRoot, 'tsconfig.json'))\n ? joinPathFragments(projectRoot, 'tsconfig.json')\n : undefined;\n}\n\n/**\n * Returns the path to the proxy configuration file or undefined when not found.\n */\nexport function getViteServerProxyConfigPath(\n nxProxyConfig: string | undefined,\n context: ExecutorContext\n): string | undefined {\n if (nxProxyConfig) {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n const proxyConfigPath = nxProxyConfig\n ? joinPathFragments(context.root, nxProxyConfig)\n : joinPathFragments(projectRoot, 'proxy.conf.json');\n\n if (existsSync(proxyConfigPath)) {\n return proxyConfigPath;\n }\n }\n}\n\n/**\n * Builds the shared options for vite.\n *\n * Most shared options are derived from the build target.\n */\nexport function getViteSharedConfig(\n options: ViteBuildExecutorOptions,\n clearScreen: boolean | undefined,\n context: ExecutorContext\n): InlineConfig {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n const root = relative(\n context.cwd,\n joinPathFragments(context.root, projectRoot)\n );\n\n return {\n mode: options.mode,\n root,\n base: options.base,\n configFile: normalizeViteConfigFilePath(projectRoot, options.configFile),\n plugins: [replaceFiles(options.fileReplacements) as PluginOption],\n optimizeDeps: { force: options.force },\n clearScreen: clearScreen,\n logLevel: options.logLevel,\n };\n}\n\n/**\n * Builds the options for the vite dev server.\n */\nexport function getViteServerOptions(\n options: ViteDevServerExecutorOptions,\n context: ExecutorContext\n): ServerOptions {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n const serverOptions: ServerOptions = {\n host: options.host,\n port: options.port,\n https: options.https,\n hmr: options.hmr,\n open: options.open,\n cors: options.cors,\n fs: {\n allow: [\n searchForWorkspaceRoot(joinPathFragments(projectRoot)),\n joinPathFragments(context.root, 'node_modules/vite'),\n ],\n },\n };\n\n const proxyConfigPath = getViteServerProxyConfigPath(\n options.proxyConfig,\n context\n );\n if (proxyConfigPath) {\n logger.info(`Loading proxy configuration from: ${proxyConfigPath}`);\n serverOptions.proxy = require(proxyConfigPath);\n }\n\n return serverOptions;\n}\n\n/**\n * Builds the build options for the vite.\n */\nexport function getViteBuildOptions(\n options: ViteBuildExecutorOptions,\n context: ExecutorContext\n): BuildOptions {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n return {\n outDir: relative(projectRoot, options.outputPath),\n emptyOutDir: options.emptyOutDir,\n reportCompressedSize: true,\n cssCodeSplit: options.cssCodeSplit,\n target: options.target ?? 'esnext',\n commonjsOptions: {\n transformMixedEsModules: true,\n },\n sourcemap: options.sourcemap,\n minify: options.minify,\n manifest: options.manifest,\n ssrManifest: options.ssrManifest,\n ssr: options.ssr,\n watch: options.watch as BuildOptions['watch'],\n };\n}\n\n/**\n * Builds the options for the vite preview server.\n */\nexport function getVitePreviewOptions(\n options: VitePreviewServerExecutorOptions,\n context: ExecutorContext\n): PreviewOptions {\n const serverOptions: ServerOptions = {\n host: options.host,\n port: options.port,\n https: options.https,\n open: options.open,\n };\n\n const proxyConfigPath = getViteServerProxyConfigPath(\n options.proxyConfig,\n context\n );\n if (proxyConfigPath) {\n logger.info(`Loading proxy configuration from: ${proxyConfigPath}`);\n serverOptions.proxy = require(proxyConfigPath);\n }\n\n return serverOptions;\n}\n\nexport function getNxTargetOptions(target: string, context: ExecutorContext) {\n const targetObj = parseTargetString(target, context.projectGraph);\n return readTargetOptions(targetObj, context);\n}\n"],"names":["normalizeViteConfigFilePath","getProjectTsConfigPath","getViteServerProxyConfigPath","getViteSharedConfig","getViteServerOptions","getViteBuildOptions","getVitePreviewOptions","getNxTargetOptions","projectRoot","configFile","normalized","joinPathFragments","existsSync","Error","undefined","nxProxyConfig","context","projectsConfigurations","projects","projectName","root","proxyConfigPath","options","clearScreen","relative","cwd","mode","base","plugins","replaceFiles","fileReplacements","optimizeDeps","force","logLevel","serverOptions","host","port","https","hmr","open","cors","fs","allow","searchForWorkspaceRoot","proxyConfig","logger","info","proxy","require","outDir","outputPath","emptyOutDir","reportCompressedSize","cssCodeSplit","target","commonjsOptions","transformMixedEsModules","sourcemap","minify","manifest","ssrManifest","ssr","watch","targetObj","parseTargetString","projectGraph","readTargetOptions"],"mappings":";;;;;;;;IAyBgBA,2BAA2B;eAA3BA;;IAoBAC,sBAAsB;eAAtBA;;IAeAC,4BAA4B;eAA5BA;;IAuBAC,mBAAmB;eAAnBA;;IA4BAC,oBAAoB;eAApBA;;IAoCAC,mBAAmB;eAAnBA;;IA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reference types=\"vitest\"
5
5
  export declare const configNoDefineConfig = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default {\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\n ],\n };\n ";
6
6
  export declare const noBuildOptionsHasTestOption = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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 ";
7
7
  export declare const someBuildOptionsSomeTestOption = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),\n react(),\n viteTsConfigPaths({\n root: '../../../',\n }),\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 forgot to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n cache: {\n dir: '../../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n ";
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 forgot 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 },";
8
+ export declare const hasEverything = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),\n react(),\n viteTsConfigPaths({\n root: '../../../',\n }),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n cache: {\n dir: '../../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n ";
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: {
12
12
  entry: string;
@@ -225,7 +225,7 @@ const hasEverything = `
225
225
  name: 'pure-libs-react-vite',
226
226
  fileName: 'index',
227
227
  // Change this to the formats you want to support.
228
- // Don't forgot to update your package.json as well.
228
+ // Don't forget to update your package.json as well.
229
229
  formats: ['es', 'cjs'],
230
230
  },
231
231
  rollupOptions: {
@@ -254,7 +254,7 @@ const buildOption = `
254
254
  name: 'my-app',
255
255
  fileName: 'index',
256
256
  // Change this to the formats you want to support.
257
- // Don't forgot to update your package.json as well.
257
+ // Don't forget to update your package.json as well.
258
258
  formats: ['es', 'cjs']
259
259
  },
260
260
  rollupOptions: {
@@ -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 viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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\nexport const someBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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 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 viteTsConfigPaths from 'vite-tsconfig-paths';\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default {\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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\nexport const someBuildOptionsSomeTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),\n react(),\n viteTsConfigPaths({\n root: '../../../',\n }),\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 forgot to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n cache: {\n dir: '../../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `;\n\nexport const buildOption = `\n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forgot to update your package.json as well.\n formats: ['es', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: [\"'react', 'react-dom', 'react/jsx-runtime'\"]\n }\n },`;\nexport const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external: [\"'react', 'react-dom', 'react/jsx-runtime'\"],\n },\n};\n\nexport const testOption = `test: {\n globals: true,\n cache: {\n dir: '../node_modules/.vitest'\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },`;\n\nexport const testOptionObject = {\n globals: true,\n cache: {\n dir: `../node_modules/.vitest`,\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n};\n\nexport const dtsPlugin = `dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),`;\nexport const dtsImportLine = `import dts from 'vite-plugin-dts';\\nimport { joinPathFragments } from '@nx/devkit';`;\n\nexport const pluginOption = `\n plugins: [\n ${dtsPlugin}\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\n ],\n `;\n"],"names":["noBuildOptions","someBuildOptions","noContentDefineConfig","conditionalConfig","configNoDefineConfig","noBuildOptionsHasTestOption","someBuildOptionsSomeTestOption","hasEverything","buildOption","buildOptionObject","testOption","testOptionObject","dtsPlugin","dtsImportLine","pluginOption","lib","entry","name","fileName","formats","rollupOptions","external","globals","cache","dir","environment","include"],"mappings":";;;;;;;;IAAaA,cAAc;eAAdA;;IA0BAC,gBAAgB;eAAhBA;;IA8BAC,qBAAqB;eAArBA;;IASAC,iBAAiB;eAAjBA;;IAkBAC,oBAAoB;eAApBA;;IAgBAC,2BAA2B;eAA3BA;;IA0BAC,8BAA8B;eAA9BA;;IAyBAC,aAAa;eAAbA;;IAkDAC,WAAW;eAAXA;;IAkBAC,iBAAiB;eAAjBA;;IAYAC,UAAU;eAAVA;;IASAC,gBAAgB;eAAhBA;;IASAC,SAAS;eAATA;;IAKAC,aAAa;eAAbA;;IAEAC,YAAY;eAAZA;;;AA/PN,MAAMd,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;IAwB3B,CAAC;AAEE,MAAMC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4B7B,CAAC;AAEE,MAAMC,wBAAwB,CAAC;;;;;;;IAOlC,CAAC;AAEE,MAAMC,oBAAoB,CAAC;;;;;;;;;;;;;;;;IAgB9B,CAAC;AAEE,MAAMC,uBAAuB,CAAC;;;;;;;;;;;;;;IAcjC,CAAC;AAEE,MAAMC,8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;IAwBxC,CAAC;AAEE,MAAMC,iCAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;IAuB3C,CAAC;AAEE,MAAMC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgD1B,CAAC;AAEE,MAAMC,cAAc,CAAC;;;;;;;;;;;;;;;;;MAiBtB,CAAC;AACA,MAAMC,oBAAoB;IAC/BM,KAAK;QACHC,OAAO;QACPC,MAAM;QACNC,UAAU;QACVC,SAAS;YAAC;YAAM;SAAM;IACxB;IACAC,eAAe;QACbC,UAAU;YAAC;SAA4C;IACzD;AACF;AAEO,MAAMX,aAAa,CAAC;;;;;;;MAOrB,CAAC;AAEA,MAAMC,mBAAmB;IAC9BW,SAAS,IAAI;IACbC,OAAO;QACLC,KAAK,CAAC,uBAAuB,CAAC;IAChC;IACAC,aAAa;IACbC,SAAS;QAAC;KAAuD;AACnE;AAEO,MAAMd,YAAY,CAAC;;;;OAInB,CAAC;AACD,MAAMC,gBAAgB,CAAC,mFAAmF,CAAC;AAE3G,MAAMC,eAAe,CAAC;;MAEvB,EAAEF,UAAU;;;;;;IAMd,CAAC"}
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 viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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\nexport const someBuildOptions = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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 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 viteTsConfigPaths from 'vite-tsconfig-paths';\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default {\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\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\nexport const someBuildOptionsSomeTestOption = `\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\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 viteTsConfigPaths from 'vite-tsconfig-paths';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n plugins: [\n dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),\n react(),\n viteTsConfigPaths({\n root: '../../../',\n }),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n cache: {\n dir: '../../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `;\n\nexport const buildOption = `\n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es', 'cjs']\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: [\"'react', 'react-dom', 'react/jsx-runtime'\"]\n }\n },`;\nexport const buildOptionObject = {\n lib: {\n entry: 'src/index.ts',\n name: 'my-app',\n fileName: 'index',\n formats: ['es', 'cjs'],\n },\n rollupOptions: {\n external: [\"'react', 'react-dom', 'react/jsx-runtime'\"],\n },\n};\n\nexport const testOption = `test: {\n globals: true,\n cache: {\n dir: '../node_modules/.vitest'\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },`;\n\nexport const testOptionObject = {\n globals: true,\n cache: {\n dir: `../node_modules/.vitest`,\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n};\n\nexport const dtsPlugin = `dts({\n entryRoot: 'src',\n tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'),\n skipDiagnostics: true,\n }),`;\nexport const dtsImportLine = `import dts from 'vite-plugin-dts';\\nimport { joinPathFragments } from '@nx/devkit';`;\n\nexport const pluginOption = `\n plugins: [\n ${dtsPlugin}\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\n ],\n `;\n"],"names":["noBuildOptions","someBuildOptions","noContentDefineConfig","conditionalConfig","configNoDefineConfig","noBuildOptionsHasTestOption","someBuildOptionsSomeTestOption","hasEverything","buildOption","buildOptionObject","testOption","testOptionObject","dtsPlugin","dtsImportLine","pluginOption","lib","entry","name","fileName","formats","rollupOptions","external","globals","cache","dir","environment","include"],"mappings":";;;;;;;;IAAaA,cAAc;eAAdA;;IA0BAC,gBAAgB;eAAhBA;;IA8BAC,qBAAqB;eAArBA;;IASAC,iBAAiB;eAAjBA;;IAkBAC,oBAAoB;eAApBA;;IAgBAC,2BAA2B;eAA3BA;;IA0BAC,8BAA8B;eAA9BA;;IAyBAC,aAAa;eAAbA;;IAkDAC,WAAW;eAAXA;;IAkBAC,iBAAiB;eAAjBA;;IAYAC,UAAU;eA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export declare const viteVersion = "^4.3.4";
3
- export declare const vitePluginEslintVersion = "^1.8.1";
4
- export declare const vitestVersion = "^0.31.0";
5
- export declare const vitestUiVersion = "^0.31.0";
6
- export declare const vitePluginReactVersion = "^3.0.0";
7
- export declare const vitePluginReactSwcVersion = "^3.3.1";
8
- export declare const vitePluginVueVersion = "^3.2.0";
9
- export declare const vitePluginVueJsxVersion = "^2.1.1";
10
- export declare const viteTsConfigPathsVersion = "^4.0.2";
11
- export declare const jsdomVersion = "~20.0.3";
12
- export declare const vitePluginDtsVersion = "~1.7.1";
13
- export declare const vitestCoverageC8Version = "^0.31.0";
14
- export declare const vitestCoverageIstanbulVersion = "^0.31.0";
2
+ export declare const viteVersion = "^4.3.9";
3
+ export declare const vitestVersion = "^0.32.0";
4
+ export declare const vitestUiVersion = "^0.32.0";
5
+ export declare const vitePluginReactVersion = "^4.0.0";
6
+ export declare const vitePluginReactSwcVersion = "^3.3.2";
7
+ export declare const viteTsConfigPathsVersion = "^4.2.0";
8
+ export declare const jsdomVersion = "~22.1.0";
9
+ export declare const vitePluginDtsVersion = "~2.3.0";
10
+ export declare const happyDomVersion = "~9.20.3";
11
+ export declare const edgeRuntimeVmVersion = "~3.0.2";
12
+ export declare const vitestCoverageC8Version = "^0.32.0";
13
+ export declare const vitestCoverageIstanbulVersion = "^0.32.0";