Home / File/ githubAPI.js — react Source File

githubAPI.js — react Source File

Architecture documentation for githubAPI.js, a javascript file in the react codebase. 0 imports, 3 dependents.

File javascript BabelCompiler Validation 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  d067b1e9_9f13_57c9_0078_2aca2499fb52["githubAPI.js"]
  6d9cc84b_c590_db27_2176_a1e548ac9492["ReportNewIssue.js"]
  6d9cc84b_c590_db27_2176_a1e548ac9492 --> d067b1e9_9f13_57c9_0078_2aca2499fb52
  b1d9750c_fd20_7898_0223_46fdfc9cdaf4["UpdateExistingIssue.js"]
  b1d9750c_fd20_7898_0223_46fdfc9cdaf4 --> d067b1e9_9f13_57c9_0078_2aca2499fb52
  99dfcde4_28a9_2198_26a1_c1058b545aea["cache.js"]
  99dfcde4_28a9_2198_26a1_c1058b545aea --> d067b1e9_9f13_57c9_0078_2aca2499fb52
  style d067b1e9_9f13_57c9_0078_2aca2499fb52 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

export type GitHubIssue = {
  title: string,
  url: string,
};

const GITHUB_ISSUES_API = 'https://api.github.com/search/issues';

export function searchGitHubIssuesURL(message: string): string {
  // Remove Fiber IDs from error message (as those will be unique).
  message = message.replace(/"[0-9]+"/g, '');

  const filters = [
    'in:title',
    'is:issue',
    'is:open',
    'is:public',
    'label:"Component: Developer Tools"',
    'repo:facebook/react',
  ];

  return (
    GITHUB_ISSUES_API +
    '?q=' +
    encodeURIComponent(message) +
    '%20' +
    filters.map(encodeURIComponent).join('%20')
  );
}

export async function searchGitHubIssues(
  message: string,
): Promise<GitHubIssue | null> {
  const response = await fetch(searchGitHubIssuesURL(message));
  const data = await response.json();
  if (data.items.length > 0) {
    const item = data.items[0];
    return {
      title: item.title,
      url: item.html_url,
    };
  } else {
    return null;
  }
}

Domain

Subdomains

Frequently Asked Questions

What does githubAPI.js do?
githubAPI.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in githubAPI.js?
githubAPI.js defines 1 function(s): searchGitHubIssuesURL.
What files import githubAPI.js?
githubAPI.js is imported by 3 file(s): ReportNewIssue.js, UpdateExistingIssue.js, cache.js.
Where is githubAPI.js in the architecture?
githubAPI.js is located at packages/react-devtools-shared/src/devtools/views/ErrorBoundary/githubAPI.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/ErrorBoundary).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free