Home / Function/ evaluateFixtureExport() — react Function Reference

evaluateFixtureExport() — react Function Reference

Architecture documentation for the evaluateFixtureExport() function in evaluator.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  850ee738_6992_b2d7_3104_159fba313678["evaluateFixtureExport()"]
  e04df78a_8312_1a6c_3ce1_ea408e44a1d7["evaluator.ts"]
  850ee738_6992_b2d7_3104_159fba313678 -->|defined in| e04df78a_8312_1a6c_3ce1_ea408e44a1d7
  c8090524_9cfa_099d_cf1f_dcf1a93439f8["doEval()"]
  c8090524_9cfa_099d_cf1f_dcf1a93439f8 -->|calls| 850ee738_6992_b2d7_3104_159fba313678
  9698a34f_5e7c_5190_40e5_024dc7eb47ae["renderComponentSequentiallyForEachProps()"]
  850ee738_6992_b2d7_3104_159fba313678 -->|calls| 9698a34f_5e7c_5190_40e5_024dc7eb47ae
  d81e0572_43a5_0109_b0bc_3a853972f427["render()"]
  850ee738_6992_b2d7_3104_159fba313678 -->|calls| d81e0572_43a5_0109_b0bc_3a853972f427
  style 850ee738_6992_b2d7_3104_159fba313678 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/snap/src/sprout/evaluator.ts lines 158–203

(globalThis as any).evaluateFixtureExport = function (
  exports: unknown,
): FixtureEvaluatorResult {
  const parsedExportResult = ExportSchema.safeParse(exports);
  if (!parsedExportResult.success) {
    const exportDetail =
      typeof exports === 'object' && exports != null
        ? `object ${util.inspect(exports)}`
        : `${exports}`;
    return {
      kind: 'UnexpectedError',
      value: `${fromZodError(parsedExportResult.error)}\nFound ` + exportDetail,
    };
  }
  const entrypoint = parsedExportResult.data.FIXTURE_ENTRYPOINT;
  if (entrypoint.sequentialRenders !== null) {
    const result = renderComponentSequentiallyForEachProps(
      entrypoint.fn,
      entrypoint.sequentialRenders,
    );

    return {
      kind: 'ok',
      value: result ?? 'null',
    };
  } else if (typeof entrypoint.fn === 'object') {
    // Try to run fixture as a react component. This is necessary because not
    // all components are functions (some are ForwardRef or Memo objects).
    const result = render(
      React.createElement(entrypoint.fn as any, entrypoint.params[0]),
    ).container.innerHTML;

    return {
      kind: 'ok',
      value: result ?? 'null',
    };
  } else {
    const result = render(React.createElement(WrapperTestComponent, entrypoint))
      .container.innerHTML;

    return {
      kind: 'ok',
      value: result ?? 'null',
    };
  }
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does evaluateFixtureExport() do?
evaluateFixtureExport() is a function in the react codebase, defined in compiler/packages/snap/src/sprout/evaluator.ts.
Where is evaluateFixtureExport() defined?
evaluateFixtureExport() is defined in compiler/packages/snap/src/sprout/evaluator.ts at line 158.
What does evaluateFixtureExport() call?
evaluateFixtureExport() calls 2 function(s): render, renderComponentSequentiallyForEachProps.
What calls evaluateFixtureExport()?
evaluateFixtureExport() is called by 1 function(s): doEval.

Analyze Your Own Codebase

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

Try Supermodel Free