@hublo/sentinel 1.5.0-alpha.34 → 1.5.0-alpha.36
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/dist/bin/sentinel.js +4 -4
- package/dist/{chunk-ZFNBW6S3.js → chunk-43HQ6BVJ.js} +24 -11
- package/dist/{chunk-LCQZGHYL.js → chunk-5HM2TYYC.js} +1107 -418
- package/dist/{chunk-GCHCLR7P.js → chunk-V3NHPRLJ.js} +10 -1
- package/dist/{chunk-GCHCLR7P.js.map → chunk-V3NHPRLJ.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/roles/static-analysis/config.js +1 -1
- package/dist/{validate-7G2ORUZD.js → validate-FRMENKHM.js} +1 -1
- package/docs/typescript-traces.md +2 -2
- package/docs/validating-a-change.md +88 -0
- package/lint/nest.json +98 -18
- package/lint/node.json +83 -3
- package/lint/react-lib.json +121 -31
- package/lint/react.json +100 -2
- package/package.json +3 -1
- package/plugins/hublo/no-palette-common.js +76 -0
- package/plugins/hublo/no-regex-lookbehind.js +70 -0
- package/plugins/hublo/require-reload-document.js +70 -0
- package/plugins/hublo.js +20 -209
- package/plugins/sonar-cognitive.js +46 -9
package/dist/bin/sentinel.js
CHANGED
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
palette,
|
|
16
16
|
registerAdapters,
|
|
17
17
|
resolve
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-5HM2TYYC.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveContext
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-43HQ6BVJ.js";
|
|
22
22
|
import {
|
|
23
23
|
ensureWorkspacePrep,
|
|
24
24
|
findWorkspaceRoot,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
readOwnVersion,
|
|
27
27
|
readProjectPackageJson
|
|
28
28
|
} from "../chunk-IL5PPLXE.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-V3NHPRLJ.js";
|
|
30
30
|
import "../chunk-O7REVMOC.js";
|
|
31
31
|
import "../chunk-QXFCZON7.js";
|
|
32
32
|
|
|
@@ -148,7 +148,7 @@ async function runValidate(ctx) {
|
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
if (!ctx.targets.includes("test")) return 1;
|
|
151
|
-
const { validateModuleTests } = await import("../validate-
|
|
151
|
+
const { validateModuleTests } = await import("../validate-FRMENKHM.js");
|
|
152
152
|
const outcomes = modules.flatMap(
|
|
153
153
|
(module) => validateModuleTests(module.name, module.root)
|
|
154
154
|
);
|
|
@@ -2160,13 +2160,26 @@ function namespaceBindings(program) {
|
|
|
2160
2160
|
import { readFileSync as readFileSync9, statSync } from "node:fs";
|
|
2161
2161
|
import { dirname as dirname2, join as join10, resolve as resolve4 } from "node:path";
|
|
2162
2162
|
import { parseSync as parseSync4 } from "oxc-parser";
|
|
2163
|
-
|
|
2163
|
+
|
|
2164
|
+
// src/shared/module-resolution.ts
|
|
2165
|
+
var RESOLVABLE_EXTENSIONS = [
|
|
2166
|
+
".ts",
|
|
2167
|
+
".tsx",
|
|
2168
|
+
".mts",
|
|
2169
|
+
".cts",
|
|
2170
|
+
".js",
|
|
2171
|
+
".jsx",
|
|
2172
|
+
".mjs",
|
|
2173
|
+
".cjs"
|
|
2174
|
+
];
|
|
2175
|
+
|
|
2176
|
+
// src/roles/test/codemod/static-import-for-require.ts
|
|
2164
2177
|
function resolveRelative(fromFile, specifier) {
|
|
2165
2178
|
const base = resolve4(dirname2(fromFile), specifier);
|
|
2166
2179
|
const candidates = [
|
|
2167
2180
|
base,
|
|
2168
|
-
...
|
|
2169
|
-
...
|
|
2181
|
+
...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
|
|
2182
|
+
...RESOLVABLE_EXTENSIONS.map((extension) => join10(base, `index${extension}`))
|
|
2170
2183
|
];
|
|
2171
2184
|
for (const candidate of candidates) {
|
|
2172
2185
|
try {
|
|
@@ -3537,7 +3550,7 @@ function resolveContext(cwd, opts) {
|
|
|
3537
3550
|
// src/roles/test/codemod/workspace-specifier.ts
|
|
3538
3551
|
import { existsSync as existsSync13, readFileSync as readFileSync13 } from "node:fs";
|
|
3539
3552
|
import { join as join15, relative as relative2, resolve as resolve6 } from "node:path";
|
|
3540
|
-
var
|
|
3553
|
+
var EXTENSIONS = ["", ".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", "/index.ts", "/index.js"];
|
|
3541
3554
|
function pathEntries(workspaceRoot) {
|
|
3542
3555
|
const file = join15(workspaceRoot, "tsconfig.base.json");
|
|
3543
3556
|
if (!existsSync13(file)) return [];
|
|
@@ -3567,7 +3580,7 @@ function workspaceSpecifier(workspaceRoot, file) {
|
|
|
3567
3580
|
const absolute = resolve6(file);
|
|
3568
3581
|
for (const entry of pathEntries(workspaceRoot)) {
|
|
3569
3582
|
if (!entry.wildcard) {
|
|
3570
|
-
if (
|
|
3583
|
+
if (EXTENSIONS.some((extension) => `${entry.target}${extension}` === absolute)) {
|
|
3571
3584
|
return entry.key;
|
|
3572
3585
|
}
|
|
3573
3586
|
continue;
|
|
@@ -3712,14 +3725,13 @@ function rewriteMockFactoryGenerics(source, program) {
|
|
|
3712
3725
|
import { readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
|
|
3713
3726
|
import { dirname as dirname7, join as join16, relative as relative3, resolve as resolve8 } from "node:path";
|
|
3714
3727
|
import { parseSync as parseSync7 } from "oxc-parser";
|
|
3715
|
-
var EXTENSIONS3 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
3716
3728
|
function resolveRelative2(fromFile, specifier) {
|
|
3717
3729
|
if (!specifier.startsWith(".")) return void 0;
|
|
3718
3730
|
const base = resolve8(dirname7(fromFile), specifier);
|
|
3719
3731
|
const candidates = [
|
|
3720
3732
|
base,
|
|
3721
|
-
...
|
|
3722
|
-
...
|
|
3733
|
+
...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
|
|
3734
|
+
...RESOLVABLE_EXTENSIONS.map((extension) => join16(base, `index${extension}`))
|
|
3723
3735
|
];
|
|
3724
3736
|
for (const candidate of candidates) {
|
|
3725
3737
|
try {
|
|
@@ -4309,7 +4321,7 @@ var THE_SHIM_CANNOT_ANSWER = [/\brequire\s*\(/, /\bjest\.(?:fn|Mock|SpyInstance)
|
|
|
4309
4321
|
var SKIPPED = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", ".git", ".vite"]);
|
|
4310
4322
|
var TEST_FILE2 = /[.-](spec|test)\.[cm]?[jt]sx?$/;
|
|
4311
4323
|
var SOURCE_FILE = /\.[cm]?[jt]sx?$/;
|
|
4312
|
-
var
|
|
4324
|
+
var EXTENSIONS2 = [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"];
|
|
4313
4325
|
function relativeSpecifiers2(source) {
|
|
4314
4326
|
const found = [];
|
|
4315
4327
|
const patterns = [
|
|
@@ -4326,10 +4338,10 @@ function relativeSpecifiers2(source) {
|
|
|
4326
4338
|
function resolveSpecifier(fromFile, specifier) {
|
|
4327
4339
|
const base = resolve9(dirname9(fromFile), specifier);
|
|
4328
4340
|
if (existsSync14(base) && statSync4(base).isFile()) return base;
|
|
4329
|
-
for (const extension of
|
|
4341
|
+
for (const extension of EXTENSIONS2) {
|
|
4330
4342
|
if (existsSync14(`${base}${extension}`)) return `${base}${extension}`;
|
|
4331
4343
|
}
|
|
4332
|
-
for (const extension of
|
|
4344
|
+
for (const extension of EXTENSIONS2) {
|
|
4333
4345
|
const index = join17(base, `index${extension}`);
|
|
4334
4346
|
if (existsSync14(index)) return index;
|
|
4335
4347
|
}
|
|
@@ -6574,6 +6586,7 @@ export {
|
|
|
6574
6586
|
oxlintSearchPath,
|
|
6575
6587
|
walk,
|
|
6576
6588
|
writtenFileFormatter,
|
|
6589
|
+
RESOLVABLE_EXTENSIONS,
|
|
6577
6590
|
readTestAdoption,
|
|
6578
6591
|
resolveContext,
|
|
6579
6592
|
moduleEnvironment,
|