@oxog/react-check 1.2.0 → 1.3.1
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/CHANGELOG.md +129 -0
- package/README.md +177 -62
- package/dist/browser-inject.global.js +13 -13
- package/dist/chain.cjs +8 -531
- package/dist/chain.cjs.map +1 -1
- package/dist/chain.d.cts +2 -2
- package/dist/chain.d.ts +2 -2
- package/dist/chain.js +2 -533
- package/dist/chain.js.map +1 -1
- package/dist/chunk-35I3PLS3.js +751 -0
- package/dist/chunk-35I3PLS3.js.map +1 -0
- package/dist/chunk-7R4KKJTW.cjs +255 -0
- package/dist/chunk-7R4KKJTW.cjs.map +1 -0
- package/dist/chunk-DSXOHC6R.cjs +755 -0
- package/dist/chunk-DSXOHC6R.cjs.map +1 -0
- package/dist/chunk-DWM55ACO.cjs +294 -0
- package/dist/chunk-DWM55ACO.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs +9 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -0
- package/dist/chunk-LFY7MUHJ.cjs +483 -0
- package/dist/chunk-LFY7MUHJ.cjs.map +1 -0
- package/dist/chunk-NLWGB4IE.cjs +380 -0
- package/dist/chunk-NLWGB4IE.cjs.map +1 -0
- package/dist/chunk-PIXJPQO7.js +481 -0
- package/dist/chunk-PIXJPQO7.js.map +1 -0
- package/dist/chunk-REEPUD73.js +362 -0
- package/dist/chunk-REEPUD73.js.map +1 -0
- package/dist/chunk-RQYHXWUC.js +292 -0
- package/dist/chunk-RQYHXWUC.js.map +1 -0
- package/dist/chunk-WLN7ZVO4.js +253 -0
- package/dist/chunk-WLN7ZVO4.js.map +1 -0
- package/dist/cli.js +1195 -297
- package/dist/cli.js.map +1 -1
- package/dist/detect.cjs +22 -324
- package/dist/detect.cjs.map +1 -1
- package/dist/detect.d.cts +8 -2
- package/dist/detect.d.ts +8 -2
- package/dist/detect.js +1 -324
- package/dist/detect.js.map +1 -1
- package/dist/{event-emitter-CxKUDo9q.d.cts → event-emitter-BVYUPYLd.d.cts} +3 -2
- package/dist/{event-emitter-CxKUDo9q.d.ts → event-emitter-BVYUPYLd.d.ts} +3 -2
- package/dist/fix.cjs +6 -715
- package/dist/fix.cjs.map +1 -1
- package/dist/fix.d.cts +8 -2
- package/dist/fix.d.ts +8 -2
- package/dist/fix.js +2 -719
- package/dist/fix.js.map +1 -1
- package/dist/index.cjs +1400 -3075
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +237 -57
- package/dist/index.d.ts +237 -57
- package/dist/index.js +1222 -2970
- package/dist/index.js.map +1 -1
- package/dist/{scanner-Cc2187fH.d.ts → scanner-BJFA0354.d.ts} +33 -4
- package/dist/{scanner-S7BtVIpW.d.cts → scanner-DZL2rIFv.d.cts} +33 -4
- package/dist/scanner.cjs +8 -1652
- package/dist/scanner.cjs.map +1 -1
- package/dist/scanner.d.cts +3 -3
- package/dist/scanner.d.ts +3 -3
- package/dist/scanner.js +4 -1656
- package/dist/scanner.js.map +1 -1
- package/dist/{types-DuZyBVVV.d.cts → types-BMDemwIs.d.cts} +35 -10
- package/dist/{types-DuZyBVVV.d.ts → types-BMDemwIs.d.ts} +35 -10
- package/package.json +16 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { F as FiberNode, R as RenderInfo, a as ReactDevToolsHook, S as SessionReport, b as ReportOptions, C as CLIMessage, B as BrowserMessage, c as RenderChainInfo, d as ScannerConfig, W as WindowWithReactDevTools } from './types-
|
|
2
|
-
export {
|
|
3
|
-
import { S as Scanner } from './scanner-
|
|
4
|
-
export { b as ScannerEvents, a as StatsCollector, c as StatsEvents } from './scanner-
|
|
1
|
+
import { F as FiberNode, R as RenderInfo, a as ReactDevToolsHook, S as SessionReport, b as ReportOptions, C as CLIMessage, B as BrowserMessage, c as RenderChainInfo, d as ScannerConfig, W as WindowWithReactDevTools } from './types-BMDemwIs.js';
|
|
2
|
+
export { r as ComponentNode, h as ComponentStats, E as ErrorCode, u as FiberType, g as FixSuggestion, e as FixType, k as FrameworkInfo, m as FrameworkOptions, O as OverlayOptions, q as ReactCheckConfig, s as ReactCheckError, t as ReactCheckEvents, p as ReactCheckOptions, n as RuleLevel, o as RuleOptions, i as SessionInfo, j as SessionSummary, f as Severity, l as ThresholdOptions, T as TimelineEvent } from './types-BMDemwIs.js';
|
|
3
|
+
import { S as Scanner } from './scanner-BJFA0354.js';
|
|
4
|
+
export { b as ScannerEvents, a as StatsCollector, c as StatsEvents } from './scanner-BJFA0354.js';
|
|
5
5
|
export { ChainAnalyzer, ChainEvents } from './chain.js';
|
|
6
6
|
export { FixEvents, FixSuggester } from './fix.js';
|
|
7
7
|
export { detectFramework, detectFrameworkFromWindow, frameworkDetectors, getFrameworkTips } from './detect.js';
|
|
8
|
-
import { E as EventEmitter } from './event-emitter-
|
|
8
|
+
import { E as EventEmitter } from './event-emitter-BVYUPYLd.js';
|
|
9
9
|
import * as node_net from 'node:net';
|
|
10
|
-
import * as puppeteer from 'puppeteer';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* React Fiber utilities for interacting with React internals
|
|
@@ -626,6 +625,19 @@ declare class Logger {
|
|
|
626
625
|
group(label: string, fn: () => void): void;
|
|
627
626
|
}
|
|
628
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Component name pattern matching
|
|
630
|
+
* @packageDocumentation
|
|
631
|
+
*/
|
|
632
|
+
/**
|
|
633
|
+
* Match a component name against a simple glob pattern (`*` = any characters,
|
|
634
|
+
* `?` = one character). All other characters match literally.
|
|
635
|
+
* @param name - Component name
|
|
636
|
+
* @param pattern - Glob pattern
|
|
637
|
+
* @returns true if the name matches
|
|
638
|
+
*/
|
|
639
|
+
declare function matchComponentPattern(name: string, pattern: string): boolean;
|
|
640
|
+
|
|
629
641
|
/**
|
|
630
642
|
* WebSocket client connection
|
|
631
643
|
*/
|
|
@@ -759,6 +771,12 @@ declare class WebSocketServer extends EventEmitter<WebSocketServerEvents> {
|
|
|
759
771
|
* Stop the server
|
|
760
772
|
*/
|
|
761
773
|
stop(): Promise<void>;
|
|
774
|
+
/**
|
|
775
|
+
* Get the port the server listens on (the real port after start() when
|
|
776
|
+
* constructed with port 0)
|
|
777
|
+
* @returns Port number
|
|
778
|
+
*/
|
|
779
|
+
getPort(): number;
|
|
762
780
|
/**
|
|
763
781
|
* Broadcast message to all clients
|
|
764
782
|
* @param message - Message to broadcast
|
|
@@ -839,18 +857,13 @@ declare class ProxyServer extends EventEmitter<ProxyServerEvents> {
|
|
|
839
857
|
private options;
|
|
840
858
|
/** Target URL parsed */
|
|
841
859
|
private targetUrl;
|
|
842
|
-
/** Injection script */
|
|
860
|
+
/** Injection script (loaded from the bundled browser script on start() when not provided) */
|
|
843
861
|
private injectionScript;
|
|
844
862
|
/**
|
|
845
863
|
* Create a new proxy server
|
|
846
864
|
* @param options - Proxy options
|
|
847
865
|
*/
|
|
848
866
|
constructor(options: ProxyOptions);
|
|
849
|
-
/**
|
|
850
|
-
* Build the injection script
|
|
851
|
-
* @returns Injection script string
|
|
852
|
-
*/
|
|
853
|
-
private buildInjectionScript;
|
|
854
867
|
/**
|
|
855
868
|
* Handle incoming request
|
|
856
869
|
* @param req - Client request
|
|
@@ -897,6 +910,11 @@ declare class ProxyServer extends EventEmitter<ProxyServerEvents> {
|
|
|
897
910
|
setInjectionScript(script: string): void;
|
|
898
911
|
}
|
|
899
912
|
|
|
913
|
+
/**
|
|
914
|
+
* Browser launcher using Puppeteer
|
|
915
|
+
* @packageDocumentation
|
|
916
|
+
*/
|
|
917
|
+
|
|
900
918
|
/**
|
|
901
919
|
* Browser launch options
|
|
902
920
|
*/
|
|
@@ -942,8 +960,46 @@ interface BrowserEvents {
|
|
|
942
960
|
/** Browser closed */
|
|
943
961
|
closed: void;
|
|
944
962
|
}
|
|
945
|
-
|
|
946
|
-
|
|
963
|
+
/**
|
|
964
|
+
* The commonly used part of Puppeteer's `Page`, typed structurally so that the
|
|
965
|
+
* package's types work without Puppeteer installed. For the full API pass
|
|
966
|
+
* Puppeteer's type: `launcher.getPage<import('puppeteer').Page>()`.
|
|
967
|
+
*/
|
|
968
|
+
interface PuppeteerPageLike {
|
|
969
|
+
/** Navigate to a URL */
|
|
970
|
+
goto(url: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
971
|
+
/** Click the first element matching a selector */
|
|
972
|
+
click(selector: string, options?: Record<string, unknown>): Promise<void>;
|
|
973
|
+
/** Type text into the element matching a selector */
|
|
974
|
+
type(selector: string, text: string, options?: Record<string, unknown>): Promise<void>;
|
|
975
|
+
/** Focus the element matching a selector */
|
|
976
|
+
focus(selector: string): Promise<void>;
|
|
977
|
+
/** Hover the element matching a selector */
|
|
978
|
+
hover(selector: string): Promise<void>;
|
|
979
|
+
/** Wait for an element matching a selector */
|
|
980
|
+
waitForSelector(selector: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
981
|
+
/** Evaluate a function or expression in the page */
|
|
982
|
+
evaluate<T>(fn: string | (() => T)): Promise<T>;
|
|
983
|
+
/** Take a screenshot */
|
|
984
|
+
screenshot(options?: Record<string, unknown>): Promise<unknown>;
|
|
985
|
+
/** Reload the page */
|
|
986
|
+
reload(options?: Record<string, unknown>): Promise<unknown>;
|
|
987
|
+
/** Current URL */
|
|
988
|
+
url(): string;
|
|
989
|
+
/** Close the page */
|
|
990
|
+
close(): Promise<void>;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* The commonly used part of Puppeteer's `Browser` (see {@link PuppeteerPageLike})
|
|
994
|
+
*/
|
|
995
|
+
interface PuppeteerBrowserLike {
|
|
996
|
+
/** Whether the browser is still connected */
|
|
997
|
+
readonly connected: boolean;
|
|
998
|
+
/** Open a new page */
|
|
999
|
+
newPage(): Promise<PuppeteerPageLike>;
|
|
1000
|
+
/** Close the browser */
|
|
1001
|
+
close(): Promise<void>;
|
|
1002
|
+
}
|
|
947
1003
|
/**
|
|
948
1004
|
* Browser launcher wrapper around Puppeteer
|
|
949
1005
|
*/
|
|
@@ -1017,15 +1073,17 @@ declare class BrowserLauncher extends EventEmitter<BrowserEvents> {
|
|
|
1017
1073
|
*/
|
|
1018
1074
|
isOpen(): boolean;
|
|
1019
1075
|
/**
|
|
1020
|
-
* Get the page instance (for advanced usage)
|
|
1076
|
+
* Get the page instance (for advanced usage). The return type is a
|
|
1077
|
+
* structural subset of Puppeteer's `Page`; pass the real type for the full
|
|
1078
|
+
* API: `getPage<import('puppeteer').Page>()`.
|
|
1021
1079
|
* @returns Puppeteer page or null
|
|
1022
1080
|
*/
|
|
1023
|
-
getPage():
|
|
1081
|
+
getPage<TPage = PuppeteerPageLike>(): TPage | null;
|
|
1024
1082
|
/**
|
|
1025
|
-
* Get the browser instance (for advanced usage)
|
|
1083
|
+
* Get the browser instance (for advanced usage); see {@link getPage}
|
|
1026
1084
|
* @returns Puppeteer browser or null
|
|
1027
1085
|
*/
|
|
1028
|
-
getBrowser():
|
|
1086
|
+
getBrowser<TBrowser = PuppeteerBrowserLike>(): TBrowser | null;
|
|
1029
1087
|
}
|
|
1030
1088
|
/**
|
|
1031
1089
|
* Check if Puppeteer is available
|
|
@@ -1033,6 +1091,14 @@ declare class BrowserLauncher extends EventEmitter<BrowserEvents> {
|
|
|
1033
1091
|
*/
|
|
1034
1092
|
declare function isPuppeteerAvailable(): Promise<boolean>;
|
|
1035
1093
|
|
|
1094
|
+
/**
|
|
1095
|
+
* Load the browser injection script and prepend the WebSocket port setting
|
|
1096
|
+
* @param wsPort - Port of the CLI WebSocket server the page should connect to
|
|
1097
|
+
* @returns Script source ready for `evaluateOnNewDocument` or a `<script>` tag
|
|
1098
|
+
* @throws Error when the bundle cannot be found (broken installation)
|
|
1099
|
+
*/
|
|
1100
|
+
declare function loadInjectionScript(wsPort: number): Promise<string>;
|
|
1101
|
+
|
|
1036
1102
|
/**
|
|
1037
1103
|
* Browser overlay for render visualization
|
|
1038
1104
|
* @packageDocumentation
|
|
@@ -1050,6 +1116,14 @@ interface OverlayConfig {
|
|
|
1050
1116
|
showToolbar: boolean;
|
|
1051
1117
|
/** Highlight duration in ms (0 = persistent until cleared) */
|
|
1052
1118
|
highlightDuration: number;
|
|
1119
|
+
/**
|
|
1120
|
+
* Render-count thresholds used for the highlight colours and toolbar counts
|
|
1121
|
+
* (same meaning as the scanner thresholds; default warning 20, critical 50)
|
|
1122
|
+
*/
|
|
1123
|
+
thresholds?: {
|
|
1124
|
+
warning: number;
|
|
1125
|
+
critical: number;
|
|
1126
|
+
};
|
|
1053
1127
|
}
|
|
1054
1128
|
/**
|
|
1055
1129
|
* Overlay for visualizing React renders in the browser
|
|
@@ -1092,6 +1166,10 @@ declare class Overlay {
|
|
|
1092
1166
|
constructor(config?: Partial<OverlayConfig>);
|
|
1093
1167
|
/** Retry count for init */
|
|
1094
1168
|
private initRetryCount;
|
|
1169
|
+
/** Pending init retry timer (document.body not ready yet) */
|
|
1170
|
+
private initRetryTimer;
|
|
1171
|
+
/** Aborts document-level listeners (drag handling) on destroy */
|
|
1172
|
+
private documentListeners;
|
|
1095
1173
|
/**
|
|
1096
1174
|
* Initialize the overlay
|
|
1097
1175
|
*/
|
|
@@ -1180,6 +1258,12 @@ declare class Overlay {
|
|
|
1180
1258
|
* Get severity level
|
|
1181
1259
|
*/
|
|
1182
1260
|
private getSeverity;
|
|
1261
|
+
/**
|
|
1262
|
+
* Severity for a render count using the configured thresholds (a count at or
|
|
1263
|
+
* above a threshold reaches that level, like the scanner's stats)
|
|
1264
|
+
* @param count - Render count
|
|
1265
|
+
*/
|
|
1266
|
+
private severityForCount;
|
|
1183
1267
|
/**
|
|
1184
1268
|
* Record a render event
|
|
1185
1269
|
*/
|
|
@@ -1265,8 +1349,6 @@ declare class BrowserScanner extends EventEmitter<BrowserScannerEvents> {
|
|
|
1265
1349
|
private running;
|
|
1266
1350
|
/** React version detected */
|
|
1267
1351
|
private reactVersion;
|
|
1268
|
-
/** Previous fiber states for comparison */
|
|
1269
|
-
private prevFiberStates;
|
|
1270
1352
|
/** Component render counts */
|
|
1271
1353
|
private renderCounts;
|
|
1272
1354
|
/** Original DevTools hook methods */
|
|
@@ -1333,16 +1415,14 @@ declare class BrowserScanner extends EventEmitter<BrowserScannerEvents> {
|
|
|
1333
1415
|
*/
|
|
1334
1416
|
private detectReactVersion;
|
|
1335
1417
|
/**
|
|
1336
|
-
* Process a fiber commit (public for IIFE hook integration)
|
|
1337
|
-
*
|
|
1418
|
+
* Process a fiber commit (public for IIFE hook integration).
|
|
1419
|
+
*
|
|
1420
|
+
* Only components that actually rendered in this commit are reported: React
|
|
1421
|
+
* reuses untouched subtrees (their `child` pointer is shared with the
|
|
1422
|
+
* alternate) and bailed-out components do not get the `PerformedWork` flag.
|
|
1423
|
+
* @param rootFiber - Root fiber of the committed tree (`root.current`)
|
|
1338
1424
|
*/
|
|
1339
1425
|
processCommit(rootFiber: FiberNode): void;
|
|
1340
|
-
/**
|
|
1341
|
-
* Walk the fiber tree
|
|
1342
|
-
* @param fiber - Current fiber
|
|
1343
|
-
* @param parent - Parent component name
|
|
1344
|
-
*/
|
|
1345
|
-
private walkFiber;
|
|
1346
1426
|
/**
|
|
1347
1427
|
* Process a single fiber
|
|
1348
1428
|
* @param fiber - Fiber to process
|
|
@@ -1396,8 +1476,13 @@ declare class BrowserScanner extends EventEmitter<BrowserScannerEvents> {
|
|
|
1396
1476
|
}
|
|
1397
1477
|
|
|
1398
1478
|
/**
|
|
1399
|
-
* Browser
|
|
1400
|
-
*
|
|
1479
|
+
* Browser-side injector: coordinates the BrowserScanner, the Overlay and the
|
|
1480
|
+
* WebSocket connection to the CLI.
|
|
1481
|
+
*
|
|
1482
|
+
* This module has NO side effects when imported, so it is safe to import from
|
|
1483
|
+
* Node.js, SSR bundles and tests. The self-installing IIFE lives in
|
|
1484
|
+
* `inject.ts`, which is only built into `dist/browser-inject.global.js`.
|
|
1485
|
+
*
|
|
1401
1486
|
* @packageDocumentation
|
|
1402
1487
|
*/
|
|
1403
1488
|
|
|
@@ -1417,10 +1502,35 @@ declare class ReactCheckInjector {
|
|
|
1417
1502
|
private reconnectTimeout;
|
|
1418
1503
|
/** Whether initialized */
|
|
1419
1504
|
private initialized;
|
|
1505
|
+
/** Whether destroyed (no more reconnects, commits are ignored) */
|
|
1506
|
+
private destroyed;
|
|
1507
|
+
/** Whether commit processing is paused (CLI sent `stop`) */
|
|
1508
|
+
private paused;
|
|
1509
|
+
/** Commits received before `init()` */
|
|
1510
|
+
private pendingCommits;
|
|
1511
|
+
/** Message queue for messages sent before connection */
|
|
1512
|
+
private messageQueue;
|
|
1513
|
+
/** requestAnimationFrame handle for FPS measurement */
|
|
1514
|
+
private rafHandle;
|
|
1515
|
+
/** Restores the React DevTools hook to its state before installation */
|
|
1516
|
+
private restoreHook;
|
|
1517
|
+
/** Window reference */
|
|
1518
|
+
private win;
|
|
1519
|
+
/** React version last reported to the CLI in a `ready` message */
|
|
1520
|
+
private reportedReactVersion;
|
|
1420
1521
|
/**
|
|
1421
1522
|
* Create the injector
|
|
1523
|
+
* @param win - Window object (defaults to the global window)
|
|
1422
1524
|
*/
|
|
1423
|
-
constructor();
|
|
1525
|
+
constructor(win?: WindowWithReactDevTools);
|
|
1526
|
+
/**
|
|
1527
|
+
* Feed a committed fiber root to the scanner. Called from the React DevTools
|
|
1528
|
+
* hook installed by {@link installReactCheck}.
|
|
1529
|
+
* @param root - Fiber root passed to `onCommitFiberRoot`
|
|
1530
|
+
*/
|
|
1531
|
+
handleCommit(root: {
|
|
1532
|
+
current: FiberNode;
|
|
1533
|
+
} | null | undefined): void;
|
|
1424
1534
|
/**
|
|
1425
1535
|
* Initialize the injector
|
|
1426
1536
|
*/
|
|
@@ -1429,10 +1539,20 @@ declare class ReactCheckInjector {
|
|
|
1429
1539
|
* Set up scanner event handlers
|
|
1430
1540
|
*/
|
|
1431
1541
|
private setupScannerEvents;
|
|
1542
|
+
/**
|
|
1543
|
+
* Measure frames per second with requestAnimationFrame and report it
|
|
1544
|
+
*/
|
|
1545
|
+
private startFpsMeasurement;
|
|
1432
1546
|
/**
|
|
1433
1547
|
* Connect to CLI WebSocket server
|
|
1434
1548
|
*/
|
|
1435
1549
|
private connect;
|
|
1550
|
+
/**
|
|
1551
|
+
* Remove event handlers from a socket so that closing it does not trigger
|
|
1552
|
+
* reconnects
|
|
1553
|
+
* @param ws - Socket
|
|
1554
|
+
*/
|
|
1555
|
+
private detachSocket;
|
|
1436
1556
|
/**
|
|
1437
1557
|
* Schedule a reconnection attempt
|
|
1438
1558
|
*/
|
|
@@ -1461,8 +1581,10 @@ declare class ReactCheckInjector {
|
|
|
1461
1581
|
* @param config - New configuration
|
|
1462
1582
|
*/
|
|
1463
1583
|
private handleConfig;
|
|
1464
|
-
/**
|
|
1465
|
-
|
|
1584
|
+
/**
|
|
1585
|
+
* Send a `ready` message with the React version detected so far
|
|
1586
|
+
*/
|
|
1587
|
+
private sendReady;
|
|
1466
1588
|
/**
|
|
1467
1589
|
* Send message to CLI
|
|
1468
1590
|
* @param message - Browser message
|
|
@@ -1473,10 +1595,85 @@ declare class ReactCheckInjector {
|
|
|
1473
1595
|
*/
|
|
1474
1596
|
private flushMessageQueue;
|
|
1475
1597
|
/**
|
|
1476
|
-
*
|
|
1598
|
+
* Register a function that restores the DevTools hook on destroy
|
|
1599
|
+
* @param restore - Restore callback
|
|
1600
|
+
*/
|
|
1601
|
+
setHookRestorer(restore: () => void): void;
|
|
1602
|
+
/**
|
|
1603
|
+
* Destroy the injector: stops reconnecting, closes the socket, restores the
|
|
1604
|
+
* React DevTools hook, removes the overlay and cancels all timers.
|
|
1477
1605
|
*/
|
|
1478
1606
|
destroy(): void;
|
|
1479
1607
|
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Install ReactCheck into a page: hooks the React DevTools global hook (creating
|
|
1610
|
+
* it when React has not loaded yet), creates the injector and initialises it
|
|
1611
|
+
* once the DOM is ready. Returns `null` on internal pages or when ReactCheck is
|
|
1612
|
+
* already installed.
|
|
1613
|
+
*
|
|
1614
|
+
* @param win - Window object
|
|
1615
|
+
* @returns The injector instance, or null when nothing was installed
|
|
1616
|
+
*/
|
|
1617
|
+
declare function installReactCheck(win: WindowWithReactDevTools): ReactCheckInjector | null;
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* Package version (kept in sync with package.json; checked by tests)
|
|
1621
|
+
* @packageDocumentation
|
|
1622
|
+
*/
|
|
1623
|
+
declare const VERSION = "1.3.1";
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* One-call programmatic scan of a URL
|
|
1627
|
+
* @packageDocumentation
|
|
1628
|
+
*/
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Options for {@link quickScan}
|
|
1632
|
+
*/
|
|
1633
|
+
interface QuickScanOptions {
|
|
1634
|
+
/** How long to observe the page, in milliseconds (default: 30000) */
|
|
1635
|
+
duration?: number;
|
|
1636
|
+
/** Run the browser headless (default: true) */
|
|
1637
|
+
headless?: boolean;
|
|
1638
|
+
/** Directory to write reports to (no files are written when omitted) */
|
|
1639
|
+
output?: string;
|
|
1640
|
+
/** Report formats to write when `output` is set (default: html, json) */
|
|
1641
|
+
formats?: Array<'html' | 'json' | 'md'>;
|
|
1642
|
+
/** Render-count thresholds */
|
|
1643
|
+
thresholds?: {
|
|
1644
|
+
critical?: number;
|
|
1645
|
+
warning?: number;
|
|
1646
|
+
fps?: number;
|
|
1647
|
+
};
|
|
1648
|
+
/** Only track components matching these glob patterns */
|
|
1649
|
+
include?: string[];
|
|
1650
|
+
/** Ignore components matching these glob patterns */
|
|
1651
|
+
exclude?: string[];
|
|
1652
|
+
/** Port for the internal WebSocket server (default: a free ephemeral port) */
|
|
1653
|
+
port?: number;
|
|
1654
|
+
/** Extra Chrome arguments passed to Puppeteer */
|
|
1655
|
+
browserArgs?: string[];
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Quick scan a URL and generate a report. Launches Chrome through Puppeteer
|
|
1659
|
+
* (an optional peer dependency), injects the ReactCheck browser script, records
|
|
1660
|
+
* renders for `duration` milliseconds and returns the session report.
|
|
1661
|
+
*
|
|
1662
|
+
* @example
|
|
1663
|
+
* ```typescript
|
|
1664
|
+
* import { quickScan } from '@oxog/react-check';
|
|
1665
|
+
*
|
|
1666
|
+
* const report = await quickScan('http://localhost:3000', {
|
|
1667
|
+
* duration: 30000,
|
|
1668
|
+
* headless: true,
|
|
1669
|
+
* });
|
|
1670
|
+
*
|
|
1671
|
+
* console.log(`Found ${report.summary.criticalIssues} critical issues`);
|
|
1672
|
+
* ```
|
|
1673
|
+
* @throws ReactCheckError BROWSER_LAUNCH_FAILED when Puppeteer is missing or the
|
|
1674
|
+
* browser cannot start, REACT_NOT_FOUND when no React render was observed
|
|
1675
|
+
*/
|
|
1676
|
+
declare function quickScan(url: string, options?: QuickScanOptions): Promise<SessionReport>;
|
|
1480
1677
|
|
|
1481
1678
|
/**
|
|
1482
1679
|
* ReactCheck - Zero-dependency React Performance Scanner
|
|
@@ -1486,7 +1683,6 @@ declare class ReactCheckInjector {
|
|
|
1486
1683
|
* @packageDocumentation
|
|
1487
1684
|
*/
|
|
1488
1685
|
|
|
1489
|
-
declare const VERSION = "1.0.0";
|
|
1490
1686
|
/**
|
|
1491
1687
|
* Create a new ReactCheck scanner instance with default options
|
|
1492
1688
|
*
|
|
@@ -1509,7 +1705,12 @@ declare function createScanner(options?: {
|
|
|
1509
1705
|
thresholds?: {
|
|
1510
1706
|
critical?: number;
|
|
1511
1707
|
warning?: number;
|
|
1708
|
+
fps?: number;
|
|
1512
1709
|
};
|
|
1710
|
+
/** Only track components matching one of these glob patterns */
|
|
1711
|
+
include?: string[];
|
|
1712
|
+
/** Ignore components matching one of these glob patterns */
|
|
1713
|
+
exclude?: string[];
|
|
1513
1714
|
}): Scanner;
|
|
1514
1715
|
/**
|
|
1515
1716
|
* Create a new report generator
|
|
@@ -1531,26 +1732,5 @@ declare function createReportGenerator(options?: {
|
|
|
1531
1732
|
output?: string;
|
|
1532
1733
|
includeSourceCode?: boolean;
|
|
1533
1734
|
}): ReportGenerator;
|
|
1534
|
-
/**
|
|
1535
|
-
* Quick scan a URL and generate a report
|
|
1536
|
-
*
|
|
1537
|
-
* @example
|
|
1538
|
-
* ```typescript
|
|
1539
|
-
* import { quickScan } from '@oxog/react-check';
|
|
1540
|
-
*
|
|
1541
|
-
* const report = await quickScan('http://localhost:3000', {
|
|
1542
|
-
* duration: 30000,
|
|
1543
|
-
* headless: true,
|
|
1544
|
-
* });
|
|
1545
|
-
*
|
|
1546
|
-
* console.log(`Found ${report.summary.criticalIssues} critical issues`);
|
|
1547
|
-
* ```
|
|
1548
|
-
*/
|
|
1549
|
-
declare function quickScan(url: string, options?: {
|
|
1550
|
-
duration?: number;
|
|
1551
|
-
headless?: boolean;
|
|
1552
|
-
output?: string;
|
|
1553
|
-
formats?: Array<'html' | 'json' | 'md'>;
|
|
1554
|
-
}): Promise<SessionReport>;
|
|
1555
1735
|
|
|
1556
|
-
export { type BrowserEvents, type BrowserLaunchOptions, BrowserLauncher, BrowserMessage, BrowserScanner, type BrowserScannerEvents, CLIMessage, EventEmitter, FiberNode, FiberTag, LogLevel, Logger, Overlay, type OverlayConfig, type ProxyOptions, ProxyServer, type ProxyServerEvents, ReactCheckInjector, ReactDevToolsHook, RenderChainInfo, RenderInfo, type ReportFormat, ReportGenerator, ReportOptions, Scanner, ScannerConfig, SessionReport, VERSION, WebSocketClient, WebSocketServer, type WebSocketServerEvents, WindowWithReactDevTools, colors, createRenderInfo, createReportGenerator, createScanner, ensureDir, escapeHtml, exists, findFiberByName, findUp, formatBytes, formatDuration, formatNumber, formatPercent, formatRenderTime, generateHTMLReport, generateJSONReport, generateMarkdownReport, generateReport, getBaseName, getChangedProps, getComponentName, getComponentPath, getDirName, getExtension, getFiberDOMNode, getOwner, getParentFiber, getReactVersion, handleBrowserMessages, isHostComponent, isMemoized, isPuppeteerAvailable, isUserComponent, joinPath, pad, parseJSONReport, quickScan, readJsonFile, readTextFile, resolvePath, saveReport, saveReports, shallowEqual, stripAnsi, supportsColor, truncate, validateJSONReport, walkFiberTree, writeJsonFile, writeTextFile };
|
|
1736
|
+
export { type BrowserEvents, type BrowserLaunchOptions, BrowserLauncher, BrowserMessage, BrowserScanner, type BrowserScannerEvents, CLIMessage, EventEmitter, FiberNode, FiberTag, LogLevel, Logger, Overlay, type OverlayConfig, type ProxyOptions, ProxyServer, type ProxyServerEvents, type PuppeteerBrowserLike, type PuppeteerPageLike, type QuickScanOptions, ReactCheckInjector, ReactDevToolsHook, RenderChainInfo, RenderInfo, type ReportFormat, ReportGenerator, ReportOptions, Scanner, ScannerConfig, SessionReport, VERSION, WebSocketClient, WebSocketServer, type WebSocketServerEvents, WindowWithReactDevTools, colors, createRenderInfo, createReportGenerator, createScanner, ensureDir, escapeHtml, exists, findFiberByName, findUp, formatBytes, formatDuration, formatNumber, formatPercent, formatRenderTime, generateHTMLReport, generateJSONReport, generateMarkdownReport, generateReport, getBaseName, getChangedProps, getComponentName, getComponentPath, getDirName, getExtension, getFiberDOMNode, getOwner, getParentFiber, getReactVersion, handleBrowserMessages, installReactCheck, isHostComponent, isMemoized, isPuppeteerAvailable, isUserComponent, joinPath, loadInjectionScript, matchComponentPattern, pad, parseJSONReport, quickScan, readJsonFile, readTextFile, resolvePath, saveReport, saveReports, shallowEqual, stripAnsi, supportsColor, truncate, validateJSONReport, walkFiberTree, writeJsonFile, writeTextFile };
|