@pygmalionjs/pygmalion 0.6.3 → 0.6.4

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.
@@ -6,12 +6,39 @@ export interface PygmalionPreviewCaptureProgress {
6
6
  completed: number;
7
7
  total: number;
8
8
  jobCount: number;
9
+ /** Stable worker-job identity used to join consecutive capture batches. */
10
+ jobId?: string;
11
+ /** Current worker batch, when the public counters represent the whole catalog. */
12
+ batchCompleted?: number;
13
+ /** Current worker batch size, when the public counters represent the whole catalog. */
14
+ batchTotal?: number;
9
15
  frameId?: string;
10
16
  captureStatus?: string;
11
17
  updatedAt?: number;
12
18
  }
19
+ export interface PygmalionPreviewCaptureCatalogProgress {
20
+ active: boolean;
21
+ completed: number;
22
+ total: number;
23
+ jobCount: number;
24
+ updatedAt?: number;
25
+ }
26
+ export declare function getPreviewCaptureCatalogProgress(): PygmalionPreviewCaptureCatalogProgress;
27
+ export declare function subscribePreviewCaptureCatalogProgress(listener: () => void): () => void;
28
+ export declare function publishPreviewCaptureCatalogProgress(value: PygmalionPreviewCaptureCatalogProgress): void;
29
+ export declare function resetPreviewCaptureCatalogProgress(): void;
13
30
  export declare function previewCaptureProgressEndpoint(artifactEndpoint: string): string;
14
31
  export declare function normalizePreviewCaptureProgress(value: unknown): PygmalionPreviewCaptureProgress | null;
32
+ export interface PreviewCaptureProgressMergeState {
33
+ jobId?: string;
34
+ baseline: number;
35
+ lastBatchCompleted: number;
36
+ lastBatchTotal: number;
37
+ }
38
+ export declare function mergePreviewCaptureProgress(worker: PygmalionPreviewCaptureProgress, catalog: PygmalionPreviewCaptureCatalogProgress, previous: PreviewCaptureProgressMergeState | null): {
39
+ progress: PygmalionPreviewCaptureProgress;
40
+ state: PreviewCaptureProgressMergeState | null;
41
+ };
15
42
  /**
16
43
  * Reads the local preview worker's current progress from the artifact plugin.
17
44
  * Idle polling is deliberately slower; an active capture tightens the interval
@@ -316,8 +316,8 @@ export function pygmalionPreviewArtifactPlugin({
316
316
  let captureJobCounter = 0;
317
317
 
318
318
  function readCaptureProgress() {
319
- const jobs = [...captureJobs.values()];
320
- if (jobs.length === 0) {
319
+ const entries = [...captureJobs.entries()];
320
+ if (entries.length === 0) {
321
321
  return {
322
322
  active: false,
323
323
  phase: 'idle',
@@ -326,6 +326,7 @@ export function pygmalionPreviewArtifactPlugin({
326
326
  jobCount: 0,
327
327
  };
328
328
  }
329
+ const jobs = entries.map(([, job]) => job);
329
330
  const phases = new Set(jobs.map((job) => job.phase));
330
331
  const phase = phases.has('capturing')
331
332
  ? 'capturing'
@@ -345,6 +346,10 @@ export function pygmalionPreviewArtifactPlugin({
345
346
  completed: jobs.reduce((sum, job) => sum + job.completed, 0),
346
347
  total: jobs.reduce((sum, job) => sum + job.total, 0),
347
348
  jobCount: jobs.length,
349
+ jobId: entries
350
+ .map(([id]) => id)
351
+ .sort()
352
+ .join(','),
348
353
  ...(latest.frameId ? { frameId: latest.frameId } : {}),
349
354
  ...(latest.captureStatus
350
355
  ? { captureStatus: latest.captureStatus }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {