@featurevisor/core 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/coverage/clover.xml +1184 -466
  3. package/coverage/coverage-final.json +21 -6
  4. package/coverage/lcov-report/builder/allocator.ts.html +1 -1
  5. package/coverage/lcov-report/builder/buildScopedConditions.ts.html +1 -1
  6. package/coverage/lcov-report/builder/buildScopedDatafile.ts.html +1 -1
  7. package/coverage/lcov-report/builder/buildScopedSegments.ts.html +1 -1
  8. package/coverage/lcov-report/builder/index.html +1 -1
  9. package/coverage/lcov-report/builder/revision.ts.html +1 -1
  10. package/coverage/lcov-report/builder/traffic.ts.html +1 -1
  11. package/coverage/lcov-report/config/index.html +116 -0
  12. package/coverage/lcov-report/config/projectConfig.ts.html +676 -0
  13. package/coverage/lcov-report/datasource/adapter.ts.html +235 -0
  14. package/coverage/lcov-report/datasource/datasource.ts.html +862 -0
  15. package/coverage/lcov-report/datasource/filesystemAdapter.ts.html +1354 -0
  16. package/coverage/lcov-report/datasource/index.html +161 -0
  17. package/coverage/lcov-report/datasource/index.ts.html +94 -0
  18. package/coverage/lcov-report/index.html +74 -29
  19. package/coverage/lcov-report/linter/attributeSchema.ts.html +175 -0
  20. package/coverage/lcov-report/linter/checkCircularDependency.ts.html +220 -0
  21. package/coverage/lcov-report/linter/checkPercentageExceedingSlot.ts.html +268 -0
  22. package/coverage/lcov-report/linter/conditionSchema.ts.html +38 -38
  23. package/coverage/lcov-report/linter/featureSchema.ts.html +363 -363
  24. package/coverage/lcov-report/linter/groupSchema.ts.html +226 -0
  25. package/coverage/lcov-report/linter/index.html +124 -19
  26. package/coverage/lcov-report/linter/lintProject.ts.html +1840 -0
  27. package/coverage/lcov-report/linter/printError.ts.html +238 -0
  28. package/coverage/lcov-report/linter/schema.ts.html +116 -116
  29. package/coverage/lcov-report/linter/segmentSchema.ts.html +5 -5
  30. package/coverage/lcov-report/linter/testSchema.ts.html +550 -0
  31. package/coverage/lcov-report/list/index.html +1 -1
  32. package/coverage/lcov-report/list/matrix.ts.html +1 -1
  33. package/coverage/lcov-report/parsers/index.html +20 -5
  34. package/coverage/lcov-report/parsers/index.ts.html +151 -0
  35. package/coverage/lcov-report/parsers/json.ts.html +2 -2
  36. package/coverage/lcov-report/parsers/yml.ts.html +6 -6
  37. package/coverage/lcov-report/tester/cliFormat.ts.html +103 -0
  38. package/coverage/lcov-report/tester/helpers.ts.html +1 -1
  39. package/coverage/lcov-report/tester/index.html +20 -5
  40. package/coverage/lcov-report/utils/git.ts.html +481 -0
  41. package/coverage/lcov-report/utils/index.html +116 -0
  42. package/coverage/lcov.info +2179 -859
  43. package/lib/linter/lintProject.d.ts +17 -1
  44. package/lib/linter/lintProject.js +191 -198
  45. package/lib/linter/lintProject.js.map +1 -1
  46. package/lib/linter/lintProject.spec.d.ts +1 -0
  47. package/lib/linter/lintProject.spec.js +86 -0
  48. package/lib/linter/lintProject.spec.js.map +1 -0
  49. package/lib/linter/printError.d.ts +7 -0
  50. package/lib/linter/printError.js +30 -15
  51. package/lib/linter/printError.js.map +1 -1
  52. package/package.json +2 -2
  53. package/src/linter/lintProject.spec.ts +115 -0
  54. package/src/linter/lintProject.ts +256 -254
  55. package/src/linter/printError.ts +40 -16
@@ -2,26 +2,50 @@ import { ZodError } from "zod";
2
2
 
3
3
  import { CLI_FORMAT_RED } from "../tester/cliFormat";
4
4
 
5
- export function printZodError(e: ZodError) {
6
- const { issues } = e;
5
+ export interface LintIssueFromZod {
6
+ message: string;
7
+ path: (string | number)[];
8
+ code?: string;
9
+ value?: unknown;
10
+ }
7
11
 
8
- issues.forEach((issue) => {
9
- if (issue.code === "invalid_union" && issue.path.length === 0 && issue.unionErrors.length > 0) {
10
- // invalid_union
11
- const lastUnionError = issue.unionErrors[issue.unionErrors.length - 1];
12
- console.error(CLI_FORMAT_RED, ` => Error: ${lastUnionError.issues[0].message}`);
13
- console.error(" Path:", lastUnionError.issues[0].path.join("."));
14
- } else {
15
- // others
16
- console.error(CLI_FORMAT_RED, ` => Error: ${issue.message}`);
17
- console.error(" Path:", issue.path.join("."));
12
+ export function getLintIssuesFromZodError(e: ZodError): LintIssueFromZod[] {
13
+ return e.issues
14
+ .map((issue) => {
15
+ if (
16
+ issue.code === "invalid_union" &&
17
+ issue.path.length === 0 &&
18
+ issue.unionErrors.length > 0
19
+ ) {
20
+ const lastUnionError = issue.unionErrors[issue.unionErrors.length - 1];
21
+ const nestedIssue = lastUnionError.issues[0];
18
22
 
19
- const receivedValue = (issue as any).received;
20
- if (typeof receivedValue !== "undefined" && receivedValue !== "undefined") {
21
- console.error(" Value:", receivedValue);
23
+ return {
24
+ message: nestedIssue.message,
25
+ path: nestedIssue.path,
26
+ code: nestedIssue.code,
27
+ value: (nestedIssue as any).received,
28
+ };
22
29
  }
23
- }
24
30
 
31
+ return {
32
+ message: issue.message,
33
+ path: issue.path,
34
+ code: issue.code,
35
+ value: (issue as any).received,
36
+ };
37
+ })
38
+ .filter(Boolean);
39
+ }
40
+
41
+ export function printZodError(e: ZodError) {
42
+ const issues = getLintIssuesFromZodError(e);
43
+ issues.forEach((issue) => {
44
+ console.error(CLI_FORMAT_RED, ` => Error: ${issue.message}`);
45
+ console.error(" Path:", issue.path.join("."));
46
+ if (typeof issue.value !== "undefined" && issue.value !== "undefined") {
47
+ console.error(" Value:", issue.value);
48
+ }
25
49
  console.error("");
26
50
  });
27
51
  }