react-doctor 0.9.1-dev.b1b62db → 0.9.2-dev.201106e

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 +216 -74
  2. package/dist/index.js +213 -71
  3. package/dist/lsp.js +214 -72
  4. package/package.json +7 -6
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]="cf9aea89-a185-53f6-9e42-7af2cece64f2")}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]="1d99d852-8548-5af9-a8d9-d49d41e704f6")}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";
@@ -64995,7 +64996,7 @@ const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
64995
64996
  const FILE_LINT_CACHE_FILENAME = "file-lint-cache.json";
64996
64997
  const FILE_LINT_CACHE_MAX_FILE_COUNT = 5e4;
64997
64998
  const SIDECAR_LINT_CACHE_FILENAME = "sidecar-lint-cache.json";
64998
- const CORE_PACKAGE_VERSION = "0.9.1";
64999
+ const CORE_PACKAGE_VERSION = "0.9.2";
64999
65000
  const DEAD_CODE_CACHE_FILENAME = "dead-code-cache.json";
65000
65001
  const DEAD_CODE_SUMMARY_CACHE_FILENAME = "dead-code-summaries.json";
65001
65002
  const SUPPLY_CHAIN_PLUGIN = "socket";
@@ -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}`)] : [
@@ -65499,7 +65531,7 @@ const hasTopLevelValueBinding = (sourceFile, bindingName) => sourceFile.statemen
65499
65531
  const namedBindings = importClause?.namedBindings;
65500
65532
  return namedBindings ? ts.isNamespaceImport(namedBindings) ? namedBindings.name.text === bindingName : namedBindings.elements.some((element) => element.name.text === bindingName) : false;
65501
65533
  }
65502
- if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === bindingName);
65534
+ if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.some((declaration) => bindingNameContainsIdentifier(declaration.name, bindingName));
65503
65535
  return (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name?.text === bindingName;
65504
65536
  });
65505
65537
  const getImportBinding = (sourceFile, bindingName) => {
@@ -65600,6 +65632,48 @@ const getScopedConfigBinding = (identifier) => {
65600
65632
  };
65601
65633
  };
65602
65634
  const isCompilerTransformModule = (moduleSpecifier, exportName) => moduleSpecifier === "babel-plugin-react-compiler" && exportName === "default" || moduleSpecifier === "@vitejs/plugin-react" && exportName === "reactCompilerPreset";
65635
+ const NODE_MODULE_SPECIFIERS = new Set(["module", "node:module"]);
65636
+ const isConstantVariableInitializer = (node) => ts.isExpression(node) && ts.isVariableDeclaration(node.parent) && ts.isVariableDeclarationList(node.parent.parent) && Boolean(node.parent.parent.flags & ts.NodeFlags.Const);
65637
+ const isNodeCreateRequireCall = (node, analysis) => {
65638
+ if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node) || ts.isAwaitExpression(node)) return isNodeCreateRequireCall(node.expression, analysis);
65639
+ if (!ts.isCallExpression(node)) return false;
65640
+ const target = node.expression;
65641
+ if (ts.isIdentifier(target)) {
65642
+ if (analysis.localBindings.has(target.text) || getScopedConfigBinding(target).wasFound) return false;
65643
+ const importBinding = getImportBinding(analysis.sourceFile, target.text);
65644
+ return Boolean(importBinding && NODE_MODULE_SPECIFIERS.has(importBinding.moduleSpecifier) && importBinding.exportName === "createRequire");
65645
+ }
65646
+ if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return false;
65647
+ if ((ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null) !== "createRequire") return false;
65648
+ const createRequireReceiver = target.expression;
65649
+ if (ts.isCallExpression(createRequireReceiver)) {
65650
+ const requiredModuleSpecifier = getRequireModuleSpecifier$1(createRequireReceiver);
65651
+ if (requiredModuleSpecifier === null || !NODE_MODULE_SPECIFIERS.has(requiredModuleSpecifier) || !ts.isIdentifier(createRequireReceiver.expression)) return false;
65652
+ const requireIdentifier = createRequireReceiver.expression;
65653
+ return !analysis.localBindings.has(requireIdentifier.text) && !getScopedConfigBinding(requireIdentifier).wasFound && !hasTopLevelValueBinding(analysis.sourceFile, requireIdentifier.text);
65654
+ }
65655
+ if (!ts.isIdentifier(createRequireReceiver)) return false;
65656
+ if (analysis.localBindings.has(createRequireReceiver.text) || getScopedConfigBinding(createRequireReceiver).wasFound) return false;
65657
+ const importBinding = getImportBinding(analysis.sourceFile, createRequireReceiver.text);
65658
+ return Boolean(importBinding?.isNamespace && NODE_MODULE_SPECIFIERS.has(importBinding.moduleSpecifier));
65659
+ };
65660
+ const getNodeRequireResolveModuleSpecifier = (callExpression, analysis) => {
65661
+ const [moduleSpecifierNode] = callExpression.arguments;
65662
+ if (!moduleSpecifierNode || !ts.isStringLiteralLike(moduleSpecifierNode)) return null;
65663
+ const target = callExpression.expression;
65664
+ if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
65665
+ if ((ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null) !== "resolve") return null;
65666
+ if (isNodeCreateRequireCall(target.expression, analysis)) return moduleSpecifierNode.text;
65667
+ if (!ts.isIdentifier(target.expression)) return null;
65668
+ const resolverIdentifier = target.expression;
65669
+ if (analysis.localBindings.has(resolverIdentifier.text)) return null;
65670
+ const scopedBinding = getScopedConfigBinding(resolverIdentifier);
65671
+ const topLevelBinding = scopedBinding.wasFound ? null : getTopLevelBinding(analysis.sourceFile, resolverIdentifier.text);
65672
+ const resolverInitializer = scopedBinding.wasFound ? scopedBinding.initializer : topLevelBinding;
65673
+ if (resolverInitializer === null && !scopedBinding.wasFound && resolverIdentifier.text === "require" && !hasTopLevelValueBinding(analysis.sourceFile, resolverIdentifier.text) && getImportBinding(analysis.sourceFile, resolverIdentifier.text) === null) return moduleSpecifierNode.text;
65674
+ if (!resolverInitializer || !isConstantVariableInitializer(resolverInitializer) || !isNodeCreateRequireCall(resolverInitializer, analysis)) return null;
65675
+ return moduleSpecifierNode.text;
65676
+ };
65603
65677
  const getAssignedPropertyInitializer = (identifier, propertyName) => {
65604
65678
  let bindingScope = null;
65605
65679
  let currentNode = identifier;
@@ -65642,9 +65716,11 @@ const getAssignedPropertyInitializer = (identifier, propertyName) => {
65642
65716
  initializer: assignedInitializer
65643
65717
  };
65644
65718
  };
65645
- const getStaticConfigValueState = (expression, analysis) => {
65646
- let unwrappedExpression = expression;
65647
- 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);
65648
65724
  if (unwrappedExpression.kind === ts.SyntaxKind.NullKeyword || ts.isIdentifier(unwrappedExpression) && unwrappedExpression.text === "undefined") return {
65649
65725
  isNullish: true,
65650
65726
  isTruthy: false
@@ -65660,31 +65736,31 @@ const getStaticConfigValueState = (expression, analysis) => {
65660
65736
  if (ts.isIdentifier(unwrappedExpression)) {
65661
65737
  if (analysis.localBindings.has(unwrappedExpression.text)) {
65662
65738
  const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
65663
- return localInitializer ? getStaticConfigValueState(localInitializer, analysis) : null;
65739
+ return localInitializer ? getStaticConfigValueState(localInitializer, analysis, nextVisitedExpressions) : null;
65664
65740
  }
65665
65741
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
65666
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis) : null;
65742
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
65667
65743
  }
65668
65744
  if (ts.isConditionalExpression(unwrappedExpression)) {
65669
- const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis);
65670
- if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis);
65671
- const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis);
65672
- 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);
65673
65749
  return whenTrueState !== null && whenFalseState !== null && whenTrueState.isNullish === whenFalseState.isNullish && whenTrueState.isTruthy === whenFalseState.isTruthy ? whenTrueState : null;
65674
65750
  }
65675
65751
  if (ts.isBinaryExpression(unwrappedExpression)) {
65676
- const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis);
65752
+ const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis, nextVisitedExpressions);
65677
65753
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
65678
65754
  if (leftState === null) return null;
65679
- return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
65755
+ return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
65680
65756
  }
65681
65757
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
65682
65758
  if (leftState === null) return null;
65683
- return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis);
65759
+ return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions);
65684
65760
  }
65685
65761
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken) {
65686
65762
  if (leftState === null) return null;
65687
- return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
65763
+ return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
65688
65764
  }
65689
65765
  }
65690
65766
  return null;
@@ -65693,25 +65769,27 @@ const isStaticallyDisabledConfigExpression = (expression, analysis) => getStatic
65693
65769
  const isStaticallyTruthyConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isTruthy === true;
65694
65770
  const isStaticallyNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === true;
65695
65771
  const isStaticallyNonNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === false;
65696
- const getReactCompilerFlagState = (expression, analysis) => {
65697
- let unwrappedExpression = expression;
65698
- 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);
65699
65777
  if (ts.isIdentifier(unwrappedExpression)) {
65700
65778
  const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
65701
65779
  if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
65702
65780
  if (analysis.localBindings.has(unwrappedExpression.text)) {
65703
65781
  const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
65704
- return localInitializer ? getReactCompilerFlagState(localInitializer, analysis) : null;
65782
+ return localInitializer ? getReactCompilerFlagState(localInitializer, analysis, nextVisitedExpressions) : null;
65705
65783
  }
65706
65784
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
65707
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis) : null;
65785
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
65708
65786
  }
65709
65787
  if (!ts.isObjectLiteralExpression(unwrappedExpression)) return null;
65710
65788
  for (const property of [...unwrappedExpression.properties].reverse()) {
65711
65789
  if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.initializer, analysis) };
65712
65790
  if (ts.isShorthandPropertyAssignment(property) && property.name.text === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.name, analysis) };
65713
65791
  if (ts.isSpreadAssignment(property)) {
65714
- const spreadState = getReactCompilerFlagState(property.expression, analysis);
65792
+ const spreadState = getReactCompilerFlagState(property.expression, analysis, nextVisitedExpressions);
65715
65793
  if (spreadState) return spreadState;
65716
65794
  }
65717
65795
  }
@@ -65883,6 +65961,11 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
65883
65961
  visitReturns(functionNode.body);
65884
65962
  return hasCompiler;
65885
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
+ };
65886
65969
  const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
65887
65970
  const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
65888
65971
  if (assignedReactCompiler.initializer && !isStaticallyDisabledConfigExpression(assignedReactCompiler.initializer, analysis)) return true;
@@ -65903,30 +65986,62 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
65903
65986
  const importBinding = getImportBinding(analysis.sourceFile, identifier.text);
65904
65987
  if (importBinding) {
65905
65988
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
65906
- if (!importBinding.moduleSpecifier.startsWith(".")) return false;
65907
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65908
- 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
+ }));
65909
65995
  }
65910
65996
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, identifier.text);
65911
65997
  return Boolean(topLevelBinding && analyzeConfigNode(topLevelBinding, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
65912
65998
  };
65913
65999
  const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransform) => {
65914
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
+ }
65915
66015
  if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
65916
66016
  const propertyName = ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null;
65917
66017
  if (propertyName === null) return null;
65918
66018
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(target.expression);
65919
66019
  if (requiredModuleSpecifier !== null) {
65920
- if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
65921
- if (!requiredModuleSpecifier.startsWith(".")) return null;
65922
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
65923
- 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;
65924
66031
  }
65925
66032
  if (!ts.isIdentifier(target.expression)) return null;
65926
- const importBinding = getImportBinding(analysis.sourceFile, target.expression.text);
65927
- if (importBinding?.isNamespace && importBinding.moduleSpecifier.startsWith(".")) {
65928
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65929
- 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;
65930
66045
  }
65931
66046
  const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
65932
66047
  if (selectedProperty === null) return null;
@@ -65949,9 +66064,13 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65949
66064
  if (propertyName === "reactCompiler") continue;
65950
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;
65951
66066
  const propertyAllowsCompilerTransform = propertyName === "plugins" || propertyName === "presets";
65952
- if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer) && property.initializer.text.startsWith(".")) {
65953
- const extendedFilePath = resolveImportedConfigFile(analysis.filePath, property.initializer.text);
65954
- 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;
65955
66074
  }
65956
66075
  if (analyzeConfigNode(property.initializer, analysis, propertyAllowsCompilerTransform, propertyAllowsCompilerTransform)) return true;
65957
66076
  } else if (ts.isShorthandPropertyAssignment(property)) {
@@ -65975,6 +66094,8 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65975
66094
  });
65976
66095
  }
65977
66096
  if (ts.isCallExpression(node)) {
66097
+ const resolvedModuleSpecifier = getNodeRequireResolveModuleSpecifier(node, analysis);
66098
+ if (resolvedModuleSpecifier !== null) return allowCompilerTransform && isCompilerTransformModule(resolvedModuleSpecifier, "default");
65978
66099
  const callTargetResult = analyzeConfigCallTarget(node, analysis, allowCompilerTransform);
65979
66100
  if (callTargetResult !== null) return callTargetResult;
65980
66101
  const directModuleSpecifier = getRequireModuleSpecifier$1(node);
@@ -65982,16 +66103,27 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65982
66103
  if (directModuleSpecifier && isRequireShadowed) return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
65983
66104
  if (directModuleSpecifier && !isRequireShadowed) {
65984
66105
  if (allowCompilerTransform && isCompilerTransformModule(directModuleSpecifier, "default")) return true;
65985
- if (directModuleSpecifier.startsWith(".")) {
65986
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, directModuleSpecifier);
65987
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, "default", allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
65988
- }
66106
+ if (analyzeImportedConfig({
66107
+ analysis,
66108
+ moduleSpecifier: directModuleSpecifier,
66109
+ exportName: "default",
66110
+ allowCompilerTransform
66111
+ })) return true;
65989
66112
  }
65990
66113
  if (ts.isIdentifier(node.expression)) {
65991
- const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
65992
- if (importBinding?.moduleSpecifier.startsWith(".")) {
65993
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65994
- 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
+ }
65995
66127
  }
65996
66128
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, node.expression.text);
65997
66129
  if (topLevelBinding && ts.isFunctionLike(topLevelBinding) && analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, node.arguments)) return true;
@@ -66001,25 +66133,29 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66001
66133
  if (ts.isPropertyAccessExpression(node)) {
66002
66134
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(node.expression);
66003
66135
  if (requiredModuleSpecifier) {
66004
- if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66005
- if (requiredModuleSpecifier.startsWith(".")) {
66006
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
66007
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66008
- }
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;
66009
66143
  return allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, node.name.text);
66010
66144
  }
66011
66145
  if (ts.isIdentifier(node.expression)) {
66012
- if (analysis.localBindings.has(node.expression.text)) {
66013
- const localInitializer = analysis.localBindings.get(node.expression.text);
66014
- 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));
66015
66149
  }
66016
66150
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66017
66151
  if (importBinding?.isNamespace) {
66018
66152
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.name.text)) return true;
66019
- if (importBinding.moduleSpecifier.startsWith(".")) {
66020
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66021
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
66022
- }
66153
+ if (analyzeImportedConfig({
66154
+ analysis,
66155
+ moduleSpecifier: importBinding.moduleSpecifier,
66156
+ exportName: node.name.text,
66157
+ allowCompilerTransform
66158
+ })) return true;
66023
66159
  return false;
66024
66160
  }
66025
66161
  const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
@@ -66030,13 +66166,19 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66030
66166
  }
66031
66167
  if (ts.isElementAccessExpression(node) && node.argumentExpression && ts.isStringLiteralLike(node.argumentExpression)) {
66032
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
+ }
66033
66173
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66034
66174
  if (importBinding?.isNamespace) {
66035
66175
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.argumentExpression.text)) return true;
66036
- if (importBinding.moduleSpecifier.startsWith(".")) {
66037
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66038
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.argumentExpression.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66039
- }
66176
+ return Boolean(analyzeImportedConfig({
66177
+ analysis,
66178
+ moduleSpecifier: importBinding.moduleSpecifier,
66179
+ exportName: node.argumentExpression.text,
66180
+ allowCompilerTransform
66181
+ }));
66040
66182
  }
66041
66183
  const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
66042
66184
  if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
@@ -66074,14 +66216,19 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66074
66216
  };
66075
66217
  const hasCompilerInConfigFile = (filePath) => analyzeConfigModuleExport(filePath, "default", false, 0, /* @__PURE__ */ new Set());
66076
66218
  const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(Path.join(directory, filename)));
66077
- const hasCompilerInPackageJsonConfig = (packageJson) => isPlainObject(packageJson.babel) && analyzeConfigSourceFileExport(ts.parseJsonText("package.json", JSON.stringify(packageJson.babel)), "package.json#babel", "default", false, 0, /* @__PURE__ */ new Set());
66078
- 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);
66079
66225
  const hasCompilerConfigurationInAncestors = (directory) => {
66080
66226
  if (isProjectBoundary(directory)) return false;
66081
66227
  let ancestorDirectory = Path.dirname(directory);
66082
66228
  while (ancestorDirectory !== Path.dirname(ancestorDirectory)) {
66083
66229
  const ancestorPackagePath = Path.join(ancestorDirectory, "package.json");
66084
- 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;
66085
66232
  if (isProjectBoundary(ancestorDirectory)) return false;
66086
66233
  ancestorDirectory = Path.dirname(ancestorDirectory);
66087
66234
  }
@@ -70367,11 +70514,6 @@ const getTypescriptScriptKind = (fileName) => {
70367
70514
  if (fileName.endsWith(".ts")) return ts.ScriptKind.TS;
70368
70515
  return ts.ScriptKind.JS;
70369
70516
  };
70370
- const unwrapTypescriptExpression = (expression) => {
70371
- let currentExpression = expression;
70372
- while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
70373
- return currentExpression;
70374
- };
70375
70517
  const BABEL_CONFIG_FILE_NAMES$1 = [
70376
70518
  "babel.config.js",
70377
70519
  "babel.config.cjs",
@@ -78276,7 +78418,7 @@ const makeNoopConsole = () => ({
78276
78418
  });
78277
78419
  //#endregion
78278
78420
  //#region src/cli/utils/version.ts
78279
- const VERSION = "0.9.1-dev.b1b62db";
78421
+ const VERSION = "0.9.2-dev.201106e";
78280
78422
  //#endregion
78281
78423
  //#region src/cli/utils/json-mode.ts
78282
78424
  let context = null;
@@ -78634,13 +78776,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
78634
78776
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
78635
78777
  * standard `SENTRY_RELEASE` override.
78636
78778
  */
78637
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.1-dev.b1b62db`;
78779
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.2-dev.201106e`;
78638
78780
  /**
78639
78781
  * Deployment environment shown in Sentry's environment filter. Defaults to
78640
78782
  * `production` for tagged releases and `development` for dev/unbuilt versions,
78641
78783
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
78642
78784
  */
78643
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.1-dev.b1b62db") ? "development" : "production");
78785
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.2-dev.201106e") ? "development" : "production");
78644
78786
  /**
78645
78787
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
78646
78788
  * (set to `0` to disable tracing) and falls back to
@@ -97439,4 +97581,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
97439
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 };
97440
97582
 
97441
97583
  //# sourceMappingURL=cli.js.map
97442
- //# debugId=cf9aea89-a185-53f6-9e42-7af2cece64f2
97584
+ //# debugId=1d99d852-8548-5af9-a8d9-d49d41e704f6