@mizchi/vlmkit-capture 0.24.0 → 0.28.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/dist/batch-prescan.d.mts +1 -3
- package/dist/batch-prescan.mjs +1 -2
- package/dist/capture-config.d.mts +1 -3
- package/dist/capture-config.mjs +1 -2
- package/dist/capturer.d.mts +1 -3
- package/dist/capturer.mjs +1 -2
- package/dist/cloudflare-quick-actions.d.mts +1 -3
- package/dist/cloudflare-quick-actions.mjs +1 -2
- package/dist/crater-client.d.mts +1 -3
- package/dist/crater-client.mjs +1 -2
- package/dist/crater-smoke.d.mts +1 -3
- package/dist/crater-smoke.mjs +1 -2
- package/dist/crater-wasm.d.mts +1 -3
- package/dist/crater-wasm.mjs +1 -2
- package/dist/detection-types.d.mts +1 -3
- package/dist/gates/crater.gate.d.mts +0 -2
- package/dist/gates/crater.gate.mjs +1 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -5
- package/dist/playwright-analyzer.d.mts +1 -3
- package/dist/playwright-analyzer.mjs +1 -2
- package/dist/playwright-launch-error.d.mts +1 -3
- package/dist/playwright-launch-error.mjs +1 -2
- package/dist/prescanner.d.mts +1 -3
- package/dist/prescanner.mjs +1 -2
- package/dist/route-capture.d.mts +1 -2
- package/dist/route-capture.mjs +1 -2
- package/dist/viewport-discovery.d.mts +1 -2
- package/dist/viewport-discovery.mjs +1 -2
- package/package.json +3 -3
package/dist/batch-prescan.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CraterClient, CraterCssMutation, PaintNode, PaintTreeChange } from "./crater-client.mjs";
|
|
2
|
-
//#region src/batch-prescan.d.ts
|
|
3
2
|
export interface BatchPrescanRequest {
|
|
4
3
|
/** Stable id (echoed back in the result). */
|
|
5
4
|
id: string;
|
|
@@ -45,5 +44,4 @@ export declare function mutationsForSelectorBlockRemoval(selector: string, prope
|
|
|
45
44
|
* True when at least one of the batch-prescan results found a paint-tree
|
|
46
45
|
* signal. Used to short-circuit follow-up per-viewport captures.
|
|
47
46
|
*/
|
|
48
|
-
export declare function hasAnyBatchPrescanSignal(results: BatchPrescanResult[]): boolean;
|
|
49
|
-
//#endregion
|
|
47
|
+
export declare function hasAnyBatchPrescanSignal(results: BatchPrescanResult[]): boolean;
|
package/dist/batch-prescan.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diffPaintTrees } from "./crater-client.mjs";
|
|
2
|
-
|
|
2
|
+
// src/batch-prescan.ts
|
|
3
3
|
/**
|
|
4
4
|
* Drive `batchRender` and return per-variant paint-tree diffs against a
|
|
5
5
|
* caller-supplied baseline tree. The baseline tree must come from a render
|
|
@@ -62,5 +62,4 @@ function mutationsForSelectorBlockRemoval(selector, properties) {
|
|
|
62
62
|
function hasAnyBatchPrescanSignal(results) {
|
|
63
63
|
return results.some((result) => !result.missing && result.changes.length > 0);
|
|
64
64
|
}
|
|
65
|
-
//#endregion
|
|
66
65
|
export { hasAnyBatchPrescanSignal, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, runBatchPrescan };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/capture-config.d.ts
|
|
2
1
|
export interface CaptureRoute {
|
|
3
2
|
name: string;
|
|
4
3
|
path: string;
|
|
@@ -45,5 +44,4 @@ export declare function resolveCaptureRoutes(options?: LoadCaptureConfigOptions)
|
|
|
45
44
|
* Helper for unit tests / non-Playwright callers: read & normalize a file.
|
|
46
45
|
*/
|
|
47
46
|
export declare function loadCaptureConfigFromFile(configPath: string): CaptureConfig;
|
|
48
|
-
export declare function captureConfigDir(configPath: string): string;
|
|
49
|
-
//#endregion
|
|
47
|
+
export declare function captureConfigDir(configPath: string): string;
|
package/dist/capture-config.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/capture-config.ts
|
|
4
4
|
/**
|
|
5
5
|
* Capture configuration loader for `vlmkit workflow init|capture`.
|
|
6
6
|
*
|
|
@@ -174,5 +174,4 @@ function loadCaptureConfigFromFile(configPath) {
|
|
|
174
174
|
function captureConfigDir(configPath) {
|
|
175
175
|
return dirname(configPath);
|
|
176
176
|
}
|
|
177
|
-
//#endregion
|
|
178
177
|
export { DEFAULT_CAPTURE_BASE_URL, DEFAULT_CAPTURE_CONFIG_FILE, DEFAULT_CAPTURE_ROUTES, captureConfigDir, loadCaptureConfigFromFile, parseCaptureConfig, resolveCaptureRoutes, routeNameFromPath };
|
package/dist/capturer.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Browser } from "playwright";
|
|
2
|
-
//#region src/capturer.d.ts
|
|
3
2
|
export type CaptureBackendKind = "local" | "cloudflare-cdp";
|
|
4
3
|
export interface CaptureBackend {
|
|
5
4
|
readonly kind: CaptureBackendKind;
|
|
@@ -39,5 +38,4 @@ export interface ResolvedCaptureBackend {
|
|
|
39
38
|
* + `CLOUDFLARE_API_TOKEN`) regardless of how the backend was selected, so
|
|
40
39
|
* CI configs can stay declarative.
|
|
41
40
|
*/
|
|
42
|
-
export declare function resolveCaptureBackend(options?: ResolveCaptureBackendOptions): ResolvedCaptureBackend;
|
|
43
|
-
//#endregion
|
|
41
|
+
export declare function resolveCaptureBackend(options?: ResolveCaptureBackendOptions): ResolvedCaptureBackend;
|
package/dist/capturer.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { chromium } from "playwright";
|
|
2
2
|
import { launchBrowser } from "@mizchi/vlmkit-core/browser-launch.ts";
|
|
3
|
-
|
|
3
|
+
// src/capturer.ts
|
|
4
4
|
/**
|
|
5
5
|
* Browser launch abstraction.
|
|
6
6
|
*
|
|
@@ -91,5 +91,4 @@ function resolveCaptureBackend(options = {}) {
|
|
|
91
91
|
default: throw new Error(`Unknown capture backend: ${choice}`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
//#endregion
|
|
95
94
|
export { buildCloudflareCdpUrl, createCloudflareCdpCapturer, createLocalCapturer, resolveCaptureBackend };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cloudflare-quick-actions.d.ts
|
|
2
1
|
export type CloudflareQuickAction = "screenshot" | "crawl";
|
|
3
2
|
export interface CloudflareQuickActionsConfig {
|
|
4
3
|
accountId: string;
|
|
@@ -109,5 +108,4 @@ export declare function createCloudflareQuickActionsClient(config: CloudflareQui
|
|
|
109
108
|
startCrawl(input: CloudflareCrawlRequest): Promise<CloudflareCrawlStartResult>;
|
|
110
109
|
getCrawlResult(jobId: string): Promise<CloudflareCrawlResult>;
|
|
111
110
|
};
|
|
112
|
-
export declare function extractCloudflareCrawlRoutes(result: CloudflareCrawlResult, options?: ExtractCloudflareCrawlRoutesOptions): CloudflareCrawlRoute[];
|
|
113
|
-
//#endregion
|
|
111
|
+
export declare function extractCloudflareCrawlRoutes(result: CloudflareCrawlResult, options?: ExtractCloudflareCrawlRoutesOptions): CloudflareCrawlRoute[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cloudflare-quick-actions.ts
|
|
2
2
|
function buildCloudflareQuickActionEndpoint(input) {
|
|
3
3
|
const base = `${(input.apiBase ?? "https://api.cloudflare.com/client/v4").replace(/\/$/u, "")}/accounts/${encodeURIComponent(input.accountId)}/browser-rendering/${input.action}`;
|
|
4
4
|
return input.jobId ? `${base}/${encodeURIComponent(input.jobId)}` : base;
|
|
@@ -138,5 +138,4 @@ function readNumber(record, key) {
|
|
|
138
138
|
const value = record[key];
|
|
139
139
|
return typeof value === "number" ? value : void 0;
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { buildCloudflareQuickActionEndpoint, createCloudflareQuickActionsClient, extractCloudflareCrawlRoutes, resolveCloudflareQuickActionsConfig };
|
package/dist/crater-client.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crater-client.d.ts
|
|
2
1
|
export declare const DEFAULT_BIDI_URL = "ws://127.0.0.1:9222";
|
|
3
2
|
export declare const VLMKIT_CRATER_BIDI_URL_ENV = "VLMKIT_CRATER_BIDI_URL";
|
|
4
3
|
export declare const CRATER_BIDI_URL_ENV = "CRATER_BIDI_URL";
|
|
@@ -154,5 +153,4 @@ export interface PaintTreeChange {
|
|
|
154
153
|
/** Compare two paint trees and return the diff */
|
|
155
154
|
export declare function diffPaintTrees(baseline: PaintNode, current: PaintNode, path?: string): PaintTreeChange[];
|
|
156
155
|
/** Check if crater server is running */
|
|
157
|
-
export declare function isCraterAvailable(url?: string): Promise<boolean>;
|
|
158
|
-
//#endregion
|
|
156
|
+
export declare function isCraterAvailable(url?: string): Promise<boolean>;
|
package/dist/crater-client.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { PNG } from "pngjs";
|
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { buildComputedStyleCaptureJsonExpression, computedStyleSnapshotToMap, hasMeaningfulComputedStyleSnapshot, parseComputedStyleSnapshot } from "@mizchi/vlmkit-core/computed-style-capture.ts";
|
|
6
|
-
|
|
6
|
+
// src/crater-client.ts
|
|
7
7
|
/**
|
|
8
8
|
* Crater BiDi client
|
|
9
9
|
*
|
|
@@ -360,5 +360,4 @@ async function isCraterAvailable(url = resolveCraterBidiUrl()) {
|
|
|
360
360
|
return false;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
//#endregion
|
|
364
363
|
export { CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CraterClient, DEFAULT_BIDI_URL, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, diffPaintTrees, isCraterAvailable, resolveCraterBidiUrl };
|
package/dist/crater-smoke.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RuleView } from "@mizchi/vlmkit-core/plugin/contract.ts";
|
|
2
|
-
//#region src/crater-smoke.d.ts
|
|
3
2
|
export interface CraterSmokeClient {
|
|
4
3
|
connect(): Promise<void>;
|
|
5
4
|
close(): Promise<void>;
|
|
@@ -104,5 +103,4 @@ export declare function parseCraterSmokeArgs(argv: readonly string[], env?: Node
|
|
|
104
103
|
* `check crater` is declared in `./gates/crater.gate.ts` and driven by the core runner
|
|
105
104
|
* (`@mizchi/vlmkit-core/plugin/runner.ts`), which owns argument parsing,
|
|
106
105
|
* `--json`, `--advisory`, the run ledger and the exit code.
|
|
107
|
-
*/
|
|
108
|
-
//#endregion
|
|
106
|
+
*/
|
package/dist/crater-smoke.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { CraterClient, isCraterAvailable, resolveCraterBidiUrl } from "./crater-
|
|
|
3
3
|
import "node:path";
|
|
4
4
|
import { BOLD, CYAN, DIM, GREEN, RED, RESET, YELLOW } from "@mizchi/vlmkit-core/terminal-colors.ts";
|
|
5
5
|
import { ruleTier } from "@mizchi/vlmkit-core/plugin/rule-tier.ts";
|
|
6
|
-
|
|
6
|
+
// src/crater-smoke.ts
|
|
7
7
|
const DEFAULT_HTML = `<!doctype html>
|
|
8
8
|
<html>
|
|
9
9
|
<head>
|
|
@@ -246,5 +246,4 @@ function parseCraterSmokeArgs(argv, env = process.env) {
|
|
|
246
246
|
* (`@mizchi/vlmkit-core/plugin/runner.ts`), which owns argument parsing,
|
|
247
247
|
* `--json`, `--advisory`, the run ledger and the exit code.
|
|
248
248
|
*/
|
|
249
|
-
//#endregion
|
|
250
249
|
export { formatCraterSmokeReport, parseCraterSmokeArgs, runCraterBidiSmoke };
|
package/dist/crater-wasm.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crater-wasm.d.ts
|
|
2
1
|
export declare const CRATER_WASM_MODULE_ENV = "VLMKIT_CRATER_WASM_MODULE";
|
|
3
2
|
export interface CraterWasmViewport {
|
|
4
3
|
width: number;
|
|
@@ -60,5 +59,4 @@ export interface LoadCraterWasmModuleOptions {
|
|
|
60
59
|
export declare function createCraterWasmLayoutBackend(module: CraterWasmModule): CraterWasmLayoutBackend;
|
|
61
60
|
export declare function loadCraterWasmModule(options?: LoadCraterWasmModuleOptions): Promise<CraterWasmModule>;
|
|
62
61
|
export declare function normalizeCraterLayoutJson(raw: string | unknown): CraterLayoutNode;
|
|
63
|
-
export declare function summarizeCraterLayout(layout: CraterLayoutNode): CraterLayoutDiagnostics;
|
|
64
|
-
//#endregion
|
|
62
|
+
export declare function summarizeCraterLayout(layout: CraterLayoutNode): CraterLayoutDiagnostics;
|
package/dist/crater-wasm.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
-
|
|
3
|
+
// src/crater-wasm.ts
|
|
4
4
|
const CRATER_WASM_MODULE_ENV = "VLMKIT_CRATER_WASM_MODULE";
|
|
5
5
|
function createCraterWasmLayoutBackend(module) {
|
|
6
6
|
assertCraterWasmModule(module);
|
|
@@ -128,5 +128,4 @@ function isBareSpecifier(value) {
|
|
|
128
128
|
function errorMessage(error) {
|
|
129
129
|
return error instanceof Error ? error.message : String(error);
|
|
130
130
|
}
|
|
131
|
-
//#endregion
|
|
132
131
|
export { CRATER_WASM_MODULE_ENV, createCraterWasmLayoutBackend, loadCraterWasmModule, normalizeCraterLayoutJson, summarizeCraterLayout };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/detection-types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Capture-level detection result shared across capture backends
|
|
4
3
|
* (Playwright, Crater BiDi) and downstream detection classifiers.
|
|
@@ -20,5 +19,4 @@ export interface ViewportDetectionResult {
|
|
|
20
19
|
* silent false-negative.
|
|
21
20
|
*/
|
|
22
21
|
visualCaptureSkipped?: boolean;
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
22
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CraterSmokeOptions, CraterSmokeReport } from "../crater-smoke.mjs";
|
|
2
|
-
//#region src/gates/crater.gate.d.ts
|
|
3
2
|
/** The gate needs `requireAvailable` at verdict time, not just at run time. */
|
|
4
3
|
export interface CraterGateOptions extends CraterSmokeOptions {
|
|
5
4
|
requireAvailable: boolean;
|
|
6
5
|
}
|
|
7
6
|
export declare const craterGate: import("@mizchi/vlmkit-core/plugin/contract.ts").GateDefinition<CraterSmokeReport, CraterGateOptions>;
|
|
8
7
|
export declare const captureGatesPlugin: import("@mizchi/vlmkit-core/plugin/contract.ts").VlmkitPlugin;
|
|
9
|
-
//#endregion
|
|
10
8
|
export { captureGatesPlugin as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatCraterSmokeReport, parseCraterSmokeArgs, runCraterBidiSmoke } from "../crater-smoke.mjs";
|
|
2
2
|
import { defineGate, definePlugin } from "@mizchi/vlmkit-core/plugin/contract.ts";
|
|
3
|
-
|
|
3
|
+
// src/gates/crater.gate.ts
|
|
4
4
|
/**
|
|
5
5
|
* `check crater` as a gate definition, owned by the package that owns the
|
|
6
6
|
* Crater client.
|
|
@@ -99,5 +99,4 @@ const captureGatesPlugin = definePlugin({
|
|
|
99
99
|
name: "@mizchi/vlmkit-capture",
|
|
100
100
|
gates: [craterGate]
|
|
101
101
|
});
|
|
102
|
-
//#endregion
|
|
103
102
|
export { captureGatesPlugin, captureGatesPlugin as default, craterGate };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CraterBatchRenderResult, CraterBreakpointDiscoveryDiagnostics, CraterBreakpointDiscoveryResult, CraterClient, CraterComputedStyleWithState, CraterCssMutation, CraterCssMutationAction, CraterRenderVariant, CraterResponsiveBreakpoint, CraterRuleViewportMap, CraterRuleViewportMapEntry, DEFAULT_BIDI_URL, PaintNode, PaintProps, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, diffPaintTrees, isCraterAvailable, resolveCraterBidiUrl } from "./crater-client.mjs";
|
|
2
|
-
import { BatchPrescanOptions, BatchPrescanRequest, BatchPrescanResult, hasAnyBatchPrescanSignal, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, runBatchPrescan } from "./batch-prescan.mjs";
|
|
3
1
|
import { CaptureConfig, CaptureRoute, CaptureRouteSet, DEFAULT_CAPTURE_BASE_URL, DEFAULT_CAPTURE_CONFIG_FILE, DEFAULT_CAPTURE_ROUTES, LoadCaptureConfigOptions, captureConfigDir, loadCaptureConfigFromFile, parseCaptureConfig, resolveCaptureRoutes, routeNameFromPath } from "./capture-config.mjs";
|
|
4
|
-
import { CloudflareCrawlRecord, CloudflareCrawlRecordStatus, CloudflareCrawlRequest, CloudflareCrawlResult, CloudflareCrawlRoute, CloudflareCrawlStartResult, CloudflareQuickAction, CloudflareQuickActionEndpointInput, CloudflareQuickActionsConfig, CloudflareQuickActionsEnv, CloudflareScreenshotRequest, CloudflareScreenshotResult, buildCloudflareQuickActionEndpoint, createCloudflareQuickActionsClient, extractCloudflareCrawlRoutes, resolveCloudflareQuickActionsConfig } from "./cloudflare-quick-actions.mjs";
|
|
5
|
-
import { CraterSmokeCheck, CraterSmokeClient, CraterSmokeReport, CraterSmokeStatus, formatCraterSmokeReport, runCraterBidiSmoke } from "./crater-smoke.mjs";
|
|
6
|
-
import { CRATER_WASM_MODULE_ENV, CraterBoxRect, CraterLayoutDiagnostics, CraterLayoutNode, CraterLayoutRootBox, CraterWasmLayoutBackend, CraterWasmModule, CraterWasmRenderRequest, CraterWasmRenderResult, CraterWasmViewport, LoadCraterWasmModuleOptions, createCraterWasmLayoutBackend, loadCraterWasmModule, normalizeCraterLayoutJson, summarizeCraterLayout } from "./crater-wasm.mjs";
|
|
7
|
-
import { ViewportDetectionResult } from "./detection-types.mjs";
|
|
8
2
|
import { Breakpoint, CraterViewportSource, DiscoveryResult, ResponsiveBreakpoint, ViewportOptions, ViewportSource, ViewportSpec, discoverViewports, discoverViewportsViaCrater, discoverViewportsWithBackend, extractBreakpoints, extractBreakpointsFromHtml, extractBreakpointsFromHtmlWithStylesheets, extractResponsiveBreakpointsFromHtml, extractResponsiveBreakpointsFromHtmlWithStylesheets, extractStylesheetHrefsFromHtml, generateViewports, mergeResponsiveBreakpoints, toResponsiveBreakpoints } from "./viewport-discovery.mjs";
|
|
9
3
|
import { diagnoseSandboxLaunchFailure, formatPlaywrightLaunchError, isPlaywrightSandboxRestrictionError } from "./playwright-launch-error.mjs";
|
|
4
|
+
import { CloudflareCrawlRecord, CloudflareCrawlRecordStatus, CloudflareCrawlRequest, CloudflareCrawlResult, CloudflareCrawlRoute, CloudflareCrawlStartResult, CloudflareQuickAction, CloudflareQuickActionEndpointInput, CloudflareQuickActionsConfig, CloudflareQuickActionsEnv, CloudflareScreenshotRequest, CloudflareScreenshotResult, buildCloudflareQuickActionEndpoint, createCloudflareQuickActionsClient, extractCloudflareCrawlRoutes, resolveCloudflareQuickActionsConfig } from "./cloudflare-quick-actions.mjs";
|
|
10
5
|
import { AnalyzedReport, FailedTest, ReportStats, analyzeReport, collectScreenshots, formatStats } from "./playwright-analyzer.mjs";
|
|
11
6
|
import { PrescannerResolvedBy, PrescannerTrialResolution, PrescannerTrialSummary, hasAnyDetectionSignal, hasCraterPrescanSignal, resolvePrescannerTrial, summarizePrescannerTrials } from "./prescanner.mjs";
|
|
7
|
+
import { CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CraterBatchRenderResult, CraterBreakpointDiscoveryDiagnostics, CraterBreakpointDiscoveryResult, CraterClient, CraterComputedStyleWithState, CraterCssMutation, CraterCssMutationAction, CraterRenderVariant, CraterResponsiveBreakpoint, CraterRuleViewportMap, CraterRuleViewportMapEntry, DEFAULT_BIDI_URL, PaintNode, PaintProps, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, diffPaintTrees, isCraterAvailable, resolveCraterBidiUrl } from "./crater-client.mjs";
|
|
8
|
+
import { CRATER_WASM_MODULE_ENV, CraterBoxRect, CraterLayoutDiagnostics, CraterLayoutNode, CraterLayoutRootBox, CraterWasmLayoutBackend, CraterWasmModule, CraterWasmRenderRequest, CraterWasmRenderResult, CraterWasmViewport, LoadCraterWasmModuleOptions, createCraterWasmLayoutBackend, loadCraterWasmModule, normalizeCraterLayoutJson, summarizeCraterLayout } from "./crater-wasm.mjs";
|
|
9
|
+
import { CraterSmokeCheck, CraterSmokeClient, CraterSmokeReport, CraterSmokeStatus, formatCraterSmokeReport, runCraterBidiSmoke } from "./crater-smoke.mjs";
|
|
10
|
+
import { ViewportDetectionResult } from "./detection-types.mjs";
|
|
11
|
+
import { BatchPrescanOptions, BatchPrescanRequest, BatchPrescanResult, hasAnyBatchPrescanSignal, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, runBatchPrescan } from "./batch-prescan.mjs";
|
|
12
12
|
export { type AnalyzedReport, type BatchPrescanOptions, type BatchPrescanRequest, type BatchPrescanResult, type Breakpoint, CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CRATER_WASM_MODULE_ENV, type CaptureConfig, type CaptureRoute, type CaptureRouteSet, type CloudflareCrawlRecord, type CloudflareCrawlRecordStatus, type CloudflareCrawlRequest, type CloudflareCrawlResult, type CloudflareCrawlRoute, type CloudflareCrawlStartResult, type CloudflareQuickAction, type CloudflareQuickActionEndpointInput, type CloudflareQuickActionsConfig, type CloudflareQuickActionsEnv, type CloudflareScreenshotRequest, type CloudflareScreenshotResult, type CraterBatchRenderResult, type CraterBoxRect, type CraterBreakpointDiscoveryDiagnostics, type CraterBreakpointDiscoveryResult, CraterClient, type CraterComputedStyleWithState, type CraterCssMutation, type CraterCssMutationAction, type CraterLayoutDiagnostics, type CraterLayoutNode, type CraterLayoutRootBox, type CraterRenderVariant, type CraterResponsiveBreakpoint, type CraterRuleViewportMap, type CraterRuleViewportMapEntry, type CraterSmokeCheck, type CraterSmokeClient, type CraterSmokeReport, type CraterSmokeStatus, type CraterViewportSource, type CraterWasmLayoutBackend, type CraterWasmModule, type CraterWasmRenderRequest, type CraterWasmRenderResult, type CraterWasmViewport, DEFAULT_BIDI_URL, DEFAULT_CAPTURE_BASE_URL, DEFAULT_CAPTURE_CONFIG_FILE, DEFAULT_CAPTURE_ROUTES, type DiscoveryResult, type FailedTest, type LoadCaptureConfigOptions, type LoadCraterWasmModuleOptions, type PaintNode, type PaintProps, type PrescannerResolvedBy, type PrescannerTrialResolution, type PrescannerTrialSummary, type ReportStats, type ResponsiveBreakpoint, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, ViewportDetectionResult, type ViewportOptions, type ViewportSource, type ViewportSpec, analyzeReport, buildCloudflareQuickActionEndpoint, captureConfigDir, collectScreenshots, createCloudflareQuickActionsClient, createCraterWasmLayoutBackend, diagnoseSandboxLaunchFailure, diffPaintTrees, discoverViewports, discoverViewportsViaCrater, discoverViewportsWithBackend, extractBreakpoints, extractBreakpointsFromHtml, extractBreakpointsFromHtmlWithStylesheets, extractCloudflareCrawlRoutes, extractResponsiveBreakpointsFromHtml, extractResponsiveBreakpointsFromHtmlWithStylesheets, extractStylesheetHrefsFromHtml, formatCraterSmokeReport, formatPlaywrightLaunchError, formatStats, generateViewports, hasAnyBatchPrescanSignal, hasAnyDetectionSignal, hasCraterPrescanSignal, isCraterAvailable, isPlaywrightSandboxRestrictionError, loadCaptureConfigFromFile, loadCraterWasmModule, mergeResponsiveBreakpoints, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, normalizeCraterLayoutJson, parseCaptureConfig, resolveCaptureRoutes, resolveCloudflareQuickActionsConfig, resolveCraterBidiUrl, resolvePrescannerTrial, routeNameFromPath, runBatchPrescan, runCraterBidiSmoke, summarizeCraterLayout, summarizePrescannerTrials, toResponsiveBreakpoints };
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CraterClient, DEFAULT_BIDI_URL, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, diffPaintTrees, isCraterAvailable, resolveCraterBidiUrl } from "./crater-client.mjs";
|
|
2
|
-
import { hasAnyBatchPrescanSignal, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, runBatchPrescan } from "./batch-prescan.mjs";
|
|
3
1
|
import { DEFAULT_CAPTURE_BASE_URL, DEFAULT_CAPTURE_CONFIG_FILE, DEFAULT_CAPTURE_ROUTES, captureConfigDir, loadCaptureConfigFromFile, parseCaptureConfig, resolveCaptureRoutes, routeNameFromPath } from "./capture-config.mjs";
|
|
4
|
-
import { buildCloudflareQuickActionEndpoint, createCloudflareQuickActionsClient, extractCloudflareCrawlRoutes, resolveCloudflareQuickActionsConfig } from "./cloudflare-quick-actions.mjs";
|
|
5
|
-
import { formatCraterSmokeReport, runCraterBidiSmoke } from "./crater-smoke.mjs";
|
|
6
|
-
import { CRATER_WASM_MODULE_ENV, createCraterWasmLayoutBackend, loadCraterWasmModule, normalizeCraterLayoutJson, summarizeCraterLayout } from "./crater-wasm.mjs";
|
|
7
2
|
import { discoverViewports, discoverViewportsViaCrater, discoverViewportsWithBackend, extractBreakpoints, extractBreakpointsFromHtml, extractBreakpointsFromHtmlWithStylesheets, extractResponsiveBreakpointsFromHtml, extractResponsiveBreakpointsFromHtmlWithStylesheets, extractStylesheetHrefsFromHtml, generateViewports, mergeResponsiveBreakpoints, toResponsiveBreakpoints } from "./viewport-discovery.mjs";
|
|
8
3
|
import { diagnoseSandboxLaunchFailure, formatPlaywrightLaunchError, isPlaywrightSandboxRestrictionError } from "./playwright-launch-error.mjs";
|
|
4
|
+
import { buildCloudflareQuickActionEndpoint, createCloudflareQuickActionsClient, extractCloudflareCrawlRoutes, resolveCloudflareQuickActionsConfig } from "./cloudflare-quick-actions.mjs";
|
|
9
5
|
import { analyzeReport, collectScreenshots, formatStats } from "./playwright-analyzer.mjs";
|
|
10
6
|
import { hasAnyDetectionSignal, hasCraterPrescanSignal, resolvePrescannerTrial, summarizePrescannerTrials } from "./prescanner.mjs";
|
|
7
|
+
import { CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CraterClient, DEFAULT_BIDI_URL, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, diffPaintTrees, isCraterAvailable, resolveCraterBidiUrl } from "./crater-client.mjs";
|
|
8
|
+
import { CRATER_WASM_MODULE_ENV, createCraterWasmLayoutBackend, loadCraterWasmModule, normalizeCraterLayoutJson, summarizeCraterLayout } from "./crater-wasm.mjs";
|
|
9
|
+
import { formatCraterSmokeReport, runCraterBidiSmoke } from "./crater-smoke.mjs";
|
|
10
|
+
import { hasAnyBatchPrescanSignal, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, runBatchPrescan } from "./batch-prescan.mjs";
|
|
11
11
|
export { CRATER_BIDI_URL_ENV, CRATER_ROOT_ENV, CRATER_WASM_MODULE_ENV, CraterClient, DEFAULT_BIDI_URL, DEFAULT_CAPTURE_BASE_URL, DEFAULT_CAPTURE_CONFIG_FILE, DEFAULT_CAPTURE_ROUTES, VLMKIT_CRATER_BIDI_URL_ENV, VLMKIT_CRATER_ROOT_ENV, analyzeReport, buildCloudflareQuickActionEndpoint, captureConfigDir, collectScreenshots, createCloudflareQuickActionsClient, createCraterWasmLayoutBackend, diagnoseSandboxLaunchFailure, diffPaintTrees, discoverViewports, discoverViewportsViaCrater, discoverViewportsWithBackend, extractBreakpoints, extractBreakpointsFromHtml, extractBreakpointsFromHtmlWithStylesheets, extractCloudflareCrawlRoutes, extractResponsiveBreakpointsFromHtml, extractResponsiveBreakpointsFromHtmlWithStylesheets, extractStylesheetHrefsFromHtml, formatCraterSmokeReport, formatPlaywrightLaunchError, formatStats, generateViewports, hasAnyBatchPrescanSignal, hasAnyDetectionSignal, hasCraterPrescanSignal, isCraterAvailable, isPlaywrightSandboxRestrictionError, loadCaptureConfigFromFile, loadCraterWasmModule, mergeResponsiveBreakpoints, mutationsForPropertyRemoval, mutationsForSelectorBlockRemoval, normalizeCraterLayoutJson, parseCaptureConfig, resolveCaptureRoutes, resolveCloudflareQuickActionsConfig, resolveCraterBidiUrl, resolvePrescannerTrial, routeNameFromPath, runBatchPrescan, runCraterBidiSmoke, summarizeCraterLayout, summarizePrescannerTrials, toResponsiveBreakpoints };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Attachment, VrtSnapshot } from "@mizchi/vlmkit-core/types.ts";
|
|
2
|
-
//#region src/playwright-analyzer.d.ts
|
|
3
2
|
export interface AnalyzedReport {
|
|
4
3
|
snapshots: VrtSnapshot[];
|
|
5
4
|
failedTests: FailedTest[];
|
|
@@ -32,5 +31,4 @@ export declare function collectScreenshots(resultsDir: string, baselineDir: stri
|
|
|
32
31
|
/**
|
|
33
32
|
* レポートの統計サマリを人間可読な文字列にする
|
|
34
33
|
*/
|
|
35
|
-
export declare function formatStats(stats: ReportStats): string;
|
|
36
|
-
//#endregion
|
|
34
|
+
export declare function formatStats(stats: ReportStats): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { basename, join, relative } from "node:path";
|
|
2
2
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
3
|
-
|
|
3
|
+
// src/playwright-analyzer.ts
|
|
4
4
|
/**
|
|
5
5
|
* Playwright JSON レポートを読み込み、構造化された VRT データに変換する
|
|
6
6
|
*/
|
|
@@ -113,5 +113,4 @@ function formatStats(stats) {
|
|
|
113
113
|
`Duration: ${(stats.duration / 1e3).toFixed(1)}s`
|
|
114
114
|
].join("\n");
|
|
115
115
|
}
|
|
116
|
-
//#endregion
|
|
117
116
|
export { analyzeReport, collectScreenshots, formatStats };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/playwright-launch-error.d.ts
|
|
2
1
|
export declare function isPlaywrightSandboxRestrictionError(error: unknown): boolean;
|
|
3
2
|
/**
|
|
4
3
|
* The `diagnose` hook for `launchBrowser` / `withBrowser`.
|
|
@@ -16,5 +15,4 @@ export declare function isPlaywrightSandboxRestrictionError(error: unknown): boo
|
|
|
16
15
|
export declare function diagnoseSandboxLaunchFailure(error: unknown): string | null;
|
|
17
16
|
export declare function formatPlaywrightLaunchError(error: unknown, options?: {
|
|
18
17
|
commandHint?: string;
|
|
19
|
-
}): string;
|
|
20
|
-
//#endregion
|
|
18
|
+
}): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/playwright-launch-error.ts
|
|
2
2
|
const FORMATTED_SANDBOX_MARKER = "Codex/macOS sandbox restriction";
|
|
3
3
|
const RAW_SANDBOX_SIGNAL_PATTERNS = [
|
|
4
4
|
"Operation not permitted",
|
|
@@ -39,5 +39,4 @@ function formatPlaywrightLaunchError(error, options = {}) {
|
|
|
39
39
|
const originalLine = message.split("\n").find((line) => line.trim().length > 0) ?? message;
|
|
40
40
|
return `Playwright browser launch is blocked by a ${FORMATTED_SANDBOX_MARKER}. Chromium itself is likely fine.${hint}\nOriginal error: ${originalLine}`;
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { diagnoseSandboxLaunchFailure, formatPlaywrightLaunchError, isPlaywrightSandboxRestrictionError };
|
package/dist/prescanner.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ViewportDetectionResult } from "./detection-types.mjs";
|
|
2
|
-
//#region src/prescanner.d.ts
|
|
3
2
|
export type PrescannerResolvedBy = "crater" | "chromium" | "none";
|
|
4
3
|
/** Which Crater metadata signal first fired for a trial resolved by crater. */
|
|
5
4
|
export type PrescannerCraterSignal = "paint-tree" | "computed-style" | "forced-state" | "visual" | "none";
|
|
@@ -33,5 +32,4 @@ export interface PrescannerTrialSummary {
|
|
|
33
32
|
export declare function hasCraterPrescanSignal(viewports: ViewportDetectionResult[]): boolean;
|
|
34
33
|
export declare function hasAnyDetectionSignal(viewports: ViewportDetectionResult[]): boolean;
|
|
35
34
|
export declare function resolvePrescannerTrial(craterViewports: ViewportDetectionResult[], chromiumViewports?: ViewportDetectionResult[]): PrescannerTrialResolution;
|
|
36
|
-
export declare function summarizePrescannerTrials(resolutions: PrescannerTrialResolution[]): PrescannerTrialSummary;
|
|
37
|
-
//#endregion
|
|
35
|
+
export declare function summarizePrescannerTrials(resolutions: PrescannerTrialResolution[]): PrescannerTrialSummary;
|
package/dist/prescanner.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/prescanner.ts
|
|
2
2
|
function hasCraterPrescanSignal(viewports) {
|
|
3
3
|
return viewports.some((viewport) => viewport.visualDiffDetected || viewport.computedStyleDiffCount > 0 || viewport.hoverDiffDetected || viewport.paintTreeDiffCount > 0);
|
|
4
4
|
}
|
|
@@ -57,5 +57,4 @@ function summarizePrescannerTrials(resolutions) {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { hasAnyDetectionSignal, hasCraterPrescanSignal, resolvePrescannerTrial, summarizePrescannerTrials };
|
package/dist/route-capture.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CaptureRoute } from "./capture-config.mjs";
|
|
2
|
-
//#region src/route-capture.d.ts
|
|
3
2
|
/** The viewport the old `vrt-desktop` project used, and vlmkit's default elsewhere. */
|
|
4
3
|
export declare const DEFAULT_CAPTURE_VIEWPORT: {
|
|
5
4
|
readonly width: 1280;
|
|
@@ -82,4 +81,4 @@ interface CdpAxNode {
|
|
|
82
81
|
* report every baseline as a semantic diff.
|
|
83
82
|
*/
|
|
84
83
|
export declare function cdpNodesToTree(nodes: readonly CdpAxNode[]): unknown;
|
|
85
|
-
|
|
84
|
+
export {};
|
package/dist/route-capture.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { withBrowser } from "@mizchi/vlmkit-core/browser-launch.ts";
|
|
3
3
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
-
|
|
4
|
+
// src/route-capture.ts
|
|
5
5
|
/**
|
|
6
6
|
* Route capture — screenshots + a11y trees for `vlmkit workflow init` / `workflow capture`,
|
|
7
7
|
* in this process.
|
|
@@ -194,5 +194,4 @@ function cdpNodesToTree(nodes) {
|
|
|
194
194
|
children: []
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
//#endregion
|
|
198
197
|
export { DEFAULT_CAPTURE_VIEWPORT, captureRoutes, cdpNodesToTree };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/viewport-discovery.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Viewport Discovery -- discover breakpoints from CSS and generate boundary-check viewports
|
|
4
3
|
*
|
|
@@ -110,4 +109,4 @@ export declare function discoverViewportsViaCrater(client: CraterViewportSource,
|
|
|
110
109
|
export declare function discoverViewportsWithBackend(html: string, options?: ViewportOptions & {
|
|
111
110
|
craterClient?: CraterViewportSource | null;
|
|
112
111
|
}): Promise<DiscoveryResult>;
|
|
113
|
-
|
|
112
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/viewport-discovery.ts
|
|
2
2
|
const MEDIA_PATTERN = /@media\s+([^{]+)\{/g;
|
|
3
3
|
const WIDTH_PATTERN = /\(\s*(min|max)-width\s*:\s*([\d.]+)(px|rem|em)\s*\)/g;
|
|
4
4
|
/** Extract all breakpoints from CSS text */
|
|
@@ -290,5 +290,4 @@ async function discoverViewportsWithBackend(html, options = {}) {
|
|
|
290
290
|
backend: usedFallback ? "hybrid" : "crater"
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
|
-
//#endregion
|
|
294
293
|
export { discoverViewports, discoverViewportsViaCrater, discoverViewportsWithBackend, extractBreakpoints, extractBreakpointsFromHtml, extractBreakpointsFromHtmlWithStylesheets, extractResponsiveBreakpointsFromHtml, extractResponsiveBreakpointsFromHtmlWithStylesheets, extractStylesheetHrefsFromHtml, generateViewports, mergeResponsiveBreakpoints, toResponsiveBreakpoints };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mizchi/vlmkit-capture",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Playwright + Crater capture infrastructure for VRT — viewport discovery, multi-route capture, prescanner.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "mizchi",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"pngjs": "^7.0.0",
|
|
40
|
-
"ws": "^8.
|
|
41
|
-
"@mizchi/vlmkit-core": "0.
|
|
40
|
+
"ws": "^8.23.0",
|
|
41
|
+
"@mizchi/vlmkit-core": "0.28.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"playwright": ">=1.61 <2"
|