@hublo/sentinel 1.7.0-alpha.2 → 1.7.0-alpha.20
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/README.md +2 -0
- package/dist/bin/sentinel.js +46 -113
- package/dist/{chunk-Z3JI7ZWX.js → chunk-AVT5FSPO.js} +232 -195
- package/dist/{chunk-EETHWJBF.js → chunk-B3Y7F7BA.js} +3533 -1074
- package/dist/{chunk-DLGBRLUU.js → chunk-EESVRILJ.js} +3 -16
- package/dist/chunk-EESVRILJ.js.map +1 -0
- package/dist/{chunk-ZNANJEMK.js → chunk-JT7ZMH44.js} +30 -16
- package/dist/chunk-JT7ZMH44.js.map +1 -0
- package/dist/{chunk-THTXP2QU.js → chunk-LX7EG6PJ.js} +5 -6
- package/dist/chunk-LX7EG6PJ.js.map +1 -0
- package/dist/chunk-NGLEGAEN.js +190 -0
- package/dist/chunk-NGLEGAEN.js.map +1 -0
- package/dist/{chunk-4YQXLPJ5.js → chunk-PMRL4MH6.js} +2 -2
- package/dist/chunk-PXTU5MPW.js +9 -0
- package/dist/chunk-PXTU5MPW.js.map +1 -0
- package/dist/{chunk-LNFGVGLE.js → chunk-SWWQ7X7B.js} +11 -23
- package/dist/{chunk-LNFGVGLE.js.map → chunk-SWWQ7X7B.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/roles/build/nest/toolchain.d.ts +1 -1
- package/dist/roles/build/nest/toolchain.js +2 -6
- package/dist/roles/build/nest/toolchain.js.map +1 -1
- package/dist/roles/sql/config.d.ts +68 -0
- package/dist/roles/sql/config.js +8 -0
- package/dist/roles/sql/config.js.map +1 -0
- package/dist/roles/static-analysis/config.js +2 -1
- package/dist/roles/test/nest/toolchain.d.ts +1 -1
- package/dist/roles/test/nest/toolchain.js +2 -3
- package/dist/roles/test/nest/toolchain.js.map +1 -1
- package/dist/roles/test/react/toolchain.js +2 -3
- package/dist/roles/test/react/toolchain.js.map +1 -1
- package/dist/roles/test/setup/jest-parity.js +2 -2
- package/dist/roles/test/setup/workspace-entry.js +2 -2
- package/dist/roles/test/shared-test-config.d.ts +1 -1
- package/dist/roles/test/shared-test-config.js +2 -3
- package/dist/tsconfig/nest.json +1 -10
- package/dist/tsconfig/node.json +1 -11
- package/dist/tsconfig/react.json +0 -3
- package/dist/{tsconfig-aliases-C_PxuZni.d.ts → tsconfig-aliases-Ce6axdJ4.d.ts} +2 -17
- package/dist/{validate-LRHF63AW.js → validate-B5567Z7X.js} +2 -4
- package/docs/build-adoption.md +0 -7
- package/docs/sql-adoption.md +552 -0
- package/docs/static-analysis-adoption.md +1 -1
- package/docs/test-adoption.md +1 -8
- package/docs/typescript-adoption.md +13 -52
- package/docs/typescript-traces.md +217 -3
- package/docs/using-sentinel.md +2 -1
- package/package.json +6 -4
- package/dist/chunk-4UUL4SEW.js +0 -50
- package/dist/chunk-DLGBRLUU.js.map +0 -1
- package/dist/chunk-H4HAFJFZ.js +0 -79
- package/dist/chunk-H4HAFJFZ.js.map +0 -1
- package/dist/chunk-THTXP2QU.js.map +0 -1
- package/dist/chunk-ZNANJEMK.js.map +0 -1
- package/dist/migrate-NI33SXZD.js +0 -517
- package/dist/tsconfig/legacy.json +0 -21
- /package/dist/{chunk-4YQXLPJ5.js.map → chunk-PMRL4MH6.js.map} +0 -0
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
binFromOwnInstall,
|
|
3
|
-
binSearchPath,
|
|
4
|
-
resolveBin
|
|
5
|
-
} from "./chunk-4UUL4SEW.js";
|
|
6
1
|
import {
|
|
7
2
|
DEFAULT_MAX_DIAGNOSTICS,
|
|
8
3
|
WORKSPACE_ROOT_MARKER,
|
|
@@ -11,15 +6,10 @@ import {
|
|
|
11
6
|
readNxProjectName,
|
|
12
7
|
readOwnPackage,
|
|
13
8
|
readProjectPackageJson
|
|
14
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JT7ZMH44.js";
|
|
15
10
|
import {
|
|
16
11
|
matchesTsconfigPattern
|
|
17
12
|
} from "./chunk-O7REVMOC.js";
|
|
18
|
-
import {
|
|
19
|
-
WORKSPACE_TSCONFIG,
|
|
20
|
-
chainPaths,
|
|
21
|
-
effectivePaths
|
|
22
|
-
} from "./chunk-H4HAFJFZ.js";
|
|
23
13
|
import {
|
|
24
14
|
parseJsonc
|
|
25
15
|
} from "./chunk-QXFCZON7.js";
|
|
@@ -408,9 +398,53 @@ function moduleEnvironment(cwd) {
|
|
|
408
398
|
// src/roles/test/reference.ts
|
|
409
399
|
import { execFileSync } from "node:child_process";
|
|
410
400
|
import { createHash } from "node:crypto";
|
|
411
|
-
import { existsSync as
|
|
401
|
+
import { existsSync as existsSync6, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, writeFileSync } from "node:fs";
|
|
412
402
|
import { tmpdir } from "node:os";
|
|
413
|
-
import { join as
|
|
403
|
+
import { join as join6, resolve as resolve2 } from "node:path";
|
|
404
|
+
|
|
405
|
+
// src/shared/resolve-bin.ts
|
|
406
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
407
|
+
import { createRequire } from "node:module";
|
|
408
|
+
import { delimiter, dirname, join as join5 } from "node:path";
|
|
409
|
+
var require2 = createRequire(import.meta.url);
|
|
410
|
+
function resolveBin(fromDir, name) {
|
|
411
|
+
let dir = fromDir;
|
|
412
|
+
for (; ; ) {
|
|
413
|
+
const candidate = join5(dir, "node_modules", ".bin", name);
|
|
414
|
+
if (existsSync5(candidate)) return candidate;
|
|
415
|
+
const parent = dirname(dir);
|
|
416
|
+
if (parent === dir) return void 0;
|
|
417
|
+
dir = parent;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function binFromOwnInstall(packageName, binName) {
|
|
421
|
+
try {
|
|
422
|
+
const manifest = require2.resolve(`${packageName}/package.json`);
|
|
423
|
+
const bin = require2(manifest).bin;
|
|
424
|
+
const relative8 = typeof bin === "string" ? bin : bin?.[binName];
|
|
425
|
+
if (!relative8) return void 0;
|
|
426
|
+
const executable = join5(dirname(manifest), relative8);
|
|
427
|
+
return existsSync5(executable) ? executable : void 0;
|
|
428
|
+
} catch {
|
|
429
|
+
return void 0;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function binSearchPath(cwd) {
|
|
433
|
+
return [`${cwd}${delimiter}node_modules/.bin (and parents)`, "sentinel's own install"].join(
|
|
434
|
+
" then "
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
function scriptPath(cwd, path) {
|
|
438
|
+
const bins = [];
|
|
439
|
+
let dir = cwd;
|
|
440
|
+
for (; ; ) {
|
|
441
|
+
bins.push(join5(dir, "node_modules", ".bin"));
|
|
442
|
+
const parent = dirname(dir);
|
|
443
|
+
if (parent === dir) break;
|
|
444
|
+
dir = parent;
|
|
445
|
+
}
|
|
446
|
+
return [...bins, path].filter(Boolean).join(delimiter);
|
|
447
|
+
}
|
|
414
448
|
|
|
415
449
|
// src/roles/test/baseline.ts
|
|
416
450
|
function readSnapshot(report) {
|
|
@@ -678,7 +712,7 @@ function describeComparison(comparison) {
|
|
|
678
712
|
// src/roles/test/reference.ts
|
|
679
713
|
function referencePath(cwd, suite) {
|
|
680
714
|
const key = createHash("sha256").update(`${resolve2(cwd)}\0${suite}`).digest("hex").slice(0, 16);
|
|
681
|
-
return
|
|
715
|
+
return join6(tmpdir(), "sentinel-test-reference", `${key}.json`);
|
|
682
716
|
}
|
|
683
717
|
function suiteOf(config) {
|
|
684
718
|
const base = config.replace(/^(jest|vitest)\./, "").replace(/\.[cm]?[jt]s$/, "");
|
|
@@ -689,9 +723,9 @@ function runJest(cwd, config) {
|
|
|
689
723
|
const bin = resolveBin(cwd, "jest");
|
|
690
724
|
if (bin === void 0) return void 0;
|
|
691
725
|
const root = findWorkspaceRoot(cwd) ?? cwd;
|
|
692
|
-
const out =
|
|
726
|
+
const out = join6(mkdtempSync(join6(tmpdir(), "sentinel-reference-")), "jest.json");
|
|
693
727
|
try {
|
|
694
|
-
execFileSync(bin, ["-c",
|
|
728
|
+
execFileSync(bin, ["-c", join6(cwd, config), "--json", `--outputFile=${out}`, "--silent"], {
|
|
695
729
|
cwd: root,
|
|
696
730
|
/*
|
|
697
731
|
* ⚠️ The module's environment, not the shell's, and this is what made the reference lie.
|
|
@@ -706,7 +740,7 @@ function runJest(cwd, config) {
|
|
|
706
740
|
});
|
|
707
741
|
} catch {
|
|
708
742
|
}
|
|
709
|
-
if (!
|
|
743
|
+
if (!existsSync6(out)) return void 0;
|
|
710
744
|
try {
|
|
711
745
|
return JSON.parse(readFileSync5(out, "utf8"));
|
|
712
746
|
} catch {
|
|
@@ -739,7 +773,7 @@ function captureReference(cwd, config) {
|
|
|
739
773
|
snapshot
|
|
740
774
|
};
|
|
741
775
|
const path = referencePath(cwd, suiteOf(config));
|
|
742
|
-
mkdirSync(
|
|
776
|
+
mkdirSync(join6(path, ".."), { recursive: true });
|
|
743
777
|
writeFileSync(path, `${JSON.stringify(stored, void 0, 2)}
|
|
744
778
|
`);
|
|
745
779
|
return {
|
|
@@ -748,7 +782,7 @@ function captureReference(cwd, config) {
|
|
|
748
782
|
};
|
|
749
783
|
}
|
|
750
784
|
function hasReference(cwd, suite) {
|
|
751
|
-
return
|
|
785
|
+
return existsSync6(referencePath(cwd, suite));
|
|
752
786
|
}
|
|
753
787
|
function compareAgainstReference(cwd, suite, report) {
|
|
754
788
|
const path = referencePath(cwd, suite);
|
|
@@ -778,9 +812,9 @@ function resolveVitest(cwd) {
|
|
|
778
812
|
|
|
779
813
|
// src/roles/test/adapters/vitest/vitest.adapter.ts
|
|
780
814
|
import { spawnSync } from "node:child_process";
|
|
781
|
-
import { existsSync as
|
|
815
|
+
import { existsSync as existsSync25, mkdtempSync as mkdtempSync3, readFileSync as readFileSync26, writeFileSync as writeFileSync2 } from "node:fs";
|
|
782
816
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
783
|
-
import { isAbsolute as isAbsolute2, join as
|
|
817
|
+
import { isAbsolute as isAbsolute2, join as join32, relative as relative7, resolve as resolve10 } from "node:path";
|
|
784
818
|
|
|
785
819
|
// src/roles/test/ordering-is-a-permutation.ts
|
|
786
820
|
function isAnImport(line) {
|
|
@@ -805,15 +839,15 @@ function lineLostByTheFixer(before, after) {
|
|
|
805
839
|
}
|
|
806
840
|
|
|
807
841
|
// src/core/config/nx-target.ts
|
|
808
|
-
import { existsSync as
|
|
809
|
-
import { join as
|
|
842
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
843
|
+
import { join as join8 } from "node:path";
|
|
810
844
|
|
|
811
845
|
// src/core/config/project-json.ts
|
|
812
|
-
import { existsSync as
|
|
813
|
-
import { join as
|
|
846
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
847
|
+
import { join as join7 } from "node:path";
|
|
814
848
|
function projectTargets(cwd) {
|
|
815
|
-
const path =
|
|
816
|
-
if (!
|
|
849
|
+
const path = join7(cwd, "project.json");
|
|
850
|
+
if (!existsSync7(path)) return void 0;
|
|
817
851
|
try {
|
|
818
852
|
return JSON.parse(readFileSync6(path, "utf8")).targets;
|
|
819
853
|
} catch {
|
|
@@ -866,7 +900,7 @@ function nxTargetOperations(options) {
|
|
|
866
900
|
if (names.length === 0) return [];
|
|
867
901
|
const targets = withTeamInputs(cwd, options.targets);
|
|
868
902
|
const operations = [];
|
|
869
|
-
if (
|
|
903
|
+
if (existsSync8(join8(cwd, "project.json"))) {
|
|
870
904
|
operations.push({
|
|
871
905
|
kind: "remove-json-keys",
|
|
872
906
|
path: "project.json",
|
|
@@ -970,24 +1004,24 @@ function rewriteToolchainImports(toolchain, source, fileName) {
|
|
|
970
1004
|
}
|
|
971
1005
|
|
|
972
1006
|
// src/roles/test/jest-migration.ts
|
|
973
|
-
import { existsSync as
|
|
974
|
-
import { createRequire as
|
|
975
|
-
import { dirname as
|
|
1007
|
+
import { existsSync as existsSync19, readFileSync as readFileSync21, readdirSync as readdirSync6 } from "node:fs";
|
|
1008
|
+
import { createRequire as createRequire5 } from "node:module";
|
|
1009
|
+
import { dirname as dirname12, join as join25, relative as relative6 } from "node:path";
|
|
976
1010
|
|
|
977
1011
|
// src/roles/test/codemod/migrate-module.ts
|
|
978
|
-
import { readdirSync as readdirSync4, readFileSync as
|
|
979
|
-
import { join as
|
|
1012
|
+
import { readdirSync as readdirSync4, readFileSync as readFileSync16, statSync as statSync5 } from "node:fs";
|
|
1013
|
+
import { join as join18 } from "node:path";
|
|
980
1014
|
import { parseSync as parseSync9 } from "oxc-parser";
|
|
981
1015
|
|
|
982
1016
|
// src/roles/test/msw-lifecycle.ts
|
|
983
|
-
import { existsSync as
|
|
984
|
-
import { join as
|
|
1017
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
|
|
1018
|
+
import { join as join9 } from "node:path";
|
|
985
1019
|
var ROOT_SETUP = "jest.setup.after.env.js";
|
|
986
1020
|
function ownsMswLifecycle(cwd, setupFiles) {
|
|
987
1021
|
for (const raw of setupFiles) {
|
|
988
1022
|
if (raw.endsWith(ROOT_SETUP)) continue;
|
|
989
|
-
const file =
|
|
990
|
-
if (!
|
|
1023
|
+
const file = join9(cwd, raw.replaceAll("<rootDir>/", "").replaceAll("<rootDir>", "."));
|
|
1024
|
+
if (!existsSync9(file)) continue;
|
|
991
1025
|
try {
|
|
992
1026
|
if (/\.listen\s*\(/.test(readFileSync7(file, "utf8"))) return true;
|
|
993
1027
|
} catch {
|
|
@@ -1009,7 +1043,7 @@ function vitestSupportName(relative8) {
|
|
|
1009
1043
|
}
|
|
1010
1044
|
|
|
1011
1045
|
// src/roles/test/codemod/inherited-automocks.ts
|
|
1012
|
-
import { existsSync as
|
|
1046
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
|
|
1013
1047
|
import { resolve as resolve3 } from "node:path";
|
|
1014
1048
|
|
|
1015
1049
|
// src/shared/ast.ts
|
|
@@ -1053,7 +1087,7 @@ function inheritedAutomocks(cwd, setupFiles, parse6) {
|
|
|
1053
1087
|
for (const named of setupFiles) {
|
|
1054
1088
|
const path = resolve3(cwd, named.replace("<rootDir>/", "./"));
|
|
1055
1089
|
if (path.startsWith(`${cwd}/`)) continue;
|
|
1056
|
-
if (!
|
|
1090
|
+
if (!existsSync10(path)) continue;
|
|
1057
1091
|
let source;
|
|
1058
1092
|
try {
|
|
1059
1093
|
source = readFileSync8(path, "utf8");
|
|
@@ -1322,7 +1356,7 @@ ${source}`;
|
|
|
1322
1356
|
}
|
|
1323
1357
|
|
|
1324
1358
|
// src/roles/test/codemod/migrate-file.ts
|
|
1325
|
-
import { dirname as
|
|
1359
|
+
import { dirname as dirname8 } from "node:path";
|
|
1326
1360
|
import { parseSync as parseSync8 } from "oxc-parser";
|
|
1327
1361
|
|
|
1328
1362
|
// src/roles/test/codemod/edits.ts
|
|
@@ -2108,9 +2142,9 @@ function asyncifyEdits(source, fn) {
|
|
|
2108
2142
|
}
|
|
2109
2143
|
|
|
2110
2144
|
// src/roles/test/codemod/named-rules.ts
|
|
2111
|
-
import { existsSync as
|
|
2112
|
-
import { createRequire } from "node:module";
|
|
2113
|
-
import { dirname as
|
|
2145
|
+
import { existsSync as existsSync11, readFileSync as readFileSync10 } from "node:fs";
|
|
2146
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
2147
|
+
import { dirname as dirname3, join as join11 } from "node:path";
|
|
2114
2148
|
|
|
2115
2149
|
// src/roles/test/codemod/namespace-import.ts
|
|
2116
2150
|
function sameModule(specifier) {
|
|
@@ -2180,7 +2214,7 @@ function namespaceBindings(program) {
|
|
|
2180
2214
|
|
|
2181
2215
|
// src/roles/test/codemod/static-import-for-require.ts
|
|
2182
2216
|
import { readFileSync as readFileSync9, statSync } from "node:fs";
|
|
2183
|
-
import { dirname, join as
|
|
2217
|
+
import { dirname as dirname2, join as join10, resolve as resolve4 } from "node:path";
|
|
2184
2218
|
import { parseSync as parseSync4 } from "oxc-parser";
|
|
2185
2219
|
|
|
2186
2220
|
// src/shared/module-resolution.ts
|
|
@@ -2197,11 +2231,11 @@ var RESOLVABLE_EXTENSIONS = [
|
|
|
2197
2231
|
|
|
2198
2232
|
// src/roles/test/codemod/static-import-for-require.ts
|
|
2199
2233
|
function resolveRelative(fromFile, specifier) {
|
|
2200
|
-
const base = resolve4(
|
|
2234
|
+
const base = resolve4(dirname2(fromFile), specifier);
|
|
2201
2235
|
const candidates = [
|
|
2202
2236
|
base,
|
|
2203
2237
|
...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
|
|
2204
|
-
...RESOLVABLE_EXTENSIONS.map((extension) =>
|
|
2238
|
+
...RESOLVABLE_EXTENSIONS.map((extension) => join10(base, `index${extension}`))
|
|
2205
2239
|
];
|
|
2206
2240
|
for (const candidate of candidates) {
|
|
2207
2241
|
try {
|
|
@@ -2403,24 +2437,24 @@ function isCommonJsPackage(fromFile, specifier) {
|
|
|
2403
2437
|
if (specifier.startsWith(".") || specifier.startsWith("/")) return false;
|
|
2404
2438
|
let resolved;
|
|
2405
2439
|
try {
|
|
2406
|
-
resolved =
|
|
2440
|
+
resolved = createRequire2(fromFile).resolve(specifier);
|
|
2407
2441
|
} catch {
|
|
2408
2442
|
return false;
|
|
2409
2443
|
}
|
|
2410
2444
|
if (!resolved.includes(`${"/"}node_modules${"/"}`)) return false;
|
|
2411
2445
|
if (resolved.endsWith(".mjs")) return false;
|
|
2412
2446
|
if (resolved.endsWith(".cjs")) return true;
|
|
2413
|
-
let dir =
|
|
2447
|
+
let dir = dirname3(resolved);
|
|
2414
2448
|
for (let depth = 0; depth < 12; depth += 1) {
|
|
2415
|
-
const manifest =
|
|
2416
|
-
if (
|
|
2449
|
+
const manifest = join11(dir, "package.json");
|
|
2450
|
+
if (existsSync11(manifest)) {
|
|
2417
2451
|
try {
|
|
2418
2452
|
return JSON.parse(readFileSync10(manifest, "utf8")).type !== "module";
|
|
2419
2453
|
} catch {
|
|
2420
2454
|
return false;
|
|
2421
2455
|
}
|
|
2422
2456
|
}
|
|
2423
|
-
const parent =
|
|
2457
|
+
const parent = dirname3(dir);
|
|
2424
2458
|
if (parent === dir) break;
|
|
2425
2459
|
dir = parent;
|
|
2426
2460
|
}
|
|
@@ -3291,8 +3325,8 @@ function propagateAwait(fileName, source, original, elsewhere = /* @__PURE__ */
|
|
|
3291
3325
|
|
|
3292
3326
|
// src/roles/test/codemod/reexport-barrel-mock.ts
|
|
3293
3327
|
import { readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
3294
|
-
import { createRequire as
|
|
3295
|
-
import { dirname as
|
|
3328
|
+
import { createRequire as createRequire3 } from "node:module";
|
|
3329
|
+
import { dirname as dirname4, join as join12 } from "node:path";
|
|
3296
3330
|
var PACKAGE_SUBPATH = /^(@[^/]+\/[^/]+|[^@.][^/]*)\/(.+)$/;
|
|
3297
3331
|
var PURE_REEXPORT = /^module\.exports\s*=\s*require\(\s*(['"])([^'"]+)\1\s*\)\s*;?$/;
|
|
3298
3332
|
function mockCalls(program) {
|
|
@@ -3320,14 +3354,14 @@ function mockCalls(program) {
|
|
|
3320
3354
|
}
|
|
3321
3355
|
function packageRoot(fromFile, name) {
|
|
3322
3356
|
try {
|
|
3323
|
-
return
|
|
3357
|
+
return dirname4(createRequire3(fromFile).resolve(`${name}/package.json`));
|
|
3324
3358
|
} catch {
|
|
3325
3359
|
return void 0;
|
|
3326
3360
|
}
|
|
3327
3361
|
}
|
|
3328
3362
|
function resolveFrom(fromFile, specifier) {
|
|
3329
3363
|
try {
|
|
3330
|
-
return
|
|
3364
|
+
return createRequire3(fromFile).resolve(specifier);
|
|
3331
3365
|
} catch {
|
|
3332
3366
|
return void 0;
|
|
3333
3367
|
}
|
|
@@ -3344,7 +3378,7 @@ function barrelsFor(fromFile, name, target) {
|
|
|
3344
3378
|
const aliases = [];
|
|
3345
3379
|
for (const entry of entries) {
|
|
3346
3380
|
if (!entry.endsWith(".js")) continue;
|
|
3347
|
-
const path =
|
|
3381
|
+
const path = join12(root, entry);
|
|
3348
3382
|
let body;
|
|
3349
3383
|
try {
|
|
3350
3384
|
if (!statSync2(path).isFile()) continue;
|
|
@@ -3447,17 +3481,17 @@ function rewriteRunnerArtefactNames(source, program) {
|
|
|
3447
3481
|
}
|
|
3448
3482
|
|
|
3449
3483
|
// src/roles/test/codemod/setup-static-imports.ts
|
|
3450
|
-
import { dirname as
|
|
3484
|
+
import { dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
3451
3485
|
|
|
3452
3486
|
// src/core/context.ts
|
|
3453
|
-
import { existsSync as
|
|
3454
|
-
import { dirname as
|
|
3487
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
3488
|
+
import { dirname as dirname5, join as join14, resolve as resolve5 } from "node:path";
|
|
3455
3489
|
|
|
3456
3490
|
// src/core/discover-modules.ts
|
|
3457
3491
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3458
3492
|
import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync12, rmSync as rmSync2 } from "node:fs";
|
|
3459
3493
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
3460
|
-
import { join as
|
|
3494
|
+
import { join as join13 } from "node:path";
|
|
3461
3495
|
function runNx(cwd, args) {
|
|
3462
3496
|
const nx = resolveBin(cwd, "nx") ?? "nx";
|
|
3463
3497
|
try {
|
|
@@ -3475,8 +3509,8 @@ function runNx(cwd, args) {
|
|
|
3475
3509
|
}
|
|
3476
3510
|
}
|
|
3477
3511
|
function readGraph(cwd) {
|
|
3478
|
-
const dir = mkdtempSync2(
|
|
3479
|
-
const file =
|
|
3512
|
+
const dir = mkdtempSync2(join13(tmpdir2(), "sentinel-nx-"));
|
|
3513
|
+
const file = join13(dir, "graph.json");
|
|
3480
3514
|
try {
|
|
3481
3515
|
runNx(cwd, ["graph", "--file", file]);
|
|
3482
3516
|
const parsed = JSON.parse(readFileSync12(file, "utf8"));
|
|
@@ -3488,7 +3522,7 @@ function readGraph(cwd) {
|
|
|
3488
3522
|
}
|
|
3489
3523
|
return Object.entries(nodes).map(([name, node]) => ({
|
|
3490
3524
|
name,
|
|
3491
|
-
root:
|
|
3525
|
+
root: join13(cwd, node.data.root)
|
|
3492
3526
|
}));
|
|
3493
3527
|
} finally {
|
|
3494
3528
|
rmSync2(dir, { recursive: true, force: true });
|
|
@@ -3529,20 +3563,20 @@ ${raw.slice(0, 300)}`
|
|
|
3529
3563
|
// src/core/context.ts
|
|
3530
3564
|
var MODULE_MARKERS = ["package.json", "project.json"];
|
|
3531
3565
|
function isModuleDir(cwd) {
|
|
3532
|
-
return MODULE_MARKERS.some((marker) =>
|
|
3566
|
+
return MODULE_MARKERS.some((marker) => existsSync12(join14(cwd, marker)));
|
|
3533
3567
|
}
|
|
3534
3568
|
function findModuleRoot(startDir, workspaceRoot) {
|
|
3535
3569
|
let dir = resolve5(startDir);
|
|
3536
3570
|
for (; ; ) {
|
|
3537
3571
|
if (workspaceRoot !== void 0 && dir === resolve5(workspaceRoot)) return void 0;
|
|
3538
3572
|
if (isModuleDir(dir)) return dir;
|
|
3539
|
-
const parent =
|
|
3573
|
+
const parent = dirname5(dir);
|
|
3540
3574
|
if (parent === dir) return void 0;
|
|
3541
3575
|
dir = parent;
|
|
3542
3576
|
}
|
|
3543
3577
|
}
|
|
3544
3578
|
function resolveContext(cwd, opts) {
|
|
3545
|
-
const atRoot =
|
|
3579
|
+
const atRoot = existsSync12(join14(cwd, WORKSPACE_ROOT_MARKER));
|
|
3546
3580
|
if (!atRoot && isModuleDir(cwd)) {
|
|
3547
3581
|
if (opts.module) {
|
|
3548
3582
|
throw new Error(
|
|
@@ -3570,40 +3604,37 @@ function resolveContext(cwd, opts) {
|
|
|
3570
3604
|
}
|
|
3571
3605
|
|
|
3572
3606
|
// src/roles/test/codemod/workspace-specifier.ts
|
|
3573
|
-
import { existsSync as
|
|
3574
|
-
import { join as
|
|
3607
|
+
import { existsSync as existsSync13, readFileSync as readFileSync13 } from "node:fs";
|
|
3608
|
+
import { join as join15, relative as relative2, resolve as resolve6 } from "node:path";
|
|
3575
3609
|
var EXTENSIONS = ["", ".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", "/index.ts", "/index.js"];
|
|
3576
|
-
|
|
3577
|
-
|
|
3610
|
+
function pathEntries(workspaceRoot) {
|
|
3611
|
+
const file = join15(workspaceRoot, "tsconfig.base.json");
|
|
3612
|
+
if (!existsSync13(file)) return [];
|
|
3613
|
+
let paths;
|
|
3578
3614
|
try {
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
return found && { ...found, fromWorkspaceFallback: false };
|
|
3615
|
+
paths = parseJsonc(
|
|
3616
|
+
readFileSync13(file, "utf8"),
|
|
3617
|
+
"tsconfig.base.json"
|
|
3618
|
+
)?.compilerOptions?.paths;
|
|
3584
3619
|
} catch {
|
|
3585
|
-
return
|
|
3620
|
+
return [];
|
|
3586
3621
|
}
|
|
3587
|
-
}
|
|
3588
|
-
function pathEntries(workspaceRoot, moduleRoot) {
|
|
3589
|
-
const found = pathsFor(workspaceRoot, moduleRoot);
|
|
3590
|
-
if (found === void 0) return [];
|
|
3591
3622
|
const entries = [];
|
|
3592
|
-
for (const [key, targets] of Object.entries(
|
|
3623
|
+
for (const [key, targets] of Object.entries(paths ?? {})) {
|
|
3593
3624
|
const target = targets[0];
|
|
3594
3625
|
if (target === void 0) continue;
|
|
3595
3626
|
const wildcard = key.endsWith("/*") && target.endsWith("/*");
|
|
3596
3627
|
entries.push({
|
|
3597
3628
|
key: wildcard ? key.slice(0, -2) : key,
|
|
3598
|
-
target: resolve6(
|
|
3629
|
+
target: resolve6(workspaceRoot, wildcard ? target.slice(0, -2) : target),
|
|
3599
3630
|
wildcard
|
|
3600
3631
|
});
|
|
3601
3632
|
}
|
|
3602
3633
|
return entries.sort((left, right) => right.target.length - left.target.length);
|
|
3603
3634
|
}
|
|
3604
|
-
function workspaceSpecifier(workspaceRoot, file
|
|
3635
|
+
function workspaceSpecifier(workspaceRoot, file) {
|
|
3605
3636
|
const absolute = resolve6(file);
|
|
3606
|
-
for (const entry of pathEntries(workspaceRoot
|
|
3637
|
+
for (const entry of pathEntries(workspaceRoot)) {
|
|
3607
3638
|
if (!entry.wildcard) {
|
|
3608
3639
|
if (EXTENSIONS.some((extension) => `${entry.target}${extension}` === absolute)) {
|
|
3609
3640
|
return entry.key;
|
|
@@ -3631,12 +3662,12 @@ function requireCall(source, node) {
|
|
|
3631
3662
|
}
|
|
3632
3663
|
function importable(written, fileName, workspaceRoot) {
|
|
3633
3664
|
if (!written.startsWith(".")) return written;
|
|
3634
|
-
const fileDir =
|
|
3665
|
+
const fileDir = dirname6(fileName);
|
|
3635
3666
|
const moduleRoot = findModuleRoot(fileDir, workspaceRoot) ?? fileDir;
|
|
3636
3667
|
const target = resolve7(fileDir, written);
|
|
3637
3668
|
if (target.startsWith(`${moduleRoot}/`)) return written;
|
|
3638
3669
|
if (workspaceRoot === void 0) return void 0;
|
|
3639
|
-
return workspaceSpecifier(workspaceRoot, target
|
|
3670
|
+
return workspaceSpecifier(workspaceRoot, target);
|
|
3640
3671
|
}
|
|
3641
3672
|
function statement(fileName, source, node, specifier, written) {
|
|
3642
3673
|
if (node.type === "ExpressionStatement") return `import '${specifier}'`;
|
|
@@ -3747,16 +3778,16 @@ function rewriteMockFactoryGenerics(source, program) {
|
|
|
3747
3778
|
}
|
|
3748
3779
|
|
|
3749
3780
|
// src/roles/test/codemod/spy-on-internal-call.ts
|
|
3750
|
-
import { readFileSync as
|
|
3751
|
-
import { dirname as
|
|
3781
|
+
import { readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
|
|
3782
|
+
import { dirname as dirname7, join as join16, relative as relative3, resolve as resolve8 } from "node:path";
|
|
3752
3783
|
import { parseSync as parseSync7 } from "oxc-parser";
|
|
3753
3784
|
function resolveRelative2(fromFile, specifier) {
|
|
3754
3785
|
if (!specifier.startsWith(".")) return void 0;
|
|
3755
|
-
const base = resolve8(
|
|
3786
|
+
const base = resolve8(dirname7(fromFile), specifier);
|
|
3756
3787
|
const candidates = [
|
|
3757
3788
|
base,
|
|
3758
3789
|
...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
|
|
3759
|
-
...RESOLVABLE_EXTENSIONS.map((extension) =>
|
|
3790
|
+
...RESOLVABLE_EXTENSIONS.map((extension) => join16(base, `index${extension}`))
|
|
3760
3791
|
];
|
|
3761
3792
|
for (const candidate of candidates) {
|
|
3762
3793
|
try {
|
|
@@ -3768,7 +3799,7 @@ function resolveRelative2(fromFile, specifier) {
|
|
|
3768
3799
|
}
|
|
3769
3800
|
function read(path) {
|
|
3770
3801
|
try {
|
|
3771
|
-
return
|
|
3802
|
+
return readFileSync14(path, "utf8");
|
|
3772
3803
|
} catch {
|
|
3773
3804
|
return void 0;
|
|
3774
3805
|
}
|
|
@@ -3889,7 +3920,7 @@ function importOf(program, local) {
|
|
|
3889
3920
|
return void 0;
|
|
3890
3921
|
}
|
|
3891
3922
|
function respell(fromFile, target) {
|
|
3892
|
-
const path = relative3(
|
|
3923
|
+
const path = relative3(dirname7(fromFile), target).replaceAll("\\", "/").replace(/\.(?:m|c)?[jt]sx?$/, "").replace(/\/index$/, "");
|
|
3893
3924
|
return path.startsWith(".") ? path : `./${path}`;
|
|
3894
3925
|
}
|
|
3895
3926
|
function namesInUse2(program) {
|
|
@@ -4202,7 +4233,7 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
|
|
|
4202
4233
|
fileName,
|
|
4203
4234
|
source,
|
|
4204
4235
|
beforeStatic,
|
|
4205
|
-
findWorkspaceRoot(
|
|
4236
|
+
findWorkspaceRoot(dirname8(fileName))
|
|
4206
4237
|
);
|
|
4207
4238
|
source = statics.source;
|
|
4208
4239
|
const original = statics.rewritten === 0 ? beforeStatic : parse3(fileName, source);
|
|
@@ -4323,7 +4354,7 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
|
|
|
4323
4354
|
*/
|
|
4324
4355
|
...statics.refusals.map((specifier) => ({
|
|
4325
4356
|
binding: specifier,
|
|
4326
|
-
reason: `\`require('${specifier}')\` reaches another project, and
|
|
4357
|
+
reason: `\`require('${specifier}')\` reaches another project, and \`tsconfig.base.json\` declares no path for it. A static import of a relative path is refused by nx, and \`await import()\` would make it a dynamic dependency, which forbids every static import of that project across this module. Add a \`paths\` entry for it, or move the file inside this project.`
|
|
4327
4358
|
})),
|
|
4328
4359
|
...fakeTimers.refusals,
|
|
4329
4360
|
...hoist.refusals,
|
|
@@ -4340,8 +4371,8 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
|
|
|
4340
4371
|
}
|
|
4341
4372
|
|
|
4342
4373
|
// src/roles/test/codemod/test-support-files.ts
|
|
4343
|
-
import { existsSync as
|
|
4344
|
-
import { dirname as
|
|
4374
|
+
import { existsSync as existsSync14, readFileSync as readFileSync15, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
|
|
4375
|
+
import { dirname as dirname9, join as join17, relative as relative4, resolve as resolve9 } from "node:path";
|
|
4345
4376
|
var THE_SHIM_CANNOT_ANSWER = [/\brequire\s*\(/, /\bjest\.(?:fn|Mock|SpyInstance)\s*</];
|
|
4346
4377
|
var SKIPPED = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", ".git", ".vite"]);
|
|
4347
4378
|
var TEST_FILE2 = /[.-](spec|test)\.[cm]?[jt]sx?$/;
|
|
@@ -4361,14 +4392,14 @@ function relativeSpecifiers2(source) {
|
|
|
4361
4392
|
return found;
|
|
4362
4393
|
}
|
|
4363
4394
|
function resolveSpecifier(fromFile, specifier) {
|
|
4364
|
-
const base = resolve9(
|
|
4365
|
-
if (
|
|
4395
|
+
const base = resolve9(dirname9(fromFile), specifier);
|
|
4396
|
+
if (existsSync14(base) && statSync4(base).isFile()) return base;
|
|
4366
4397
|
for (const extension of EXTENSIONS2) {
|
|
4367
|
-
if (
|
|
4398
|
+
if (existsSync14(`${base}${extension}`)) return `${base}${extension}`;
|
|
4368
4399
|
}
|
|
4369
4400
|
for (const extension of EXTENSIONS2) {
|
|
4370
|
-
const index =
|
|
4371
|
-
if (
|
|
4401
|
+
const index = join17(base, `index${extension}`);
|
|
4402
|
+
if (existsSync14(index)) return index;
|
|
4372
4403
|
}
|
|
4373
4404
|
return void 0;
|
|
4374
4405
|
}
|
|
@@ -4385,9 +4416,9 @@ function moduleSources(cwd) {
|
|
|
4385
4416
|
}
|
|
4386
4417
|
for (const entry of entries) {
|
|
4387
4418
|
if (entry.isDirectory()) {
|
|
4388
|
-
if (!SKIPPED.has(entry.name)) stack.push(
|
|
4419
|
+
if (!SKIPPED.has(entry.name)) stack.push(join17(dir, entry.name));
|
|
4389
4420
|
} else if (SOURCE_FILE.test(entry.name)) {
|
|
4390
|
-
found.push(
|
|
4421
|
+
found.push(join17(dir, entry.name));
|
|
4391
4422
|
}
|
|
4392
4423
|
}
|
|
4393
4424
|
}
|
|
@@ -4395,7 +4426,7 @@ function moduleSources(cwd) {
|
|
|
4395
4426
|
}
|
|
4396
4427
|
function read2(path) {
|
|
4397
4428
|
try {
|
|
4398
|
-
return
|
|
4429
|
+
return readFileSync15(path, "utf8");
|
|
4399
4430
|
} catch {
|
|
4400
4431
|
return void 0;
|
|
4401
4432
|
}
|
|
@@ -4407,7 +4438,7 @@ function setupFilesInside(cwd, named) {
|
|
|
4407
4438
|
const full = resolve9(cwd, withoutToken);
|
|
4408
4439
|
const inside = relative4(cwd, full);
|
|
4409
4440
|
if (inside.startsWith("..") || inside === "") continue;
|
|
4410
|
-
if (!
|
|
4441
|
+
if (!existsSync14(full)) continue;
|
|
4411
4442
|
kept.push(inside.replaceAll("\\", "/"));
|
|
4412
4443
|
}
|
|
4413
4444
|
return kept;
|
|
@@ -4453,7 +4484,7 @@ function parse4(fileName, source) {
|
|
|
4453
4484
|
}
|
|
4454
4485
|
function read3(path) {
|
|
4455
4486
|
try {
|
|
4456
|
-
return
|
|
4487
|
+
return readFileSync16(path, "utf8");
|
|
4457
4488
|
} catch {
|
|
4458
4489
|
return void 0;
|
|
4459
4490
|
}
|
|
@@ -4471,7 +4502,7 @@ function defaultImportedSpecifiers(cwd) {
|
|
|
4471
4502
|
}
|
|
4472
4503
|
for (const entry of entries) {
|
|
4473
4504
|
if (SKIPPED2.has(entry)) continue;
|
|
4474
|
-
const path =
|
|
4505
|
+
const path = join18(dir, entry);
|
|
4475
4506
|
let directory;
|
|
4476
4507
|
try {
|
|
4477
4508
|
directory = statSync5(path).isDirectory();
|
|
@@ -4503,13 +4534,13 @@ function migrateModuleTests(cwd, setupFiles = []) {
|
|
|
4503
4534
|
const defaultImported = defaultImportedSpecifiers(cwd);
|
|
4504
4535
|
const asyncHelpers = /* @__PURE__ */ new Set();
|
|
4505
4536
|
for (const relative8 of listTestSupportFiles(cwd, setupFiles)) {
|
|
4506
|
-
const source = read3(
|
|
4537
|
+
const source = read3(join18(cwd, relative8));
|
|
4507
4538
|
if (source === void 0) {
|
|
4508
4539
|
blockers.push({ file: relative8, reason: "this file could not be read" });
|
|
4509
4540
|
continue;
|
|
4510
4541
|
}
|
|
4511
4542
|
const migrated = migrateTestFile(
|
|
4512
|
-
|
|
4543
|
+
join18(cwd, relative8),
|
|
4513
4544
|
source,
|
|
4514
4545
|
defaultImported,
|
|
4515
4546
|
/* @__PURE__ */ new Set(),
|
|
@@ -4528,8 +4559,8 @@ function migrateModuleTests(cwd, setupFiles = []) {
|
|
|
4528
4559
|
const renamedTo = vitestSupportName(relative8);
|
|
4529
4560
|
if (!migrated.changed && renamedTo === relative8) continue;
|
|
4530
4561
|
if (renamedTo !== relative8) operations.push({ kind: "delete", path: relative8 });
|
|
4531
|
-
const before = parse4(
|
|
4532
|
-
const after = parse4(
|
|
4562
|
+
const before = parse4(join18(cwd, relative8), source);
|
|
4563
|
+
const after = parse4(join18(cwd, relative8), migrated.source);
|
|
4533
4564
|
if (before !== void 0 && after !== void 0) {
|
|
4534
4565
|
const wasAsync = asyncFunctionNames(before);
|
|
4535
4566
|
for (const name of asyncFunctionNames(after)) {
|
|
@@ -4538,17 +4569,17 @@ function migrateModuleTests(cwd, setupFiles = []) {
|
|
|
4538
4569
|
}
|
|
4539
4570
|
files++;
|
|
4540
4571
|
renamed += migrated.renamed;
|
|
4541
|
-
const contents = /\bvi\./.test(migrated.source) ? injectViImport(
|
|
4572
|
+
const contents = /\bvi\./.test(migrated.source) ? injectViImport(join18(cwd, renamedTo), migrated.source) : migrated.source;
|
|
4542
4573
|
operations.push({ kind: "write", path: renamedTo, contents });
|
|
4543
4574
|
}
|
|
4544
4575
|
for (const relative8 of listTestFiles(cwd)) {
|
|
4545
|
-
const source = read3(
|
|
4576
|
+
const source = read3(join18(cwd, relative8));
|
|
4546
4577
|
if (source === void 0) {
|
|
4547
4578
|
blockers.push({ file: relative8, reason: "this file could not be read" });
|
|
4548
4579
|
continue;
|
|
4549
4580
|
}
|
|
4550
4581
|
const migrated = migrateTestFile(
|
|
4551
|
-
|
|
4582
|
+
join18(cwd, relative8),
|
|
4552
4583
|
source,
|
|
4553
4584
|
defaultImported,
|
|
4554
4585
|
asyncHelpers,
|
|
@@ -4582,8 +4613,8 @@ function migrateModuleTests(cwd, setupFiles = []) {
|
|
|
4582
4613
|
}
|
|
4583
4614
|
|
|
4584
4615
|
// src/roles/test/nest/generate-config.ts
|
|
4585
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
4586
|
-
import { join as
|
|
4616
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync17, statSync as statSync6 } from "node:fs";
|
|
4617
|
+
import { join as join19, relative as relative5 } from "node:path";
|
|
4587
4618
|
import { parseSync as parseSync10 } from "oxc-parser";
|
|
4588
4619
|
var NEST_TEST_PRESET_SPECIFIER = "@hublo/sentinel/test/nest";
|
|
4589
4620
|
var REACT_TEST_PRESET_SPECIFIER = "@hublo/sentinel/test/react";
|
|
@@ -4630,7 +4661,7 @@ function readModuleTraits(cwd) {
|
|
|
4630
4661
|
}
|
|
4631
4662
|
for (const entry of entries) {
|
|
4632
4663
|
if (SKIPPED3.has(entry)) continue;
|
|
4633
|
-
const path =
|
|
4664
|
+
const path = join19(dir, entry);
|
|
4634
4665
|
let directory;
|
|
4635
4666
|
try {
|
|
4636
4667
|
directory = statSync6(path).isDirectory();
|
|
@@ -4644,7 +4675,7 @@ function readModuleTraits(cwd) {
|
|
|
4644
4675
|
if (!/\.tsx?$/.test(entry)) continue;
|
|
4645
4676
|
let source;
|
|
4646
4677
|
try {
|
|
4647
|
-
source =
|
|
4678
|
+
source = readFileSync17(path, "utf8");
|
|
4648
4679
|
} catch {
|
|
4649
4680
|
continue;
|
|
4650
4681
|
}
|
|
@@ -4785,8 +4816,8 @@ ${overrides.join("\n")}
|
|
|
4785
4816
|
}
|
|
4786
4817
|
|
|
4787
4818
|
// src/roles/test/nest/read-jest-config.ts
|
|
4788
|
-
import { existsSync as
|
|
4789
|
-
import { join as
|
|
4819
|
+
import { existsSync as existsSync15, readFileSync as readFileSync18 } from "node:fs";
|
|
4820
|
+
import { join as join20 } from "node:path";
|
|
4790
4821
|
var CARRIED = [
|
|
4791
4822
|
"testEnvironment",
|
|
4792
4823
|
"coverageDirectory",
|
|
@@ -4976,7 +5007,7 @@ function extendedConfig(source, cwd) {
|
|
|
4976
5007
|
(name) => name.replace(/^\.\//, "")
|
|
4977
5008
|
);
|
|
4978
5009
|
const file = candidates.find(
|
|
4979
|
-
(name) => /^jest[\w.-]*\.(ts|js)$/.test(name) &&
|
|
5010
|
+
(name) => /^jest[\w.-]*\.(ts|js)$/.test(name) && existsSync15(join20(cwd, name))
|
|
4980
5011
|
);
|
|
4981
5012
|
if (file === void 0) continue;
|
|
4982
5013
|
if (!new RegExp(String.raw`\{\s*\.\.\.${binding}\b`).test(source)) continue;
|
|
@@ -5003,11 +5034,11 @@ function sideEffects(source, extended) {
|
|
|
5003
5034
|
return found;
|
|
5004
5035
|
}
|
|
5005
5036
|
function readJestConfig(cwd, named) {
|
|
5006
|
-
const file = named ?? JEST_CONFIG_FILES.find((name) =>
|
|
5007
|
-
if (file === void 0 || !
|
|
5037
|
+
const file = named ?? JEST_CONFIG_FILES.find((name) => existsSync15(join20(cwd, name)));
|
|
5038
|
+
if (file === void 0 || !existsSync15(join20(cwd, file))) return void 0;
|
|
5008
5039
|
let source;
|
|
5009
5040
|
try {
|
|
5010
|
-
source =
|
|
5041
|
+
source = readFileSync18(join20(cwd, file), "utf8");
|
|
5011
5042
|
} catch {
|
|
5012
5043
|
return { file, refusals: [`${file} could not be read`], notes: [] };
|
|
5013
5044
|
}
|
|
@@ -5088,8 +5119,8 @@ function readJestConfig(cwd, named) {
|
|
|
5088
5119
|
}
|
|
5089
5120
|
|
|
5090
5121
|
// src/roles/test/nest/run-modes.ts
|
|
5091
|
-
import { existsSync as
|
|
5092
|
-
import { basename as basename2, join as
|
|
5122
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
5123
|
+
import { basename as basename2, join as join21 } from "node:path";
|
|
5093
5124
|
var JEST_EXECUTOR = "@nx/jest:jest";
|
|
5094
5125
|
var PRIMARY_CONFIG_FILE = "vitest.config.mts";
|
|
5095
5126
|
var PRIMARY_TARGET = "test";
|
|
@@ -5110,7 +5141,7 @@ function runModes(cwd, fallback) {
|
|
|
5110
5141
|
const jestConfig = entry.options?.jestConfig;
|
|
5111
5142
|
if (jestConfig === void 0) continue;
|
|
5112
5143
|
const name = configName(jestConfig);
|
|
5113
|
-
if (!
|
|
5144
|
+
if (!existsSync16(join21(cwd, name))) continue;
|
|
5114
5145
|
declared.push({
|
|
5115
5146
|
target,
|
|
5116
5147
|
jestConfig: name,
|
|
@@ -5135,12 +5166,12 @@ function runModes(cwd, fallback) {
|
|
|
5135
5166
|
}
|
|
5136
5167
|
|
|
5137
5168
|
// src/roles/test/written-file-formatter.ts
|
|
5138
|
-
import { existsSync as
|
|
5139
|
-
import { dirname as
|
|
5169
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
5170
|
+
import { dirname as dirname11, join as join24 } from "node:path";
|
|
5140
5171
|
|
|
5141
5172
|
// src/roles/format/read-adoption.ts
|
|
5142
|
-
import { existsSync as
|
|
5143
|
-
import { join as
|
|
5173
|
+
import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
|
|
5174
|
+
import { join as join22 } from "node:path";
|
|
5144
5175
|
|
|
5145
5176
|
// src/roles/format/config-policy.ts
|
|
5146
5177
|
var FORMAT_CONFIG_FILE = ".oxfmtrc.json";
|
|
@@ -5247,11 +5278,11 @@ function sameValue(a, b) {
|
|
|
5247
5278
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
5248
5279
|
}
|
|
5249
5280
|
function readFormatAdoption(cwd) {
|
|
5250
|
-
const path =
|
|
5251
|
-
if (!
|
|
5281
|
+
const path = join22(cwd, FORMAT_CONFIG_FILE);
|
|
5282
|
+
if (!existsSync17(path)) return NOT_ADOPTED(null);
|
|
5252
5283
|
let parsed;
|
|
5253
5284
|
try {
|
|
5254
|
-
parsed = parseJsonc(
|
|
5285
|
+
parsed = parseJsonc(readFileSync19(path, "utf8"), FORMAT_CONFIG_FILE);
|
|
5255
5286
|
} catch (error) {
|
|
5256
5287
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5257
5288
|
return NOT_ADOPTED(FORMAT_CONFIG_FILE, `${FORMAT_CONFIG_FILE} could not be parsed (${reason})`);
|
|
@@ -5295,9 +5326,9 @@ function readFormatAdoption(cwd) {
|
|
|
5295
5326
|
}
|
|
5296
5327
|
|
|
5297
5328
|
// src/roles/format/resolve-oxfmt.ts
|
|
5298
|
-
import { readFileSync as
|
|
5299
|
-
import { createRequire as
|
|
5300
|
-
import { dirname as
|
|
5329
|
+
import { readFileSync as readFileSync20 } from "node:fs";
|
|
5330
|
+
import { createRequire as createRequire4 } from "node:module";
|
|
5331
|
+
import { dirname as dirname10, join as join23 } from "node:path";
|
|
5301
5332
|
function resolveOxfmt(cwd) {
|
|
5302
5333
|
return resolveBin(cwd, "oxfmt") ?? binFromOwnInstall("oxfmt", "oxfmt");
|
|
5303
5334
|
}
|
|
@@ -5325,9 +5356,9 @@ function configSchema() {
|
|
|
5325
5356
|
}
|
|
5326
5357
|
function readConfigSchema() {
|
|
5327
5358
|
try {
|
|
5328
|
-
const manifest =
|
|
5329
|
-
const schemaPath =
|
|
5330
|
-
return JSON.parse(
|
|
5359
|
+
const manifest = createRequire4(import.meta.url).resolve("oxfmt/package.json");
|
|
5360
|
+
const schemaPath = join23(dirname10(manifest), "configuration_schema.json");
|
|
5361
|
+
return JSON.parse(readFileSync20(schemaPath, "utf8"));
|
|
5331
5362
|
} catch {
|
|
5332
5363
|
return void 0;
|
|
5333
5364
|
}
|
|
@@ -5352,9 +5383,9 @@ function prettierConfigFrom(cwd) {
|
|
|
5352
5383
|
let dir = cwd;
|
|
5353
5384
|
for (; ; ) {
|
|
5354
5385
|
for (const name of PRETTIER_CONFIGS) {
|
|
5355
|
-
if (
|
|
5386
|
+
if (existsSync18(join24(dir, name))) return join24(dir, name);
|
|
5356
5387
|
}
|
|
5357
|
-
const parent =
|
|
5388
|
+
const parent = dirname11(dir);
|
|
5358
5389
|
if (parent === dir) return void 0;
|
|
5359
5390
|
dir = parent;
|
|
5360
5391
|
}
|
|
@@ -5382,12 +5413,12 @@ function writtenFileFormatter(cwd) {
|
|
|
5382
5413
|
var SPEC_TSCONFIG = "tsconfig.spec.json";
|
|
5383
5414
|
var VITEST_GLOBAL_TYPES = "vitest/globals";
|
|
5384
5415
|
function specTypesOperation(cwd) {
|
|
5385
|
-
const path =
|
|
5386
|
-
if (!
|
|
5416
|
+
const path = join25(cwd, SPEC_TSCONFIG);
|
|
5417
|
+
if (!existsSync19(path)) return void 0;
|
|
5387
5418
|
let config;
|
|
5388
5419
|
try {
|
|
5389
5420
|
config = parseJsonc(
|
|
5390
|
-
|
|
5421
|
+
readFileSync21(path, "utf8"),
|
|
5391
5422
|
SPEC_TSCONFIG
|
|
5392
5423
|
);
|
|
5393
5424
|
} catch {
|
|
@@ -5406,12 +5437,12 @@ function specTypesOperation(cwd) {
|
|
|
5406
5437
|
};
|
|
5407
5438
|
}
|
|
5408
5439
|
function specTypesCleanupOperation(cwd) {
|
|
5409
|
-
const path =
|
|
5410
|
-
if (!
|
|
5440
|
+
const path = join25(cwd, SPEC_TSCONFIG);
|
|
5441
|
+
if (!existsSync19(path)) return void 0;
|
|
5411
5442
|
let config;
|
|
5412
5443
|
try {
|
|
5413
5444
|
config = parseJsonc(
|
|
5414
|
-
|
|
5445
|
+
readFileSync21(path, "utf8"),
|
|
5415
5446
|
SPEC_TSCONFIG
|
|
5416
5447
|
);
|
|
5417
5448
|
} catch {
|
|
@@ -5429,9 +5460,9 @@ function specTypesCleanupOperation(cwd) {
|
|
|
5429
5460
|
}
|
|
5430
5461
|
function shippedTypesPath(cwd, declaration) {
|
|
5431
5462
|
try {
|
|
5432
|
-
const manifest =
|
|
5433
|
-
const file =
|
|
5434
|
-
if (
|
|
5463
|
+
const manifest = createRequire5(join25(cwd, "noop.cjs")).resolve("@hublo/sentinel/package.json");
|
|
5464
|
+
const file = join25(dirname12(manifest), declaration);
|
|
5465
|
+
if (existsSync19(file)) {
|
|
5435
5466
|
const path = relative6(cwd, file);
|
|
5436
5467
|
return path.startsWith(".") ? path : `./${path}`;
|
|
5437
5468
|
}
|
|
@@ -5450,7 +5481,7 @@ function helpersStillCallingJest(cwd) {
|
|
|
5450
5481
|
return;
|
|
5451
5482
|
}
|
|
5452
5483
|
for (const entry of entries) {
|
|
5453
|
-
const path =
|
|
5484
|
+
const path = join25(dir, entry.name);
|
|
5454
5485
|
if (entry.isDirectory()) {
|
|
5455
5486
|
if (!skip.has(entry.name)) walk2(path);
|
|
5456
5487
|
continue;
|
|
@@ -5460,7 +5491,7 @@ function helpersStillCallingJest(cwd) {
|
|
|
5460
5491
|
if (/^(jest|vitest)\./.test(entry.name)) continue;
|
|
5461
5492
|
let source;
|
|
5462
5493
|
try {
|
|
5463
|
-
source =
|
|
5494
|
+
source = readFileSync21(path, "utf8");
|
|
5464
5495
|
} catch {
|
|
5465
5496
|
continue;
|
|
5466
5497
|
}
|
|
@@ -5497,7 +5528,7 @@ function tsconfigFileListOperations(cwd) {
|
|
|
5497
5528
|
let config;
|
|
5498
5529
|
try {
|
|
5499
5530
|
config = parseJsonc(
|
|
5500
|
-
|
|
5531
|
+
readFileSync21(join25(cwd, name), "utf8"),
|
|
5501
5532
|
name
|
|
5502
5533
|
);
|
|
5503
5534
|
} catch {
|
|
@@ -5912,12 +5943,12 @@ function plan(context) {
|
|
|
5912
5943
|
}
|
|
5913
5944
|
|
|
5914
5945
|
// src/roles/test/written-file-linter.ts
|
|
5915
|
-
import { existsSync as
|
|
5916
|
-
import { join as
|
|
5946
|
+
import { existsSync as existsSync24 } from "node:fs";
|
|
5947
|
+
import { join as join31 } from "node:path";
|
|
5917
5948
|
|
|
5918
5949
|
// src/roles/lint/module-baseline.ts
|
|
5919
|
-
import { existsSync as
|
|
5920
|
-
import { join as
|
|
5950
|
+
import { existsSync as existsSync20, readFileSync as readFileSync22 } from "node:fs";
|
|
5951
|
+
import { join as join26 } from "node:path";
|
|
5921
5952
|
|
|
5922
5953
|
// src/roles/lint/oxlint-rule-owners.json
|
|
5923
5954
|
var oxlint_rule_owners_default = {
|
|
@@ -6659,10 +6690,10 @@ function describeHolds(holds) {
|
|
|
6659
6690
|
return `held ${holds.length} rule(s) at \`warn\` for this module, covering ${total} violation(s) that were already there: ${listed}${rest}. They are written to ${LINT_BASELINE_FILE}, they still report, and they return to \`error\` once fixed and re-initialized`;
|
|
6660
6691
|
}
|
|
6661
6692
|
function heldRules(cwd) {
|
|
6662
|
-
const path =
|
|
6663
|
-
if (!
|
|
6693
|
+
const path = join26(cwd, LINT_BASELINE_FILE);
|
|
6694
|
+
if (!existsSync20(path)) return [];
|
|
6664
6695
|
try {
|
|
6665
|
-
const parsed = parseJsonc(
|
|
6696
|
+
const parsed = parseJsonc(readFileSync22(path, "utf8"), LINT_BASELINE_FILE);
|
|
6666
6697
|
const scoped = (parsed.overrides ?? []).flatMap((override) => Object.keys(override.rules ?? {}));
|
|
6667
6698
|
return [.../* @__PURE__ */ new Set([...Object.keys(parsed.rules ?? {}), ...scoped])];
|
|
6668
6699
|
} catch {
|
|
@@ -6710,12 +6741,12 @@ function lintTarget() {
|
|
|
6710
6741
|
}
|
|
6711
6742
|
|
|
6712
6743
|
// src/roles/lint/read-adoption.ts
|
|
6713
|
-
import { readFileSync as
|
|
6714
|
-
import { join as
|
|
6744
|
+
import { readFileSync as readFileSync25 } from "node:fs";
|
|
6745
|
+
import { join as join29 } from "node:path";
|
|
6715
6746
|
|
|
6716
6747
|
// src/core/config/read-adoption.ts
|
|
6717
|
-
import { existsSync as
|
|
6718
|
-
import { join as
|
|
6748
|
+
import { existsSync as existsSync22, readFileSync as readFileSync24 } from "node:fs";
|
|
6749
|
+
import { join as join28 } from "node:path";
|
|
6719
6750
|
|
|
6720
6751
|
// src/core/config/owned-keys.ts
|
|
6721
6752
|
function presetOwnedKeys(config, permitted, presetSets) {
|
|
@@ -6730,12 +6761,12 @@ function localOnlyKeys(config, permitted, presetSets) {
|
|
|
6730
6761
|
}
|
|
6731
6762
|
|
|
6732
6763
|
// src/core/config/resolve-config-target.ts
|
|
6733
|
-
import { existsSync as
|
|
6734
|
-
import { join as
|
|
6764
|
+
import { existsSync as existsSync21, readFileSync as readFileSync23 } from "node:fs";
|
|
6765
|
+
import { join as join27 } from "node:path";
|
|
6735
6766
|
function readExtends(absolutePath) {
|
|
6736
6767
|
let parsed;
|
|
6737
6768
|
try {
|
|
6738
|
-
parsed = parseJsonc(
|
|
6769
|
+
parsed = parseJsonc(readFileSync23(absolutePath, "utf8"), absolutePath);
|
|
6739
6770
|
} catch {
|
|
6740
6771
|
return [];
|
|
6741
6772
|
}
|
|
@@ -6749,8 +6780,8 @@ function resolveConfigTarget(moduleDir, { candidates, markers, fallback }) {
|
|
|
6749
6780
|
let existing;
|
|
6750
6781
|
let existingExtendsSomething = false;
|
|
6751
6782
|
for (const candidate of candidates) {
|
|
6752
|
-
const absolutePath =
|
|
6753
|
-
if (!
|
|
6783
|
+
const absolutePath = join27(moduleDir, candidate);
|
|
6784
|
+
if (!existsSync21(absolutePath)) continue;
|
|
6754
6785
|
const chain = readExtends(absolutePath);
|
|
6755
6786
|
if (existing === void 0) {
|
|
6756
6787
|
existing = candidate;
|
|
@@ -6783,12 +6814,12 @@ var NOT_ADOPTED2 = (configFile, unreadable = null) => ({
|
|
|
6783
6814
|
});
|
|
6784
6815
|
function readAdoption(cwd, options) {
|
|
6785
6816
|
const target = resolveConfigTarget(cwd, options);
|
|
6786
|
-
if (target.reason === "none" || !
|
|
6817
|
+
if (target.reason === "none" || !existsSync22(join28(cwd, target.path))) {
|
|
6787
6818
|
return NOT_ADOPTED2(target.reason === "none" ? null : target.path);
|
|
6788
6819
|
}
|
|
6789
6820
|
let parsed;
|
|
6790
6821
|
try {
|
|
6791
|
-
parsed = parseJsonc(
|
|
6822
|
+
parsed = parseJsonc(readFileSync24(join28(cwd, target.path), "utf8"), target.path);
|
|
6792
6823
|
} catch (error) {
|
|
6793
6824
|
const reason = error instanceof Error ? error.message : String(error);
|
|
6794
6825
|
return NOT_ADOPTED2(target.path, `${target.path} could not be parsed (${reason})`);
|
|
@@ -9472,7 +9503,7 @@ function readModuleAdditions(cwd) {
|
|
|
9472
9503
|
if (preset === void 0 || adoption.configFile === null) return NO_ADDITIONS;
|
|
9473
9504
|
try {
|
|
9474
9505
|
const config = parseJsonc(
|
|
9475
|
-
|
|
9506
|
+
readFileSync25(join29(cwd, adoption.configFile), "utf8"),
|
|
9476
9507
|
adoption.configFile
|
|
9477
9508
|
);
|
|
9478
9509
|
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
@@ -9489,15 +9520,15 @@ function readModuleAdditions(cwd) {
|
|
|
9489
9520
|
}
|
|
9490
9521
|
|
|
9491
9522
|
// src/roles/lint/resolve-oxlint.ts
|
|
9492
|
-
import { existsSync as
|
|
9493
|
-
import { createRequire as
|
|
9494
|
-
import { delimiter, dirname as
|
|
9523
|
+
import { existsSync as existsSync23 } from "node:fs";
|
|
9524
|
+
import { createRequire as createRequire6 } from "node:module";
|
|
9525
|
+
import { delimiter as delimiter2, dirname as dirname13, join as join30 } from "node:path";
|
|
9495
9526
|
import { fileURLToPath } from "node:url";
|
|
9496
9527
|
var PACKAGE_OF = {
|
|
9497
9528
|
oxlint: "oxlint",
|
|
9498
9529
|
tsgolint: "oxlint-tsgolint"
|
|
9499
9530
|
};
|
|
9500
|
-
var
|
|
9531
|
+
var require3 = createRequire6(import.meta.url);
|
|
9501
9532
|
function resolveOxlint(cwd, name = "oxlint") {
|
|
9502
9533
|
return resolveBin(cwd, name) ?? binFromOwnInstall(PACKAGE_OF[name], name);
|
|
9503
9534
|
}
|
|
@@ -9507,7 +9538,7 @@ function canRunTypeAware(cwd) {
|
|
|
9507
9538
|
function oxlintPath(cwd, env) {
|
|
9508
9539
|
const shim = tsgolintShim(cwd);
|
|
9509
9540
|
if (!shim) return env.PATH;
|
|
9510
|
-
return [
|
|
9541
|
+
return [dirname13(shim), env.PATH].filter(Boolean).join(delimiter2);
|
|
9511
9542
|
}
|
|
9512
9543
|
function tsgolintShim(cwd) {
|
|
9513
9544
|
const fromModule = resolveBin(cwd, "tsgolint");
|
|
@@ -9515,19 +9546,19 @@ function tsgolintShim(cwd) {
|
|
|
9515
9546
|
const candidates = [];
|
|
9516
9547
|
for (const owner of ["oxlint-tsgolint", "oxlint"]) {
|
|
9517
9548
|
try {
|
|
9518
|
-
const packageDir =
|
|
9519
|
-
candidates.push(
|
|
9520
|
-
candidates.push(
|
|
9549
|
+
const packageDir = dirname13(require3.resolve(`${owner}/package.json`));
|
|
9550
|
+
candidates.push(join30(packageDir, "node_modules", ".bin", "tsgolint"));
|
|
9551
|
+
candidates.push(join30(packageDir, "..", ".bin", "tsgolint"));
|
|
9521
9552
|
} catch {
|
|
9522
9553
|
}
|
|
9523
9554
|
}
|
|
9524
9555
|
try {
|
|
9525
|
-
const ownRoot =
|
|
9526
|
-
candidates.push(
|
|
9556
|
+
const ownRoot = dirname13(require3.resolve("@hublo/sentinel/package.json"));
|
|
9557
|
+
candidates.push(join30(ownRoot, "node_modules", ".bin", "tsgolint"));
|
|
9527
9558
|
} catch {
|
|
9528
|
-
candidates.push(resolveBin(
|
|
9559
|
+
candidates.push(resolveBin(dirname13(fileURLToPath(import.meta.url)), "tsgolint") ?? "");
|
|
9529
9560
|
}
|
|
9530
|
-
return candidates.find((candidate) => candidate !== "" &&
|
|
9561
|
+
return candidates.find((candidate) => candidate !== "" && existsSync23(candidate));
|
|
9531
9562
|
}
|
|
9532
9563
|
function oxlintSearchPath(cwd) {
|
|
9533
9564
|
return binSearchPath(cwd);
|
|
@@ -9541,7 +9572,7 @@ function writtenFileLinter(cwd) {
|
|
|
9541
9572
|
return { bin: oxlint, args: ["--fix"], origin: "this module's own oxlint config" };
|
|
9542
9573
|
}
|
|
9543
9574
|
}
|
|
9544
|
-
const config = ESLINT_CONFIG_FILES.map((name) =>
|
|
9575
|
+
const config = ESLINT_CONFIG_FILES.map((name) => join31(cwd, name)).find((path) => existsSync24(path));
|
|
9545
9576
|
const eslint = resolveBin(cwd, "eslint");
|
|
9546
9577
|
if (config !== void 0 && eslint !== void 0) {
|
|
9547
9578
|
return {
|
|
@@ -9563,7 +9594,7 @@ var FORMATTABLE = /\.(m|c)?(j|t)sx?$|\.json$/;
|
|
|
9563
9594
|
var FORMAT_BATCH = 25;
|
|
9564
9595
|
function readIfPossible(path) {
|
|
9565
9596
|
try {
|
|
9566
|
-
return
|
|
9597
|
+
return readFileSync26(path, "utf8");
|
|
9567
9598
|
} catch {
|
|
9568
9599
|
return void 0;
|
|
9569
9600
|
}
|
|
@@ -9689,12 +9720,12 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
|
|
|
9689
9720
|
const linter = writtenFileLinter(ctx.cwd);
|
|
9690
9721
|
if (linter === void 0) return;
|
|
9691
9722
|
const workspaceRoot = findWorkspaceRoot(ctx.cwd) ?? ctx.cwd;
|
|
9692
|
-
const fromRoot = (file) => relative7(workspaceRoot,
|
|
9723
|
+
const fromRoot = (file) => relative7(workspaceRoot, join32(ctx.cwd, file));
|
|
9693
9724
|
let unsettled = 0;
|
|
9694
9725
|
const reverted = [];
|
|
9695
9726
|
for (let at = 0; at < written.length; at += FORMAT_BATCH) {
|
|
9696
9727
|
const batch = written.slice(at, at + FORMAT_BATCH);
|
|
9697
|
-
const before = new Map(batch.map((file) => [file, readIfPossible(
|
|
9728
|
+
const before = new Map(batch.map((file) => [file, readIfPossible(join32(ctx.cwd, file))]));
|
|
9698
9729
|
const pass = spawnSync(linter.bin, [...linter.args, ...batch.map(fromRoot)], {
|
|
9699
9730
|
cwd: workspaceRoot,
|
|
9700
9731
|
encoding: "utf8"
|
|
@@ -9703,11 +9734,11 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
|
|
|
9703
9734
|
for (const file of batch) {
|
|
9704
9735
|
const was = before.get(file);
|
|
9705
9736
|
if (was === void 0) continue;
|
|
9706
|
-
const now = readIfPossible(
|
|
9737
|
+
const now = readIfPossible(join32(ctx.cwd, file));
|
|
9707
9738
|
if (now === void 0 || now === was) continue;
|
|
9708
9739
|
const lost = lineLostByTheFixer(was, now);
|
|
9709
9740
|
if (lost === void 0) continue;
|
|
9710
|
-
writeFileSync2(
|
|
9741
|
+
writeFileSync2(join32(ctx.cwd, file), was);
|
|
9711
9742
|
reverted.push(`${file}: \`${lost.slice(0, 80)}\``);
|
|
9712
9743
|
}
|
|
9713
9744
|
}
|
|
@@ -9786,7 +9817,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
|
|
|
9786
9817
|
metrics: { ..._VitestAdapter.NOTHING_TO_REPORT, error: "vitest not available" }
|
|
9787
9818
|
};
|
|
9788
9819
|
}
|
|
9789
|
-
const out =
|
|
9820
|
+
const out = join32(mkdtempSync3(join32(tmpdir3(), "sentinel-test-report-")), "vitest.json");
|
|
9790
9821
|
const { cwd: runFrom, options, env } = fromWorkspaceRoot(ctx.cwd, [], []);
|
|
9791
9822
|
const result = spawnSync(bin, ["run", ...options, "--reporter=json", `--outputFile=${out}`], {
|
|
9792
9823
|
cwd: runFrom,
|
|
@@ -9801,7 +9832,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
|
|
|
9801
9832
|
metrics: { ..._VitestAdapter.NOTHING_TO_REPORT, error: result.error.message }
|
|
9802
9833
|
};
|
|
9803
9834
|
}
|
|
9804
|
-
if (!
|
|
9835
|
+
if (!existsSync25(out)) {
|
|
9805
9836
|
return {
|
|
9806
9837
|
ok: false,
|
|
9807
9838
|
code: 1,
|
|
@@ -9810,7 +9841,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
|
|
|
9810
9841
|
}
|
|
9811
9842
|
let parsed;
|
|
9812
9843
|
try {
|
|
9813
|
-
parsed = JSON.parse(
|
|
9844
|
+
parsed = JSON.parse(readFileSync26(out, "utf8"));
|
|
9814
9845
|
} catch {
|
|
9815
9846
|
return {
|
|
9816
9847
|
ok: false,
|
|
@@ -9933,6 +9964,10 @@ export {
|
|
|
9933
9964
|
BaseAdapter,
|
|
9934
9965
|
splitToolArgs,
|
|
9935
9966
|
separateToolArgs,
|
|
9967
|
+
resolveBin,
|
|
9968
|
+
binFromOwnInstall,
|
|
9969
|
+
binSearchPath,
|
|
9970
|
+
scriptPath,
|
|
9936
9971
|
nxTargetOperations,
|
|
9937
9972
|
FORMAT_CONFIG_FILE,
|
|
9938
9973
|
FORMAT_SCRIPT_NAME,
|
|
@@ -9989,10 +10024,12 @@ export {
|
|
|
9989
10024
|
oxlintPath,
|
|
9990
10025
|
oxlintSearchPath,
|
|
9991
10026
|
walk,
|
|
10027
|
+
MEMBER_TYPES,
|
|
9992
10028
|
writtenFileFormatter,
|
|
9993
10029
|
RESOLVABLE_EXTENSIONS,
|
|
9994
|
-
|
|
10030
|
+
findModuleRoot,
|
|
9995
10031
|
resolveContext,
|
|
10032
|
+
readTestAdoption,
|
|
9996
10033
|
moduleEnvironment,
|
|
9997
10034
|
suiteOf,
|
|
9998
10035
|
captureReference,
|