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

@liendev/parser

v0.43.0

Published

AST parsing, complexity analysis, and semantic chunking for Lien

Readme

@liendev/parser

AST parsing, complexity analysis, and semantic chunking for Lien.

This package provides the core parsing and analysis capabilities used by Lien's semantic code search. It is extracted from @liendev/core to enable lightweight consumers (like @liendev/review) that need parsing without embeddings or vector DB dependencies.

Features

  • AST Parsing — Tree-sitter-based parsing for TypeScript, JavaScript, Python, PHP, Rust, and Go
  • Semantic Chunking — Split code into meaningful chunks respecting function/class boundaries
  • Complexity Analysis — Cyclomatic, cognitive, and Halstead complexity metrics
  • Dependency Analysis — Import/export tracking with transitive dependent resolution
  • Symbol Extraction — Extract functions, classes, interfaces, and call sites from AST
  • Test Association Detection — Convention-based and import-based test file detection
  • Codebase Scanning — File discovery with gitignore support and ecosystem presets

Supported Languages

| Language | AST Parsing | Complexity Metrics | Import/Export Tracking | |----------|:-----------:|:------------------:|:---------------------:| | TypeScript | Yes | Yes | Yes | | JavaScript | Yes | Yes | Yes | | Python | Yes | Yes | Yes | | PHP | Yes | Yes | Yes | | Rust | Yes | Yes | Yes | | Go | Yes | Yes | Yes |

Line-based chunking and symbol extraction are available for additional languages including Java, C#, Ruby, and Vue.

Usage

import {
  parseAST,
  chunkByAST,
  detectLanguage,
  analyzeComplexityFromChunks,
  scanCodebase,
  chunkFile,
} from '@liendev/parser';

// Parse a file into an AST
const language = detectLanguage('example.ts');
const result = parseAST(sourceCode, language);

// Chunk a file using AST-aware boundaries
const chunks = await chunkByAST('src/auth.ts', sourceCode, {
  chunkSize: 75,
  chunkOverlap: 10,
});

// Analyze complexity from chunks
const report = analyzeComplexityFromChunks(chunks, files, {
  cyclomatic: 15,
  cognitive: 15,
  halstead_effort: 60,
  halstead_bugs: 1.5,
});

Architecture

This package is part of the Lien monorepo:

@liendev/parser   ← AST, complexity, chunking, scanning (this package)
@liendev/core     ← embeddings, vector DB, search (depends on parser)
@liendev/lien     ← CLI and MCP server (depends on both)
@liendev/review   ← PR review (depends on parser only)

License

AGPL-3.0 — see LICENSE for details.