react-doctor 0.9.2-dev.3f3197f → 0.9.2-dev.b1352a2
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 +78 -36
- package/dist/index.js +62 -32
- package/dist/lsp.js +61 -31
- package/package.json +4 -4
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]="a53d2e7d-c9bc-5c54-b965-3a988afa3832")}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";
|
|
@@ -13,11 +13,11 @@ import * as Crypto from "node:crypto";
|
|
|
13
13
|
import crypto, { createHash, randomUUID } from "node:crypto";
|
|
14
14
|
import { ResolverFactory } from "oxc-resolver";
|
|
15
15
|
import ts from "typescript";
|
|
16
|
+
import * as NodeUrl from "node:url";
|
|
17
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
16
18
|
import * as OS from "node:os";
|
|
17
19
|
import os, { tmpdir } from "node:os";
|
|
18
20
|
import { parseJSON5 } from "confbox";
|
|
19
|
-
import * as NodeUrl from "node:url";
|
|
20
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
21
21
|
import { createJiti } from "jiti";
|
|
22
22
|
import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
|
|
23
23
|
import { gzipSync } from "node:zlib";
|
|
@@ -65596,10 +65596,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
|
|
|
65596
65596
|
}
|
|
65597
65597
|
return null;
|
|
65598
65598
|
};
|
|
65599
|
-
const getFunctionLocalBindings = (functionNode, argumentsList) => {
|
|
65599
|
+
const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
|
|
65600
65600
|
const localBindings = /* @__PURE__ */ new Map();
|
|
65601
65601
|
functionNode.parameters.forEach((parameter, parameterIndex) => {
|
|
65602
|
-
if (ts.isIdentifier(parameter.name))
|
|
65602
|
+
if (ts.isIdentifier(parameter.name)) {
|
|
65603
|
+
const argument = argumentsList[parameterIndex];
|
|
65604
|
+
localBindings.set(parameter.name.text, {
|
|
65605
|
+
expression: argument ?? parameter.initializer ?? null,
|
|
65606
|
+
analysis: argument ? argumentAnalysis : functionAnalysis
|
|
65607
|
+
});
|
|
65608
|
+
}
|
|
65603
65609
|
});
|
|
65604
65610
|
return localBindings;
|
|
65605
65611
|
};
|
|
@@ -65735,8 +65741,8 @@ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /*
|
|
|
65735
65741
|
};
|
|
65736
65742
|
if (ts.isIdentifier(unwrappedExpression)) {
|
|
65737
65743
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
65738
|
-
const
|
|
65739
|
-
return
|
|
65744
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
65745
|
+
return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
65740
65746
|
}
|
|
65741
65747
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
65742
65748
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -65778,8 +65784,8 @@ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /*
|
|
|
65778
65784
|
const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
|
|
65779
65785
|
if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
|
|
65780
65786
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
65781
|
-
const
|
|
65782
|
-
return
|
|
65787
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
65788
|
+
return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
65783
65789
|
}
|
|
65784
65790
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
65785
65791
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -65802,8 +65808,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
65802
65808
|
visitedExpressions.add(resolvedExpression);
|
|
65803
65809
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
65804
65810
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
65805
|
-
const
|
|
65806
|
-
return
|
|
65811
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
65812
|
+
return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
|
|
65807
65813
|
}
|
|
65808
65814
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
65809
65815
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
@@ -65812,9 +65818,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
65812
65818
|
}
|
|
65813
65819
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
65814
65820
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
65815
|
-
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return
|
|
65816
|
-
|
|
65817
|
-
|
|
65821
|
+
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
65822
|
+
node: property.initializer,
|
|
65823
|
+
analysis
|
|
65824
|
+
};
|
|
65825
|
+
if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
65826
|
+
node: property,
|
|
65827
|
+
analysis
|
|
65828
|
+
};
|
|
65829
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
|
|
65830
|
+
node: property.name,
|
|
65831
|
+
analysis
|
|
65832
|
+
};
|
|
65818
65833
|
if (ts.isSpreadAssignment(property)) {
|
|
65819
65834
|
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
65820
65835
|
if (spreadProperty) return spreadProperty;
|
|
@@ -65827,8 +65842,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
|
|
|
65827
65842
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
65828
65843
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
65829
65844
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
65830
|
-
const
|
|
65831
|
-
return
|
|
65845
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
65846
|
+
return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
|
|
65832
65847
|
}
|
|
65833
65848
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
65834
65849
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
|
|
@@ -65912,15 +65927,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
|
|
|
65912
65927
|
}
|
|
65913
65928
|
return bindings;
|
|
65914
65929
|
};
|
|
65915
|
-
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
65930
|
+
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
65916
65931
|
if (!isFile(filePath) || importDepth > 4) return false;
|
|
65917
65932
|
const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
|
|
65918
65933
|
if (visitedModules.has(moduleVisitKey)) return false;
|
|
65919
65934
|
const nextVisitedModules = new Set(visitedModules);
|
|
65920
65935
|
nextVisitedModules.add(moduleVisitKey);
|
|
65921
|
-
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
|
|
65936
|
+
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
|
|
65922
65937
|
};
|
|
65923
|
-
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
65938
|
+
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
65924
65939
|
const analysis = {
|
|
65925
65940
|
filePath,
|
|
65926
65941
|
sourceFile,
|
|
@@ -65930,14 +65945,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
|
|
|
65930
65945
|
localBindings: /* @__PURE__ */ new Map(),
|
|
65931
65946
|
activeFunctions: /* @__PURE__ */ new Set()
|
|
65932
65947
|
};
|
|
65948
|
+
const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
|
|
65933
65949
|
const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
|
|
65934
|
-
return exportedConfigNodes.some((node) =>
|
|
65950
|
+
return exportedConfigNodes.some((node) => {
|
|
65951
|
+
if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
65952
|
+
if (argumentsList.length > 0 && ts.isIdentifier(node)) {
|
|
65953
|
+
const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
|
|
65954
|
+
if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
65955
|
+
const importBinding = getImportBinding(sourceFile, node.text);
|
|
65956
|
+
if (importBinding) {
|
|
65957
|
+
const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
|
|
65958
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
65959
|
+
}
|
|
65960
|
+
}
|
|
65961
|
+
return analyzeConfigNode(node, analysis, allowCompilerTransform);
|
|
65962
|
+
}) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
|
|
65935
65963
|
if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
|
|
65936
65964
|
const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
|
|
65937
|
-
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
|
|
65965
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
65938
65966
|
});
|
|
65939
65967
|
};
|
|
65940
|
-
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
|
|
65968
|
+
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
|
|
65941
65969
|
if (!functionNode.body) return false;
|
|
65942
65970
|
if (analysis.activeFunctions.has(functionNode.pos)) return false;
|
|
65943
65971
|
const activeFunctions = new Set(analysis.activeFunctions);
|
|
@@ -65945,7 +65973,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
65945
65973
|
const functionAnalysis = {
|
|
65946
65974
|
...analysis,
|
|
65947
65975
|
visitedNodes: /* @__PURE__ */ new Set(),
|
|
65948
|
-
localBindings: getFunctionLocalBindings(functionNode, argumentsList),
|
|
65976
|
+
localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
|
|
65949
65977
|
activeFunctions
|
|
65950
65978
|
};
|
|
65951
65979
|
if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
|
|
@@ -65964,7 +65992,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
65964
65992
|
const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
|
|
65965
65993
|
const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
|
|
65966
65994
|
if (!importedFilePath) return null;
|
|
65967
|
-
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
|
|
65995
|
+
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
|
|
65968
65996
|
};
|
|
65969
65997
|
const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
|
|
65970
65998
|
const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
|
|
@@ -65978,8 +66006,8 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
|
|
|
65978
66006
|
if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
|
|
65979
66007
|
if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
|
|
65980
66008
|
if (analysis.localBindings.has(identifier.text)) {
|
|
65981
|
-
const
|
|
65982
|
-
return Boolean(
|
|
66009
|
+
const localReference = analysis.localBindings.get(identifier.text);
|
|
66010
|
+
return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
65983
66011
|
}
|
|
65984
66012
|
const scopedBinding = getScopedConfigBinding(identifier);
|
|
65985
66013
|
if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
@@ -66045,7 +66073,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
|
|
|
66045
66073
|
}
|
|
66046
66074
|
const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
|
|
66047
66075
|
if (selectedProperty === null) return null;
|
|
66048
|
-
return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
66076
|
+
return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
66049
66077
|
};
|
|
66050
66078
|
const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
|
|
66051
66079
|
const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
|
|
@@ -66145,7 +66173,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
66145
66173
|
if (ts.isIdentifier(node.expression)) {
|
|
66146
66174
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
66147
66175
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
66148
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
66176
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
66149
66177
|
}
|
|
66150
66178
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
66151
66179
|
if (importBinding?.isNamespace) {
|
|
@@ -66159,7 +66187,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
66159
66187
|
return false;
|
|
66160
66188
|
}
|
|
66161
66189
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
66162
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
66190
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
66163
66191
|
return false;
|
|
66164
66192
|
}
|
|
66165
66193
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -66168,7 +66196,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
66168
66196
|
if (ts.isIdentifier(node.expression)) {
|
|
66169
66197
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
66170
66198
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
66171
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
66199
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
66172
66200
|
}
|
|
66173
66201
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
66174
66202
|
if (importBinding?.isNamespace) {
|
|
@@ -66181,7 +66209,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
66181
66209
|
}));
|
|
66182
66210
|
}
|
|
66183
66211
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
66184
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
66212
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
66185
66213
|
return false;
|
|
66186
66214
|
}
|
|
66187
66215
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -68558,6 +68586,7 @@ const classifyPackageRole = (filename) => {
|
|
|
68558
68586
|
* Resolves the absolute path to read for a diagnostic's `filePath`,
|
|
68559
68587
|
* accounting for the various shapes oxlint emits:
|
|
68560
68588
|
*
|
|
68589
|
+
* - `file://` URL — decode to an absolute filesystem path.
|
|
68561
68590
|
* - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
|
|
68562
68591
|
* - Absolute Windows (`C:/...` or `C:\...`) — pass through.
|
|
68563
68592
|
* - `./relative` or bare relative — join against `rootDirectory`.
|
|
@@ -68567,6 +68596,7 @@ const classifyPackageRole = (filename) => {
|
|
|
68567
68596
|
* use one canonical resolution path.
|
|
68568
68597
|
*/
|
|
68569
68598
|
const resolveCandidateReadPath = (rootDirectory, filePath) => {
|
|
68599
|
+
if (filePath.startsWith("file://")) return fileURLToPath(filePath);
|
|
68570
68600
|
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
68571
68601
|
if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
|
|
68572
68602
|
return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
|
|
@@ -78424,7 +78454,7 @@ const makeNoopConsole = () => ({
|
|
|
78424
78454
|
});
|
|
78425
78455
|
//#endregion
|
|
78426
78456
|
//#region src/cli/utils/version.ts
|
|
78427
|
-
const VERSION = "0.9.2-dev.
|
|
78457
|
+
const VERSION = "0.9.2-dev.b1352a2";
|
|
78428
78458
|
//#endregion
|
|
78429
78459
|
//#region src/cli/utils/json-mode.ts
|
|
78430
78460
|
let context = null;
|
|
@@ -78782,13 +78812,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
78782
78812
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
78783
78813
|
* standard `SENTRY_RELEASE` override.
|
|
78784
78814
|
*/
|
|
78785
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.2-dev.
|
|
78815
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.2-dev.b1352a2`;
|
|
78786
78816
|
/**
|
|
78787
78817
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
78788
78818
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
78789
78819
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
78790
78820
|
*/
|
|
78791
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.2-dev.
|
|
78821
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.2-dev.b1352a2") ? "development" : "production");
|
|
78792
78822
|
/**
|
|
78793
78823
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
78794
78824
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -96241,7 +96271,19 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
96241
96271
|
}
|
|
96242
96272
|
const projectDirectories = await selectProjects(resolvedDirectory, flags.project, skipPrompts, userConfig?.projects);
|
|
96243
96273
|
const projectSelectionCompletedTime = performance$1.now();
|
|
96244
|
-
|
|
96274
|
+
let changedFilesDiffInfo = flags.changedFilesFrom ? buildChangedFilesDiffInfo(readChangedFilesFrom(Path.resolve(flags.changedFilesFrom))) : null;
|
|
96275
|
+
if (changedFilesDiffInfo !== null && scanTarget.didRedirectViaRootDir) {
|
|
96276
|
+
const relativeProjectDirectory = resolveProjectRelativeDirectory(requestedDirectory, resolvedDirectory);
|
|
96277
|
+
if (relativeProjectDirectory) {
|
|
96278
|
+
const projectPrefix = `${relativeProjectDirectory}/`;
|
|
96279
|
+
changedFilesDiffInfo = {
|
|
96280
|
+
...changedFilesDiffInfo,
|
|
96281
|
+
changedFiles: changedFilesDiffInfo.changedFiles.flatMap((filePath) => {
|
|
96282
|
+
return filePath.startsWith(projectPrefix) ? [filePath.slice(projectPrefix.length)] : [];
|
|
96283
|
+
})
|
|
96284
|
+
};
|
|
96285
|
+
}
|
|
96286
|
+
}
|
|
96245
96287
|
const requestedScope = resolveScope(flags, userConfig);
|
|
96246
96288
|
const includeUntracked = flags.includeUntracked ?? false;
|
|
96247
96289
|
const scopeRequest = requestedScope.scope === void 0 && changedFilesDiffInfo !== null ? {
|
|
@@ -97601,4 +97643,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
97601
97643
|
export { toForwardSlashes as A, getCategoryImpact as B, buildRulePriorityMap as C, resolveBlockingLevel as D, formatLearnMoreLine as E, TUI_REPORT_DETAIL_WIDTH_FRACTION as F, runPromise as G, mapWithConcurrency as H, isCiEnvironment as I, succeed$3 as J, sync as K, DIAGNOSTIC_CATEGORY_BUCKETS as L, isUnicodeSupported as M, METRIC as N, isReactDoctorWorkflowInstalled as O, TUI_REPORT_COMPACT_MAX_ROWS as P, Progress as R, hasLintHardFailure as S, formatFixRecipeLine as T, mergeReactDoctorConfigs as U, highlighter as V, resolveScanTarget as W, canAnimateOnboarding as _, resolveCliInspectOptions as a, buildCodeFrame as b, detectLaunchableAgents as c, launchCliAgent as d, isShareOptedOut as f, doctorFace as g, easeOutCubic as h, selectProjects as i, findNearestPackageDirectory as j, recordCount as k, CLI_AGENT_BINARIES as l, printFooter as m, shouldFailScanGate as n, countUniqueScannedFiles as o, inspect as p, void_ as q, discoverWorkspacePackages as r, setUpGitHubActions as s, exitGracefully as t, copyToClipboard as u, computeProjectedScore as v, buildSortedRuleGroups as w, buildNoScoreMessage as x, formatElapsedTime as y, Reporter as z };
|
|
97602
97644
|
|
|
97603
97645
|
//# sourceMappingURL=cli.js.map
|
|
97604
|
-
//# debugId=
|
|
97646
|
+
//# debugId=a53d2e7d-c9bc-5c54-b965-3a988afa3832
|
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]="d8933f05-29ad-59df-86d5-8c21cd4e4460")}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";
|
|
@@ -13,11 +13,11 @@ import * as NodeChildProcess from "node:child_process";
|
|
|
13
13
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
14
14
|
import { ResolverFactory } from "oxc-resolver";
|
|
15
15
|
import ts from "typescript";
|
|
16
|
+
import * as NodeUrl from "node:url";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
16
18
|
import * as OS from "node:os";
|
|
17
19
|
import os from "node:os";
|
|
18
20
|
import { parseJSON5 } from "confbox";
|
|
19
|
-
import * as NodeUrl from "node:url";
|
|
20
|
-
import { fileURLToPath } from "node:url";
|
|
21
21
|
import { createJiti } from "jiti";
|
|
22
22
|
import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
|
|
23
23
|
import { gzipSync } from "node:zlib";
|
|
@@ -62399,10 +62399,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
|
|
|
62399
62399
|
}
|
|
62400
62400
|
return null;
|
|
62401
62401
|
};
|
|
62402
|
-
const getFunctionLocalBindings = (functionNode, argumentsList) => {
|
|
62402
|
+
const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
|
|
62403
62403
|
const localBindings = /* @__PURE__ */ new Map();
|
|
62404
62404
|
functionNode.parameters.forEach((parameter, parameterIndex) => {
|
|
62405
|
-
if (ts.isIdentifier(parameter.name))
|
|
62405
|
+
if (ts.isIdentifier(parameter.name)) {
|
|
62406
|
+
const argument = argumentsList[parameterIndex];
|
|
62407
|
+
localBindings.set(parameter.name.text, {
|
|
62408
|
+
expression: argument ?? parameter.initializer ?? null,
|
|
62409
|
+
analysis: argument ? argumentAnalysis : functionAnalysis
|
|
62410
|
+
});
|
|
62411
|
+
}
|
|
62406
62412
|
});
|
|
62407
62413
|
return localBindings;
|
|
62408
62414
|
};
|
|
@@ -62538,8 +62544,8 @@ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /*
|
|
|
62538
62544
|
};
|
|
62539
62545
|
if (ts.isIdentifier(unwrappedExpression)) {
|
|
62540
62546
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62541
|
-
const
|
|
62542
|
-
return
|
|
62547
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
62548
|
+
return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62543
62549
|
}
|
|
62544
62550
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62545
62551
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62581,8 +62587,8 @@ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /*
|
|
|
62581
62587
|
const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
|
|
62582
62588
|
if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
|
|
62583
62589
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62584
|
-
const
|
|
62585
|
-
return
|
|
62590
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
62591
|
+
return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62586
62592
|
}
|
|
62587
62593
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62588
62594
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62605,8 +62611,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62605
62611
|
visitedExpressions.add(resolvedExpression);
|
|
62606
62612
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62607
62613
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62608
|
-
const
|
|
62609
|
-
return
|
|
62614
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
62615
|
+
return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
|
|
62610
62616
|
}
|
|
62611
62617
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62612
62618
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
@@ -62615,9 +62621,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62615
62621
|
}
|
|
62616
62622
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62617
62623
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
62618
|
-
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return
|
|
62619
|
-
|
|
62620
|
-
|
|
62624
|
+
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
62625
|
+
node: property.initializer,
|
|
62626
|
+
analysis
|
|
62627
|
+
};
|
|
62628
|
+
if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
62629
|
+
node: property,
|
|
62630
|
+
analysis
|
|
62631
|
+
};
|
|
62632
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
|
|
62633
|
+
node: property.name,
|
|
62634
|
+
analysis
|
|
62635
|
+
};
|
|
62621
62636
|
if (ts.isSpreadAssignment(property)) {
|
|
62622
62637
|
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62623
62638
|
if (spreadProperty) return spreadProperty;
|
|
@@ -62630,8 +62645,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
|
|
|
62630
62645
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62631
62646
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62632
62647
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62633
|
-
const
|
|
62634
|
-
return
|
|
62648
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
62649
|
+
return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
|
|
62635
62650
|
}
|
|
62636
62651
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62637
62652
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
|
|
@@ -62715,15 +62730,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
|
|
|
62715
62730
|
}
|
|
62716
62731
|
return bindings;
|
|
62717
62732
|
};
|
|
62718
|
-
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
62733
|
+
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62719
62734
|
if (!isFile(filePath) || importDepth > 4) return false;
|
|
62720
62735
|
const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
|
|
62721
62736
|
if (visitedModules.has(moduleVisitKey)) return false;
|
|
62722
62737
|
const nextVisitedModules = new Set(visitedModules);
|
|
62723
62738
|
nextVisitedModules.add(moduleVisitKey);
|
|
62724
|
-
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
|
|
62739
|
+
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
|
|
62725
62740
|
};
|
|
62726
|
-
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
62741
|
+
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62727
62742
|
const analysis = {
|
|
62728
62743
|
filePath,
|
|
62729
62744
|
sourceFile,
|
|
@@ -62733,14 +62748,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
|
|
|
62733
62748
|
localBindings: /* @__PURE__ */ new Map(),
|
|
62734
62749
|
activeFunctions: /* @__PURE__ */ new Set()
|
|
62735
62750
|
};
|
|
62751
|
+
const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
|
|
62736
62752
|
const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
|
|
62737
|
-
return exportedConfigNodes.some((node) =>
|
|
62753
|
+
return exportedConfigNodes.some((node) => {
|
|
62754
|
+
if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
62755
|
+
if (argumentsList.length > 0 && ts.isIdentifier(node)) {
|
|
62756
|
+
const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
|
|
62757
|
+
if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
62758
|
+
const importBinding = getImportBinding(sourceFile, node.text);
|
|
62759
|
+
if (importBinding) {
|
|
62760
|
+
const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
|
|
62761
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
62762
|
+
}
|
|
62763
|
+
}
|
|
62764
|
+
return analyzeConfigNode(node, analysis, allowCompilerTransform);
|
|
62765
|
+
}) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
|
|
62738
62766
|
if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
|
|
62739
62767
|
const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
|
|
62740
|
-
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
|
|
62768
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
62741
62769
|
});
|
|
62742
62770
|
};
|
|
62743
|
-
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
|
|
62771
|
+
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
|
|
62744
62772
|
if (!functionNode.body) return false;
|
|
62745
62773
|
if (analysis.activeFunctions.has(functionNode.pos)) return false;
|
|
62746
62774
|
const activeFunctions = new Set(analysis.activeFunctions);
|
|
@@ -62748,7 +62776,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62748
62776
|
const functionAnalysis = {
|
|
62749
62777
|
...analysis,
|
|
62750
62778
|
visitedNodes: /* @__PURE__ */ new Set(),
|
|
62751
|
-
localBindings: getFunctionLocalBindings(functionNode, argumentsList),
|
|
62779
|
+
localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
|
|
62752
62780
|
activeFunctions
|
|
62753
62781
|
};
|
|
62754
62782
|
if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
|
|
@@ -62767,7 +62795,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62767
62795
|
const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
|
|
62768
62796
|
const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
|
|
62769
62797
|
if (!importedFilePath) return null;
|
|
62770
|
-
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
|
|
62798
|
+
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
|
|
62771
62799
|
};
|
|
62772
62800
|
const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
|
|
62773
62801
|
const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
|
|
@@ -62781,8 +62809,8 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
|
|
|
62781
62809
|
if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
|
|
62782
62810
|
if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
|
|
62783
62811
|
if (analysis.localBindings.has(identifier.text)) {
|
|
62784
|
-
const
|
|
62785
|
-
return Boolean(
|
|
62812
|
+
const localReference = analysis.localBindings.get(identifier.text);
|
|
62813
|
+
return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
62786
62814
|
}
|
|
62787
62815
|
const scopedBinding = getScopedConfigBinding(identifier);
|
|
62788
62816
|
if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
@@ -62848,7 +62876,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
|
|
|
62848
62876
|
}
|
|
62849
62877
|
const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
|
|
62850
62878
|
if (selectedProperty === null) return null;
|
|
62851
|
-
return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
62879
|
+
return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62852
62880
|
};
|
|
62853
62881
|
const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
|
|
62854
62882
|
const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
|
|
@@ -62948,7 +62976,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62948
62976
|
if (ts.isIdentifier(node.expression)) {
|
|
62949
62977
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
62950
62978
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
62951
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
62979
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
62952
62980
|
}
|
|
62953
62981
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
62954
62982
|
if (importBinding?.isNamespace) {
|
|
@@ -62962,7 +62990,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62962
62990
|
return false;
|
|
62963
62991
|
}
|
|
62964
62992
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
62965
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
62993
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62966
62994
|
return false;
|
|
62967
62995
|
}
|
|
62968
62996
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -62971,7 +62999,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62971
62999
|
if (ts.isIdentifier(node.expression)) {
|
|
62972
63000
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
62973
63001
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
62974
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63002
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
62975
63003
|
}
|
|
62976
63004
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
62977
63005
|
if (importBinding?.isNamespace) {
|
|
@@ -62984,7 +63012,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62984
63012
|
}));
|
|
62985
63013
|
}
|
|
62986
63014
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
62987
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63015
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62988
63016
|
return false;
|
|
62989
63017
|
}
|
|
62990
63018
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -65361,6 +65389,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65361
65389
|
* Resolves the absolute path to read for a diagnostic's `filePath`,
|
|
65362
65390
|
* accounting for the various shapes oxlint emits:
|
|
65363
65391
|
*
|
|
65392
|
+
* - `file://` URL — decode to an absolute filesystem path.
|
|
65364
65393
|
* - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
|
|
65365
65394
|
* - Absolute Windows (`C:/...` or `C:\...`) — pass through.
|
|
65366
65395
|
* - `./relative` or bare relative — join against `rootDirectory`.
|
|
@@ -65370,6 +65399,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65370
65399
|
* use one canonical resolution path.
|
|
65371
65400
|
*/
|
|
65372
65401
|
const resolveCandidateReadPath = (rootDirectory, filePath) => {
|
|
65402
|
+
if (filePath.startsWith("file://")) return fileURLToPath(filePath);
|
|
65373
65403
|
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
65374
65404
|
if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
|
|
65375
65405
|
return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
|
|
@@ -74892,4 +74922,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
74892
74922
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
74893
74923
|
|
|
74894
74924
|
//# sourceMappingURL=index.js.map
|
|
74895
|
-
//# debugId=
|
|
74925
|
+
//# debugId=d8933f05-29ad-59df-86d5-8c21cd4e4460
|
package/dist/lsp.js
CHANGED
|
@@ -12,9 +12,9 @@ import * as NodeChildProcess from "node:child_process";
|
|
|
12
12
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
13
13
|
import { ResolverFactory } from "oxc-resolver";
|
|
14
14
|
import ts from "typescript";
|
|
15
|
-
import { parseJSON5 } from "confbox";
|
|
16
15
|
import * as NodeUrl from "node:url";
|
|
17
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { parseJSON5 } from "confbox";
|
|
18
18
|
import { createJiti } from "jiti";
|
|
19
19
|
import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
|
|
20
20
|
import { gzipSync } from "node:zlib";
|
|
@@ -62452,10 +62452,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
|
|
|
62452
62452
|
}
|
|
62453
62453
|
return null;
|
|
62454
62454
|
};
|
|
62455
|
-
const getFunctionLocalBindings = (functionNode, argumentsList) => {
|
|
62455
|
+
const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
|
|
62456
62456
|
const localBindings = /* @__PURE__ */ new Map();
|
|
62457
62457
|
functionNode.parameters.forEach((parameter, parameterIndex) => {
|
|
62458
|
-
if (ts.isIdentifier(parameter.name))
|
|
62458
|
+
if (ts.isIdentifier(parameter.name)) {
|
|
62459
|
+
const argument = argumentsList[parameterIndex];
|
|
62460
|
+
localBindings.set(parameter.name.text, {
|
|
62461
|
+
expression: argument ?? parameter.initializer ?? null,
|
|
62462
|
+
analysis: argument ? argumentAnalysis : functionAnalysis
|
|
62463
|
+
});
|
|
62464
|
+
}
|
|
62459
62465
|
});
|
|
62460
62466
|
return localBindings;
|
|
62461
62467
|
};
|
|
@@ -62591,8 +62597,8 @@ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /*
|
|
|
62591
62597
|
};
|
|
62592
62598
|
if (ts.isIdentifier(unwrappedExpression)) {
|
|
62593
62599
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62594
|
-
const
|
|
62595
|
-
return
|
|
62600
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
62601
|
+
return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62596
62602
|
}
|
|
62597
62603
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62598
62604
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62634,8 +62640,8 @@ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /*
|
|
|
62634
62640
|
const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
|
|
62635
62641
|
if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
|
|
62636
62642
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62637
|
-
const
|
|
62638
|
-
return
|
|
62643
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
62644
|
+
return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62639
62645
|
}
|
|
62640
62646
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62641
62647
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62658,8 +62664,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62658
62664
|
visitedExpressions.add(resolvedExpression);
|
|
62659
62665
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62660
62666
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62661
|
-
const
|
|
62662
|
-
return
|
|
62667
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
62668
|
+
return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
|
|
62663
62669
|
}
|
|
62664
62670
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62665
62671
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
@@ -62668,9 +62674,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62668
62674
|
}
|
|
62669
62675
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62670
62676
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
62671
|
-
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return
|
|
62672
|
-
|
|
62673
|
-
|
|
62677
|
+
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
62678
|
+
node: property.initializer,
|
|
62679
|
+
analysis
|
|
62680
|
+
};
|
|
62681
|
+
if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
62682
|
+
node: property,
|
|
62683
|
+
analysis
|
|
62684
|
+
};
|
|
62685
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
|
|
62686
|
+
node: property.name,
|
|
62687
|
+
analysis
|
|
62688
|
+
};
|
|
62674
62689
|
if (ts.isSpreadAssignment(property)) {
|
|
62675
62690
|
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62676
62691
|
if (spreadProperty) return spreadProperty;
|
|
@@ -62683,8 +62698,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
|
|
|
62683
62698
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62684
62699
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62685
62700
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62686
|
-
const
|
|
62687
|
-
return
|
|
62701
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
62702
|
+
return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
|
|
62688
62703
|
}
|
|
62689
62704
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62690
62705
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
|
|
@@ -62768,15 +62783,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
|
|
|
62768
62783
|
}
|
|
62769
62784
|
return bindings;
|
|
62770
62785
|
};
|
|
62771
|
-
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
62786
|
+
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62772
62787
|
if (!isFile(filePath) || importDepth > 4) return false;
|
|
62773
62788
|
const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
|
|
62774
62789
|
if (visitedModules.has(moduleVisitKey)) return false;
|
|
62775
62790
|
const nextVisitedModules = new Set(visitedModules);
|
|
62776
62791
|
nextVisitedModules.add(moduleVisitKey);
|
|
62777
|
-
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
|
|
62792
|
+
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
|
|
62778
62793
|
};
|
|
62779
|
-
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
62794
|
+
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62780
62795
|
const analysis = {
|
|
62781
62796
|
filePath,
|
|
62782
62797
|
sourceFile,
|
|
@@ -62786,14 +62801,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
|
|
|
62786
62801
|
localBindings: /* @__PURE__ */ new Map(),
|
|
62787
62802
|
activeFunctions: /* @__PURE__ */ new Set()
|
|
62788
62803
|
};
|
|
62804
|
+
const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
|
|
62789
62805
|
const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
|
|
62790
|
-
return exportedConfigNodes.some((node) =>
|
|
62806
|
+
return exportedConfigNodes.some((node) => {
|
|
62807
|
+
if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
62808
|
+
if (argumentsList.length > 0 && ts.isIdentifier(node)) {
|
|
62809
|
+
const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
|
|
62810
|
+
if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
62811
|
+
const importBinding = getImportBinding(sourceFile, node.text);
|
|
62812
|
+
if (importBinding) {
|
|
62813
|
+
const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
|
|
62814
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
62815
|
+
}
|
|
62816
|
+
}
|
|
62817
|
+
return analyzeConfigNode(node, analysis, allowCompilerTransform);
|
|
62818
|
+
}) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
|
|
62791
62819
|
if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
|
|
62792
62820
|
const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
|
|
62793
|
-
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
|
|
62821
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
62794
62822
|
});
|
|
62795
62823
|
};
|
|
62796
|
-
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
|
|
62824
|
+
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
|
|
62797
62825
|
if (!functionNode.body) return false;
|
|
62798
62826
|
if (analysis.activeFunctions.has(functionNode.pos)) return false;
|
|
62799
62827
|
const activeFunctions = new Set(analysis.activeFunctions);
|
|
@@ -62801,7 +62829,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62801
62829
|
const functionAnalysis = {
|
|
62802
62830
|
...analysis,
|
|
62803
62831
|
visitedNodes: /* @__PURE__ */ new Set(),
|
|
62804
|
-
localBindings: getFunctionLocalBindings(functionNode, argumentsList),
|
|
62832
|
+
localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
|
|
62805
62833
|
activeFunctions
|
|
62806
62834
|
};
|
|
62807
62835
|
if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
|
|
@@ -62820,7 +62848,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62820
62848
|
const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
|
|
62821
62849
|
const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
|
|
62822
62850
|
if (!importedFilePath) return null;
|
|
62823
|
-
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
|
|
62851
|
+
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
|
|
62824
62852
|
};
|
|
62825
62853
|
const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
|
|
62826
62854
|
const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
|
|
@@ -62834,8 +62862,8 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
|
|
|
62834
62862
|
if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
|
|
62835
62863
|
if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
|
|
62836
62864
|
if (analysis.localBindings.has(identifier.text)) {
|
|
62837
|
-
const
|
|
62838
|
-
return Boolean(
|
|
62865
|
+
const localReference = analysis.localBindings.get(identifier.text);
|
|
62866
|
+
return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
62839
62867
|
}
|
|
62840
62868
|
const scopedBinding = getScopedConfigBinding(identifier);
|
|
62841
62869
|
if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
@@ -62901,7 +62929,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
|
|
|
62901
62929
|
}
|
|
62902
62930
|
const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
|
|
62903
62931
|
if (selectedProperty === null) return null;
|
|
62904
|
-
return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
62932
|
+
return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62905
62933
|
};
|
|
62906
62934
|
const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
|
|
62907
62935
|
const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
|
|
@@ -63001,7 +63029,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63001
63029
|
if (ts.isIdentifier(node.expression)) {
|
|
63002
63030
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
63003
63031
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
63004
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63032
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
63005
63033
|
}
|
|
63006
63034
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
63007
63035
|
if (importBinding?.isNamespace) {
|
|
@@ -63015,7 +63043,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63015
63043
|
return false;
|
|
63016
63044
|
}
|
|
63017
63045
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
63018
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63046
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
63019
63047
|
return false;
|
|
63020
63048
|
}
|
|
63021
63049
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -63024,7 +63052,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63024
63052
|
if (ts.isIdentifier(node.expression)) {
|
|
63025
63053
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
63026
63054
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
63027
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63055
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
63028
63056
|
}
|
|
63029
63057
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
63030
63058
|
if (importBinding?.isNamespace) {
|
|
@@ -63037,7 +63065,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63037
63065
|
}));
|
|
63038
63066
|
}
|
|
63039
63067
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
63040
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63068
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
63041
63069
|
return false;
|
|
63042
63070
|
}
|
|
63043
63071
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -65410,6 +65438,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65410
65438
|
* Resolves the absolute path to read for a diagnostic's `filePath`,
|
|
65411
65439
|
* accounting for the various shapes oxlint emits:
|
|
65412
65440
|
*
|
|
65441
|
+
* - `file://` URL — decode to an absolute filesystem path.
|
|
65413
65442
|
* - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
|
|
65414
65443
|
* - Absolute Windows (`C:/...` or `C:\...`) — pass through.
|
|
65415
65444
|
* - `./relative` or bare relative — join against `rootDirectory`.
|
|
@@ -65419,6 +65448,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65419
65448
|
* use one canonical resolution path.
|
|
65420
65449
|
*/
|
|
65421
65450
|
const resolveCandidateReadPath = (rootDirectory, filePath) => {
|
|
65451
|
+
if (filePath.startsWith("file://")) return fileURLToPath(filePath);
|
|
65422
65452
|
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
65423
65453
|
if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
|
|
65424
65454
|
return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
|
|
@@ -76519,5 +76549,5 @@ const startLanguageServer = () => {
|
|
|
76519
76549
|
};
|
|
76520
76550
|
//#endregion
|
|
76521
76551
|
export { startLanguageServer };
|
|
76522
|
-
!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]="
|
|
76523
|
-
//# debugId=
|
|
76552
|
+
!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]="d58404fe-4e69-5868-81c2-97b15676ab73")}catch(e){}}();
|
|
76553
|
+
//# debugId=d58404fe-4e69-5868-81c2-97b15676ab73
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.9.2-dev.
|
|
3
|
+
"version": "0.9.2-dev.b1352a2",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"jiti": "^2.7.0",
|
|
63
63
|
"magicast": "^0.5.3",
|
|
64
64
|
"oxc-resolver": "^11.24.2",
|
|
65
|
-
"oxlint": ">=1.
|
|
65
|
+
"oxlint": ">=1.76.0 <1.77.0",
|
|
66
66
|
"prompts": "^2.4.2",
|
|
67
67
|
"react": "19.2.5",
|
|
68
68
|
"typescript": ">=5.0.4 <6",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
71
71
|
"vscode-uri": "^3.1.0",
|
|
72
72
|
"yaml": "^2.9.0",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
73
|
+
"deslop-js": "0.9.2",
|
|
74
|
+
"oxlint-plugin-react-doctor": "0.9.2-dev.b1352a2"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/babel__code-frame": "^7.27.0",
|