react-doctor 0.9.1-dev.7ee59d3 → 0.9.1-dev.80e89c5

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.
Files changed (4) hide show
  1. package/dist/cli.js +170 -72
  2. package/dist/index.js +167 -69
  3. package/dist/lsp.js +167 -69
  4. package/package.json +5 -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]="7f26fa62-fe0c-5ae0-bc9c-97a0deb50b43")}catch(e){}}();
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]="3092d21f-ad14-532c-9877-ac1e91c6e9e0")}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";
@@ -11,6 +11,7 @@ import process$1 from "node:process";
11
11
  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";
12
12
  import * as Crypto from "node:crypto";
13
13
  import crypto, { createHash, randomUUID } from "node:crypto";
14
+ import { ResolverFactory } from "oxc-resolver";
14
15
  import ts from "typescript";
15
16
  import * as OS from "node:os";
16
17
  import os, { tmpdir } from "node:os";
@@ -65239,8 +65240,13 @@ const findMonorepoRoot = (startDirectory) => {
65239
65240
  * byte-equivalent copy.
65240
65241
  */
65241
65242
  const isProjectBoundary = (directory) => NFS.existsSync(Path.join(directory, ".git")) || isMonorepoRoot(directory);
65243
+ const unwrapTypescriptExpression = (expression) => {
65244
+ let currentExpression = expression;
65245
+ while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
65246
+ return currentExpression;
65247
+ };
65242
65248
  const TSCONFIG_FILENAME = "tsconfig.json";
65243
- const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || Path.isAbsolute(extendsValue);
65249
+ const isLocalModuleSpecifier = (moduleSpecifier) => moduleSpecifier === "." || moduleSpecifier === ".." || moduleSpecifier.startsWith("./") || moduleSpecifier.startsWith("../") || Path.isAbsolute(moduleSpecifier);
65244
65250
  const ensureJsonExtension = (filePath) => Path.extname(filePath) === "" ? `${filePath}.json` : filePath;
65245
65251
  const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
65246
65252
  const requireFromConfig = createRequire(Path.join(fromConfigDirectory, "tsconfig.json"));
@@ -65257,7 +65263,12 @@ const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
65257
65263
  return null;
65258
65264
  };
65259
65265
  const resolveExtendsPath = (extendsValue, fromConfigDirectory) => {
65260
- if (isRelativeExtendsValue(extendsValue)) return ensureJsonExtension(Path.resolve(fromConfigDirectory, extendsValue));
65266
+ if (isLocalModuleSpecifier(extendsValue)) {
65267
+ const resolvedPath = Path.resolve(fromConfigDirectory, extendsValue);
65268
+ if (isFile(resolvedPath)) return resolvedPath;
65269
+ const directoryConfigPath = Path.join(resolvedPath, TSCONFIG_FILENAME);
65270
+ return isFile(directoryConfigPath) ? directoryConfigPath : ensureJsonExtension(resolvedPath);
65271
+ }
65261
65272
  return resolvePackageExtendsPath(extendsValue, fromConfigDirectory);
65262
65273
  };
65263
65274
  const normalizeCompilerOptions = (compilerOptions) => {
@@ -65451,6 +65462,15 @@ const REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS = [
65451
65462
  ".cts",
65452
65463
  ".json"
65453
65464
  ];
65465
+ const REACT_COMPILER_CONFIG_RESOLVER = new ResolverFactory({
65466
+ conditionNames: [
65467
+ "import",
65468
+ "require",
65469
+ "node",
65470
+ "default"
65471
+ ],
65472
+ extensions: REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS
65473
+ });
65454
65474
  const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
65455
65475
  const hasCompilerPackage = (packageJson, compilerPackages) => {
65456
65476
  const allDependencies = {
@@ -65474,6 +65494,18 @@ const hasCompilerPackageInAncestors = (directory, compilerPackages) => {
65474
65494
  return false;
65475
65495
  };
65476
65496
  const resolveImportedConfigFile = (fromFilePath, moduleSpecifier) => {
65497
+ if (!isLocalModuleSpecifier(moduleSpecifier)) {
65498
+ try {
65499
+ const resolvedPath = REACT_COMPILER_CONFIG_RESOLVER.resolveFileSync(fromFilePath, moduleSpecifier).path;
65500
+ if (resolvedPath && isFile(resolvedPath)) return resolvedPath;
65501
+ } catch {}
65502
+ try {
65503
+ const resolvedPath = createRequire(fromFilePath).resolve(moduleSpecifier);
65504
+ return isFile(resolvedPath) ? resolvedPath : null;
65505
+ } catch {
65506
+ return null;
65507
+ }
65508
+ }
65477
65509
  const unresolvedPath = Path.resolve(Path.dirname(fromFilePath), moduleSpecifier);
65478
65510
  const extension = Path.extname(unresolvedPath);
65479
65511
  return (extension ? [unresolvedPath, ...REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS.map((sourceExtension) => `${unresolvedPath.slice(0, -extension.length)}${sourceExtension}`)] : [
@@ -65684,9 +65716,11 @@ const getAssignedPropertyInitializer = (identifier, propertyName) => {
65684
65716
  initializer: assignedInitializer
65685
65717
  };
65686
65718
  };
65687
- const getStaticConfigValueState = (expression, analysis) => {
65688
- let unwrappedExpression = expression;
65689
- while (ts.isParenthesizedExpression(unwrappedExpression) || ts.isAsExpression(unwrappedExpression) || ts.isTypeAssertionExpression(unwrappedExpression) || ts.isSatisfiesExpression(unwrappedExpression) || ts.isNonNullExpression(unwrappedExpression)) unwrappedExpression = unwrappedExpression.expression;
65719
+ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
65720
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
65721
+ if (visitedExpressions.has(unwrappedExpression)) return null;
65722
+ const nextVisitedExpressions = new Set(visitedExpressions);
65723
+ nextVisitedExpressions.add(unwrappedExpression);
65690
65724
  if (unwrappedExpression.kind === ts.SyntaxKind.NullKeyword || ts.isIdentifier(unwrappedExpression) && unwrappedExpression.text === "undefined") return {
65691
65725
  isNullish: true,
65692
65726
  isTruthy: false
@@ -65702,31 +65736,31 @@ const getStaticConfigValueState = (expression, analysis) => {
65702
65736
  if (ts.isIdentifier(unwrappedExpression)) {
65703
65737
  if (analysis.localBindings.has(unwrappedExpression.text)) {
65704
65738
  const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
65705
- return localInitializer ? getStaticConfigValueState(localInitializer, analysis) : null;
65739
+ return localInitializer ? getStaticConfigValueState(localInitializer, analysis, nextVisitedExpressions) : null;
65706
65740
  }
65707
65741
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
65708
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis) : null;
65742
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
65709
65743
  }
65710
65744
  if (ts.isConditionalExpression(unwrappedExpression)) {
65711
- const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis);
65712
- if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis);
65713
- const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis);
65714
- const whenFalseState = getStaticConfigValueState(unwrappedExpression.whenFalse, analysis);
65745
+ const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis, nextVisitedExpressions);
65746
+ if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis, nextVisitedExpressions);
65747
+ const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis, nextVisitedExpressions);
65748
+ const whenFalseState = getStaticConfigValueState(unwrappedExpression.whenFalse, analysis, nextVisitedExpressions);
65715
65749
  return whenTrueState !== null && whenFalseState !== null && whenTrueState.isNullish === whenFalseState.isNullish && whenTrueState.isTruthy === whenFalseState.isTruthy ? whenTrueState : null;
65716
65750
  }
65717
65751
  if (ts.isBinaryExpression(unwrappedExpression)) {
65718
- const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis);
65752
+ const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis, nextVisitedExpressions);
65719
65753
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
65720
65754
  if (leftState === null) return null;
65721
- return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
65755
+ return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
65722
65756
  }
65723
65757
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
65724
65758
  if (leftState === null) return null;
65725
- return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis);
65759
+ return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions);
65726
65760
  }
65727
65761
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken) {
65728
65762
  if (leftState === null) return null;
65729
- return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
65763
+ return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
65730
65764
  }
65731
65765
  }
65732
65766
  return null;
@@ -65735,25 +65769,27 @@ const isStaticallyDisabledConfigExpression = (expression, analysis) => getStatic
65735
65769
  const isStaticallyTruthyConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isTruthy === true;
65736
65770
  const isStaticallyNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === true;
65737
65771
  const isStaticallyNonNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === false;
65738
- const getReactCompilerFlagState = (expression, analysis) => {
65739
- let unwrappedExpression = expression;
65740
- while (ts.isParenthesizedExpression(unwrappedExpression) || ts.isAsExpression(unwrappedExpression) || ts.isTypeAssertionExpression(unwrappedExpression) || ts.isSatisfiesExpression(unwrappedExpression) || ts.isNonNullExpression(unwrappedExpression)) unwrappedExpression = unwrappedExpression.expression;
65772
+ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
65773
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
65774
+ if (visitedExpressions.has(unwrappedExpression)) return null;
65775
+ const nextVisitedExpressions = new Set(visitedExpressions);
65776
+ nextVisitedExpressions.add(unwrappedExpression);
65741
65777
  if (ts.isIdentifier(unwrappedExpression)) {
65742
65778
  const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
65743
65779
  if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
65744
65780
  if (analysis.localBindings.has(unwrappedExpression.text)) {
65745
65781
  const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
65746
- return localInitializer ? getReactCompilerFlagState(localInitializer, analysis) : null;
65782
+ return localInitializer ? getReactCompilerFlagState(localInitializer, analysis, nextVisitedExpressions) : null;
65747
65783
  }
65748
65784
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
65749
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis) : null;
65785
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
65750
65786
  }
65751
65787
  if (!ts.isObjectLiteralExpression(unwrappedExpression)) return null;
65752
65788
  for (const property of [...unwrappedExpression.properties].reverse()) {
65753
65789
  if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.initializer, analysis) };
65754
65790
  if (ts.isShorthandPropertyAssignment(property) && property.name.text === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.name, analysis) };
65755
65791
  if (ts.isSpreadAssignment(property)) {
65756
- const spreadState = getReactCompilerFlagState(property.expression, analysis);
65792
+ const spreadState = getReactCompilerFlagState(property.expression, analysis, nextVisitedExpressions);
65757
65793
  if (spreadState) return spreadState;
65758
65794
  }
65759
65795
  }
@@ -65925,6 +65961,11 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
65925
65961
  visitReturns(functionNode.body);
65926
65962
  return hasCompiler;
65927
65963
  };
65964
+ const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
65965
+ const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
65966
+ if (!importedFilePath) return null;
65967
+ return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
65968
+ };
65928
65969
  const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
65929
65970
  const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
65930
65971
  if (assignedReactCompiler.initializer && !isStaticallyDisabledConfigExpression(assignedReactCompiler.initializer, analysis)) return true;
@@ -65945,30 +65986,62 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
65945
65986
  const importBinding = getImportBinding(analysis.sourceFile, identifier.text);
65946
65987
  if (importBinding) {
65947
65988
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
65948
- if (!importBinding.moduleSpecifier.startsWith(".")) return false;
65949
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65950
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
65989
+ return Boolean(analyzeImportedConfig({
65990
+ analysis,
65991
+ moduleSpecifier: importBinding.moduleSpecifier,
65992
+ exportName: importBinding.exportName,
65993
+ allowCompilerTransform
65994
+ }));
65951
65995
  }
65952
65996
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, identifier.text);
65953
65997
  return Boolean(topLevelBinding && analyzeConfigNode(topLevelBinding, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
65954
65998
  };
65955
65999
  const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransform) => {
65956
66000
  const target = callExpression.expression;
66001
+ const callableRequiredModuleSpecifier = getRequireModuleSpecifier$1(target);
66002
+ if (callableRequiredModuleSpecifier !== null) {
66003
+ if (ts.isCallExpression(target) && ts.isIdentifier(target.expression) && (analysis.localBindings.has(target.expression.text) || getScopedConfigBinding(target.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66004
+ if (allowCompilerTransform && isCompilerTransformModule(callableRequiredModuleSpecifier, "default")) return true;
66005
+ const hasCompilerTransform = analyzeImportedConfig({
66006
+ analysis,
66007
+ moduleSpecifier: callableRequiredModuleSpecifier,
66008
+ exportName: "default",
66009
+ allowCompilerTransform,
66010
+ argumentsList: callExpression.arguments
66011
+ });
66012
+ if (isLocalModuleSpecifier(callableRequiredModuleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66013
+ return null;
66014
+ }
65957
66015
  if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
65958
66016
  const propertyName = ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null;
65959
66017
  if (propertyName === null) return null;
65960
66018
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(target.expression);
65961
66019
  if (requiredModuleSpecifier !== null) {
65962
- if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
65963
- if (!requiredModuleSpecifier.startsWith(".")) return null;
65964
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
65965
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, propertyName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, callExpression.arguments));
66020
+ if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (analysis.localBindings.has(target.expression.expression.text) || getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66021
+ if (allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, propertyName)) return true;
66022
+ const hasCompilerTransform = analyzeImportedConfig({
66023
+ analysis,
66024
+ moduleSpecifier: requiredModuleSpecifier,
66025
+ exportName: propertyName,
66026
+ allowCompilerTransform,
66027
+ argumentsList: callExpression.arguments
66028
+ });
66029
+ if (isLocalModuleSpecifier(requiredModuleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66030
+ return null;
65966
66031
  }
65967
66032
  if (!ts.isIdentifier(target.expression)) return null;
65968
- const importBinding = getImportBinding(analysis.sourceFile, target.expression.text);
65969
- if (importBinding?.isNamespace && importBinding.moduleSpecifier.startsWith(".")) {
65970
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65971
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, propertyName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, callExpression.arguments));
66033
+ const importBinding = analysis.localBindings.has(target.expression.text) || getScopedConfigBinding(target.expression).wasFound ? null : getImportBinding(analysis.sourceFile, target.expression.text);
66034
+ if (importBinding?.isNamespace) {
66035
+ if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, propertyName)) return true;
66036
+ const hasCompilerTransform = analyzeImportedConfig({
66037
+ analysis,
66038
+ moduleSpecifier: importBinding.moduleSpecifier,
66039
+ exportName: propertyName,
66040
+ allowCompilerTransform,
66041
+ argumentsList: callExpression.arguments
66042
+ });
66043
+ if (isLocalModuleSpecifier(importBinding.moduleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66044
+ return null;
65972
66045
  }
65973
66046
  const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
65974
66047
  if (selectedProperty === null) return null;
@@ -65991,9 +66064,13 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65991
66064
  if (propertyName === "reactCompiler") continue;
65992
66065
  if ((propertyName === "plugins" || propertyName === "presets") && node.properties.slice(propertyIndex + 1).some((laterProperty) => ts.isSpreadAssignment(laterProperty) && configExpressionMayDefineProperty(laterProperty.expression, propertyName, analysis) || (ts.isPropertyAssignment(laterProperty) || ts.isShorthandPropertyAssignment(laterProperty)) && getStaticPropertyName$2(laterProperty.name) === propertyName)) continue;
65993
66066
  const propertyAllowsCompilerTransform = propertyName === "plugins" || propertyName === "presets";
65994
- if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer) && property.initializer.text.startsWith(".")) {
65995
- const extendedFilePath = resolveImportedConfigFile(analysis.filePath, property.initializer.text);
65996
- if (extendedFilePath && analyzeConfigModuleExport(extendedFilePath, "default", false, analysis.importDepth + 1, analysis.visitedModules)) return true;
66067
+ if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer)) {
66068
+ if (analyzeImportedConfig({
66069
+ analysis,
66070
+ moduleSpecifier: property.initializer.text,
66071
+ exportName: "default",
66072
+ allowCompilerTransform: false
66073
+ })) return true;
65997
66074
  }
65998
66075
  if (analyzeConfigNode(property.initializer, analysis, propertyAllowsCompilerTransform, propertyAllowsCompilerTransform)) return true;
65999
66076
  } else if (ts.isShorthandPropertyAssignment(property)) {
@@ -66026,16 +66103,27 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66026
66103
  if (directModuleSpecifier && isRequireShadowed) return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
66027
66104
  if (directModuleSpecifier && !isRequireShadowed) {
66028
66105
  if (allowCompilerTransform && isCompilerTransformModule(directModuleSpecifier, "default")) return true;
66029
- if (directModuleSpecifier.startsWith(".")) {
66030
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, directModuleSpecifier);
66031
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, "default", allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
66032
- }
66106
+ if (analyzeImportedConfig({
66107
+ analysis,
66108
+ moduleSpecifier: directModuleSpecifier,
66109
+ exportName: "default",
66110
+ allowCompilerTransform
66111
+ })) return true;
66033
66112
  }
66034
66113
  if (ts.isIdentifier(node.expression)) {
66035
- const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66036
- if (importBinding?.moduleSpecifier.startsWith(".")) {
66037
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66038
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, node.arguments));
66114
+ if (!analysis.localBindings.has(node.expression.text) && !getScopedConfigBinding(node.expression).wasFound) {
66115
+ const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66116
+ if (importBinding) {
66117
+ if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
66118
+ const hasCompilerTransform = analyzeImportedConfig({
66119
+ analysis,
66120
+ moduleSpecifier: importBinding.moduleSpecifier,
66121
+ exportName: importBinding.exportName,
66122
+ allowCompilerTransform,
66123
+ argumentsList: node.arguments
66124
+ });
66125
+ if (isLocalModuleSpecifier(importBinding.moduleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66126
+ }
66039
66127
  }
66040
66128
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, node.expression.text);
66041
66129
  if (topLevelBinding && ts.isFunctionLike(topLevelBinding) && analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, node.arguments)) return true;
@@ -66045,25 +66133,29 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66045
66133
  if (ts.isPropertyAccessExpression(node)) {
66046
66134
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(node.expression);
66047
66135
  if (requiredModuleSpecifier) {
66048
- if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66049
- if (requiredModuleSpecifier.startsWith(".")) {
66050
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
66051
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66052
- }
66136
+ if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (analysis.localBindings.has(node.expression.expression.text) || getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66137
+ if (analyzeImportedConfig({
66138
+ analysis,
66139
+ moduleSpecifier: requiredModuleSpecifier,
66140
+ exportName: node.name.text,
66141
+ allowCompilerTransform
66142
+ })) return true;
66053
66143
  return allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, node.name.text);
66054
66144
  }
66055
66145
  if (ts.isIdentifier(node.expression)) {
66056
- if (analysis.localBindings.has(node.expression.text)) {
66057
- const localInitializer = analysis.localBindings.get(node.expression.text);
66058
- return Boolean(localInitializer && analyzeConfigNode(localInitializer, analysis, allowCompilerTransform));
66146
+ if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
66147
+ const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
66148
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
66059
66149
  }
66060
66150
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66061
66151
  if (importBinding?.isNamespace) {
66062
66152
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.name.text)) return true;
66063
- if (importBinding.moduleSpecifier.startsWith(".")) {
66064
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66065
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
66066
- }
66153
+ if (analyzeImportedConfig({
66154
+ analysis,
66155
+ moduleSpecifier: importBinding.moduleSpecifier,
66156
+ exportName: node.name.text,
66157
+ allowCompilerTransform
66158
+ })) return true;
66067
66159
  return false;
66068
66160
  }
66069
66161
  const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
@@ -66074,13 +66166,19 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66074
66166
  }
66075
66167
  if (ts.isElementAccessExpression(node) && node.argumentExpression && ts.isStringLiteralLike(node.argumentExpression)) {
66076
66168
  if (ts.isIdentifier(node.expression)) {
66169
+ if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
66170
+ const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
66171
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
66172
+ }
66077
66173
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66078
66174
  if (importBinding?.isNamespace) {
66079
66175
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.argumentExpression.text)) return true;
66080
- if (importBinding.moduleSpecifier.startsWith(".")) {
66081
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66082
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.argumentExpression.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66083
- }
66176
+ return Boolean(analyzeImportedConfig({
66177
+ analysis,
66178
+ moduleSpecifier: importBinding.moduleSpecifier,
66179
+ exportName: node.argumentExpression.text,
66180
+ allowCompilerTransform
66181
+ }));
66084
66182
  }
66085
66183
  const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
66086
66184
  if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
@@ -66118,14 +66216,19 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66118
66216
  };
66119
66217
  const hasCompilerInConfigFile = (filePath) => analyzeConfigModuleExport(filePath, "default", false, 0, /* @__PURE__ */ new Set());
66120
66218
  const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(Path.join(directory, filename)));
66121
- const hasCompilerInPackageJsonConfig = (packageJson) => isPlainObject(packageJson.babel) && analyzeConfigSourceFileExport(ts.parseJsonText("package.json", JSON.stringify(packageJson.babel)), "package.json#babel", "default", false, 0, /* @__PURE__ */ new Set());
66122
- const hasCompilerConfiguration = (directory, packageJson) => hasCompilerInPackageJsonConfig(packageJson) || hasCompilerInConfigFiles(directory, REACT_COMPILER_CONFIG_FILENAMES);
66219
+ const hasCompilerInPackageJsonConfig = (directory, packageJson) => {
66220
+ if (!isPlainObject(packageJson.babel)) return false;
66221
+ const packageJsonPath = Path.join(directory, "package.json");
66222
+ return analyzeConfigSourceFileExport(ts.parseJsonText(packageJsonPath, JSON.stringify(packageJson.babel)), packageJsonPath, "default", false, 0, /* @__PURE__ */ new Set());
66223
+ };
66224
+ const hasCompilerConfiguration = (directory, packageJson) => hasCompilerInPackageJsonConfig(directory, packageJson) || hasCompilerInConfigFiles(directory, REACT_COMPILER_CONFIG_FILENAMES);
66123
66225
  const hasCompilerConfigurationInAncestors = (directory) => {
66124
66226
  if (isProjectBoundary(directory)) return false;
66125
66227
  let ancestorDirectory = Path.dirname(directory);
66126
66228
  while (ancestorDirectory !== Path.dirname(ancestorDirectory)) {
66127
66229
  const ancestorPackagePath = Path.join(ancestorDirectory, "package.json");
66128
- if (hasCompilerInPackageJsonConfig(isFile(ancestorPackagePath) ? readPackageJson$1(ancestorPackagePath) : {}) || hasCompilerInConfigFiles(ancestorDirectory, BABEL_CONFIG_FILENAMES)) return true;
66230
+ const ancestorPackageJson = isFile(ancestorPackagePath) ? readPackageJson$1(ancestorPackagePath) : {};
66231
+ if (hasCompilerInPackageJsonConfig(ancestorDirectory, ancestorPackageJson) || hasCompilerInConfigFiles(ancestorDirectory, BABEL_CONFIG_FILENAMES)) return true;
66129
66232
  if (isProjectBoundary(ancestorDirectory)) return false;
66130
66233
  ancestorDirectory = Path.dirname(ancestorDirectory);
66131
66234
  }
@@ -70411,11 +70514,6 @@ const getTypescriptScriptKind = (fileName) => {
70411
70514
  if (fileName.endsWith(".ts")) return ts.ScriptKind.TS;
70412
70515
  return ts.ScriptKind.JS;
70413
70516
  };
70414
- const unwrapTypescriptExpression = (expression) => {
70415
- let currentExpression = expression;
70416
- while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
70417
- return currentExpression;
70418
- };
70419
70517
  const BABEL_CONFIG_FILE_NAMES$1 = [
70420
70518
  "babel.config.js",
70421
70519
  "babel.config.cjs",
@@ -78320,7 +78418,7 @@ const makeNoopConsole = () => ({
78320
78418
  });
78321
78419
  //#endregion
78322
78420
  //#region src/cli/utils/version.ts
78323
- const VERSION = "0.9.1-dev.7ee59d3";
78421
+ const VERSION = "0.9.1-dev.80e89c5";
78324
78422
  //#endregion
78325
78423
  //#region src/cli/utils/json-mode.ts
78326
78424
  let context = null;
@@ -78678,13 +78776,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
78678
78776
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
78679
78777
  * standard `SENTRY_RELEASE` override.
78680
78778
  */
78681
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.1-dev.7ee59d3`;
78779
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.1-dev.80e89c5`;
78682
78780
  /**
78683
78781
  * Deployment environment shown in Sentry's environment filter. Defaults to
78684
78782
  * `production` for tagged releases and `development` for dev/unbuilt versions,
78685
78783
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
78686
78784
  */
78687
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.1-dev.7ee59d3") ? "development" : "production");
78785
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.1-dev.80e89c5") ? "development" : "production");
78688
78786
  /**
78689
78787
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
78690
78788
  * (set to `0` to disable tracing) and falls back to
@@ -97483,4 +97581,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
97483
97581
  export { toForwardSlashes as A, highlighter as B, buildRulePriorityMap as C, resolveBlockingLevel as D, formatLearnMoreLine as E, isCiEnvironment as F, sync as G, mergeReactDoctorConfigs as H, DIAGNOSTIC_CATEGORY_BUCKETS as I, void_ as K, Progress as L, isUnicodeSupported as M, METRIC as N, isReactDoctorWorkflowInstalled as O, TUI_REPORT_DETAIL_WIDTH_FRACTION as P, Reporter as R, hasLintHardFailure as S, formatFixRecipeLine as T, resolveScanTarget as U, mapWithConcurrency as V, runPromise 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, succeed$3 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, getCategoryImpact as z };
97484
97582
 
97485
97583
  //# sourceMappingURL=cli.js.map
97486
- //# debugId=7f26fa62-fe0c-5ae0-bc9c-97a0deb50b43
97584
+ //# debugId=3092d21f-ad14-532c-9877-ac1e91c6e9e0