@oxog/react-check 1.1.1 → 1.1.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/CHANGELOG.md +20 -0
- package/dist/cli.js +86 -23
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +27 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +27 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.3] - 2025-12-31
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Automatic puppeteer installation: If puppeteer is not installed, ReactCheck will automatically install it on first run
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Removed debug console.log statements from production build
|
|
17
|
+
|
|
18
|
+
## [1.1.2] - 2025-12-31
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- SSL/HTTPS support: Browser now ignores certificate errors for self-signed certs
|
|
23
|
+
- Improved scan stability: Better signal handling for Windows and non-TTY environments
|
|
24
|
+
- TUI now properly detects TTY availability and falls back gracefully
|
|
25
|
+
- Added automatic retry (3 attempts) when target app is not ready
|
|
26
|
+
- Better error messages for common issues (connection refused, port in use)
|
|
27
|
+
|
|
8
28
|
## [1.1.1] - 2025-12-31
|
|
9
29
|
|
|
10
30
|
### Added
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { dirname, resolve, join, extname, basename } from 'path';
|
|
|
5
5
|
import { createServer } from 'http';
|
|
6
6
|
import { createHash } from 'crypto';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
|
-
import { exec } from 'child_process';
|
|
8
|
+
import { exec, execSync } from 'child_process';
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -5605,6 +5605,8 @@ var BrowserLauncher = class extends EventEmitter {
|
|
|
5605
5605
|
"--disable-setuid-sandbox",
|
|
5606
5606
|
"--disable-dev-shm-usage",
|
|
5607
5607
|
"--disable-gpu",
|
|
5608
|
+
"--ignore-certificate-errors",
|
|
5609
|
+
"--ignore-certificate-errors-spki-list",
|
|
5608
5610
|
`--window-size=${this.options.width},${this.options.height}`,
|
|
5609
5611
|
...this.options.args
|
|
5610
5612
|
];
|
|
@@ -5661,25 +5663,37 @@ var BrowserLauncher = class extends EventEmitter {
|
|
|
5661
5663
|
});
|
|
5662
5664
|
}
|
|
5663
5665
|
/**
|
|
5664
|
-
* Navigate to a URL
|
|
5666
|
+
* Navigate to a URL with retry support
|
|
5665
5667
|
* @param url - URL to navigate to
|
|
5668
|
+
* @param retries - Number of retries (default: 3)
|
|
5669
|
+
* @param retryDelay - Delay between retries in ms (default: 2000)
|
|
5666
5670
|
*/
|
|
5667
|
-
async navigate(url) {
|
|
5671
|
+
async navigate(url, retries = 3, retryDelay = 2e3) {
|
|
5668
5672
|
if (!this.page) {
|
|
5669
5673
|
throw new Error("Browser not launched");
|
|
5670
5674
|
}
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5675
|
+
let lastError = null;
|
|
5676
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
5677
|
+
try {
|
|
5678
|
+
await this.page.goto(url, {
|
|
5679
|
+
waitUntil: "networkidle2",
|
|
5680
|
+
timeout: this.options.timeout
|
|
5681
|
+
});
|
|
5682
|
+
this.emit("navigated", { url });
|
|
5683
|
+
logger3.info(`Navigated to ${url}`);
|
|
5684
|
+
return;
|
|
5685
|
+
} catch (error) {
|
|
5686
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
5687
|
+
this.emit("error", lastError);
|
|
5688
|
+
if (lastError.message.includes("ERR_CONNECTION_REFUSED") && attempt < retries) {
|
|
5689
|
+
logger3.warn(`Connection refused, retrying in ${retryDelay}ms... (${attempt}/${retries})`);
|
|
5690
|
+
await new Promise((resolve3) => setTimeout(resolve3, retryDelay));
|
|
5691
|
+
continue;
|
|
5692
|
+
}
|
|
5693
|
+
throw lastError;
|
|
5694
|
+
}
|
|
5682
5695
|
}
|
|
5696
|
+
throw lastError ?? new Error("Navigation failed");
|
|
5683
5697
|
}
|
|
5684
5698
|
/**
|
|
5685
5699
|
* Execute script in page context
|
|
@@ -7027,6 +7041,29 @@ var WebUIServer = class extends EventEmitter {
|
|
|
7027
7041
|
}
|
|
7028
7042
|
};
|
|
7029
7043
|
var logger4 = new Logger({ prefix: "scan", level: 1 /* INFO */ });
|
|
7044
|
+
async function installPuppeteer() {
|
|
7045
|
+
console.log("");
|
|
7046
|
+
console.log(colors.cyan + "\u{1F4E6} Puppeteer is required for browser automation." + colors.reset);
|
|
7047
|
+
console.log(colors.gray + " Installing puppeteer... (this may take a minute)" + colors.reset);
|
|
7048
|
+
console.log("");
|
|
7049
|
+
try {
|
|
7050
|
+
execSync("npm install puppeteer --no-save", {
|
|
7051
|
+
stdio: "inherit",
|
|
7052
|
+
timeout: 3e5
|
|
7053
|
+
// 5 minutes timeout
|
|
7054
|
+
});
|
|
7055
|
+
console.log("");
|
|
7056
|
+
console.log(colors.green + "\u2713 Puppeteer installed successfully!" + colors.reset);
|
|
7057
|
+
console.log("");
|
|
7058
|
+
return true;
|
|
7059
|
+
} catch (error) {
|
|
7060
|
+
console.log("");
|
|
7061
|
+
logger4.error("Failed to install puppeteer automatically.");
|
|
7062
|
+
logger4.info("Please install it manually: npm install puppeteer");
|
|
7063
|
+
logger4.info("Or use --proxy mode: react-check scan --proxy <url>");
|
|
7064
|
+
return false;
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7030
7067
|
function parseScanOptions(args) {
|
|
7031
7068
|
return {
|
|
7032
7069
|
target: normalizeTarget(args.target ?? "localhost:3000"),
|
|
@@ -7123,7 +7160,7 @@ async function runScanCommand(args) {
|
|
|
7123
7160
|
browserClients: /* @__PURE__ */ new Set()
|
|
7124
7161
|
};
|
|
7125
7162
|
setupScannerEvents(session);
|
|
7126
|
-
const useTUI = !mergedOptions.silent && !mergedOptions.proxy;
|
|
7163
|
+
const useTUI = !mergedOptions.silent && !mergedOptions.proxy && process.stdin.isTTY;
|
|
7127
7164
|
if (useTUI) {
|
|
7128
7165
|
session.tui = new TUI(mergedOptions.target);
|
|
7129
7166
|
setupTUIEvents(session);
|
|
@@ -7133,6 +7170,8 @@ async function runScanCommand(args) {
|
|
|
7133
7170
|
fps: session.scanner.getFps()
|
|
7134
7171
|
}));
|
|
7135
7172
|
session.tui.start();
|
|
7173
|
+
} else if (!mergedOptions.silent && !mergedOptions.proxy && !process.stdin.isTTY) {
|
|
7174
|
+
logger4.warn("TTY not available, TUI disabled. Use --silent for non-interactive mode.");
|
|
7136
7175
|
}
|
|
7137
7176
|
if (mergedOptions.webui) {
|
|
7138
7177
|
session.webui = new WebUIServer(mergedOptions.webuiPort, mergedOptions.target);
|
|
@@ -7195,12 +7234,19 @@ async function runScanCommand(args) {
|
|
|
7195
7234
|
console.log(` Press ${colors.bold}Ctrl+C${colors.reset} to stop scanning`);
|
|
7196
7235
|
console.log("");
|
|
7197
7236
|
} else {
|
|
7198
|
-
|
|
7237
|
+
let hasPuppeteer = await isPuppeteerAvailable();
|
|
7199
7238
|
if (!hasPuppeteer) {
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7239
|
+
const installed = await installPuppeteer();
|
|
7240
|
+
if (!installed) {
|
|
7241
|
+
await session.wsServer.stop();
|
|
7242
|
+
return 2;
|
|
7243
|
+
}
|
|
7244
|
+
hasPuppeteer = await isPuppeteerAvailable();
|
|
7245
|
+
if (!hasPuppeteer) {
|
|
7246
|
+
logger4.error("Puppeteer installation failed. Please try manually: npm install puppeteer");
|
|
7247
|
+
await session.wsServer.stop();
|
|
7248
|
+
return 2;
|
|
7249
|
+
}
|
|
7204
7250
|
}
|
|
7205
7251
|
const injectionScript = await getInjectionScript(mergedOptions.port);
|
|
7206
7252
|
session.browser = new BrowserLauncher({
|
|
@@ -7243,7 +7289,20 @@ async function runScanCommand(args) {
|
|
|
7243
7289
|
return summary.criticalIssues > 0 ? 1 : 0;
|
|
7244
7290
|
} catch (error) {
|
|
7245
7291
|
await cleanupSession(session);
|
|
7246
|
-
|
|
7292
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
7293
|
+
if (errorMessage.includes("ERR_CONNECTION_REFUSED")) {
|
|
7294
|
+
logger4.error(`Could not connect to ${mergedOptions.target}`);
|
|
7295
|
+
logger4.info("Make sure your React application is running at that address.");
|
|
7296
|
+
logger4.info("Example: npm start or npm run dev");
|
|
7297
|
+
} else if (errorMessage.includes("EADDRINUSE")) {
|
|
7298
|
+
logger4.error(`Port ${mergedOptions.port} is already in use`);
|
|
7299
|
+
logger4.info("Try using a different port with --port <number>");
|
|
7300
|
+
} else if (errorMessage.includes("ERR_CERT")) {
|
|
7301
|
+
logger4.error("SSL certificate error");
|
|
7302
|
+
logger4.info("ReactCheck now supports self-signed certificates by default.");
|
|
7303
|
+
} else {
|
|
7304
|
+
logger4.error("Scan failed:", errorMessage);
|
|
7305
|
+
}
|
|
7247
7306
|
return 2;
|
|
7248
7307
|
}
|
|
7249
7308
|
}
|
|
@@ -7356,6 +7415,10 @@ async function waitForSignal() {
|
|
|
7356
7415
|
return new Promise((resolve3) => {
|
|
7357
7416
|
process.once("SIGINT", () => resolve3());
|
|
7358
7417
|
process.once("SIGTERM", () => resolve3());
|
|
7418
|
+
if (process.stdin.isTTY) {
|
|
7419
|
+
process.stdin.resume();
|
|
7420
|
+
}
|
|
7421
|
+
process.stdin.once("end", () => resolve3());
|
|
7359
7422
|
});
|
|
7360
7423
|
}
|
|
7361
7424
|
function generateReport(session) {
|
|
@@ -7368,7 +7431,7 @@ function generateReport(session) {
|
|
|
7368
7431
|
id: session.id
|
|
7369
7432
|
};
|
|
7370
7433
|
return {
|
|
7371
|
-
version: "1.
|
|
7434
|
+
version: "1.1.3",
|
|
7372
7435
|
generated: formatDate(),
|
|
7373
7436
|
session: sessionInfo,
|
|
7374
7437
|
summary: exported.stats.summary,
|
|
@@ -7560,7 +7623,7 @@ async function runInitCommand(args) {
|
|
|
7560
7623
|
|
|
7561
7624
|
// src/cli/index.ts
|
|
7562
7625
|
var logger6 = new Logger({ prefix: "ReactCheck", level: 1 /* INFO */ });
|
|
7563
|
-
var VERSION = "1.
|
|
7626
|
+
var VERSION = "1.1.3";
|
|
7564
7627
|
function printVersion() {
|
|
7565
7628
|
console.log(`@oxog/react-check v${VERSION}`);
|
|
7566
7629
|
}
|