code: def _modify_js_deps(
      package_json: dict,
      key: Literal["dependencies", "devDependencies"],
      gradio_dir: Path,
  ):
      for dep in package_json.get(key, []):
          # if curent working directory is the gradio repo, use the local version of the dependency'
          if not _in_test_dir() and dep.startswith("@gradio/"):
              package_json[key][dep] = _get_js_dependency_version(
                  dep, gradio_dir / "_frontend_code"
              )
      return package_json
  
imports: from __future__ import annotations
  import dataclasses
  import inspect
  import json
  import re
  import shutil
  import textwrap
  from pathlib import Path
  from typing import Literal
  import gradio
label_desc: Use image node_id 4 for calling a global function with example usage: _modify_js_deps(package_json, key, gradio_dir) and returns: package_json