@swmansion/argent 0.14.1-next.1 → 0.14.1-next.3
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/tool-server.cjs +71 -14
- package/package.json +1 -1
package/dist/tool-server.cjs
CHANGED
|
@@ -110500,6 +110500,11 @@ var ScreencastManager = class {
|
|
|
110500
110500
|
fps;
|
|
110501
110501
|
activeCount = 0;
|
|
110502
110502
|
currentOpts = null;
|
|
110503
|
+
// The in-flight Page.startScreencast promise for the first subscriber, shared
|
|
110504
|
+
// so concurrent joiners await the SAME start instead of assuming a live
|
|
110505
|
+
// session (and stranding themselves on a frame-less stream if it fails). Null
|
|
110506
|
+
// when no start is in flight (idle, or a live session already running).
|
|
110507
|
+
startInFlight = null;
|
|
110503
110508
|
lastFrame = null;
|
|
110504
110509
|
cdpListenerInstalled = false;
|
|
110505
110510
|
/**
|
|
@@ -110513,20 +110518,41 @@ var ScreencastManager = class {
|
|
|
110513
110518
|
}
|
|
110514
110519
|
async start(opts = {}) {
|
|
110515
110520
|
this.installCdpListenerOnce();
|
|
110516
|
-
|
|
110517
|
-
if (this.
|
|
110521
|
+
let acquired = false;
|
|
110522
|
+
if (this.startInFlight) {
|
|
110523
|
+
await this.startInFlight;
|
|
110524
|
+
if (this.activeCount > 0) {
|
|
110525
|
+
if (this.optsDiffer(opts, this.currentOpts)) this.warnOptsIgnored();
|
|
110526
|
+
this.activeCount += 1;
|
|
110527
|
+
acquired = true;
|
|
110528
|
+
}
|
|
110529
|
+
} else if (this.activeCount === 0) {
|
|
110518
110530
|
this.currentOpts = opts;
|
|
110519
|
-
|
|
110520
|
-
|
|
110521
|
-
|
|
110522
|
-
|
|
110523
|
-
|
|
110524
|
-
|
|
110531
|
+
const inFlight = this.cdp.send("Page.startScreencast", this.toCdpStartArgs(opts)).then(() => void 0);
|
|
110532
|
+
this.startInFlight = inFlight;
|
|
110533
|
+
try {
|
|
110534
|
+
await inFlight;
|
|
110535
|
+
} catch (err) {
|
|
110536
|
+
if (this.startInFlight === inFlight) {
|
|
110537
|
+
this.startInFlight = null;
|
|
110538
|
+
this.currentOpts = null;
|
|
110539
|
+
}
|
|
110540
|
+
throw err;
|
|
110541
|
+
}
|
|
110542
|
+
if (this.startInFlight === inFlight) {
|
|
110543
|
+
this.startInFlight = null;
|
|
110544
|
+
this.activeCount += 1;
|
|
110545
|
+
acquired = true;
|
|
110546
|
+
}
|
|
110547
|
+
} else {
|
|
110548
|
+
if (this.optsDiffer(opts, this.currentOpts)) this.warnOptsIgnored();
|
|
110549
|
+
this.activeCount += 1;
|
|
110550
|
+
acquired = true;
|
|
110525
110551
|
}
|
|
110526
110552
|
let stopped = false;
|
|
110527
110553
|
const session = {
|
|
110528
110554
|
stop: async () => {
|
|
110529
|
-
if (stopped) return;
|
|
110555
|
+
if (stopped || !acquired) return;
|
|
110530
110556
|
stopped = true;
|
|
110531
110557
|
this.activeCount = Math.max(0, this.activeCount - 1);
|
|
110532
110558
|
if (this.activeCount === 0) {
|
|
@@ -110542,9 +110568,16 @@ var ScreencastManager = class {
|
|
|
110542
110568
|
async forceStop() {
|
|
110543
110569
|
this.activeCount = 0;
|
|
110544
110570
|
this.currentOpts = null;
|
|
110571
|
+
this.startInFlight = null;
|
|
110545
110572
|
await this.cdp.send("Page.stopScreencast").catch(() => {
|
|
110546
110573
|
});
|
|
110547
110574
|
}
|
|
110575
|
+
warnOptsIgnored() {
|
|
110576
|
+
process.stderr.write(
|
|
110577
|
+
`[chromium-screencast] additional caller requested screencast opts that differ from the active session; ignoring (first writer wins).
|
|
110578
|
+
`
|
|
110579
|
+
);
|
|
110580
|
+
}
|
|
110548
110581
|
installCdpListenerOnce() {
|
|
110549
110582
|
if (this.cdpListenerInstalled) return;
|
|
110550
110583
|
this.cdpListenerInstalled = true;
|
|
@@ -139258,14 +139291,30 @@ async function analyzeScreenshotTextChanges(options) {
|
|
|
139258
139291
|
};
|
|
139259
139292
|
}
|
|
139260
139293
|
return analyzeTextRegions({
|
|
139261
|
-
baselineRegions: baselineOcr.blocks,
|
|
139262
|
-
currentRegions: currentOcr.blocks,
|
|
139294
|
+
baselineRegions: rescaleTextRegions(baselineOcr.blocks, options.baselineRegionScale),
|
|
139295
|
+
currentRegions: rescaleTextRegions(currentOcr.blocks, options.currentRegionScale),
|
|
139263
139296
|
baselineImage: options.baselineImage,
|
|
139264
139297
|
currentImage: options.currentImage,
|
|
139265
139298
|
ignoreTopPixels: options.ignoreTopPixels,
|
|
139266
139299
|
textChangeMinConfidence: options.textChangeMinConfidence
|
|
139267
139300
|
});
|
|
139268
139301
|
}
|
|
139302
|
+
function rescaleTextRegions(regions, scale) {
|
|
139303
|
+
if (!scale || scale.x === 1 && scale.y === 1) return regions;
|
|
139304
|
+
return regions.map((region) => ({
|
|
139305
|
+
...region,
|
|
139306
|
+
bounds: scaleBounds(region.bounds, scale),
|
|
139307
|
+
words: region.words?.map((word) => ({ ...word, bounds: scaleBounds(word.bounds, scale) }))
|
|
139308
|
+
}));
|
|
139309
|
+
}
|
|
139310
|
+
function scaleBounds(bounds, scale) {
|
|
139311
|
+
return {
|
|
139312
|
+
x: bounds.x * scale.x,
|
|
139313
|
+
y: bounds.y * scale.y,
|
|
139314
|
+
width: bounds.width * scale.x,
|
|
139315
|
+
height: bounds.height * scale.y
|
|
139316
|
+
};
|
|
139317
|
+
}
|
|
139269
139318
|
function analyzeTextRegions(params) {
|
|
139270
139319
|
const textChangeMinConfidence = params.textChangeMinConfidence ?? DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE;
|
|
139271
139320
|
validateTextChangeMinConfidence(textChangeMinConfidence);
|
|
@@ -139950,9 +139999,11 @@ async function diffPngFiles(options) {
|
|
|
139950
139999
|
baselinePath: options.baselinePath,
|
|
139951
140000
|
currentPath: options.currentPath,
|
|
139952
140001
|
hasPixelDiff: pixelDiff.differentPixels > 0,
|
|
139953
|
-
baselineImage:
|
|
139954
|
-
currentImage:
|
|
139955
|
-
|
|
140002
|
+
baselineImage: baseline,
|
|
140003
|
+
currentImage: current,
|
|
140004
|
+
baselineRegionScale: regionScaleBetween(decodedBaseline, baseline),
|
|
140005
|
+
currentRegionScale: regionScaleBetween(decodedCurrent, current),
|
|
140006
|
+
ignoreTopPixels: ignoredTopRowsFor(baseline.height, settings.ignoreTopNormalizedY),
|
|
139956
140007
|
textChangeMinConfidence: DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE
|
|
139957
140008
|
});
|
|
139958
140009
|
return summarizeResult({
|
|
@@ -140020,6 +140071,12 @@ function markChangedPixels(params) {
|
|
|
140020
140071
|
function ignoredTopRowsFor(height, ignoreTopNormalizedY) {
|
|
140021
140072
|
return Math.min(height, Math.ceil(height * ignoreTopNormalizedY));
|
|
140022
140073
|
}
|
|
140074
|
+
function regionScaleBetween(from2, to) {
|
|
140075
|
+
return {
|
|
140076
|
+
x: from2.width === 0 ? 1 : to.width / from2.width,
|
|
140077
|
+
y: from2.height === 0 ? 1 : to.height / from2.height
|
|
140078
|
+
};
|
|
140079
|
+
}
|
|
140023
140080
|
function getChangedRegions(params) {
|
|
140024
140081
|
const rawRegions = traceChangeRegions({
|
|
140025
140082
|
mask: params.mask,
|