Home / File/ packaging.js — react Source File

packaging.js — react Source File

Architecture documentation for packaging.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

'use strict';

const {
  existsSync,
  readdirSync,
  unlinkSync,
  readFileSync,
  writeFileSync,
} = require('fs');
const Bundles = require('./bundles');
const {
  asyncCopyTo,
  asyncExecuteCommand,
  asyncExtractTar,
  asyncRimRaf,
} = require('./utils');

const {
  NODE_ES2015,
  ESM_DEV,
  ESM_PROD,
  NODE_DEV,
  NODE_PROD,
  NODE_PROFILING,
  BUN_DEV,
  BUN_PROD,
  FB_WWW_DEV,
  FB_WWW_PROD,
  FB_WWW_PROFILING,
  RN_OSS_DEV,
  RN_OSS_PROD,
  RN_OSS_PROFILING,
  RN_FB_DEV,
  RN_FB_PROD,
  RN_FB_PROFILING,
  BROWSER_SCRIPT,
  CJS_DTS,
  ESM_DTS,
} = Bundles.bundleTypes;

function getPackageName(name) {
  if (name.indexOf('/') !== -1) {
    return name.split('/')[0];
  }
  return name;
}

function getBundleOutputPath(bundle, bundleType, filename, packageName) {
  switch (bundleType) {
    case NODE_ES2015:
      return `build/node_modules/${packageName}/cjs/${filename}`;
    case ESM_DEV:
    case ESM_PROD:
    case ESM_DTS:
      return `build/node_modules/${packageName}/esm/${filename}`;
    case BUN_DEV:
    case BUN_PROD:
      return `build/node_modules/${packageName}/cjs/${filename}`;
    case NODE_DEV:
    case NODE_PROD:
// ... (232 more lines)

Domain

Subdomains

Frequently Asked Questions

What does packaging.js do?
packaging.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 packaging.js?
packaging.js defines 10 function(s): copyAllShims, copyRNShims, copyWWWShims, filterOutEntrypoints, getBundleOutputPath, getPackageName, getTarOptions, hasNonFBBundleTypes, prepareNpmPackage, prepareNpmPackages.
Where is packaging.js in the architecture?
packaging.js is located at scripts/rollup/packaging.js (domain: BabelCompiler, subdomain: Optimization, directory: scripts/rollup).

Analyze Your Own Codebase

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

Try Supermodel Free