@oxog/react-check 1.0.2 → 1.0.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/browser-inject.global.js +3 -3
- package/dist/cli.js +735 -53
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +47 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1349,11 +1349,17 @@ declare class ReactCheckInjector {
|
|
|
1349
1349
|
* @param config - New configuration
|
|
1350
1350
|
*/
|
|
1351
1351
|
private handleConfig;
|
|
1352
|
+
/** Message queue for messages sent before connection */
|
|
1353
|
+
private messageQueue;
|
|
1352
1354
|
/**
|
|
1353
1355
|
* Send message to CLI
|
|
1354
1356
|
* @param message - Browser message
|
|
1355
1357
|
*/
|
|
1356
1358
|
private send;
|
|
1359
|
+
/**
|
|
1360
|
+
* Flush queued messages after connection
|
|
1361
|
+
*/
|
|
1362
|
+
private flushMessageQueue;
|
|
1357
1363
|
/**
|
|
1358
1364
|
* Find DOM element for a component
|
|
1359
1365
|
* @param componentName - Component name
|
package/dist/index.d.ts
CHANGED
|
@@ -1349,11 +1349,17 @@ declare class ReactCheckInjector {
|
|
|
1349
1349
|
* @param config - New configuration
|
|
1350
1350
|
*/
|
|
1351
1351
|
private handleConfig;
|
|
1352
|
+
/** Message queue for messages sent before connection */
|
|
1353
|
+
private messageQueue;
|
|
1352
1354
|
/**
|
|
1353
1355
|
* Send message to CLI
|
|
1354
1356
|
* @param message - Browser message
|
|
1355
1357
|
*/
|
|
1356
1358
|
private send;
|
|
1359
|
+
/**
|
|
1360
|
+
* Flush queued messages after connection
|
|
1361
|
+
*/
|
|
1362
|
+
private flushMessageQueue;
|
|
1357
1363
|
/**
|
|
1358
1364
|
* Find DOM element for a component
|
|
1359
1365
|
* @param componentName - Component name
|
package/dist/index.js
CHANGED
|
@@ -5343,7 +5343,12 @@ var ReactCheckInjector = class {
|
|
|
5343
5343
|
this.initialized = true;
|
|
5344
5344
|
this.overlay.init();
|
|
5345
5345
|
this.setupScannerEvents();
|
|
5346
|
+
this.scanner.start();
|
|
5346
5347
|
this.connect();
|
|
5348
|
+
const markHookReady = this._markHookReady;
|
|
5349
|
+
if (markHookReady) {
|
|
5350
|
+
markHookReady();
|
|
5351
|
+
}
|
|
5347
5352
|
console.log("[ReactCheck] Initialized");
|
|
5348
5353
|
}
|
|
5349
5354
|
/**
|
|
@@ -5386,6 +5391,7 @@ var ReactCheckInjector = class {
|
|
|
5386
5391
|
type: "ready",
|
|
5387
5392
|
payload: { reactVersion: this.scanner.getReactVersion() }
|
|
5388
5393
|
});
|
|
5394
|
+
this.flushMessageQueue();
|
|
5389
5395
|
this.scanner.start();
|
|
5390
5396
|
};
|
|
5391
5397
|
this.ws.onmessage = (event) => {
|
|
@@ -5454,6 +5460,8 @@ var ReactCheckInjector = class {
|
|
|
5454
5460
|
this.overlay.configure({ animationSpeed: config.animationSpeed });
|
|
5455
5461
|
}
|
|
5456
5462
|
}
|
|
5463
|
+
/** Message queue for messages sent before connection */
|
|
5464
|
+
messageQueue = [];
|
|
5457
5465
|
/**
|
|
5458
5466
|
* Send message to CLI
|
|
5459
5467
|
* @param message - Browser message
|
|
@@ -5461,6 +5469,19 @@ var ReactCheckInjector = class {
|
|
|
5461
5469
|
send(message) {
|
|
5462
5470
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
5463
5471
|
this.ws.send(JSON.stringify(message));
|
|
5472
|
+
} else {
|
|
5473
|
+
this.messageQueue.push(message);
|
|
5474
|
+
}
|
|
5475
|
+
}
|
|
5476
|
+
/**
|
|
5477
|
+
* Flush queued messages after connection
|
|
5478
|
+
*/
|
|
5479
|
+
flushMessageQueue() {
|
|
5480
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN && this.messageQueue.length > 0) {
|
|
5481
|
+
for (const message of this.messageQueue) {
|
|
5482
|
+
this.ws.send(JSON.stringify(message));
|
|
5483
|
+
}
|
|
5484
|
+
this.messageQueue = [];
|
|
5464
5485
|
}
|
|
5465
5486
|
}
|
|
5466
5487
|
/**
|
|
@@ -5496,7 +5517,10 @@ var ReactCheckInjector = class {
|
|
|
5496
5517
|
return;
|
|
5497
5518
|
}
|
|
5498
5519
|
win.__REACTCHECK_INJECTED__ = true;
|
|
5520
|
+
const injector = new ReactCheckInjector();
|
|
5499
5521
|
if (!win.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
|
5522
|
+
const pendingCommits = [];
|
|
5523
|
+
let injectorReady = false;
|
|
5500
5524
|
const hook = {
|
|
5501
5525
|
renderers: /* @__PURE__ */ new Map(),
|
|
5502
5526
|
supportsFiber: true,
|
|
@@ -5505,15 +5529,36 @@ var ReactCheckInjector = class {
|
|
|
5505
5529
|
this.renderers.set(id, renderer);
|
|
5506
5530
|
return id;
|
|
5507
5531
|
},
|
|
5508
|
-
onCommitFiberRoot: function() {
|
|
5532
|
+
onCommitFiberRoot: function(rendererID, root) {
|
|
5533
|
+
if (injectorReady) {
|
|
5534
|
+
const scanner = injector.scanner;
|
|
5535
|
+
if (scanner) {
|
|
5536
|
+
scanner["processCommit"](root.current);
|
|
5537
|
+
}
|
|
5538
|
+
} else {
|
|
5539
|
+
pendingCommits.push({ rendererID, root });
|
|
5540
|
+
}
|
|
5509
5541
|
},
|
|
5510
5542
|
onCommitFiberUnmount: function() {
|
|
5543
|
+
},
|
|
5544
|
+
// Method to process pending commits when injector is ready
|
|
5545
|
+
_processPending: function() {
|
|
5546
|
+
injectorReady = true;
|
|
5547
|
+
const scanner = injector.scanner;
|
|
5548
|
+
if (scanner) {
|
|
5549
|
+
for (const { root } of pendingCommits) {
|
|
5550
|
+
scanner["processCommit"](root.current);
|
|
5551
|
+
}
|
|
5552
|
+
pendingCommits.length = 0;
|
|
5553
|
+
}
|
|
5511
5554
|
}
|
|
5512
5555
|
};
|
|
5513
5556
|
win.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook;
|
|
5514
5557
|
console.log("[ReactCheck] DevTools hook installed");
|
|
5558
|
+
injector._markHookReady = () => {
|
|
5559
|
+
hook._processPending();
|
|
5560
|
+
};
|
|
5515
5561
|
}
|
|
5516
|
-
const injector = new ReactCheckInjector();
|
|
5517
5562
|
if (document.readyState === "loading") {
|
|
5518
5563
|
document.addEventListener("DOMContentLoaded", () => {
|
|
5519
5564
|
injector.init();
|