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

@technical-1/extract

v1.1.0

Published

List, table, and schema-driven DOM extraction helpers

Readme

@technical-1/extract

Structured DOM extraction. Tolerant by design: list/table helpers return empty collections (not throws) when nothing matches; schema extraction yields "" for absent fields. Uses page.evaluate under the hood. You inject the Page. Infrastructure errors (a page.evaluate rejection from frame detachment, navigation, or a target crash) propagate as exceptions — the tolerant contract covers missing DOM nodes only, not page failures.

Convenience wrapper. This package wraps puppeteer-core's page.evaluate() with small helpers for common text, table, and schema extraction patterns. It doesn't add new capability beyond page.evaluate() — it exists so the rest of @technical-1/* composes through one consistent, typed surface with predictable empty-collection semantics. If you only need DOM extraction, you can call page.evaluate() directly.

ESM only. This package ships ESM ("type": "module"). If you're in a fresh npm init -y project (CommonJS by default), add "type": "module" to your package.json — or use a .mjs file — before running the examples below, or Node throws SyntaxError: Cannot use import statement outside a module.

import { extractAll, extractTable, extractSchema } from "@technical-1/extract";

const titles = await extractAll(page, "h2.title");
const rows = await extractTable(page, "table#data");
const row = await extractSchema(page, { name: ".name", price: ".price" });

Shadow-DOM piercing

Every extractor takes an optional { pierceShadow?: boolean }. Default false = today's document.querySelector(All) (fast, no shadow traversal). true recurses through open shadow roots. Note: closed shadow roots are invisible to any script and cannot be pierced; extractTable piercing locates the table root only (cells within a nested-shadow table are out of scope). Example:

const label = await extractText(page, "span.price", { pierceShadow: true });
const items = await extractAll(page, "product-card .title", { pierceShadow: true });

Pagination

extractPaginated(page, { nextSelector, extractFn, maxPages, settleMs }) runs extractFn per page, clicks nextSelector, waits settleMs, and stops when the next control is gone or maxPages is hit. Document: a missing next control ends the loop (not an error — consistent with the tolerant contract); the nextSelector should match only an active next control (sites typically remove/hide it on the last page); maxPages defaults to 50 and is a safety bound; a click failure surfaces as a retryable PptrKitError. Example:

const all = await extractPaginated(page, {
  nextSelector: "a.pagination-next",
  extractFn: (p) => extractAll(p, "li.result .title"),
  maxPages: 20,
});

Note the DI logger is accepted here (logger) — the tolerant extractors do not log; only this orchestrator does.