Home / Function/ babelTransformSource() — react Function Reference

babelTransformSource() — react Function Reference

Architecture documentation for the babelTransformSource() function in region.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5f56a222_da44_6eef_6a79_2af79c6f0276["babelTransformSource()"]
  9880abca_4eaa_66fe_8026_b2b3f05215a1["region.js"]
  5f56a222_da44_6eef_6a79_2af79c6f0276 -->|defined in| 9880abca_4eaa_66fe_8026_b2b3f05215a1
  4de3a03b_563e_1bde_1161_9d24390b2848["transformSourceImpl()"]
  4de3a03b_563e_1bde_1161_9d24390b2848 -->|calls| 5f56a222_da44_6eef_6a79_2af79c6f0276
  style 5f56a222_da44_6eef_6a79_2af79c6f0276 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/flight/loader/region.js lines 48–64

async function babelTransformSource(source, context, defaultTransformSource) {
  const {format} = context;
  if (format === 'module') {
    const opt = Object.assign({filename: context.url}, babelOptions);
    const newResult = await babel.transformAsync(source, opt);
    if (!newResult) {
      if (typeof source === 'string') {
        return {source};
      }
      return {
        source: Buffer.from(source).toString('utf8'),
      };
    }
    return {source: newResult.code};
  }
  return defaultTransformSource(source, context, defaultTransformSource);
}

Domain

Subdomains

Frequently Asked Questions

What does babelTransformSource() do?
babelTransformSource() is a function in the react codebase, defined in fixtures/flight/loader/region.js.
Where is babelTransformSource() defined?
babelTransformSource() is defined in fixtures/flight/loader/region.js at line 48.
What calls babelTransformSource()?
babelTransformSource() is called by 1 function(s): transformSourceImpl.

Analyze Your Own Codebase

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

Try Supermodel Free