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 NodePlatform

From Leeroopedia
Revision as of 11:37, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Microsoft_Playwright_NodePlatform.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Implementation Page

Overview

NodePlatform implements the Platform interface for Node.js environments, providing platform-specific implementations of crypto, filesystem, zone management, and other runtime services.

Description

This module provides the Node.js-specific implementation of Playwright's platform abstraction layer. Key implementations:

  • NodeZone -- wraps the zone-based async context tracking system
  • Platform methods for crypto operations (SHA1, GUID), filesystem access, color output, environment variables
  • Zod schema conversion utilities for MCP (Model Context Protocol) tool definitions
  • Stream pipeline utilities for data transfer
  • Debug mode and test detection helpers

This abstraction allows Playwright's client code to work across different JavaScript runtimes by delegating platform-specific operations.

Usage

Instantiated once and provided to the Playwright client as the platform implementation for Node.js environments.

Code Reference

Source Location

packages/playwright-core/src/server/utils/nodePlatform.ts (183 lines)

Key Signatures

class NodeZone implements Zone {
  push<T>(data: T): NodeZone
  pop(): NodeZone
  run<R>(func: () => R): R
  data<T>(): T | undefined
}

// Platform implementation provides:
// - calculateSha1(), createGuid()
// - fs operations
// - environment access
// - color support detection
// - Zod schema conversion

Import

import { nodePlatform } from './server/utils/nodePlatform';

I/O Contract

Inputs

  • Platform-specific environment (Node.js process, filesystem, crypto)

Outputs

  • Uniform Platform interface for cross-runtime compatibility
  • Zone-based async context management

Related Pages

Page Connections

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