Home / Function/ exports() — react Function Reference

exports() — react Function Reference

Architecture documentation for the exports() function in TurbopackMock.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e5875f24_d621_7c8b_1f9d_847c971fd87a["exports()"]
  0125a513_b38f_0d90_692f_a7282612ad13["TurbopackMock.js"]
  e5875f24_d621_7c8b_1f9d_847c971fd87a -->|defined in| 0125a513_b38f_0d90_692f_a7282612ad13
  style e5875f24_d621_7c8b_1f9d_847c971fd87a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-server-dom-turbopack/src/__tests__/utils/TurbopackMock.js lines 37–85

exports.clientExports = function clientExports(moduleExports, chunkUrl) {
  const chunks = [];
  if (chunkUrl !== undefined) {
    chunks.push(chunkUrl);
  }
  const idx = '' + turbopackModuleIdx++;
  turbopackClientModules[idx] = moduleExports;
  const path = url.pathToFileURL(idx).href;
  turbopackClientMap[path] = {
    id: idx,
    chunks,
    name: '*',
  };
  // We only add this if this test is testing ESM compat.
  if ('__esModule' in moduleExports) {
    turbopackClientMap[path + '#'] = {
      id: idx,
      chunks,
      name: '',
    };
  }
  if (typeof moduleExports.then === 'function') {
    moduleExports.then(
      asyncModuleExports => {
        for (const name in asyncModuleExports) {
          turbopackClientMap[path + '#' + name] = {
            id: idx,
            chunks,
            name: name,
          };
        }
      },
      () => {},
    );
  }
  if ('split' in moduleExports) {
    // If we're testing module splitting, we encode this name in a separate module id.
    const splitIdx = '' + turbopackModuleIdx++;
    turbopackClientModules[splitIdx] = {
      s: moduleExports.split,
    };
    turbopackClientMap[path + '#split'] = {
      id: splitIdx,
      chunks,
      name: 's',
    };
  }
  return createClientModuleProxy(path);
};

Domain

Subdomains

Frequently Asked Questions

What does exports() do?
exports() is a function in the react codebase, defined in packages/react-server-dom-turbopack/src/__tests__/utils/TurbopackMock.js.
Where is exports() defined?
exports() is defined in packages/react-server-dom-turbopack/src/__tests__/utils/TurbopackMock.js at line 37.

Analyze Your Own Codebase

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

Try Supermodel Free