@cleaver/breakcheck-core 0.2.5 → 0.3.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 (53) hide show
  1. package/README.md +94 -0
  2. package/dist/api/index.d.ts +23 -5
  3. package/dist/api/index.js +71 -10
  4. package/dist/api/index.js.map +1 -1
  5. package/dist/core/check/index.d.ts +9 -0
  6. package/dist/core/check/index.js +116 -0
  7. package/dist/core/check/index.js.map +1 -0
  8. package/dist/core/compare/classes/ComparisonRepository.d.ts +11 -0
  9. package/dist/core/compare/classes/ComparisonRepository.js +26 -4
  10. package/dist/core/compare/classes/ComparisonRepository.js.map +1 -1
  11. package/dist/core/compare/index.js +20 -4
  12. package/dist/core/compare/index.js.map +1 -1
  13. package/dist/core/crawler/index.d.ts +7 -1
  14. package/dist/core/crawler/index.js +17 -2
  15. package/dist/core/crawler/index.js.map +1 -1
  16. package/dist/core/rules/RulesEngine.js.map +1 -1
  17. package/dist/core/snapshot/classes/SnapshotRepository.d.ts +15 -2
  18. package/dist/core/snapshot/classes/SnapshotRepository.js +110 -9
  19. package/dist/core/snapshot/classes/SnapshotRepository.js.map +1 -1
  20. package/dist/core/snapshot/index.d.ts +2 -1
  21. package/dist/core/snapshot/index.js +5 -2
  22. package/dist/core/snapshot/index.js.map +1 -1
  23. package/dist/core/snapshot/route-coverage.d.ts +3 -0
  24. package/dist/core/snapshot/route-coverage.js +18 -0
  25. package/dist/core/snapshot/route-coverage.js.map +1 -0
  26. package/dist/core/snapshot/update-routes.d.ts +4 -0
  27. package/dist/core/snapshot/update-routes.js +58 -0
  28. package/dist/core/snapshot/update-routes.js.map +1 -0
  29. package/dist/core/view/index.d.ts +2 -1
  30. package/dist/core/view/index.js +4 -4
  31. package/dist/core/view/index.js.map +1 -1
  32. package/dist/index.d.ts +6 -2
  33. package/dist/index.js +4 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib/config.d.ts +18 -0
  36. package/dist/lib/config.js +363 -0
  37. package/dist/lib/config.js.map +1 -0
  38. package/dist/lib/crawlee-logger.js.map +1 -1
  39. package/dist/lib/logger.d.ts +5 -4
  40. package/dist/lib/logger.js.map +1 -1
  41. package/dist/lib/root.d.ts +1 -1
  42. package/dist/lib/root.js +17 -6
  43. package/dist/lib/root.js.map +1 -1
  44. package/dist/lib/storage.d.ts +12 -0
  45. package/dist/lib/storage.js +76 -0
  46. package/dist/lib/storage.js.map +1 -0
  47. package/dist/types/api.d.ts +42 -0
  48. package/dist/types/compare.d.ts +5 -2
  49. package/dist/types/config.d.ts +72 -0
  50. package/dist/types/config.js +2 -0
  51. package/dist/types/config.js.map +1 -0
  52. package/dist/types/rules.d.ts +8 -3
  53. package/package.json +11 -10
@@ -2,9 +2,12 @@
2
2
  import { Change } from "diff";
3
3
  /**
4
4
  * Represents a single difference found between two page snapshots
5
- * This is equivalent to the Change type from the diff package
5
+ * This retains the optional change flags exposed by earlier diff releases.
6
6
  */
7
- export type LineDiff = Change;
7
+ export type LineDiff = Omit<Change, "added" | "removed"> & {
8
+ added?: boolean;
9
+ removed?: boolean;
10
+ };
8
11
  /**
9
12
  * Represents the complete diff result for a single page
10
13
  */
@@ -0,0 +1,72 @@
1
+ import type { CrawlerType } from "./api.js";
2
+ /** The supported project configuration schema versions. */
3
+ export type ProjectConfigVersion = 1 | 2;
4
+ /** Crawl defaults that may be persisted in a project configuration file. */
5
+ export interface ProjectCrawlConfig {
6
+ crawlerType?: CrawlerType;
7
+ maxDepth?: number;
8
+ maxConcurrency?: number;
9
+ includePatterns?: string[];
10
+ excludePatterns?: string[];
11
+ }
12
+ /** Comparison defaults that may be persisted in a project configuration file. */
13
+ export interface ProjectComparisonConfig {
14
+ rulesDir?: string;
15
+ }
16
+ /** A command passed to Node's process launcher without shell interpretation. */
17
+ export type ProjectCommand = string[];
18
+ /** Local site lifecycle settings for `breakcheck check`. */
19
+ export interface ProjectCheckServerConfig {
20
+ start: ProjectCommand;
21
+ stop?: ProjectCommand;
22
+ cwd?: string;
23
+ env?: Record<string, string>;
24
+ readyPath?: string;
25
+ timeoutMs?: number;
26
+ }
27
+ /** Settings for a repeatable exact-route regression check. */
28
+ export interface ProjectCheckConfig {
29
+ routesFile: string;
30
+ baselineSnapshot: string;
31
+ prepare?: ProjectCommand[];
32
+ server?: ProjectCheckServerConfig;
33
+ reportDir?: string;
34
+ }
35
+ /** The JSON shape accepted by `breakcheck.config.json`. */
36
+ export interface ProjectConfig {
37
+ version: ProjectConfigVersion;
38
+ baseUrl?: string;
39
+ storageDir?: string;
40
+ crawl?: ProjectCrawlConfig;
41
+ comparison?: ProjectComparisonConfig;
42
+ check?: ProjectCheckConfig;
43
+ }
44
+ /** A validated project configuration together with the file that supplied it. */
45
+ export interface LoadedProjectConfig {
46
+ configPath: string;
47
+ config: ProjectConfig;
48
+ }
49
+ /** Options controlling explicit configuration selection and discovery. */
50
+ export interface ProjectConfigLoadOptions {
51
+ cwd?: string;
52
+ configPath?: string;
53
+ noConfig?: boolean;
54
+ }
55
+ /** A validated configuration with paths resolved for downstream operations. */
56
+ export interface ResolvedProjectConfig {
57
+ configPath?: string;
58
+ storageDir: string;
59
+ baseUrl?: string;
60
+ crawl: ProjectCrawlConfig;
61
+ rulesDir?: string;
62
+ check?: ResolvedProjectCheckConfig;
63
+ }
64
+ /** Check configuration with filesystem paths resolved from the config file. */
65
+ export interface ResolvedProjectCheckConfig extends Omit<ProjectCheckConfig, "routesFile" | "reportDir" | "server"> {
66
+ configDirectory: string;
67
+ routesFile: string;
68
+ reportDir: string;
69
+ server?: Omit<ProjectCheckServerConfig, "cwd"> & {
70
+ cwd: string;
71
+ };
72
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
@@ -72,11 +72,16 @@ export interface Region {
72
72
  name: string;
73
73
  }
74
74
  /**
75
- * The root structure of the JSON rules document
75
+ * The serialized JSON document produced from the rules DSL.
76
76
  */
77
- export interface Ruleset {
78
- name: string;
77
+ export interface RulesDocument {
79
78
  rules: Rule[];
80
79
  /** Named regions are optional for backwards-compatible inline rulesets. */
81
80
  regions?: Region[];
82
81
  }
82
+ /**
83
+ * A named runtime ruleset used by comparisons.
84
+ */
85
+ export interface Ruleset extends RulesDocument {
86
+ name: string;
87
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleaver/breakcheck-core",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -32,16 +32,17 @@
32
32
  "dev": "tsc -w"
33
33
  },
34
34
  "dependencies": {
35
- "cheerio": "1.0.0-rc.12",
35
+ "cheerio": "^1.2.0",
36
36
  "chevrotain": "^13.2.0",
37
- "crawlee": "^3.18.1",
38
- "diff": "^5.2.2",
37
+ "crawlee": "^3.18.2",
38
+ "diff": "^9.0.0",
39
39
  "diff2html": "^3.4.56",
40
- "express": "^5.2.1",
41
- "find-up": "^7.0.0",
42
- "js-beautify": "^1.15.4",
43
- "pino": "^9.14.0",
44
- "pino-pretty": "^11.2.1",
45
- "playwright": "^1.62.1"
40
+ "domhandler": "^5.0.3",
41
+ "express": "^5.3.0",
42
+ "find-up": "^8.0.0",
43
+ "js-beautify": "^2.0.3",
44
+ "pino": "^10.4.0",
45
+ "pino-pretty": "^13.2.0",
46
+ "playwright": "^1.64.0"
46
47
  }
47
48
  }