react-doctor 0.5.5 → 0.5.6-dev.09dde18
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 +32 -15
- package/dist/index.d.ts +4 -3
- package/dist/index.js +29 -12
- package/dist/lsp.js +30 -13
- 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]="1aaf9dd2-5d2e-5683-83a9-1c39885f45a7")}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";
|
|
@@ -39692,10 +39692,15 @@ const buildCapabilities = (project) => {
|
|
|
39692
39692
|
}
|
|
39693
39693
|
if (project.tailwindVersion !== null) {
|
|
39694
39694
|
capabilities.add("tailwind");
|
|
39695
|
-
|
|
39695
|
+
const tailwind = parseTailwindMajorMinor(project.tailwindVersion);
|
|
39696
|
+
if (isTailwindAtLeast(tailwind, {
|
|
39696
39697
|
major: 3,
|
|
39697
39698
|
minor: 4
|
|
39698
39699
|
})) capabilities.add("tailwind:3.4");
|
|
39700
|
+
if (tailwind !== null && isTailwindAtLeast(tailwind, {
|
|
39701
|
+
major: 4,
|
|
39702
|
+
minor: 0
|
|
39703
|
+
})) capabilities.add("tailwind:4");
|
|
39699
39704
|
}
|
|
39700
39705
|
if (project.zodVersion !== null) {
|
|
39701
39706
|
capabilities.add("zod");
|
|
@@ -39740,13 +39745,24 @@ const checkSecurityScan = (rootDirectory, options = {}) => {
|
|
|
39740
39745
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledBy)) return [];
|
|
39741
39746
|
return [{
|
|
39742
39747
|
entry,
|
|
39743
|
-
scan
|
|
39748
|
+
scan,
|
|
39749
|
+
committedFilesOnly: rule.committedFilesOnly === true
|
|
39744
39750
|
}];
|
|
39745
39751
|
});
|
|
39746
39752
|
if (enabledScanRules.length === 0) return [];
|
|
39747
39753
|
const diagnostics = [];
|
|
39748
39754
|
const seen = /* @__PURE__ */ new Set();
|
|
39749
|
-
|
|
39755
|
+
const gitIgnoredCache = /* @__PURE__ */ new Map();
|
|
39756
|
+
const isFileGitIgnored = (file) => {
|
|
39757
|
+
let status = gitIgnoredCache.get(file.absolutePath);
|
|
39758
|
+
if (status === void 0) {
|
|
39759
|
+
status = isPathGitIgnored(rootDirectory, file.absolutePath);
|
|
39760
|
+
gitIgnoredCache.set(file.absolutePath, status);
|
|
39761
|
+
}
|
|
39762
|
+
return status === true;
|
|
39763
|
+
};
|
|
39764
|
+
for (const file of collectSecurityScanFiles(rootDirectory)) for (const { entry, scan, committedFilesOnly } of enabledScanRules) for (const finding of scan(file)) {
|
|
39765
|
+
if (committedFilesOnly && isFileGitIgnored(file)) continue;
|
|
39750
39766
|
const diagnostic = buildSecurityScanDiagnostic(finding, entry, file.relativePath);
|
|
39751
39767
|
const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
|
|
39752
39768
|
if (seen.has(key)) continue;
|
|
@@ -39975,12 +39991,11 @@ const collectKnipPatterns = (rootDirectory, settingName) => {
|
|
|
39975
39991
|
if (!config) return [];
|
|
39976
39992
|
return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
|
|
39977
39993
|
};
|
|
39978
|
-
const collectDeadCodeIgnorePatterns = (rootDirectory
|
|
39994
|
+
const collectDeadCodeIgnorePatterns = (rootDirectory) => {
|
|
39979
39995
|
const seen = /* @__PURE__ */ new Set();
|
|
39980
39996
|
const sources = [
|
|
39981
39997
|
readIgnoreFile(path.join(rootDirectory, ".gitignore")),
|
|
39982
39998
|
collectIgnorePatterns(rootDirectory),
|
|
39983
|
-
userConfig?.ignore?.files ?? [],
|
|
39984
39999
|
collectKnipPatterns(rootDirectory, "ignore")
|
|
39985
40000
|
];
|
|
39986
40001
|
for (const source of sources) for (const pattern of source) seen.add(pattern);
|
|
@@ -40258,11 +40273,10 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
|
|
|
40258
40273
|
});
|
|
40259
40274
|
});
|
|
40260
40275
|
const checkDeadCode = async (options) => {
|
|
40261
|
-
const { userConfig } = options;
|
|
40262
40276
|
const rootDirectory = toCanonicalPath(options.rootDirectory);
|
|
40263
40277
|
if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
|
|
40264
40278
|
const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
|
|
40265
|
-
const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory
|
|
40279
|
+
const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
|
|
40266
40280
|
const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
|
|
40267
40281
|
rootDirectory,
|
|
40268
40282
|
entryPatterns,
|
|
@@ -42773,6 +42787,8 @@ const resolveConcreteVersion = (spec) => {
|
|
|
42773
42787
|
const trimmed = spec.trim();
|
|
42774
42788
|
if (trimmed.length === 0) return null;
|
|
42775
42789
|
if (trimmed.includes(":")) return null;
|
|
42790
|
+
const range = import_semver.validRange(trimmed);
|
|
42791
|
+
if (range === null || range === "*") return null;
|
|
42776
42792
|
return import_semver.minVersion(trimmed)?.version ?? null;
|
|
42777
42793
|
};
|
|
42778
42794
|
const locateDependencyKey = (packageJsonText, section, name) => {
|
|
@@ -43159,8 +43175,10 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43159
43175
|
const lintFailureState = yield* get$2(lintFailure);
|
|
43160
43176
|
yield* afterLint(lintFailureState.didFail);
|
|
43161
43177
|
if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
|
|
43178
|
+
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
43179
|
+
const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
|
|
43162
43180
|
const shouldRunDeadCode = input.runDeadCode && !isDiffMode && (showWarnings || deadCodeMaySurfaceWhenWarningsHidden(resolvedConfig.config));
|
|
43163
|
-
const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(
|
|
43181
|
+
const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(`Scanned ${scannedFilesLabel}, analyzing dead code...`).pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
|
|
43164
43182
|
rootDirectory: scanDirectory,
|
|
43165
43183
|
userConfig: resolvedConfig.config
|
|
43166
43184
|
}).pipe(catchTag("ReactDoctorError", (error) => unwrap(gen(function* () {
|
|
@@ -43173,10 +43191,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43173
43191
|
const deadCodeFailureState = yield* get$2(deadCodeFailure);
|
|
43174
43192
|
const scanElapsedMilliseconds = Date.now() - scanStartTime;
|
|
43175
43193
|
const scanElapsedSeconds = (scanElapsedMilliseconds / 1e3).toFixed(1);
|
|
43176
|
-
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
43177
43194
|
if (!lintFailureState.didFail) if (deadCodeFailureState.didFail) yield* scanProgress.fail(DEAD_CODE_FAIL_TEXT);
|
|
43178
43195
|
else if (input.suppressScanSummary) yield* scanProgress.stop();
|
|
43179
|
-
else yield* scanProgress.succeed(`Scanned ${
|
|
43196
|
+
else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
|
|
43180
43197
|
yield* reporterService.finalize;
|
|
43181
43198
|
const finalDiagnostics = [
|
|
43182
43199
|
...envCollected,
|
|
@@ -43958,7 +43975,7 @@ const makeNoopConsole = () => ({
|
|
|
43958
43975
|
});
|
|
43959
43976
|
//#endregion
|
|
43960
43977
|
//#region src/cli/utils/version.ts
|
|
43961
|
-
const VERSION = "0.5.
|
|
43978
|
+
const VERSION = "0.5.6-dev.09dde18";
|
|
43962
43979
|
//#endregion
|
|
43963
43980
|
//#region src/cli/utils/json-mode.ts
|
|
43964
43981
|
let context = null;
|
|
@@ -44316,13 +44333,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
44316
44333
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
44317
44334
|
* standard `SENTRY_RELEASE` override.
|
|
44318
44335
|
*/
|
|
44319
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.
|
|
44336
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.6-dev.09dde18`;
|
|
44320
44337
|
/**
|
|
44321
44338
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
44322
44339
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
44323
44340
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
44324
44341
|
*/
|
|
44325
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.
|
|
44342
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.6-dev.09dde18") ? "development" : "production");
|
|
44326
44343
|
/**
|
|
44327
44344
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
44328
44345
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -53934,4 +53951,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
53934
53951
|
export {};
|
|
53935
53952
|
|
|
53936
53953
|
//# sourceMappingURL=cli.js.map
|
|
53937
|
-
//# debugId=
|
|
53954
|
+
//# debugId=1aaf9dd2-5d2e-5683-83a9-1c39885f45a7
|
package/dist/index.d.ts
CHANGED
|
@@ -9280,9 +9280,10 @@ interface ReactDoctorConfig {
|
|
|
9280
9280
|
* list, user-provided names are treated as distinctive and never
|
|
9281
9281
|
* subject to receiver-object disambiguation.
|
|
9282
9282
|
*
|
|
9283
|
-
*
|
|
9284
|
-
*
|
|
9285
|
-
*
|
|
9283
|
+
* Common guard conventions are already recognized automatically
|
|
9284
|
+
* (`requireAdmin`, `ensureSignedIn`, `getCurrentUser`, `hasRole`, …),
|
|
9285
|
+
* so this is only needed for domain-specific guards whose names carry
|
|
9286
|
+
* no auth noun — e.g. a project-local `requireWorkspaceMember`.
|
|
9286
9287
|
*/
|
|
9287
9288
|
serverAuthFunctionNames?: string[];
|
|
9288
9289
|
/**
|
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]="b4f6f7e7-99db-553a-aa15-14b646162f39")}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 * as NFS from "node:fs";
|
|
@@ -36472,10 +36472,15 @@ const buildCapabilities = (project) => {
|
|
|
36472
36472
|
}
|
|
36473
36473
|
if (project.tailwindVersion !== null) {
|
|
36474
36474
|
capabilities.add("tailwind");
|
|
36475
|
-
|
|
36475
|
+
const tailwind = parseTailwindMajorMinor(project.tailwindVersion);
|
|
36476
|
+
if (isTailwindAtLeast(tailwind, {
|
|
36476
36477
|
major: 3,
|
|
36477
36478
|
minor: 4
|
|
36478
36479
|
})) capabilities.add("tailwind:3.4");
|
|
36480
|
+
if (tailwind !== null && isTailwindAtLeast(tailwind, {
|
|
36481
|
+
major: 4,
|
|
36482
|
+
minor: 0
|
|
36483
|
+
})) capabilities.add("tailwind:4");
|
|
36479
36484
|
}
|
|
36480
36485
|
if (project.zodVersion !== null) {
|
|
36481
36486
|
capabilities.add("zod");
|
|
@@ -36520,13 +36525,24 @@ const checkSecurityScan = (rootDirectory, options = {}) => {
|
|
|
36520
36525
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledBy)) return [];
|
|
36521
36526
|
return [{
|
|
36522
36527
|
entry,
|
|
36523
|
-
scan
|
|
36528
|
+
scan,
|
|
36529
|
+
committedFilesOnly: rule.committedFilesOnly === true
|
|
36524
36530
|
}];
|
|
36525
36531
|
});
|
|
36526
36532
|
if (enabledScanRules.length === 0) return [];
|
|
36527
36533
|
const diagnostics = [];
|
|
36528
36534
|
const seen = /* @__PURE__ */ new Set();
|
|
36529
|
-
|
|
36535
|
+
const gitIgnoredCache = /* @__PURE__ */ new Map();
|
|
36536
|
+
const isFileGitIgnored = (file) => {
|
|
36537
|
+
let status = gitIgnoredCache.get(file.absolutePath);
|
|
36538
|
+
if (status === void 0) {
|
|
36539
|
+
status = isPathGitIgnored(rootDirectory, file.absolutePath);
|
|
36540
|
+
gitIgnoredCache.set(file.absolutePath, status);
|
|
36541
|
+
}
|
|
36542
|
+
return status === true;
|
|
36543
|
+
};
|
|
36544
|
+
for (const file of collectSecurityScanFiles(rootDirectory)) for (const { entry, scan, committedFilesOnly } of enabledScanRules) for (const finding of scan(file)) {
|
|
36545
|
+
if (committedFilesOnly && isFileGitIgnored(file)) continue;
|
|
36530
36546
|
const diagnostic = buildSecurityScanDiagnostic(finding, entry, file.relativePath);
|
|
36531
36547
|
const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
|
|
36532
36548
|
if (seen.has(key)) continue;
|
|
@@ -36739,12 +36755,11 @@ const collectKnipPatterns = (rootDirectory, settingName) => {
|
|
|
36739
36755
|
if (!config) return [];
|
|
36740
36756
|
return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
|
|
36741
36757
|
};
|
|
36742
|
-
const collectDeadCodeIgnorePatterns = (rootDirectory
|
|
36758
|
+
const collectDeadCodeIgnorePatterns = (rootDirectory) => {
|
|
36743
36759
|
const seen = /* @__PURE__ */ new Set();
|
|
36744
36760
|
const sources = [
|
|
36745
36761
|
readIgnoreFile(path.join(rootDirectory, ".gitignore")),
|
|
36746
36762
|
collectIgnorePatterns(rootDirectory),
|
|
36747
|
-
userConfig?.ignore?.files ?? [],
|
|
36748
36763
|
collectKnipPatterns(rootDirectory, "ignore")
|
|
36749
36764
|
];
|
|
36750
36765
|
for (const source of sources) for (const pattern of source) seen.add(pattern);
|
|
@@ -37022,11 +37037,10 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
|
|
|
37022
37037
|
});
|
|
37023
37038
|
});
|
|
37024
37039
|
const checkDeadCode = async (options) => {
|
|
37025
|
-
const { userConfig } = options;
|
|
37026
37040
|
const rootDirectory = toCanonicalPath(options.rootDirectory);
|
|
37027
37041
|
if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
|
|
37028
37042
|
const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
|
|
37029
|
-
const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory
|
|
37043
|
+
const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
|
|
37030
37044
|
const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
|
|
37031
37045
|
rootDirectory,
|
|
37032
37046
|
entryPatterns,
|
|
@@ -39537,6 +39551,8 @@ const resolveConcreteVersion = (spec) => {
|
|
|
39537
39551
|
const trimmed = spec.trim();
|
|
39538
39552
|
if (trimmed.length === 0) return null;
|
|
39539
39553
|
if (trimmed.includes(":")) return null;
|
|
39554
|
+
const range = import_semver.validRange(trimmed);
|
|
39555
|
+
if (range === null || range === "*") return null;
|
|
39540
39556
|
return import_semver.minVersion(trimmed)?.version ?? null;
|
|
39541
39557
|
};
|
|
39542
39558
|
const locateDependencyKey = (packageJsonText, section, name) => {
|
|
@@ -39923,8 +39939,10 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
39923
39939
|
const lintFailureState = yield* get$2(lintFailure);
|
|
39924
39940
|
yield* afterLint(lintFailureState.didFail);
|
|
39925
39941
|
if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
|
|
39942
|
+
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
39943
|
+
const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
|
|
39926
39944
|
const shouldRunDeadCode = input.runDeadCode && !isDiffMode && (showWarnings || deadCodeMaySurfaceWhenWarningsHidden(resolvedConfig.config));
|
|
39927
|
-
const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(
|
|
39945
|
+
const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(`Scanned ${scannedFilesLabel}, analyzing dead code...`).pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
|
|
39928
39946
|
rootDirectory: scanDirectory,
|
|
39929
39947
|
userConfig: resolvedConfig.config
|
|
39930
39948
|
}).pipe(catchTag("ReactDoctorError", (error) => unwrap(gen(function* () {
|
|
@@ -39937,10 +39955,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
39937
39955
|
const deadCodeFailureState = yield* get$2(deadCodeFailure);
|
|
39938
39956
|
const scanElapsedMilliseconds = Date.now() - scanStartTime;
|
|
39939
39957
|
const scanElapsedSeconds = (scanElapsedMilliseconds / 1e3).toFixed(1);
|
|
39940
|
-
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
39941
39958
|
if (!lintFailureState.didFail) if (deadCodeFailureState.didFail) yield* scanProgress.fail(DEAD_CODE_FAIL_TEXT);
|
|
39942
39959
|
else if (input.suppressScanSummary) yield* scanProgress.stop();
|
|
39943
|
-
else yield* scanProgress.succeed(`Scanned ${
|
|
39960
|
+
else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
|
|
39944
39961
|
yield* reporterService.finalize;
|
|
39945
39962
|
const finalDiagnostics = [
|
|
39946
39963
|
...envCollected,
|
|
@@ -40559,4 +40576,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
40559
40576
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
40560
40577
|
|
|
40561
40578
|
//# sourceMappingURL=index.js.map
|
|
40562
|
-
//# debugId=
|
|
40579
|
+
//# debugId=b4f6f7e7-99db-553a-aa15-14b646162f39
|
package/dist/lsp.js
CHANGED
|
@@ -36458,10 +36458,15 @@ const buildCapabilities = (project) => {
|
|
|
36458
36458
|
}
|
|
36459
36459
|
if (project.tailwindVersion !== null) {
|
|
36460
36460
|
capabilities.add("tailwind");
|
|
36461
|
-
|
|
36461
|
+
const tailwind = parseTailwindMajorMinor(project.tailwindVersion);
|
|
36462
|
+
if (isTailwindAtLeast(tailwind, {
|
|
36462
36463
|
major: 3,
|
|
36463
36464
|
minor: 4
|
|
36464
36465
|
})) capabilities.add("tailwind:3.4");
|
|
36466
|
+
if (tailwind !== null && isTailwindAtLeast(tailwind, {
|
|
36467
|
+
major: 4,
|
|
36468
|
+
minor: 0
|
|
36469
|
+
})) capabilities.add("tailwind:4");
|
|
36465
36470
|
}
|
|
36466
36471
|
if (project.zodVersion !== null) {
|
|
36467
36472
|
capabilities.add("zod");
|
|
@@ -36506,13 +36511,24 @@ const checkSecurityScan = (rootDirectory, options = {}) => {
|
|
|
36506
36511
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledBy)) return [];
|
|
36507
36512
|
return [{
|
|
36508
36513
|
entry,
|
|
36509
|
-
scan
|
|
36514
|
+
scan,
|
|
36515
|
+
committedFilesOnly: rule.committedFilesOnly === true
|
|
36510
36516
|
}];
|
|
36511
36517
|
});
|
|
36512
36518
|
if (enabledScanRules.length === 0) return [];
|
|
36513
36519
|
const diagnostics = [];
|
|
36514
36520
|
const seen = /* @__PURE__ */ new Set();
|
|
36515
|
-
|
|
36521
|
+
const gitIgnoredCache = /* @__PURE__ */ new Map();
|
|
36522
|
+
const isFileGitIgnored = (file) => {
|
|
36523
|
+
let status = gitIgnoredCache.get(file.absolutePath);
|
|
36524
|
+
if (status === void 0) {
|
|
36525
|
+
status = isPathGitIgnored(rootDirectory, file.absolutePath);
|
|
36526
|
+
gitIgnoredCache.set(file.absolutePath, status);
|
|
36527
|
+
}
|
|
36528
|
+
return status === true;
|
|
36529
|
+
};
|
|
36530
|
+
for (const file of collectSecurityScanFiles(rootDirectory)) for (const { entry, scan, committedFilesOnly } of enabledScanRules) for (const finding of scan(file)) {
|
|
36531
|
+
if (committedFilesOnly && isFileGitIgnored(file)) continue;
|
|
36516
36532
|
const diagnostic = buildSecurityScanDiagnostic(finding, entry, file.relativePath);
|
|
36517
36533
|
const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
|
|
36518
36534
|
if (seen.has(key)) continue;
|
|
@@ -36725,12 +36741,11 @@ const collectKnipPatterns = (rootDirectory, settingName) => {
|
|
|
36725
36741
|
if (!config) return [];
|
|
36726
36742
|
return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
|
|
36727
36743
|
};
|
|
36728
|
-
const collectDeadCodeIgnorePatterns = (rootDirectory
|
|
36744
|
+
const collectDeadCodeIgnorePatterns = (rootDirectory) => {
|
|
36729
36745
|
const seen = /* @__PURE__ */ new Set();
|
|
36730
36746
|
const sources = [
|
|
36731
36747
|
readIgnoreFile(path.join(rootDirectory, ".gitignore")),
|
|
36732
36748
|
collectIgnorePatterns(rootDirectory),
|
|
36733
|
-
userConfig?.ignore?.files ?? [],
|
|
36734
36749
|
collectKnipPatterns(rootDirectory, "ignore")
|
|
36735
36750
|
];
|
|
36736
36751
|
for (const source of sources) for (const pattern of source) seen.add(pattern);
|
|
@@ -37008,11 +37023,10 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
|
|
|
37008
37023
|
});
|
|
37009
37024
|
});
|
|
37010
37025
|
const checkDeadCode = async (options) => {
|
|
37011
|
-
const { userConfig } = options;
|
|
37012
37026
|
const rootDirectory = toCanonicalPath(options.rootDirectory);
|
|
37013
37027
|
if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
|
|
37014
37028
|
const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
|
|
37015
|
-
const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory
|
|
37029
|
+
const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
|
|
37016
37030
|
const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
|
|
37017
37031
|
rootDirectory,
|
|
37018
37032
|
entryPatterns,
|
|
@@ -39523,6 +39537,8 @@ const resolveConcreteVersion = (spec) => {
|
|
|
39523
39537
|
const trimmed = spec.trim();
|
|
39524
39538
|
if (trimmed.length === 0) return null;
|
|
39525
39539
|
if (trimmed.includes(":")) return null;
|
|
39540
|
+
const range = import_semver.validRange(trimmed);
|
|
39541
|
+
if (range === null || range === "*") return null;
|
|
39526
39542
|
return import_semver.minVersion(trimmed)?.version ?? null;
|
|
39527
39543
|
};
|
|
39528
39544
|
const locateDependencyKey = (packageJsonText, section, name) => {
|
|
@@ -39909,8 +39925,10 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
39909
39925
|
const lintFailureState = yield* get$2(lintFailure);
|
|
39910
39926
|
yield* afterLint(lintFailureState.didFail);
|
|
39911
39927
|
if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
|
|
39928
|
+
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
39929
|
+
const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
|
|
39912
39930
|
const shouldRunDeadCode = input.runDeadCode && !isDiffMode && (showWarnings || deadCodeMaySurfaceWhenWarningsHidden(resolvedConfig.config));
|
|
39913
|
-
const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(
|
|
39931
|
+
const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(`Scanned ${scannedFilesLabel}, analyzing dead code...`).pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
|
|
39914
39932
|
rootDirectory: scanDirectory,
|
|
39915
39933
|
userConfig: resolvedConfig.config
|
|
39916
39934
|
}).pipe(catchTag("ReactDoctorError", (error) => unwrap(gen(function* () {
|
|
@@ -39923,10 +39941,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
39923
39941
|
const deadCodeFailureState = yield* get$2(deadCodeFailure);
|
|
39924
39942
|
const scanElapsedMilliseconds = Date.now() - scanStartTime;
|
|
39925
39943
|
const scanElapsedSeconds = (scanElapsedMilliseconds / 1e3).toFixed(1);
|
|
39926
|
-
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
39927
39944
|
if (!lintFailureState.didFail) if (deadCodeFailureState.didFail) yield* scanProgress.fail(DEAD_CODE_FAIL_TEXT);
|
|
39928
39945
|
else if (input.suppressScanSummary) yield* scanProgress.stop();
|
|
39929
|
-
else yield* scanProgress.succeed(`Scanned ${
|
|
39946
|
+
else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
|
|
39930
39947
|
yield* reporterService.finalize;
|
|
39931
39948
|
const finalDiagnostics = [
|
|
39932
39949
|
...envCollected,
|
|
@@ -40297,7 +40314,7 @@ const computeConfigFingerprint = (projectDirectory, version) => {
|
|
|
40297
40314
|
/** Display name used in client-facing messages and progress titles. */
|
|
40298
40315
|
const SERVER_DISPLAY_NAME = "React Doctor";
|
|
40299
40316
|
/** Server version reported in `serverInfo`; injected at build, `dev` from source. */
|
|
40300
|
-
const SERVER_VERSION = "0.5.
|
|
40317
|
+
const SERVER_VERSION = "0.5.6";
|
|
40301
40318
|
/** `Diagnostic.source` shown next to every published diagnostic. */
|
|
40302
40319
|
const DIAGNOSTIC_SOURCE = "react-doctor";
|
|
40303
40320
|
/**
|
|
@@ -42344,5 +42361,5 @@ const startLanguageServer = () => {
|
|
|
42344
42361
|
};
|
|
42345
42362
|
//#endregion
|
|
42346
42363
|
export { startLanguageServer };
|
|
42347
|
-
!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]="
|
|
42348
|
-
//# debugId=
|
|
42364
|
+
!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]="9421149c-0ed9-5e00-81da-4f7dd8faf332")}catch(e){}}();
|
|
42365
|
+
//# debugId=9421149c-0ed9-5e00-81da-4f7dd8faf332
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6-dev.09dde18",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vscode-languageserver": "^9.0.1",
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
|
-
"oxlint-plugin-react-doctor": "0.5.
|
|
67
|
+
"oxlint-plugin-react-doctor": "0.5.6-dev.09dde18"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"@xterm/headless": "^6.0.0",
|
|
73
73
|
"commander": "^14.0.3",
|
|
74
74
|
"ora": "^9.4.0",
|
|
75
|
-
"@react-doctor/api": "0.5.
|
|
76
|
-
"@react-doctor/
|
|
77
|
-
"@react-doctor/
|
|
75
|
+
"@react-doctor/api": "0.5.6",
|
|
76
|
+
"@react-doctor/language-server": "0.5.6",
|
|
77
|
+
"@react-doctor/core": "0.5.6"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": "^20.19.0 || >=22.13.0"
|