react-doctor 0.8.3-dev.84b9990 → 0.8.3-dev.9155bc0
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 +273 -178
- package/dist/index.js +32 -16
- package/dist/lsp.js +34 -18
- package/dist/run-scan-app-DZ5jGWFf.js +1661 -0
- package/package.json +12 -6
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]="ef9143d9-5b2e-5eca-adb3-89fde61aafe8")}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",
|
|
@@ -62504,18 +62518,20 @@ const getReactCompilerFlagState = (expression, analysis) => {
|
|
|
62504
62518
|
}
|
|
62505
62519
|
return null;
|
|
62506
62520
|
};
|
|
62507
|
-
const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
62521
|
+
const getSelectedObjectProperty = (expression, propertyName, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
|
|
62508
62522
|
let resolvedExpression = expression;
|
|
62509
62523
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62524
|
+
if (visitedExpressions.has(resolvedExpression)) return null;
|
|
62525
|
+
visitedExpressions.add(resolvedExpression);
|
|
62510
62526
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62511
62527
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62512
62528
|
const localInitializer = analysis.localBindings.get(resolvedExpression.text);
|
|
62513
|
-
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis) : null;
|
|
62529
|
+
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
|
|
62514
62530
|
}
|
|
62515
62531
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62516
|
-
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis) : null;
|
|
62532
|
+
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
62517
62533
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, resolvedExpression.text);
|
|
62518
|
-
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis) : null;
|
|
62534
|
+
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis, visitedExpressions) : null;
|
|
62519
62535
|
}
|
|
62520
62536
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62521
62537
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
@@ -62523,7 +62539,7 @@ const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
|
62523
62539
|
if (ts.isMethodDeclaration(property) && getStaticPropertyName$1(property.name) === propertyName) return property;
|
|
62524
62540
|
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
|
|
62525
62541
|
if (ts.isSpreadAssignment(property)) {
|
|
62526
|
-
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis);
|
|
62542
|
+
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62527
62543
|
if (spreadProperty) return spreadProperty;
|
|
62528
62544
|
}
|
|
62529
62545
|
}
|
|
@@ -69948,13 +69964,13 @@ const decodeFileDiagnostics = (raw) => {
|
|
|
69948
69964
|
}
|
|
69949
69965
|
};
|
|
69950
69966
|
const emptyCache$1 = () => ({
|
|
69951
|
-
version:
|
|
69967
|
+
version: 2,
|
|
69952
69968
|
rulesets: {}
|
|
69953
69969
|
});
|
|
69954
69970
|
const loadRulesetEntries$1 = (cacheFilePath, rulesetHash) => {
|
|
69955
69971
|
const entries = /* @__PURE__ */ new Map();
|
|
69956
69972
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69957
|
-
if (persisted.version !==
|
|
69973
|
+
if (persisted.version !== 2 || !isRecord(persisted.rulesets)) return entries;
|
|
69958
69974
|
const bucket = persisted.rulesets[rulesetHash];
|
|
69959
69975
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
69960
69976
|
for (const [fileKey, rawDiagnostics] of Object.entries(bucket.files)) {
|
|
@@ -69974,7 +69990,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69974
69990
|
},
|
|
69975
69991
|
persist: () => {
|
|
69976
69992
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69977
|
-
const rulesets = onDisk.version ===
|
|
69993
|
+
const rulesets = onDisk.version === 2 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
69978
69994
|
const existingBucket = rulesets[rulesetHash];
|
|
69979
69995
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
69980
69996
|
const ourFiles = {};
|
|
@@ -69988,7 +70004,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69988
70004
|
files: Object.fromEntries(cappedEntries)
|
|
69989
70005
|
};
|
|
69990
70006
|
atomicWriteJson(cacheFilePath, {
|
|
69991
|
-
version:
|
|
70007
|
+
version: 2,
|
|
69992
70008
|
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
70009
|
});
|
|
69994
70010
|
}
|
|
@@ -70077,13 +70093,13 @@ const encodeSidecarFileEntry = (entry) => ({
|
|
|
70077
70093
|
diagnostics: entry.diagnostics
|
|
70078
70094
|
});
|
|
70079
70095
|
const emptyCache = () => ({
|
|
70080
|
-
version:
|
|
70096
|
+
version: 3,
|
|
70081
70097
|
rulesets: {}
|
|
70082
70098
|
});
|
|
70083
70099
|
const loadRulesetEntries = (cacheFilePath, rulesetHash) => {
|
|
70084
70100
|
const entries = /* @__PURE__ */ new Map();
|
|
70085
70101
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70086
|
-
if (persisted.version !==
|
|
70102
|
+
if (persisted.version !== 3 || !isRecord(persisted.rulesets)) return entries;
|
|
70087
70103
|
const bucket = persisted.rulesets[rulesetHash];
|
|
70088
70104
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
70089
70105
|
for (const [fileKey, rawEntry] of Object.entries(bucket.files)) {
|
|
@@ -70103,7 +70119,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70103
70119
|
},
|
|
70104
70120
|
persist: () => {
|
|
70105
70121
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70106
|
-
const rulesets = onDisk.version ===
|
|
70122
|
+
const rulesets = onDisk.version === 3 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
70107
70123
|
const existingBucket = rulesets[rulesetHash];
|
|
70108
70124
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
70109
70125
|
const ourFiles = {};
|
|
@@ -70117,7 +70133,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70117
70133
|
files: Object.fromEntries(cappedEntries)
|
|
70118
70134
|
};
|
|
70119
70135
|
atomicWriteJson(cacheFilePath, {
|
|
70120
|
-
version:
|
|
70136
|
+
version: 3,
|
|
70121
70137
|
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
70138
|
});
|
|
70123
70139
|
}
|
|
@@ -71050,7 +71066,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
71050
71066
|
minifiedFileCache.set(absolutePath, minified);
|
|
71051
71067
|
return minified;
|
|
71052
71068
|
};
|
|
71053
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71069
|
+
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
71070
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71055
71071
|
const primaryLabel = diagnostic.labels[0];
|
|
71056
71072
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -73867,4 +73883,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
73867
73883
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
73868
73884
|
|
|
73869
73885
|
//# sourceMappingURL=index.js.map
|
|
73870
|
-
//# debugId=
|
|
73886
|
+
//# debugId=ef9143d9-5b2e-5eca-adb3-89fde61aafe8
|
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",
|
|
@@ -62557,18 +62571,20 @@ const getReactCompilerFlagState = (expression, analysis) => {
|
|
|
62557
62571
|
}
|
|
62558
62572
|
return null;
|
|
62559
62573
|
};
|
|
62560
|
-
const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
62574
|
+
const getSelectedObjectProperty = (expression, propertyName, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
|
|
62561
62575
|
let resolvedExpression = expression;
|
|
62562
62576
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62577
|
+
if (visitedExpressions.has(resolvedExpression)) return null;
|
|
62578
|
+
visitedExpressions.add(resolvedExpression);
|
|
62563
62579
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62564
62580
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62565
62581
|
const localInitializer = analysis.localBindings.get(resolvedExpression.text);
|
|
62566
|
-
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis) : null;
|
|
62582
|
+
return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
|
|
62567
62583
|
}
|
|
62568
62584
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62569
|
-
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis) : null;
|
|
62585
|
+
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
62570
62586
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, resolvedExpression.text);
|
|
62571
|
-
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis) : null;
|
|
62587
|
+
return topLevelBinding && ts.isExpression(topLevelBinding) ? getSelectedObjectProperty(topLevelBinding, propertyName, analysis, visitedExpressions) : null;
|
|
62572
62588
|
}
|
|
62573
62589
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62574
62590
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
@@ -62576,7 +62592,7 @@ const getSelectedObjectProperty = (expression, propertyName, analysis) => {
|
|
|
62576
62592
|
if (ts.isMethodDeclaration(property) && getStaticPropertyName$1(property.name) === propertyName) return property;
|
|
62577
62593
|
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
|
|
62578
62594
|
if (ts.isSpreadAssignment(property)) {
|
|
62579
|
-
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis);
|
|
62595
|
+
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62580
62596
|
if (spreadProperty) return spreadProperty;
|
|
62581
62597
|
}
|
|
62582
62598
|
}
|
|
@@ -69927,13 +69943,13 @@ const decodeFileDiagnostics = (raw) => {
|
|
|
69927
69943
|
}
|
|
69928
69944
|
};
|
|
69929
69945
|
const emptyCache$1 = () => ({
|
|
69930
|
-
version:
|
|
69946
|
+
version: 2,
|
|
69931
69947
|
rulesets: {}
|
|
69932
69948
|
});
|
|
69933
69949
|
const loadRulesetEntries$1 = (cacheFilePath, rulesetHash) => {
|
|
69934
69950
|
const entries = /* @__PURE__ */ new Map();
|
|
69935
69951
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69936
|
-
if (persisted.version !==
|
|
69952
|
+
if (persisted.version !== 2 || !isRecord(persisted.rulesets)) return entries;
|
|
69937
69953
|
const bucket = persisted.rulesets[rulesetHash];
|
|
69938
69954
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
69939
69955
|
for (const [fileKey, rawDiagnostics] of Object.entries(bucket.files)) {
|
|
@@ -69953,7 +69969,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69953
69969
|
},
|
|
69954
69970
|
persist: () => {
|
|
69955
69971
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache$1());
|
|
69956
|
-
const rulesets = onDisk.version ===
|
|
69972
|
+
const rulesets = onDisk.version === 2 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
69957
69973
|
const existingBucket = rulesets[rulesetHash];
|
|
69958
69974
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
69959
69975
|
const ourFiles = {};
|
|
@@ -69967,7 +69983,7 @@ const createFileLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
69967
69983
|
files: Object.fromEntries(cappedEntries)
|
|
69968
69984
|
};
|
|
69969
69985
|
atomicWriteJson(cacheFilePath, {
|
|
69970
|
-
version:
|
|
69986
|
+
version: 2,
|
|
69971
69987
|
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
69988
|
});
|
|
69973
69989
|
}
|
|
@@ -70056,13 +70072,13 @@ const encodeSidecarFileEntry = (entry) => ({
|
|
|
70056
70072
|
diagnostics: entry.diagnostics
|
|
70057
70073
|
});
|
|
70058
70074
|
const emptyCache = () => ({
|
|
70059
|
-
version:
|
|
70075
|
+
version: 3,
|
|
70060
70076
|
rulesets: {}
|
|
70061
70077
|
});
|
|
70062
70078
|
const loadRulesetEntries = (cacheFilePath, rulesetHash) => {
|
|
70063
70079
|
const entries = /* @__PURE__ */ new Map();
|
|
70064
70080
|
const persisted = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70065
|
-
if (persisted.version !==
|
|
70081
|
+
if (persisted.version !== 3 || !isRecord(persisted.rulesets)) return entries;
|
|
70066
70082
|
const bucket = persisted.rulesets[rulesetHash];
|
|
70067
70083
|
if (!isRecord(bucket) || !isRecord(bucket.files)) return entries;
|
|
70068
70084
|
for (const [fileKey, rawEntry] of Object.entries(bucket.files)) {
|
|
@@ -70082,7 +70098,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70082
70098
|
},
|
|
70083
70099
|
persist: () => {
|
|
70084
70100
|
const onDisk = failOpenReadJson(cacheFilePath, emptyCache());
|
|
70085
|
-
const rulesets = onDisk.version ===
|
|
70101
|
+
const rulesets = onDisk.version === 3 && isRecord(onDisk.rulesets) ? { ...onDisk.rulesets } : {};
|
|
70086
70102
|
const existingBucket = rulesets[rulesetHash];
|
|
70087
70103
|
const existingFiles = isRecord(existingBucket) && isRecord(existingBucket.files) ? existingBucket.files : {};
|
|
70088
70104
|
const ourFiles = {};
|
|
@@ -70096,7 +70112,7 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
70096
70112
|
files: Object.fromEntries(cappedEntries)
|
|
70097
70113
|
};
|
|
70098
70114
|
atomicWriteJson(cacheFilePath, {
|
|
70099
|
-
version:
|
|
70115
|
+
version: 3,
|
|
70100
70116
|
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
70117
|
});
|
|
70102
70118
|
}
|
|
@@ -71029,7 +71045,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
71029
71045
|
minifiedFileCache.set(absolutePath, minified);
|
|
71030
71046
|
return minified;
|
|
71031
71047
|
};
|
|
71032
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71048
|
+
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
71049
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71034
71050
|
const primaryLabel = diagnostic.labels[0];
|
|
71035
71051
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -74139,7 +74155,7 @@ const createLintCache = (input) => {
|
|
|
74139
74155
|
let persistTimer = null;
|
|
74140
74156
|
try {
|
|
74141
74157
|
const parsed = JSON.parse(fs.readFileSync(cacheFilePath, "utf8"));
|
|
74142
|
-
if (parsed.version ===
|
|
74158
|
+
if (parsed.version === 3 && parsed.fingerprint === input.fingerprint) for (const [fsPath, entry] of Object.entries(parsed.entries)) entries.set(fsPath, entry);
|
|
74143
74159
|
} catch {}
|
|
74144
74160
|
const persist = () => {
|
|
74145
74161
|
if (persistTimer) {
|
|
@@ -74150,7 +74166,7 @@ const createLintCache = (input) => {
|
|
|
74150
74166
|
dirty = false;
|
|
74151
74167
|
try {
|
|
74152
74168
|
const payload = {
|
|
74153
|
-
version:
|
|
74169
|
+
version: 3,
|
|
74154
74170
|
fingerprint: input.fingerprint,
|
|
74155
74171
|
entries: Object.fromEntries(entries)
|
|
74156
74172
|
};
|
|
@@ -75488,5 +75504,5 @@ const startLanguageServer = () => {
|
|
|
75488
75504
|
};
|
|
75489
75505
|
//#endregion
|
|
75490
75506
|
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=
|
|
75507
|
+
!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]="a35abfab-9805-5633-9c17-c7012a9dc0b3")}catch(e){}}();
|
|
75508
|
+
//# debugId=a35abfab-9805-5633-9c17-c7012a9dc0b3
|