code: def compile_with_vegafusion(vegalite_spec: dict) -> dict:
      """Compile a Vega-Lite spec to Vega and pre-transform with VegaFusion
  
      Note: This function should only be called on a Vega-Lite spec
      that was generated with the "vegafusion" data transformer enabled.
      In particular, this spec may contain references to extract datasets
      using table:// prefixed URLs.
  
      Parameters
      ----------
      vegalite_spec: dict
          A Vega-Lite spec that was generated from an Altair chart with
          the "vegafusion" data transformer enabled
  
      Returns
      -------
      dict
          A Vega spec that has been pre-transformed by VegaFusion
      """
      # Local import to avoid circular ImportError
      from altair import vegalite_compilers, data_transformers
  
      vf = import_vegafusion()
  
      # Compile Vega-Lite spec to Vega
      compiler = vegalite_compilers.get()
      if compiler is None:
          raise ValueError("No active vega-lite compiler plugin found")
  
      vega_spec = compiler(vegalite_spec)
  
      # Retrieve dict of inline tables referenced by the spec
      inline_tables = get_inline_tables(vega_spec)
  
      # Pre-evaluate transforms in vega spec with vegafusion
      row_limit = data_transformers.options.get("max_rows", None)
      transformed_vega_spec, warnings = vf.runtime.pre_transform_spec(
          vega_spec,
          vf.get_local_tz(),
          inline_datasets=inline_tables,
          row_limit=row_limit,
      )
  
      # Check from row limit warning and convert to MaxRowsError
      handle_row_limit_exceeded(row_limit, warnings)
  
      return transformed_vega_spec
  
file_path: altair/altair/utils/_vegafusion_data.py
imports: from toolz import curried
  import uuid
  from weakref import WeakValueDictionary
  from typing import Union, Dict, Set, MutableMapping, TypedDict, Final, TYPE_CHECKING
  from altair.utils._importers import import_vegafusion
  from altair.utils.core import DataFrameLike
  from altair.utils.data import DataType, ToValuesReturnType, MaxRowsError
  from altair.vegalite.data import default_data_transformer
label_desc: Use image node_id 5 for calling a global function with example usage: compile_with_vegafusion(vegalite_spec) and returns: transformed_vega_spec