@swmansion/argent 0.14.1-next.2 → 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 +42 -9
- 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;
|