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

@eliware/path

v12.0.0

Published

Import-meta-based path utilities for modern Node.js ESM applications.

Readme

eliware.org

@eliware/path npm License CI

Import-meta-based path utilities for modern Node.js ESM applications.

Table of Contents

Features

  • Accept import.meta or a directory string as the base path.
  • Join, resolve, and relativize paths with native Node.js behavior.
  • Convert paths to file URLs and file URLs to paths.
  • Include TypeScript declarations and have no runtime dependencies.

Requirements

  • Node.js 26 or later.
  • Native ESM support.

Setup

Install the package:

npm install @eliware/path

Usage

Pass import.meta from an ESM module, or pass a directory string:

import path, { pathUrl, resolvePath, relativePath } from "@eliware/path";

const filePath = path(import.meta, ".env");
const fileUrl = pathUrl(import.meta, "module.mjs");
const absolutePath = resolvePath(import.meta, "data", "input.json");
const relative = relativePath(import.meta, "data", "input.json");

Read release notes for package changes.

Development

Read the documentation index for the architecture and operations guides. Read the repository specifications for normative rules. See the example index for runnable examples.

Testing

Run aggregate validation:

npm test

Run npm run lint, npm run audit, npm run format:check, npm run typecheck, or npm run pack for one check.

Troubleshooting

Pass import.meta or a directory string to each path helper. Missing or invalid bases cause an error. String inputs always represent directories.

Security

These helpers do not access files or networks. Absolute segments and .. can escape the base path. Validate untrusted segments before file access.

API

  • getCurrentFilename(metaOrDir) returns a module file path or the input directory string.
  • getCurrentDirname(metaOrDir, dirnameFn?) returns the current directory path.
  • path(metaOrDir, ...segments) joins the base directory with path segments.
  • pathUrl(metaOrDir, ...segments) returns a file URL string.
  • resolvePath(metaOrDir, ...segments) returns an absolute path.
  • relativePath(metaOrDir, ...segments) returns a path relative to the base directory.
  • fileUrlToPath(fileUrl) converts a file URL to a path.

The default export is path. All helpers accept ImportMeta or a directory string. The optional dirnameFn applies only to ImportMeta inputs.

Packaging

The package uses native ESM and supports Node.js 26 or later. It includes TypeScript declarations under src/. It has no runtime dependencies and performs no initialization at import time.

Examples

Run the example from the repository root:

node examples/example.mjs

See examples/README.md for the full example index.

Support

For help, questions, or to chat with the author and community, visit:

Discordeliware.org

eliware.org on Discord

Links

License

MIT © Eliware