@harness-engineering/core 0.12.0 → 0.13.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.
- package/dist/architecture/matchers.js +27 -35
- package/dist/architecture/matchers.mjs +1 -1
- package/dist/{chunk-ZHGBWFYD.mjs → chunk-D6VFA6AS.mjs} +22 -29
- package/dist/index.d.mts +420 -292
- package/dist/index.d.ts +420 -292
- package/dist/index.js +931 -537
- package/dist/index.mjs +871 -484
- package/package.json +2 -2
|
@@ -110,14 +110,10 @@ var ConstraintRuleSchema = import_zod.z.object({
|
|
|
110
110
|
// forward-compat for governs edges
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
// src/architecture/collectors/circular-deps.ts
|
|
114
|
-
var import_node_path = require("path");
|
|
115
|
-
|
|
116
113
|
// src/architecture/collectors/hash.ts
|
|
117
114
|
var import_node_crypto = require("crypto");
|
|
118
115
|
function violationId(relativePath, category, normalizedDetail) {
|
|
119
|
-
const
|
|
120
|
-
const input = `${path}:${category}:${normalizedDetail}`;
|
|
116
|
+
const input = `${relativePath}:${category}:${normalizedDetail}`;
|
|
121
117
|
return (0, import_node_crypto.createHash)("sha256").update(input).digest("hex");
|
|
122
118
|
}
|
|
123
119
|
function constraintRuleId(category, scope, description) {
|
|
@@ -149,12 +145,16 @@ function resolveFileToLayer(file, layers) {
|
|
|
149
145
|
// src/shared/fs-utils.ts
|
|
150
146
|
var import_fs = require("fs");
|
|
151
147
|
var import_util = require("util");
|
|
148
|
+
var import_node_path = require("path");
|
|
152
149
|
var import_glob = require("glob");
|
|
153
150
|
var accessAsync = (0, import_util.promisify)(import_fs.access);
|
|
154
151
|
var readFileAsync = (0, import_util.promisify)(import_fs.readFile);
|
|
155
152
|
async function findFiles(pattern, cwd = process.cwd()) {
|
|
156
153
|
return (0, import_glob.glob)(pattern, { cwd, absolute: true });
|
|
157
154
|
}
|
|
155
|
+
function relativePosix(from, to) {
|
|
156
|
+
return (0, import_node_path.relative)(from, to).replaceAll("\\", "/");
|
|
157
|
+
}
|
|
158
158
|
|
|
159
159
|
// src/constraints/dependencies.ts
|
|
160
160
|
var import_path = require("path");
|
|
@@ -209,8 +209,8 @@ async function buildDependencyGraph(files, parser, graphDependencyData) {
|
|
|
209
209
|
function checkLayerViolations(graph, layers, rootDir) {
|
|
210
210
|
const violations = [];
|
|
211
211
|
for (const edge of graph.edges) {
|
|
212
|
-
const fromRelative = (
|
|
213
|
-
const toRelative = (
|
|
212
|
+
const fromRelative = relativePosix(rootDir, edge.from);
|
|
213
|
+
const toRelative = relativePosix(rootDir, edge.to);
|
|
214
214
|
const fromLayer = resolveFileToLayer(fromRelative, layers);
|
|
215
215
|
const toLayer = resolveFileToLayer(toRelative, layers);
|
|
216
216
|
if (!fromLayer || !toLayer) continue;
|
|
@@ -433,8 +433,8 @@ var CircularDepsCollector = class {
|
|
|
433
433
|
}
|
|
434
434
|
const { cycles, largestCycle } = result.value;
|
|
435
435
|
const violations = cycles.map((cycle) => {
|
|
436
|
-
const cyclePath = cycle.cycle.map((f) => (
|
|
437
|
-
const firstFile = (
|
|
436
|
+
const cyclePath = cycle.cycle.map((f) => relativePosix(rootDir, f)).join(" -> ");
|
|
437
|
+
const firstFile = relativePosix(rootDir, cycle.cycle[0]);
|
|
438
438
|
return {
|
|
439
439
|
id: violationId(firstFile, this.category, cyclePath),
|
|
440
440
|
file: firstFile,
|
|
@@ -455,7 +455,6 @@ var CircularDepsCollector = class {
|
|
|
455
455
|
};
|
|
456
456
|
|
|
457
457
|
// src/architecture/collectors/layer-violations.ts
|
|
458
|
-
var import_node_path2 = require("path");
|
|
459
458
|
var LayerViolationCollector = class {
|
|
460
459
|
category = "layer-violations";
|
|
461
460
|
getRules(_config, _rootDir) {
|
|
@@ -499,8 +498,8 @@ var LayerViolationCollector = class {
|
|
|
499
498
|
(v) => v.reason === "WRONG_LAYER"
|
|
500
499
|
);
|
|
501
500
|
const violations = layerViolations.map((v) => {
|
|
502
|
-
const relFile = (
|
|
503
|
-
const relImport = (
|
|
501
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
502
|
+
const relImport = relativePosix(rootDir, v.imports);
|
|
504
503
|
const detail = `${v.fromLayer} -> ${v.toLayer}: ${relFile} imports ${relImport}`;
|
|
505
504
|
return {
|
|
506
505
|
id: violationId(relFile, this.category, detail),
|
|
@@ -524,11 +523,11 @@ var LayerViolationCollector = class {
|
|
|
524
523
|
// src/architecture/baseline-manager.ts
|
|
525
524
|
var import_node_fs = require("fs");
|
|
526
525
|
var import_node_crypto2 = require("crypto");
|
|
527
|
-
var
|
|
526
|
+
var import_node_path2 = require("path");
|
|
528
527
|
var ArchBaselineManager = class {
|
|
529
528
|
baselinesPath;
|
|
530
529
|
constructor(projectRoot, baselinePath) {
|
|
531
|
-
this.baselinesPath = baselinePath ? (0,
|
|
530
|
+
this.baselinesPath = baselinePath ? (0, import_node_path2.join)(projectRoot, baselinePath) : (0, import_node_path2.join)(projectRoot, ".harness", "arch", "baselines.json");
|
|
532
531
|
}
|
|
533
532
|
/**
|
|
534
533
|
* Snapshot the current metric results into an ArchBaseline.
|
|
@@ -589,7 +588,7 @@ var ArchBaselineManager = class {
|
|
|
589
588
|
* Uses atomic write (write to temp file, then rename) to prevent corruption.
|
|
590
589
|
*/
|
|
591
590
|
save(baseline) {
|
|
592
|
-
const dir = (0,
|
|
591
|
+
const dir = (0, import_node_path2.dirname)(this.baselinesPath);
|
|
593
592
|
if (!(0, import_node_fs.existsSync)(dir)) {
|
|
594
593
|
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
595
594
|
}
|
|
@@ -669,9 +668,6 @@ function diff(current, baseline) {
|
|
|
669
668
|
};
|
|
670
669
|
}
|
|
671
670
|
|
|
672
|
-
// src/architecture/collectors/complexity.ts
|
|
673
|
-
var import_node_path4 = require("path");
|
|
674
|
-
|
|
675
671
|
// src/entropy/detectors/complexity.ts
|
|
676
672
|
var import_promises = require("fs/promises");
|
|
677
673
|
var DEFAULT_THRESHOLDS = {
|
|
@@ -995,7 +991,7 @@ var ComplexityCollector = class {
|
|
|
995
991
|
(v) => v.severity === "error" || v.severity === "warning"
|
|
996
992
|
);
|
|
997
993
|
const violations = filtered.map((v) => {
|
|
998
|
-
const relFile = (
|
|
994
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
999
995
|
const idDetail = `${v.metric}:${v.function}`;
|
|
1000
996
|
return {
|
|
1001
997
|
id: violationId(relFile, this.category, idDetail),
|
|
@@ -1020,9 +1016,6 @@ var ComplexityCollector = class {
|
|
|
1020
1016
|
}
|
|
1021
1017
|
};
|
|
1022
1018
|
|
|
1023
|
-
// src/architecture/collectors/coupling.ts
|
|
1024
|
-
var import_node_path5 = require("path");
|
|
1025
|
-
|
|
1026
1019
|
// src/entropy/detectors/coupling.ts
|
|
1027
1020
|
var DEFAULT_THRESHOLDS2 = {
|
|
1028
1021
|
fanOut: { warn: 15 },
|
|
@@ -1224,7 +1217,7 @@ var CouplingCollector = class {
|
|
|
1224
1217
|
(v) => v.severity === "error" || v.severity === "warning"
|
|
1225
1218
|
);
|
|
1226
1219
|
const violations = filtered.map((v) => {
|
|
1227
|
-
const relFile = (
|
|
1220
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
1228
1221
|
const idDetail = `${v.metric}`;
|
|
1229
1222
|
return {
|
|
1230
1223
|
id: violationId(relFile, this.category, idDetail),
|
|
@@ -1247,7 +1240,6 @@ var CouplingCollector = class {
|
|
|
1247
1240
|
};
|
|
1248
1241
|
|
|
1249
1242
|
// src/architecture/collectors/forbidden-imports.ts
|
|
1250
|
-
var import_node_path6 = require("path");
|
|
1251
1243
|
var ForbiddenImportCollector = class {
|
|
1252
1244
|
category = "forbidden-imports";
|
|
1253
1245
|
getRules(_config, _rootDir) {
|
|
@@ -1291,8 +1283,8 @@ var ForbiddenImportCollector = class {
|
|
|
1291
1283
|
(v) => v.reason === "FORBIDDEN_IMPORT"
|
|
1292
1284
|
);
|
|
1293
1285
|
const violations = forbidden.map((v) => {
|
|
1294
|
-
const relFile = (
|
|
1295
|
-
const relImport = (
|
|
1286
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
1287
|
+
const relImport = relativePosix(rootDir, v.imports);
|
|
1296
1288
|
const detail = `forbidden import: ${relFile} -> ${relImport}`;
|
|
1297
1289
|
return {
|
|
1298
1290
|
id: violationId(relFile, this.category, detail),
|
|
@@ -1315,7 +1307,7 @@ var ForbiddenImportCollector = class {
|
|
|
1315
1307
|
|
|
1316
1308
|
// src/architecture/collectors/module-size.ts
|
|
1317
1309
|
var import_promises2 = require("fs/promises");
|
|
1318
|
-
var
|
|
1310
|
+
var import_node_path3 = require("path");
|
|
1319
1311
|
async function discoverModules(rootDir) {
|
|
1320
1312
|
const modules = [];
|
|
1321
1313
|
async function scanDir(dir) {
|
|
@@ -1331,7 +1323,7 @@ async function discoverModules(rootDir) {
|
|
|
1331
1323
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === "dist") {
|
|
1332
1324
|
continue;
|
|
1333
1325
|
}
|
|
1334
|
-
const fullPath = (0,
|
|
1326
|
+
const fullPath = (0, import_node_path3.join)(dir, entry.name);
|
|
1335
1327
|
if (entry.isDirectory()) {
|
|
1336
1328
|
subdirs.push(fullPath);
|
|
1337
1329
|
} else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx")) && !entry.name.endsWith(".test.ts") && !entry.name.endsWith(".test.tsx") && !entry.name.endsWith(".spec.ts")) {
|
|
@@ -1348,10 +1340,10 @@ async function discoverModules(rootDir) {
|
|
|
1348
1340
|
}
|
|
1349
1341
|
}
|
|
1350
1342
|
modules.push({
|
|
1351
|
-
modulePath: (
|
|
1343
|
+
modulePath: relativePosix(rootDir, dir),
|
|
1352
1344
|
fileCount: tsFiles.length,
|
|
1353
1345
|
totalLoc,
|
|
1354
|
-
files: tsFiles.map((f) => (
|
|
1346
|
+
files: tsFiles.map((f) => relativePosix(rootDir, f))
|
|
1355
1347
|
});
|
|
1356
1348
|
}
|
|
1357
1349
|
for (const sub of subdirs) {
|
|
@@ -1443,16 +1435,16 @@ var ModuleSizeCollector = class {
|
|
|
1443
1435
|
|
|
1444
1436
|
// src/architecture/collectors/dep-depth.ts
|
|
1445
1437
|
var import_promises3 = require("fs/promises");
|
|
1446
|
-
var
|
|
1438
|
+
var import_node_path4 = require("path");
|
|
1447
1439
|
function extractImportSources(content, filePath) {
|
|
1448
1440
|
const importRegex = /(?:import|export)\s+.*?from\s+['"](\.[^'"]+)['"]/g;
|
|
1449
1441
|
const dynamicRegex = /import\s*\(\s*['"](\.[^'"]+)['"]\s*\)/g;
|
|
1450
1442
|
const sources = [];
|
|
1451
|
-
const dir = (0,
|
|
1443
|
+
const dir = (0, import_node_path4.dirname)(filePath);
|
|
1452
1444
|
for (const regex of [importRegex, dynamicRegex]) {
|
|
1453
1445
|
let match;
|
|
1454
1446
|
while ((match = regex.exec(content)) !== null) {
|
|
1455
|
-
let resolved = (0,
|
|
1447
|
+
let resolved = (0, import_node_path4.resolve)(dir, match[1]);
|
|
1456
1448
|
if (!resolved.endsWith(".ts") && !resolved.endsWith(".tsx")) {
|
|
1457
1449
|
resolved += ".ts";
|
|
1458
1450
|
}
|
|
@@ -1473,7 +1465,7 @@ async function collectTsFiles(dir) {
|
|
|
1473
1465
|
for (const entry of entries) {
|
|
1474
1466
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === "dist")
|
|
1475
1467
|
continue;
|
|
1476
|
-
const fullPath = (0,
|
|
1468
|
+
const fullPath = (0, import_node_path4.join)(d, entry.name);
|
|
1477
1469
|
if (entry.isDirectory()) {
|
|
1478
1470
|
await scan(fullPath);
|
|
1479
1471
|
} else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx")) && !entry.name.endsWith(".test.ts") && !entry.name.endsWith(".test.tsx") && !entry.name.endsWith(".spec.ts")) {
|
|
@@ -1527,7 +1519,7 @@ var DepDepthCollector = class {
|
|
|
1527
1519
|
}
|
|
1528
1520
|
const moduleMap = /* @__PURE__ */ new Map();
|
|
1529
1521
|
for (const file of allFiles) {
|
|
1530
|
-
const relDir = (
|
|
1522
|
+
const relDir = relativePosix(rootDir, (0, import_node_path4.dirname)(file));
|
|
1531
1523
|
if (!moduleMap.has(relDir)) moduleMap.set(relDir, []);
|
|
1532
1524
|
moduleMap.get(relDir).push(file);
|
|
1533
1525
|
}
|
|
@@ -82,14 +82,10 @@ var ConstraintRuleSchema = z.object({
|
|
|
82
82
|
// forward-compat for governs edges
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
// src/architecture/collectors/circular-deps.ts
|
|
86
|
-
import { relative as relative2 } from "path";
|
|
87
|
-
|
|
88
85
|
// src/architecture/collectors/hash.ts
|
|
89
86
|
import { createHash } from "crypto";
|
|
90
87
|
function violationId(relativePath, category, normalizedDetail) {
|
|
91
|
-
const
|
|
92
|
-
const input = `${path}:${category}:${normalizedDetail}`;
|
|
88
|
+
const input = `${relativePath}:${category}:${normalizedDetail}`;
|
|
93
89
|
return createHash("sha256").update(input).digest("hex");
|
|
94
90
|
}
|
|
95
91
|
function constraintRuleId(category, scope, description) {
|
|
@@ -131,6 +127,7 @@ function resolveFileToLayer(file, layers) {
|
|
|
131
127
|
// src/shared/fs-utils.ts
|
|
132
128
|
import { access, constants, readFile } from "fs";
|
|
133
129
|
import { promisify } from "util";
|
|
130
|
+
import { relative } from "path";
|
|
134
131
|
import { glob } from "glob";
|
|
135
132
|
var accessAsync = promisify(access);
|
|
136
133
|
var readFileAsync = promisify(readFile);
|
|
@@ -153,9 +150,12 @@ async function readFileContent(path) {
|
|
|
153
150
|
async function findFiles(pattern, cwd = process.cwd()) {
|
|
154
151
|
return glob(pattern, { cwd, absolute: true });
|
|
155
152
|
}
|
|
153
|
+
function relativePosix(from, to) {
|
|
154
|
+
return relative(from, to).replaceAll("\\", "/");
|
|
155
|
+
}
|
|
156
156
|
|
|
157
157
|
// src/constraints/dependencies.ts
|
|
158
|
-
import { dirname, resolve
|
|
158
|
+
import { dirname, resolve } from "path";
|
|
159
159
|
function resolveImportPath(importSource, fromFile, _rootDir) {
|
|
160
160
|
if (!importSource.startsWith(".") && !importSource.startsWith("/")) {
|
|
161
161
|
return null;
|
|
@@ -207,8 +207,8 @@ async function buildDependencyGraph(files, parser, graphDependencyData) {
|
|
|
207
207
|
function checkLayerViolations(graph, layers, rootDir) {
|
|
208
208
|
const violations = [];
|
|
209
209
|
for (const edge of graph.edges) {
|
|
210
|
-
const fromRelative =
|
|
211
|
-
const toRelative =
|
|
210
|
+
const fromRelative = relativePosix(rootDir, edge.from);
|
|
211
|
+
const toRelative = relativePosix(rootDir, edge.to);
|
|
212
212
|
const fromLayer = resolveFileToLayer(fromRelative, layers);
|
|
213
213
|
const toLayer = resolveFileToLayer(toRelative, layers);
|
|
214
214
|
if (!fromLayer || !toLayer) continue;
|
|
@@ -438,8 +438,8 @@ var CircularDepsCollector = class {
|
|
|
438
438
|
}
|
|
439
439
|
const { cycles, largestCycle } = result.value;
|
|
440
440
|
const violations = cycles.map((cycle) => {
|
|
441
|
-
const cyclePath = cycle.cycle.map((f) =>
|
|
442
|
-
const firstFile =
|
|
441
|
+
const cyclePath = cycle.cycle.map((f) => relativePosix(rootDir, f)).join(" -> ");
|
|
442
|
+
const firstFile = relativePosix(rootDir, cycle.cycle[0]);
|
|
443
443
|
return {
|
|
444
444
|
id: violationId(firstFile, this.category, cyclePath),
|
|
445
445
|
file: firstFile,
|
|
@@ -460,7 +460,6 @@ var CircularDepsCollector = class {
|
|
|
460
460
|
};
|
|
461
461
|
|
|
462
462
|
// src/architecture/collectors/layer-violations.ts
|
|
463
|
-
import { relative as relative3 } from "path";
|
|
464
463
|
var LayerViolationCollector = class {
|
|
465
464
|
category = "layer-violations";
|
|
466
465
|
getRules(_config, _rootDir) {
|
|
@@ -504,8 +503,8 @@ var LayerViolationCollector = class {
|
|
|
504
503
|
(v) => v.reason === "WRONG_LAYER"
|
|
505
504
|
);
|
|
506
505
|
const violations = layerViolations.map((v) => {
|
|
507
|
-
const relFile =
|
|
508
|
-
const relImport =
|
|
506
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
507
|
+
const relImport = relativePosix(rootDir, v.imports);
|
|
509
508
|
const detail = `${v.fromLayer} -> ${v.toLayer}: ${relFile} imports ${relImport}`;
|
|
510
509
|
return {
|
|
511
510
|
id: violationId(relFile, this.category, detail),
|
|
@@ -674,9 +673,6 @@ function diff(current, baseline) {
|
|
|
674
673
|
};
|
|
675
674
|
}
|
|
676
675
|
|
|
677
|
-
// src/architecture/collectors/complexity.ts
|
|
678
|
-
import { relative as relative4 } from "path";
|
|
679
|
-
|
|
680
676
|
// src/entropy/detectors/complexity.ts
|
|
681
677
|
import { readFile as readFile2 } from "fs/promises";
|
|
682
678
|
var DEFAULT_THRESHOLDS = {
|
|
@@ -1000,7 +996,7 @@ var ComplexityCollector = class {
|
|
|
1000
996
|
(v) => v.severity === "error" || v.severity === "warning"
|
|
1001
997
|
);
|
|
1002
998
|
const violations = filtered.map((v) => {
|
|
1003
|
-
const relFile =
|
|
999
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
1004
1000
|
const idDetail = `${v.metric}:${v.function}`;
|
|
1005
1001
|
return {
|
|
1006
1002
|
id: violationId(relFile, this.category, idDetail),
|
|
@@ -1025,9 +1021,6 @@ var ComplexityCollector = class {
|
|
|
1025
1021
|
}
|
|
1026
1022
|
};
|
|
1027
1023
|
|
|
1028
|
-
// src/architecture/collectors/coupling.ts
|
|
1029
|
-
import { relative as relative5 } from "path";
|
|
1030
|
-
|
|
1031
1024
|
// src/entropy/detectors/coupling.ts
|
|
1032
1025
|
var DEFAULT_THRESHOLDS2 = {
|
|
1033
1026
|
fanOut: { warn: 15 },
|
|
@@ -1229,7 +1222,7 @@ var CouplingCollector = class {
|
|
|
1229
1222
|
(v) => v.severity === "error" || v.severity === "warning"
|
|
1230
1223
|
);
|
|
1231
1224
|
const violations = filtered.map((v) => {
|
|
1232
|
-
const relFile =
|
|
1225
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
1233
1226
|
const idDetail = `${v.metric}`;
|
|
1234
1227
|
return {
|
|
1235
1228
|
id: violationId(relFile, this.category, idDetail),
|
|
@@ -1252,7 +1245,6 @@ var CouplingCollector = class {
|
|
|
1252
1245
|
};
|
|
1253
1246
|
|
|
1254
1247
|
// src/architecture/collectors/forbidden-imports.ts
|
|
1255
|
-
import { relative as relative6 } from "path";
|
|
1256
1248
|
var ForbiddenImportCollector = class {
|
|
1257
1249
|
category = "forbidden-imports";
|
|
1258
1250
|
getRules(_config, _rootDir) {
|
|
@@ -1296,8 +1288,8 @@ var ForbiddenImportCollector = class {
|
|
|
1296
1288
|
(v) => v.reason === "FORBIDDEN_IMPORT"
|
|
1297
1289
|
);
|
|
1298
1290
|
const violations = forbidden.map((v) => {
|
|
1299
|
-
const relFile =
|
|
1300
|
-
const relImport =
|
|
1291
|
+
const relFile = relativePosix(rootDir, v.file);
|
|
1292
|
+
const relImport = relativePosix(rootDir, v.imports);
|
|
1301
1293
|
const detail = `forbidden import: ${relFile} -> ${relImport}`;
|
|
1302
1294
|
return {
|
|
1303
1295
|
id: violationId(relFile, this.category, detail),
|
|
@@ -1320,7 +1312,7 @@ var ForbiddenImportCollector = class {
|
|
|
1320
1312
|
|
|
1321
1313
|
// src/architecture/collectors/module-size.ts
|
|
1322
1314
|
import { readFile as readFile3, readdir } from "fs/promises";
|
|
1323
|
-
import { join as join2
|
|
1315
|
+
import { join as join2 } from "path";
|
|
1324
1316
|
async function discoverModules(rootDir) {
|
|
1325
1317
|
const modules = [];
|
|
1326
1318
|
async function scanDir(dir) {
|
|
@@ -1353,10 +1345,10 @@ async function discoverModules(rootDir) {
|
|
|
1353
1345
|
}
|
|
1354
1346
|
}
|
|
1355
1347
|
modules.push({
|
|
1356
|
-
modulePath:
|
|
1348
|
+
modulePath: relativePosix(rootDir, dir),
|
|
1357
1349
|
fileCount: tsFiles.length,
|
|
1358
1350
|
totalLoc,
|
|
1359
|
-
files: tsFiles.map((f) =>
|
|
1351
|
+
files: tsFiles.map((f) => relativePosix(rootDir, f))
|
|
1360
1352
|
});
|
|
1361
1353
|
}
|
|
1362
1354
|
for (const sub of subdirs) {
|
|
@@ -1448,7 +1440,7 @@ var ModuleSizeCollector = class {
|
|
|
1448
1440
|
|
|
1449
1441
|
// src/architecture/collectors/dep-depth.ts
|
|
1450
1442
|
import { readFile as readFile4, readdir as readdir2 } from "fs/promises";
|
|
1451
|
-
import { join as join3,
|
|
1443
|
+
import { join as join3, dirname as dirname3, resolve as resolve2 } from "path";
|
|
1452
1444
|
function extractImportSources(content, filePath) {
|
|
1453
1445
|
const importRegex = /(?:import|export)\s+.*?from\s+['"](\.[^'"]+)['"]/g;
|
|
1454
1446
|
const dynamicRegex = /import\s*\(\s*['"](\.[^'"]+)['"]\s*\)/g;
|
|
@@ -1532,7 +1524,7 @@ var DepDepthCollector = class {
|
|
|
1532
1524
|
}
|
|
1533
1525
|
const moduleMap = /* @__PURE__ */ new Map();
|
|
1534
1526
|
for (const file of allFiles) {
|
|
1535
|
-
const relDir =
|
|
1527
|
+
const relDir = relativePosix(rootDir, dirname3(file));
|
|
1536
1528
|
if (!moduleMap.has(relDir)) moduleMap.set(relDir, []);
|
|
1537
1529
|
moduleMap.get(relDir).push(file);
|
|
1538
1530
|
}
|
|
@@ -1790,6 +1782,7 @@ export {
|
|
|
1790
1782
|
fileExists,
|
|
1791
1783
|
readFileContent,
|
|
1792
1784
|
findFiles,
|
|
1785
|
+
relativePosix,
|
|
1793
1786
|
defineLayer,
|
|
1794
1787
|
resolveFileToLayer,
|
|
1795
1788
|
buildDependencyGraph,
|