Home / Function/ compareScopeDependency() — react Function Reference

compareScopeDependency() — react Function Reference

Architecture documentation for the compareScopeDependency() function in CodegenReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6a8ff3cc_0e37_88e5_c9ab_174737741902["compareScopeDependency()"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  6a8ff3cc_0e37_88e5_c9ab_174737741902 -->|defined in| dc7f10c2_c914_a162_d02b_a10a15c64a5f
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  6a8ff3cc_0e37_88e5_c9ab_174737741902 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  style 6a8ff3cc_0e37_88e5_c9ab_174737741902 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts lines 2658–2680

function compareScopeDependency(
  a: ReactiveScopeDependency,
  b: ReactiveScopeDependency,
): number {
  CompilerError.invariant(
    a.identifier.name?.kind === 'named' && b.identifier.name?.kind === 'named',
    {
      reason: '[Codegen] Expected named identifier for dependency',
      loc: a.identifier.loc,
    },
  );
  const aName = [
    a.identifier.name.value,
    ...a.path.map(entry => `${entry.optional ? '?' : ''}${entry.property}`),
  ].join('.');
  const bName = [
    b.identifier.name.value,
    ...b.path.map(entry => `${entry.optional ? '?' : ''}${entry.property}`),
  ].join('.');
  if (aName < bName) return -1;
  else if (aName > bName) return 1;
  else return 0;
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does compareScopeDependency() do?
compareScopeDependency() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts.
Where is compareScopeDependency() defined?
compareScopeDependency() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts at line 2658.
What does compareScopeDependency() call?
compareScopeDependency() calls 1 function(s): invariant.

Analyze Your Own Codebase

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

Try Supermodel Free