@archest/jest 1.0.3 → 1.0.6
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/index.js.map +1 -1
- package/node_modules/@archest/core/dist/dto.d.ts +6 -0
- package/node_modules/@archest/core/dist/files/types.d.ts +6 -0
- package/node_modules/@archest/core/dist/index.js +13 -13
- package/node_modules/@archest/core/dist/index.js.map +1 -1
- package/node_modules/@archest/core/dist/index.mjs +159 -74
- package/node_modules/@archest/core/dist/index.mjs.map +1 -1
- package/node_modules/@archest/core/dist/utils/paths.d.ts +4 -0
- package/node_modules/@archest/core/package.json +7 -6
- package/node_modules/@archest/core-rust/core-rust.darwin-arm64.node +0 -0
- package/node_modules/@archest/core-rust/core-rust.linux-x64-gnu.node +0 -0
- package/node_modules/@archest/core-rust/core-rust.win32-x64-msvc.node +0 -0
- package/node_modules/@archest/core-rust/package.json +1 -1
- package/package.json +10 -8
|
@@ -17,6 +17,10 @@ function i(e, t, n) {
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/utils/ruleBuilder.ts
|
|
19
19
|
function a(e, t, n) {
|
|
20
|
+
if (e.length === 0) return {
|
|
21
|
+
pass: !1,
|
|
22
|
+
message: () => "No items matched the selector. The rule is vacuous."
|
|
23
|
+
};
|
|
20
24
|
let r = [];
|
|
21
25
|
for (let i of e) {
|
|
22
26
|
let { passes: e, failMessage: a, failNotMessage: o } = n(i);
|
|
@@ -148,10 +152,31 @@ function h(e, t, n) {
|
|
|
148
152
|
};
|
|
149
153
|
}
|
|
150
154
|
//#endregion
|
|
155
|
+
//#region src/utils/paths.ts
|
|
156
|
+
function g(e) {
|
|
157
|
+
if (e.length === 0) return "";
|
|
158
|
+
let t = [...e].sort(), n = t[0], r = t[t.length - 1], i = 0;
|
|
159
|
+
for (; i < n.length && n[i] === r[i];) i++;
|
|
160
|
+
let a = n.substring(0, i), o = Math.max(a.lastIndexOf("/"), a.lastIndexOf("\\"));
|
|
161
|
+
return o === -1 ? "" : a.substring(0, o + 1);
|
|
162
|
+
}
|
|
163
|
+
function _(e, t, n) {
|
|
164
|
+
let r = e.substring(t.length).replace(/\\/g, "/").replace(/^\//, ""), i = n.replace(/\\/g, "/").replace(/^\//, "").replace(/\/$/, "");
|
|
165
|
+
return r.startsWith("src/") && !i.startsWith("src/") && i !== "src" && (r = r.substring(4)), r.startsWith(`${i}/`) || r === i;
|
|
166
|
+
}
|
|
167
|
+
function v(e, t) {
|
|
168
|
+
let n = e.replace(/\\/g, "/"), r = t.replace(/\\/g, "/").replace(/^\//, "").replace(/\/$/, ""), i = n.split("/"), a = r.split("/");
|
|
169
|
+
return i.some((e, t) => a.every((e, n) => i[t + n] === e));
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
151
172
|
//#region src/classes/locateClasses.ts
|
|
152
|
-
function
|
|
173
|
+
function y(e, t, n) {
|
|
153
174
|
let r = e;
|
|
154
|
-
if (n?.inFolder
|
|
175
|
+
if (n?.inFolder) {
|
|
176
|
+
let i = e.map((e) => e._filePath), a = t.projectRoot || g(i);
|
|
177
|
+
r = r.filter((e) => _(e._filePath, a, n.inFolder));
|
|
178
|
+
}
|
|
179
|
+
if (n?.matchNamePattern) {
|
|
155
180
|
let e = typeof n.matchNamePattern == "string" ? new RegExp(n.matchNamePattern) : n.matchNamePattern;
|
|
156
181
|
r = r.filter((t) => t.name && e.test(t.name));
|
|
157
182
|
}
|
|
@@ -178,7 +203,11 @@ function g(e, t, n) {
|
|
|
178
203
|
}
|
|
179
204
|
//#endregion
|
|
180
205
|
//#region src/files/checkDependOnExternalModule.ts
|
|
181
|
-
function
|
|
206
|
+
function b(e, t, n) {
|
|
207
|
+
if (e.files.length === 0) return {
|
|
208
|
+
pass: !1,
|
|
209
|
+
message: () => "No files matched the selector. The rule is vacuous."
|
|
210
|
+
};
|
|
182
211
|
let r = [], i = typeof t == "string" ? new RegExp(t) : t;
|
|
183
212
|
for (let a of e.files) {
|
|
184
213
|
let e = (a.external_dependencies || []).some((e) => i.test(e));
|
|
@@ -191,15 +220,19 @@ function _(e, t, n) {
|
|
|
191
220
|
}
|
|
192
221
|
//#endregion
|
|
193
222
|
//#region src/files/getFileDependencies.ts
|
|
194
|
-
function
|
|
223
|
+
function x(e, t) {
|
|
195
224
|
return e.dependencies || [];
|
|
196
225
|
}
|
|
197
226
|
//#endregion
|
|
198
227
|
//#region src/files/checkDependOnFilesInFolder.ts
|
|
199
|
-
function
|
|
228
|
+
function S(e, t, n) {
|
|
229
|
+
if (e.files.length === 0) return {
|
|
230
|
+
pass: !1,
|
|
231
|
+
message: () => "No files matched the selector. The rule is vacuous."
|
|
232
|
+
};
|
|
200
233
|
let r = [];
|
|
201
234
|
for (let i of e.files) {
|
|
202
|
-
let a =
|
|
235
|
+
let a = x(i, e.projectData).some((e) => v(e, t));
|
|
203
236
|
n && a ? r.push(`File ${i.path} depends on files in ${t}, but it shouldn't.`) : !n && !a && r.push(`File ${i.path} does not depend on files in ${t}, but it should.`);
|
|
204
237
|
}
|
|
205
238
|
return {
|
|
@@ -209,7 +242,11 @@ function y(e, t, n) {
|
|
|
209
242
|
}
|
|
210
243
|
//#endregion
|
|
211
244
|
//#region src/files/fileCheckBeFreeOfCycles.ts
|
|
212
|
-
function
|
|
245
|
+
function C(e, t) {
|
|
246
|
+
if (e.files.length === 0) return {
|
|
247
|
+
pass: !1,
|
|
248
|
+
message: () => "No files matched the selector. The rule is vacuous."
|
|
249
|
+
};
|
|
213
250
|
let n = e.files.map((e) => e.path), r = e.archestProject;
|
|
214
251
|
if (!r) return {
|
|
215
252
|
pass: !0,
|
|
@@ -223,7 +260,7 @@ function b(e, t) {
|
|
|
223
260
|
}
|
|
224
261
|
//#endregion
|
|
225
262
|
//#region src/files/fileCheckHaveMaxCyclomaticComplexity.ts
|
|
226
|
-
function
|
|
263
|
+
function w(e, t, n) {
|
|
227
264
|
return o(e.files, (e) => e.path, (e) => {
|
|
228
265
|
let t = 0;
|
|
229
266
|
for (let n of e.functions) t += n.cyclomatic_complexity || 0;
|
|
@@ -233,7 +270,11 @@ function x(e, t, n) {
|
|
|
233
270
|
}
|
|
234
271
|
//#endregion
|
|
235
272
|
//#region src/files/fileCheckHaveMaxExportedFunctions.ts
|
|
236
|
-
function
|
|
273
|
+
function T(e, t, n) {
|
|
274
|
+
if (e.files.length === 0) return {
|
|
275
|
+
pass: !1,
|
|
276
|
+
message: () => "No files matched the selector. The rule is vacuous."
|
|
277
|
+
};
|
|
237
278
|
let r = [];
|
|
238
279
|
for (let i of e.files) {
|
|
239
280
|
let e = i.functions.filter((e) => e.is_exported).length, a = e > t;
|
|
@@ -246,7 +287,7 @@ function S(e, t, n) {
|
|
|
246
287
|
}
|
|
247
288
|
//#endregion
|
|
248
289
|
//#region src/shared/sharedCheckHaveMinMaintainabilityIndex.ts
|
|
249
|
-
function
|
|
290
|
+
function E(e, t, n, r, i, o) {
|
|
250
291
|
return a(e, o, (e) => {
|
|
251
292
|
let a = t(e), o = n(e), s = o < i, c = `${r} ${a || "Anonymous"}`;
|
|
252
293
|
return {
|
|
@@ -258,22 +299,68 @@ function C(e, t, n, r, i, o) {
|
|
|
258
299
|
}
|
|
259
300
|
//#endregion
|
|
260
301
|
//#region src/files/fileCheckHaveMinMaintainabilityIndex.ts
|
|
261
|
-
function
|
|
262
|
-
return
|
|
302
|
+
function D(e, t, n) {
|
|
303
|
+
return e.files.length === 0 ? {
|
|
304
|
+
pass: !1,
|
|
305
|
+
message: () => "No files matched the selector. The rule is vacuous."
|
|
306
|
+
} : E(e.files, (e) => e.path, (e) => {
|
|
307
|
+
let t = [...e.functions || [], ...e.classes || []];
|
|
308
|
+
if (t.length > 0) {
|
|
309
|
+
let e = t.reduce((e, t) => e + (t.maintainability_index || 0), 0);
|
|
310
|
+
return Math.round(e / t.length);
|
|
311
|
+
}
|
|
312
|
+
return 100;
|
|
313
|
+
}, "File", t, n);
|
|
263
314
|
}
|
|
264
315
|
//#endregion
|
|
265
316
|
//#region src/files/fileCheckMatchNamePattern.ts
|
|
266
|
-
function
|
|
317
|
+
function O(e, t, n) {
|
|
267
318
|
return p(e.files, (e) => e.path, "File", t, n);
|
|
268
319
|
}
|
|
269
320
|
//#endregion
|
|
321
|
+
//#region src/functions/locateFunctions.ts
|
|
322
|
+
function k(e, t, n) {
|
|
323
|
+
let r = e;
|
|
324
|
+
if (n?.inFolder) {
|
|
325
|
+
let i = e.map((e) => e._filePath), a = t.projectRoot || g(i);
|
|
326
|
+
r = r.filter((e) => _(e._filePath, a, n.inFolder));
|
|
327
|
+
}
|
|
328
|
+
if (n?.matchNamePattern) {
|
|
329
|
+
let e = typeof n.matchNamePattern == "string" ? new RegExp(n.matchNamePattern) : n.matchNamePattern;
|
|
330
|
+
r = r.filter((t) => t.name && e.test(t.name));
|
|
331
|
+
}
|
|
332
|
+
return n?.isTopLevel && (r = r.filter((e) => e.is_top_level)), {
|
|
333
|
+
type: "FunctionLocator",
|
|
334
|
+
functions: r,
|
|
335
|
+
projectData: t
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
270
339
|
//#region src/files/locateFiles.ts
|
|
271
|
-
function
|
|
340
|
+
function A(e, t, n, r) {
|
|
272
341
|
let i = e;
|
|
273
|
-
if (r?.inFolder
|
|
342
|
+
if (r?.inFolder) {
|
|
343
|
+
let n = e.map((e) => e.path), a = t.projectRoot || g(n);
|
|
344
|
+
i = i.filter((e) => _(e.path, a, r.inFolder));
|
|
345
|
+
}
|
|
346
|
+
if (r?.matchNamePattern) {
|
|
274
347
|
let e = typeof r.matchNamePattern == "string" ? new RegExp(r.matchNamePattern) : r.matchNamePattern;
|
|
275
348
|
i = i.filter((t) => e.test(t.path));
|
|
276
349
|
}
|
|
350
|
+
if (r?.hasFunction) {
|
|
351
|
+
let e = r.hasFunction;
|
|
352
|
+
i = i.filter((n) => k((n.functions || []).map((e) => ({
|
|
353
|
+
...e,
|
|
354
|
+
_filePath: n.path
|
|
355
|
+
})), t, e).functions.length > 0);
|
|
356
|
+
}
|
|
357
|
+
if (r?.hasClass) {
|
|
358
|
+
let e = r.hasClass;
|
|
359
|
+
i = i.filter((n) => y((n.classes || []).map((e) => ({
|
|
360
|
+
...e,
|
|
361
|
+
_filePath: n.path
|
|
362
|
+
})), t, e).classes.length > 0);
|
|
363
|
+
}
|
|
277
364
|
let a = {
|
|
278
365
|
type: "FileLocator",
|
|
279
366
|
files: i,
|
|
@@ -286,7 +373,7 @@ function E(e, t, n, r) {
|
|
|
286
373
|
}
|
|
287
374
|
//#endregion
|
|
288
375
|
//#region src/functions/functionCheckHaveExplicitReturnType.ts
|
|
289
|
-
function
|
|
376
|
+
function j(e, t) {
|
|
290
377
|
let n = [];
|
|
291
378
|
for (let r of e.functions) {
|
|
292
379
|
let e = r.name || "Anonymous Function", i = r.has_explicit_return_type;
|
|
@@ -299,46 +386,32 @@ function D(e, t) {
|
|
|
299
386
|
}
|
|
300
387
|
//#endregion
|
|
301
388
|
//#region src/functions/functionCheckHaveMaxCyclomaticComplexity.ts
|
|
302
|
-
function
|
|
389
|
+
function M(e, t, n) {
|
|
303
390
|
return o(e.functions, (e) => e.name, (e) => e.cyclomatic_complexity || 0, "Function", t, n);
|
|
304
391
|
}
|
|
305
392
|
//#endregion
|
|
306
393
|
//#region src/functions/functionCheckHaveMinMaintainabilityIndex.ts
|
|
307
|
-
function
|
|
308
|
-
return
|
|
394
|
+
function N(e, t, n) {
|
|
395
|
+
return E(e.functions, (e) => e.name, (e) => e.maintainability_index || 100, "Function", t, n);
|
|
309
396
|
}
|
|
310
397
|
//#endregion
|
|
311
398
|
//#region src/functions/functionCheckHaveModifier.ts
|
|
312
|
-
function
|
|
399
|
+
function ee(e, t, n) {
|
|
313
400
|
return c(e.functions, (e) => e.name, "Function", t, n);
|
|
314
401
|
}
|
|
315
402
|
//#endregion
|
|
316
403
|
//#region src/functions/functionCheckHaveNameMatchingFileName.ts
|
|
317
|
-
function
|
|
404
|
+
function P(e, t) {
|
|
318
405
|
return u(e.functions, (e) => e.name, "Function", t);
|
|
319
406
|
}
|
|
320
407
|
//#endregion
|
|
321
408
|
//#region src/functions/functionCheckMatchNamePattern.ts
|
|
322
|
-
function
|
|
409
|
+
function F(e, t, n) {
|
|
323
410
|
return p(e.functions, (e) => e.name, "Function", t, n);
|
|
324
411
|
}
|
|
325
412
|
//#endregion
|
|
326
|
-
//#region src/functions/locateFunctions.ts
|
|
327
|
-
function N(e, t, n) {
|
|
328
|
-
let r = e;
|
|
329
|
-
if (n?.inFolder && (r = r.filter((e) => e._filePath.includes(`/${n.inFolder}/`) || e._filePath.includes(`\\${n.inFolder}\\`))), n?.matchNamePattern) {
|
|
330
|
-
let e = typeof n.matchNamePattern == "string" ? new RegExp(n.matchNamePattern) : n.matchNamePattern;
|
|
331
|
-
r = r.filter((t) => t.name && e.test(t.name));
|
|
332
|
-
}
|
|
333
|
-
return n?.isTopLevel && (r = r.filter((e) => e.is_top_level)), {
|
|
334
|
-
type: "FunctionLocator",
|
|
335
|
-
functions: r,
|
|
336
|
-
projectData: t
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
//#endregion
|
|
340
413
|
//#region src/layers/checkLayeredArchitecture.ts
|
|
341
|
-
function
|
|
414
|
+
function I(e) {
|
|
342
415
|
let t = [];
|
|
343
416
|
for (let n of e.assertions) t.push(...n(e.files));
|
|
344
417
|
return {
|
|
@@ -348,7 +421,7 @@ function P(e) {
|
|
|
348
421
|
}
|
|
349
422
|
//#endregion
|
|
350
423
|
//#region src/layers/createLayeredArchitecture.ts
|
|
351
|
-
function
|
|
424
|
+
function L(e, t) {
|
|
352
425
|
return {
|
|
353
426
|
type: "LayeredArchitecture",
|
|
354
427
|
files: e,
|
|
@@ -359,45 +432,49 @@ function F(e, t) {
|
|
|
359
432
|
}
|
|
360
433
|
//#endregion
|
|
361
434
|
//#region src/layers/layer.ts
|
|
362
|
-
function
|
|
435
|
+
function R(e, t, n) {
|
|
363
436
|
return e.layers.set(t, n), e;
|
|
364
437
|
}
|
|
365
438
|
//#endregion
|
|
366
439
|
//#region src/layers/getLayerDependencies.ts
|
|
367
|
-
function
|
|
440
|
+
function z(e, t) {
|
|
368
441
|
return e.dependencies || [];
|
|
369
442
|
}
|
|
370
443
|
//#endregion
|
|
371
444
|
//#region src/layers/layerShouldNotBeAccessedByAnyLayer.ts
|
|
372
|
-
function
|
|
445
|
+
function B(e, t) {
|
|
373
446
|
if (!e.layers.has(t)) throw Error(`Layer ${t} is not defined`);
|
|
374
447
|
return e.assertions.push((n) => {
|
|
375
448
|
let r = [], i = e.layers.get(t);
|
|
376
449
|
for (let a of n) {
|
|
377
450
|
let n = a.path;
|
|
378
|
-
!n.includes(`/${i}/`) && !n.includes(`\\${i}\\`) &&
|
|
451
|
+
!n.includes(`/${i}/`) && !n.includes(`\\${i}\\`) && z(a, e.projectData).some((e) => e.includes(`/${i}/`) || e.includes(`\\${i}\\`)) && r.push(`File ${n} accesses layer ${t} but it shouldn't.`);
|
|
379
452
|
}
|
|
380
453
|
return r;
|
|
381
454
|
}), e;
|
|
382
455
|
}
|
|
383
456
|
//#endregion
|
|
384
457
|
//#region src/layers/layerShouldOnlyBeAccessedBy.ts
|
|
385
|
-
function
|
|
458
|
+
function V(e, t, n) {
|
|
386
459
|
if (!e.layers.has(t)) throw Error(`Layer ${t} is not defined`);
|
|
387
460
|
return e.assertions.push((r) => {
|
|
388
461
|
let i = [], a = e.layers.get(t), o = n.map((t) => e.layers.get(t));
|
|
389
462
|
for (let s of r) {
|
|
390
463
|
let r = s.path, c = o.some((e) => r.includes(`/${e}/`) || r.includes(`\\${e}\\`));
|
|
391
|
-
!r.includes(`/${a}/`) && !r.includes(`\\${a}\\`) && !c &&
|
|
464
|
+
!r.includes(`/${a}/`) && !r.includes(`\\${a}\\`) && !c && z(s, e.projectData).some((e) => e.includes(`/${a}/`) || e.includes(`\\${a}\\`)) && i.push(`File ${r} accesses layer ${t} but only ${n.join(", ")} are allowed.`);
|
|
392
465
|
}
|
|
393
466
|
return i;
|
|
394
467
|
}), e;
|
|
395
468
|
}
|
|
396
469
|
//#endregion
|
|
397
470
|
//#region src/properties/locateProperties.ts
|
|
398
|
-
function
|
|
471
|
+
function H(e, t, n) {
|
|
399
472
|
let r = e;
|
|
400
|
-
if (n?.inFolder
|
|
473
|
+
if (n?.inFolder) {
|
|
474
|
+
let i = e.map((e) => e._filePath), a = t.projectRoot || g(i);
|
|
475
|
+
r = r.filter((e) => _(e._filePath, a, n.inFolder));
|
|
476
|
+
}
|
|
477
|
+
if (n?.matchNamePattern) {
|
|
401
478
|
let e = typeof n.matchNamePattern == "string" ? new RegExp(n.matchNamePattern) : n.matchNamePattern;
|
|
402
479
|
r = r.filter((t) => e.test(t.name));
|
|
403
480
|
}
|
|
@@ -409,7 +486,7 @@ function B(e, t, n) {
|
|
|
409
486
|
}
|
|
410
487
|
//#endregion
|
|
411
488
|
//#region src/slices/locateSlices.ts
|
|
412
|
-
function
|
|
489
|
+
function U(e, t, n) {
|
|
413
490
|
let r = n.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "([^/\\\\]+)"), i = new RegExp(r), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
414
491
|
for (let t of e) {
|
|
415
492
|
let e = t.path.match(i);
|
|
@@ -428,7 +505,7 @@ function V(e, t, n) {
|
|
|
428
505
|
}
|
|
429
506
|
//#endregion
|
|
430
507
|
//#region src/project/parseProject.ts
|
|
431
|
-
function
|
|
508
|
+
function W(e = {}) {
|
|
432
509
|
let i = e.tsConfigFilePath || r.findConfigFile(process.cwd(), r.sys.fileExists, "tsconfig.json");
|
|
433
510
|
if (!i) throw Error("Could not find tsconfig.json");
|
|
434
511
|
let a = t(i), o = r.readConfigFile(i, r.sys.readFile);
|
|
@@ -436,47 +513,47 @@ function H(e = {}) {
|
|
|
436
513
|
let s = r.parseJsonConfigFileContent(o.config, r.sys, a, void 0, i, void 0, [{
|
|
437
514
|
extension: ".vue",
|
|
438
515
|
isMixedContent: !0,
|
|
439
|
-
scriptKind: r.ScriptKind.
|
|
516
|
+
scriptKind: r.ScriptKind.Deferred
|
|
440
517
|
}, {
|
|
441
518
|
extension: ".svelte",
|
|
442
519
|
isMixedContent: !0,
|
|
443
|
-
scriptKind: r.ScriptKind.
|
|
520
|
+
scriptKind: r.ScriptKind.Deferred
|
|
444
521
|
}]), c = n.parse(s.fileNames), l = JSON.parse(c.getProjectData());
|
|
445
|
-
return {
|
|
522
|
+
return l.projectRoot = a, {
|
|
446
523
|
projectData: l,
|
|
447
|
-
getFiles: (e) =>
|
|
448
|
-
getClasses: (e) =>
|
|
524
|
+
getFiles: (e) => A(l.files, l, c, e),
|
|
525
|
+
getClasses: (e) => y(l.files.flatMap((e) => e.classes.map((t) => ({
|
|
449
526
|
...t,
|
|
450
527
|
_filePath: e.path
|
|
451
528
|
}))), l, e),
|
|
452
529
|
layeredArchitecture: () => {
|
|
453
|
-
let e =
|
|
454
|
-
layer: (n, r) => (e =
|
|
530
|
+
let e = L(l.files, l), t = {
|
|
531
|
+
layer: (n, r) => (e = R(e, n, r), t),
|
|
455
532
|
whereLayer: (n) => ({
|
|
456
|
-
shouldNotBeAccessedByAnyLayer: () => (e =
|
|
457
|
-
shouldOnlyBeAccessedBy: (...r) => (e =
|
|
533
|
+
shouldNotBeAccessedByAnyLayer: () => (e = B(e, n), t),
|
|
534
|
+
shouldOnlyBeAccessedBy: (...r) => (e = V(e, n, r), t)
|
|
458
535
|
}),
|
|
459
|
-
check: () =>
|
|
536
|
+
check: () => I(e),
|
|
460
537
|
get data() {
|
|
461
538
|
return e;
|
|
462
539
|
}
|
|
463
540
|
};
|
|
464
541
|
return t;
|
|
465
542
|
},
|
|
466
|
-
getFunctions: (e) =>
|
|
543
|
+
getFunctions: (e) => k(l.files.flatMap((e) => e.functions.map((t) => ({
|
|
467
544
|
...t,
|
|
468
545
|
_filePath: e.path
|
|
469
546
|
}))), l, e),
|
|
470
|
-
getProperties: (e) =>
|
|
547
|
+
getProperties: (e) => H(l.files.flatMap((e) => e.properties.map((t) => ({
|
|
471
548
|
...t,
|
|
472
549
|
_filePath: e.path
|
|
473
550
|
}))), l, e),
|
|
474
|
-
getSlices: (e) =>
|
|
551
|
+
getSlices: (e) => U(l.files, l, e)
|
|
475
552
|
};
|
|
476
553
|
}
|
|
477
554
|
//#endregion
|
|
478
555
|
//#region src/properties/propertyCheckBeReadonly.ts
|
|
479
|
-
function
|
|
556
|
+
function G(e, t) {
|
|
480
557
|
let n = [];
|
|
481
558
|
for (let r of e.properties) {
|
|
482
559
|
let e = r.name || "Anonymous Property", i = r.is_readonly;
|
|
@@ -489,7 +566,11 @@ function U(e, t) {
|
|
|
489
566
|
}
|
|
490
567
|
//#endregion
|
|
491
568
|
//#region src/slices/sliceCheckBeFreeOfCycles.ts
|
|
492
|
-
function
|
|
569
|
+
function K(e, t) {
|
|
570
|
+
if (e.sliceIds.size === 0) return {
|
|
571
|
+
pass: !1,
|
|
572
|
+
message: () => "No slices matched the selector. The rule is vacuous."
|
|
573
|
+
};
|
|
493
574
|
let n = /* @__PURE__ */ new Map();
|
|
494
575
|
for (let t of e.sliceIds) n.set(t, /* @__PURE__ */ new Set());
|
|
495
576
|
for (let [t, r] of e.sliceFiles.entries()) for (let i of r) if (i.dependencies) for (let r of i.dependencies) {
|
|
@@ -517,7 +598,11 @@ function W(e, t) {
|
|
|
517
598
|
}
|
|
518
599
|
//#endregion
|
|
519
600
|
//#region src/slices/sliceCheckHaveMaxDistanceFromMainSequence.ts
|
|
520
|
-
function
|
|
601
|
+
function q(e, t, n) {
|
|
602
|
+
if (e.sliceIds.size === 0) return {
|
|
603
|
+
pass: !1,
|
|
604
|
+
message: () => "No slices matched the selector. The rule is vacuous."
|
|
605
|
+
};
|
|
521
606
|
let r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
522
607
|
for (let t of e.sliceIds) i.set(t, /* @__PURE__ */ new Set()), a.set(t, /* @__PURE__ */ new Set());
|
|
523
608
|
for (let [t, n] of e.sliceFiles.entries()) for (let r of n) if (r.dependencies) for (let n of r.dependencies) {
|
|
@@ -540,21 +625,21 @@ function G(e, t, n) {
|
|
|
540
625
|
}
|
|
541
626
|
//#endregion
|
|
542
627
|
//#region src/testUtils.ts
|
|
543
|
-
function
|
|
628
|
+
function J(e, t = "test.ts") {
|
|
544
629
|
return r.createSourceFile(t, e, r.ScriptTarget.Latest, !0);
|
|
545
630
|
}
|
|
546
|
-
function
|
|
631
|
+
function Y(e) {
|
|
547
632
|
return { files: e.map((e) => ({
|
|
548
633
|
path: e.fileName,
|
|
549
|
-
classes:
|
|
550
|
-
functions:
|
|
551
|
-
properties:
|
|
634
|
+
classes: Z(e),
|
|
635
|
+
functions: Q(e),
|
|
636
|
+
properties: $(e)
|
|
552
637
|
})) };
|
|
553
638
|
}
|
|
554
|
-
function
|
|
639
|
+
function X(e) {
|
|
555
640
|
return n.parseMock(JSON.stringify(e));
|
|
556
641
|
}
|
|
557
|
-
function
|
|
642
|
+
function Z(e) {
|
|
558
643
|
let t = [];
|
|
559
644
|
return r.forEachChild(e, (n) => {
|
|
560
645
|
if (r.isClassDeclaration(n)) {
|
|
@@ -581,7 +666,7 @@ function Y(e) {
|
|
|
581
666
|
}
|
|
582
667
|
}), t;
|
|
583
668
|
}
|
|
584
|
-
function
|
|
669
|
+
function Q(e) {
|
|
585
670
|
let t = [];
|
|
586
671
|
return r.forEachChild(e, (n) => {
|
|
587
672
|
if (r.isFunctionDeclaration(n) || r.isMethodDeclaration(n) || r.isArrowFunction(n)) {
|
|
@@ -597,7 +682,7 @@ function X(e) {
|
|
|
597
682
|
}
|
|
598
683
|
}), t;
|
|
599
684
|
}
|
|
600
|
-
function
|
|
685
|
+
function $(e) {
|
|
601
686
|
let t = [];
|
|
602
687
|
return r.forEachChild(e, (n) => {
|
|
603
688
|
r.isClassDeclaration(n) && n.members.forEach((n) => {
|
|
@@ -610,6 +695,6 @@ function Z(e) {
|
|
|
610
695
|
}), t;
|
|
611
696
|
}
|
|
612
697
|
//#endregion
|
|
613
|
-
export {
|
|
698
|
+
export { b as checkDependOnExternalModule, S as checkDependOnFilesInFolder, I as checkLayeredArchitecture, i as classCheckExtendClass, s as classCheckHaveMaxCyclomaticComplexity, l as classCheckHaveModifier, d as classCheckHaveNameMatchingFileName, f as classCheckImplementInterface, m as classCheckMatchNamePattern, h as classCheckResideInFolder, L as createLayeredArchitecture, X as createMockArchestProject, Y as createMockProgram, J as createSourceFile, C as fileCheckBeFreeOfCycles, w as fileCheckHaveMaxCyclomaticComplexity, T as fileCheckHaveMaxExportedFunctions, D as fileCheckHaveMinMaintainabilityIndex, O as fileCheckMatchNamePattern, j as functionCheckHaveExplicitReturnType, M as functionCheckHaveMaxCyclomaticComplexity, N as functionCheckHaveMinMaintainabilityIndex, ee as functionCheckHaveModifier, P as functionCheckHaveNameMatchingFileName, F as functionCheckMatchNamePattern, Z as getClasses, Q as getFunctions, $ as getProperties, R as layer, B as layerShouldNotBeAccessedByAnyLayer, V as layerShouldOnlyBeAccessedBy, y as locateClasses, A as locateFiles, k as locateFunctions, H as locateProperties, U as locateSlices, W as parseProject, G as propertyCheckBeReadonly, K as sliceCheckBeFreeOfCycles, q as sliceCheckHaveMaxDistanceFromMainSequence };
|
|
614
699
|
|
|
615
700
|
//# sourceMappingURL=index.mjs.map
|