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

@avesbox/canary

v0.1.0

Published

A vitepress transformer for rendering Dart code examples with advanced features like inline annotations, custom types, and enhanced syntax highlighting.

Readme

Canary

Lightweight Shiki transformer to add Dart code inspection hovers in VitePress.

What it does

  • Lexes Dart code blocks to identify declarations and expressions.
  • Builds a simple CST and scope tree to track variable and type information.
  • Adds hover popovers showing inferred types and documentation for variables, members, and expressions.

How to use

Go to .vitepress/config.mts and add the canaryTransformer to the list of code transformers:

// .vitepress/config.mts
import { canaryTransformer } from '@avesbox/canary'
export default defineConfig({
  markdown: {
    codeTransformers: [canaryTransformer()],
  },
})

The transformer will automatically apply to all Dart code blocks (```dart). If you wish for it to only apply to specific code blocks, you can use the canary directive and add the parameter explicitTrigger set to true:

// .vitepress/config.mts
import { canaryTransformer } from '@avesbox/canary'

export default defineConfig({
  markdown: {
    codeTransformers: [canaryTransformer({ explicitTrigger: true })],
  },
})

Then in your markdown files, use the canary directive in the code fence:

final message = "Hello, Canary!";
message.length;

Then in your theme file, initialize the Canary theme enhancements:

// .vitepress/theme/index.ts
import { setupCanaryTheme } from '@avesbox/canary'
import '@avesbox/canary/style.css'

export default {
  extends: DefaultTheme,
  Layout,
  enhanceApp(ctx) {
    DefaultTheme?.enhanceApp?.(ctx)
    setupCanaryTheme()
  },
}

Use regular ```dart fences; no custom fence syntax is needed.

Custom Types

You can define external types for the inspector to recognize. This is useful for documenting framework types that aren't defined in the code block itself.

Inline configuration

// .vitepress/config.mts
import { canaryTransformer, defineCustomTypes } from '@avesbox/canary'

const customTypes = defineCustomTypes({
  types: [
    {
      name: 'Provider',
      description: 'A dependency injection container.',
      members: {
        get: { type: 'T', description: 'Retrieves an instance of type T.' },
        has: 'bool',
      },
      staticMembers: {
        of: { type: 'Provider', description: 'Returns the nearest Provider.' },
      },
    },
    {
      name: 'Request',
      description: 'Represents an HTTP request.',
      members: {
        method: 'String',
        path: 'String',
        body: { type: 'dynamic', description: 'The parsed request body.' },
      },
    },
  ],
})

export default defineConfig({
  markdown: {
    codeTransformers: [canaryTransformer({ customTypes })],
  },
})

When a custom type is used in code, the inspector will:

  1. Recognize the type name and show its description on hover
  2. Resolve member access (e.g., request.body) with the correct type and description
  3. Include the type in variable inference (e.g., final req = Request()req: Request)