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

@adviser/cement

v0.5.6

Published

better try/catch/finally handling

Downloads

10,692

Readme

Cement

An agnostic platform abstraction layer for TypeScript/JavaScript and Go that provides consistent APIs across Node.js, Deno, Cloudflare Workers, and other runtimes.

Overview

Cement provides a unified interface for common system operations, logging, and utilities across different JavaScript/TypeScript runtimes and Go. Write your code once and run it anywhere - whether that's Node.js, Deno, browsers, or Cloudflare Workers.

Key Features

System Abstraction

Cross-platform system operations through a unified interface:

interface SysAbstraction {
  Time(): Time;
  Stdout(): WritableStream<Uint8Array>;
  Stderr(): WritableStream<Uint8Array>;
  NextId(): string;
  Random0ToValue(value: number): number;
  System(): SystemService;
  FileSystem(): FileService;
}

Structured Logging

Inspired by Go's zerolog, providing efficient structured logging:

logger
  .Str("user", "john")
  .Uint64("id", 123)
  .Info()
  .Log("User logged in");

Additional Utilities

  • Result & Option Types: Type-safe error handling inspired by Rust
  • Future: Promise-based async utilities
  • URI Handling: Mutable URL utilities for safe URL manipulation
  • Crypto: Platform-agnostic cryptographic operations
  • Tracer: Distributed tracing support
  • LRU Cache: Efficient least-recently-used cache implementation
  • Path Operations: Cross-platform path manipulation
  • HTTP Headers: Type-safe HTTP header utilities
  • Poller: Polling utilities with configurable intervals
  • Timeouted: Timeout wrapper for async operations

Installation

npm (Node.js)

npm install @adviser/cement

pnpm

pnpm add @adviser/cement

Deno

import { ... } from "jsr:@adviser/cement";

Go

go get github.com/mabels/cement

Usage

Basic Example

import { BuildBasicSystemService } from "@adviser/cement/node";

const sys = BuildBasicSystemService();
const logger = sys.Logger();

logger
  .Str("module", "app")
  .Info()
  .Log("Application started");

// Use file system operations
const fs = sys.FileSystem();
await fs.writeFile("output.txt", "Hello World");

Platform-Specific Imports

// Node.js
import { BuildBasicSystemService } from "@adviser/cement/node";

// Deno
import { BuildBasicSystemService } from "@adviser/cement/deno";

// Cloudflare Workers
import { BuildBasicSystemService } from "@adviser/cement/cf";

// Browser/Web
import { BuildBasicSystemService } from "@adviser/cement/web";

Result Type for Error Handling

import { Result } from "@adviser/cement";

function divide(a: number, b: number): Result<number> {
  if (b === 0) {
    return Result.Err(new Error("Division by zero"));
  }
  return Result.Ok(a / b);
}

const result = divide(10, 2);
if (result.isOk()) {
  console.log("Result:", result.unwrap());
} else {
  console.error("Error:", result.unwrapErr());
}

Documentation

For comprehensive documentation, API references, and advanced usage examples, visit:

https://mabels.github.io/cement

Supported Platforms

  • Node.js (>= 20.19.0)
  • Deno
  • Cloudflare Workers
  • Web Browsers
  • Go (>= 1.22.0)

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Run tests for specific platform
pnpm test:js     # Node.js/JavaScript tests
pnpm test:deno   # Deno tests

# Build
pnpm build

# Lint
pnpm lint

# Format code
pnpm format

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Apache License 2.0 - See LICENSE for details.

Repository