react-doctor 0.7.6-dev.0150fc9 → 0.7.6-dev.0a8d30b
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 +41 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -9
- package/dist/lsp.js +23 -7
- package/package.json +2 -2
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]="5dcb5b0b-ca1e-5655-8f52-3c22b421256d")}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";
|
|
@@ -41823,6 +41823,7 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
41823
41823
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
41824
41824
|
};
|
|
41825
41825
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
41826
|
+
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
41826
41827
|
/**
|
|
41827
41828
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
41828
41829
|
* behind a `Context.Service`. The production layer (`layerNode`)
|
|
@@ -41893,6 +41894,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
41893
41894
|
args,
|
|
41894
41895
|
directory
|
|
41895
41896
|
});
|
|
41897
|
+
const listUntrackedFilePaths = (directory, includePaths = []) => runGit(directory, [
|
|
41898
|
+
"ls-files",
|
|
41899
|
+
"-z",
|
|
41900
|
+
"--others",
|
|
41901
|
+
"--exclude-standard",
|
|
41902
|
+
...includePaths.length > 0 ? ["--", ...includePaths] : []
|
|
41903
|
+
]).pipe(map$3((result) => result.status === 0 ? splitNullSeparated(result.stdout) : null));
|
|
41904
|
+
const mergeUntracked = (directory, trackedFilePaths, includeUntracked) => includeUntracked ? listUntrackedFilePaths(directory).pipe(map$3((untracked) => untracked === null ? trackedFilePaths : [...new Set([...trackedFilePaths, ...untracked])])) : succeed$2(trackedFilePaths);
|
|
41896
41905
|
const currentBranch = (directory) => runGit(directory, [
|
|
41897
41906
|
"rev-parse",
|
|
41898
41907
|
"--abbrev-ref",
|
|
@@ -42015,7 +42024,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
42015
42024
|
githubViewerPermission,
|
|
42016
42025
|
branchExists,
|
|
42017
42026
|
mergeBase,
|
|
42018
|
-
diffSelection: ({ directory, explicitBaseBranch }) => gen(function* () {
|
|
42027
|
+
diffSelection: ({ directory, explicitBaseBranch, includeUntracked = false }) => gen(function* () {
|
|
42019
42028
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
42020
42029
|
if (explicitBaseBranch !== void 0) {
|
|
42021
42030
|
const range = parseGitDiffRange(explicitBaseBranch);
|
|
@@ -42044,7 +42053,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
42044
42053
|
"HEAD"
|
|
42045
42054
|
]);
|
|
42046
42055
|
if (uncommitted.status !== 0) return null;
|
|
42047
|
-
const files = splitNullSeparated(uncommitted.stdout);
|
|
42056
|
+
const files = yield* mergeUntracked(directory, splitNullSeparated(uncommitted.stdout), includeUntracked);
|
|
42048
42057
|
if (files.length === 0) return null;
|
|
42049
42058
|
return {
|
|
42050
42059
|
currentBranch: resolvedCurrentBranch,
|
|
@@ -42074,7 +42083,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
42074
42083
|
currentBranch: resolvedCurrentBranch,
|
|
42075
42084
|
baseBranch,
|
|
42076
42085
|
diffBaseRef: mergeBaseRef,
|
|
42077
|
-
changedFiles: splitNullSeparated(diff.stdout),
|
|
42086
|
+
changedFiles: yield* mergeUntracked(directory, splitNullSeparated(diff.stdout), includeUntracked),
|
|
42078
42087
|
isCurrentChanges: false
|
|
42079
42088
|
};
|
|
42080
42089
|
}).pipe(withSpan("Git.diffSelection")),
|
|
@@ -42120,7 +42129,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
42120
42129
|
stdout: result.stdout
|
|
42121
42130
|
};
|
|
42122
42131
|
}).pipe(withSpan("Git.grep")),
|
|
42123
|
-
changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
|
|
42132
|
+
changedLineRanges: ({ directory, baseRef, cached, files, includeUntracked = false }) => gen(function* () {
|
|
42124
42133
|
if (files.length === 0) return [];
|
|
42125
42134
|
if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
|
|
42126
42135
|
const result = yield* runGit(directory, [
|
|
@@ -42134,7 +42143,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
42134
42143
|
...files
|
|
42135
42144
|
]);
|
|
42136
42145
|
if (result.status !== 0) return null;
|
|
42137
|
-
|
|
42146
|
+
const changedLineRanges = parseChangedLineRanges(result.stdout);
|
|
42147
|
+
if (cached || !includeUntracked) return changedLineRanges;
|
|
42148
|
+
const untrackedFilePaths = yield* listUntrackedFilePaths(directory, files);
|
|
42149
|
+
if (untrackedFilePaths === null) return changedLineRanges;
|
|
42150
|
+
return [...changedLineRanges, ...untrackedFilePaths.map((file) => ({
|
|
42151
|
+
file,
|
|
42152
|
+
ranges: [[1, UNTRACKED_FILE_LAST_LINE]]
|
|
42153
|
+
}))];
|
|
42138
42154
|
}).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
|
|
42139
42155
|
});
|
|
42140
42156
|
})).pipe(provide$2(layer$3.pipe(provide$2(mergeAll$1(layer$2, layer$1)))));
|
|
@@ -46266,10 +46282,11 @@ const computeDiagnosticDelta = (input) => {
|
|
|
46266
46282
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
46267
46283
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
46268
46284
|
*/
|
|
46269
|
-
const getDiffInfo = (directory, explicitBaseBranch) => runPromise(gen(function* () {
|
|
46285
|
+
const getDiffInfo = (directory, explicitBaseBranch, includeUntracked) => runPromise(gen(function* () {
|
|
46270
46286
|
const selection = yield* (yield* Git).diffSelection({
|
|
46271
46287
|
directory,
|
|
46272
|
-
explicitBaseBranch
|
|
46288
|
+
explicitBaseBranch,
|
|
46289
|
+
includeUntracked
|
|
46273
46290
|
});
|
|
46274
46291
|
if (selection === null) return null;
|
|
46275
46292
|
return {
|
|
@@ -46699,7 +46716,7 @@ const makeNoopConsole = () => ({
|
|
|
46699
46716
|
});
|
|
46700
46717
|
//#endregion
|
|
46701
46718
|
//#region src/cli/utils/version.ts
|
|
46702
|
-
const VERSION = "0.7.6-dev.
|
|
46719
|
+
const VERSION = "0.7.6-dev.0a8d30b";
|
|
46703
46720
|
//#endregion
|
|
46704
46721
|
//#region src/cli/utils/json-mode.ts
|
|
46705
46722
|
let context = null;
|
|
@@ -47068,13 +47085,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47068
47085
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47069
47086
|
* standard `SENTRY_RELEASE` override.
|
|
47070
47087
|
*/
|
|
47071
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.6-dev.
|
|
47088
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.6-dev.0a8d30b`;
|
|
47072
47089
|
/**
|
|
47073
47090
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47074
47091
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47075
47092
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47076
47093
|
*/
|
|
47077
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.6-dev.
|
|
47094
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.6-dev.0a8d30b") ? "development" : "production");
|
|
47078
47095
|
/**
|
|
47079
47096
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47080
47097
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -63792,10 +63809,15 @@ const warnIfAiTrainingEnvironment = () => {
|
|
|
63792
63809
|
//#region src/cli/utils/validate-mode-flags.ts
|
|
63793
63810
|
const usedDiffAlias = (flags) => flags.diff !== void 0 && flags.diff !== false && flags.diff !== "false" && flags.diff !== "";
|
|
63794
63811
|
const usedScope = (flags) => typeof flags.scope === "string" && flags.scope.length > 0;
|
|
63812
|
+
const validateIncludeUntrackedScope = (includeUntracked, scope) => {
|
|
63813
|
+
if (!includeUntracked || scope !== void 0 && scope !== "full") return;
|
|
63814
|
+
throw new CliInputError("--include-untracked requires the files, changed, or lines scope (via --scope, --diff, or config).");
|
|
63815
|
+
};
|
|
63795
63816
|
const validateModeFlags = (flags) => {
|
|
63796
63817
|
if (usedScope(flags) && usedDiffAlias(flags)) throw new CliInputError("Cannot combine --scope and --diff; --diff is the deprecated alias.");
|
|
63797
63818
|
if (flags.staged && usedDiffAlias(flags)) throw new CliInputError("Cannot combine --staged and --diff; pick one mode.");
|
|
63798
63819
|
if (flags.staged && (flags.scope === "full" || flags.scope === "changed")) throw new CliInputError(`Cannot combine --staged with --scope ${flags.scope}; use --scope files or --scope lines, or drop --scope.`);
|
|
63820
|
+
if (flags.includeUntracked && flags.staged) throw new CliInputError("Cannot combine --include-untracked with --staged; the git index never holds untracked files.");
|
|
63799
63821
|
if (flags.score && flags.json) throw new CliInputError("Cannot combine --score and --json; pick one output mode.");
|
|
63800
63822
|
if (flags.score && flags.telemetry === false) throw new CliInputError("Cannot combine --score with --no-telemetry; --score prints the score that --no-telemetry disables.");
|
|
63801
63823
|
if (flags.debug && (flags.score === false || flags.telemetry === false)) {
|
|
@@ -64005,13 +64027,15 @@ const inspectAction = async (directory, flags) => {
|
|
|
64005
64027
|
const projectDirectories = await selectProjects(resolvedDirectory, flags.project, skipPrompts, userConfig?.projects);
|
|
64006
64028
|
const changedFilesDiffInfo = flags.changedFilesFrom ? buildChangedFilesDiffInfo(readChangedFilesFrom(Path.resolve(flags.changedFilesFrom))) : null;
|
|
64007
64029
|
const requestedScope = resolveScope(flags, userConfig);
|
|
64030
|
+
const includeUntracked = flags.includeUntracked ?? false;
|
|
64008
64031
|
const scopeRequest = requestedScope.scope === void 0 && changedFilesDiffInfo !== null ? {
|
|
64009
64032
|
...requestedScope,
|
|
64010
64033
|
scope: "changed"
|
|
64011
64034
|
} : requestedScope;
|
|
64035
|
+
validateIncludeUntrackedScope(includeUntracked, scopeRequest.scope);
|
|
64012
64036
|
const wantsDiffMode = scopeRequest.scope !== void 0 && scopeRequest.scope !== "full";
|
|
64013
64037
|
const shouldDetectDiff = changedFilesDiffInfo === null && (wantsDiffMode || scopeRequest.scope === void 0 && !skipPrompts && !isQuiet);
|
|
64014
|
-
const diffInfo = changedFilesDiffInfo ?? (shouldDetectDiff ? await getDiffInfo(resolvedDirectory, scopeRequest.base) : null);
|
|
64038
|
+
const diffInfo = changedFilesDiffInfo ?? (shouldDetectDiff ? await getDiffInfo(resolvedDirectory, scopeRequest.base, includeUntracked) : null);
|
|
64015
64039
|
const scope = await finalizeScope({
|
|
64016
64040
|
requested: scopeRequest,
|
|
64017
64041
|
diffInfo,
|
|
@@ -64025,7 +64049,8 @@ const inspectAction = async (directory, flags) => {
|
|
|
64025
64049
|
const changedLineRanges = scope === "lines" && diffInfo !== null && (diffInfo.isCurrentChanges || linesBaseRef !== null) && diffInfo !== null ? await getChangedLineRanges({
|
|
64026
64050
|
directory: resolvedDirectory,
|
|
64027
64051
|
baseRef: linesBaseRef ?? void 0,
|
|
64028
|
-
files: [...diffInfo.changedFiles]
|
|
64052
|
+
files: [...diffInfo.changedFiles],
|
|
64053
|
+
includeUntracked
|
|
64029
64054
|
}) : null;
|
|
64030
64055
|
if (scope === "lines" && changedLineRanges === null && !isQuiet) {
|
|
64031
64056
|
cliLogger.warn("Could not determine changed lines (no base ref or git diff failed); reporting all issues in changed files.");
|
|
@@ -64958,6 +64983,7 @@ const ROOT_FLAG_SPEC = {
|
|
|
64958
64983
|
"--dead-code",
|
|
64959
64984
|
"--debug",
|
|
64960
64985
|
"--help",
|
|
64986
|
+
"--include-untracked",
|
|
64961
64987
|
"--json",
|
|
64962
64988
|
"--json-compact",
|
|
64963
64989
|
"--lint",
|
|
@@ -65221,7 +65247,7 @@ ${highlighter.dim("Learn more:")}
|
|
|
65221
65247
|
${highlighter.info(CI_URL)}
|
|
65222
65248
|
`;
|
|
65223
65249
|
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 (issues whose source spans touch 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);
|
|
65250
|
+
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 (issues whose source spans touch changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").option("--include-untracked", "with --scope files/changed/lines, also scan ordinary untracked files (respects .gitignore)").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
65251
|
program.action(inspectAction);
|
|
65226
65252
|
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
65253
|
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 +65297,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
65271
65297
|
export {};
|
|
65272
65298
|
|
|
65273
65299
|
//# sourceMappingURL=cli.js.map
|
|
65274
|
-
//# debugId=
|
|
65300
|
+
//# debugId=5dcb5b0b-ca1e-5655-8f52-3c22b421256d
|
package/dist/index.d.ts
CHANGED
|
@@ -10256,7 +10256,7 @@ declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReportV3$1;
|
|
|
10256
10256
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
10257
10257
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
10258
10258
|
*/
|
|
10259
|
-
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string) => Promise<DiffInfo | null>;
|
|
10259
|
+
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string, includeUntracked?: boolean) => Promise<DiffInfo | null>;
|
|
10260
10260
|
declare const filterSourceFiles: (filePaths: string[]) => string[];
|
|
10261
10261
|
/**
|
|
10262
10262
|
* Programmatic façade over `Git.changedLineRanges` (the `lines` scope). Diffs
|
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]="80f981d4-ebf0-5bc0-9643-8a68d27626a5")}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";
|
|
@@ -38579,6 +38579,7 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
38579
38579
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
38580
38580
|
};
|
|
38581
38581
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
38582
|
+
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
38582
38583
|
/**
|
|
38583
38584
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
38584
38585
|
* behind a `Context.Service`. The production layer (`layerNode`)
|
|
@@ -38649,6 +38650,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38649
38650
|
args,
|
|
38650
38651
|
directory
|
|
38651
38652
|
});
|
|
38653
|
+
const listUntrackedFilePaths = (directory, includePaths = []) => runGit(directory, [
|
|
38654
|
+
"ls-files",
|
|
38655
|
+
"-z",
|
|
38656
|
+
"--others",
|
|
38657
|
+
"--exclude-standard",
|
|
38658
|
+
...includePaths.length > 0 ? ["--", ...includePaths] : []
|
|
38659
|
+
]).pipe(map$3((result) => result.status === 0 ? splitNullSeparated(result.stdout) : null));
|
|
38660
|
+
const mergeUntracked = (directory, trackedFilePaths, includeUntracked) => includeUntracked ? listUntrackedFilePaths(directory).pipe(map$3((untracked) => untracked === null ? trackedFilePaths : [...new Set([...trackedFilePaths, ...untracked])])) : succeed$2(trackedFilePaths);
|
|
38652
38661
|
const currentBranch = (directory) => runGit(directory, [
|
|
38653
38662
|
"rev-parse",
|
|
38654
38663
|
"--abbrev-ref",
|
|
@@ -38771,7 +38780,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38771
38780
|
githubViewerPermission,
|
|
38772
38781
|
branchExists,
|
|
38773
38782
|
mergeBase,
|
|
38774
|
-
diffSelection: ({ directory, explicitBaseBranch }) => gen(function* () {
|
|
38783
|
+
diffSelection: ({ directory, explicitBaseBranch, includeUntracked = false }) => gen(function* () {
|
|
38775
38784
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
38776
38785
|
if (explicitBaseBranch !== void 0) {
|
|
38777
38786
|
const range = parseGitDiffRange(explicitBaseBranch);
|
|
@@ -38800,7 +38809,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38800
38809
|
"HEAD"
|
|
38801
38810
|
]);
|
|
38802
38811
|
if (uncommitted.status !== 0) return null;
|
|
38803
|
-
const files = splitNullSeparated(uncommitted.stdout);
|
|
38812
|
+
const files = yield* mergeUntracked(directory, splitNullSeparated(uncommitted.stdout), includeUntracked);
|
|
38804
38813
|
if (files.length === 0) return null;
|
|
38805
38814
|
return {
|
|
38806
38815
|
currentBranch: resolvedCurrentBranch,
|
|
@@ -38830,7 +38839,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38830
38839
|
currentBranch: resolvedCurrentBranch,
|
|
38831
38840
|
baseBranch,
|
|
38832
38841
|
diffBaseRef: mergeBaseRef,
|
|
38833
|
-
changedFiles: splitNullSeparated(diff.stdout),
|
|
38842
|
+
changedFiles: yield* mergeUntracked(directory, splitNullSeparated(diff.stdout), includeUntracked),
|
|
38834
38843
|
isCurrentChanges: false
|
|
38835
38844
|
};
|
|
38836
38845
|
}).pipe(withSpan("Git.diffSelection")),
|
|
@@ -38876,7 +38885,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38876
38885
|
stdout: result.stdout
|
|
38877
38886
|
};
|
|
38878
38887
|
}).pipe(withSpan("Git.grep")),
|
|
38879
|
-
changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
|
|
38888
|
+
changedLineRanges: ({ directory, baseRef, cached, files, includeUntracked = false }) => gen(function* () {
|
|
38880
38889
|
if (files.length === 0) return [];
|
|
38881
38890
|
if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
|
|
38882
38891
|
const result = yield* runGit(directory, [
|
|
@@ -38890,7 +38899,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38890
38899
|
...files
|
|
38891
38900
|
]);
|
|
38892
38901
|
if (result.status !== 0) return null;
|
|
38893
|
-
|
|
38902
|
+
const changedLineRanges = parseChangedLineRanges(result.stdout);
|
|
38903
|
+
if (cached || !includeUntracked) return changedLineRanges;
|
|
38904
|
+
const untrackedFilePaths = yield* listUntrackedFilePaths(directory, files);
|
|
38905
|
+
if (untrackedFilePaths === null) return changedLineRanges;
|
|
38906
|
+
return [...changedLineRanges, ...untrackedFilePaths.map((file) => ({
|
|
38907
|
+
file,
|
|
38908
|
+
ranges: [[1, UNTRACKED_FILE_LAST_LINE]]
|
|
38909
|
+
}))];
|
|
38894
38910
|
}).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
|
|
38895
38911
|
});
|
|
38896
38912
|
})).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
|
|
@@ -42948,10 +42964,11 @@ const buildSkippedChecks = (input) => {
|
|
|
42948
42964
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
42949
42965
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
42950
42966
|
*/
|
|
42951
|
-
const getDiffInfo = (directory, explicitBaseBranch) => runPromise(gen(function* () {
|
|
42967
|
+
const getDiffInfo = (directory, explicitBaseBranch, includeUntracked) => runPromise(gen(function* () {
|
|
42952
42968
|
const selection = yield* (yield* Git).diffSelection({
|
|
42953
42969
|
directory,
|
|
42954
|
-
explicitBaseBranch
|
|
42970
|
+
explicitBaseBranch,
|
|
42971
|
+
includeUntracked
|
|
42955
42972
|
});
|
|
42956
42973
|
if (selection === null) return null;
|
|
42957
42974
|
return {
|
|
@@ -43241,4 +43258,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43241
43258
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43242
43259
|
|
|
43243
43260
|
//# sourceMappingURL=index.js.map
|
|
43244
|
-
//# debugId=
|
|
43261
|
+
//# debugId=80f981d4-ebf0-5bc0-9643-8a68d27626a5
|
package/dist/lsp.js
CHANGED
|
@@ -38557,6 +38557,7 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
38557
38557
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
38558
38558
|
};
|
|
38559
38559
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
38560
|
+
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
38560
38561
|
/**
|
|
38561
38562
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
38562
38563
|
* behind a `Context.Service`. The production layer (`layerNode`)
|
|
@@ -38627,6 +38628,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38627
38628
|
args,
|
|
38628
38629
|
directory
|
|
38629
38630
|
});
|
|
38631
|
+
const listUntrackedFilePaths = (directory, includePaths = []) => runGit(directory, [
|
|
38632
|
+
"ls-files",
|
|
38633
|
+
"-z",
|
|
38634
|
+
"--others",
|
|
38635
|
+
"--exclude-standard",
|
|
38636
|
+
...includePaths.length > 0 ? ["--", ...includePaths] : []
|
|
38637
|
+
]).pipe(map$3((result) => result.status === 0 ? splitNullSeparated(result.stdout) : null));
|
|
38638
|
+
const mergeUntracked = (directory, trackedFilePaths, includeUntracked) => includeUntracked ? listUntrackedFilePaths(directory).pipe(map$3((untracked) => untracked === null ? trackedFilePaths : [...new Set([...trackedFilePaths, ...untracked])])) : succeed$2(trackedFilePaths);
|
|
38630
38639
|
const currentBranch = (directory) => runGit(directory, [
|
|
38631
38640
|
"rev-parse",
|
|
38632
38641
|
"--abbrev-ref",
|
|
@@ -38749,7 +38758,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38749
38758
|
githubViewerPermission,
|
|
38750
38759
|
branchExists,
|
|
38751
38760
|
mergeBase,
|
|
38752
|
-
diffSelection: ({ directory, explicitBaseBranch }) => gen(function* () {
|
|
38761
|
+
diffSelection: ({ directory, explicitBaseBranch, includeUntracked = false }) => gen(function* () {
|
|
38753
38762
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
38754
38763
|
if (explicitBaseBranch !== void 0) {
|
|
38755
38764
|
const range = parseGitDiffRange(explicitBaseBranch);
|
|
@@ -38778,7 +38787,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38778
38787
|
"HEAD"
|
|
38779
38788
|
]);
|
|
38780
38789
|
if (uncommitted.status !== 0) return null;
|
|
38781
|
-
const files = splitNullSeparated(uncommitted.stdout);
|
|
38790
|
+
const files = yield* mergeUntracked(directory, splitNullSeparated(uncommitted.stdout), includeUntracked);
|
|
38782
38791
|
if (files.length === 0) return null;
|
|
38783
38792
|
return {
|
|
38784
38793
|
currentBranch: resolvedCurrentBranch,
|
|
@@ -38808,7 +38817,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38808
38817
|
currentBranch: resolvedCurrentBranch,
|
|
38809
38818
|
baseBranch,
|
|
38810
38819
|
diffBaseRef: mergeBaseRef,
|
|
38811
|
-
changedFiles: splitNullSeparated(diff.stdout),
|
|
38820
|
+
changedFiles: yield* mergeUntracked(directory, splitNullSeparated(diff.stdout), includeUntracked),
|
|
38812
38821
|
isCurrentChanges: false
|
|
38813
38822
|
};
|
|
38814
38823
|
}).pipe(withSpan("Git.diffSelection")),
|
|
@@ -38854,7 +38863,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38854
38863
|
stdout: result.stdout
|
|
38855
38864
|
};
|
|
38856
38865
|
}).pipe(withSpan("Git.grep")),
|
|
38857
|
-
changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
|
|
38866
|
+
changedLineRanges: ({ directory, baseRef, cached, files, includeUntracked = false }) => gen(function* () {
|
|
38858
38867
|
if (files.length === 0) return [];
|
|
38859
38868
|
if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
|
|
38860
38869
|
const result = yield* runGit(directory, [
|
|
@@ -38868,7 +38877,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38868
38877
|
...files
|
|
38869
38878
|
]);
|
|
38870
38879
|
if (result.status !== 0) return null;
|
|
38871
|
-
|
|
38880
|
+
const changedLineRanges = parseChangedLineRanges(result.stdout);
|
|
38881
|
+
if (cached || !includeUntracked) return changedLineRanges;
|
|
38882
|
+
const untrackedFilePaths = yield* listUntrackedFilePaths(directory, files);
|
|
38883
|
+
if (untrackedFilePaths === null) return changedLineRanges;
|
|
38884
|
+
return [...changedLineRanges, ...untrackedFilePaths.map((file) => ({
|
|
38885
|
+
file,
|
|
38886
|
+
ranges: [[1, UNTRACKED_FILE_LAST_LINE]]
|
|
38887
|
+
}))];
|
|
38872
38888
|
}).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
|
|
38873
38889
|
});
|
|
38874
38890
|
})).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
|
|
@@ -44878,5 +44894,5 @@ const startLanguageServer = () => {
|
|
|
44878
44894
|
};
|
|
44879
44895
|
//#endregion
|
|
44880
44896
|
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=
|
|
44897
|
+
!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]="288f7240-2ee1-5bcb-a56e-bca2b972818c")}catch(e){}}();
|
|
44898
|
+
//# debugId=288f7240-2ee1-5bcb-a56e-bca2b972818c
|
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.0a8d30b",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
68
|
"deslop-js": "0.7.6",
|
|
69
|
-
"oxlint-plugin-react-doctor": "0.7.6-dev.
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.7.6-dev.0a8d30b"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|