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

mere-lang

v1.0.0

Published

A minimal, explicit programming language with no syntax sugar and no implicit behavior.

Readme

Mere - A Minimal Explicit Language

Mere is a minimal, explicit programming language with both Node.js and browser runtimes. It embodies the following design principles:

Design Principles

  • Minimal: Minimal keywords, no syntax sugar, no implicit behavior
  • Explicit: No hidden behavior, no automatic cleanup, no default values
  • Concrete: No user-defined generics, all types are concrete
  • Deterministic: Each structure does one thing, each token has a clear role
  • Locally Checkable: Errors detected in local scope
  • Closure-free: Functions capture no scope; all dependencies are explicit parameters

Language Features

Keywords

fn let mut if elif else while return type import export from true false unit ok err and or not

Types

  • Built-in: Number, String, Boolean, Unit, List<T>, Result<T>, Map<K,V>, Task<T>, Fn<A,B,...,R>
  • User-defined: Records only (type Point = { x: Number, y: Number })

Variables

  • let x = expr — immutable binding
  • let mut x = expr — mutable binding
  • x = newExpr — reassignment (mutable only)

Control Flow

  • if / elif / else — both as statements and as expressions (returns a value)
  • while condition { body } — loops
  • No exceptions — use Result<T> for error handling

Functions

  • Last expression in function body is the return value
  • Explicit return for early returns
  • Parameters and return types are explicitly annotated
  • Named functions with fn, lambda expressions with fn(args) expr
  • Tail-call optimization (TCO) for recursive calls

Error Handling

  • All fallible operations return Result<T>
  • Explicit field access with r.isOk, r.value, r.errMessage
  • No try-catch, no ? operator

Concurrency

  • join waits for async task completion
  • Cooperative scheduling (synchronous appearance)

Browser / Canvas API

Mere supports browser-based 2D drawing via built-in canvas_* functions:

| Category | Function | Params | Description | |----------|----------|--------|-------------| | Clear | canvas_clear | — | Clear entire canvas | | Size | canvas_get_width | — | Canvas width in logical px | | | canvas_get_height | — | Canvas height in logical px | | Color | canvas_set_fill_color | String | Fill color (CSS string) | | | canvas_set_stroke_color | String | Stroke color | | Gradient | canvas_create_linear_gradient | Number x4 | Create linear gradient, returns id | | | canvas_create_radial_gradient | Number x6 | Create radial gradient, returns id | | | canvas_add_color_stop | Number, Number, String | Add color stop to gradient | | | canvas_set_fill_gradient | Number | Use gradient as fill | | | canvas_set_stroke_gradient | Number | Use gradient as stroke | | Font | canvas_set_font | String | Font spec (e.g. "bold 48px sans-serif") | | Text | canvas_fill_text | String, Number, Number | Filled text at (x, y) | | | canvas_stroke_text | String, Number, Number | Outlined text | | | canvas_measure_text | String | Text width in px | | | canvas_set_text_align | String | "left"/"center"/"right" | | | canvas_set_text_baseline | String | "top"/"middle"/"bottom" | | Rect | canvas_fill_rect | Number x4 | Filled rectangle (x, y, w, h) | | | canvas_stroke_rect | Number x4 | Outlined rectangle | | | canvas_clear_rect | Number x4 | Clear rectangle area | | Path | canvas_begin_path | — | Start path | | | canvas_close_path | — | Close path | | | canvas_move_to | Number, Number | Move pen to (x, y) | | | canvas_line_to | Number, Number | Line to (x, y) | | | canvas_arc | Number x5 | Arc (x, y, r, startAngle, endAngle) | | | canvas_arc_to | Number x5 | Arc with control points | | | canvas_stroke | — | Stroke current path | | | canvas_fill | — | Fill current path | | | canvas_set_line_width | Number | Line thickness | | | canvas_set_line_dash | List<Number> | Line dash pattern | | Shadow | canvas_set_shadow_color | String | Shadow color | | | canvas_set_shadow_blur | Number | Shadow blur radius | | | canvas_set_shadow_offset_x | Number | Shadow X offset | | | canvas_set_shadow_offset_y | Number | Shadow Y offset | | Transform | canvas_save | — | Save state stack | | | canvas_restore | — | Restore state | | | canvas_rotate | Number | Rotate (radians) | | | canvas_translate | Number, Number | Translate origin | | | canvas_scale | Number, Number | Scale transform | | Image | canvas_load_image | String | Load image from URL, returns id | | | canvas_draw_image | Number x5 | Draw image (id, x, y, w, h) | | | canvas_image_loaded | Number | Check if image is loaded | | Audio | audio_load | String | Load audio from URL, returns id | | | audio_play | Number | Play audio | | | audio_pause | Number | Pause audio | | | audio_resume | Number | Resume audio | | | audio_stop | Number | Stop and reset audio | | | audio_set_volume | Number, Number | Set volume (id, 0-1) | | | audio_set_loop | Number, Boolean | Set loop mode | | Events | canvas_on_click | Fn | Register click handler (x, y) | | | canvas_on_drag | Fn | Register hover/mousemove handler (x, y) | | | canvas_on_dblclick | Fn | Register double-click handler (x, y) | | | canvas_wait_click | — | Wait for click, returns Task<Map> | | | canvas_wait_drag | — | Wait for drag, returns Task<Map> | | Cursor | canvas_set_cursor | String | Set CSS cursor style | | Math | sin | Number | Sine | | | floor | Number | Floor | | | round | Number | Round | | | pi | — | Pi constant | | | now | — | Current timestamp (ms) | | | random | Number | Random int in [0, n) | | Await | await_font_loaded | — | Wait for font loading | | | next_frame | — | Wait until next animation frame |

Use mere build to produce a standalone HTML file that inlines the runtime and your .mere code.

Module System

  • Flat modules (no nesting)
  • Explicit export and import
  • File name = module name

Installation

cd mere
npm install
npm run build            # Compile TypeScript + build browser bundle

Usage

# Run a Mere program (Node.js)
mere examples/hello.mere

# Run tests
npm test

# Build for browser — produces standalone HTML
mere build examples/browser/rectangles.mere
open rectangles.html   # Works directly in browser

# Options
mere build input.mere -o output.html --width 1024 --height 768

Examples

| File | Description | |------|-------------| | examples/hello.mere | Hello World | | examples/factorial.mere | Recursive factorial | | examples/fibonacci.mere | Recursive Fibonacci | | examples/error_handling.mere | Result-based error handling | | examples/data_structures.mere | Lists and Maps | | examples/records.mere | Custom record types | | examples/browser/rectangles.mere | Canvas drawing (browser target) | | examples/browser/game.html | Browser game (Touhou-themed card game) | | examples/browser/events.mere | Click/drag event handling |

Language Specification

See docs/usage.md for the complete language reference.

Limitations (Intentional)

  • No user-defined generics
  • No pattern matching
  • No exceptions
  • No automatic resource management
  • No inheritance/interfaces/polymorphism
  • No operator overloading
  • No reflection/metaprogramming
  • No channels (use file I/O)

License

MIT