@nx/vite 22.1.0-beta.3 → 22.1.0-beta.5

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.3",
3
+ "version": "22.1.0-beta.5",
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.3",
33
+ "@nx/devkit": "22.1.0-beta.5",
34
34
  "@phenomnomnominal/tsquery": "~5.0.1",
35
35
  "enquirer": "~2.3.6",
36
- "@nx/js": "22.1.0-beta.3",
36
+ "@nx/js": "22.1.0-beta.5",
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.3"
44
+ "nx": "22.1.0-beta.5"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -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,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"}
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;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"}
@@ -138,7 +138,7 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
138
138
  [groupName]: targetGroup,
139
139
  },
140
140
  };
141
- const projectRootRelativeTestPaths = await getTestPathsRelativeToProjectRoot(projectRoot);
141
+ const projectRootRelativeTestPaths = await getTestPathsRelativeToProjectRoot(projectRoot, context.workspaceRoot);
142
142
  for (const relativePath of projectRootRelativeTestPaths) {
143
143
  if (relativePath.includes('../')) {
144
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' +
@@ -462,14 +462,17 @@ function checkIfConfigFileShouldBeProject(projectRoot, context) {
462
462
  }
463
463
  return true;
464
464
  }
465
- async function getTestPathsRelativeToProjectRoot(projectRoot) {
466
- const fullProjectRoot = (0, node_path_1.join)(devkit_1.workspaceRoot, projectRoot);
465
+ async function getTestPathsRelativeToProjectRoot(projectRoot, workspaceRoot) {
466
+ const fullProjectRoot = (0, node_path_1.join)(workspaceRoot, projectRoot);
467
467
  const { createVitest } = await Promise.resolve().then(() => require('vitest/node'));
468
468
  const vitest = await createVitest('test', {
469
+ root: fullProjectRoot,
469
470
  dir: fullProjectRoot,
470
471
  filesOnly: true,
471
472
  watch: false,
472
473
  });
473
474
  const relevantTestSpecifications = await vitest.getRelevantTestSpecifications();
474
- return relevantTestSpecifications.map((ts) => (0, node_path_1.relative)(projectRoot, ts.moduleId));
475
+ return relevantTestSpecifications
476
+ .filter((ts) => projectRoot === '.' ? true : ts.moduleId.startsWith(fullProjectRoot))
477
+ .map((ts) => (0, node_path_1.relative)(projectRoot, ts.moduleId));
475
478
  }