Home / Function/ babelTransformSource() — react Function Reference

babelTransformSource() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  34c26cb5_ba7c_ed3a_7b00_d99d6a970117["babelTransformSource()"]
  2147ecb6_7b0c_5060_7d10_643cc38d3dff["server.js"]
  34c26cb5_ba7c_ed3a_7b00_d99d6a970117 -->|defined in| 2147ecb6_7b0c_5060_7d10_643cc38d3dff
  style 34c26cb5_ba7c_ed3a_7b00_d99d6a970117 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/view-transition/loader/server.js lines 35–51

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/view-transition/loader/server.js.
Where is babelTransformSource() defined?
babelTransformSource() is defined in fixtures/view-transition/loader/server.js at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free