@nx/vite 22.1.0-beta.1 → 22.1.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": "22.1.0-beta.1",
3
+ "version": "22.1.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for building and testing applications using Vite",
6
6
  "repository": {
@@ -30,10 +30,10 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nx/devkit": "22.1.0-beta.1",
33
+ "@nx/devkit": "22.1.0-beta.3",
34
34
  "@phenomnomnominal/tsquery": "~5.0.1",
35
35
  "enquirer": "~2.3.6",
36
- "@nx/js": "22.1.0-beta.1",
36
+ "@nx/js": "22.1.0-beta.3",
37
37
  "picomatch": "4.0.2",
38
38
  "tsconfig-paths": "^4.1.2",
39
39
  "semver": "^7.6.3",
@@ -41,7 +41,7 @@
41
41
  "ajv": "^8.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "nx": "22.1.0-beta.1"
44
+ "nx": "22.1.0-beta.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "title": "Vite Prod Builder",
5
5
  "cli": "nx",
6
- "description": "Builds a Vite.js application for production.",
6
+ "description": "Builds a Vite application for production.",
7
7
  "type": "object",
8
8
  "presets": [
9
9
  {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "configFile": {
38
38
  "type": "string",
39
- "description": "The name of the Vite.js configuration file.",
39
+ "description": "The name of the Vite configuration file.",
40
40
  "x-completion-type": "file",
41
41
  "x-completion-glob": "vite.config.@(js|ts)"
42
42
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "cli": "nx",
3
- "title": "Configure a project to use Vite.js.",
4
- "description": "Configure a project to use Vite.js.",
3
+ "title": "Configure a project to use Vite.",
4
+ "description": "Configure a project to use Vite.",
5
5
  "$id": "configure-vite-project",
6
6
  "type": "object",
7
7
  "properties": {
@@ -12,6 +12,14 @@ export interface VitePluginOptions {
12
12
  typecheckTargetName?: string;
13
13
  watchDepsTargetName?: string;
14
14
  buildDepsTargetName?: string;
15
+ /**
16
+ * Atomizer for vitest
17
+ */
18
+ ciTargetName?: string;
19
+ /**
20
+ * The name that should be used to group atomized tasks on CI
21
+ */
22
+ ciGroupName?: string;
15
23
  }
16
24
  /**
17
25
  * @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAQd,MAAM,YAAY,CAAC;AAkBpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAiBD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CAuGxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EASd,MAAM,YAAY,CAAC;AAgBpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CAuGxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
@@ -2,20 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = exports.createNodes = exports.createDependencies = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const path_1 = require("path");
6
- const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
7
- const fs_1 = require("fs");
8
5
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
9
- const cache_directory_1 = require("nx/src/utils/cache-directory");
6
+ const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
10
7
  const js_1 = require("@nx/js");
11
- const executor_utils_1 = require("../utils/executor-utils");
8
+ const util_1 = require("@nx/js/src/plugins/typescript/util");
9
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = require("node:path");
12
12
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
13
+ const cache_directory_1 = require("nx/src/utils/cache-directory");
14
+ const plugins_1 = require("nx/src/utils/plugins");
15
+ const executor_utils_1 = require("../utils/executor-utils");
13
16
  const picomatch = require("picomatch");
14
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
15
- const util_1 = require("@nx/js/src/plugins/typescript/util");
16
17
  const pmc = (0, devkit_1.getPackageManagerCommand)();
17
18
  function readTargetsCache(cachePath) {
18
- return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, fs_1.existsSync)(cachePath)
19
+ return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, node_fs_1.existsSync)(cachePath)
19
20
  ? (0, devkit_1.readJsonFile)(cachePath)
20
21
  : {};
21
22
  }
@@ -35,11 +36,11 @@ exports.createNodes = [
35
36
  async (configFilePaths, options, context) => {
36
37
  const optionsHash = (0, file_hasher_1.hashObject)(options);
37
38
  const normalizedOptions = normalizeOptions(options);
38
- const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
39
+ const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
39
40
  const targetsCache = readTargetsCache(cachePath);
40
41
  const isUsingTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
41
42
  const { roots: projectRoots, configFiles: validConfigFiles } = configFilePaths.reduce((acc, configFile) => {
42
- const potentialRoot = (0, path_1.dirname)(configFile);
43
+ const potentialRoot = (0, node_path_1.dirname)(configFile);
43
44
  if (checkIfConfigFileShouldBeProject(potentialRoot, context)) {
44
45
  acc.roots.push(potentialRoot);
45
46
  acc.configFiles.push(configFile);
@@ -53,9 +54,9 @@ exports.createNodes = [
53
54
  const hashes = await (0, calculate_hash_for_create_nodes_1.calculateHashesForCreateNodes)(projectRoots, { ...normalizedOptions, isUsingTsSolutionSetup }, context, projectRoots.map((r) => [lockfile]));
54
55
  try {
55
56
  return await (0, devkit_1.createNodesFromFiles)(async (configFile, _, context, idx) => {
56
- const projectRoot = (0, path_1.dirname)(configFile);
57
+ const projectRoot = (0, node_path_1.dirname)(configFile);
57
58
  // Do not create a project if package.json and project.json isn't there.
58
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
59
+ const siblingFiles = (0, node_fs_1.readdirSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot));
59
60
  const tsConfigFiles = siblingFiles.filter((p) => picomatch('tsconfig*{.json,.*.json}')(p)) ?? [];
60
61
  const hasReactRouterConfig = siblingFiles.some((configFile) => {
61
62
  const parts = configFile.split('.');
@@ -104,17 +105,101 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
104
105
  catch {
105
106
  // do nothing
106
107
  }
108
+ // Workaround for race condition with ESM-only Vite plugins (e.g. @vitejs/plugin-vue@6+)
109
+ // If vite.config.ts is compiled as CJS, then when both require('@vitejs/plugin-vue') and import('@vitejs/plugin-vue')
110
+ // are pending in the same process, Node will throw an error:
111
+ // Error [ERR_INTERNAL_ASSERTION]: Cannot require() ES Module @vitejs/plugin-vue/dist/index.js because it is not yet fully loaded.
112
+ // This may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().
113
+ try {
114
+ const importVuePlugin = () => new Function('return import("@vitejs/plugin-vue")')();
115
+ await importVuePlugin();
116
+ }
117
+ catch {
118
+ // Plugin not installed or not needed, ignore
119
+ }
107
120
  const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
108
121
  const viteBuildConfig = await resolveConfig({
109
122
  configFile: absoluteConfigFilePath,
110
123
  mode: 'development',
111
124
  }, 'build');
125
+ let metadata = {};
112
126
  const { buildOutputs, testOutputs, hasTest, isBuildable, hasServeConfig } = getOutputs(viteBuildConfig, projectRoot, context.workspaceRoot);
113
127
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
114
128
  const targets = {};
115
- // if file is vitest.config or vite.config has definition for test, create target for test
129
+ // if file is vitest.config or vite.config has definition for test, create targets for test and/or atomized tests
116
130
  if (configFilePath.includes('vitest.config') || hasTest) {
117
131
  targets[options.testTargetName] = await testTarget(namedInputs, testOutputs, projectRoot);
132
+ if (options.ciTargetName) {
133
+ const groupName = options.ciGroupName ?? (0, plugins_1.deriveGroupNameFromTarget)(options.ciTargetName);
134
+ const targetGroup = [];
135
+ const dependsOn = [];
136
+ metadata = {
137
+ targetGroups: {
138
+ [groupName]: targetGroup,
139
+ },
140
+ };
141
+ const projectRootRelativeTestPaths = await getTestPathsRelativeToProjectRoot(projectRoot);
142
+ for (const relativePath of projectRootRelativeTestPaths) {
143
+ if (relativePath.includes('../')) {
144
+ throw new Error('@nx/vite/plugin attempted to run tests outside of the project root. This is not supported and should not happen. Please open an issue at https://github.com/nrwl/nx/issues/new/choose with the following information:\n\n' +
145
+ `\n\n${JSON.stringify({
146
+ projectRoot,
147
+ relativePath,
148
+ projectRootRelativeTestPaths,
149
+ context,
150
+ }, null, 2)}`);
151
+ }
152
+ const targetName = `${options.ciTargetName}--${relativePath}`;
153
+ dependsOn.push(targetName);
154
+ targets[targetName] = {
155
+ // It does not make sense to run atomized tests in watch mode as they are intended to be run in CI
156
+ command: `vitest run ${relativePath}`,
157
+ cache: targets[options.testTargetName].cache,
158
+ inputs: targets[options.testTargetName].inputs,
159
+ outputs: targets[options.testTargetName].outputs,
160
+ options: {
161
+ cwd: projectRoot,
162
+ env: targets[options.testTargetName].options.env,
163
+ },
164
+ metadata: {
165
+ technologies: ['vitest'],
166
+ description: `Run Vitest Tests in ${relativePath}`,
167
+ help: {
168
+ command: `${pmc.exec} vitest --help`,
169
+ example: {
170
+ options: {
171
+ coverage: true,
172
+ },
173
+ },
174
+ },
175
+ },
176
+ };
177
+ targetGroup.push(targetName);
178
+ }
179
+ if (targetGroup.length > 0) {
180
+ targets[options.ciTargetName] = {
181
+ executor: 'nx:noop',
182
+ cache: true,
183
+ inputs: targets[options.testTargetName].inputs,
184
+ outputs: targets[options.testTargetName].outputs,
185
+ dependsOn,
186
+ metadata: {
187
+ technologies: ['vitest'],
188
+ description: 'Run Vitest Tests in CI',
189
+ nonAtomizedTarget: options.testTargetName,
190
+ help: {
191
+ command: `${pmc.exec} vitest --help`,
192
+ example: {
193
+ options: {
194
+ coverage: true,
195
+ },
196
+ },
197
+ },
198
+ },
199
+ };
200
+ targetGroup.unshift(options.ciTargetName);
201
+ }
202
+ }
118
203
  }
119
204
  if (hasReactRouterConfig) {
120
205
  // If we have a react-router config, we can skip the rest of the targets
@@ -186,7 +271,6 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
186
271
  }
187
272
  }
188
273
  (0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
189
- const metadata = {};
190
274
  return {
191
275
  targets,
192
276
  metadata,
@@ -324,7 +408,7 @@ function getOutputs(viteBuildConfig, projectRoot, workspaceRoot) {
324
408
  const buildOutputPath = normalizeOutputPath(build?.outDir, projectRoot, workspaceRoot, 'dist');
325
409
  const isBuildable = build?.lib ||
326
410
  build?.rollupOptions?.input ||
327
- (0, fs_1.existsSync)((0, path_1.join)(workspaceRoot, projectRoot, 'index.html'));
411
+ (0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRoot, projectRoot, 'index.html'));
328
412
  const hasServeConfig = Boolean(server?.host || server?.port);
329
413
  const reportsDirectoryPath = normalizeOutputPath(test?.coverage?.reportsDirectory, projectRoot, workspaceRoot, 'coverage');
330
414
  return {
@@ -345,15 +429,15 @@ function normalizeOutputPath(outputPath, projectRoot, workspaceRoot, path) {
345
429
  }
346
430
  }
347
431
  else {
348
- if ((0, path_1.isAbsolute)(outputPath)) {
349
- return `{workspaceRoot}/${(0, path_1.relative)(workspaceRoot, outputPath)}`;
432
+ if ((0, node_path_1.isAbsolute)(outputPath)) {
433
+ return `{workspaceRoot}/${(0, node_path_1.relative)(workspaceRoot, outputPath)}`;
350
434
  }
351
435
  else {
352
436
  if (outputPath.startsWith('..')) {
353
- return (0, path_1.join)('{workspaceRoot}', (0, path_1.join)(projectRoot, outputPath));
437
+ return (0, node_path_1.join)('{workspaceRoot}', (0, node_path_1.join)(projectRoot, outputPath));
354
438
  }
355
439
  else {
356
- return (0, path_1.join)('{projectRoot}', outputPath);
440
+ return (0, node_path_1.join)('{projectRoot}', outputPath);
357
441
  }
358
442
  }
359
443
  }
@@ -371,10 +455,21 @@ function normalizeOptions(options) {
371
455
  }
372
456
  function checkIfConfigFileShouldBeProject(projectRoot, context) {
373
457
  // Do not create a project if package.json and project.json isn't there.
374
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
458
+ const siblingFiles = (0, node_fs_1.readdirSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot));
375
459
  if (!siblingFiles.includes('package.json') &&
376
460
  !siblingFiles.includes('project.json')) {
377
461
  return false;
378
462
  }
379
463
  return true;
380
464
  }
465
+ async function getTestPathsRelativeToProjectRoot(projectRoot) {
466
+ const fullProjectRoot = (0, node_path_1.join)(devkit_1.workspaceRoot, projectRoot);
467
+ const { createVitest } = await Promise.resolve().then(() => require('vitest/node'));
468
+ const vitest = await createVitest('test', {
469
+ dir: fullProjectRoot,
470
+ filesOnly: true,
471
+ watch: false,
472
+ });
473
+ const relevantTestSpecifications = await vitest.getRelevantTestSpecifications();
474
+ return relevantTestSpecifications.map((ts) => (0, node_path_1.relative)(projectRoot, ts.moduleId));
475
+ }
@@ -282,7 +282,7 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
282
282
  ? ''
283
283
  : options.includeLib
284
284
  ? ` // Configuration for building your library.
285
- // See: https://vitejs.dev/guide/build.html#library-mode
285
+ // See: https://vite.dev/guide/build.html#library-mode
286
286
  build: {
287
287
  outDir: '${buildOutDir}',
288
288
  emptyOutDir: true,
@@ -435,8 +435,8 @@ async function handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName
435
435
  devkit_1.logger.warn(`The custom ${target} target you provided (${userProvidedTargetName}) cannot be converted to use the @nx/vite:${executor} executor.
436
436
  However, we found the following ${target} target in your project that can be converted: ${validFoundTargetName}
437
437
 
438
- Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit
439
- your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.
438
+ Please note that converting a potentially non-compatible project to use Vite may result in unexpected behavior. Always commit
439
+ your changes before converting a project to use Vite, and test the converted project thoroughly before deploying it.
440
440
  `);
441
441
  const { Confirm } = require('enquirer');
442
442
  const prompt = new Confirm({
@@ -450,8 +450,8 @@ async function handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName
450
450
  Please try again, either by providing a different ${target} target or by not providing a target at all (Nx will
451
451
  convert the first one it finds, most probably this one: ${validFoundTargetName})
452
452
 
453
- Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit
454
- your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.
453
+ Please note that converting a potentially non-compatible project to use Vite may result in unexpected behavior. Always commit
454
+ your changes before converting a project to use Vite, and test the converted project thoroughly before deploying it.
455
455
  `);
456
456
  }
457
457
  }
@@ -5,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 { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default {\n plugins: [\n react(),\n nxViteTsPaths(),\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 { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n \n cacheDir: '../../node_modules/.vitest',\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n\n });\n ";
7
7
  export declare const someBuildOptionsSomeTestOption = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n\n export default defineConfig({\n plugins: [\n react(),\n nxViteTsPaths(),\n ],\n\n test: {\n my: 'option',\n },\n\n build: {\n my: 'option',\n }\n\n });\n ";
8
- export declare const hasEverything = "\n /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vitejs.dev/guide/build.html#library-mode\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points.\n entry: 'src/index.ts',\n name: 'pure-libs-react-vite',\n fileName: 'index',\n // Change this to the formats you want to support.\n // Don't forget to update your package.json as well.\n formats: ['es'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n ";
9
- 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']\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 { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';\n import dts from 'vite-plugin-dts';\n import { joinPathFragments } from '@nx/devkit';\n\n export default defineConfig({\n cacheDir: '../../node_modules/.vitest',\n plugins: [\n dts({ entryRoot: 'src', tsConfigFilePath: joinPathFragments(__dirname, 'tsconfig.lib.json'), skipDiagnostics: true }),\n react(),\n nxViteTsPaths(),\n ],\n \n // Configuration for building your library.\n // See: https://vite.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'],\n },\n rollupOptions: {\n // External packages that should not be bundled into your library.\n external: ['react', 'react-dom', 'react/jsx-runtime'],\n },\n },\n \n test: {\n globals: true,\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n ";
9
+ export declare const buildOption = "\n // Configuration for building your library.\n // See: https://vite.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']\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;
@@ -1 +1 @@
1
- {"version":3,"file":"test-vite-configs.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/utils/test-files/test-vite-configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,iiBAoBtB,CAAC;AAEN,eAAO,MAAM,gBAAgB,mlBAwBxB,CAAC;AAEN,eAAO,MAAM,qBAAqB,oQAO7B,CAAC;AAEN,eAAO,MAAM,iBAAiB,4YAgBzB,CAAC;AAEN,eAAO,MAAM,oBAAoB,oUAY5B,CAAC;AAEN,eAAO,MAAM,2BAA2B,uiBAqBnC,CAAC;AAEN,eAAO,MAAM,8BAA8B,wbAqBtC,CAAC;AAEN,eAAO,MAAM,aAAa,o7CAwCrB,CAAC;AAEN,eAAO,MAAM,WAAW,goBAiBjB,CAAC;AACR,eAAO,MAAM,iBAAiB;;;;;;;;;;CAU7B,CAAC;AAEF,eAAO,MAAM,UAAU,uJAIhB,CAAC;AAER,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,OAAO,UAGnB,CAAC;AAEF,eAAO,MAAM,OAAO,UAAiC,CAAC"}
1
+ {"version":3,"file":"test-vite-configs.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/utils/test-files/test-vite-configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,iiBAoBtB,CAAC;AAEN,eAAO,MAAM,gBAAgB,mlBAwBxB,CAAC;AAEN,eAAO,MAAM,qBAAqB,oQAO7B,CAAC;AAEN,eAAO,MAAM,iBAAiB,4YAgBzB,CAAC;AAEN,eAAO,MAAM,oBAAoB,oUAY5B,CAAC;AAEN,eAAO,MAAM,2BAA2B,uiBAqBnC,CAAC;AAEN,eAAO,MAAM,8BAA8B,wbAqBtC,CAAC;AAEN,eAAO,MAAM,aAAa,k7CAwCrB,CAAC;AAEN,eAAO,MAAM,WAAW,8nBAiBjB,CAAC;AACR,eAAO,MAAM,iBAAiB;;;;;;;;;;CAU7B,CAAC;AAEF,eAAO,MAAM,UAAU,uJAIhB,CAAC;AAER,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,OAAO,UAGnB,CAAC;AAEF,eAAO,MAAM,OAAO,UAAiC,CAAC"}
@@ -146,7 +146,7 @@ exports.hasEverything = `
146
146
  ],
147
147
 
148
148
  // Configuration for building your library.
149
- // See: https://vitejs.dev/guide/build.html#library-mode
149
+ // See: https://vite.dev/guide/build.html#library-mode
150
150
  build: {
151
151
  lib: {
152
152
  // Could also be a dictionary or array of multiple entry points.
@@ -172,7 +172,7 @@ exports.hasEverything = `
172
172
  `;
173
173
  exports.buildOption = `
174
174
  // Configuration for building your library.
175
- // See: https://vitejs.dev/guide/build.html#library-mode
175
+ // See: https://vite.dev/guide/build.html#library-mode
176
176
  build: {
177
177
  lib: {
178
178
  // Could also be a dictionary or array of multiple entry points.