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

tolk-inspect

v0.1.3

Published

Read-only semantic inspection for in-memory Tolk projects

Readme

tolk-inspect

Read-only AST and semantic inspection for in-memory Tolk projects, backed by Rust and WebAssembly.

tolk-inspect is designed for audit tools, linters, code navigation, and visualizations. It resolves project-wide symbols and types, evaluates constants, exposes control-flow graphs, traces direct and indirect calls, and reports Acton linter diagnostics.

Install

npm install tolk-inspect

The package is ESM-only, runs on Node.js 22 or newer, and has no runtime dependencies. Browser bundling is not currently supported.

Quickstart

import { inspectProject } from "tolk-inspect";

const project = await inspectProject({
  root: "/project",
  files: {
    "/project/main.tolk": `
      import "math";
      fun main(): int { return answer(); }
    `,
    "/project/math.tolk": `
      const VALUE = 42;
      fun answer(): int { return VALUE; }
    `,
  },
  entrypoints: ["/project/main.tolk"],
});

const answer = project.symbols().find((symbol) => symbol.name === "answer");
if (answer) {
  console.log("references", project.references(answer));
  console.log("callers", project.callers(answer));
  console.log("CFG", project.controlFlow(answer));
}

console.log("diagnostics", project.diagnostics());
project.dispose();

All paths are logical, normalized project paths. The analyzer never reads the filesystem; the caller supplies every workspace, Tolk standard-library, and Acton-library source. For a complete project, pass those sources together with their roots:

const project = await inspectProject({
  root: "/project",
  files: {
    ...workspaceSources,
    ...tolkStandardLibrarySources,
    ...actonLibrarySources,
  },
  entrypoints: ["/project/contracts/main.tolk"],
  stdlibRoot: "/project/.acton/tolk-stdlib",
  actonStdlibRoot: "/project/.acton",
  importMappings: { "@acton": "/project/.acton" },
});

Main API

An InspectedProject provides:

  • files(), node(), and AST traversal through AstNode
  • symbols(), symbolFor(), symbolAt(), resolve(), and references()
  • typeOf() and exact constantValue() results
  • controlFlow(), including successors, predecessors, reachability, and dominance
  • callSites(), callGraph(), calls(), and callers()
  • diagnostics(), including structured Acton linter fixes

callSites() is the authoritative representation for indirect calls. A call may have several conservative targets; complete: false means an additional source-level target could not be identified.

Call dispose() when the snapshot is no longer needed. Access after disposal throws.

Analysis boundaries

  • Snapshots are immutable; analyze again after changing source text.
  • Official C++ compiler diagnostics are not part of the WASM package.
  • Callables originating in opaque FFI, runtime, or deserialized data may remain incomplete.
  • Callable analysis is intentionally whole-program and context-insensitive, so a helper called with different callbacks reports their conservative union.

Guides and compatibility

The analysis backend uses stable Acton v1.2.1, locked to commit 13594911b09b0a9bc68910111e0bb88a74161f5b. Use versionInfo() to inspect the package, Acton revision, and analyzer Tolk version at runtime.