Mendly is a utility library for TypeScript and JavaScript that extends the standard library with reader, writer, URI, enumerator, error, and device utilities.
npm install mendlyUse the package root for the portable surface.
import { mendly } from "mendly"Use the Node entrypoint when you want filesystem-backed Reader.open(...) and Writer.open(...) registration.
import { mendly } from "mendly/node"The package exports two public entrypoints:
mendlyresolves to the portable root and does not import Node built-ins.mendly/noderesolves to the Node-specific entry and registers filesystem-backedReaderandWriteropeners.
The published package uses standard npm package metadata only:
exportsdefines the public ESM entrypoints for the portable root and the Node subpath.typespoints at the generated root declarations.filesrestricts the published tarball todist,LICENSE, andREADME.md.
That means consumers should import from the package entrypoints, not from source files or generated internal paths.
The portable mendly namespace is available in both environments and includes:
mendly.Readermendly.Writermendly.Urimendly.Errormendly.Enumeratormendly.Enumerablemendly.Device
Node consumers should use the Node entrypoint when they need filesystem-backed behavior. Reader.open(...) and Writer.open(...) can resolve file: resources through the registered filesystem-backed openers there.
import { mendly } from "mendly/node"
const input = mendly.Reader.open(mendly.Uri.parse("file:///tmp/input.txt")!)
const output = await mendly.Writer.open(
mendly.Uri.parse("file:///tmp/output.txt")!
)Browser consumers should use the portable root import:
import { mendly } from "mendly"
const reader = mendly.Reader.String.create("hello")
const writer = mendly.Writer.String.create()
await writer.writeLine("hello")
console.log(reader.read())
console.log(writer.result)From the portable root:
mendly.Readerandmendly.Writerkeep their in-memory functionality.Reader.open(...)andWriter.open(...)remain callable.- No filesystem-backed openers are registered.
- The root import does not pull
node:fs,node:path, ornode:utilinto the top-level graph.
That means file resources are not opened in browser builds:
import { mendly } from "mendly"
const resource = mendly.Uri.parse("file:///tmp/example.txt")!
console.log(mendly.Reader.open(resource))
console.log(await mendly.Writer.open(resource))- Import from
mendly, not from generateddistfiles. - Import from
mendly/nodeonly when the calling code explicitly needs filesystem access. - Use
Reader.StringandWriter.Stringfor browser-safe in-memory work. - Use
Reader.openandWriter.openfor file resources only frommendly/node. - Avoid deep-importing Node-only file-backed modules from browser-targeted applications.
Stable releases are triggered by commits to the branches listed in bump-minor.yml. The bump type is determined by the commit message prefix:
| Prefix | Bump |
|---|---|
breaking: |
major |
feature: |
minor |
fix: |
patch |
| (none) | minor |
Prerelease versions are bumped automatically on push to the branches listed in bump-beta.yml (beta) and bump-alpha.yml (alpha), and do not require a wording prefix.
Your runtime or bundler must respect package exports so mendly resolves to the portable root and mendly/node resolves to the Node-specific entry. Modern Node ESM, Vite, Rollup, webpack 5, and esbuild do this by default.
This package relies on the standard npm publishing flow. To inspect the exact published contents locally, run npm pack --dry-run.