react-doctor 0.9.1-dev.8534d86 → 0.9.1-dev.b1b62db

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 +279 -19
  2. package/dist/index.js +275 -15
  3. package/dist/lsp.js +275 -15
  4. 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]="68199c0f-9834-55ef-9753-efce9ed982ad")}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]="cf9aea89-a185-53f6-9e42-7af2cece64f2")}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";
@@ -65486,7 +65486,7 @@ const parseConfigSourceFile = (filePath, content) => filePath.endsWith(".json")
65486
65486
  const getStaticPropertyName$2 = (propertyName) => ts.isIdentifier(propertyName) || ts.isStringLiteralLike(propertyName) ? propertyName.text : ts.isComputedPropertyName(propertyName) && ts.isStringLiteralLike(propertyName.expression) ? propertyName.expression.text : null;
65487
65487
  const isCommonJsConfigExportAssignment = (node, sourceFile) => ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken && (node.left.getText(sourceFile) === "module.exports" || node.left.getText(sourceFile) === "exports.default");
65488
65488
  const hasExportModifier = (node) => ts.canHaveModifiers(node) && Boolean(ts.getModifiers(node)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword));
65489
- const getRequireModuleSpecifier = (expression) => {
65489
+ const getRequireModuleSpecifier$1 = (expression) => {
65490
65490
  if (!ts.isCallExpression(expression) || !ts.isIdentifier(expression.expression) || expression.expression.text !== "require" || expression.arguments.length !== 1) return null;
65491
65491
  const moduleSpecifier = expression.arguments[0];
65492
65492
  return moduleSpecifier && ts.isStringLiteralLike(moduleSpecifier) ? moduleSpecifier.text : null;
@@ -65530,21 +65530,21 @@ const getImportBinding = (sourceFile, bindingName) => {
65530
65530
  for (const declaration of statement.declarationList.declarations) {
65531
65531
  if (!declaration.initializer) continue;
65532
65532
  if (ts.isIdentifier(declaration.name) && declaration.name.text === bindingName) {
65533
- const directModuleSpecifier = getRequireModuleSpecifier(declaration.initializer);
65533
+ const directModuleSpecifier = getRequireModuleSpecifier$1(declaration.initializer);
65534
65534
  if (directModuleSpecifier) return {
65535
65535
  moduleSpecifier: directModuleSpecifier,
65536
65536
  exportName: "default",
65537
65537
  isNamespace: true
65538
65538
  };
65539
- if (ts.isPropertyAccessExpression(declaration.initializer) && getRequireModuleSpecifier(declaration.initializer.expression) !== null) return {
65540
- moduleSpecifier: getRequireModuleSpecifier(declaration.initializer.expression) ?? "",
65539
+ if (ts.isPropertyAccessExpression(declaration.initializer) && getRequireModuleSpecifier$1(declaration.initializer.expression) !== null) return {
65540
+ moduleSpecifier: getRequireModuleSpecifier$1(declaration.initializer.expression) ?? "",
65541
65541
  exportName: declaration.initializer.name.text,
65542
65542
  isNamespace: false
65543
65543
  };
65544
65544
  }
65545
65545
  if (!ts.isObjectBindingPattern(declaration.name)) continue;
65546
65546
  const bindingElement = declaration.name.elements.find((element) => ts.isIdentifier(element.name) && element.name.text === bindingName);
65547
- const moduleSpecifier = getRequireModuleSpecifier(declaration.initializer);
65547
+ const moduleSpecifier = getRequireModuleSpecifier$1(declaration.initializer);
65548
65548
  if (bindingElement && moduleSpecifier) return {
65549
65549
  moduleSpecifier,
65550
65550
  exportName: bindingElement.propertyName ? getStaticPropertyName$2(bindingElement.propertyName) ?? bindingElement.propertyName.getText(sourceFile) : bindingElement.name.getText(sourceFile),
@@ -65915,7 +65915,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
65915
65915
  if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
65916
65916
  const propertyName = ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null;
65917
65917
  if (propertyName === null) return null;
65918
- const requiredModuleSpecifier = getRequireModuleSpecifier(target.expression);
65918
+ const requiredModuleSpecifier = getRequireModuleSpecifier$1(target.expression);
65919
65919
  if (requiredModuleSpecifier !== null) {
65920
65920
  if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
65921
65921
  if (!requiredModuleSpecifier.startsWith(".")) return null;
@@ -65977,7 +65977,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65977
65977
  if (ts.isCallExpression(node)) {
65978
65978
  const callTargetResult = analyzeConfigCallTarget(node, analysis, allowCompilerTransform);
65979
65979
  if (callTargetResult !== null) return callTargetResult;
65980
- const directModuleSpecifier = getRequireModuleSpecifier(node);
65980
+ const directModuleSpecifier = getRequireModuleSpecifier$1(node);
65981
65981
  const isRequireShadowed = analysis.localBindings.has("require") || ts.isIdentifier(node.expression) && getScopedConfigBinding(node.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require");
65982
65982
  if (directModuleSpecifier && isRequireShadowed) return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
65983
65983
  if (directModuleSpecifier && !isRequireShadowed) {
@@ -65999,7 +65999,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65999
65999
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform) || node.arguments.some((argument) => analyzeConfigNode(argument, analysis, false));
66000
66000
  }
66001
66001
  if (ts.isPropertyAccessExpression(node)) {
66002
- const requiredModuleSpecifier = getRequireModuleSpecifier(node.expression);
66002
+ const requiredModuleSpecifier = getRequireModuleSpecifier$1(node.expression);
66003
66003
  if (requiredModuleSpecifier) {
66004
66004
  if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66005
66005
  if (requiredModuleSpecifier.startsWith(".")) {
@@ -69336,7 +69336,7 @@ const warn = (message) => {
69336
69336
  runSync(warn$1(message));
69337
69337
  };
69338
69338
  const CONFIG_BASENAME = "doctor.config";
69339
- const CONFIG_EXTENSIONS = [
69339
+ const CONFIG_EXTENSIONS$1 = [
69340
69340
  "ts",
69341
69341
  "mts",
69342
69342
  "cts",
@@ -69440,7 +69440,7 @@ const loadLegacyConfig = (directory) => {
69440
69440
  };
69441
69441
  const loadConfigFromDirectory = async (directory) => {
69442
69442
  let sawBrokenConfigFile = false;
69443
- for (const extension of CONFIG_EXTENSIONS) {
69443
+ for (const extension of CONFIG_EXTENSIONS$1) {
69444
69444
  const filePath = Path.join(directory, `${CONFIG_BASENAME}.${extension}`);
69445
69445
  if (!isFile(filePath)) continue;
69446
69446
  const isDataFile = DATA_CONFIG_EXTENSIONS.has(extension);
@@ -69499,7 +69499,7 @@ const loadConfigWithSource = (rootDirectory) => {
69499
69499
  return loadPromise;
69500
69500
  };
69501
69501
  const directoryHasCurrentConfig = (directory) => {
69502
- for (const extension of CONFIG_EXTENSIONS) if (isFile(Path.join(directory, `${CONFIG_BASENAME}.${extension}`))) return true;
69502
+ for (const extension of CONFIG_EXTENSIONS$1) if (isFile(Path.join(directory, `${CONFIG_BASENAME}.${extension}`))) return true;
69503
69503
  return readEmbeddedPackageJsonConfig(directory) !== null;
69504
69504
  };
69505
69505
  /**
@@ -73291,7 +73291,11 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths) => {
73291
73291
  const ROOT_DIRECTORY_PLACEHOLDER = "<root>";
73292
73292
  const normalizeConfigForHash = (config) => {
73293
73293
  const clone = JSON.parse(JSON.stringify(config));
73294
- if (clone?.settings?.["react-doctor"]) clone.settings["react-doctor"].rootDirectory = ROOT_DIRECTORY_PLACEHOLDER;
73294
+ if (clone?.settings?.["react-doctor"]) {
73295
+ const reactDoctorSettings = clone.settings["react-doctor"];
73296
+ reactDoctorSettings.rootDirectory = ROOT_DIRECTORY_PLACEHOLDER;
73297
+ if (Array.isArray(reactDoctorSettings.unpluginAutoImportRootDirectories)) reactDoctorSettings.unpluginAutoImportRootDirectories = [ROOT_DIRECTORY_PLACEHOLDER];
73298
+ }
73295
73299
  if (Array.isArray(clone?.jsPlugins)) clone.jsPlugins = clone.jsPlugins.map((_, index) => `<plugin:${index}>`);
73296
73300
  return clone;
73297
73301
  };
@@ -73450,13 +73454,14 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
73450
73454
  }
73451
73455
  return enabled;
73452
73456
  };
73453
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
73457
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, runtimeGlobals, unpluginAutoImportGlobalScopes, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
73454
73458
  const hasIncludedTags = includedTags.size > 0;
73455
73459
  const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
73456
73460
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
73457
73461
  const jsPlugins = [];
73458
73462
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
73459
73463
  const capabilities = getCapabilities(project);
73464
+ const settingsRootDirectory = resolveSettingsRootDirectory(project.rootDirectory);
73460
73465
  const enabledReactDoctorRules = {};
73461
73466
  for (const registryEntry of REACT_DOCTOR_RULES) {
73462
73467
  const rule = reactDoctorPlugin.rules[registryEntry.id];
@@ -73502,8 +73507,16 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
73502
73507
  jsPlugins: [...jsPlugins, pluginPath],
73503
73508
  settings: { "react-doctor": {
73504
73509
  framework: project.framework,
73505
- rootDirectory: resolveSettingsRootDirectory(project.rootDirectory),
73510
+ rootDirectory: settingsRootDirectory,
73506
73511
  capabilities: [...capabilities].sort(),
73512
+ ...runtimeGlobals && runtimeGlobals.length > 0 ? { runtimeGlobals: [...runtimeGlobals] } : {},
73513
+ ...unpluginAutoImportGlobalScopes && unpluginAutoImportGlobalScopes.length > 0 ? {
73514
+ unpluginAutoImportRootDirectories: [...new Set([settingsRootDirectory, project.rootDirectory])],
73515
+ unpluginAutoImportGlobalScopes: unpluginAutoImportGlobalScopes.map((scope) => ({
73516
+ directory: scope.directory,
73517
+ names: [...scope.names]
73518
+ }))
73519
+ } : {},
73507
73520
  ...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
73508
73521
  ...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {}
73509
73522
  } },
@@ -73514,6 +73527,245 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
73514
73527
  }
73515
73528
  };
73516
73529
  };
73530
+ const AUTO_IMPORT_ADAPTER_PATTERN = /^unplugin-auto-import\/(?:astro|esbuild|rollup|rolldown|rspack|vite|webpack)$/;
73531
+ const CONFIG_BASENAMES = [
73532
+ "astro.config",
73533
+ "esbuild.config",
73534
+ "rollup.config",
73535
+ "rolldown.config",
73536
+ "rspack.config",
73537
+ "vite.config",
73538
+ "webpack.config"
73539
+ ];
73540
+ const CONFIG_EXTENSIONS = [
73541
+ ".cjs",
73542
+ ".cts",
73543
+ ".js",
73544
+ ".mjs",
73545
+ ".mts",
73546
+ ".ts"
73547
+ ];
73548
+ const CONFIG_FILENAMES = new Set(CONFIG_BASENAMES.flatMap((basename) => CONFIG_EXTENSIONS.map((extension) => `${basename}${extension}`)));
73549
+ const DEFAULT_ESLINT_GLOBALS_PATH = ".eslintrc-auto-import.json";
73550
+ const SUPPORTED_GLOBAL_VALUES = new Set([
73551
+ true,
73552
+ false,
73553
+ "readable",
73554
+ "readonly",
73555
+ "writable",
73556
+ "writeable"
73557
+ ]);
73558
+ const getStaticProperty = (objectExpression, propertyName) => objectExpression.properties.find((property) => {
73559
+ if (ts.isSpreadAssignment(property)) return false;
73560
+ const name = ts.isComputedPropertyName(property.name) ? unwrapTypescriptExpression(property.name.expression) : property.name;
73561
+ return (ts.isIdentifier(name) || ts.isStringLiteralLike(name)) && name.text === propertyName;
73562
+ }) ?? null;
73563
+ const hasNonLiteralComputedProperty = (objectExpression) => objectExpression.properties.some((property) => !ts.isSpreadAssignment(property) && ts.isComputedPropertyName(property.name) && !ts.isStringLiteralLike(unwrapTypescriptExpression(property.name.expression)));
73564
+ const getStaticPropertyAssignment = (objectExpression, propertyName) => {
73565
+ const property = getStaticProperty(objectExpression, propertyName);
73566
+ return property && ts.isPropertyAssignment(property) ? property : null;
73567
+ };
73568
+ const getRequireModuleSpecifier = (expression) => {
73569
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
73570
+ if (ts.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === "default") return getRequireModuleSpecifier(unwrappedExpression.expression);
73571
+ if (!ts.isCallExpression(unwrappedExpression) || !ts.isIdentifier(unwrappedExpression.expression) || unwrappedExpression.expression.text !== "require" || unwrappedExpression.arguments.length !== 1) return null;
73572
+ const moduleSpecifier = unwrappedExpression.arguments[0];
73573
+ return moduleSpecifier && ts.isStringLiteralLike(moduleSpecifier) ? moduleSpecifier.text : null;
73574
+ };
73575
+ const getRequiredPropertyModuleSpecifier = (expression, propertyName) => {
73576
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
73577
+ return ts.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === propertyName ? getRequireModuleSpecifier(unwrappedExpression.expression) : null;
73578
+ };
73579
+ const isCommonJsExportAssignment = (node, sourceFile) => ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken && (node.left.getText(sourceFile) === "module.exports" || node.left.getText(sourceFile) === "exports.default");
73580
+ const isTopLevelExpression = (node) => {
73581
+ let ancestor = node.parent;
73582
+ while (ancestor && !ts.isSourceFile(ancestor)) {
73583
+ if (ts.isExpressionStatement(ancestor)) return ts.isSourceFile(ancestor.parent);
73584
+ if (!ts.isParenthesizedExpression(ancestor) && !ts.isAsExpression(ancestor) && !ts.isSatisfiesExpression(ancestor) && !ts.isNonNullExpression(ancestor) && !ts.isTypeAssertionExpression(ancestor) && !ts.isAwaitExpression(ancestor)) return false;
73585
+ ancestor = ancestor.parent;
73586
+ }
73587
+ return false;
73588
+ };
73589
+ const isInsideActiveConfigProperty = (node, propertyName, sourceFile, esbuildBindings, esbuildNamespaceBindings) => {
73590
+ let ancestor = node.parent;
73591
+ let didFindConfigProperty = false;
73592
+ while (ancestor && !ts.isSourceFile(ancestor)) {
73593
+ if (!didFindConfigProperty && !ts.isArrayLiteralExpression(ancestor) && !ts.isParenthesizedExpression(ancestor) && !ts.isAsExpression(ancestor) && !ts.isSatisfiesExpression(ancestor) && !ts.isNonNullExpression(ancestor) && !ts.isTypeAssertionExpression(ancestor) && !ts.isPropertyAssignment(ancestor)) return false;
73594
+ if (ts.isPropertyAssignment(ancestor)) {
73595
+ const isConfigProperty = (ts.isIdentifier(ancestor.name) || ts.isStringLiteralLike(ancestor.name)) && ancestor.name.text === propertyName;
73596
+ if (didFindConfigProperty || !isConfigProperty) return false;
73597
+ if (!ts.isObjectLiteralExpression(ancestor.parent) || ancestor.parent.properties.some(ts.isSpreadAssignment)) return false;
73598
+ didFindConfigProperty = true;
73599
+ ancestor = ancestor.parent;
73600
+ continue;
73601
+ }
73602
+ if (didFindConfigProperty) {
73603
+ if (ts.isExportAssignment(ancestor)) return true;
73604
+ if (isCommonJsExportAssignment(ancestor, sourceFile)) return isTopLevelExpression(ancestor);
73605
+ if (propertyName === "plugins" && ts.isCallExpression(ancestor) && (ts.isIdentifier(ancestor.expression) ? esbuildBindings.has(ancestor.expression.text) : ts.isPropertyAccessExpression(ancestor.expression) && ancestor.expression.name.text === "build" && (ts.isIdentifier(ancestor.expression.expression) && esbuildNamespaceBindings.has(ancestor.expression.expression.text) || getRequireModuleSpecifier(ancestor.expression.expression) === "esbuild"))) return isTopLevelExpression(ancestor);
73606
+ if (!(ts.isObjectLiteralExpression(ancestor) || ts.isParenthesizedExpression(ancestor) || ts.isAsExpression(ancestor) || ts.isSatisfiesExpression(ancestor) || ts.isNonNullExpression(ancestor) || ts.isTypeAssertionExpression(ancestor) || ts.isCallExpression(ancestor) && ts.isIdentifier(ancestor.expression) && ancestor.expression.text === "defineConfig")) return false;
73607
+ }
73608
+ ancestor = ancestor.parent;
73609
+ }
73610
+ return false;
73611
+ };
73612
+ const getGlobalsPathFromActiveAutoImportCall = (callExpression, packageDirectory) => {
73613
+ const optionsExpression = callExpression.arguments[0];
73614
+ if (!optionsExpression) return null;
73615
+ const unwrappedOptions = unwrapTypescriptExpression(optionsExpression);
73616
+ if (!ts.isObjectLiteralExpression(unwrappedOptions)) return null;
73617
+ if (unwrappedOptions.properties.some(ts.isSpreadAssignment) || hasNonLiteralComputedProperty(unwrappedOptions)) return null;
73618
+ if (getStaticProperty(unwrappedOptions, "include") || getStaticProperty(unwrappedOptions, "exclude")) return null;
73619
+ const eslintrcProperty = getStaticPropertyAssignment(unwrappedOptions, "eslintrc");
73620
+ if (!eslintrcProperty) return null;
73621
+ const eslintrcExpression = unwrapTypescriptExpression(eslintrcProperty.initializer);
73622
+ if (!ts.isObjectLiteralExpression(eslintrcExpression)) return null;
73623
+ if (eslintrcExpression.properties.some(ts.isSpreadAssignment) || hasNonLiteralComputedProperty(eslintrcExpression)) return null;
73624
+ const enabledProperty = getStaticPropertyAssignment(eslintrcExpression, "enabled");
73625
+ if (!enabledProperty || unwrapTypescriptExpression(enabledProperty.initializer).kind !== ts.SyntaxKind.TrueKeyword) return null;
73626
+ const filepathProperty = getStaticProperty(eslintrcExpression, "filepath");
73627
+ if (!filepathProperty) return Path.join(packageDirectory, DEFAULT_ESLINT_GLOBALS_PATH);
73628
+ if (!ts.isPropertyAssignment(filepathProperty)) return null;
73629
+ const filepathExpression = unwrapTypescriptExpression(filepathProperty.initializer);
73630
+ return ts.isStringLiteralLike(filepathExpression) ? Path.resolve(packageDirectory, filepathExpression.text) : null;
73631
+ };
73632
+ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
73633
+ let sourceText;
73634
+ try {
73635
+ sourceText = NFS.readFileSync(configPath, "utf8");
73636
+ } catch {
73637
+ return {
73638
+ didFindActiveAutoImport: false,
73639
+ globalsPaths: []
73640
+ };
73641
+ }
73642
+ const sourceFile = ts.createSourceFile(configPath, sourceText, ts.ScriptTarget.Latest, true);
73643
+ const autoImportBindings = /* @__PURE__ */ new Map();
73644
+ const esbuildBindings = /* @__PURE__ */ new Set();
73645
+ const esbuildNamespaceBindings = /* @__PURE__ */ new Set();
73646
+ for (const statement of sourceFile.statements) {
73647
+ if (ts.isImportDeclaration(statement) && ts.isStringLiteralLike(statement.moduleSpecifier)) {
73648
+ const moduleSpecifier = statement.moduleSpecifier.text;
73649
+ if (AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) {
73650
+ const defaultBinding = statement.importClause?.name;
73651
+ if (defaultBinding) autoImportBindings.set(defaultBinding.text, moduleSpecifier);
73652
+ }
73653
+ if (moduleSpecifier === "esbuild") {
73654
+ const defaultBinding = statement.importClause?.name;
73655
+ if (defaultBinding) esbuildNamespaceBindings.add(defaultBinding.text);
73656
+ const namedBindings = statement.importClause?.namedBindings;
73657
+ if (namedBindings && ts.isNamedImports(namedBindings)) {
73658
+ for (const importSpecifier of namedBindings.elements) if ((importSpecifier.propertyName ?? importSpecifier.name).text === "build") esbuildBindings.add(importSpecifier.name.text);
73659
+ }
73660
+ if (namedBindings && ts.isNamespaceImport(namedBindings)) esbuildNamespaceBindings.add(namedBindings.name.text);
73661
+ }
73662
+ }
73663
+ if (!ts.isVariableStatement(statement)) continue;
73664
+ for (const declaration of statement.declarationList.declarations) {
73665
+ if (!declaration.initializer) continue;
73666
+ const declarationName = ts.isIdentifier(declaration.name) ? declaration.name.text : null;
73667
+ const moduleSpecifier = getRequireModuleSpecifier(declaration.initializer);
73668
+ if (declarationName && moduleSpecifier && AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) autoImportBindings.set(declarationName, moduleSpecifier);
73669
+ if (moduleSpecifier === "esbuild") {
73670
+ if (declarationName) esbuildNamespaceBindings.add(declarationName);
73671
+ if (ts.isObjectBindingPattern(declaration.name)) for (const bindingElement of declaration.name.elements) {
73672
+ const importedName = bindingElement.propertyName ?? bindingElement.name;
73673
+ if (ts.isIdentifier(importedName) && importedName.text === "build" && ts.isIdentifier(bindingElement.name)) esbuildBindings.add(bindingElement.name.text);
73674
+ }
73675
+ }
73676
+ if (declarationName && getRequiredPropertyModuleSpecifier(declaration.initializer, "build") === "esbuild") esbuildBindings.add(declarationName);
73677
+ }
73678
+ }
73679
+ const globalsPaths = /* @__PURE__ */ new Set();
73680
+ let didFindActiveAutoImport = false;
73681
+ let didFindUnsafeActiveAutoImport = false;
73682
+ const visit = (node) => {
73683
+ if (ts.isCallExpression(node)) {
73684
+ const moduleSpecifier = ts.isIdentifier(node.expression) ? autoImportBindings.get(node.expression.text) : getRequireModuleSpecifier(node.expression);
73685
+ if (moduleSpecifier && AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) {
73686
+ if (isInsideActiveConfigProperty(node, moduleSpecifier.endsWith("/astro") ? "integrations" : "plugins", sourceFile, esbuildBindings, esbuildNamespaceBindings)) {
73687
+ didFindActiveAutoImport = true;
73688
+ const globalsPath = getGlobalsPathFromActiveAutoImportCall(node, packageDirectory);
73689
+ if (globalsPath) globalsPaths.add(globalsPath);
73690
+ else didFindUnsafeActiveAutoImport = true;
73691
+ }
73692
+ }
73693
+ }
73694
+ ts.forEachChild(node, visit);
73695
+ };
73696
+ visit(sourceFile);
73697
+ return {
73698
+ didFindActiveAutoImport,
73699
+ globalsPaths: didFindUnsafeActiveAutoImport ? [] : [...globalsPaths]
73700
+ };
73701
+ };
73702
+ const collectGeneratedGlobalNames = (globalsPath, rootDirectory) => {
73703
+ const relativePath = Path.relative(rootDirectory, globalsPath);
73704
+ if (relativePath.startsWith("..") || Path.isAbsolute(relativePath)) return [];
73705
+ const parsed = failOpenReadJson(globalsPath, null);
73706
+ if (!isPlainObject(parsed) || !isPlainObject(parsed.globals)) return [];
73707
+ return Object.entries(parsed.globals).filter((entry) => entry[0].length > 0 && (typeof entry[1] === "boolean" || typeof entry[1] === "string") && SUPPORTED_GLOBAL_VALUES.has(entry[1])).map(([name]) => name).sort();
73708
+ };
73709
+ const findOwningPackageDirectory = (absoluteFilePath, rootDirectory, cache) => {
73710
+ let currentDirectory = Path.dirname(absoluteFilePath);
73711
+ const visitedDirectories = [];
73712
+ while (true) {
73713
+ const cachedDirectory = cache.get(currentDirectory);
73714
+ if (cachedDirectory !== void 0) {
73715
+ for (const visitedDirectory of visitedDirectories) cache.set(visitedDirectory, cachedDirectory);
73716
+ return cachedDirectory;
73717
+ }
73718
+ const relativeDirectory = Path.relative(rootDirectory, currentDirectory);
73719
+ if (relativeDirectory.startsWith("..") || Path.isAbsolute(relativeDirectory)) {
73720
+ for (const visitedDirectory of visitedDirectories) cache.set(visitedDirectory, null);
73721
+ return null;
73722
+ }
73723
+ visitedDirectories.push(currentDirectory);
73724
+ if (NFS.existsSync(Path.join(currentDirectory, "package.json"))) {
73725
+ for (const visitedDirectory of visitedDirectories) cache.set(visitedDirectory, currentDirectory);
73726
+ return currentDirectory;
73727
+ }
73728
+ if (currentDirectory === rootDirectory) {
73729
+ for (const visitedDirectory of visitedDirectories) cache.set(visitedDirectory, null);
73730
+ return null;
73731
+ }
73732
+ currentDirectory = Path.dirname(currentDirectory);
73733
+ }
73734
+ };
73735
+ const collectPackageGlobalNames = (packageDirectory, rootDirectory) => {
73736
+ let directoryEntries;
73737
+ try {
73738
+ directoryEntries = NFS.readdirSync(packageDirectory, { withFileTypes: true });
73739
+ } catch {
73740
+ return [];
73741
+ }
73742
+ const configuredGlobalsPaths = [];
73743
+ for (const entry of directoryEntries) {
73744
+ if (!entry.isFile() && !entry.isSymbolicLink() || !CONFIG_FILENAMES.has(entry.name)) continue;
73745
+ const configGlobalsPaths = collectGlobalsPathsFromConfig(Path.join(packageDirectory, entry.name), packageDirectory);
73746
+ if (configGlobalsPaths.didFindActiveAutoImport) configuredGlobalsPaths.push(configGlobalsPaths.globalsPaths.toSorted());
73747
+ }
73748
+ if (configuredGlobalsPaths.length === 0) return [];
73749
+ const globalsPaths = configuredGlobalsPaths[0];
73750
+ if (configuredGlobalsPaths.some((candidatePaths) => candidatePaths.length !== globalsPaths.length || candidatePaths.some((candidatePath, index) => candidatePath !== globalsPaths[index]))) return [];
73751
+ const names = /* @__PURE__ */ new Set();
73752
+ for (const globalsPath of globalsPaths) for (const name of collectGeneratedGlobalNames(globalsPath, rootDirectory)) names.add(name);
73753
+ return [...names].sort();
73754
+ };
73755
+ const collectUnpluginAutoImportGlobalScopes = ({ rootDirectory, candidateFiles }) => {
73756
+ const absoluteRootDirectory = Path.resolve(rootDirectory);
73757
+ const packageDirectoryCache = /* @__PURE__ */ new Map();
73758
+ const packageDirectories = /* @__PURE__ */ new Set();
73759
+ for (const candidateFile of candidateFiles) {
73760
+ const packageDirectory = findOwningPackageDirectory(Path.resolve(absoluteRootDirectory, candidateFile), absoluteRootDirectory, packageDirectoryCache);
73761
+ if (packageDirectory) packageDirectories.add(packageDirectory);
73762
+ }
73763
+ const scopes = [...packageDirectories].map((packageDirectory) => ({
73764
+ directory: Path.relative(absoluteRootDirectory, packageDirectory).replaceAll("\\", "/"),
73765
+ names: collectPackageGlobalNames(packageDirectory, absoluteRootDirectory)
73766
+ })).sort((firstScope, secondScope) => firstScope.directory.localeCompare(secondScope.directory));
73767
+ return scopes.some((scope) => scope.names.length > 0) ? scopes : [];
73768
+ };
73517
73769
  const validateDiagnostic$1 = decodeUnknownSync(Diagnostic);
73518
73770
  const decodeFileDiagnostics = (raw) => {
73519
73771
  if (!Array.isArray(raw)) return null;
@@ -75507,6 +75759,8 @@ const reactHooksJsPluginDropNote = (error) => {
75507
75759
  const runOxlint = async (options) => {
75508
75760
  const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
75509
75761
  const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
75762
+ const runtimeGlobals = Array.isArray(userConfig?.runtimeGlobals) ? userConfig.runtimeGlobals.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
75763
+ let unpluginAutoImportGlobalScopes = [];
75510
75764
  const severityControls = buildRuleSeverityControls(userConfig);
75511
75765
  validateRuleRegistration();
75512
75766
  resetManifestCaches();
@@ -75555,6 +75809,10 @@ const runOxlint = async (options) => {
75555
75809
  await yieldToEventLoop();
75556
75810
  const sizedScanFiles = includePaths === void 0 ? listSourceFilesWithSize(rootDirectory) : null;
75557
75811
  const candidateFiles = includePaths !== void 0 ? includePaths : (sizedScanFiles ?? []).map((entry) => entry.path);
75812
+ unpluginAutoImportGlobalScopes = collectUnpluginAutoImportGlobalScopes({
75813
+ rootDirectory,
75814
+ candidateFiles
75815
+ });
75558
75816
  const preparedHtmlSources = prepareHtmlLintSources(rootDirectory, configDirectory, candidateFiles);
75559
75817
  const lintFiles = preparedHtmlSources.lintFiles;
75560
75818
  const hasHtmlFiles = preparedHtmlSources.sourcePathByLintPath.size > 0;
@@ -75570,6 +75828,8 @@ const runOxlint = async (options) => {
75570
75828
  ignoredTags,
75571
75829
  includedTags,
75572
75830
  includeTagDefaults,
75831
+ runtimeGlobals,
75832
+ unpluginAutoImportGlobalScopes,
75573
75833
  serverAuthFunctionNames,
75574
75834
  severityControls,
75575
75835
  userPlugins,
@@ -78016,7 +78276,7 @@ const makeNoopConsole = () => ({
78016
78276
  });
78017
78277
  //#endregion
78018
78278
  //#region src/cli/utils/version.ts
78019
- const VERSION = "0.9.1-dev.8534d86";
78279
+ const VERSION = "0.9.1-dev.b1b62db";
78020
78280
  //#endregion
78021
78281
  //#region src/cli/utils/json-mode.ts
78022
78282
  let context = null;
@@ -78374,13 +78634,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
78374
78634
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
78375
78635
  * standard `SENTRY_RELEASE` override.
78376
78636
  */
78377
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.1-dev.8534d86`;
78637
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.1-dev.b1b62db`;
78378
78638
  /**
78379
78639
  * Deployment environment shown in Sentry's environment filter. Defaults to
78380
78640
  * `production` for tagged releases and `development` for dev/unbuilt versions,
78381
78641
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
78382
78642
  */
78383
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.1-dev.8534d86") ? "development" : "production");
78643
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.1-dev.b1b62db") ? "development" : "production");
78384
78644
  /**
78385
78645
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
78386
78646
  * (set to `0` to disable tracing) and falls back to
@@ -97179,4 +97439,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
97179
97439
  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 };
97180
97440
 
97181
97441
  //# sourceMappingURL=cli.js.map
97182
- //# debugId=68199c0f-9834-55ef-9753-efce9ed982ad
97442
+ //# debugId=cf9aea89-a185-53f6-9e42-7af2cece64f2