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

@delightfuldocs/ia-tree

v0.3.0

Published

<!-- IDEA: Rename to @delightfuldocs/ia? -->

Readme

ia-tree

ia-tree is a specification for representing the information architecture of a website as an abstract syntax tree. It implements the unist spec.

Motivation

I've seen a lot of projects come up with data structures for representing the structure of websites and then creating components and utilities to work with those structures.

It's a lot of redundant work!

If a standard data structure can represent the structure of any website, a common set of components and utilities can be used to render and manipulate that structure.

For example, I should be able to pass the same data into different React components — say, a Sidebar component and a Breadcrumbs component — and have both render with sensible defaults.

Install

npm install @delightfuldocs/ia-tree
# yarn add @delightfuldocs/ia-tree

Usage

  1. Import the package:

    // ESM
    import { root, group, page } from "@delightfuldocs/ia-tree";
    
    // CJS
    const { root, group, page } = require("@delightfuldocs/ia-tree");
  2. Create a tree:

    const tree = root([
      group("Getting started", [
        page("overview", "Overview"),
        page("quick-start", "Quick start"),
        page("changelog", "Changelog"),
      ]),
    ]);
  3. Use unist utilities to interact with the tree:

    import { root, group, page } from "@delightfuldocs/ia-tree";
    import { visit } from "unist-util-visit";
    
    const tree = root([
      group("Getting started", [
        page("overview", "Overview"),
        page("quick-start", "Quick start"),
        page("changelog", "Changelog"),
      ]),
    ]);
    
    visit(tree, (node) => {
      console.log(node);
    });

API reference

Builders

Helper functions for creating a valid tree.

group(label: string, children: Child[]) => Group

Creates a Group node.

Parameters
  • label - A human readable label for the group.
  • children - The nodes that exist within the group.
Returns

Group

root(children: Child[]) => Root

Creates a Root node.

Type guards

Functions for checking if something is a node (or a certain type of node). These are particularly useful if you're using unist utilities, such as unist-util-visit to navigate a tree and only want to manipulate certain nodes.

isChild(data: any) => boolean

Returns true if data is a Child node.

isGroup(data: any) => boolean

Returns true if data is a Group node.

Types

The type definitions of the nodes that can exist within a tree.

Child

type Child = Group | Link | Page | Section;

Represents any node that can be a child of a Parent node. The only node that can't be a child is the Root node.

Group

type Group = {
  type: "group";
  label: string;
  children: Child[];
};

Represents a group of nodes. The Group node itself is not associated with a web page. It's simply a collection of nodes assigned a label.

For example, in the Stripe documentation, sidebar labels like Online payments, Invoicing, Get started, and Working with invoices are equivalent to groups:

Link

type Link = {
  type: "link";
  url: string;
  label: string;
};

Represents a link to an external web page.

Page

type Page = {
  type: "page";
  id: string;
  label: string;
  children?: Child[];
};

Represents a page of content that exists within the information architecture. The page can optionally have sub-pages via the children property.

Parent

type Parent = Group | Page | Root | Section;

Represents any node that can have children. The only nodes that can't have children are Link nodes. It's not required for Page nodes to have children.

Root

type Root = {
  type: "root";
  children: Child[];
};

Represents the root node of an information architecture. It can only be used at the root node of a tree. All other nodes can be a descendant of a Root node.

Section

type Section = {
  type: "section";
  id: string;
  label: string;
  children: Child[];
};

Represents a distinct section within an information architecture. The Section node itself is associated with a page in the information architecture.

When users view a section's page, or a page that exists within a section, the intent is for the primary navigation to only contain pages belonging to that section.

For example, in Stripe's documentation, the Payments or Business operations pages each have their own sidebars. These could be represented as sections.

Utilities

  • ia-tree-get-breadcrumbs
  • ia-tree-get-section