@juxtapose/core 0.9.0 → 0.11.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/agent/handoff.d.ts +3 -1
- package/dist/agent/handoff.js +17 -0
- package/dist/agent/handoff.js.map +1 -1
- package/dist/browser/page.d.ts +20 -4
- package/dist/browser/page.js +15 -6
- package/dist/browser/page.js.map +1 -1
- package/dist/capture/capture.d.ts +7 -0
- package/dist/capture/capture.js +60 -9
- package/dist/capture/capture.js.map +1 -1
- package/dist/capture/config-errors.d.ts +10 -0
- package/dist/capture/config-errors.js +20 -0
- package/dist/capture/config-errors.js.map +1 -0
- package/dist/capture/idle.d.ts +88 -0
- package/dist/capture/idle.js +558 -0
- package/dist/capture/idle.js.map +1 -0
- package/dist/capture/network-policy.d.ts +21 -0
- package/dist/capture/network-policy.js +114 -0
- package/dist/capture/network-policy.js.map +1 -0
- package/dist/capture/pool.d.ts +6 -0
- package/dist/capture/pool.js +1 -0
- package/dist/capture/pool.js.map +1 -1
- package/dist/capture/settle-options.d.ts +80 -0
- package/dist/capture/settle-options.js +236 -0
- package/dist/capture/settle-options.js.map +1 -0
- package/dist/capture/settle.d.ts +60 -18
- package/dist/capture/settle.js +157 -100
- package/dist/capture/settle.js.map +1 -1
- package/dist/capture/snap.d.ts +3 -0
- package/dist/capture/snap.js +7 -1
- package/dist/capture/snap.js.map +1 -1
- package/dist/capture/variants.d.ts +1 -4
- package/dist/capture/variants.js +25 -10
- package/dist/capture/variants.js.map +1 -1
- package/dist/diff/structural.d.ts +4 -1
- package/dist/diff/structural.js +3 -0
- package/dist/diff/structural.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/run/run.d.ts +4 -0
- package/dist/run/run.js +20 -1
- package/dist/run/run.js.map +1 -1
- package/dist/types.d.ts +77 -1
- package/package.json +1 -1
package/dist/run/run.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// failed. On a green run this function never decodes a single image.
|
|
7
7
|
import { captureEnv } from '../capture/env.js';
|
|
8
8
|
import { capturePool } from '../capture/pool.js';
|
|
9
|
-
import { resolveStatus, toDiffStatus } from '../baseline/status.js';
|
|
9
|
+
import { hashImage, resolveStatus, toDiffStatus, } from '../baseline/status.js';
|
|
10
10
|
import { decodeStructure } from '../capture/structure.js';
|
|
11
11
|
import { structuralDiff } from '../diff/structural.js';
|
|
12
12
|
import { compareCodeUnits } from '../diff/structural/deltas.js';
|
|
@@ -14,6 +14,7 @@ import { computeGroups } from './groups.js';
|
|
|
14
14
|
import { diffImages, resolveThreshold, resolveMinDiffPercent, } from '../diff/diff.js';
|
|
15
15
|
import { phases } from './phases.js';
|
|
16
16
|
import { shellQuote } from '../shell-quote.js';
|
|
17
|
+
import { settleFlag } from '../capture/settle-options.js';
|
|
17
18
|
export const DEFAULT_VIEWPORT = { width: 1280, height: 800 };
|
|
18
19
|
export async function runCapture(opts) {
|
|
19
20
|
const startedAt = new Date();
|
|
@@ -31,6 +32,17 @@ export async function runCapture(opts) {
|
|
|
31
32
|
viewport,
|
|
32
33
|
onProgress: opts.onProgress,
|
|
33
34
|
...(opts.onWarning ? { onWarning: opts.onWarning } : {}),
|
|
35
|
+
settleLayers: {
|
|
36
|
+
project: {
|
|
37
|
+
...(opts.config?.settle ? { settle: opts.config.settle } : {}),
|
|
38
|
+
...(opts.config?.network ? { network: opts.config.network } : {}),
|
|
39
|
+
...(opts.config?.waitForSelector !== undefined
|
|
40
|
+
? { waitForSelector: opts.config.waitForSelector }
|
|
41
|
+
: {}),
|
|
42
|
+
...(opts.config?.delay !== undefined ? { delay: opts.config.delay } : {}),
|
|
43
|
+
},
|
|
44
|
+
...(opts.settle ? { call: opts.settle } : {}),
|
|
45
|
+
},
|
|
34
46
|
signal: opts.signal,
|
|
35
47
|
});
|
|
36
48
|
// Capture is measured as the whole streamed loop rather than per story: the
|
|
@@ -98,6 +110,7 @@ async function judge(snapshot, story, manifest, opts, p) {
|
|
|
98
110
|
storyId: story.storyId,
|
|
99
111
|
...variantOf(story),
|
|
100
112
|
status,
|
|
113
|
+
hash: hashImage(snapshot.image),
|
|
101
114
|
mismatchPixels: 0,
|
|
102
115
|
mismatchPercent: 0,
|
|
103
116
|
changedRegions: [],
|
|
@@ -105,6 +118,11 @@ async function judge(snapshot, story, manifest, opts, p) {
|
|
|
105
118
|
// with the regions means nobody downstream has to re-enumerate stories to
|
|
106
119
|
// find out what the coordinates are relative to.
|
|
107
120
|
viewport: snapshot.viewport,
|
|
121
|
+
// Never silent: a capture taken at the settle cap says so on every
|
|
122
|
+
// status, a pass included, with what was still pending.
|
|
123
|
+
...(snapshot.settle
|
|
124
|
+
? { flags: [settleFlag(snapshot.settle)], settle: snapshot.settle }
|
|
125
|
+
: {}),
|
|
108
126
|
durationMs: snapshot.durationMs,
|
|
109
127
|
};
|
|
110
128
|
// pass / new / stale need no pixel work: there is either nothing to explain
|
|
@@ -191,6 +209,7 @@ async function tryStructural(opts, story, snapshot, pixels, p) {
|
|
|
191
209
|
pixels,
|
|
192
210
|
escalate: { command: `jux handoff ${shellQuote(story.storyId)}` },
|
|
193
211
|
...(cause ? { cause } : {}),
|
|
212
|
+
...(snapshot.settle ? { settleFlag: settleFlag(snapshot.settle) } : {}),
|
|
194
213
|
});
|
|
195
214
|
}
|
|
196
215
|
catch {
|
package/dist/run/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run/run.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,2EAA2E;AAC3E,qEAAqE;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run/run.ts"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AAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxE,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;+EAC+E;AAC/E,SAAS,SAAS,CAChB,KAAoB;IAEpB,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QACnE,CAAC,CAAC;YACE,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,EAAE;SACzC;QACH,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,KAAK,CAAC,OAAqB;IAClC,MAAM,OAAO,GAA+B;QAC1C,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;KACR,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,OAAO;QAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7C,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -34,7 +34,58 @@ export interface StoryParams {
|
|
|
34
34
|
/** Set on a variant's resolved params; a variant-only field. The default
|
|
35
35
|
* capture is always light, so a story's own `colorScheme` is ignored. */
|
|
36
36
|
colorScheme?: ColorScheme;
|
|
37
|
+
/** How the capture decides the page has finished. Layered over the project
|
|
38
|
+
* config's `settle` and under per-call options. */
|
|
39
|
+
settle?: SettleParams;
|
|
40
|
+
/** Which requests the page may make. Layered like `settle`; read before
|
|
41
|
+
* navigation, so only the story's static params count, not live ones. */
|
|
42
|
+
network?: NetworkParams;
|
|
37
43
|
}
|
|
44
|
+
/** Third-party requests during capture (issue #147). */
|
|
45
|
+
export interface NetworkParams {
|
|
46
|
+
/** `'block'` fails requests to origins other than the page's own, so a
|
|
47
|
+
* random photo or a broken link neither changes the pixels nor holds the
|
|
48
|
+
* page to the settle cap. Default `'allow'`. */
|
|
49
|
+
external?: 'allow' | 'block';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The event-driven settle wait: the page is captured once it reports no
|
|
53
|
+
* pending timers, frames, messages, fonts or images and no counted request is
|
|
54
|
+
* in flight, or at `timeout`, whichever comes first.
|
|
55
|
+
*/
|
|
56
|
+
export interface SettleParams {
|
|
57
|
+
/** Hard cap on the wait, ms, 1 to 60000. Default 1500. At the cap the
|
|
58
|
+
* page is captured anyway and the result is flagged `settle-timeout`. */
|
|
59
|
+
timeout?: number;
|
|
60
|
+
/** Also wait for the page to call `window.__juxtapose.ready()`. */
|
|
61
|
+
ready?: boolean;
|
|
62
|
+
network?: {
|
|
63
|
+
/** Requests never counted as pending. Added to the defaults
|
|
64
|
+
* (`type:WebSocket`, `type:EventSource`, `type:Ping`, `type:Prefetch`). */
|
|
65
|
+
ignore?: string[];
|
|
66
|
+
/** Each pattern must see a matching request complete before the page
|
|
67
|
+
* counts as settled. Wins over `ignore`. */
|
|
68
|
+
require?: string[];
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Something about a capture that doesn't fail it but should be read.
|
|
72
|
+
* `settle-timeout`: the settle wait hit its cap. `settle-fallback`: the
|
|
73
|
+
* event-driven wait could not run and a weaker one stood in. */
|
|
74
|
+
export type CaptureFlag = 'settle-timeout' | 'settle-fallback';
|
|
75
|
+
/** Present on a capture whose settle wait hit its cap (`timeout`), or could
|
|
76
|
+
* not run as designed (`fallback`). */
|
|
77
|
+
export type SettleReport = {
|
|
78
|
+
status: 'timeout';
|
|
79
|
+
/** The cap that was hit, ms. */
|
|
80
|
+
timeoutMs: number;
|
|
81
|
+
/** What was still pending at the cap, one description per item, such
|
|
82
|
+
* as `1 request to /api/feed in flight (Fetch)`. Never empty. */
|
|
83
|
+
pending: string[];
|
|
84
|
+
} | {
|
|
85
|
+
status: 'fallback';
|
|
86
|
+
/** Why the event-driven wait could not run. Never empty. */
|
|
87
|
+
pending: string[];
|
|
88
|
+
};
|
|
38
89
|
export type ColorScheme = 'light' | 'dark';
|
|
39
90
|
/** One named variant: any per-story option, plus a color scheme and the name
|
|
40
91
|
* of another variant to start from. `skip` is not a field; set the variant to
|
|
@@ -86,6 +137,8 @@ export interface Snapshot {
|
|
|
86
137
|
* Absent when structure capture failed or was disabled — it explains a
|
|
87
138
|
* failure, it never decides one. */
|
|
88
139
|
structure?: StructureSnapshot;
|
|
140
|
+
/** Present only when the settle wait hit its cap. */
|
|
141
|
+
settle?: SettleReport;
|
|
89
142
|
}
|
|
90
143
|
export interface StructureRect {
|
|
91
144
|
x: number;
|
|
@@ -188,7 +241,13 @@ export type Flag = 'element-removed' | 'text-changed' | 'large-reflow' | 'unexpl
|
|
|
188
241
|
| 'sub-threshold' | 'structure-truncated' | 'no-baseline-structure' | 'no-current-structure'
|
|
189
242
|
/** Either side's content is taller than the viewport: changes below the
|
|
190
243
|
* fold are invisible to both pixels and structure. */
|
|
191
|
-
| 'below-fold'
|
|
244
|
+
| 'below-fold'
|
|
245
|
+
/** The current capture's settle wait hit its cap: the page may have been
|
|
246
|
+
* captured mid-update. The result's `settle.pending` says what was left. */
|
|
247
|
+
| 'settle-timeout'
|
|
248
|
+
/** The current capture's event-driven settle wait could not run; a
|
|
249
|
+
* fonts/images/quiet-DOM wait stood in. */
|
|
250
|
+
| 'settle-fallback';
|
|
192
251
|
export type CauseKind =
|
|
193
252
|
/** At least one changed file is in the story's import closure. */
|
|
194
253
|
'in-closure'
|
|
@@ -264,6 +323,11 @@ export interface DiffResult {
|
|
|
264
323
|
* can say the conditions it was captured under without re-enumerating. */
|
|
265
324
|
variantParams?: Omit<VariantSpec, 'extends'>;
|
|
266
325
|
status: DiffStatus;
|
|
326
|
+
/** sha256 of the current capture's WebP: the same hash `baseline/` compares,
|
|
327
|
+
* so two runs are byte-identical per story exactly when these match. Absent
|
|
328
|
+
* on skipped and errored stories (nothing was captured) and on reports
|
|
329
|
+
* written before it was recorded. */
|
|
330
|
+
hash?: string;
|
|
267
331
|
mismatchPixels: number;
|
|
268
332
|
mismatchPercent: number;
|
|
269
333
|
/** Bounding boxes of changed clusters. Empty unless status is 'fail'. */
|
|
@@ -280,6 +344,10 @@ export interface DiffResult {
|
|
|
280
344
|
/** Tier-0 explanation of a failure. Present only when status is 'fail' and
|
|
281
345
|
* the current capture produced a structure; never consulted on pass. */
|
|
282
346
|
structural?: StructuralVerdict;
|
|
347
|
+
/** Present only when non-empty. Never changes `status`. */
|
|
348
|
+
flags?: CaptureFlag[];
|
|
349
|
+
/** Present only with the `settle-timeout` flag. */
|
|
350
|
+
settle?: SettleReport;
|
|
283
351
|
durationMs: number;
|
|
284
352
|
}
|
|
285
353
|
/** One change seen on several stories: the same signature on ≥2 failing
|
|
@@ -377,6 +445,14 @@ export interface ProjectConfig {
|
|
|
377
445
|
viewport?: Viewport;
|
|
378
446
|
threshold?: number;
|
|
379
447
|
minDiffPercent?: number;
|
|
448
|
+
/** Project-wide settle options; a story's `settle` is layered over them. */
|
|
449
|
+
settle?: SettleParams;
|
|
450
|
+
/** Project-wide network policy; a story's `network` is layered over it. */
|
|
451
|
+
network?: NetworkParams;
|
|
452
|
+
/** Project-wide `waitForSelector`; a story's own wins. */
|
|
453
|
+
waitForSelector?: string;
|
|
454
|
+
/** Project-wide `delay`, ms; a story's own wins. */
|
|
455
|
+
delay?: number;
|
|
380
456
|
/** Variants every story gets, by name. A story's own variant of the same
|
|
381
457
|
* name wins; a story sets one to `false` to opt out. Applies to every
|
|
382
458
|
* platform, the urls list included. */
|