@nx/vitest 23.2.1 → 23.3.0-beta.1

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.
@@ -448,16 +448,39 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
448
448
  const jsonCache = new Map();
449
449
  const result = new Map();
450
450
  const rootTsConfigName = (0, js_1.getRootTsConfigFileName)();
451
+ // A directory cache requires project-specific filtering on replay.
452
+ const dirChainCache = new Map();
453
+ const collectDirChain = (dir) => {
454
+ const cached = dirChainCache.get(dir);
455
+ if (cached !== undefined)
456
+ return cached;
457
+ const paths = [];
458
+ const localSeen = new Set();
459
+ const tsconfigPath = dir
460
+ ? (0, node_path_1.join)(workspaceRoot, dir, 'tsconfig.json')
461
+ : (0, node_path_1.join)(workspaceRoot, 'tsconfig.json');
462
+ if ((0, node_fs_1.existsSync)(tsconfigPath)) {
463
+ (0, internal_2.walkTsconfigExtendsChain)(tsconfigPath, (absPath) => {
464
+ const wsRelative = (0, node_path_1.relative)(workspaceRoot, absPath)
465
+ .split(node_path_1.sep)
466
+ .join('/');
467
+ if (!localSeen.has(wsRelative)) {
468
+ localSeen.add(wsRelative);
469
+ paths.push(wsRelative);
470
+ }
471
+ return 'continue';
472
+ }, { jsonCache });
473
+ }
474
+ dirChainCache.set(dir, paths);
475
+ return paths;
476
+ };
451
477
  for (const projectRoot of projectRoots) {
452
478
  if (projectRoot === '.')
453
479
  continue;
454
480
  const outside = [];
455
481
  const seen = new Set();
456
482
  const projectPrefix = `${projectRoot}/`;
457
- const collect = (absolutePath) => {
458
- const wsRelative = (0, node_path_1.relative)(workspaceRoot, absolutePath)
459
- .split(node_path_1.sep)
460
- .join('/');
483
+ const collectWsRelative = (wsRelative) => {
461
484
  if (seen.has(wsRelative))
462
485
  return;
463
486
  seen.add(wsRelative);
@@ -472,11 +495,13 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
472
495
  return;
473
496
  outside.push(wsRelative);
474
497
  };
475
- // 1. Walk the project tsconfig's extends chain
476
498
  const projectTsconfig = (0, node_path_1.join)(workspaceRoot, projectRoot, 'tsconfig.json');
477
499
  if ((0, node_fs_1.existsSync)(projectTsconfig)) {
478
500
  (0, internal_2.walkTsconfigExtendsChain)(projectTsconfig, (absPath) => {
479
- collect(absPath);
501
+ const wsRelative = (0, node_path_1.relative)(workspaceRoot, absPath)
502
+ .split(node_path_1.sep)
503
+ .join('/');
504
+ collectWsRelative(wsRelative);
480
505
  return 'continue';
481
506
  }, { jsonCache });
482
507
  }
@@ -484,12 +509,8 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
484
509
  // between the entry point and the filesystem root)
485
510
  let dir = (0, node_path_1.dirname)(projectRoot);
486
511
  while (dir && dir !== '.') {
487
- const ancestorTsconfig = (0, node_path_1.join)(workspaceRoot, dir, 'tsconfig.json');
488
- if ((0, node_fs_1.existsSync)(ancestorTsconfig)) {
489
- (0, internal_2.walkTsconfigExtendsChain)(ancestorTsconfig, (absPath) => {
490
- collect(absPath);
491
- return 'continue';
492
- }, { jsonCache });
512
+ for (const wsRelative of collectDirChain(dir)) {
513
+ collectWsRelative(wsRelative);
493
514
  }
494
515
  const parent = (0, node_path_1.dirname)(dir);
495
516
  if (parent === dir)
@@ -497,12 +518,8 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
497
518
  dir = parent;
498
519
  }
499
520
  // 3. Check the workspace root itself (dirname loop above stops at '.')
500
- const rootTsconfig = (0, node_path_1.join)(workspaceRoot, 'tsconfig.json');
501
- if ((0, node_fs_1.existsSync)(rootTsconfig)) {
502
- (0, internal_2.walkTsconfigExtendsChain)(rootTsconfig, (absPath) => {
503
- collect(absPath);
504
- return 'continue';
505
- }, { jsonCache });
521
+ for (const wsRelative of collectDirChain('')) {
522
+ collectWsRelative(wsRelative);
506
523
  }
507
524
  if (outside.length > 0) {
508
525
  result.set(projectRoot, outside);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/vitest",
3
3
  "description": "The Nx Plugin for Vitest to enable fast unit testing with Vitest.",
4
- "version": "23.2.1",
4
+ "version": "23.3.0-beta.1",
5
5
  "type": "commonjs",
6
6
  "files": [
7
7
  "dist",
@@ -81,13 +81,13 @@
81
81
  "tslib": "^2.3.0",
82
82
  "semver": "^7.6.3",
83
83
  "@phenomnomnominal/tsquery": "~6.2.0",
84
- "@nx/devkit": "23.2.1",
85
- "@nx/js": "23.2.1"
84
+ "@nx/devkit": "23.3.0-beta.1",
85
+ "@nx/js": "23.3.0-beta.1"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "vitest": "^3.0.0 || ^4.0.0",
89
89
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
90
- "@nx/eslint": "23.2.1"
90
+ "@nx/eslint": "23.3.0-beta.1"
91
91
  },
92
92
  "peerDependenciesMeta": {
93
93
  "@nx/eslint": {
@@ -101,6 +101,6 @@
101
101
  }
102
102
  },
103
103
  "devDependencies": {
104
- "nx": "23.2.1"
104
+ "nx": "23.3.0-beta.1"
105
105
  }
106
106
  }