Home / File/ region.js — react Source File

region.js — react Source File

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

File javascript BabelCompiler Optimization 1 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  df4a6afe_3473_bd9e_5bea_d0af5290c8bd["region.js"]
  f7930dd6_d3df_0825_8ac7_db225bb0a0a2["node-loader"]
  df4a6afe_3473_bd9e_5bea_d0af5290c8bd --> f7930dd6_d3df_0825_8ac7_db225bb0a0a2
  style df4a6afe_3473_bd9e_5bea_d0af5290c8bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
  resolve,
  load as reactLoad,
  getSource as getSourceImpl,
  transformSource as reactTransformSource,
} from 'react-server-dom-esm/node-loader';

export {resolve};

async function textLoad(url, context, defaultLoad) {
  const {format} = context;
  const result = await defaultLoad(url, context, defaultLoad);
  if (result.format === 'module') {
    if (typeof result.source === 'string') {
      return result;
    }
    return {
      source: Buffer.from(result.source).toString('utf8'),
      format: 'module',
    };
  }
  return result;
}

export async function load(url, context, defaultLoad) {
  return await reactLoad(url, context, (u, c) => {
    return textLoad(u, c, defaultLoad);
  });
}

async function textTransformSource(source, context, defaultTransformSource) {
  const {format} = context;
  if (format === 'module') {
    if (typeof source === 'string') {
      return {source};
    }
    return {
      source: Buffer.from(source).toString('utf8'),
    };
  }
  return defaultTransformSource(source, context, defaultTransformSource);
}

async function transformSourceImpl(source, context, defaultTransformSource) {
  return await reactTransformSource(source, context, (s, c) => {
    return textTransformSource(s, c, defaultTransformSource);
  });
}

export const transformSource =
  process.version < 'v16' ? transformSourceImpl : undefined;
export const getSource = process.version < 'v16' ? getSourceImpl : undefined;

Domain

Subdomains

Dependencies

  • node-loader

Frequently Asked Questions

What does region.js do?
region.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in region.js?
region.js defines 4 function(s): load, textLoad, textTransformSource, transformSourceImpl.
What does region.js depend on?
region.js imports 1 module(s): node-loader.
Where is region.js in the architecture?
region.js is located at fixtures/flight-esm/loader/region.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/flight-esm/loader).

Analyze Your Own Codebase

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

Try Supermodel Free