@nx/vite 20.2.0-rc.0 → 20.2.0

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": "20.2.0-rc.0",
3
+ "version": "20.2.0",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for building and testing applications using Vite",
6
6
  "repository": {
@@ -30,11 +30,11 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nx/devkit": "20.2.0-rc.0",
33
+ "@nx/devkit": "20.2.0",
34
34
  "@phenomnomnominal/tsquery": "~5.0.1",
35
35
  "@swc/helpers": "~0.5.0",
36
36
  "enquirer": "~2.3.6",
37
- "@nx/js": "20.2.0-rc.0",
37
+ "@nx/js": "20.2.0",
38
38
  "tsconfig-paths": "^4.1.2",
39
39
  "minimatch": "9.0.3"
40
40
  },
@@ -30,7 +30,7 @@ const _minimatch = require("minimatch");
30
30
  const _tssolutionsetup = require("@nx/js/src/utils/typescript/ts-solution-setup");
31
31
  const pmc = (0, _devkit.getPackageManagerCommand)();
32
32
  function readTargetsCache(cachePath) {
33
- return (0, _fs.existsSync)(cachePath) ? (0, _devkit.readJsonFile)(cachePath) : {};
33
+ return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, _fs.existsSync)(cachePath) ? (0, _devkit.readJsonFile)(cachePath) : {};
34
34
  }
35
35
  function writeTargetsToCache(cachePath, results) {
36
36
  (0, _devkit.writeJsonFile)(cachePath, results);
@@ -121,12 +121,12 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
121
121
  const hasRemixPlugin = viteBuildConfig.plugins && viteBuildConfig.plugins.some((p)=>p.name === 'remix');
122
122
  if (!configFilePath.includes('vitest.config') && !hasRemixPlugin && isBuildable) {
123
123
  var _viteBuildConfig_build1;
124
- targets[options.buildTargetName] = await buildTarget(options.buildTargetName, namedInputs, buildOutputs, projectRoot);
124
+ targets[options.buildTargetName] = await buildTarget(options.buildTargetName, namedInputs, buildOutputs, projectRoot, isUsingTsSolutionSetup);
125
125
  // If running in library mode, then there is nothing to serve.
126
126
  if (!((_viteBuildConfig_build1 = viteBuildConfig.build) == null ? void 0 : _viteBuildConfig_build1.lib) || hasServeConfig) {
127
- targets[options.serveTargetName] = serveTarget(projectRoot);
127
+ targets[options.serveTargetName] = serveTarget(projectRoot, isUsingTsSolutionSetup);
128
128
  targets[options.previewTargetName] = previewTarget(projectRoot, options.buildTargetName);
129
- targets[options.serveStaticTargetName] = serveStaticTarget(options);
129
+ targets[options.serveStaticTargetName] = serveStaticTarget(options, isUsingTsSolutionSetup);
130
130
  }
131
131
  }
132
132
  if (tsConfigFiles.length) {
@@ -168,6 +168,11 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
168
168
  }
169
169
  }
170
170
  };
171
+ if (isUsingTsSolutionSetup) {
172
+ targets[options.typecheckTargetName].syncGenerators = [
173
+ '@nx/js:typescript-sync'
174
+ ];
175
+ }
171
176
  }
172
177
  // if file is vitest.config or vite.config has definition for test, create target for test
173
178
  if (configFilePath.includes('vitest.config') || hasTest) {
@@ -180,8 +185,8 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
180
185
  isLibrary: Boolean((_viteBuildConfig_build = viteBuildConfig.build) == null ? void 0 : _viteBuildConfig_build.lib)
181
186
  };
182
187
  }
183
- async function buildTarget(buildTargetName, namedInputs, outputs, projectRoot) {
184
- return {
188
+ async function buildTarget(buildTargetName, namedInputs, outputs, projectRoot, isUsingTsSolutionSetup) {
189
+ const buildTarget = {
185
190
  command: `vite build`,
186
191
  options: {
187
192
  cwd: (0, _devkit.joinPathFragments)(projectRoot)
@@ -221,8 +226,14 @@ async function buildTarget(buildTargetName, namedInputs, outputs, projectRoot) {
221
226
  }
222
227
  }
223
228
  };
229
+ if (isUsingTsSolutionSetup) {
230
+ buildTarget.syncGenerators = [
231
+ '@nx/js:typescript-sync'
232
+ ];
233
+ }
234
+ return buildTarget;
224
235
  }
225
- function serveTarget(projectRoot) {
236
+ function serveTarget(projectRoot, isUsingTsSolutionSetup) {
226
237
  const targetConfig = {
227
238
  command: `vite serve`,
228
239
  options: {
@@ -243,6 +254,11 @@ function serveTarget(projectRoot) {
243
254
  }
244
255
  }
245
256
  };
257
+ if (isUsingTsSolutionSetup) {
258
+ targetConfig.syncGenerators = [
259
+ '@nx/js:typescript-sync'
260
+ ];
261
+ }
246
262
  return targetConfig;
247
263
  }
248
264
  function previewTarget(projectRoot, buildTargetName) {
@@ -313,7 +329,7 @@ async function testTarget(namedInputs, outputs, projectRoot) {
313
329
  }
314
330
  };
315
331
  }
316
- function serveStaticTarget(options) {
332
+ function serveStaticTarget(options, isUsingTsSolutionSetup) {
317
333
  const targetConfig = {
318
334
  executor: '@nx/web:file-server',
319
335
  options: {
@@ -321,6 +337,11 @@ function serveStaticTarget(options) {
321
337
  spa: true
322
338
  }
323
339
  };
340
+ if (isUsingTsSolutionSetup) {
341
+ targetConfig.syncGenerators = [
342
+ '@nx/js:typescript-sync'
343
+ ];
344
+ }
324
345
  return targetConfig;
325
346
  }
326
347
  function getOutputs(viteBuildConfig, projectRoot, workspaceRoot) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/vite/src/plugins/plugin.ts"],"sourcesContent":["import {\n CreateDependencies,\n CreateNodes,\n CreateNodesContext,\n createNodesFromFiles,\n CreateNodesV2,\n detectPackageManager,\n getPackageManagerCommand,\n joinPathFragments,\n logger,\n ProjectConfiguration,\n readJsonFile,\n TargetConfiguration,\n writeJsonFile,\n} from '@nx/devkit';\nimport { dirname, isAbsolute, join, relative } from 'path';\nimport { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs';\nimport { existsSync, readdirSync } from 'fs';\nimport { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash-for-create-nodes';\nimport { workspaceDataDirectory } from 'nx/src/utils/cache-directory';\nimport { getLockFileName } from '@nx/js';\nimport { loadViteDynamicImport } from '../utils/executor-utils';\nimport { hashObject } from 'nx/src/hasher/file-hasher';\nimport { minimatch } from 'minimatch';\nimport { isUsingTsSolutionSetup as _isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\n\nconst pmc = getPackageManagerCommand();\n\nexport interface VitePluginOptions {\n buildTargetName?: string;\n testTargetName?: string;\n serveTargetName?: string;\n previewTargetName?: string;\n serveStaticTargetName?: string;\n typecheckTargetName?: string;\n}\n\ntype ViteTargets = Pick<ProjectConfiguration, 'targets' | 'metadata'>;\n\nfunction readTargetsCache(cachePath: string): Record<string, ViteTargets> {\n return existsSync(cachePath) ? readJsonFile(cachePath) : {};\n}\n\nfunction writeTargetsToCache(cachePath, results?: Record<string, ViteTargets>) {\n writeJsonFile(cachePath, results);\n}\n\n/**\n * @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.\n */\nexport const createDependencies: CreateDependencies = () => {\n return [];\n};\n\nconst viteVitestConfigGlob = '**/{vite,vitest}.config.{js,ts,mjs,mts,cjs,cts}';\n\nexport const createNodesV2: CreateNodesV2<VitePluginOptions> = [\n viteVitestConfigGlob,\n async (configFilePaths, options, context) => {\n const optionsHash = hashObject(options);\n const cachePath = join(workspaceDataDirectory, `vite-${optionsHash}.hash`);\n const targetsCache = readTargetsCache(cachePath);\n const isUsingTsSolutionSetup = _isUsingTsSolutionSetup();\n try {\n return await createNodesFromFiles(\n (configFile, options, context) =>\n createNodesInternal(\n configFile,\n options,\n context,\n targetsCache,\n isUsingTsSolutionSetup\n ),\n configFilePaths,\n options,\n context\n );\n } finally {\n writeTargetsToCache(cachePath, targetsCache);\n }\n },\n];\n\nexport const createNodes: CreateNodes<VitePluginOptions> = [\n viteVitestConfigGlob,\n async (configFilePath, options, context) => {\n logger.warn(\n '`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.'\n );\n return createNodesInternal(\n configFilePath,\n options,\n context,\n {},\n _isUsingTsSolutionSetup()\n );\n },\n];\n\nasync function createNodesInternal(\n configFilePath: string,\n options: VitePluginOptions,\n context: CreateNodesContext,\n targetsCache: Record<string, ViteTargets>,\n isUsingTsSolutionSetup: boolean\n) {\n const projectRoot = dirname(configFilePath);\n // Do not create a project if package.json and project.json isn't there.\n const siblingFiles = readdirSync(join(context.workspaceRoot, projectRoot));\n if (\n !siblingFiles.includes('package.json') &&\n !siblingFiles.includes('project.json')\n ) {\n return {};\n }\n\n const tsConfigFiles =\n siblingFiles.filter((p) => minimatch(p, 'tsconfig*{.json,.*.json}')) ?? [];\n\n const normalizedOptions = normalizeOptions(options);\n\n // We do not want to alter how the hash is calculated, so appending the config file path to the hash\n // to prevent vite/vitest files overwriting the target cache created by the other\n const hash =\n (await calculateHashForCreateNodes(\n projectRoot,\n normalizedOptions,\n context,\n [getLockFileName(detectPackageManager(context.workspaceRoot))]\n )) + configFilePath;\n\n const { isLibrary, ...viteTargets } = await buildViteTargets(\n configFilePath,\n projectRoot,\n normalizedOptions,\n tsConfigFiles,\n isUsingTsSolutionSetup,\n context\n );\n targetsCache[hash] ??= viteTargets;\n\n const { targets, metadata } = targetsCache[hash];\n const project: ProjectConfiguration = {\n root: projectRoot,\n targets,\n metadata,\n };\n\n // If project is buildable, then the project type.\n // If it is not buildable, then leave it to other plugins/project.json to set the project type.\n if (project.targets[options.buildTargetName]) {\n project.projectType = isLibrary ? 'library' : 'application';\n }\n\n return {\n projects: {\n [projectRoot]: project,\n },\n };\n}\n\nasync function buildViteTargets(\n configFilePath: string,\n projectRoot: string,\n options: VitePluginOptions,\n tsConfigFiles: string[],\n isUsingTsSolutionSetup: boolean,\n context: CreateNodesContext\n): Promise<ViteTargets & { isLibrary: boolean }> {\n const absoluteConfigFilePath = joinPathFragments(\n context.workspaceRoot,\n configFilePath\n );\n // Workaround for the `build$3 is not a function` error that we sometimes see in agents.\n // This should be removed later once we address the issue properly\n try {\n const importEsbuild = () => new Function('return import(\"esbuild\")')();\n await importEsbuild();\n } catch {\n // do nothing\n }\n const { resolveConfig } = await loadViteDynamicImport();\n const viteBuildConfig = await resolveConfig(\n {\n configFile: absoluteConfigFilePath,\n mode: 'development',\n },\n 'build'\n );\n\n const { buildOutputs, testOutputs, hasTest, isBuildable, hasServeConfig } =\n getOutputs(viteBuildConfig, projectRoot, context.workspaceRoot);\n\n const namedInputs = getNamedInputs(projectRoot, context);\n\n const targets: Record<string, TargetConfiguration> = {};\n\n // If file is not vitest.config and buildable, create targets for build, serve, preview and serve-static\n const hasRemixPlugin =\n viteBuildConfig.plugins &&\n viteBuildConfig.plugins.some((p) => p.name === 'remix');\n if (\n !configFilePath.includes('vitest.config') &&\n !hasRemixPlugin &&\n isBuildable\n ) {\n targets[options.buildTargetName] = await buildTarget(\n options.buildTargetName,\n namedInputs,\n buildOutputs,\n projectRoot\n );\n\n // If running in library mode, then there is nothing to serve.\n if (!viteBuildConfig.build?.lib || hasServeConfig) {\n targets[options.serveTargetName] = serveTarget(projectRoot);\n targets[options.previewTargetName] = previewTarget(\n projectRoot,\n options.buildTargetName\n );\n targets[options.serveStaticTargetName] = serveStaticTarget(options) as {};\n }\n }\n\n if (tsConfigFiles.length) {\n const tsConfigToUse =\n ['tsconfig.app.json', 'tsconfig.lib.json', 'tsconfig.json'].find((t) =>\n tsConfigFiles.includes(t)\n ) ?? tsConfigFiles[0];\n targets[options.typecheckTargetName] = {\n cache: true,\n inputs: [\n ...('production' in namedInputs\n ? ['production', '^production']\n : ['default', '^default']),\n { externalDependencies: ['typescript'] },\n ],\n command: isUsingTsSolutionSetup\n ? `tsc --build --emitDeclarationOnly --pretty --verbose`\n : `tsc --noEmit -p ${tsConfigToUse}`,\n options: { cwd: joinPathFragments(projectRoot) },\n metadata: {\n description: `Run Typechecking`,\n help: {\n command: `${pmc.exec} tsc --help -p ${tsConfigToUse}`,\n example: {\n options: {\n noEmit: true,\n },\n },\n },\n },\n };\n }\n\n // if file is vitest.config or vite.config has definition for test, create target for test\n if (configFilePath.includes('vitest.config') || hasTest) {\n targets[options.testTargetName] = await testTarget(\n namedInputs,\n testOutputs,\n projectRoot\n );\n }\n\n const metadata = {};\n return { targets, metadata, isLibrary: Boolean(viteBuildConfig.build?.lib) };\n}\n\nasync function buildTarget(\n buildTargetName: string,\n namedInputs: {\n [inputName: string]: any[];\n },\n outputs: string[],\n projectRoot: string\n) {\n return {\n command: `vite build`,\n options: { cwd: joinPathFragments(projectRoot) },\n cache: true,\n dependsOn: [`^${buildTargetName}`],\n inputs: [\n ...('production' in namedInputs\n ? ['production', '^production']\n : ['default', '^default']),\n {\n externalDependencies: ['vite'],\n },\n ],\n outputs,\n metadata: {\n technologies: ['vite'],\n description: `Run Vite build`,\n help: {\n command: `${pmc.exec} vite build --help`,\n example: {\n options: {\n sourcemap: true,\n manifest: 'manifest.json',\n },\n },\n },\n },\n };\n}\n\nfunction serveTarget(projectRoot: string) {\n const targetConfig: TargetConfiguration = {\n command: `vite serve`,\n options: {\n cwd: joinPathFragments(projectRoot),\n },\n metadata: {\n technologies: ['vite'],\n description: `Starts Vite dev server`,\n help: {\n command: `${pmc.exec} vite --help`,\n example: {\n options: {\n port: 3000,\n },\n },\n },\n },\n };\n\n return targetConfig;\n}\n\nfunction previewTarget(projectRoot: string, buildTargetName) {\n const targetConfig: TargetConfiguration = {\n command: `vite preview`,\n dependsOn: [buildTargetName],\n options: {\n cwd: joinPathFragments(projectRoot),\n },\n metadata: {\n technologies: ['vite'],\n description: `Locally preview Vite production build`,\n help: {\n command: `${pmc.exec} vite preview --help`,\n example: {\n options: {\n port: 3000,\n },\n },\n },\n },\n };\n\n return targetConfig;\n}\n\nasync function testTarget(\n namedInputs: {\n [inputName: string]: any[];\n },\n outputs: string[],\n projectRoot: string\n) {\n return {\n command: `vitest`,\n options: { cwd: joinPathFragments(projectRoot) },\n cache: true,\n inputs: [\n ...('production' in namedInputs\n ? ['default', '^production']\n : ['default', '^default']),\n {\n externalDependencies: ['vitest'],\n },\n { env: 'CI' },\n ],\n outputs,\n metadata: {\n technologies: ['vite'],\n description: `Run Vite tests`,\n help: {\n command: `${pmc.exec} vitest --help`,\n example: {\n options: {\n bail: 1,\n coverage: true,\n },\n },\n },\n },\n };\n}\n\nfunction serveStaticTarget(options: VitePluginOptions) {\n const targetConfig: TargetConfiguration = {\n executor: '@nx/web:file-server',\n options: {\n buildTarget: `${options.buildTargetName}`,\n spa: true,\n },\n };\n\n return targetConfig;\n}\n\nfunction getOutputs(\n viteBuildConfig: Record<string, any> | undefined,\n projectRoot: string,\n workspaceRoot: string\n): {\n buildOutputs: string[];\n testOutputs: string[];\n hasTest: boolean;\n isBuildable: boolean;\n hasServeConfig: boolean;\n} {\n const { build, test, server } = viteBuildConfig;\n\n const buildOutputPath = normalizeOutputPath(\n build?.outDir,\n projectRoot,\n workspaceRoot,\n 'dist'\n );\n\n const isBuildable =\n build?.lib ||\n build?.rollupOptions?.input ||\n existsSync(join(workspaceRoot, projectRoot, 'index.html'));\n\n const hasServeConfig = Boolean(server);\n\n const reportsDirectoryPath = normalizeOutputPath(\n test?.coverage?.reportsDirectory,\n projectRoot,\n workspaceRoot,\n 'coverage'\n );\n\n return {\n buildOutputs: [buildOutputPath],\n testOutputs: [reportsDirectoryPath],\n hasTest: !!test,\n isBuildable,\n hasServeConfig,\n };\n}\n\nfunction normalizeOutputPath(\n outputPath: string | undefined,\n projectRoot: string,\n workspaceRoot: string,\n path: 'coverage' | 'dist'\n): string | undefined {\n if (!outputPath) {\n if (projectRoot === '.') {\n return `{projectRoot}/${path}`;\n } else {\n return `{workspaceRoot}/${path}/{projectRoot}`;\n }\n } else {\n if (isAbsolute(outputPath)) {\n return `{workspaceRoot}/${relative(workspaceRoot, outputPath)}`;\n } else {\n if (outputPath.startsWith('..')) {\n return join('{workspaceRoot}', join(projectRoot, outputPath));\n } else {\n return join('{projectRoot}', outputPath);\n }\n }\n }\n}\n\nfunction normalizeOptions(options: VitePluginOptions): VitePluginOptions {\n options ??= {};\n options.buildTargetName ??= 'build';\n options.serveTargetName ??= 'serve';\n options.previewTargetName ??= 'preview';\n options.testTargetName ??= 'test';\n options.serveStaticTargetName ??= 'serve-static';\n options.typecheckTargetName ??= 'typecheck';\n return options;\n}\n"],"names":["createDependencies","createNodes","createNodesV2","pmc","getPackageManagerCommand","readTargetsCache","cachePath","existsSync","readJsonFile","writeTargetsToCache","results","writeJsonFile","viteVitestConfigGlob","configFilePaths","options","context","optionsHash","hashObject","join","workspaceDataDirectory","targetsCache","isUsingTsSolutionSetup","_isUsingTsSolutionSetup","createNodesFromFiles","configFile","createNodesInternal","configFilePath","logger","warn","hash","projectRoot","dirname","siblingFiles","readdirSync","workspaceRoot","includes","tsConfigFiles","filter","p","minimatch","normalizedOptions","normalizeOptions","calculateHashForCreateNodes","getLockFileName","detectPackageManager","buildViteTargets","isLibrary","viteTargets","targets","metadata","project","root","buildTargetName","projectType","projects","viteBuildConfig","absoluteConfigFilePath","joinPathFragments","importEsbuild","Function","resolveConfig","loadViteDynamicImport","mode","buildOutputs","testOutputs","hasTest","isBuildable","hasServeConfig","getOutputs","namedInputs","getNamedInputs","hasRemixPlugin","plugins","some","name","buildTarget","build","lib","serveTargetName","serveTarget","previewTargetName","previewTarget","serveStaticTargetName","serveStaticTarget","length","tsConfigToUse","find","t","typecheckTargetName","cache","inputs","externalDependencies","command","cwd","description","help","exec","example","noEmit","testTargetName","testTarget","Boolean","outputs","dependsOn","technologies","sourcemap","manifest","targetConfig","port","env","bail","coverage","executor","spa","test","server","buildOutputPath","normalizeOutputPath","outDir","rollupOptions","input","reportsDirectoryPath","reportsDirectory","outputPath","path","isAbsolute","relative","startsWith"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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4CAARrF,UAAQqF,iBAAmB;;IAC3BrF,2BAAAA,YAAAA,SAAQoE,0DAARpE,UAAQoE,wBAA0B;;IAClCpE,yBAAAA,YAAAA,SAAQ0E,sDAAR1E,UAAQ0E,sBAAwB;IAChC,OAAO1E;AACT"}
1
+ {"version":3,"sources":["../../../../../packages/vite/src/plugins/plugin.ts"],"sourcesContent":["import {\n CreateDependencies,\n CreateNodes,\n CreateNodesContext,\n createNodesFromFiles,\n CreateNodesV2,\n detectPackageManager,\n getPackageManagerCommand,\n joinPathFragments,\n logger,\n ProjectConfiguration,\n readJsonFile,\n TargetConfiguration,\n writeJsonFile,\n} from '@nx/devkit';\nimport { dirname, isAbsolute, join, relative } from 'path';\nimport { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs';\nimport { existsSync, readdirSync } from 'fs';\nimport { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash-for-create-nodes';\nimport { workspaceDataDirectory } from 'nx/src/utils/cache-directory';\nimport { getLockFileName } from '@nx/js';\nimport { loadViteDynamicImport } from '../utils/executor-utils';\nimport { hashObject } from 'nx/src/hasher/file-hasher';\nimport { minimatch } from 'minimatch';\nimport { isUsingTsSolutionSetup as _isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';\n\nconst pmc = getPackageManagerCommand();\n\nexport interface VitePluginOptions {\n buildTargetName?: string;\n testTargetName?: string;\n serveTargetName?: string;\n previewTargetName?: string;\n serveStaticTargetName?: string;\n typecheckTargetName?: string;\n}\n\ntype ViteTargets = Pick<ProjectConfiguration, 'targets' | 'metadata'>;\n\nfunction readTargetsCache(cachePath: string): Record<string, ViteTargets> {\n return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && existsSync(cachePath)\n ? readJsonFile(cachePath)\n : {};\n}\n\nfunction writeTargetsToCache(cachePath, results?: Record<string, ViteTargets>) {\n writeJsonFile(cachePath, results);\n}\n\n/**\n * @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.\n */\nexport const createDependencies: CreateDependencies = () => {\n return [];\n};\n\nconst viteVitestConfigGlob = '**/{vite,vitest}.config.{js,ts,mjs,mts,cjs,cts}';\n\nexport const createNodesV2: CreateNodesV2<VitePluginOptions> = [\n viteVitestConfigGlob,\n async (configFilePaths, options, context) => {\n const optionsHash = hashObject(options);\n const cachePath = join(workspaceDataDirectory, `vite-${optionsHash}.hash`);\n const targetsCache = readTargetsCache(cachePath);\n const isUsingTsSolutionSetup = _isUsingTsSolutionSetup();\n try {\n return await createNodesFromFiles(\n (configFile, options, context) =>\n createNodesInternal(\n configFile,\n options,\n context,\n targetsCache,\n isUsingTsSolutionSetup\n ),\n configFilePaths,\n options,\n context\n );\n } finally {\n writeTargetsToCache(cachePath, targetsCache);\n }\n },\n];\n\nexport const createNodes: CreateNodes<VitePluginOptions> = [\n viteVitestConfigGlob,\n async (configFilePath, options, context) => {\n logger.warn(\n '`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.'\n );\n return createNodesInternal(\n configFilePath,\n options,\n context,\n {},\n _isUsingTsSolutionSetup()\n );\n },\n];\n\nasync function createNodesInternal(\n configFilePath: string,\n options: VitePluginOptions,\n context: CreateNodesContext,\n targetsCache: Record<string, ViteTargets>,\n isUsingTsSolutionSetup: boolean\n) {\n const projectRoot = dirname(configFilePath);\n // Do not create a project if package.json and project.json isn't there.\n const siblingFiles = readdirSync(join(context.workspaceRoot, projectRoot));\n if (\n !siblingFiles.includes('package.json') &&\n !siblingFiles.includes('project.json')\n ) {\n return {};\n }\n\n const tsConfigFiles =\n siblingFiles.filter((p) => minimatch(p, 'tsconfig*{.json,.*.json}')) ?? [];\n\n const normalizedOptions = normalizeOptions(options);\n\n // We do not want to alter how the hash is calculated, so appending the config file path to the hash\n // to prevent vite/vitest files overwriting the target cache created by the other\n const hash =\n (await calculateHashForCreateNodes(\n projectRoot,\n normalizedOptions,\n context,\n [getLockFileName(detectPackageManager(context.workspaceRoot))]\n )) + configFilePath;\n\n const { isLibrary, ...viteTargets } = await buildViteTargets(\n configFilePath,\n projectRoot,\n normalizedOptions,\n tsConfigFiles,\n isUsingTsSolutionSetup,\n context\n );\n targetsCache[hash] ??= viteTargets;\n\n const { targets, metadata } = targetsCache[hash];\n const project: ProjectConfiguration = {\n root: projectRoot,\n targets,\n metadata,\n };\n\n // If project is buildable, then the project type.\n // If it is not buildable, then leave it to other plugins/project.json to set the project type.\n if (project.targets[options.buildTargetName]) {\n project.projectType = isLibrary ? 'library' : 'application';\n }\n\n return {\n projects: {\n [projectRoot]: project,\n },\n };\n}\n\nasync function buildViteTargets(\n configFilePath: string,\n projectRoot: string,\n options: VitePluginOptions,\n tsConfigFiles: string[],\n isUsingTsSolutionSetup: boolean,\n context: CreateNodesContext\n): Promise<ViteTargets & { isLibrary: boolean }> {\n const absoluteConfigFilePath = joinPathFragments(\n context.workspaceRoot,\n configFilePath\n );\n // Workaround for the `build$3 is not a function` error that we sometimes see in agents.\n // This should be removed later once we address the issue properly\n try {\n const importEsbuild = () => new Function('return import(\"esbuild\")')();\n await importEsbuild();\n } catch {\n // do nothing\n }\n const { resolveConfig } = await loadViteDynamicImport();\n const viteBuildConfig = await resolveConfig(\n {\n configFile: absoluteConfigFilePath,\n mode: 'development',\n },\n 'build'\n );\n\n const { buildOutputs, testOutputs, hasTest, isBuildable, hasServeConfig } =\n getOutputs(viteBuildConfig, projectRoot, context.workspaceRoot);\n\n const namedInputs = getNamedInputs(projectRoot, context);\n\n const targets: Record<string, TargetConfiguration> = {};\n\n // If file is not vitest.config and buildable, create targets for build, serve, preview and serve-static\n const hasRemixPlugin =\n viteBuildConfig.plugins &&\n viteBuildConfig.plugins.some((p) => p.name === 'remix');\n if (\n !configFilePath.includes('vitest.config') &&\n !hasRemixPlugin &&\n isBuildable\n ) {\n targets[options.buildTargetName] = await buildTarget(\n options.buildTargetName,\n namedInputs,\n buildOutputs,\n projectRoot,\n isUsingTsSolutionSetup\n );\n\n // If running in library mode, then there is nothing to serve.\n if (!viteBuildConfig.build?.lib || hasServeConfig) {\n targets[options.serveTargetName] = serveTarget(\n projectRoot,\n isUsingTsSolutionSetup\n );\n targets[options.previewTargetName] = previewTarget(\n projectRoot,\n options.buildTargetName\n );\n targets[options.serveStaticTargetName] = serveStaticTarget(\n options,\n isUsingTsSolutionSetup\n );\n }\n }\n\n if (tsConfigFiles.length) {\n const tsConfigToUse =\n ['tsconfig.app.json', 'tsconfig.lib.json', 'tsconfig.json'].find((t) =>\n tsConfigFiles.includes(t)\n ) ?? tsConfigFiles[0];\n targets[options.typecheckTargetName] = {\n cache: true,\n inputs: [\n ...('production' in namedInputs\n ? ['production', '^production']\n : ['default', '^default']),\n { externalDependencies: ['typescript'] },\n ],\n command: isUsingTsSolutionSetup\n ? `tsc --build --emitDeclarationOnly --pretty --verbose`\n : `tsc --noEmit -p ${tsConfigToUse}`,\n options: { cwd: joinPathFragments(projectRoot) },\n metadata: {\n description: `Run Typechecking`,\n help: {\n command: `${pmc.exec} tsc --help -p ${tsConfigToUse}`,\n example: {\n options: {\n noEmit: true,\n },\n },\n },\n },\n };\n\n if (isUsingTsSolutionSetup) {\n targets[options.typecheckTargetName].syncGenerators = [\n '@nx/js:typescript-sync',\n ];\n }\n }\n\n // if file is vitest.config or vite.config has definition for test, create target for test\n if (configFilePath.includes('vitest.config') || hasTest) {\n targets[options.testTargetName] = await testTarget(\n namedInputs,\n testOutputs,\n projectRoot\n );\n }\n\n const metadata = {};\n return { targets, metadata, isLibrary: Boolean(viteBuildConfig.build?.lib) };\n}\n\nasync function buildTarget(\n buildTargetName: string,\n namedInputs: {\n [inputName: string]: any[];\n },\n outputs: string[],\n projectRoot: string,\n isUsingTsSolutionSetup: boolean\n) {\n const buildTarget: TargetConfiguration = {\n command: `vite build`,\n options: { cwd: joinPathFragments(projectRoot) },\n cache: true,\n dependsOn: [`^${buildTargetName}`],\n inputs: [\n ...('production' in namedInputs\n ? ['production', '^production']\n : ['default', '^default']),\n {\n externalDependencies: ['vite'],\n },\n ],\n outputs,\n metadata: {\n technologies: ['vite'],\n description: `Run Vite build`,\n help: {\n command: `${pmc.exec} vite build --help`,\n example: {\n options: {\n sourcemap: true,\n manifest: 'manifest.json',\n },\n },\n },\n },\n };\n\n if (isUsingTsSolutionSetup) {\n buildTarget.syncGenerators = ['@nx/js:typescript-sync'];\n }\n\n return buildTarget;\n}\n\nfunction serveTarget(projectRoot: string, isUsingTsSolutionSetup: boolean) {\n const targetConfig: TargetConfiguration = {\n command: `vite serve`,\n options: {\n cwd: joinPathFragments(projectRoot),\n },\n metadata: {\n technologies: ['vite'],\n description: `Starts Vite dev server`,\n help: {\n command: `${pmc.exec} vite --help`,\n example: {\n options: {\n port: 3000,\n },\n },\n },\n },\n };\n\n if (isUsingTsSolutionSetup) {\n targetConfig.syncGenerators = ['@nx/js:typescript-sync'];\n }\n\n return targetConfig;\n}\n\nfunction previewTarget(projectRoot: string, buildTargetName) {\n const targetConfig: TargetConfiguration = {\n command: `vite preview`,\n dependsOn: [buildTargetName],\n options: {\n cwd: joinPathFragments(projectRoot),\n },\n metadata: {\n technologies: ['vite'],\n description: `Locally preview Vite production build`,\n help: {\n command: `${pmc.exec} vite preview --help`,\n example: {\n options: {\n port: 3000,\n },\n },\n },\n },\n };\n\n return targetConfig;\n}\n\nasync function testTarget(\n namedInputs: {\n [inputName: string]: any[];\n },\n outputs: string[],\n projectRoot: string\n) {\n return {\n command: `vitest`,\n options: { cwd: joinPathFragments(projectRoot) },\n cache: true,\n inputs: [\n ...('production' in namedInputs\n ? ['default', '^production']\n : ['default', '^default']),\n {\n externalDependencies: ['vitest'],\n },\n { env: 'CI' },\n ],\n outputs,\n metadata: {\n technologies: ['vite'],\n description: `Run Vite tests`,\n help: {\n command: `${pmc.exec} vitest --help`,\n example: {\n options: {\n bail: 1,\n coverage: true,\n },\n },\n },\n },\n };\n}\n\nfunction serveStaticTarget(\n options: VitePluginOptions,\n isUsingTsSolutionSetup: boolean\n) {\n const targetConfig: TargetConfiguration = {\n executor: '@nx/web:file-server',\n options: {\n buildTarget: `${options.buildTargetName}`,\n spa: true,\n },\n };\n\n if (isUsingTsSolutionSetup) {\n targetConfig.syncGenerators = ['@nx/js:typescript-sync'];\n }\n\n return targetConfig;\n}\n\nfunction getOutputs(\n viteBuildConfig: Record<string, any> | undefined,\n projectRoot: string,\n workspaceRoot: string\n): {\n buildOutputs: string[];\n testOutputs: string[];\n hasTest: boolean;\n isBuildable: boolean;\n hasServeConfig: boolean;\n} {\n const { build, test, server } = viteBuildConfig;\n\n const buildOutputPath = normalizeOutputPath(\n build?.outDir,\n projectRoot,\n workspaceRoot,\n 'dist'\n );\n\n const isBuildable =\n build?.lib ||\n build?.rollupOptions?.input ||\n existsSync(join(workspaceRoot, projectRoot, 'index.html'));\n\n const hasServeConfig = Boolean(server);\n\n const reportsDirectoryPath = normalizeOutputPath(\n test?.coverage?.reportsDirectory,\n projectRoot,\n workspaceRoot,\n 'coverage'\n );\n\n return {\n buildOutputs: [buildOutputPath],\n testOutputs: [reportsDirectoryPath],\n hasTest: !!test,\n isBuildable,\n hasServeConfig,\n };\n}\n\nfunction normalizeOutputPath(\n outputPath: string | undefined,\n projectRoot: string,\n workspaceRoot: string,\n path: 'coverage' | 'dist'\n): string | undefined {\n if (!outputPath) {\n if (projectRoot === '.') {\n return `{projectRoot}/${path}`;\n } else {\n return `{workspaceRoot}/${path}/{projectRoot}`;\n }\n } else {\n if (isAbsolute(outputPath)) {\n return `{workspaceRoot}/${relative(workspaceRoot, outputPath)}`;\n } else {\n if (outputPath.startsWith('..')) {\n return join('{workspaceRoot}', join(projectRoot, outputPath));\n } else {\n return join('{projectRoot}', outputPath);\n }\n }\n }\n}\n\nfunction normalizeOptions(options: VitePluginOptions): VitePluginOptions {\n options ??= {};\n options.buildTargetName ??= 'build';\n options.serveTargetName ??= 'serve';\n options.previewTargetName ??= 'preview';\n options.testTargetName ??= 'test';\n options.serveStaticTargetName ??= 'serve-static';\n options.typecheckTargetName ??= 'typecheck';\n return options;\n}\n"],"names":["createDependencies","createNodes","createNodesV2","pmc","getPackageManagerCommand","readTargetsCache","cachePath","process","env","NX_CACHE_PROJECT_GRAPH","existsSync","readJsonFile","writeTargetsToCache","results","writeJsonFile","viteVitestConfigGlob","configFilePaths","options","context","optionsHash","hashObject","join","workspaceDataDirectory","targetsCache","isUsingTsSolutionSetup","_isUsingTsSolutionSetup","createNodesFromFiles","configFile","createNodesInternal","configFilePath","logger","warn","hash","projectRoot","dirname","siblingFiles","readdirSync","workspaceRoot","includes","tsConfigFiles","filter","p","minimatch","normalizedOptions","normalizeOptions","calculateHashForCreateNodes","getLockFileName","detectPackageManager","buildViteTargets","isLibrary","viteTargets","targets","metadata","project","root","buildTargetName","projectType","projects","viteBuildConfig","absoluteConfigFilePath","joinPathFragments","importEsbuild","Function","resolveConfig","loadViteDynamicImport","mode","buildOutputs","testOutputs","hasTest","isBuildable","hasServeConfig","getOutputs","namedInputs","getNamedInputs","hasRemixPlugin","plugins","some","name","buildTarget","build","lib","serveTargetName","serveTarget","previewTargetName","previewTarget","serveStaticTargetName","serveStaticTarget","length","tsConfigToUse","find","t","typecheckTargetName","cache","inputs","externalDependencies","command","cwd","description","help","exec","example","noEmit","syncGenerators","testTargetName","testTarget","Boolean","outputs","dependsOn","technologies","sourcemap","manifest","targetConfig","port","bail","coverage","executor","spa","test","server","buildOutputPath","normalizeOutputPath","outDir","rollupOptions","input","reportsDirectoryPath","reportsDirectory","outputPath","path","isAbsolute","relative","startsWith"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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