npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spotterjs/base

v1.0.4

Published

Shared TypeScript types for spotterjs

Downloads

143

Readme

@spotterjs/base

Shared TypeScript types, error helpers, and small geometry utilities for the spotterjs packages.

Most users get this package through @spotterjs/core, but it can be installed directly when you need public types for integrations, plugins, or tests.

中文文档:本包的类型说明与坐标约定也适用于中文指南中的 @spotterjs/core、MCP 和 OCR 示例。

Install

npm install @spotterjs/base

Exports

| Symbol | Purpose | |--------|---------| | Region | Rectangle with left, top, width, and height in pixels | | Point | Two-dimensional pixel coordinate | | CaptureImage | Raw RGBA capture buffer with width and height | | TemplateImage | Template image input: image path or encoded PNG/JPEG/WebP Buffer | | MatchOptions | Template matching options such as confidence, region, and scale | | MatchWaitOptions | Wait options with timeoutMs and optional intervalMs | | MatchResult | Template match result with region, center, score, and matchScore | | MatchScore | Normalized matching score shared by visual and OCR text matching | | TextMatchEvaluation | OCR text-match diagnostics | | WindowInfo | Top-level desktop window metadata | | DesktopApp | Process-grouped desktop app and window metadata | | MatchProvider | find / findAll / waitFor provider interface | | SpotterError | Structured error with stable code, optional domain, and context | | isSpotterError(error) | Type guard for spotterjs structured errors | | toSpotterError(error) | Convert unknown errors into SpotterError | | centerOf(region) | Return the integer center point of a region |

Coordinate Conventions

Desktop Region and Point values use screen coordinates unless an API explicitly documents a local coordinate space. The screen origin is the desktop top-left corner.

Window-scoped APIs such as windows.findTemplate also return screen coordinates, so their centers can be passed directly to mouse.tap.

image.find returns coordinates relative to the provided capture. Android plugin APIs use Android device screenshot coordinates.

Error Conventions

spotterjs packages throw SpotterError for structured failures. Application code should branch on isSpotterError(error) and then use stable SPOTTER_<DOMAIN>_<REASON> codes.

import { isSpotterError } from "@spotterjs/base";

try {
  // call a spotterjs API
} catch (error) {
  if (isSpotterError(error)) {
    console.log(error.code, error.domain, error.context);
  }
}

Hover exported types in your IDE for detailed JSDoc on each field.

License

See LICENSE.