vitest-auto-spy 5.54.0 → 5.55.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/CHANGELOG.md +13 -1
- package/dist/cli.js +36 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,17 @@ The latest released version here must always match the one published on
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [5.55.0] - 2026-09-30
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **`perf-import` no longer names a barrel the spec cannot avoid.** A spec whose other imports —
|
|
18
|
+
usually its subject — already load the same barrel is skipped, since importing the module directly
|
|
19
|
+
would leave the graph as it is. So is a barrel that a non-wildcard tsconfig `paths` alias points at,
|
|
20
|
+
when the spec lives outside the barrel's directory: that is another package's public entry, and in
|
|
21
|
+
an Nx workspace `@nx/enforce-module-boundaries` rejects the relative import that would bypass it.
|
|
22
|
+
On a consumer Nx workspace this took the report from 7 barrel findings to 0.
|
|
23
|
+
|
|
13
24
|
## [5.54.0] - 2026-09-30
|
|
14
25
|
|
|
15
26
|
### Added
|
|
@@ -6673,7 +6684,8 @@ moved under 1 %: `/angular` +192 B (+1.0 %) for the override queue and the HTTP
|
|
|
6673
6684
|
This copy ships with the package and carries 5.x only. Releases before 5.0.0 are in the
|
|
6674
6685
|
[full changelog](https://github.com/ASDAlexey/vitest-auto-spy/blob/master/CHANGELOG.md).
|
|
6675
6686
|
|
|
6676
|
-
[Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.
|
|
6687
|
+
[Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.55.0...HEAD
|
|
6688
|
+
[5.55.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.54.0...v5.55.0
|
|
6677
6689
|
[5.54.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.53.0...v5.54.0
|
|
6678
6690
|
[5.53.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.52.0...v5.53.0
|
|
6679
6691
|
[5.52.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.51.0...v5.52.0
|
package/dist/cli.js
CHANGED
|
@@ -1654,7 +1654,7 @@ function foreignPragmaPass() {
|
|
|
1654
1654
|
}
|
|
1655
1655
|
|
|
1656
1656
|
// src/cli/checks/export-map.generated.ts
|
|
1657
|
-
var EXPORT_MAP_VERSION = "5.
|
|
1657
|
+
var EXPORT_MAP_VERSION = "5.54.0";
|
|
1658
1658
|
var ENTRY_SPECIFIERS = "vitest-auto-spy vitest-auto-spy/bun vitest-auto-spy/bun-angular vitest-auto-spy/node vitest-auto-spy/rstest vitest-auto-spy/rxjs vitest-auto-spy/console vitest-auto-spy/dom-stubs vitest-auto-spy/diagnostics vitest-auto-spy/jasmine vitest-auto-spy/jasmine-compat vitest-auto-spy/observer-spy vitest-auto-spy/angular vitest-auto-spy/angular/diagnostics vitest-auto-spy/angular/doubles vitest-auto-spy/angular/matchers vitest-auto-spy/angular-http vitest-auto-spy/angular-router vitest-auto-spy/signal-forms vitest-auto-spy/nestjs vitest-auto-spy/react vitest-auto-spy/vue vitest-auto-spy/svelte vitest-auto-spy/setup vitest-auto-spy/zone vitest-auto-spy/eslint-plugin vitest-auto-spy/perf-reporter";
|
|
1659
1659
|
var EXPORTED_BY = {
|
|
1660
1660
|
AccessorImplementations: "0 1 2 3 4 12 20 21 22",
|
|
@@ -4614,8 +4614,6 @@ function runNgTest(options, tools, io) {
|
|
|
4614
4614
|
}
|
|
4615
4615
|
return tools.spawn({ command: process.execPath, args: run, cwd: options.cwd, env: {}, shell: false }).status;
|
|
4616
4616
|
}
|
|
4617
|
-
|
|
4618
|
-
// src/cli/checks/barrels.ts
|
|
4619
4617
|
var BARREL_NAME = /(?:^|\/)(?:index|public[_-]api)\.[cm]?[jt]sx?$/;
|
|
4620
4618
|
var RE_EXPORT = /\bexport\s+(?:type\s+)?(?:\*|{[^}]*})[^;]*?\bfrom\s*["'][^"']+["']/g;
|
|
4621
4619
|
var OWN_DECLARATION = /(?:^|\n)\s*export\s+(?:abstract\s+)?(?:default|class|function|const|let|var|enum|namespace|interface|type\s+\w+\s*=)\b/;
|
|
@@ -4625,9 +4623,9 @@ function isBarrel(file, text) {
|
|
|
4625
4623
|
}
|
|
4626
4624
|
return (text.match(RE_EXPORT) ?? []).length >= 2;
|
|
4627
4625
|
}
|
|
4628
|
-
function
|
|
4629
|
-
const seen =
|
|
4630
|
-
const order = [
|
|
4626
|
+
function reachableFrom(starts, graph) {
|
|
4627
|
+
const seen = new Set(starts);
|
|
4628
|
+
const order = [...starts];
|
|
4631
4629
|
for (const current of order) {
|
|
4632
4630
|
for (const edge of graph.imports.get(current) ?? []) {
|
|
4633
4631
|
if (!seen.has(edge)) {
|
|
@@ -4636,9 +4634,33 @@ function reachOf(file, graph) {
|
|
|
4636
4634
|
}
|
|
4637
4635
|
}
|
|
4638
4636
|
}
|
|
4639
|
-
return seen
|
|
4637
|
+
return seen;
|
|
4638
|
+
}
|
|
4639
|
+
function reachOf(file, graph) {
|
|
4640
|
+
return reachableFrom([file], graph).size - 1;
|
|
4641
|
+
}
|
|
4642
|
+
function packageEntries(cwd, files) {
|
|
4643
|
+
const entries = /* @__PURE__ */ new Set();
|
|
4644
|
+
for (const alias of readCompilerPaths2(cwd).aliases) {
|
|
4645
|
+
for (const target of alias.wildcard ? [] : alias.targets) {
|
|
4646
|
+
const resolved = resolveRelative("package.json", `./${target}`, files);
|
|
4647
|
+
if (resolved !== void 0) {
|
|
4648
|
+
entries.add(resolved);
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
}
|
|
4652
|
+
return entries;
|
|
4653
|
+
}
|
|
4654
|
+
function loadedAnyway(barrel, imported, graph) {
|
|
4655
|
+
return reachableFrom(
|
|
4656
|
+
imported.filter((other) => other !== barrel),
|
|
4657
|
+
graph
|
|
4658
|
+
).has(barrel);
|
|
4659
|
+
}
|
|
4660
|
+
function outsidePackage(spec, barrel, entries) {
|
|
4661
|
+
return entries.has(barrel) && !spec.startsWith(`${posix.dirname(barrel)}/`);
|
|
4640
4662
|
}
|
|
4641
|
-
function findBarrelImports(graph) {
|
|
4663
|
+
function findBarrelImports(graph, entries = /* @__PURE__ */ new Set()) {
|
|
4642
4664
|
const barrels = /* @__PURE__ */ new Map();
|
|
4643
4665
|
const found = [];
|
|
4644
4666
|
for (const [file, text] of graph.texts) {
|
|
@@ -4652,7 +4674,7 @@ function findBarrelImports(graph) {
|
|
|
4652
4674
|
}
|
|
4653
4675
|
for (const target of imported) {
|
|
4654
4676
|
const reach = barrels.get(target);
|
|
4655
|
-
if (reach !== void 0) {
|
|
4677
|
+
if (reach !== void 0 && !outsidePackage(spec, target, entries) && !loadedAnyway(target, imported, graph)) {
|
|
4656
4678
|
found.push({ spec, barrel: target, reach });
|
|
4657
4679
|
}
|
|
4658
4680
|
}
|
|
@@ -7072,9 +7094,9 @@ function perfMarkdown(document) {
|
|
|
7072
7094
|
|
|
7073
7095
|
// src/cli/perf.ts
|
|
7074
7096
|
var QUIET_MS = 5e3;
|
|
7075
|
-
function barrelCandidates(graph) {
|
|
7097
|
+
function barrelCandidates(graph, entries) {
|
|
7076
7098
|
const widest = /* @__PURE__ */ new Map();
|
|
7077
|
-
for (const use of findBarrelImports(graph)) {
|
|
7099
|
+
for (const use of findBarrelImports(graph, entries)) {
|
|
7078
7100
|
if (!widest.has(use.spec)) {
|
|
7079
7101
|
widest.set(use.spec, use);
|
|
7080
7102
|
}
|
|
@@ -7084,11 +7106,11 @@ function barrelCandidates(graph) {
|
|
|
7084
7106
|
function importPhase(run) {
|
|
7085
7107
|
return run.files.length > 0 && run.files.every((file) => file.fetch !== void 0) ? "Evaluating imported modules \u2014 the wait for their transforms is counted under `transform` \u2014" : "Importing modules";
|
|
7086
7108
|
}
|
|
7087
|
-
function importFindings(phases, graph, run, context) {
|
|
7109
|
+
function importFindings(phases, graph, profile, run, context) {
|
|
7088
7110
|
if (shareOf(phases, "import") < DOMINATES || context.builder !== void 0) {
|
|
7089
7111
|
return [];
|
|
7090
7112
|
}
|
|
7091
|
-
const ranked = barrelCandidates(graph);
|
|
7113
|
+
const ranked = barrelCandidates(graph, packageEntries(profile.cwd, new Set(profile.files)));
|
|
7092
7114
|
if (ranked.length === 0) {
|
|
7093
7115
|
return [];
|
|
7094
7116
|
}
|
|
@@ -7129,7 +7151,7 @@ function analysePerf(run, profile, failOnFlaky = false, context = perfContext(pr
|
|
|
7129
7151
|
...environmentFindings(phases, profile, graph, measured),
|
|
7130
7152
|
...domEngineFindings(phases, graph, run, context),
|
|
7131
7153
|
...transformFindings(phases, graph, run, context),
|
|
7132
|
-
...importFindings(phases, graph, run, context),
|
|
7154
|
+
...importFindings(phases, graph, profile, run, context),
|
|
7133
7155
|
...isolationFindings(phases, graph, profile, run, void 0, context),
|
|
7134
7156
|
...poolFindings(phases, graph, run, context),
|
|
7135
7157
|
...workerFindings(total, graph, run, void 0, context)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-auto-spy",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.55.0",
|
|
4
4
|
"description": "Auto-generate fully-typed test spies from a class — across Vitest, Bun, node:test and Rstest, with Angular/NestJS/React/Vue/Svelte recipes. Drop-in replacement for jest-auto-spies and jasmine-auto-spies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto-mock",
|