Home / File/ index.js — react Source File

index.js — react Source File

Architecture documentation for index.js, a javascript file in the react codebase.

Entity Profile

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.
 */
'use strict';

// Based on similar script in Jest
// https://github.com/facebook/jest/blob/a7acc5ae519613647ff2c253dd21933d6f94b47f/scripts/prettier.js

const chalk = require('chalk');
const glob = require('glob');
const prettier = require('prettier');
const fs = require('fs');
const path = require('path');
const listChangedFiles = require('../shared/listChangedFiles');
const prettierConfigPath = require.resolve('../../.prettierrc');

const mode = process.argv[2] || 'check';
const shouldWrite = mode === 'write' || mode === 'write-changed';
const onlyChanged = mode === 'check-changed' || mode === 'write-changed';

const changedFiles = onlyChanged ? listChangedFiles() : null;

const prettierIgnoreFilePath = path.join(
  __dirname,
  '..',
  '..',
  '.prettierignore'
);
const prettierIgnore = fs.readFileSync(prettierIgnoreFilePath, {
  encoding: 'utf8',
});
const ignoredPathsListedInPrettierIgnore = prettierIgnore
  .toString()
  .replace(/\r\n/g, '\n')
  .split('\n')
  .filter(line => !!line && !line.startsWith('#'));

const ignoredPathsListedInPrettierIgnoreInGlobFormat =
  ignoredPathsListedInPrettierIgnore.map(ignoredPath => {
    const existsAndDirectory =
      fs.existsSync(ignoredPath) && fs.lstatSync(ignoredPath).isDirectory();

    if (existsAndDirectory) {
      return path.join(ignoredPath, '/**');
    }

    return ignoredPath;
  });

const files = glob
  .sync('**/*.{js,jsx,ts,tsx}', {
    ignore: [
      '**/*.d.ts',
      '**/node_modules/**',
      '**/cjs/**',
      '**/dist/**',
      '**/__snapshots__/**',
// ... (64 more lines)

Domain

Subdomains

Frequently Asked Questions

What does index.js do?
index.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in index.js?
index.js defines 4 function(s): files, ignoredPathsListedInPrettierIgnore, ignoredPathsListedInPrettierIgnoreInGlobFormat, main.
Where is index.js in the architecture?
index.js is located at scripts/prettier/index.js (domain: BabelCompiler, subdomain: Entrypoint, directory: scripts/prettier).

Analyze Your Own Codebase

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

Try Supermodel Free