@nx/vite 16.4.0-beta.2 → 16.4.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vite",
3
- "version": "16.4.0-beta.2",
3
+ "version": "16.4.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for building and testing applications using Vite",
6
6
  "repository": {
@@ -29,9 +29,9 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nrwl/vite": "16.4.0-beta.2",
33
- "@nx/devkit": "16.4.0-beta.2",
34
- "@nx/js": "16.4.0-beta.2",
32
+ "@nrwl/vite": "16.4.0-beta.3",
33
+ "@nx/devkit": "16.4.0-beta.3",
34
+ "@nx/js": "16.4.0-beta.3",
35
35
  "@phenomnomnominal/tsquery": "~5.0.1",
36
36
  "@swc/helpers": "~0.5.0",
37
37
  "dotenv": "~10.0.0",
@@ -59,5 +59,5 @@
59
59
  "./src/executors/*.impl": "./src/executors/*.impl.js",
60
60
  "./src/executors/*/compat": "./src/executors/*/compat.js"
61
61
  },
62
- "gitHead": "abb2678056668cc8beaaf9c5ebc2a2e6ad487173"
62
+ "gitHead": "d7f500985ba56117bf17c133bf70d22e42a7af27"
63
63
  }
@@ -22,14 +22,21 @@ const _js = require("@nx/js");
22
22
  const _fs = require("fs");
23
23
  const _path = require("path");
24
24
  const _asynciterable = require("@nx/devkit/src/utils/async-iterable");
25
- const _internal = require("@nx/js/src/internal");
25
+ const _executorutils = require("../../utils/executor-utils");
26
26
  async function* viteBuildExecutor(options, context) {
27
27
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
28
- (0, _internal.registerTsConfigPaths)((0, _path.resolve)(projectRoot, 'tsconfig.json'));
28
+ (0, _executorutils.registerPaths)(projectRoot, options, context);
29
29
  const normalizedOptions = normalizeOptions(options);
30
30
  const buildConfig = (0, _vite.mergeConfig)((0, _optionsutils.getViteSharedConfig)(normalizedOptions, false, context), {
31
31
  build: (0, _optionsutils.getViteBuildOptions)(normalizedOptions, context)
32
32
  });
33
+ if (!options.skipTypeCheck) {
34
+ await (0, _executorutils.validateTypes)({
35
+ workspaceRoot: context.root,
36
+ projectRoot: projectRoot,
37
+ tsconfig: (0, _optionsutils.getProjectTsConfigPath)(projectRoot)
38
+ });
39
+ }
33
40
  const watcherOrOutput = await runInstance(buildConfig);
34
41
  const libraryPackageJson = (0, _path.resolve)(projectRoot, 'package.json');
35
42
  const rootPackageJson = (0, _path.resolve)(context.root, 'package.json');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"sourcesContent":["import 'dotenv/config';\nimport { ExecutorContext, writeJsonFile } from '@nx/devkit';\nimport { build, InlineConfig, mergeConfig } from 'vite';\nimport {\n getViteBuildOptions,\n getViteSharedConfig,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from './schema';\nimport {\n copyAssets,\n createLockFile,\n createPackageJson,\n getLockFileName,\n} from '@nx/js';\nimport { existsSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\nimport { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';\n\nimport { registerTsConfigPaths } from '@nx/js/src/internal';\n\nexport async function* viteBuildExecutor(\n options: ViteBuildExecutorOptions,\n context: ExecutorContext\n) {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n registerTsConfigPaths(resolve(projectRoot, 'tsconfig.json'));\n\n const normalizedOptions = normalizeOptions(options);\n\n const buildConfig = mergeConfig(\n getViteSharedConfig(normalizedOptions, false, context),\n {\n build: getViteBuildOptions(normalizedOptions, context),\n }\n );\n\n const watcherOrOutput = await runInstance(buildConfig);\n\n const libraryPackageJson = resolve(projectRoot, 'package.json');\n const rootPackageJson = resolve(context.root, 'package.json');\n const distPackageJson = resolve(normalizedOptions.outputPath, 'package.json');\n\n // Generate a package.json if option has been set.\n if (options.generatePackageJson) {\n const builtPackageJson = createPackageJson(\n context.projectName,\n context.projectGraph,\n {\n target: context.targetName,\n root: context.root,\n isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.\n }\n );\n\n builtPackageJson.type = 'module';\n\n writeJsonFile(`${options.outputPath}/package.json`, builtPackageJson);\n\n const lockFile = createLockFile(builtPackageJson);\n writeFileSync(`${options.outputPath}/${getLockFileName()}`, lockFile, {\n encoding: 'utf-8',\n });\n }\n // For buildable libs, copy package.json if it exists.\n else if (\n !existsSync(distPackageJson) &&\n existsSync(libraryPackageJson) &&\n rootPackageJson !== libraryPackageJson\n ) {\n await copyAssets(\n {\n outputPath: normalizedOptions.outputPath,\n assets: [\n {\n input: projectRoot,\n output: '.',\n glob: 'package.json',\n },\n ],\n },\n context\n );\n }\n\n if ('on' in watcherOrOutput) {\n const iterable = createAsyncIterable<{ success: boolean }>(({ next }) => {\n let success = true;\n watcherOrOutput.on('event', (event) => {\n if (event.code === 'START') {\n success = true;\n } else if (event.code === 'ERROR') {\n success = false;\n } else if (event.code === 'END') {\n next({ success });\n }\n // result must be closed when present.\n // see https://rollupjs.org/guide/en/#rollupwatch\n if ('result' in event) {\n event.result.close();\n }\n });\n });\n yield* iterable;\n } else {\n const output = watcherOrOutput?.['output'] || watcherOrOutput?.[0]?.output;\n const fileName = output?.[0]?.fileName || 'main.cjs';\n const outfile = resolve(normalizedOptions.outputPath, fileName);\n yield { success: true, outfile };\n }\n}\n\nfunction runInstance(options: InlineConfig) {\n return build({\n ...options,\n });\n}\n\nfunction normalizeOptions(options: ViteBuildExecutorOptions) {\n const normalizedOptions = { ...options };\n\n // coerce watch to null or {} to match with Vite's watch config\n if (options.watch === false) {\n normalizedOptions.watch = null;\n } else if (options.watch === true) {\n normalizedOptions.watch = {};\n }\n\n return normalizedOptions;\n}\n\nexport default viteBuildExecutor;\n"],"names":["viteBuildExecutor","options","context","projectRoot","projectsConfigurations","projects","projectName","root","registerTsConfigPaths","resolve","normalizedOptions","normalizeOptions","buildConfig","mergeConfig","getViteSharedConfig","build","getViteBuildOptions","watcherOrOutput","runInstance","libraryPackageJson","rootPackageJson","distPackageJson","outputPath","generatePackageJson","builtPackageJson","createPackageJson","projectGraph","target","targetName","isProduction","includeDevDependenciesInPackageJson","type","writeJsonFile","lockFile","createLockFile","writeFileSync","getLockFileName","encoding","existsSync","copyAssets","assets","input","output","glob","iterable","createAsyncIterable","next","success","on","event","code","result","close","fileName","outfile","watch"],"mappings":";;;;;;;;IAoBuBA,iBAAiB;eAAjBA;;IAgHvB,OAAiC;eAAjC;;;;QApIO;wBACwC;sBACE;8BAI1C;oBAOA;oBACmC;sBAClB;+BACY;0BAEE;AAE/B,gBAAgBA,kBACrBC,OAAiC,EACjCC,OAAwB,EACxB;IACA,MAAMC,cACJD,QAAQE,sBAAsB,CAACC,QAAQ,CAACH,QAAQI,WAAW,CAAC,CAACC,IAAI;IAEnEC,IAAAA,+BAAqB,EAACC,IAAAA,aAAO,EAACN,aAAa;IAE3C,MAAMO,oBAAoBC,iBAAiBV;IAE3C,MAAMW,cAAcC,IAAAA,iBAAW,EAC7BC,IAAAA,iCAAmB,EAACJ,mBAAmB,KAAK,EAAER,UAC9C;QACEa,OAAOC,IAAAA,iCAAmB,EAACN,mBAAmBR;IAChD;IAGF,MAAMe,kBAAkB,MAAMC,YAAYN;IAE1C,MAAMO,qBAAqBV,IAAAA,aAAO,EAACN,aAAa;IAChD,MAAMiB,kBAAkBX,IAAAA,aAAO,EAACP,QAAQK,IAAI,EAAE;IAC9C,MAAMc,kBAAkBZ,IAAAA,aAAO,EAACC,kBAAkBY,UAAU,EAAE;IAE9D,kDAAkD;IAClD,IAAIrB,QAAQsB,mBAAmB,EAAE;QAC/B,MAAMC,mBAAmBC,IAAAA,qBAAiB,EACxCvB,QAAQI,WAAW,EACnBJ,QAAQwB,YAAY,EACpB;YACEC,QAAQzB,QAAQ0B,UAAU;YAC1BrB,MAAML,QAAQK,IAAI;YAClBsB,cAAc,C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AAA,IAAAA,CAAAA,oBAAAA,eAAiB,CAAC,EAAE,YAApBA,KAAAA,IAAAA,kBAAsByB,MAAF,AAAD;QACjE,MAAMW,WAAWX,CAAAA,iBAAAA,KAAAA,IAAAA,CAAAA,WAAAA,MAAQ,CAAC,EAAE,YAAXA,KAAAA,IAAAA,SAAaW,QAAF,AAAD,KAAe;QAC1C,MAAMC,UAAU7C,IAAAA,aAAO,EAACC,kBAAkBY,UAAU,EAAE+B;QACtD,MAAM;YAAEN,SAAS,IAAI;YAAEO;QAAQ;IACjC,CAAC;AACH;AAEA,SAASpC,YAAYjB,OAAqB,EAAE;IAC1C,OAAOc,IAAAA,WAAK,EAAC,eACRd;AAEP;AAEA,SAASU,iBAAiBV,OAAiC,EAAE;IAC3D,MAAMS,oBAAoB,eAAKT;IAE/B,+DAA+D;IAC/D,IAAIA,QAAQsD,KAAK,KAAK,KAAK,EAAE;QAC3B7C,kBAAkB6C,KAAK,GAAG,IAAI;IAChC,OAAO,IAAItD,QAAQsD,KAAK,KAAK,IAAI,EAAE;QACjC7C,kBAAkB6C,KAAK,GAAG,CAAC;IAC7B,CAAC;IAED,OAAO7C;AACT;MAEA,WAAeV"}
1
+ {"version":3,"sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"sourcesContent":["import 'dotenv/config';\nimport { ExecutorContext, writeJsonFile } from '@nx/devkit';\nimport { build, InlineConfig, mergeConfig } from 'vite';\nimport {\n getProjectTsConfigPath,\n getViteBuildOptions,\n getViteSharedConfig,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from './schema';\nimport {\n copyAssets,\n createLockFile,\n createPackageJson,\n getLockFileName,\n} from '@nx/js';\nimport { existsSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\nimport { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';\nimport { registerPaths, validateTypes } from '../../utils/executor-utils';\n\nexport async function* viteBuildExecutor(\n options: ViteBuildExecutorOptions,\n context: ExecutorContext\n) {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n registerPaths(projectRoot, options, context);\n\n const normalizedOptions = normalizeOptions(options);\n\n const buildConfig = mergeConfig(\n getViteSharedConfig(normalizedOptions, false, context),\n {\n build: getViteBuildOptions(normalizedOptions, context),\n }\n );\n\n if (!options.skipTypeCheck) {\n await validateTypes({\n workspaceRoot: context.root,\n projectRoot: projectRoot,\n tsconfig: getProjectTsConfigPath(projectRoot),\n });\n }\n\n const watcherOrOutput = await runInstance(buildConfig);\n\n const libraryPackageJson = resolve(projectRoot, 'package.json');\n const rootPackageJson = resolve(context.root, 'package.json');\n const distPackageJson = resolve(normalizedOptions.outputPath, 'package.json');\n\n // Generate a package.json if option has been set.\n if (options.generatePackageJson) {\n const builtPackageJson = createPackageJson(\n context.projectName,\n context.projectGraph,\n {\n target: context.targetName,\n root: context.root,\n isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.\n }\n );\n\n builtPackageJson.type = 'module';\n\n writeJsonFile(`${options.outputPath}/package.json`, builtPackageJson);\n\n const lockFile = createLockFile(builtPackageJson);\n writeFileSync(`${options.outputPath}/${getLockFileName()}`, lockFile, {\n encoding: 'utf-8',\n });\n }\n // For buildable libs, copy package.json if it exists.\n else if (\n !existsSync(distPackageJson) &&\n existsSync(libraryPackageJson) &&\n rootPackageJson !== libraryPackageJson\n ) {\n await copyAssets(\n {\n outputPath: normalizedOptions.outputPath,\n assets: [\n {\n input: projectRoot,\n output: '.',\n glob: 'package.json',\n },\n ],\n },\n context\n );\n }\n\n if ('on' in watcherOrOutput) {\n const iterable = createAsyncIterable<{ success: boolean }>(({ next }) => {\n let success = true;\n watcherOrOutput.on('event', (event) => {\n if (event.code === 'START') {\n success = true;\n } else if (event.code === 'ERROR') {\n success = false;\n } else if (event.code === 'END') {\n next({ success });\n }\n // result must be closed when present.\n // see https://rollupjs.org/guide/en/#rollupwatch\n if ('result' in event) {\n event.result.close();\n }\n });\n });\n yield* iterable;\n } else {\n const output = watcherOrOutput?.['output'] || watcherOrOutput?.[0]?.output;\n const fileName = output?.[0]?.fileName || 'main.cjs';\n const outfile = resolve(normalizedOptions.outputPath, fileName);\n yield { success: true, outfile };\n }\n}\n\nfunction runInstance(options: InlineConfig) {\n return build({\n ...options,\n });\n}\n\nfunction normalizeOptions(options: ViteBuildExecutorOptions) {\n const normalizedOptions = { ...options };\n\n // coerce watch to null or {} to match with Vite's watch config\n if (options.watch === false) {\n normalizedOptions.watch = null;\n } else if (options.watch === true) {\n normalizedOptions.watch = {};\n }\n\n return normalizedOptions;\n}\n\nexport default viteBuildExecutor;\n"],"names":["viteBuildExecutor","options","context","projectRoot","projectsConfigurations","projects","projectName","root","registerPaths","normalizedOptions","normalizeOptions","buildConfig","mergeConfig","getViteSharedConfig","build","getViteBuildOptions","skipTypeCheck","validateTypes","workspaceRoot","tsconfig","getProjectTsConfigPath","watcherOrOutput","runInstance","libraryPackageJson","resolve","rootPackageJson","distPackageJson","outputPath","generatePackageJson","builtPackageJson","createPackageJson","projectGraph","target","targetName","isProduction","includeDevDependenciesInPackageJson","type","writeJsonFile","lockFile","createLockFile","writeFileSync","getLockFileName","encoding","existsSync","copyAssets","assets","input","output","glob","iterable","createAsyncIterable","next","success","on","event","code","result","close","fileName","outfile","watch"],"mappings":";;;;;;;;IAoBuBA,iBAAiB;eAAjBA;;IAwHvB,OAAiC;eAAjC;;;;QA5IO;wBACwC;sBACE;8BAK1C;oBAOA;oBACmC;sBAClB;+BACY;+BACS;AAEtC,gBAAgBA,kBACrBC,OAAiC,EACjCC,OAAwB,EACxB;IACA,MAAMC,cACJD,QAAQE,sBAAsB,CAACC,QAAQ,CAACH,QAAQI,WAAW,CAAC,CAACC,IAAI;IAEnEC,IAAAA,4BAAa,EAACL,aAAaF,SAASC;IAEpC,MAAMO,oBAAoBC,iBAAiBT;IAE3C,MAAMU,cAAcC,IAAAA,iBAAW,EAC7BC,IAAAA,iCAAmB,EAACJ,mBAAmB,KAAK,EAAEP,UAC9C;QACEY,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kBAAkBmD,KAAK,GAAG,IAAI;IAChC,OAAO,IAAI3D,QAAQ2D,KAAK,KAAK,IAAI,EAAE;QACjCnD,kBAAkBmD,KAAK,GAAG,CAAC;IAC7B,CAAC;IAED,OAAOnD;AACT;MAEA,WAAeT"}
@@ -18,4 +18,6 @@ export interface ViteBuildExecutorOptions {
18
18
  generatePackageJson?: boolean;
19
19
  includeDevDependenciesInPackageJson?: boolean;
20
20
  cssCodeSplit?: boolean;
21
+ buildLibsFromSource?: boolean;
22
+ skipTypeCheck?: boolean;
21
23
  }
@@ -18,6 +18,16 @@
18
18
  "x-completion-type": "directory",
19
19
  "x-priority": "important"
20
20
  },
21
+ "buildLibsFromSource": {
22
+ "type": "boolean",
23
+ "description": "Read buildable libraries from source instead of building them separately.",
24
+ "default": true
25
+ },
26
+ "skipTypeCheck": {
27
+ "type": "boolean",
28
+ "description": "Skip type-checking via TypeScript. Skipping type-checking speeds up the build but type errors are not caught.",
29
+ "default": false
30
+ },
21
31
  "base": {
22
32
  "type": "string",
23
33
  "description": "Base public path when served in development or production.",
@@ -17,11 +17,10 @@ const _extends = require("@swc/helpers/_/_extends");
17
17
  require("dotenv/config");
18
18
  const _vite = require("vite");
19
19
  const _optionsutils = require("../../utils/options-utils");
20
- const _internal = require("@nx/js/src/internal");
21
- const _path = require("path");
20
+ const _executorutils = require("../../utils/executor-utils");
22
21
  async function* viteDevServerExecutor(options, context) {
23
22
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
24
- (0, _internal.registerTsConfigPaths)((0, _path.resolve)(projectRoot, 'tsconfig.json'));
23
+ (0, _executorutils.registerPaths)(projectRoot, options, context);
25
24
  // Retrieve the option for the configured buildTarget.
26
25
  const buildTargetOptions = (0, _optionsutils.getNxTargetOptions)(options.buildTarget, context);
27
26
  // Merge the options from the build and dev-serve targets.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"sourcesContent":["import 'dotenv/config';\nimport { ExecutorContext } from '@nx/devkit';\nimport { createServer, InlineConfig, mergeConfig, ViteDevServer } from 'vite';\n\nimport {\n getViteSharedConfig,\n getNxTargetOptions,\n getViteServerOptions,\n getViteBuildOptions,\n} from '../../utils/options-utils';\n\nimport { ViteDevServerExecutorOptions } from './schema';\nimport { ViteBuildExecutorOptions } from '../build/schema';\nimport { registerTsConfigPaths } from '@nx/js/src/internal';\nimport { resolve } from 'path';\n\nexport async function* viteDevServerExecutor(\n options: ViteDevServerExecutorOptions,\n context: ExecutorContext\n): AsyncGenerator<{ success: boolean; baseUrl: string }> {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n registerTsConfigPaths(resolve(projectRoot, 'tsconfig.json'));\n\n // Retrieve the option for the configured buildTarget.\n const buildTargetOptions: ViteBuildExecutorOptions = getNxTargetOptions(\n options.buildTarget,\n context\n );\n\n // Merge the options from the build and dev-serve targets.\n // The latter takes precedence.\n const mergedOptions = {\n ...buildTargetOptions,\n ...options,\n };\n\n // Add the server specific configuration.\n const serverConfig: InlineConfig = mergeConfig(\n getViteSharedConfig(mergedOptions, options.clearScreen, context),\n {\n build: getViteBuildOptions(mergedOptions, context),\n server: getViteServerOptions(mergedOptions, context),\n }\n );\n\n try {\n const server = await createServer(serverConfig);\n await runViteDevServer(server);\n const resolvedUrls = [\n ...server.resolvedUrls.local,\n ...server.resolvedUrls.network,\n ];\n\n yield {\n success: true,\n baseUrl: resolvedUrls[0] ?? '',\n };\n } catch (e) {\n console.error(e);\n yield {\n success: false,\n baseUrl: '',\n };\n }\n\n await new Promise<void>((resolve) => {\n process.once('SIGINT', () => resolve());\n process.once('SIGTERM', () => resolve());\n process.once('exit', () => resolve());\n });\n}\n\nasync function runViteDevServer(server: ViteDevServer): Promise<void> {\n await server.listen();\n server.printUrls();\n\n const processOnExit = async () => {\n await server.close();\n };\n\n process.once('SIGINT', processOnExit);\n process.once('SIGTERM', processOnExit);\n process.once('exit', processOnExit);\n}\n\nexport default viteDevServerExecutor;\n"],"names":["viteDevServerExecutor","options","context","projectRoot","projectsConfigurations","projects","projectName","root","registerTsConfigPaths","resolve","buildTargetOptions","getNxTargetOptions","buildTarget","mergedOptions","serverConfig","mergeConfig","getViteSharedConfig","clearScreen","build","getViteBuildOptions","server","getViteServerOptions","createServer","runViteDevServer","resolvedUrls","local","network","success","baseUrl","e","console","error","Promise","process","once","listen","printUrls","processOnExit","close"],"mappings":";;;;;;;;IAgBuBA,qBAAqB;eAArBA;;IAuEvB,OAAqC;eAArC;;;;QAvFO;sBAEgE;8BAOhE;0BAI+B;sBACd;AAEjB,gBAAgBA,sBACrBC,OAAqC,EACrCC,OAAwB,EAC+B;IACvD,MAAMC,cACJD,QAAQE,sBAAsB,CAACC,QAAQ,CAACH,QAAQI,WAAW,CAAC,CAACC,IAAI;IAEnEC,IAAAA,+BAAqB,EAACC,IAAAA,aAAO,EAACN,aAAa;IAE3C,sDAAsD;IACtD,MAAMO,qBAA+CC,IAAAA,gCAAkB,EACrEV,QAAQW,WAAW,EACnBV;IAGF,0DAA0D;IAC1D,+BAA+B;IAC/B,MAAMW,gBAAgB,eACjBH,oBACAT;IAGL,yCAAyC;IACzC,MAAMa,eAA6BC,IAAAA,iBAAW,EAC5CC,IAAAA,iCAAmB,EAACH,eAAeZ,QAAQgB,WAAW,EAAEf,UACxD;QACEgB,OAAOC,IAAAA,iCAAmB,EAACN,eAAeX;QAC1CkB,QAAQC,IAAAA,kCAAoB,EAACR,eAAeX;IAC9C;IAGF,IAAI;QACF,MAAMkB,SAAS,MAAME,IAAAA,kBAAY,EAACR;QAClC,MAAMS,iBAAiBH;QACvB,MAAMI,eAAe;eAChBJ,OAAOI,YAAY,CAACC,KAAK;eACzBL,OAAOI,YAAY,CAACE,OAAO;SAC/B;YAIUF;QAFX,MAAM;YACJG,SAAS,IAAI;YACbC,SAASJ,CAAAA,iBAAAA,YAAY,CAAC,EAAE,YAAfA,iBAAmB,EAAE;QAChC;IACF,EAAE,OAAOK,GAAG;QACVC,QAAQC,KAAK,CAACF;QACd,MAAM;YACJF,SAAS,KAAK;YACdC,SAAS;QACX;IACF;IAEA,MAAM,IAAII,QAAc,CAACvB,UAAY;QACnCwB,QAAQC,IAAI,CAAC,UAAU,IAAMzB;QAC7BwB,QAAQC,IAAI,CAAC,WAAW,IAAMzB;QAC9BwB,QAAQC,IAAI,CAAC,QAAQ,IAAMzB;IAC7B;AACF;AAEA,eAAec,iBAAiBH,MAAqB,EAAiB;IACpE,MAAMA,OAAOe,MAAM;IACnBf,OAAOgB,SAAS;IAEhB,MAAMC,gBAAgB,UAAY;QAChC,MAAMjB,OAAOkB,KAAK;IACpB;IAEAL,QAAQC,IAAI,CAAC,UAAUG;IACvBJ,QAAQC,IAAI,CAAC,WAAWG;IACxBJ,QAAQC,IAAI,CAAC,QAAQG;AACvB;MAEA,WAAerC"}
1
+ {"version":3,"sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"sourcesContent":["import 'dotenv/config';\nimport { ExecutorContext } from '@nx/devkit';\nimport { createServer, InlineConfig, mergeConfig, ViteDevServer } from 'vite';\n\nimport {\n getViteSharedConfig,\n getNxTargetOptions,\n getViteServerOptions,\n getViteBuildOptions,\n} from '../../utils/options-utils';\n\nimport { ViteDevServerExecutorOptions } from './schema';\nimport { ViteBuildExecutorOptions } from '../build/schema';\nimport { registerPaths } from '../../utils/executor-utils';\n\nexport async function* viteDevServerExecutor(\n options: ViteDevServerExecutorOptions,\n context: ExecutorContext\n): AsyncGenerator<{ success: boolean; baseUrl: string }> {\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n registerPaths(projectRoot, options, context);\n\n // Retrieve the option for the configured buildTarget.\n const buildTargetOptions: ViteBuildExecutorOptions = getNxTargetOptions(\n options.buildTarget,\n context\n );\n\n // Merge the options from the build and dev-serve targets.\n // The latter takes precedence.\n const mergedOptions = {\n ...buildTargetOptions,\n ...options,\n };\n\n // Add the server specific configuration.\n const serverConfig: InlineConfig = mergeConfig(\n getViteSharedConfig(mergedOptions, options.clearScreen, context),\n {\n build: getViteBuildOptions(mergedOptions, context),\n server: getViteServerOptions(mergedOptions, context),\n }\n );\n\n try {\n const server = await createServer(serverConfig);\n await runViteDevServer(server);\n const resolvedUrls = [\n ...server.resolvedUrls.local,\n ...server.resolvedUrls.network,\n ];\n\n yield {\n success: true,\n baseUrl: resolvedUrls[0] ?? '',\n };\n } catch (e) {\n console.error(e);\n yield {\n success: false,\n baseUrl: '',\n };\n }\n\n await new Promise<void>((resolve) => {\n process.once('SIGINT', () => resolve());\n process.once('SIGTERM', () => resolve());\n process.once('exit', () => resolve());\n });\n}\n\nasync function runViteDevServer(server: ViteDevServer): Promise<void> {\n await server.listen();\n server.printUrls();\n\n const processOnExit = async () => {\n await server.close();\n };\n\n process.once('SIGINT', processOnExit);\n process.once('SIGTERM', processOnExit);\n process.once('exit', processOnExit);\n}\n\nexport default viteDevServerExecutor;\n"],"names":["viteDevServerExecutor","options","context","projectRoot","projectsConfigurations","projects","projectName","root","registerPaths","buildTargetOptions","getNxTargetOptions","buildTarget","mergedOptions","serverConfig","mergeConfig","getViteSharedConfig","clearScreen","build","getViteBuildOptions","server","getViteServerOptions","createServer","runViteDevServer","resolvedUrls","local","network","success","baseUrl","e","console","error","Promise","resolve","process","once","listen","printUrls","processOnExit","close"],"mappings":";;;;;;;;IAeuBA,qBAAqB;eAArBA;;IAuEvB,OAAqC;eAArC;;;;QAtFO;sBAEgE;8BAOhE;+BAIuB;AAEvB,gBAAgBA,sBACrBC,OAAqC,EACrCC,OAAwB,EAC+B;IACvD,MAAMC,cACJD,QAAQE,sBAAsB,CAACC,QAAQ,CAACH,QAAQI,WAAW,CAAC,CAACC,IAAI;IAEnEC,IAAAA,4BAAa,EAACL,aAAaF,SAASC;IAEpC,sDAAsD;IACtD,MAAMO,qBAA+CC,IAAAA,gCAAkB,EACrET,QAAQU,WAAW,EACnBT;IAGF,0DAA0D;IAC1D,+BAA+B;IAC/B,MAAMU,gBAAgB,eACjBH,oBACAR;IAGL,yCAAyC;IACzC,MAAMY,eAA6BC,IAAAA,iBAAW,EAC5CC,IAAAA,iCAAmB,EAACH,eAAeX,QAAQe,WAAW,EAAEd,UACxD;QACEe,OAAOC,IAAAA,iCAAmB,EAACN,eAAeV;QAC1CiB,QAAQC,IAAAA,kCAAoB,EAACR,eAAeV;IAC9C;IAGF,IAAI;QACF,MAAMiB,SAAS,MAAME,IAAAA,kBAAY,EAACR;QAClC,MAAMS,iBAAiBH;QACvB,MAAMI,eAAe;eAChBJ,OAAOI,YAAY,CAACC,KAAK;eACzBL,OAAOI,YAAY,CAACE,OAAO;SAC/B;YAIUF;QAFX,MAAM;YACJG,SAAS,IAAI;YACbC,SAASJ,CAAAA,iBAAAA,YAAY,CAAC,EAAE,YAAfA,iBAAmB,EAAE;QAChC;IACF,EAAE,OAAOK,GAAG;QACVC,QAAQC,KAAK,CAACF;QACd,MAAM;YACJF,SAAS,KAAK;YACdC,SAAS;QACX;IACF;IAEA,MAAM,IAAII,QAAc,CAACC,UAAY;QACnCC,QAAQC,IAAI,CAAC,UAAU,IAAMF;QAC7BC,QAAQC,IAAI,CAAC,WAAW,IAAMF;QAC9BC,QAAQC,IAAI,CAAC,QAAQ,IAAMF;IAC7B;AACF;AAEA,eAAeV,iBAAiBH,MAAqB,EAAiB;IACpE,MAAMA,OAAOgB,MAAM;IACnBhB,OAAOiB,SAAS;IAEhB,MAAMC,gBAAgB,UAAY;QAChC,MAAMlB,OAAOmB,KAAK;IACpB;IAEAL,QAAQC,IAAI,CAAC,UAAUG;IACvBJ,QAAQC,IAAI,CAAC,WAAWG;IACxBJ,QAAQC,IAAI,CAAC,QAAQG;AACvB;MAEA,WAAerC"}
@@ -1,5 +1,6 @@
1
1
  export interface ViteDevServerExecutorOptions {
2
2
  buildTarget: string;
3
+ buildLibsFromSource?: boolean;
3
4
  proxyConfig?: string;
4
5
  port?: number;
5
6
  host?: string | boolean;
@@ -21,6 +21,11 @@
21
21
  "description": "Target which builds the application. Only used to retrieve the configuration as the dev-server does not build the code.",
22
22
  "x-priority": "important"
23
23
  },
24
+ "buildLibsFromSource": {
25
+ "type": "boolean",
26
+ "description": "Read buildable libraries from source instead of building them separately.",
27
+ "default": true
28
+ },
24
29
  "proxyConfig": {
25
30
  "type": "string",
26
31
  "description": "Path to the proxy configuration file.",
@@ -21,6 +21,7 @@ const _devkit = require("@nx/devkit");
21
21
  const _generatorutils = require("../../utils/generator-utils");
22
22
  const _init = require("../init/init");
23
23
  const _versions = require("../../utils/versions");
24
+ const _js = require("@nx/js");
24
25
  async function vitestGenerator(tree, schema) {
25
26
  const tasks = [];
26
27
  const { targets , root , projectType } = (0, _devkit.readProjectConfiguration)(tree, schema.project);
@@ -91,6 +92,7 @@ function updateTsConfig(tree, options, projectRoot) {
91
92
  return json;
92
93
  });
93
94
  }
95
+ (0, _js.addTsLibDependencies)(tree);
94
96
  }
95
97
  }
96
98
  function createFiles(tree, options, projectRoot) {
@@ -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","tsconfigAppPath","exists","generateFiles","__dirname","tmpl","offsetFromRoot","convertNxGenerator"],"mappings":";;;;;;;;IA0BsBA,eAAe;eAAfA;;IAyHtB,OAA+B;eAA/B;;IACaC,eAAe;eAAfA;;;;wBAxIN;gCAKA;sBAGmB;0BAInB;AAEA,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;IACjC;IACAb,MAAMc,IAAI,CAACH;IAEX,IAAI,CAACZ,OAAOg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AAe,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,IAAIhC,KAAK8C,MAAM,CAACF,kBAAkB;YAChCX,IAAAA,kBAAU,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,OAAO,IAAInC,KAAK8C,MAAM,CAACD,kBAAkB;YACvCZ,IAAAA,kBAAU,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 });\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","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;;IA2HtB,OAA+B;eAA/B;;IACaC,eAAe;eAAfA;;;;wBA5IN;gCAKA;sBAGmB;0BAInB;oBAE8B;A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zB,IAAI,CAAC;gBACzC,OAAOmB;YACT;QAEJ,CAAC;QAEDY,IAAAA,wBAAoB,EAAC/C;IACvB,CAAC;AACH;AAEA,SAASqB,YACPrB,IAAU,EACV+B,OAA8B,EAC9BC,WAAmB,EACnB;IACAgB,IAAAA,qBAAa,EAAChD,MAAMkC,IAAAA,yBAAiB,EAACe,WAAW,UAAUjB,aAAa;QACtEkB,MAAM;OACHnB;QACHC;QACAmB,gBAAgBA,IAAAA,sBAAc,EAACnB;;AAEnC;MAEA,WAAelC;AACR,MAAMC,kBAAkBqD,IAAAA,0BAAkB,EAACtD"}
@@ -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,10 +418,10 @@ 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
426
  const testOption = options.includeVitest ? `test: {
427
427
  globals: true,
@@ -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;;IA6C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F,EAAEC,YAAY;;QAEd,CAAC;IAEP,OAAO;QACL0B,cAAM,CAACW,IAAI,CAAC,CAAC;+BACc,EAAEtC,eAAe;MAC1C,CAAC;IACL,CAAC;AACH"}
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 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: '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;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,8BA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AE;QACV;IACF;IAEA,MAAM0E,mBAAmB;QACvBC,SAAS,IAAI;QACbC,OAAO;YACLC,KAAK,CAAC,EAAEjH,eAAe,oBAAoB,CAAC;QAC9C;QACAkH,aAAa;QACbrE,SAAS;YAAC;SAAuD;IACnE;IAEA,MAAMsE,UAAUC,IAAAA,8CAAyB,EACvC9H,MACA2E,gBACAC,aACAsC,mBACApC,WACAC,eACAW,cACAT,YACAuC,kBACA5B,UACAlB;IAGF,IAAI,CAACmD,SAAS;QACZvB,cAAM,CAACC,IAAI,CACT,CAAC,wEAAwE,EAAE5B,eAAe;;QAExF,EAAEC,YAAY;;QAEd,CAAC;IAEP,OAAO;QACL0B,cAAM,CAACW,IAAI,CAAC,CAAC;+BACc,EAAEtC,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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AOC,IAAAA,yBAAiB,EAACH,WAAW/C;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;eA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,8 +5,8 @@ export declare const conditionalConfig = "\n /// <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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