Skip to content
eliwarePublic

Repository files navigation

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 path as input.
  • Join, resolve, and relativize paths with Node.js rules.
  • Convert paths to file URLs and file URLs to paths.

Requirements

  • Use Node.js 26 or later.
  • Use native ESM.

Setup

Install @eliware/path:

npm install @eliware/path

Usage

Pass import.meta or a directory path to a helper:

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

const filePath = path(import.meta, "config", "app.json");
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 user guides. Read the example index for runnable examples. Read the specifications index for repository rules.

Testing

Run aggregate validation:

npm test
  • Run npm run lint for lint checks.
  • Run npm run audit for dependency checks.
  • Run npm run format to format files.
  • Run npm run format:check to check file format.
  • Run npm run typecheck to check declarations.
  • Run npm run pack to check package contents.

Troubleshooting

Read the troubleshooting guide for input and URL errors.

Security

The helpers do not read files or use the network. Absolute segments and .. can move outside the starting directory. Check paths from user input before file access.

API

Read the API reference for all exported functions and their behavior.

Packaging

The package uses native ESM and supports Node.js 26 or later. It includes TypeScript declarations and has no runtime dependencies. Use MAJOR.MINOR.PATCH for package versions. The npm workflow publishes a tag only when it matches package.json.version and validation passes. Follow Eliware Operations for release approval. Read the package guide for package files.

Examples

Run an example from the repository root:

node examples/example.mjs

Read the example index for all examples.

Support

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

Discordeliware.org

eliware.org on Discord

Links

License

MIT © Eliware

Releases

Contributors

Languages