Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright CheckDeps

From Leeroopedia

Template:Implementation Page

Overview

CheckDeps is a build utility that validates import dependencies across all Playwright packages, ensuring that each package only imports from allowed dependencies and that dependency versions are consistent.

Description

This script performs comprehensive dependency validation:

  • Parses TypeScript/JavaScript source files using the TypeScript compiler API to extract import statements
  • Validates that each import resolves to an allowed dependency based on the package's package.json
  • Checks for version mismatches between playwright-core and playwright package dependencies
  • Handles special import mappings for internal packages (web, injected, isomorphic, testIsomorphic)
  • Recognizes Node.js builtins and peer dependencies (electron, react, zod, etc.)
  • Supports path-mapped imports via TypeScript's tsconfig paths

The script iterates through all packages including html-reporter, playwright-ct-core, protocol, recorder, trace-viewer, web, injected, playwright-core, and playwright.

Usage

Run as a CI check to ensure dependency hygiene across the monorepo.

Code Reference

Source Location

utils/check_deps.js (274 lines)

Key Functions

async function checkDeps()
async function innerCheckDeps(root)
function listFiles(dir)

Execution

node utils/check_deps.js

I/O Contract

Inputs

  • Source files from all packages in the monorepo
  • package.json files for dependency declarations

Outputs

  • Console warnings for undeclared dependencies
  • Exit code 1 if version mismatches are found between packages

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment