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

zyra-ts

v0.1.0

Published

Zyra language compiler (source .zy → ESM .js)

Downloads

7

Readme

Zyra Language Specification (v0)

Zyra is a strict, expression-oriented programming language that compiles to modern browser-native JavaScript (ESM) with zero runtime library.

It prioritizes:

  • Explicitness over magic
  • Immutable data structures (structs)
  • Strict typing without type-level complexity
  • Predictable async behavior
  • Canonical formatting (no style configuration)
  • Clean interop with the web platform

Philosophy

Zyra is:

  • Strict but not academic
  • Functional but not dogmatic
  • Async-safe
  • Struct-first
  • Expression-oriented
  • Browser-native
  • Zero-runtime
  • Opinionated
  • Zyra removes JavaScript’s footguns without fighting the web platform.

1. File Structure

  • Source extension: .zy
  • Compiles to: .js (ESM)
  • Project root is defined by the Zyra config file.
  • All imports use absolute root syntax: @/

Example:

from @/utils/math import add

2. Formatting (zyra fmt)

  • Zyra enforces a single canonical format:
  • 2 spaces indentation
  • No tabs
  • No semicolons in source
  • Braces on same line
  • Imports sorted alphabetically
  • Struct literals multiline by default
  • Pipelines vertically aligned
  • No configurable style rules

3. Variables

  • const → immutable binding
  • var → mutable binding
  • Struct fields are always immutable
  • Unused variables are compile errors
  • _ is the only discard binding

Example:

const x = 10
var y = 20

4. Types

  • Built-in Types
    • Int → JS number
    • BigInt → JS bigint
    • Bool → JS boolean
    • String → JS string
    • Any
    • Void
    • Never
  • Optional Type
    • Represents T | null.
    • undefined is not allowed in Zyra source.
String?

5. Numeric Rules

  • 123Int
  • 123nBigInt
  • Float literals are not allowed in v0
  • Mixing Int and BigInt requires explicit conversion.

Integer division:

5 // 2

Compiles to:

Math.trunc(5 / 2)

6. Functions

  • Functions return last expression implicitly
  • return is allowed
  • Functions containing await compile to async function

Example:

def add(a: Int, b: Int) -> Int {
  a + b
}

7. Expression-Oriented Design

Everything returns a value:

  • if
  • match
  • try
  • Blocks {}

Example:

const x =
  if (n > 0) { 1 }
  else { 0 }

8. Structs (Immutable)

struct User {
  id: UserId
  name: String
  age: Int?
}
  • Construction:
const u = User {
  id: UserId("u1")
  name: "Andre"
  age: null
}
  • Update via copy:
const u2 = u {
  name: "Bob"
}
  • Raw object literals are not allowed.

9. Enums

enum Result<T, E> {
  Ok(value: T)
  Err(error: E)
}
  • Pattern matching:
match r {
  Ok(v) => v
  Err(e) => throw e
}

10. Pattern Matching

Supports:

  • Enum destructuring
  • Struct destructuring
  • Nested patterns
  • Wildcard _
  • Literal matching
  • Exhaustiveness is enforced for enums

Example:

match value {
  User { name, .. } => name
  _ => "unknown"
}

11. Equality

  • == compiles to ===
  • != compiles to !==
  • No loose equality exists

12. Type Checking (is)

is checks type identity, not equality.

  • Supports:
  • Built-in types
  • Struct types
  • Enum types

Example:

if (value is User) { ... }

13. Booleans

Operators:

  • &&
  • ||
  • !
  • Operands must be Bool. No truthiness allowed.

14. Strings

Double quotes interpolate:

"hello {name}"

Single quotes are raw:

'hello {name}'

Multiline:

"""
hello {name}
"""

15. Async Model

  • await keyword
  • Async inferred automatically
  • Top-level await allowed
  • Promise must be:
    • awaited
    • stored
    • or explicitly ignored with spawn

Safe await:

const x: T? = await? fetchData()

Compiles to .catch(() => null).


16. Defer

defer cleanup()

Compiles to try/finally.


17. Imports

Absolute only:

from @/module/test import myfunction

Relative imports are not allowed.


18. Strictness Rules

Compile errors for:

  • Unused variables
  • Unused imports
  • Unused parameters
  • Forgotten promises
  • Missing match cases (enum)
  • Missing struct fields in construction

19. Collections

  • Mutable collections:
    • Array<T>
    • Map<K, V>
  • Struct fields remain immutable.

20. No OOP

Zyra has:

  • No classes
  • No inheritance
  • No this
  • No prototype manipulation
  • No decorators
  • No runtime library
  • Zyra compiles directly to clean modern JavaScript.

CLI

zyra fmt
zyra check
zyra build
zyra run