Home / Function/ processExperimental() — react Function Reference

processExperimental() — react Function Reference

Architecture documentation for the processExperimental() function in build-all-release-channels.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  07ae733a_8302_4852_ff9b_8b779bea6dc2["processExperimental()"]
  39121ebe_f6d4_878e_0797_7a6b417f5f9a["build-all-release-channels.js"]
  07ae733a_8302_4852_ff9b_8b779bea6dc2 -->|defined in| 39121ebe_f6d4_878e_0797_7a6b417f5f9a
  c4f900f2_b639_f662_05d1_7ae05c59be96["main()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 07ae733a_8302_4852_ff9b_8b779bea6dc2
  8939a711_3ab0_2de0_0d1c_f6d01f0ba44d["updatePackageVersions()"]
  07ae733a_8302_4852_ff9b_8b779bea6dc2 -->|calls| 8939a711_3ab0_2de0_0d1c_f6d01f0ba44d
  96e8a694_22e2_8063_6b09_c6e72c4e5009["updatePlaceholderReactVersionInCompiledArtifacts()"]
  07ae733a_8302_4852_ff9b_8b779bea6dc2 -->|calls| 96e8a694_22e2_8063_6b09_c6e72c4e5009
  style 07ae733a_8302_4852_ff9b_8b779bea6dc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/rollup/build-all-release-channels.js lines 298–389

function processExperimental(buildDir, version) {
  if (fs.existsSync(buildDir + '/node_modules')) {
    const defaultVersionIfNotFound =
      '0.0.0' + '-experimental-' + sha + '-' + dateString;
    const versionsMap = new Map();
    for (const moduleName in stablePackages) {
      versionsMap.set(moduleName, defaultVersionIfNotFound);
    }
    for (const moduleName of experimentalPackages) {
      versionsMap.set(moduleName, defaultVersionIfNotFound);
    }
    updatePackageVersions(
      buildDir + '/node_modules',
      versionsMap,
      defaultVersionIfNotFound,
      true
    );
    fs.renameSync(buildDir + '/node_modules', buildDir + '/oss-experimental');
    updatePlaceholderReactVersionInCompiledArtifacts(
      buildDir + '/oss-experimental',
      // TODO: The npm version for experimental releases does not include the
      // React version, but the runtime version does so that DevTools can do
      // feature detection. Decide what to do about this later.
      ReactVersion + '-experimental-' + sha + '-' + dateString
    );
  }

  if (fs.existsSync(buildDir + '/facebook-www')) {
    for (const fileName of fs.readdirSync(buildDir + '/facebook-www')) {
      const filePath = buildDir + '/facebook-www/' + fileName;
      const stats = fs.statSync(filePath);
      if (!stats.isDirectory()) {
        fs.renameSync(filePath, filePath.replace('.js', '.modern.js'));
      }
    }
    const versionString =
      ReactVersion + '-www-modern-' + sha + '-' + dateString;
    updatePlaceholderReactVersionInCompiledArtifacts(
      buildDir + '/facebook-www',
      versionString
    );

    // Also save a file with the version number
    fs.writeFileSync(buildDir + '/facebook-www/VERSION_MODERN', versionString);
  }

  const rnVersionString = ReactVersion + '-native-fb-' + sha + '-' + dateString;
  if (fs.existsSync(buildDir + '/facebook-react-native')) {
    updatePlaceholderReactVersionInCompiledArtifacts(
      buildDir + '/facebook-react-native',
      rnVersionString
    );

    // Also save a file with the version number
    fs.writeFileSync(
      buildDir + '/facebook-react-native/VERSION_NATIVE_FB',
      rnVersionString
    );
  }

  if (fs.existsSync(buildDir + '/react-native')) {
    updatePlaceholderReactVersionInCompiledArtifacts(
      buildDir + '/react-native',
      rnVersionString,
      filename => filename.endsWith('.fb.js')
    );

    updatePlaceholderReactVersionInCompiledArtifacts(
      buildDir + '/react-native',
      ReactVersion,
      filename => !filename.endsWith('.fb.js') && filename.endsWith('.js')
    );
  }

  if (fs.existsSync(buildDir + '/sizes')) {
    fs.renameSync(buildDir + '/sizes', buildDir + '/sizes-experimental');
  }

  // Delete all other artifacts that weren't handled above. We assume they are
  // duplicates of the corresponding artifacts in the stable channel. Ideally,
  // the underlying build script should not have produced these files in the

Domain

Subdomains

Called By

Frequently Asked Questions

What does processExperimental() do?
processExperimental() is a function in the react codebase, defined in scripts/rollup/build-all-release-channels.js.
Where is processExperimental() defined?
processExperimental() is defined in scripts/rollup/build-all-release-channels.js at line 298.
What does processExperimental() call?
processExperimental() calls 2 function(s): updatePackageVersions, updatePlaceholderReactVersionInCompiledArtifacts.
What calls processExperimental()?
processExperimental() is called by 1 function(s): main.

Analyze Your Own Codebase

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

Try Supermodel Free