react-doctor 0.7.6-dev.81e6647 → 0.7.6-dev.8528def
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/cli.js +24 -65
- package/dist/index.js +17 -51
- package/dist/lsp.js +17 -51
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bc56f5c4-5b95-5727-8e86-d43a534abbbc")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -36341,12 +36341,10 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
36341
36341
|
const listSourceFilesWithSize = (rootDirectory) => collectSizedSourceFiles(rootDirectory, (listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory)).sort());
|
|
36342
36342
|
const listSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).map((entry) => entry.path);
|
|
36343
36343
|
const countSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).length;
|
|
36344
|
-
const UTF8_BOM_CHARACTER = "";
|
|
36345
|
-
const stripUtf8Bom = (content) => content.startsWith(UTF8_BOM_CHARACTER) ? content.slice(1) : content;
|
|
36346
36344
|
const cachedPackageJsons = /* @__PURE__ */ new Map();
|
|
36347
36345
|
const readPackageJsonUncached = (packageJsonPath) => {
|
|
36348
36346
|
try {
|
|
36349
|
-
return JSON.parse(
|
|
36347
|
+
return JSON.parse(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
36350
36348
|
} catch (error) {
|
|
36351
36349
|
if (error instanceof SyntaxError) return {};
|
|
36352
36350
|
if (isErrnoException(error)) {
|
|
@@ -40019,6 +40017,7 @@ const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
40019
40017
|
const PNPM_LOCKFILE = "pnpm-lock.yaml";
|
|
40020
40018
|
const PACKAGE_JSON_FILE = "package.json";
|
|
40021
40019
|
const PNPM_HARDENING_RULE_KEY = "require-pnpm-hardening";
|
|
40020
|
+
const UTF8_BOM_CHAR = "";
|
|
40022
40021
|
const HARDENING_SETTING_KEYS = new Set([
|
|
40023
40022
|
"minimumReleaseAge",
|
|
40024
40023
|
"blockExoticSubdeps",
|
|
@@ -40043,11 +40042,12 @@ const stripInlineComment = (rawValue) => {
|
|
|
40043
40042
|
return rawValue;
|
|
40044
40043
|
};
|
|
40045
40044
|
const unquote = (rawValue) => rawValue.replace(/^["']|["']$/g, "");
|
|
40045
|
+
const stripBom = (rawContent) => rawContent.startsWith(UTF8_BOM_CHAR) ? rawContent.slice(1) : rawContent;
|
|
40046
40046
|
const parseHardeningSettings = (content) => {
|
|
40047
40047
|
let minimumReleaseAge = null;
|
|
40048
40048
|
let blockExoticSubdeps = null;
|
|
40049
40049
|
let trustPolicy = null;
|
|
40050
|
-
const lines =
|
|
40050
|
+
const lines = stripBom(content).split(/\r?\n/);
|
|
40051
40051
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
40052
40052
|
const lineText = lines[lineIndex];
|
|
40053
40053
|
if (lineText === void 0) continue;
|
|
@@ -40081,7 +40081,7 @@ const isPnpmManagedProject = (rootDirectory) => {
|
|
|
40081
40081
|
const packageJsonPath = Path.join(rootDirectory, PACKAGE_JSON_FILE);
|
|
40082
40082
|
if (!isFile(packageJsonPath)) return false;
|
|
40083
40083
|
try {
|
|
40084
|
-
const packageJsonRaw =
|
|
40084
|
+
const packageJsonRaw = NFS.readFileSync(packageJsonPath, "utf-8");
|
|
40085
40085
|
const packageJson = JSON.parse(packageJsonRaw);
|
|
40086
40086
|
if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
|
|
40087
40087
|
} catch {
|
|
@@ -42886,12 +42886,6 @@ const mapWithConcurrency = async (items, concurrency, task) => {
|
|
|
42886
42886
|
if (errors.length > 0) throw errors[0];
|
|
42887
42887
|
return results;
|
|
42888
42888
|
};
|
|
42889
|
-
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
42890
|
-
let lineNumber = 1;
|
|
42891
|
-
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
42892
|
-
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === 10) lineNumber++;
|
|
42893
|
-
return lineNumber;
|
|
42894
|
-
};
|
|
42895
42889
|
const REANIMATED_SHARED_VALUE_HINT = "If this is a Reanimated shared value, prefer its React Compiler-compatible `.get()` / `.set()` accessors over `.value` — https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/#react-compiler-support";
|
|
42896
42890
|
const ACCESSORS_MIN_VERSION = "3.15.0";
|
|
42897
42891
|
const supportsAccessors = (reanimatedVersion) => {
|
|
@@ -43463,6 +43457,13 @@ const findOutermostEnclosingFunctionRange = (sourceFile, targetLine) => {
|
|
|
43463
43457
|
visit(sourceFile);
|
|
43464
43458
|
return foundRange;
|
|
43465
43459
|
};
|
|
43460
|
+
const NEWLINE_BYTE = 10;
|
|
43461
|
+
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
43462
|
+
let lineNumber = 1;
|
|
43463
|
+
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
43464
|
+
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === NEWLINE_BYTE) lineNumber++;
|
|
43465
|
+
return lineNumber;
|
|
43466
|
+
};
|
|
43466
43467
|
/**
|
|
43467
43468
|
* Drops `react-doctor/react-compiler-no-manual-memoization` diagnostics
|
|
43468
43469
|
* whose enclosing function also carries a `react-hooks-js` (React
|
|
@@ -43667,33 +43668,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
43667
43668
|
}
|
|
43668
43669
|
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
43669
43670
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
43670
|
-
const sourceBufferCache = /* @__PURE__ */ new Map();
|
|
43671
|
-
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
43672
|
-
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
43673
|
-
const readSourceBuffer = (filename) => {
|
|
43674
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
43675
|
-
const cached = sourceBufferCache.get(absolutePath);
|
|
43676
|
-
if (cached !== void 0) return cached;
|
|
43677
|
-
let sourceBuffer;
|
|
43678
|
-
try {
|
|
43679
|
-
sourceBuffer = NFS.readFileSync(absolutePath);
|
|
43680
|
-
} catch {
|
|
43681
|
-
sourceBuffer = null;
|
|
43682
|
-
}
|
|
43683
|
-
sourceBufferCache.set(absolutePath, sourceBuffer);
|
|
43684
|
-
return sourceBuffer;
|
|
43685
|
-
};
|
|
43686
|
-
const readSourceLines = (filename) => {
|
|
43687
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
43688
|
-
const cached = sourceLinesCache.get(absolutePath);
|
|
43689
|
-
if (cached !== void 0) return cached;
|
|
43690
|
-
const sourceBuffer = readSourceBuffer(filename);
|
|
43691
|
-
const sourceLines = sourceBuffer ? sourceBuffer.toString("utf8").split("\n") : null;
|
|
43692
|
-
sourceLinesCache.set(absolutePath, sourceLines);
|
|
43693
|
-
return sourceLines;
|
|
43694
|
-
};
|
|
43695
43671
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
43696
|
-
const absolutePath =
|
|
43672
|
+
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
43697
43673
|
const cached = minifiedFileCache.get(absolutePath);
|
|
43698
43674
|
if (cached !== void 0) return cached;
|
|
43699
43675
|
const minified = isMinifiedSource(absolutePath);
|
|
@@ -43706,17 +43682,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
43706
43682
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
43707
43683
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
43708
43684
|
const primarySpan = primaryLabel?.span;
|
|
43709
|
-
const sourceBuffer = primarySpan ? readSourceBuffer(diagnostic.filename) : null;
|
|
43710
43685
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
43711
43686
|
const category = resolveDiagnosticCategory(plugin, rule);
|
|
43712
|
-
const matchByOccurrence = resolveMatchByOccurrence(rule, category);
|
|
43713
|
-
const sourceLines = primarySpan ? readSourceLines(diagnostic.filename) : null;
|
|
43714
|
-
const primaryLineIndex = primarySpan ? primarySpan.line - 1 : -1;
|
|
43715
|
-
const primaryLine = sourceLines?.[primaryLineIndex];
|
|
43716
|
-
const primaryColumnIndex = primarySpan ? primarySpan.column - 1 : -1;
|
|
43717
|
-
const isJsxTagLabel = primaryLine !== void 0 && primaryColumnIndex >= 0 && (primaryLine[primaryColumnIndex] === "<" || primaryLine[primaryColumnIndex - 1] === "<");
|
|
43718
|
-
const jsxOpenerEndLineIndex = sourceLines && isJsxTagLabel ? findJsxOpenerSpan(sourceLines, primaryLineIndex) : null;
|
|
43719
|
-
const primarySpanEndLine = jsxOpenerEndLineIndex !== null ? jsxOpenerEndLineIndex + 1 : primarySpan && sourceBuffer ? lineOfUtf8Offset(sourceBuffer, primarySpan.offset + Math.max(primarySpan.length - 1, 0)) : void 0;
|
|
43720
43687
|
return {
|
|
43721
43688
|
filePath: normalizedFilePath,
|
|
43722
43689
|
plugin,
|
|
@@ -43730,11 +43697,10 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
43730
43697
|
column: primarySpan?.column ?? 0,
|
|
43731
43698
|
...primarySpan ? {
|
|
43732
43699
|
offset: primarySpan.offset,
|
|
43733
|
-
length: primarySpan.length
|
|
43734
|
-
...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
|
|
43700
|
+
length: primarySpan.length
|
|
43735
43701
|
} : {},
|
|
43736
43702
|
category,
|
|
43737
|
-
...
|
|
43703
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
43738
43704
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
43739
43705
|
};
|
|
43740
43706
|
}), rootDirectory);
|
|
@@ -46699,7 +46665,7 @@ const makeNoopConsole = () => ({
|
|
|
46699
46665
|
});
|
|
46700
46666
|
//#endregion
|
|
46701
46667
|
//#region src/cli/utils/version.ts
|
|
46702
|
-
const VERSION = "0.7.6-dev.
|
|
46668
|
+
const VERSION = "0.7.6-dev.8528def";
|
|
46703
46669
|
//#endregion
|
|
46704
46670
|
//#region src/cli/utils/json-mode.ts
|
|
46705
46671
|
let context = null;
|
|
@@ -47068,13 +47034,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47068
47034
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47069
47035
|
* standard `SENTRY_RELEASE` override.
|
|
47070
47036
|
*/
|
|
47071
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.6-dev.
|
|
47037
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.6-dev.8528def`;
|
|
47072
47038
|
/**
|
|
47073
47039
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47074
47040
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47075
47041
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47076
47042
|
*/
|
|
47077
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.6-dev.
|
|
47043
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.6-dev.8528def") ? "development" : "production");
|
|
47078
47044
|
/**
|
|
47079
47045
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47080
47046
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -50839,7 +50805,7 @@ const BLOCKING_SUMMARY = {
|
|
|
50839
50805
|
const SCOPE_SUMMARY = {
|
|
50840
50806
|
full: "Scan the whole project on every run",
|
|
50841
50807
|
files: "Report every issue in changed files",
|
|
50842
|
-
lines: "Report issues
|
|
50808
|
+
lines: "Report issues on changed lines",
|
|
50843
50809
|
changed: "Report only the issues a change introduces"
|
|
50844
50810
|
};
|
|
50845
50811
|
const gatesEqual = (left, right) => left.blocking === right.blocking && left.scope === right.scope && left.comment === right.comment && left.reviewComments === right.reviewComments && left.commitStatus === right.commitStatus;
|
|
@@ -59709,8 +59675,7 @@ const buildScanAttributes = (input) => {
|
|
|
59709
59675
|
rulesConfigured: ruleKeys.length,
|
|
59710
59676
|
rulesDisabled: ruleKeys.filter((key) => ruleOverrides[key] === "off").length,
|
|
59711
59677
|
fileCount: input.result?.scannedFileCount ?? null,
|
|
59712
|
-
nonJsxFileCount: input.result?.analyzedFiles?.filter((filePath) => !JSX_FILE_PATTERN.test(filePath)).length ?? null
|
|
59713
|
-
multilineDiagnosticCount: input.result?.diagnostics.filter((diagnostic) => (diagnostic.endLine ?? diagnostic.line) > diagnostic.line).length ?? null
|
|
59678
|
+
nonJsxFileCount: input.result?.analyzedFiles?.filter((filePath) => !JSX_FILE_PATTERN.test(filePath)).length ?? null
|
|
59714
59679
|
});
|
|
59715
59680
|
};
|
|
59716
59681
|
/**
|
|
@@ -59779,12 +59744,6 @@ const countDeadlineSkippedFiles = (lintPartialFailures) => sumFileCountsMatching
|
|
|
59779
59744
|
const DROPPED_FILES_MESSAGE_PATTERN = /^(\d+) file\(s\) failed to lint and were skipped/;
|
|
59780
59745
|
const countDroppedLintFiles = (lintPartialFailures) => sumFileCountsMatching(lintPartialFailures, DROPPED_FILES_MESSAGE_PATTERN);
|
|
59781
59746
|
//#endregion
|
|
59782
|
-
//#region src/cli/utils/diagnostic-intersects-line-ranges.ts
|
|
59783
|
-
const diagnosticIntersectsLineRanges = (diagnostic, lineRanges) => {
|
|
59784
|
-
const diagnosticEndLine = Math.max(diagnostic.line, diagnostic.endLine ?? diagnostic.line);
|
|
59785
|
-
return lineRanges.some(([rangeStartLine, rangeEndLine]) => diagnostic.line <= rangeEndLine && diagnosticEndLine >= rangeStartLine);
|
|
59786
|
-
};
|
|
59787
|
-
//#endregion
|
|
59788
59747
|
//#region src/cli/utils/materialize-baseline-files.ts
|
|
59789
59748
|
/**
|
|
59790
59749
|
* Materializes the `ref` version of `files` into `tempDirectory` (via
|
|
@@ -60970,7 +60929,7 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
60970
60929
|
const relativePath = toForwardSlashes(path.isAbsolute(diagnostic.filePath) ? path.relative(directory, diagnostic.filePath) : diagnostic.filePath);
|
|
60971
60930
|
const ranges = rangesByFile.get(relativePath);
|
|
60972
60931
|
if (ranges === void 0) return false;
|
|
60973
|
-
return
|
|
60932
|
+
return ranges.some(([start, end]) => diagnostic.line >= start && diagnostic.line <= end);
|
|
60974
60933
|
};
|
|
60975
60934
|
};
|
|
60976
60935
|
const buildIgnoredTags = (userConfig) => {
|
|
@@ -65221,7 +65180,7 @@ ${highlighter.dim("Learn more:")}
|
|
|
65221
65180
|
${highlighter.info(CI_URL)}
|
|
65222
65181
|
`;
|
|
65223
65182
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
65224
|
-
const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--supply-chain", "enable the dependency supply-chain scan (default)").option("--no-supply-chain", "skip the dependency supply-chain scan (Socket.dev dependency health checks)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").option("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("--json-out <path>", "with --json, write the report to a file instead of stdout").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much supported JS/TS source to scan/report: full (default), files, changed (only new issues vs base), or lines (
|
|
65183
|
+
const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--supply-chain", "enable the dependency supply-chain scan (default)").option("--no-supply-chain", "skip the dependency supply-chain scan (Socket.dev dependency health checks)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").option("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("--json-out <path>", "with --json, write the report to a file instead of stdout").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much supported JS/TS source to scan/report: full (default), files, changed (only new issues vs base), or lines (only changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--max-duration <seconds>", "scan time budget for the whole run, shared across workspace projects: past it, remaining lint batches and dead-code are skipped and partial results are reported (skipped files are listed in the JSON report)").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
|
|
65225
65184
|
program.action(inspectAction);
|
|
65226
65185
|
program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
|
|
65227
65186
|
program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
|
|
@@ -65271,4 +65230,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
65271
65230
|
export {};
|
|
65272
65231
|
|
|
65273
65232
|
//# sourceMappingURL=cli.js.map
|
|
65274
|
-
//# debugId=
|
|
65233
|
+
//# debugId=bc56f5c4-5b95-5727-8e86-d43a534abbbc
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3e7262c1-34a6-5fd7-a4a2-5e7a15ca735d")}catch(e){}}();
|
|
3
3
|
import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
@@ -33142,15 +33142,13 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
33142
33142
|
const listSourceFilesWithSize = (rootDirectory) => collectSizedSourceFiles(rootDirectory, (listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory)).sort());
|
|
33143
33143
|
const listSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).map((entry) => entry.path);
|
|
33144
33144
|
const countSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).length;
|
|
33145
|
-
const UTF8_BOM_CHARACTER = "";
|
|
33146
|
-
const stripUtf8Bom = (content) => content.startsWith(UTF8_BOM_CHARACTER) ? content.slice(1) : content;
|
|
33147
33145
|
const cachedPackageJsons = /* @__PURE__ */ new Map();
|
|
33148
33146
|
const clearPackageJsonCache = () => {
|
|
33149
33147
|
cachedPackageJsons.clear();
|
|
33150
33148
|
};
|
|
33151
33149
|
const readPackageJsonUncached = (packageJsonPath) => {
|
|
33152
33150
|
try {
|
|
33153
|
-
return JSON.parse(
|
|
33151
|
+
return JSON.parse(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
33154
33152
|
} catch (error) {
|
|
33155
33153
|
if (error instanceof SyntaxError) return {};
|
|
33156
33154
|
if (isErrnoException(error)) {
|
|
@@ -36791,6 +36789,7 @@ const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
36791
36789
|
const PNPM_LOCKFILE = "pnpm-lock.yaml";
|
|
36792
36790
|
const PACKAGE_JSON_FILE = "package.json";
|
|
36793
36791
|
const PNPM_HARDENING_RULE_KEY = "require-pnpm-hardening";
|
|
36792
|
+
const UTF8_BOM_CHAR = "";
|
|
36794
36793
|
const HARDENING_SETTING_KEYS = new Set([
|
|
36795
36794
|
"minimumReleaseAge",
|
|
36796
36795
|
"blockExoticSubdeps",
|
|
@@ -36815,11 +36814,12 @@ const stripInlineComment = (rawValue) => {
|
|
|
36815
36814
|
return rawValue;
|
|
36816
36815
|
};
|
|
36817
36816
|
const unquote = (rawValue) => rawValue.replace(/^["']|["']$/g, "");
|
|
36817
|
+
const stripBom = (rawContent) => rawContent.startsWith(UTF8_BOM_CHAR) ? rawContent.slice(1) : rawContent;
|
|
36818
36818
|
const parseHardeningSettings = (content) => {
|
|
36819
36819
|
let minimumReleaseAge = null;
|
|
36820
36820
|
let blockExoticSubdeps = null;
|
|
36821
36821
|
let trustPolicy = null;
|
|
36822
|
-
const lines =
|
|
36822
|
+
const lines = stripBom(content).split(/\r?\n/);
|
|
36823
36823
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
36824
36824
|
const lineText = lines[lineIndex];
|
|
36825
36825
|
if (lineText === void 0) continue;
|
|
@@ -36853,7 +36853,7 @@ const isPnpmManagedProject = (rootDirectory) => {
|
|
|
36853
36853
|
const packageJsonPath = Path.join(rootDirectory, PACKAGE_JSON_FILE);
|
|
36854
36854
|
if (!isFile(packageJsonPath)) return false;
|
|
36855
36855
|
try {
|
|
36856
|
-
const packageJsonRaw =
|
|
36856
|
+
const packageJsonRaw = NFS.readFileSync(packageJsonPath, "utf-8");
|
|
36857
36857
|
const packageJson = JSON.parse(packageJsonRaw);
|
|
36858
36858
|
if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
|
|
36859
36859
|
} catch {
|
|
@@ -39642,12 +39642,6 @@ const mapWithConcurrency = async (items, concurrency, task) => {
|
|
|
39642
39642
|
if (errors.length > 0) throw errors[0];
|
|
39643
39643
|
return results;
|
|
39644
39644
|
};
|
|
39645
|
-
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
39646
|
-
let lineNumber = 1;
|
|
39647
|
-
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
39648
|
-
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === 10) lineNumber++;
|
|
39649
|
-
return lineNumber;
|
|
39650
|
-
};
|
|
39651
39645
|
const REANIMATED_SHARED_VALUE_HINT = "If this is a Reanimated shared value, prefer its React Compiler-compatible `.get()` / `.set()` accessors over `.value` — https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/#react-compiler-support";
|
|
39652
39646
|
const ACCESSORS_MIN_VERSION = "3.15.0";
|
|
39653
39647
|
const supportsAccessors = (reanimatedVersion) => {
|
|
@@ -40219,6 +40213,13 @@ const findOutermostEnclosingFunctionRange = (sourceFile, targetLine) => {
|
|
|
40219
40213
|
visit(sourceFile);
|
|
40220
40214
|
return foundRange;
|
|
40221
40215
|
};
|
|
40216
|
+
const NEWLINE_BYTE = 10;
|
|
40217
|
+
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
40218
|
+
let lineNumber = 1;
|
|
40219
|
+
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
40220
|
+
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === NEWLINE_BYTE) lineNumber++;
|
|
40221
|
+
return lineNumber;
|
|
40222
|
+
};
|
|
40222
40223
|
/**
|
|
40223
40224
|
* Drops `react-doctor/react-compiler-no-manual-memoization` diagnostics
|
|
40224
40225
|
* whose enclosing function also carries a `react-hooks-js` (React
|
|
@@ -40423,33 +40424,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40423
40424
|
}
|
|
40424
40425
|
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40425
40426
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
40426
|
-
const sourceBufferCache = /* @__PURE__ */ new Map();
|
|
40427
|
-
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
40428
|
-
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40429
|
-
const readSourceBuffer = (filename) => {
|
|
40430
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40431
|
-
const cached = sourceBufferCache.get(absolutePath);
|
|
40432
|
-
if (cached !== void 0) return cached;
|
|
40433
|
-
let sourceBuffer;
|
|
40434
|
-
try {
|
|
40435
|
-
sourceBuffer = NFS.readFileSync(absolutePath);
|
|
40436
|
-
} catch {
|
|
40437
|
-
sourceBuffer = null;
|
|
40438
|
-
}
|
|
40439
|
-
sourceBufferCache.set(absolutePath, sourceBuffer);
|
|
40440
|
-
return sourceBuffer;
|
|
40441
|
-
};
|
|
40442
|
-
const readSourceLines = (filename) => {
|
|
40443
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40444
|
-
const cached = sourceLinesCache.get(absolutePath);
|
|
40445
|
-
if (cached !== void 0) return cached;
|
|
40446
|
-
const sourceBuffer = readSourceBuffer(filename);
|
|
40447
|
-
const sourceLines = sourceBuffer ? sourceBuffer.toString("utf8").split("\n") : null;
|
|
40448
|
-
sourceLinesCache.set(absolutePath, sourceLines);
|
|
40449
|
-
return sourceLines;
|
|
40450
|
-
};
|
|
40451
40427
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
40452
|
-
const absolutePath =
|
|
40428
|
+
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40453
40429
|
const cached = minifiedFileCache.get(absolutePath);
|
|
40454
40430
|
if (cached !== void 0) return cached;
|
|
40455
40431
|
const minified = isMinifiedSource(absolutePath);
|
|
@@ -40462,17 +40438,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40462
40438
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
40463
40439
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
40464
40440
|
const primarySpan = primaryLabel?.span;
|
|
40465
|
-
const sourceBuffer = primarySpan ? readSourceBuffer(diagnostic.filename) : null;
|
|
40466
40441
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
40467
40442
|
const category = resolveDiagnosticCategory(plugin, rule);
|
|
40468
|
-
const matchByOccurrence = resolveMatchByOccurrence(rule, category);
|
|
40469
|
-
const sourceLines = primarySpan ? readSourceLines(diagnostic.filename) : null;
|
|
40470
|
-
const primaryLineIndex = primarySpan ? primarySpan.line - 1 : -1;
|
|
40471
|
-
const primaryLine = sourceLines?.[primaryLineIndex];
|
|
40472
|
-
const primaryColumnIndex = primarySpan ? primarySpan.column - 1 : -1;
|
|
40473
|
-
const isJsxTagLabel = primaryLine !== void 0 && primaryColumnIndex >= 0 && (primaryLine[primaryColumnIndex] === "<" || primaryLine[primaryColumnIndex - 1] === "<");
|
|
40474
|
-
const jsxOpenerEndLineIndex = sourceLines && isJsxTagLabel ? findJsxOpenerSpan(sourceLines, primaryLineIndex) : null;
|
|
40475
|
-
const primarySpanEndLine = jsxOpenerEndLineIndex !== null ? jsxOpenerEndLineIndex + 1 : primarySpan && sourceBuffer ? lineOfUtf8Offset(sourceBuffer, primarySpan.offset + Math.max(primarySpan.length - 1, 0)) : void 0;
|
|
40476
40443
|
return {
|
|
40477
40444
|
filePath: normalizedFilePath,
|
|
40478
40445
|
plugin,
|
|
@@ -40486,11 +40453,10 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40486
40453
|
column: primarySpan?.column ?? 0,
|
|
40487
40454
|
...primarySpan ? {
|
|
40488
40455
|
offset: primarySpan.offset,
|
|
40489
|
-
length: primarySpan.length
|
|
40490
|
-
...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
|
|
40456
|
+
length: primarySpan.length
|
|
40491
40457
|
} : {},
|
|
40492
40458
|
category,
|
|
40493
|
-
...
|
|
40459
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
40494
40460
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
40495
40461
|
};
|
|
40496
40462
|
}), rootDirectory);
|
|
@@ -43241,4 +43207,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43241
43207
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43242
43208
|
|
|
43243
43209
|
//# sourceMappingURL=index.js.map
|
|
43244
|
-
//# debugId=
|
|
43210
|
+
//# debugId=3e7262c1-34a6-5fd7-a4a2-5e7a15ca735d
|
package/dist/lsp.js
CHANGED
|
@@ -33194,15 +33194,13 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
33194
33194
|
const listSourceFilesWithSize = (rootDirectory) => collectSizedSourceFiles(rootDirectory, (listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory)).sort());
|
|
33195
33195
|
const listSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).map((entry) => entry.path);
|
|
33196
33196
|
const countSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).length;
|
|
33197
|
-
const UTF8_BOM_CHARACTER = "";
|
|
33198
|
-
const stripUtf8Bom = (content) => content.startsWith(UTF8_BOM_CHARACTER) ? content.slice(1) : content;
|
|
33199
33197
|
const cachedPackageJsons = /* @__PURE__ */ new Map();
|
|
33200
33198
|
const clearPackageJsonCache = () => {
|
|
33201
33199
|
cachedPackageJsons.clear();
|
|
33202
33200
|
};
|
|
33203
33201
|
const readPackageJsonUncached = (packageJsonPath) => {
|
|
33204
33202
|
try {
|
|
33205
|
-
return JSON.parse(
|
|
33203
|
+
return JSON.parse(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
33206
33204
|
} catch (error) {
|
|
33207
33205
|
if (error instanceof SyntaxError) return {};
|
|
33208
33206
|
if (isErrnoException(error)) {
|
|
@@ -36769,6 +36767,7 @@ const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
36769
36767
|
const PNPM_LOCKFILE = "pnpm-lock.yaml";
|
|
36770
36768
|
const PACKAGE_JSON_FILE = "package.json";
|
|
36771
36769
|
const PNPM_HARDENING_RULE_KEY = "require-pnpm-hardening";
|
|
36770
|
+
const UTF8_BOM_CHAR = "";
|
|
36772
36771
|
const HARDENING_SETTING_KEYS = new Set([
|
|
36773
36772
|
"minimumReleaseAge",
|
|
36774
36773
|
"blockExoticSubdeps",
|
|
@@ -36793,11 +36792,12 @@ const stripInlineComment = (rawValue) => {
|
|
|
36793
36792
|
return rawValue;
|
|
36794
36793
|
};
|
|
36795
36794
|
const unquote = (rawValue) => rawValue.replace(/^["']|["']$/g, "");
|
|
36795
|
+
const stripBom = (rawContent) => rawContent.startsWith(UTF8_BOM_CHAR) ? rawContent.slice(1) : rawContent;
|
|
36796
36796
|
const parseHardeningSettings = (content) => {
|
|
36797
36797
|
let minimumReleaseAge = null;
|
|
36798
36798
|
let blockExoticSubdeps = null;
|
|
36799
36799
|
let trustPolicy = null;
|
|
36800
|
-
const lines =
|
|
36800
|
+
const lines = stripBom(content).split(/\r?\n/);
|
|
36801
36801
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
36802
36802
|
const lineText = lines[lineIndex];
|
|
36803
36803
|
if (lineText === void 0) continue;
|
|
@@ -36831,7 +36831,7 @@ const isPnpmManagedProject = (rootDirectory) => {
|
|
|
36831
36831
|
const packageJsonPath = Path.join(rootDirectory, PACKAGE_JSON_FILE);
|
|
36832
36832
|
if (!isFile(packageJsonPath)) return false;
|
|
36833
36833
|
try {
|
|
36834
|
-
const packageJsonRaw =
|
|
36834
|
+
const packageJsonRaw = NFS.readFileSync(packageJsonPath, "utf-8");
|
|
36835
36835
|
const packageJson = JSON.parse(packageJsonRaw);
|
|
36836
36836
|
if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
|
|
36837
36837
|
} catch {
|
|
@@ -39620,12 +39620,6 @@ const mapWithConcurrency = async (items, concurrency, task) => {
|
|
|
39620
39620
|
if (errors.length > 0) throw errors[0];
|
|
39621
39621
|
return results;
|
|
39622
39622
|
};
|
|
39623
|
-
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
39624
|
-
let lineNumber = 1;
|
|
39625
|
-
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
39626
|
-
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === 10) lineNumber++;
|
|
39627
|
-
return lineNumber;
|
|
39628
|
-
};
|
|
39629
39623
|
const REANIMATED_SHARED_VALUE_HINT = "If this is a Reanimated shared value, prefer its React Compiler-compatible `.get()` / `.set()` accessors over `.value` — https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/#react-compiler-support";
|
|
39630
39624
|
const ACCESSORS_MIN_VERSION = "3.15.0";
|
|
39631
39625
|
const supportsAccessors = (reanimatedVersion) => {
|
|
@@ -40197,6 +40191,13 @@ const findOutermostEnclosingFunctionRange = (sourceFile, targetLine) => {
|
|
|
40197
40191
|
visit(sourceFile);
|
|
40198
40192
|
return foundRange;
|
|
40199
40193
|
};
|
|
40194
|
+
const NEWLINE_BYTE = 10;
|
|
40195
|
+
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
40196
|
+
let lineNumber = 1;
|
|
40197
|
+
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
40198
|
+
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === NEWLINE_BYTE) lineNumber++;
|
|
40199
|
+
return lineNumber;
|
|
40200
|
+
};
|
|
40200
40201
|
/**
|
|
40201
40202
|
* Drops `react-doctor/react-compiler-no-manual-memoization` diagnostics
|
|
40202
40203
|
* whose enclosing function also carries a `react-hooks-js` (React
|
|
@@ -40401,33 +40402,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40401
40402
|
}
|
|
40402
40403
|
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40403
40404
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
40404
|
-
const sourceBufferCache = /* @__PURE__ */ new Map();
|
|
40405
|
-
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
40406
|
-
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40407
|
-
const readSourceBuffer = (filename) => {
|
|
40408
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40409
|
-
const cached = sourceBufferCache.get(absolutePath);
|
|
40410
|
-
if (cached !== void 0) return cached;
|
|
40411
|
-
let sourceBuffer;
|
|
40412
|
-
try {
|
|
40413
|
-
sourceBuffer = NFS.readFileSync(absolutePath);
|
|
40414
|
-
} catch {
|
|
40415
|
-
sourceBuffer = null;
|
|
40416
|
-
}
|
|
40417
|
-
sourceBufferCache.set(absolutePath, sourceBuffer);
|
|
40418
|
-
return sourceBuffer;
|
|
40419
|
-
};
|
|
40420
|
-
const readSourceLines = (filename) => {
|
|
40421
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40422
|
-
const cached = sourceLinesCache.get(absolutePath);
|
|
40423
|
-
if (cached !== void 0) return cached;
|
|
40424
|
-
const sourceBuffer = readSourceBuffer(filename);
|
|
40425
|
-
const sourceLines = sourceBuffer ? sourceBuffer.toString("utf8").split("\n") : null;
|
|
40426
|
-
sourceLinesCache.set(absolutePath, sourceLines);
|
|
40427
|
-
return sourceLines;
|
|
40428
|
-
};
|
|
40429
40405
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
40430
|
-
const absolutePath =
|
|
40406
|
+
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40431
40407
|
const cached = minifiedFileCache.get(absolutePath);
|
|
40432
40408
|
if (cached !== void 0) return cached;
|
|
40433
40409
|
const minified = isMinifiedSource(absolutePath);
|
|
@@ -40440,17 +40416,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40440
40416
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
40441
40417
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
40442
40418
|
const primarySpan = primaryLabel?.span;
|
|
40443
|
-
const sourceBuffer = primarySpan ? readSourceBuffer(diagnostic.filename) : null;
|
|
40444
40419
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
40445
40420
|
const category = resolveDiagnosticCategory(plugin, rule);
|
|
40446
|
-
const matchByOccurrence = resolveMatchByOccurrence(rule, category);
|
|
40447
|
-
const sourceLines = primarySpan ? readSourceLines(diagnostic.filename) : null;
|
|
40448
|
-
const primaryLineIndex = primarySpan ? primarySpan.line - 1 : -1;
|
|
40449
|
-
const primaryLine = sourceLines?.[primaryLineIndex];
|
|
40450
|
-
const primaryColumnIndex = primarySpan ? primarySpan.column - 1 : -1;
|
|
40451
|
-
const isJsxTagLabel = primaryLine !== void 0 && primaryColumnIndex >= 0 && (primaryLine[primaryColumnIndex] === "<" || primaryLine[primaryColumnIndex - 1] === "<");
|
|
40452
|
-
const jsxOpenerEndLineIndex = sourceLines && isJsxTagLabel ? findJsxOpenerSpan(sourceLines, primaryLineIndex) : null;
|
|
40453
|
-
const primarySpanEndLine = jsxOpenerEndLineIndex !== null ? jsxOpenerEndLineIndex + 1 : primarySpan && sourceBuffer ? lineOfUtf8Offset(sourceBuffer, primarySpan.offset + Math.max(primarySpan.length - 1, 0)) : void 0;
|
|
40454
40421
|
return {
|
|
40455
40422
|
filePath: normalizedFilePath,
|
|
40456
40423
|
plugin,
|
|
@@ -40464,11 +40431,10 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40464
40431
|
column: primarySpan?.column ?? 0,
|
|
40465
40432
|
...primarySpan ? {
|
|
40466
40433
|
offset: primarySpan.offset,
|
|
40467
|
-
length: primarySpan.length
|
|
40468
|
-
...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
|
|
40434
|
+
length: primarySpan.length
|
|
40469
40435
|
} : {},
|
|
40470
40436
|
category,
|
|
40471
|
-
...
|
|
40437
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
40472
40438
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
40473
40439
|
};
|
|
40474
40440
|
}), rootDirectory);
|
|
@@ -44878,5 +44844,5 @@ const startLanguageServer = () => {
|
|
|
44878
44844
|
};
|
|
44879
44845
|
//#endregion
|
|
44880
44846
|
export { startLanguageServer };
|
|
44881
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
44882
|
-
//# debugId=
|
|
44847
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a3135dfe-cc85-5d34-adea-93f5c29d9bcb")}catch(e){}}();
|
|
44848
|
+
//# debugId=a3135dfe-cc85-5d34-adea-93f5c29d9bcb
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.7.6-dev.
|
|
3
|
+
"version": "0.7.6-dev.8528def",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"oxlint-plugin-react-doctor": "0.7.6-dev.8528def",
|
|
69
|
+
"deslop-js": "0.7.6"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"ora": "^9.4.0",
|
|
77
77
|
"@react-doctor/api": "0.7.6",
|
|
78
|
-
"@react-doctor/
|
|
79
|
-
"@react-doctor/
|
|
78
|
+
"@react-doctor/language-server": "0.7.6",
|
|
79
|
+
"@react-doctor/core": "0.7.6"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": "^20.19.0 || >=22.13.0"
|