@mizchi/vlmkit-capture 0.9.0 → 0.9.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/README.md +3 -3
- package/dist/capture-config.d.mts +5 -5
- package/dist/capture-config.mjs +7 -7
- package/dist/capturer.d.mts +1 -1
- package/dist/capturer.mjs +2 -2
- package/dist/crater-smoke.mjs +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Playwright / Crater capture infrastructure for VRT — viewport discovery,
|
|
4
4
|
multi-route capture, prescanner integration.
|
|
5
5
|
|
|
6
|
-
Part of the [`vlmkit`](https://github.com/mizchi/
|
|
6
|
+
Part of the [`vlmkit`](https://github.com/mizchi/vlmkit) monorepo.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ const { viewports, breakpoints } = discoverViewports(html, {
|
|
|
24
24
|
|
|
25
25
|
const routeSet = resolveCaptureRoutes({
|
|
26
26
|
cwd: process.cwd(),
|
|
27
|
-
configPath: "
|
|
27
|
+
configPath: "vlmkit.config.json",
|
|
28
28
|
});
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ import { capturePage } from "@mizchi/vlmkit-capture/capturer.ts";
|
|
|
39
39
|
|
|
40
40
|
| Module | Purpose |
|
|
41
41
|
|---|---|
|
|
42
|
-
| `capture-config` | `
|
|
42
|
+
| `capture-config` | `vlmkit.config.json` resolution + route schema. |
|
|
43
43
|
| `viewport-discovery` | Parse CSS media queries to suggest test viewports. |
|
|
44
44
|
| `crater-client` | Bidi-protocol client for the Crater browser engine. |
|
|
45
45
|
| `playwright-analyzer` | Auto-detect Playwright config from project. |
|
|
@@ -18,10 +18,10 @@ declare const DEFAULT_CAPTURE_BASE_URL = "http://127.0.0.1:4174";
|
|
|
18
18
|
/**
|
|
19
19
|
* Built-in fallback used when no config or env override is provided.
|
|
20
20
|
* Kept for vlmkit's own development workflow; external projects should
|
|
21
|
-
* supply their own routes via `
|
|
21
|
+
* supply their own routes via `vlmkit.config.json`.
|
|
22
22
|
*/
|
|
23
23
|
declare const DEFAULT_CAPTURE_ROUTES: CaptureRoute[];
|
|
24
|
-
declare const DEFAULT_CAPTURE_CONFIG_FILE = "
|
|
24
|
+
declare const DEFAULT_CAPTURE_CONFIG_FILE = "vlmkit.config.json";
|
|
25
25
|
declare function parseCaptureConfig(raw: string): CaptureConfig;
|
|
26
26
|
declare function routeNameFromPath(path: string): string;
|
|
27
27
|
interface LoadCaptureConfigOptions {
|
|
@@ -35,9 +35,9 @@ interface LoadCaptureConfigOptions {
|
|
|
35
35
|
* Resolve the route set to use for a capture run.
|
|
36
36
|
*
|
|
37
37
|
* Precedence (highest first):
|
|
38
|
-
* 1. `
|
|
39
|
-
* 2. Explicit config path (CLI / `
|
|
40
|
-
* 3. `
|
|
38
|
+
* 1. `VLMKIT_CAPTURE_ROUTES` env var (JSON-encoded array)
|
|
39
|
+
* 2. Explicit config path (CLI / `VLMKIT_CONFIG_PATH`)
|
|
40
|
+
* 3. `vlmkit.config.json` discovered in `cwd`
|
|
41
41
|
* 4. Built-in defaults
|
|
42
42
|
*/
|
|
43
43
|
declare function resolveCaptureRoutes(options?: LoadCaptureConfigOptions): CaptureRouteSet;
|
package/dist/capture-config.mjs
CHANGED
|
@@ -5,14 +5,14 @@ import { dirname, isAbsolute, resolve } from "node:path";
|
|
|
5
5
|
* Capture configuration loader for `vlmkit workflow init|capture`.
|
|
6
6
|
*
|
|
7
7
|
* Allows external projects to drive `e2e/vrt-capture.spec.ts` without
|
|
8
|
-
* editing the spec by sourcing routes from `
|
|
9
|
-
* file pointed at by `--config` / `
|
|
8
|
+
* editing the spec by sourcing routes from `vlmkit.config.json` (or any
|
|
9
|
+
* file pointed at by `--config` / `VLMKIT_CONFIG_PATH`).
|
|
10
10
|
*/
|
|
11
11
|
const DEFAULT_CAPTURE_BASE_URL = "http://127.0.0.1:4174";
|
|
12
12
|
/**
|
|
13
13
|
* Built-in fallback used when no config or env override is provided.
|
|
14
14
|
* Kept for vlmkit's own development workflow; external projects should
|
|
15
|
-
* supply their own routes via `
|
|
15
|
+
* supply their own routes via `vlmkit.config.json`.
|
|
16
16
|
*/
|
|
17
17
|
const DEFAULT_CAPTURE_ROUTES = [
|
|
18
18
|
{
|
|
@@ -41,7 +41,7 @@ const DEFAULT_CAPTURE_ROUTES = [
|
|
|
41
41
|
waitFor: "main"
|
|
42
42
|
}
|
|
43
43
|
];
|
|
44
|
-
const DEFAULT_CAPTURE_CONFIG_FILE = "
|
|
44
|
+
const DEFAULT_CAPTURE_CONFIG_FILE = "vlmkit.config.json";
|
|
45
45
|
function parseCaptureConfig(raw) {
|
|
46
46
|
let parsed;
|
|
47
47
|
try {
|
|
@@ -102,9 +102,9 @@ function routeNameFromPath(path) {
|
|
|
102
102
|
* Resolve the route set to use for a capture run.
|
|
103
103
|
*
|
|
104
104
|
* Precedence (highest first):
|
|
105
|
-
* 1. `
|
|
106
|
-
* 2. Explicit config path (CLI / `
|
|
107
|
-
* 3. `
|
|
105
|
+
* 1. `VLMKIT_CAPTURE_ROUTES` env var (JSON-encoded array)
|
|
106
|
+
* 2. Explicit config path (CLI / `VLMKIT_CONFIG_PATH`)
|
|
107
|
+
* 3. `vlmkit.config.json` discovered in `cwd`
|
|
108
108
|
* 4. Built-in defaults
|
|
109
109
|
*/
|
|
110
110
|
function resolveCaptureRoutes(options = {}) {
|
package/dist/capturer.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ interface ResolvedCaptureBackend {
|
|
|
33
33
|
/**
|
|
34
34
|
* Resolution order:
|
|
35
35
|
* 1. Explicit `--backend` flag
|
|
36
|
-
* 2. `
|
|
36
|
+
* 2. `VLMKIT_CAPTURE_BACKEND` env var
|
|
37
37
|
* 3. Default local
|
|
38
38
|
*
|
|
39
39
|
* For the Cloudflare backend, credentials come from env (`CLOUDFLARE_ACCOUNT_ID`
|
package/dist/capturer.mjs
CHANGED
|
@@ -51,7 +51,7 @@ function maskAccount(id) {
|
|
|
51
51
|
/**
|
|
52
52
|
* Resolution order:
|
|
53
53
|
* 1. Explicit `--backend` flag
|
|
54
|
-
* 2. `
|
|
54
|
+
* 2. `VLMKIT_CAPTURE_BACKEND` env var
|
|
55
55
|
* 3. Default local
|
|
56
56
|
*
|
|
57
57
|
* For the Cloudflare backend, credentials come from env (`CLOUDFLARE_ACCOUNT_ID`
|
|
@@ -61,7 +61,7 @@ function maskAccount(id) {
|
|
|
61
61
|
function resolveCaptureBackend(options = {}) {
|
|
62
62
|
const env = options.env ?? process.env;
|
|
63
63
|
const explicit = options.backendFlag?.trim().toLowerCase();
|
|
64
|
-
const envChoice = env.
|
|
64
|
+
const envChoice = env.VLMKIT_CAPTURE_BACKEND?.trim().toLowerCase();
|
|
65
65
|
const choice = explicit || envChoice || "local";
|
|
66
66
|
const source = explicit ? "flag" : envChoice ? "env" : "default";
|
|
67
67
|
switch (choice) {
|
package/dist/crater-smoke.mjs
CHANGED
|
@@ -264,6 +264,6 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
264
264
|
else console.log(formatCraterSmokeReport(report));
|
|
265
265
|
if (report.status === "fail" || args.requireAvailable && report.status === "skip") process.exit(1);
|
|
266
266
|
}
|
|
267
|
-
if (process.env.
|
|
267
|
+
if (process.env.__VLMKIT_DISPATCHER_LEAF__ === "crater-smoke" || (process.argv[1] ? resolve(process.argv[1]) === fileURLToPath(import.meta.url) : false)) main().catch(handleCliError);
|
|
268
268
|
//#endregion
|
|
269
269
|
export { formatCraterSmokeReport, parseCraterSmokeArgs, runCraterBidiSmoke };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mizchi/vlmkit-capture",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Playwright + Crater capture infrastructure for VRT — viewport discovery, multi-route capture, prescanner.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "mizchi",
|
|
@@ -36,10 +36,12 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"playwright": "^1.61.1",
|
|
40
39
|
"pngjs": "^7.0.0",
|
|
41
40
|
"ws": "^8.20.0",
|
|
42
|
-
"@mizchi/vlmkit-core": "0.9.
|
|
41
|
+
"@mizchi/vlmkit-core": "0.9.1"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"playwright": ">=1.61 <2"
|
|
43
45
|
},
|
|
44
46
|
"scripts": {
|
|
45
47
|
"build": "pnpm --dir ../.. exec tsdown --config tsdown.packages.config.ts --filter @mizchi/vlmkit-capture",
|