react-doctor 0.8.3 → 0.9.0-dev.30369b6
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 +277 -181
- package/dist/index.js +35 -18
- package/dist/lsp.js +38 -21
- package/dist/run-scan-app-DZ5jGWFf.js +1661 -0
- package/package.json +13 -7
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]="15a71be1-a569-52e7-b9d5-4796065a0f2a")}catch(e){}}();
|
|
3
3
|
import { i as __toESM$1, r as __require, t as __commonJSMin$1 } from "./chunk-ChKA3wi6.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";
|
|
@@ -61487,6 +61487,13 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
61487
61487
|
"out",
|
|
61488
61488
|
"storybook-static"
|
|
61489
61489
|
]);
|
|
61490
|
+
const TYPESCRIPT_DECLARATION_FILE_PATTERN = /\.d\.(?:ts|mts|cts)$/;
|
|
61491
|
+
const OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES = new Set([
|
|
61492
|
+
"TS(1036)",
|
|
61493
|
+
"TS(1038)",
|
|
61494
|
+
"TS(1183)",
|
|
61495
|
+
"TS(1319)"
|
|
61496
|
+
]);
|
|
61490
61497
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
61491
61498
|
const REACT_ROUTER_CAPABILITY_THRESHOLDS = [
|
|
61492
61499
|
{
|
|
@@ -61755,6 +61762,13 @@ const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
|
61755
61762
|
"Maintainability"
|
|
61756
61763
|
];
|
|
61757
61764
|
const OCCURRENCE_MATCHED_CATEGORIES = new Set(["Accessibility"]);
|
|
61765
|
+
new Map(Object.entries({
|
|
61766
|
+
Security: "An attacker can read user data, act as your users, or run code you never shipped.",
|
|
61767
|
+
Bugs: "Real users hit crashes, wrong output, or state that silently corrupts.",
|
|
61768
|
+
Performance: "Users feel extra latency and wasted renders on every interaction.",
|
|
61769
|
+
Accessibility: "Users on screen readers, keyboards, or assistive tech get locked out.",
|
|
61770
|
+
Maintainability: "Every future change gets slower and riskier to make."
|
|
61771
|
+
}));
|
|
61758
61772
|
const APP_ONLY_RULE_KEYS = new Set([
|
|
61759
61773
|
"react-hooks-js/static-components",
|
|
61760
61774
|
"react-doctor/no-render-prop-children",
|
|
@@ -61777,7 +61791,7 @@ const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
|
|
|
61777
61791
|
const FILE_LINT_CACHE_FILENAME = "file-lint-cache.json";
|
|
61778
61792
|
const FILE_LINT_CACHE_MAX_FILE_COUNT = 5e4;
|
|
61779
61793
|
const SIDECAR_LINT_CACHE_FILENAME = "sidecar-lint-cache.json";
|
|
61780
|
-
const CORE_PACKAGE_VERSION = "0.
|
|
61794
|
+
const CORE_PACKAGE_VERSION = "0.9.0";
|
|
61781
61795
|
const DEAD_CODE_CACHE_FILENAME = "dead-code-cache.json";
|
|
61782
61796
|
const DEAD_CODE_SUMMARY_CACHE_FILENAME = "dead-code-summaries.json";
|
|
61783
61797
|
const SUPPLY_CHAIN_PLUGIN = "socket";
|
|
@@ -62168,6 +62182,7 @@ const frameworkMergeRank = (framework) => {
|
|
|
62168
62182
|
return MOBILE_FRAMEWORKS.has(framework) ? 2 : 1;
|
|
62169
62183
|
};
|
|
62170
62184
|
const REACT_COMPILER_LINT_PACKAGES = new Set(["eslint-plugin-react-compiler"]);
|
|
62185
|
+
const REACT_COMPILER_RUNTIME_PACKAGES = new Set(["react-compiler-runtime"]);
|
|
62171
62186
|
const NEXT_CONFIG_FILENAMES = [
|
|
62172
62187
|
"next.config.js",
|
|
62173
62188
|
"next.config.mjs",
|
|
@@ -62504,18 +62519,20 @@ const getReactCompilerFlagState = (expression, analysis) => {
|
|
|
62504
62519
|
}
|
|
62505
62520
|
return null;
|
|
62506
62521
|
};
|
|
62507
|
-
const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
62522
|
+
const getSelectedObjectProperty = (expression, propertyName, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
|
|
62508
62523
|
let resolvedExpression = expression;
|
|
62509
62524
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62525
|
+
if (visitedExpressions.has(resolvedExpression)) return null;
|
|
62526
|
+
visitedExpressions.add(resolvedExpression);
|
|
62510
62527
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62511
62528
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62512
62529
|
const localInitializer = analysis.localBindings.get(resolvedExpression.text);
|
|
62513
|
-
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis) : null;
|
|
62530
|
+
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
|
|
62514
62531
|
}
|
|
62515
62532
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62516
|
-
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis) : null;
|
|
62533
|
+
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
62517
62534
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, resolvedExpression.text);
|
|
62518
|
-
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis) : null;
|
|
62535
|
+
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis, visitedExpressions) : null;
|
|
62519
62536
|
}
|
|
62520
62537
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62521
62538
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
@@ -62523,7 +62540,7 @@ const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
|
62523
62540
|
if (ts.isMethodDeclaration(property) && getStaticPropertyName$1(property.name) === propertyName) return property;
|
|
62524
62541
|
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
|
|
62525
62542
|
if (ts.isSpreadAssignment(property)) {
|
|
62526
|
-
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis);
|
|
62543
|
+
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62527
62544
|
if (spreadProperty) return spreadProperty;
|
|
62528
62545
|
}
|
|
62529
62546
|
}
|
|
@@ -62872,7 +62889,7 @@ const hasCompilerConfigurationInAncestors = (directory) => {
|
|
|
62872
62889
|
}
|
|
62873
62890
|
return false;
|
|
62874
62891
|
};
|
|
62875
|
-
const detectReactCompiler = (directory, packageJson) => hasCompilerConfiguration(directory, packageJson) || hasCompilerConfigurationInAncestors(directory);
|
|
62892
|
+
const detectReactCompiler = (directory, packageJson) => hasCompilerPackage(packageJson, REACT_COMPILER_RUNTIME_PACKAGES) || hasCompilerPackageInAncestors(directory, REACT_COMPILER_RUNTIME_PACKAGES) || hasCompilerConfiguration(directory, packageJson) || hasCompilerConfigurationInAncestors(directory);
|
|
62876
62893
|
const detectReactCompilerLintPlugin = (directory, packageJson) => hasCompilerPackage(packageJson, REACT_COMPILER_LINT_PACKAGES) || hasCompilerPackageInAncestors(directory, REACT_COMPILER_LINT_PACKAGES);
|
|
62877
62894
|
const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((filename) => {
|
|
62878
62895
|
const filePath = Path.join(directory, filename);
|
|
@@ -69948,13 +69965,13 @@ const decodeFileDiagnostics = (raw) => {
|
|
|
69948
69965
|
}
|
|
69949
69966
|
};
|
|
69950
69967
|
const emptyCache$1 = () => ({
|
|
69951
|
-
version:
|
|
69968
|
+
version: 2,
|
|
69952
69969
|
rulesets: {}
|
|
69953
69970
|
});
|
|
69954
69971
|
const loadRulesetEntries$1 = (cacheFilePath, rulesetHash) => {
|
|
69955
69972
|
const entries = /* @__PURE__ */ new Map();
|
|
69956
69973
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69957
|
-
if (persisted.version !==
|
|
69974
|
+
if (persisted.version !== 2 || !isRecord(persisted.rulesets)) return entries;
|
|
69958
69975
|
const bucket = persisted.rulesets[rulesetHash];
|
|
69959
69976
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
69960
69977
|
for (const [fileKey, rawDiagnostics] of Object.entries(bucket.files)) {
|
|
@@ -69974,7 +69991,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69974
69991
|
},
|
|
69975
69992
|
persist: () => {
|
|
69976
69993
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69977
|
-
const rulesets = onDisk.version ===
|
|
69994
|
+
const rulesets = onDisk.version === 2 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
69978
69995
|
const existingBucket = rulesets[rulesetHash];
|
|
69979
69996
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
69980
69997
|
const ourFiles = {};
|
|
@@ -69988,7 +70005,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69988
70005
|
files: Object.fromEntries(cappedEntries)
|
|
69989
70006
|
};
|
|
69990
70007
|
atomicWriteJson(cacheFilePath, {
|
|
69991
|
-
version:
|
|
70008
|
+
version: 2,
|
|
69992
70009
|
rulesets: Object.fromEntries(Object.entries(rulesets).filter(([, bucket]) => isRecord(bucket) && typeof bucket.updatedAtMs === "number").sort(([, first], [, second]) => second.updatedAtMs - first.updatedAtMs).slice(0, 8))
|
|
69993
70010
|
});
|
|
69994
70011
|
}
|
|
@@ -70077,13 +70094,13 @@ const encodeSidecarFileEntry = (entry) => ({
|
|
|
70077
70094
|
diagnostics: entry.diagnostics
|
|
70078
70095
|
});
|
|
70079
70096
|
const emptyCache = () => ({
|
|
70080
|
-
version:
|
|
70097
|
+
version: 3,
|
|
70081
70098
|
rulesets: {}
|
|
70082
70099
|
});
|
|
70083
70100
|
const loadRulesetEntries = (cacheFilePath, rulesetHash) => {
|
|
70084
70101
|
const entries = /* @__PURE__ */ new Map();
|
|
70085
70102
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70086
|
-
if (persisted.version !==
|
|
70103
|
+
if (persisted.version !== 3 || !isRecord(persisted.rulesets)) return entries;
|
|
70087
70104
|
const bucket = persisted.rulesets[rulesetHash];
|
|
70088
70105
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
70089
70106
|
for (const [fileKey, rawEntry] of Object.entries(bucket.files)) {
|
|
@@ -70103,7 +70120,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70103
70120
|
},
|
|
70104
70121
|
persist: () => {
|
|
70105
70122
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70106
|
-
const rulesets = onDisk.version ===
|
|
70123
|
+
const rulesets = onDisk.version === 3 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
70107
70124
|
const existingBucket = rulesets[rulesetHash];
|
|
70108
70125
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
70109
70126
|
const ourFiles = {};
|
|
@@ -70117,7 +70134,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70117
70134
|
files: Object.fromEntries(cappedEntries)
|
|
70118
70135
|
};
|
|
70119
70136
|
atomicWriteJson(cacheFilePath, {
|
|
70120
|
-
version:
|
|
70137
|
+
version: 3,
|
|
70121
70138
|
rulesets: Object.fromEntries(Object.entries(rulesets).filter(([, bucket]) => isRecord(bucket) && typeof bucket.updatedAtMs === "number").sort(([, first], [, second]) => second.updatedAtMs - first.updatedAtMs).slice(0, 8))
|
|
70122
70139
|
});
|
|
70123
70140
|
}
|
|
@@ -71050,7 +71067,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
71050
71067
|
minifiedFileCache.set(absolutePath, minified);
|
|
71051
71068
|
return minified;
|
|
71052
71069
|
};
|
|
71053
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71070
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71054
71071
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71055
71072
|
const primaryLabel = diagnostic.labels[0];
|
|
71056
71073
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -73867,4 +73884,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
73867
73884
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
73868
73885
|
|
|
73869
73886
|
//# sourceMappingURL=index.js.map
|
|
73870
|
-
//# debugId=
|
|
73887
|
+
//# debugId=15a71be1-a569-52e7-b9d5-4796065a0f2a
|
package/dist/lsp.js
CHANGED
|
@@ -61517,6 +61517,13 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
61517
61517
|
"out",
|
|
61518
61518
|
"storybook-static"
|
|
61519
61519
|
]);
|
|
61520
|
+
const TYPESCRIPT_DECLARATION_FILE_PATTERN = /\.d\.(?:ts|mts|cts)$/;
|
|
61521
|
+
const OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES = new Set([
|
|
61522
|
+
"TS(1036)",
|
|
61523
|
+
"TS(1038)",
|
|
61524
|
+
"TS(1183)",
|
|
61525
|
+
"TS(1319)"
|
|
61526
|
+
]);
|
|
61520
61527
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
61521
61528
|
const REACT_ROUTER_CAPABILITY_THRESHOLDS = [
|
|
61522
61529
|
{
|
|
@@ -61808,6 +61815,13 @@ const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
|
61808
61815
|
"Maintainability"
|
|
61809
61816
|
];
|
|
61810
61817
|
const OCCURRENCE_MATCHED_CATEGORIES = new Set(["Accessibility"]);
|
|
61818
|
+
new Map(Object.entries({
|
|
61819
|
+
Security: "An attacker can read user data, act as your users, or run code you never shipped.",
|
|
61820
|
+
Bugs: "Real users hit crashes, wrong output, or state that silently corrupts.",
|
|
61821
|
+
Performance: "Users feel extra latency and wasted renders on every interaction.",
|
|
61822
|
+
Accessibility: "Users on screen readers, keyboards, or assistive tech get locked out.",
|
|
61823
|
+
Maintainability: "Every future change gets slower and riskier to make."
|
|
61824
|
+
}));
|
|
61811
61825
|
const APP_ONLY_RULE_KEYS = new Set([
|
|
61812
61826
|
"react-hooks-js/static-components",
|
|
61813
61827
|
"react-doctor/no-render-prop-children",
|
|
@@ -61830,7 +61844,7 @@ const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
|
|
|
61830
61844
|
const FILE_LINT_CACHE_FILENAME = "file-lint-cache.json";
|
|
61831
61845
|
const FILE_LINT_CACHE_MAX_FILE_COUNT = 5e4;
|
|
61832
61846
|
const SIDECAR_LINT_CACHE_FILENAME = "sidecar-lint-cache.json";
|
|
61833
|
-
const CORE_PACKAGE_VERSION = "0.
|
|
61847
|
+
const CORE_PACKAGE_VERSION = "0.9.0";
|
|
61834
61848
|
const DEAD_CODE_CACHE_FILENAME = "dead-code-cache.json";
|
|
61835
61849
|
const DEAD_CODE_SUMMARY_CACHE_FILENAME = "dead-code-summaries.json";
|
|
61836
61850
|
const SUPPLY_CHAIN_PLUGIN = "socket";
|
|
@@ -62221,6 +62235,7 @@ const frameworkMergeRank = (framework) => {
|
|
|
62221
62235
|
return MOBILE_FRAMEWORKS.has(framework) ? 2 : 1;
|
|
62222
62236
|
};
|
|
62223
62237
|
const REACT_COMPILER_LINT_PACKAGES = new Set(["eslint-plugin-react-compiler"]);
|
|
62238
|
+
const REACT_COMPILER_RUNTIME_PACKAGES = new Set(["react-compiler-runtime"]);
|
|
62224
62239
|
const NEXT_CONFIG_FILENAMES = [
|
|
62225
62240
|
"next.config.js",
|
|
62226
62241
|
"next.config.mjs",
|
|
@@ -62557,18 +62572,20 @@ const getReactCompilerFlagState = (expression, analysis) => {
|
|
|
62557
62572
|
}
|
|
62558
62573
|
return null;
|
|
62559
62574
|
};
|
|
62560
|
-
const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
62575
|
+
const getSelectedObjectProperty = (expression, propertyName, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
|
|
62561
62576
|
let resolvedExpression = expression;
|
|
62562
62577
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62578
|
+
if (visitedExpressions.has(resolvedExpression)) return null;
|
|
62579
|
+
visitedExpressions.add(resolvedExpression);
|
|
62563
62580
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62564
62581
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62565
62582
|
const localInitializer = analysis.localBindings.get(resolvedExpression.text);
|
|
62566
|
-
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis) : null;
|
|
62583
|
+
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
|
|
62567
62584
|
}
|
|
62568
62585
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62569
|
-
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis) : null;
|
|
62586
|
+
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
62570
62587
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, resolvedExpression.text);
|
|
62571
|
-
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis) : null;
|
|
62588
|
+
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis, visitedExpressions) : null;
|
|
62572
62589
|
}
|
|
62573
62590
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62574
62591
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
@@ -62576,7 +62593,7 @@ const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
|
62576
62593
|
if (ts.isMethodDeclaration(property) && getStaticPropertyName$1(property.name) === propertyName) return property;
|
|
62577
62594
|
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
|
|
62578
62595
|
if (ts.isSpreadAssignment(property)) {
|
|
62579
|
-
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis);
|
|
62596
|
+
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62580
62597
|
if (spreadProperty) return spreadProperty;
|
|
62581
62598
|
}
|
|
62582
62599
|
}
|
|
@@ -62925,7 +62942,7 @@ const hasCompilerConfigurationInAncestors = (directory) => {
|
|
|
62925
62942
|
}
|
|
62926
62943
|
return false;
|
|
62927
62944
|
};
|
|
62928
|
-
const detectReactCompiler = (directory, packageJson) => hasCompilerConfiguration(directory, packageJson) || hasCompilerConfigurationInAncestors(directory);
|
|
62945
|
+
const detectReactCompiler = (directory, packageJson) => hasCompilerPackage(packageJson, REACT_COMPILER_RUNTIME_PACKAGES) || hasCompilerPackageInAncestors(directory, REACT_COMPILER_RUNTIME_PACKAGES) || hasCompilerConfiguration(directory, packageJson) || hasCompilerConfigurationInAncestors(directory);
|
|
62929
62946
|
const detectReactCompilerLintPlugin = (directory, packageJson) => hasCompilerPackage(packageJson, REACT_COMPILER_LINT_PACKAGES) || hasCompilerPackageInAncestors(directory, REACT_COMPILER_LINT_PACKAGES);
|
|
62930
62947
|
const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((filename) => {
|
|
62931
62948
|
const filePath = Path.join(directory, filename);
|
|
@@ -69927,13 +69944,13 @@ const decodeFileDiagnostics = (raw) => {
|
|
|
69927
69944
|
}
|
|
69928
69945
|
};
|
|
69929
69946
|
const emptyCache$1 = () => ({
|
|
69930
|
-
version:
|
|
69947
|
+
version: 2,
|
|
69931
69948
|
rulesets: {}
|
|
69932
69949
|
});
|
|
69933
69950
|
const loadRulesetEntries$1 = (cacheFilePath, rulesetHash) => {
|
|
69934
69951
|
const entries = /* @__PURE__ */ new Map();
|
|
69935
69952
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69936
|
-
if (persisted.version !==
|
|
69953
|
+
if (persisted.version !== 2 || !isRecord(persisted.rulesets)) return entries;
|
|
69937
69954
|
const bucket = persisted.rulesets[rulesetHash];
|
|
69938
69955
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
69939
69956
|
for (const [fileKey, rawDiagnostics] of Object.entries(bucket.files)) {
|
|
@@ -69953,7 +69970,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69953
69970
|
},
|
|
69954
69971
|
persist: () => {
|
|
69955
69972
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69956
|
-
const rulesets = onDisk.version ===
|
|
69973
|
+
const rulesets = onDisk.version === 2 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
69957
69974
|
const existingBucket = rulesets[rulesetHash];
|
|
69958
69975
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
69959
69976
|
const ourFiles = {};
|
|
@@ -69967,7 +69984,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69967
69984
|
files: Object.fromEntries(cappedEntries)
|
|
69968
69985
|
};
|
|
69969
69986
|
atomicWriteJson(cacheFilePath, {
|
|
69970
|
-
version:
|
|
69987
|
+
version: 2,
|
|
69971
69988
|
rulesets: Object.fromEntries(Object.entries(rulesets).filter(([, bucket]) => isRecord(bucket) && typeof bucket.updatedAtMs === "number").sort(([, first], [, second]) => second.updatedAtMs - first.updatedAtMs).slice(0, 8))
|
|
69972
69989
|
});
|
|
69973
69990
|
}
|
|
@@ -70056,13 +70073,13 @@ const encodeSidecarFileEntry = (entry) => ({
|
|
|
70056
70073
|
diagnostics: entry.diagnostics
|
|
70057
70074
|
});
|
|
70058
70075
|
const emptyCache = () => ({
|
|
70059
|
-
version:
|
|
70076
|
+
version: 3,
|
|
70060
70077
|
rulesets: {}
|
|
70061
70078
|
});
|
|
70062
70079
|
const loadRulesetEntries = (cacheFilePath, rulesetHash) => {
|
|
70063
70080
|
const entries = /* @__PURE__ */ new Map();
|
|
70064
70081
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70065
|
-
if (persisted.version !==
|
|
70082
|
+
if (persisted.version !== 3 || !isRecord(persisted.rulesets)) return entries;
|
|
70066
70083
|
const bucket = persisted.rulesets[rulesetHash];
|
|
70067
70084
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
70068
70085
|
for (const [fileKey, rawEntry] of Object.entries(bucket.files)) {
|
|
@@ -70082,7 +70099,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70082
70099
|
},
|
|
70083
70100
|
persist: () => {
|
|
70084
70101
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70085
|
-
const rulesets = onDisk.version ===
|
|
70102
|
+
const rulesets = onDisk.version === 3 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
70086
70103
|
const existingBucket = rulesets[rulesetHash];
|
|
70087
70104
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
70088
70105
|
const ourFiles = {};
|
|
@@ -70096,7 +70113,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70096
70113
|
files: Object.fromEntries(cappedEntries)
|
|
70097
70114
|
};
|
|
70098
70115
|
atomicWriteJson(cacheFilePath, {
|
|
70099
|
-
version:
|
|
70116
|
+
version: 3,
|
|
70100
70117
|
rulesets: Object.fromEntries(Object.entries(rulesets).filter(([, bucket]) => isRecord(bucket) && typeof bucket.updatedAtMs === "number").sort(([, first], [, second]) => second.updatedAtMs - first.updatedAtMs).slice(0, 8))
|
|
70101
70118
|
});
|
|
70102
70119
|
}
|
|
@@ -71029,7 +71046,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
71029
71046
|
minifiedFileCache.set(absolutePath, minified);
|
|
71030
71047
|
return minified;
|
|
71031
71048
|
};
|
|
71032
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71049
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71033
71050
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71034
71051
|
const primaryLabel = diagnostic.labels[0];
|
|
71035
71052
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -73458,7 +73475,7 @@ const computeConfigFingerprint = (projectDirectory, version) => {
|
|
|
73458
73475
|
/** Display name used in client-facing messages and progress titles. */
|
|
73459
73476
|
const SERVER_DISPLAY_NAME = "React Doctor";
|
|
73460
73477
|
/** Server version reported in `serverInfo`; injected at build, `dev` from source. */
|
|
73461
|
-
const SERVER_VERSION = "0.
|
|
73478
|
+
const SERVER_VERSION = "0.9.0";
|
|
73462
73479
|
/** `Diagnostic.source` shown next to every published diagnostic. */
|
|
73463
73480
|
const DIAGNOSTIC_SOURCE = "react-doctor";
|
|
73464
73481
|
/**
|
|
@@ -74139,7 +74156,7 @@ const createLintCache = (input) => {
|
|
|
74139
74156
|
let persistTimer = null;
|
|
74140
74157
|
try {
|
|
74141
74158
|
const parsed = JSON.parse(fs.readFileSync(cacheFilePath, "utf8"));
|
|
74142
|
-
if (parsed.version ===
|
|
74159
|
+
if (parsed.version === 3 && parsed.fingerprint === input.fingerprint) for (const [fsPath, entry] of Object.entries(parsed.entries)) entries.set(fsPath, entry);
|
|
74143
74160
|
} catch {}
|
|
74144
74161
|
const persist = () => {
|
|
74145
74162
|
if (persistTimer) {
|
|
@@ -74150,7 +74167,7 @@ const createLintCache = (input) => {
|
|
|
74150
74167
|
dirty = false;
|
|
74151
74168
|
try {
|
|
74152
74169
|
const payload = {
|
|
74153
|
-
version:
|
|
74170
|
+
version: 3,
|
|
74154
74171
|
fingerprint: input.fingerprint,
|
|
74155
74172
|
entries: Object.fromEntries(entries)
|
|
74156
74173
|
};
|
|
@@ -75488,5 +75505,5 @@ const startLanguageServer = () => {
|
|
|
75488
75505
|
};
|
|
75489
75506
|
//#endregion
|
|
75490
75507
|
export { startLanguageServer };
|
|
75491
|
-
!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]="
|
|
75492
|
-
//# debugId=
|
|
75508
|
+
!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]="e096785e-6914-5fc2-a183-b829bd591466")}catch(e){}}();
|
|
75509
|
+
//# debugId=e096785e-6914-5fc2-a183-b829bd591466
|