@arx-hq/collectors-browser 0.0.0-stage → 0.4.0-alpha.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/LICENSE +21 -0
- package/README.md +25 -2
- package/dist/index.d.ts +120 -0
- package/dist/index.js +1769 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arx Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @arx-hq/collectors-browser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Part of the [Arx](https://github.com/mehmetkoyunco/arx) 360-degree deterministic software quality, security, and production-readiness harness.
|
|
4
|
+
|
|
5
|
+
Wave 2 modular UI/web collectors covering `DESIGN`, `UX_A11Y`, `PERF`, and `SEO` with optional `playwright` and `@axe-core/playwright` peer probes.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @arx-hq/collectors-browser
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createBrowserCollectors } from "@arx-hq/collectors-browser";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Documentation & Source
|
|
20
|
+
|
|
21
|
+
- Repository: https://github.com/mehmetkoyunco/arx
|
|
22
|
+
- CLI Quick Start: `npx @arx-hq/cli init --profile saas-web && npx @arx-hq/cli check`
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT © Arx Contributors
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ViewportConfig, CollectorPlugin, MetricFinding, BudgetsConfig } from '@arx-hq/contracts';
|
|
2
|
+
|
|
3
|
+
interface OverlapIssue {
|
|
4
|
+
readonly selectorA: string;
|
|
5
|
+
readonly selectorB: string;
|
|
6
|
+
}
|
|
7
|
+
interface TapTargetIssue {
|
|
8
|
+
readonly selector: string;
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
}
|
|
12
|
+
interface BrokenImageIssue {
|
|
13
|
+
readonly src: string;
|
|
14
|
+
}
|
|
15
|
+
interface AxeViolationSummary {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly impact: "critical" | "serious" | "moderate" | "minor";
|
|
18
|
+
readonly help: string;
|
|
19
|
+
readonly nodesCount: number;
|
|
20
|
+
}
|
|
21
|
+
interface CwvMetrics {
|
|
22
|
+
readonly lcpMs?: number;
|
|
23
|
+
readonly cls?: number;
|
|
24
|
+
readonly ttfbMs?: number;
|
|
25
|
+
}
|
|
26
|
+
interface ViewportProbeSnapshot {
|
|
27
|
+
readonly viewport: ViewportConfig;
|
|
28
|
+
readonly scrollWidth: number;
|
|
29
|
+
readonly clientWidth: number;
|
|
30
|
+
readonly overlaps: readonly OverlapIssue[];
|
|
31
|
+
readonly smallTapTargets: readonly TapTargetIssue[];
|
|
32
|
+
readonly brokenImages: readonly BrokenImageIssue[];
|
|
33
|
+
readonly hasFavicon: boolean;
|
|
34
|
+
readonly consoleErrors: readonly string[];
|
|
35
|
+
readonly pageErrors: readonly string[];
|
|
36
|
+
readonly axeViolations: readonly AxeViolationSummary[];
|
|
37
|
+
readonly cwv: CwvMetrics;
|
|
38
|
+
}
|
|
39
|
+
interface BrowserProbeResult {
|
|
40
|
+
readonly available: boolean;
|
|
41
|
+
readonly reason?: string;
|
|
42
|
+
readonly url: string;
|
|
43
|
+
readonly viewports: readonly ViewportProbeSnapshot[];
|
|
44
|
+
}
|
|
45
|
+
interface BrowserProbe {
|
|
46
|
+
probeUrl(url: string, viewports: readonly ViewportConfig[]): Promise<BrowserProbeResult>;
|
|
47
|
+
}
|
|
48
|
+
declare function createPlaywrightBrowserProbe(): BrowserProbe;
|
|
49
|
+
|
|
50
|
+
declare function evaluateDesignProbe(probeResult: BrowserProbeResult): MetricFinding[];
|
|
51
|
+
declare function createDesignBrowserCollector(probe?: BrowserProbe): CollectorPlugin;
|
|
52
|
+
|
|
53
|
+
interface TokenScanResult {
|
|
54
|
+
readonly findings: readonly MetricFinding[];
|
|
55
|
+
readonly totalStyleLines: number;
|
|
56
|
+
}
|
|
57
|
+
declare function scanDesignTokens(relFile: string, content: string): TokenScanResult;
|
|
58
|
+
declare function createDesignTokensCollector(): CollectorPlugin;
|
|
59
|
+
|
|
60
|
+
declare function scanPerfAstPatterns(relFile: string, content: string): MetricFinding[];
|
|
61
|
+
declare function createPerfAstCollector(): CollectorPlugin;
|
|
62
|
+
|
|
63
|
+
declare function createPerfBundleCollector(): CollectorPlugin;
|
|
64
|
+
|
|
65
|
+
declare function evaluateCwvProbe(probeResult: BrowserProbeResult, budgets: BudgetsConfig): MetricFinding[];
|
|
66
|
+
declare function createPerfCwvCollector(probe?: BrowserProbe): CollectorPlugin;
|
|
67
|
+
|
|
68
|
+
declare function evaluateSeoHtml(html: string, sourceLabel: string, options: {
|
|
69
|
+
readonly hasRobotsTxt: boolean;
|
|
70
|
+
readonly hasSitemapXml: boolean;
|
|
71
|
+
readonly isUrl: boolean;
|
|
72
|
+
}): MetricFinding[];
|
|
73
|
+
declare function createSeoAuditCollector(fetchFn?: typeof fetch): CollectorPlugin;
|
|
74
|
+
|
|
75
|
+
declare function evaluateUxProbe(probeResult: BrowserProbeResult): MetricFinding[];
|
|
76
|
+
declare function crawlInternalLinks(appUrl: string, fetchFn?: typeof fetch): Promise<MetricFinding[]>;
|
|
77
|
+
declare function createUxBrowserCollector(probe?: BrowserProbe, fetchFn?: typeof fetch): CollectorPlugin;
|
|
78
|
+
|
|
79
|
+
declare function scanUxStaticAst(relFile: string, content: string): MetricFinding[];
|
|
80
|
+
declare function createUxStaticCollector(): CollectorPlugin;
|
|
81
|
+
|
|
82
|
+
interface ParsedHtmlDocument {
|
|
83
|
+
readonly htmlLang?: string;
|
|
84
|
+
readonly title?: string;
|
|
85
|
+
readonly description?: string;
|
|
86
|
+
readonly canonical?: string;
|
|
87
|
+
readonly hasFavicon: boolean;
|
|
88
|
+
readonly ogTags: Record<string, string>;
|
|
89
|
+
readonly twitterTags: Record<string, string>;
|
|
90
|
+
readonly headings: readonly {
|
|
91
|
+
readonly level: number;
|
|
92
|
+
readonly text: string;
|
|
93
|
+
}[];
|
|
94
|
+
readonly hasMainLandmark: boolean;
|
|
95
|
+
readonly imagesWithoutAlt: readonly string[];
|
|
96
|
+
readonly internalLinks: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
declare function parseHtmlDocument(html: string): ParsedHtmlDocument;
|
|
99
|
+
|
|
100
|
+
declare function toPosix(filePath: string): string;
|
|
101
|
+
declare function createIgnoreMatcher(ignorePaths: readonly string[]): (relPosixPath: string) => boolean;
|
|
102
|
+
declare function walkProjectFiles(options: {
|
|
103
|
+
readonly rootDir: string;
|
|
104
|
+
readonly ignorePaths: readonly string[];
|
|
105
|
+
readonly extensions?: ReadonlySet<string>;
|
|
106
|
+
readonly includeBuildDirs?: boolean;
|
|
107
|
+
}): Promise<string[]>;
|
|
108
|
+
declare function pathExists(absPath: string): Promise<boolean>;
|
|
109
|
+
declare function readTextIfExists(absPath: string): Promise<string | null>;
|
|
110
|
+
declare function isSuppressedAtLine(lines: readonly string[], oneBasedLine: number, metricId: string): boolean;
|
|
111
|
+
|
|
112
|
+
declare const COLLECTORS_BROWSER_SCHEMA_VERSION: "1.0.0";
|
|
113
|
+
|
|
114
|
+
interface BrowserCollectorOptions {
|
|
115
|
+
readonly probe?: BrowserProbe;
|
|
116
|
+
readonly fetchFn?: typeof fetch;
|
|
117
|
+
}
|
|
118
|
+
declare function createBrowserCollectors(options?: BrowserCollectorOptions): CollectorPlugin[];
|
|
119
|
+
|
|
120
|
+
export { type AxeViolationSummary, type BrokenImageIssue, type BrowserCollectorOptions, type BrowserProbe, type BrowserProbeResult, COLLECTORS_BROWSER_SCHEMA_VERSION, type CwvMetrics, type OverlapIssue, type ParsedHtmlDocument, type TapTargetIssue, type TokenScanResult, type ViewportProbeSnapshot, crawlInternalLinks, createBrowserCollectors, createDesignBrowserCollector, createDesignTokensCollector, createIgnoreMatcher, createPerfAstCollector, createPerfBundleCollector, createPerfCwvCollector, createPlaywrightBrowserProbe, createSeoAuditCollector, createUxBrowserCollector, createUxStaticCollector, evaluateCwvProbe, evaluateDesignProbe, evaluateSeoHtml, evaluateUxProbe, isSuppressedAtLine, parseHtmlDocument, pathExists, readTextIfExists, scanDesignTokens, scanPerfAstPatterns, scanUxStaticAst, toPosix, walkProjectFiles };
|