cypress-annotate 0.1.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.
- package/AGENTS.md +65 -0
- package/DOCS/pipeline.md +258 -0
- package/LICENSE +21 -0
- package/README.md +360 -0
- package/dist/annotate-image.d.ts +60 -0
- package/dist/annotate-image.d.ts.map +1 -0
- package/dist/annotate-image.js +160 -0
- package/dist/annotate.d.ts +9 -0
- package/dist/annotate.d.ts.map +1 -0
- package/dist/annotate.js +82 -0
- package/dist/browser/collect-elements.js +158 -0
- package/dist/browser/measure-target.js +69 -0
- package/dist/claude-reasoner.d.ts +17 -0
- package/dist/claude-reasoner.d.ts.map +1 -0
- package/dist/claude-reasoner.js +192 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +74 -0
- package/dist/cypress/commands.d.ts +50 -0
- package/dist/cypress/commands.d.ts.map +1 -0
- package/dist/cypress/commands.js +68 -0
- package/dist/cypress/failure-explainer.d.ts +45 -0
- package/dist/cypress/failure-explainer.d.ts.map +1 -0
- package/dist/cypress/failure-explainer.js +123 -0
- package/dist/cypress/failure-hook.d.ts +30 -0
- package/dist/cypress/failure-hook.d.ts.map +1 -0
- package/dist/cypress/failure-hook.js +148 -0
- package/dist/cypress/failure-report.d.ts +41 -0
- package/dist/cypress/failure-report.d.ts.map +1 -0
- package/dist/cypress/failure-report.js +14 -0
- package/dist/cypress/failure-selector.d.ts +45 -0
- package/dist/cypress/failure-selector.d.ts.map +1 -0
- package/dist/cypress/failure-selector.js +107 -0
- package/dist/cypress/measure-dom.d.ts +52 -0
- package/dist/cypress/measure-dom.d.ts.map +1 -0
- package/dist/cypress/measure-dom.js +132 -0
- package/dist/cypress/scroll-into-view.d.ts +15 -0
- package/dist/cypress/scroll-into-view.d.ts.map +1 -0
- package/dist/cypress/scroll-into-view.js +17 -0
- package/dist/cypress/task.d.ts +47 -0
- package/dist/cypress/task.d.ts.map +1 -0
- package/dist/cypress/task.js +69 -0
- package/dist/draw.d.ts +19 -0
- package/dist/draw.d.ts.map +1 -0
- package/dist/draw.js +177 -0
- package/dist/finder.d.ts +68 -0
- package/dist/finder.d.ts.map +1 -0
- package/dist/finder.js +64 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/inventory.d.ts +33 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +88 -0
- package/dist/measure.d.ts +11 -0
- package/dist/measure.d.ts.map +1 -0
- package/dist/measure.js +145 -0
- package/dist/pipeline.d.ts +60 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +115 -0
- package/dist/types.d.ts +115 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +113 -0
- package/skills/annotate-bug/SKILL.md +121 -0
- package/skills/cypress-annotate/SKILL.md +154 -0
- package/src/browser/collect-elements.js +158 -0
- package/src/browser/measure-target.js +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EAAW,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,aAAa,EACb,YAAY,EACZ,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKvF,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACpF,mBAAmB,YAAY,CAAC;AAEhC,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAgBzB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { annotate } from './annotate.js';
|
|
2
|
+
export { annotate } from './annotate.js';
|
|
3
|
+
export { annotateImage, resolveScale, } from './annotate-image.js';
|
|
4
|
+
export { measureElement, measureRegion, readPageMetrics } from './measure.js';
|
|
5
|
+
export { buildOverlaySvg, compositeOverlay } from './draw.js';
|
|
6
|
+
export { collectInventory, renderInventory } from './inventory.js';
|
|
7
|
+
// ClaudeReasoner is not re-exported here - import it from 'cypress-annotate/reasoner'
|
|
8
|
+
// instead. It is the only piece of this package with a real (non-type-only)
|
|
9
|
+
// dependency on @anthropic-ai/sdk; keeping it out of this barrel means every
|
|
10
|
+
// other export here stays usable with neither the SDK nor a peer install of it.
|
|
11
|
+
export { findingsToAnnotations, gatherReasonerInput, ReplayReasoner, SEVERITY_COLORS, } from './finder.js';
|
|
12
|
+
export { runBugHunt } from './pipeline.js';
|
|
13
|
+
/**
|
|
14
|
+
* One-shot: open a URL, annotate it, close the browser.
|
|
15
|
+
*
|
|
16
|
+
* Playwright is loaded lazily, on the first call, rather than imported at the
|
|
17
|
+
* top of this file. `playwright` is an optional peer dependency - a consumer
|
|
18
|
+
* who only wants annotateImage()/the Cypress plugin (neither of which touch a
|
|
19
|
+
* browser at all) should never be forced to have it installed just because
|
|
20
|
+
* this function exists somewhere else in the same package.
|
|
21
|
+
*/
|
|
22
|
+
export async function captureAnnotated(url, annotations, options = {}) {
|
|
23
|
+
let browser;
|
|
24
|
+
try {
|
|
25
|
+
const { chromium } = await import('playwright');
|
|
26
|
+
browser = await chromium.launch({ headless: options.headless ?? true, ...options.launch });
|
|
27
|
+
const context = await browser.newContext({
|
|
28
|
+
viewport: options.viewport ?? { width: 1280, height: 800 },
|
|
29
|
+
deviceScaleFactor: options.deviceScaleFactor ?? 2,
|
|
30
|
+
});
|
|
31
|
+
const page = await context.newPage();
|
|
32
|
+
await page.goto(url, { waitUntil: 'networkidle' });
|
|
33
|
+
if (options.settleMs)
|
|
34
|
+
await page.waitForTimeout(options.settleMs);
|
|
35
|
+
return await annotate(page, annotations, options);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
await browser?.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
import type { CssRect } from './types.js';
|
|
3
|
+
export interface InventoryItem {
|
|
4
|
+
/** Handle the model refers to, e.g. "e12". */
|
|
5
|
+
ref: string;
|
|
6
|
+
/**
|
|
7
|
+
* Selector chain that is guaranteed to resolve, because the attribute it
|
|
8
|
+
* matches was injected during collection.
|
|
9
|
+
*/
|
|
10
|
+
target: string[];
|
|
11
|
+
/** Readable selector for the bug report, derived from ids/test-ids/structure. */
|
|
12
|
+
reportSelector: string;
|
|
13
|
+
tag: string;
|
|
14
|
+
role: string | null;
|
|
15
|
+
/** Accessible-ish name: aria-label, alt, placeholder, value, or trimmed text. */
|
|
16
|
+
name: string;
|
|
17
|
+
rect: CssRect;
|
|
18
|
+
inViewport: boolean;
|
|
19
|
+
/** Empty for the main document. */
|
|
20
|
+
framePath: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface InventoryOptions {
|
|
23
|
+
/** Cap on items sent to the model, to bound token cost. Default 120. */
|
|
24
|
+
limit?: number;
|
|
25
|
+
/** Ignore anything smaller than this many CSS px on either axis. Default 8. */
|
|
26
|
+
minSize?: number;
|
|
27
|
+
/** Only collect elements currently intersecting the viewport. Default false. */
|
|
28
|
+
viewportOnly?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function collectInventory(page: Page, options?: InventoryOptions): Promise<InventoryItem[]>;
|
|
31
|
+
/** Compact text rendering of the inventory for the model prompt. */
|
|
32
|
+
export declare function renderInventory(items: InventoryItem[]): string;
|
|
33
|
+
//# sourceMappingURL=inventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory.d.ts","sourceRoot":"","sources":["../src/inventory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAS,IAAI,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,iFAAiF;IACjF,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AA8DD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC,CAkC1B;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CAW9D"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
const REF_ATTR = 'data-annot-ref';
|
|
5
|
+
const FRAME_ATTR = 'data-annot-frame';
|
|
6
|
+
const COLLECTOR_PATH = join(dirname(fileURLToPath(import.meta.url)), 'browser', 'collect-elements.js');
|
|
7
|
+
let collectorSource;
|
|
8
|
+
async function loadCollector() {
|
|
9
|
+
collectorSource ??= await readFile(COLLECTOR_PATH, 'utf8');
|
|
10
|
+
return collectorSource;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Run the collector in a frame.
|
|
14
|
+
*
|
|
15
|
+
* The source is inlined into a self-invoking expression rather than passed as a
|
|
16
|
+
* function: Playwright will not call a function supplied as a string with
|
|
17
|
+
* arguments, and passing the TypeScript function directly breaks because
|
|
18
|
+
* esbuild rewrites it to reference a `__name` helper that the page lacks.
|
|
19
|
+
*/
|
|
20
|
+
async function runCollector(frame, args) {
|
|
21
|
+
const source = await loadCollector();
|
|
22
|
+
return frame.evaluate(`(${source})(${JSON.stringify(args)})`);
|
|
23
|
+
}
|
|
24
|
+
/** Tag same-origin child frames so their contents can be addressed by a chain. */
|
|
25
|
+
async function tagFrames(page) {
|
|
26
|
+
const map = new Map();
|
|
27
|
+
let index = 0;
|
|
28
|
+
for (const frame of page.frames()) {
|
|
29
|
+
if (frame === page.mainFrame())
|
|
30
|
+
continue;
|
|
31
|
+
try {
|
|
32
|
+
const element = await frame.frameElement();
|
|
33
|
+
const id = `f${++index}`;
|
|
34
|
+
await element.evaluate((el, [attr, value]) => el.setAttribute(attr, value), [FRAME_ATTR, id]);
|
|
35
|
+
map.set(frame, `[${FRAME_ATTR}="${id}"]`);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Cross-origin or detached frames cannot be tagged; they are skipped and
|
|
39
|
+
// their contents simply will not appear in the inventory.
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return map;
|
|
43
|
+
}
|
|
44
|
+
export async function collectInventory(page, options = {}) {
|
|
45
|
+
const limit = options.limit ?? 120;
|
|
46
|
+
const args = {
|
|
47
|
+
refAttr: REF_ATTR,
|
|
48
|
+
minSize: options.minSize ?? 8,
|
|
49
|
+
viewportOnly: options.viewportOnly ?? false,
|
|
50
|
+
};
|
|
51
|
+
const items = [];
|
|
52
|
+
const mainRaw = await runCollector(page.mainFrame(), { ...args, prefix: 'e' });
|
|
53
|
+
for (const raw of mainRaw) {
|
|
54
|
+
items.push({ ...raw, target: [`[${REF_ATTR}="${raw.ref}"]`], framePath: [] });
|
|
55
|
+
}
|
|
56
|
+
const frames = await tagFrames(page);
|
|
57
|
+
let frameIndex = 0;
|
|
58
|
+
for (const [frame, frameSelector] of frames) {
|
|
59
|
+
frameIndex++;
|
|
60
|
+
try {
|
|
61
|
+
const raw = await runCollector(frame, { ...args, prefix: `f${frameIndex}e` });
|
|
62
|
+
for (const item of raw) {
|
|
63
|
+
items.push({
|
|
64
|
+
...item,
|
|
65
|
+
target: [frameSelector, `[${REF_ATTR}="${item.ref}"]`],
|
|
66
|
+
framePath: [frameSelector],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Same reasoning as tagFrames: an inaccessible frame is skipped.
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return items.slice(0, limit);
|
|
75
|
+
}
|
|
76
|
+
/** Compact text rendering of the inventory for the model prompt. */
|
|
77
|
+
export function renderInventory(items) {
|
|
78
|
+
return items
|
|
79
|
+
.map((item) => {
|
|
80
|
+
const r = item.rect;
|
|
81
|
+
const box = `${Math.round(r.x)},${Math.round(r.y)} ${Math.round(r.width)}x${Math.round(r.height)}`;
|
|
82
|
+
const role = item.role ? ` role=${item.role}` : '';
|
|
83
|
+
const frame = item.framePath.length > 0 ? ' [in iframe]' : '';
|
|
84
|
+
const name = item.name ? ` "${item.name}"` : '';
|
|
85
|
+
return `[${item.ref}] <${item.tag}>${role}${name} @ ${box}${frame} — ${item.reportSelector}`;
|
|
86
|
+
})
|
|
87
|
+
.join('\n');
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
import type { MeasuredElement, PageMetrics, Region } from './types.js';
|
|
3
|
+
export declare function readPageMetrics(page: Page): Promise<PageMetrics>;
|
|
4
|
+
export declare function measureElement(page: Page, selector: string | string[], metrics: PageMetrics): Promise<MeasuredElement>;
|
|
5
|
+
/**
|
|
6
|
+
* Turn a percentage region into the same shape a measured element has, so the
|
|
7
|
+
* rest of the pipeline cannot tell the difference.
|
|
8
|
+
*/
|
|
9
|
+
export declare function measureRegion(region: Region, metrics: PageMetrics): MeasuredElement;
|
|
10
|
+
export declare function scrollElementIntoView(page: Page, selector: string | string[]): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../src/measure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAyB,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAW,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKhF,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAoBtE;AAwCD,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,eAAe,CAAC,CA+D1B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,eAAe,CAiCnF;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAIlG"}
|
package/dist/measure.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export async function readPageMetrics(page) {
|
|
2
|
+
return page.evaluate(() => {
|
|
3
|
+
const doc = document.documentElement;
|
|
4
|
+
const body = document.body;
|
|
5
|
+
return {
|
|
6
|
+
devicePixelRatio: window.devicePixelRatio,
|
|
7
|
+
scrollX: window.scrollX,
|
|
8
|
+
scrollY: window.scrollY,
|
|
9
|
+
// window.innerWidth/Height, not documentElement.clientWidth/Height: in
|
|
10
|
+
// quirks mode (a page with no doctype - Hacker News, plenty of internal
|
|
11
|
+
// tools) the root element reports the *content* size, so clientHeight can
|
|
12
|
+
// be the full document height. innerWidth/Height is also exactly the
|
|
13
|
+
// viewport Playwright was configured with, which is what the screenshot
|
|
14
|
+
// dimensions are derived from.
|
|
15
|
+
viewportWidth: window.innerWidth,
|
|
16
|
+
viewportHeight: window.innerHeight,
|
|
17
|
+
documentWidth: Math.max(doc.scrollWidth, body ? body.scrollWidth : 0),
|
|
18
|
+
documentHeight: Math.max(doc.scrollHeight, body ? body.scrollHeight : 0),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Walk a frame chain, accumulating the offset of each iframe's content origin
|
|
24
|
+
* within the top-level viewport. A frame's own internal scrolling needs no
|
|
25
|
+
* correction: `getBoundingClientRect()` inside that frame is already relative
|
|
26
|
+
* to the frame's own viewport.
|
|
27
|
+
*/
|
|
28
|
+
async function resolveTarget(page, chain) {
|
|
29
|
+
const targetSelector = chain[chain.length - 1];
|
|
30
|
+
if (targetSelector === undefined)
|
|
31
|
+
throw new Error('Empty selector chain.');
|
|
32
|
+
let host = page;
|
|
33
|
+
let offsetX = 0;
|
|
34
|
+
let offsetY = 0;
|
|
35
|
+
for (const frameSelector of chain.slice(0, -1)) {
|
|
36
|
+
const frameElement = host.locator(frameSelector);
|
|
37
|
+
if ((await frameElement.count()) === 0) {
|
|
38
|
+
throw new Error(`Frame selector matched nothing: ${frameSelector}`);
|
|
39
|
+
}
|
|
40
|
+
const origin = await frameElement.first().evaluate((el) => {
|
|
41
|
+
const rect = el.getBoundingClientRect();
|
|
42
|
+
const style = getComputedStyle(el);
|
|
43
|
+
return {
|
|
44
|
+
x: rect.left + parseFloat(style.borderLeftWidth) + parseFloat(style.paddingLeft),
|
|
45
|
+
y: rect.top + parseFloat(style.borderTopWidth) + parseFloat(style.paddingTop),
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
offsetX += origin.x;
|
|
49
|
+
offsetY += origin.y;
|
|
50
|
+
host = host.frameLocator(frameSelector);
|
|
51
|
+
}
|
|
52
|
+
return { locator: host.locator(targetSelector), offsetX, offsetY };
|
|
53
|
+
}
|
|
54
|
+
export async function measureElement(page, selector, metrics) {
|
|
55
|
+
const chain = Array.isArray(selector) ? selector : [selector];
|
|
56
|
+
const label = chain.join(' >>> ');
|
|
57
|
+
const { locator, offsetX, offsetY } = await resolveTarget(page, chain);
|
|
58
|
+
const matchCount = await locator.count();
|
|
59
|
+
if (matchCount === 0)
|
|
60
|
+
throw new Error(`Selector matched no elements: ${label}`);
|
|
61
|
+
const measured = await locator.first().evaluate((el) => {
|
|
62
|
+
const rect = el.getBoundingClientRect();
|
|
63
|
+
// An element inside a fixed subtree does not move with document scroll, so
|
|
64
|
+
// its document-space position is undefined in the usual sense.
|
|
65
|
+
let fixed = false;
|
|
66
|
+
for (let node = el; node; node = node.parentElement) {
|
|
67
|
+
if (getComputedStyle(node).position === 'fixed') {
|
|
68
|
+
fixed = true;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
x: rect.x,
|
|
74
|
+
y: rect.y,
|
|
75
|
+
width: rect.width,
|
|
76
|
+
height: rect.height,
|
|
77
|
+
isFixed: fixed,
|
|
78
|
+
tagName: el.tagName.toLowerCase(),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
const viewportRect = {
|
|
82
|
+
x: measured.x + offsetX,
|
|
83
|
+
y: measured.y + offsetY,
|
|
84
|
+
width: measured.width,
|
|
85
|
+
height: measured.height,
|
|
86
|
+
};
|
|
87
|
+
const documentRect = measured.isFixed
|
|
88
|
+
? { ...viewportRect }
|
|
89
|
+
: {
|
|
90
|
+
...viewportRect,
|
|
91
|
+
x: viewportRect.x + metrics.scrollX,
|
|
92
|
+
y: viewportRect.y + metrics.scrollY,
|
|
93
|
+
};
|
|
94
|
+
const inViewport = viewportRect.x + viewportRect.width > 0 &&
|
|
95
|
+
viewportRect.y + viewportRect.height > 0 &&
|
|
96
|
+
viewportRect.x < metrics.viewportWidth &&
|
|
97
|
+
viewportRect.y < metrics.viewportHeight;
|
|
98
|
+
return {
|
|
99
|
+
selector: label,
|
|
100
|
+
source: 'selector',
|
|
101
|
+
viewportRect,
|
|
102
|
+
documentRect,
|
|
103
|
+
isFixed: measured.isFixed,
|
|
104
|
+
inViewport,
|
|
105
|
+
framePath: chain.slice(0, -1),
|
|
106
|
+
tagName: measured.tagName,
|
|
107
|
+
matchCount,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Turn a percentage region into the same shape a measured element has, so the
|
|
112
|
+
* rest of the pipeline cannot tell the difference.
|
|
113
|
+
*/
|
|
114
|
+
export function measureRegion(region, metrics) {
|
|
115
|
+
const basis = region.basis ?? 'viewport';
|
|
116
|
+
const baseWidth = basis === 'document' ? metrics.documentWidth : metrics.viewportWidth;
|
|
117
|
+
const baseHeight = basis === 'document' ? metrics.documentHeight : metrics.viewportHeight;
|
|
118
|
+
const rect = {
|
|
119
|
+
x: (region.xPct / 100) * baseWidth,
|
|
120
|
+
y: (region.yPct / 100) * baseHeight,
|
|
121
|
+
width: (region.widthPct / 100) * baseWidth,
|
|
122
|
+
height: (region.heightPct / 100) * baseHeight,
|
|
123
|
+
};
|
|
124
|
+
const viewportRect = basis === 'document' ? { ...rect, x: rect.x - metrics.scrollX, y: rect.y - metrics.scrollY } : rect;
|
|
125
|
+
const documentRect = basis === 'document' ? rect : { ...rect, x: rect.x + metrics.scrollX, y: rect.y + metrics.scrollY };
|
|
126
|
+
return {
|
|
127
|
+
selector: `region ${region.xPct}%,${region.yPct}% ${region.widthPct}x${region.heightPct}% of ${basis}`,
|
|
128
|
+
source: 'region',
|
|
129
|
+
viewportRect,
|
|
130
|
+
documentRect,
|
|
131
|
+
isFixed: false,
|
|
132
|
+
inViewport: viewportRect.x + viewportRect.width > 0 &&
|
|
133
|
+
viewportRect.y + viewportRect.height > 0 &&
|
|
134
|
+
viewportRect.x < metrics.viewportWidth &&
|
|
135
|
+
viewportRect.y < metrics.viewportHeight,
|
|
136
|
+
framePath: [],
|
|
137
|
+
tagName: 'region',
|
|
138
|
+
matchCount: 1,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export async function scrollElementIntoView(page, selector) {
|
|
142
|
+
const chain = Array.isArray(selector) ? selector : [selector];
|
|
143
|
+
const { locator } = await resolveTarget(page, chain);
|
|
144
|
+
await locator.first().scrollIntoViewIfNeeded();
|
|
145
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
import { type BugFinding, type Reasoner } from './finder.js';
|
|
3
|
+
import type { InventoryItem } from './inventory.js';
|
|
4
|
+
import type { Annotation, PixelRect } from './types.js';
|
|
5
|
+
export interface BugHuntOptions {
|
|
6
|
+
ticket: string;
|
|
7
|
+
reasoner: Reasoner;
|
|
8
|
+
/** Also render a cropped close-up per finding. Default true. */
|
|
9
|
+
perFinding?: boolean;
|
|
10
|
+
/** Context around each finding in its close-up, CSS px. Default 90. */
|
|
11
|
+
cropPadding?: number;
|
|
12
|
+
/** Cap on viewport passes down the page. Default 6. */
|
|
13
|
+
maxPasses?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface AnnotatedFinding {
|
|
16
|
+
/** 1-based, stable across the whole hunt; matches the overview marker. */
|
|
17
|
+
number: number;
|
|
18
|
+
finding: BugFinding;
|
|
19
|
+
annotation: Annotation;
|
|
20
|
+
/** Which element the annotation actually landed on, for auditing. */
|
|
21
|
+
resolvedTo: string;
|
|
22
|
+
/** Readable selector for the ticket, when the finding resolved to an element. */
|
|
23
|
+
reportSelector: string | null;
|
|
24
|
+
/** Which viewport pass reported it. */
|
|
25
|
+
pass: number;
|
|
26
|
+
image: Buffer;
|
|
27
|
+
drawnRect: PixelRect | undefined;
|
|
28
|
+
warnings: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface HuntPass {
|
|
31
|
+
index: number;
|
|
32
|
+
scrollY: number;
|
|
33
|
+
inventorySize: number;
|
|
34
|
+
findingCount: number;
|
|
35
|
+
/** Every finding from this pass on one viewport screenshot. */
|
|
36
|
+
overview: Buffer | null;
|
|
37
|
+
}
|
|
38
|
+
export interface BugHuntResult {
|
|
39
|
+
/** De-duplicated across passes. */
|
|
40
|
+
annotated: AnnotatedFinding[];
|
|
41
|
+
unresolved: {
|
|
42
|
+
finding: BugFinding;
|
|
43
|
+
reason: string;
|
|
44
|
+
}[];
|
|
45
|
+
passes: HuntPass[];
|
|
46
|
+
/** Union of every pass's inventory, keyed by readable selector. */
|
|
47
|
+
inventory: InventoryItem[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Work down the page one viewport at a time, reasoning about each and
|
|
51
|
+
* annotating whatever comes back.
|
|
52
|
+
*
|
|
53
|
+
* A pass is the unit of correctness here: the inventory, the screenshot the
|
|
54
|
+
* model reasons over, and any percentage region it returns must all share one
|
|
55
|
+
* scroll position. Mixing scroll positions between those three is what makes
|
|
56
|
+
* region fallbacks land in the wrong place, so each pass scrolls, settles, and
|
|
57
|
+
* only then measures.
|
|
58
|
+
*/
|
|
59
|
+
export declare function runBugHunt(page: Page, options: BugHuntOptions): Promise<BugHuntResult>;
|
|
60
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,UAAU,EAAE;QAAE,OAAO,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,mEAAmE;IACnE,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAqH5F"}
|
package/dist/pipeline.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { annotate } from './annotate.js';
|
|
2
|
+
import { findingsToAnnotations, gatherReasonerInput, } from './finder.js';
|
|
3
|
+
import { readPageMetrics } from './measure.js';
|
|
4
|
+
/**
|
|
5
|
+
* Work down the page one viewport at a time, reasoning about each and
|
|
6
|
+
* annotating whatever comes back.
|
|
7
|
+
*
|
|
8
|
+
* A pass is the unit of correctness here: the inventory, the screenshot the
|
|
9
|
+
* model reasons over, and any percentage region it returns must all share one
|
|
10
|
+
* scroll position. Mixing scroll positions between those three is what makes
|
|
11
|
+
* region fallbacks land in the wrong place, so each pass scrolls, settles, and
|
|
12
|
+
* only then measures.
|
|
13
|
+
*/
|
|
14
|
+
export async function runBugHunt(page, options) {
|
|
15
|
+
const maxPasses = options.maxPasses ?? 6;
|
|
16
|
+
// Reuse the one definition of these metrics rather than re-deriving them:
|
|
17
|
+
// getting the viewport height wrong here silently collapses the sweep to a
|
|
18
|
+
// single pass on any quirks-mode page.
|
|
19
|
+
const { viewportHeight, documentHeight } = await readPageMetrics(page);
|
|
20
|
+
// Overlap each pass by 10% so a bug straddling a boundary is fully visible in
|
|
21
|
+
// at least one of them.
|
|
22
|
+
const step = Math.max(1, Math.floor(viewportHeight * 0.9));
|
|
23
|
+
const positions = [];
|
|
24
|
+
for (let y = 0; positions.length < maxPasses; y += step) {
|
|
25
|
+
const clamped = Math.min(y, Math.max(0, documentHeight - viewportHeight));
|
|
26
|
+
if (positions.length > 0 && clamped === positions[positions.length - 1])
|
|
27
|
+
break;
|
|
28
|
+
positions.push(clamped);
|
|
29
|
+
if (clamped + viewportHeight >= documentHeight)
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const annotated = [];
|
|
33
|
+
const unresolvedByDescription = new Map();
|
|
34
|
+
const passes = [];
|
|
35
|
+
const inventoryBySelector = new Map();
|
|
36
|
+
const seenKeys = new Set();
|
|
37
|
+
let findingNumber = 0;
|
|
38
|
+
for (const [passIndex, scrollY] of positions.entries()) {
|
|
39
|
+
await page.evaluate((y) => window.scrollTo(0, y), scrollY);
|
|
40
|
+
await page.waitForTimeout(120);
|
|
41
|
+
const input = await gatherReasonerInput(page, options.ticket, true);
|
|
42
|
+
for (const item of input.inventory) {
|
|
43
|
+
if (!inventoryBySelector.has(item.reportSelector)) {
|
|
44
|
+
inventoryBySelector.set(item.reportSelector, item);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const findings = await options.reasoner.propose(input);
|
|
48
|
+
const resolution = findingsToAnnotations(findings, input.inventory);
|
|
49
|
+
for (const entry of resolution.unresolved) {
|
|
50
|
+
// An element below the fold on this pass may resolve on the next one, so
|
|
51
|
+
// key by description and reconcile against the annotated set at the end.
|
|
52
|
+
if (!unresolvedByDescription.has(entry.finding.description)) {
|
|
53
|
+
unresolvedByDescription.set(entry.finding.description, entry);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// A bug visible in the overlap between two passes gets reported twice.
|
|
57
|
+
const fresh = resolution.resolved
|
|
58
|
+
.filter((entry) => !seenKeys.has(entry.key))
|
|
59
|
+
.map((entry) => ({ entry, number: ++findingNumber }));
|
|
60
|
+
for (const { entry } of fresh)
|
|
61
|
+
seenKeys.add(entry.key);
|
|
62
|
+
let overview = null;
|
|
63
|
+
if (fresh.length > 0) {
|
|
64
|
+
// Full sentences would cover the rest of the page here, so the overview
|
|
65
|
+
// carries a marker and the close-up carries the description.
|
|
66
|
+
const result = await annotate(page, fresh.map(({ entry, number }) => ({
|
|
67
|
+
...entry.annotation,
|
|
68
|
+
label: `#${number} ${entry.finding.severity}`,
|
|
69
|
+
})), { mode: 'viewport', scrollIntoView: false });
|
|
70
|
+
overview = result.image;
|
|
71
|
+
}
|
|
72
|
+
passes.push({
|
|
73
|
+
index: passIndex,
|
|
74
|
+
scrollY,
|
|
75
|
+
inventorySize: input.inventory.length,
|
|
76
|
+
findingCount: fresh.length,
|
|
77
|
+
overview,
|
|
78
|
+
});
|
|
79
|
+
if (options.perFinding ?? true) {
|
|
80
|
+
for (const { entry, number } of fresh) {
|
|
81
|
+
const labelled = {
|
|
82
|
+
...entry.annotation,
|
|
83
|
+
label: `#${number} ${entry.finding.severity}: ${entry.finding.description}`,
|
|
84
|
+
};
|
|
85
|
+
const result = await annotate(page, [labelled], {
|
|
86
|
+
mode: 'element',
|
|
87
|
+
cropPadding: options.cropPadding ?? 90,
|
|
88
|
+
// Staying at this pass's scroll position keeps percentage regions
|
|
89
|
+
// meaningful; annotate() converts to document space from here.
|
|
90
|
+
scrollToTop: false,
|
|
91
|
+
style: { dimOutside: 0.45 },
|
|
92
|
+
});
|
|
93
|
+
annotated.push({
|
|
94
|
+
number,
|
|
95
|
+
finding: entry.finding,
|
|
96
|
+
annotation: labelled,
|
|
97
|
+
resolvedTo: result.elements[0]?.selector ?? 'unknown',
|
|
98
|
+
reportSelector: entry.item?.reportSelector ?? null,
|
|
99
|
+
pass: passIndex,
|
|
100
|
+
image: result.image,
|
|
101
|
+
drawnRect: result.drawnRects[0],
|
|
102
|
+
warnings: result.warnings,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const annotatedDescriptions = new Set(annotated.map((a) => a.finding.description));
|
|
108
|
+
const unresolved = Array.from(unresolvedByDescription.values()).filter((entry) => !annotatedDescriptions.has(entry.finding.description));
|
|
109
|
+
return {
|
|
110
|
+
annotated,
|
|
111
|
+
unresolved,
|
|
112
|
+
passes,
|
|
113
|
+
inventory: Array.from(inventoryBySelector.values()),
|
|
114
|
+
};
|
|
115
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** A rectangle in CSS pixels, relative to the top-level viewport. */
|
|
2
|
+
export interface CssRect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/** A rectangle in image pixels, relative to the screenshot's top-left corner. */
|
|
9
|
+
export interface PixelRect {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/** What the page looked like at the moment of measurement. */
|
|
16
|
+
export interface PageMetrics {
|
|
17
|
+
/** window.devicePixelRatio, as the page itself reports it. */
|
|
18
|
+
devicePixelRatio: number;
|
|
19
|
+
scrollX: number;
|
|
20
|
+
scrollY: number;
|
|
21
|
+
/** Layout viewport, CSS px. */
|
|
22
|
+
viewportWidth: number;
|
|
23
|
+
viewportHeight: number;
|
|
24
|
+
/** Full scrollable document, CSS px. */
|
|
25
|
+
documentWidth: number;
|
|
26
|
+
documentHeight: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fallback target for when the agent cannot name a clean selector: a rectangle
|
|
30
|
+
* given as percentages, so it is independent of viewport size.
|
|
31
|
+
*/
|
|
32
|
+
export interface Region {
|
|
33
|
+
xPct: number;
|
|
34
|
+
yPct: number;
|
|
35
|
+
widthPct: number;
|
|
36
|
+
heightPct: number;
|
|
37
|
+
/** Percentages of the viewport (default) or of the whole document. */
|
|
38
|
+
basis?: 'viewport' | 'document';
|
|
39
|
+
}
|
|
40
|
+
export interface MeasuredElement {
|
|
41
|
+
/** Human-readable description of what was targeted. */
|
|
42
|
+
selector: string;
|
|
43
|
+
/** Whether this came from a selector match or a percentage region. */
|
|
44
|
+
source: 'selector' | 'region';
|
|
45
|
+
/** Viewport-relative, CSS px, including any ancestor-iframe offsets. */
|
|
46
|
+
viewportRect: CssRect;
|
|
47
|
+
/** Document-relative, CSS px (viewportRect + scroll, except for fixed elements). */
|
|
48
|
+
documentRect: CssRect;
|
|
49
|
+
/** True if the element or an ancestor is position:fixed, so it does not scroll. */
|
|
50
|
+
isFixed: boolean;
|
|
51
|
+
/** True if any part of the element is inside the current viewport. */
|
|
52
|
+
inViewport: boolean;
|
|
53
|
+
/** Extra frames the element was found inside, outermost first. */
|
|
54
|
+
framePath: string[];
|
|
55
|
+
tagName: string;
|
|
56
|
+
/** How many elements the selector matched. Anything above 1 is ambiguous. */
|
|
57
|
+
matchCount: number;
|
|
58
|
+
}
|
|
59
|
+
export type ShapeKind = 'box' | 'circle' | 'arrow';
|
|
60
|
+
export interface AnnotationStyle {
|
|
61
|
+
/** CSS colour for the outline and label background. */
|
|
62
|
+
color?: string;
|
|
63
|
+
/** Outline width in CSS px; scaled by devicePixelRatio when drawn. */
|
|
64
|
+
strokeWidth?: number;
|
|
65
|
+
/** Grow the shape outwards by this many CSS px so it does not sit on the element's edge. */
|
|
66
|
+
padding?: number;
|
|
67
|
+
/** Corner radius in CSS px. */
|
|
68
|
+
radius?: number;
|
|
69
|
+
/** Darken everything outside the annotated regions. 0 disables. */
|
|
70
|
+
dimOutside?: number;
|
|
71
|
+
labelFontSize?: number;
|
|
72
|
+
labelColor?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface Annotation {
|
|
75
|
+
/**
|
|
76
|
+
* CSS selector, or a frame chain like ["iframe#checkout", ".pay-button"].
|
|
77
|
+
* Mutually exclusive with `region`; exactly one must be set.
|
|
78
|
+
*/
|
|
79
|
+
selector?: string | string[];
|
|
80
|
+
/** Percentage-based fallback when no selector is available. */
|
|
81
|
+
region?: Region;
|
|
82
|
+
label?: string;
|
|
83
|
+
shape?: ShapeKind;
|
|
84
|
+
style?: AnnotationStyle;
|
|
85
|
+
}
|
|
86
|
+
export type ScreenshotMode = 'viewport' | 'fullPage' | 'element';
|
|
87
|
+
export interface AnnotateOptions {
|
|
88
|
+
/** Where to screenshot: the viewport, the whole document, or a crop around the element. */
|
|
89
|
+
mode?: ScreenshotMode;
|
|
90
|
+
/** For mode 'element', how much context to keep around the element, in CSS px. */
|
|
91
|
+
cropPadding?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Scroll to the top before capturing a full-page screenshot. Chromium renders
|
|
94
|
+
* fixed elements once, at whatever scroll offset the capture starts from, so
|
|
95
|
+
* starting at the top is the only offset where fixed and static elements agree.
|
|
96
|
+
*/
|
|
97
|
+
scrollToTop?: boolean;
|
|
98
|
+
/** Bring the first annotated element into view before a viewport capture. */
|
|
99
|
+
scrollIntoView?: boolean;
|
|
100
|
+
style?: AnnotationStyle;
|
|
101
|
+
}
|
|
102
|
+
export interface AnnotateResult {
|
|
103
|
+
image: Buffer;
|
|
104
|
+
/** The same capture without the overlay, cropped identically. For verification. */
|
|
105
|
+
rawImage: Buffer;
|
|
106
|
+
/** Pixel dimensions of the returned image. */
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
metrics: PageMetrics;
|
|
110
|
+
elements: MeasuredElement[];
|
|
111
|
+
/** Final drawn rectangles, in image pixels. Useful for asserting alignment. */
|
|
112
|
+
drawnRects: PixelRect[];
|
|
113
|
+
warnings: string[];
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|