Home / Function/ babelTransformSource() — react Function Reference

babelTransformSource() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6e1804d7_d9d5_8088_dcd9_79f77f412046["babelTransformSource()"]
  50aebae3_345d_ebc8_a535_43013692ac0d["global.js"]
  6e1804d7_d9d5_8088_dcd9_79f77f412046 -->|defined in| 50aebae3_345d_ebc8_a535_43013692ac0d
  style 6e1804d7_d9d5_8088_dcd9_79f77f412046 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/flight/loader/global.js lines 32–48

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/global.js.
Where is babelTransformSource() defined?
babelTransformSource() is defined in fixtures/flight/loader/global.js at line 32.

Analyze Your Own Codebase

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

Try Supermodel Free