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

@unipty/powershell-parser

v0.2.0

Published

Official PowerShell parser adapter for UniPty: classifies command text through the official Parser.ParseInput API over an explicit pwsh host, without executing anything.

Readme

@unipty/powershell-parser

English | 简体中文 · GitHub · Docs

Official PowerShell parser adapter for UniPty: it classifies PowerShell command text toward UniPty's structured launch, with the official PowerShell Parser.ParseInput API as its only semantic authority. It never executes the input and never falls back to Bash-like parsing.

The adapter runs inside an explicitly selected PowerShell host (pwsh by default). The static adapter script travels as an -EncodedCommand; your text travels separately as base64-encoded UTF-8 on stdin, so no caller text is ever interpolated into a command line and no Windows console code-page ambiguity applies.

Usage

import { parsePowershell } from "@unipty/powershell-parser";

await parsePowershell('dotnet build -c "My Config"');
// → { kind: "argv", argv: ["dotnet", "build", "-c", "My Config"] }

await parsePowershell("a | b");
// → { kind: "script", language: "powershell", source: "a | b" }

await parsePowershell("echo 'unterminated");
// → { kind: "incomplete", diagnostics: [...] }

When the result is argv, the official parser proved exactly one command with literal elements (literal strings, parameters like -c, and numeric constants). When it is script, the text carries PowerShell semantics (pipelines, redirection, $variables, subexpressions, multiple statements, …) and you must explicitly accept that policy before launching anything.

Host handling

import { isPowershellHostAvailable, PowershellParseError } from "@unipty/powershell-parser";

await isPowershellHostAvailable(); // → false when no pwsh exists

await parsePowershell("x", { host: "pwsh-preview" }); // explicit host choice
  • Missing host → rejects with PowershellParseError code capability-unavailable (never a Bash-interpreted result).
  • Host starts but exits non-zero, returns an unknown result kind, or emits malformed output → host-failure (never a silent script downgrade); exceeded budget (default 15 s, configurable via timeoutMs) → host-timeout.
  • Powershell 7+ (pwsh) is the default target; pass options.host for another executable (e.g. powershell for Windows PowerShell 5.1, which also has Parser.ParseInput).

Diagnostics

Official ParseError records serialize as { message, errorId, incomplete, range } with UTF-16 extent offsets; errors flagged IncompleteInput map to incomplete, all others to invalid.