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

@falseinput/expressive

v0.3.0

Published

Compiler for the Expressive Language.

Readme

Expressive

Expressive is a toolkit and a DSL for creating MapLibre compatible styles.

Expressive Language compiles to MapLibre style specification JSON. It lets you split styles into multiple files, use variables, color functions, conditionals and write expressions using nice and readable syntax.

The expc CLI automatically compiles and serves local style.exp files, and provides diagnostics information such as type errors or warnings.

Expressive Language Support extension for Visual Studio Code provides syntax highlighting, autocomplete and more.

See it in action:

// colors.exp
base_saturation = 1

{
    "land": std.hsl(64, 25 * base_saturation, 91),
    "water": std.hsl(194, 98 * base_saturation, 50),
    "roads": std.hsl(60, 3 * base_saturation, 45)
}

// water-colors.exp
colors = import "./colors.exp"

{
    "ocean": when {
        zoom() > 16 -> std.lighten(colors.water, 20),
        zoom() > 10 -> std.lighten(colors.water, 10),
        true -> colors.water
    },
    "lake": std.lighten(colors.water, 15),
    "lagoon": std.darken(colors.water, 30)
}

Install

Run

npm i -g @falseinput/expressive

Use

compile (default)

Compile an Expressive file to MapLibre style JSON.

expc -i <input> -o <output>

| Flag | Alias | Required | Description | |------|-------|----------|-------------| | --input | -i | yes | Path to the .exp source file | | --output | -o | yes | Path to the output .json file |

Example:

expc -i style.exp -o style.json

serve

Builds all *style.exp files in the current directory and serves them with hot reload.

expc serve [--port <port>]

| Flag | Alias | Default | Description | |------|-------|---------|-------------| | --port | -p | 3000 | Port to listen on |

Example:

expc serve --port 8080

docs

Print the Expressive language reference and exit.

expc docs

Library

The package also ships the compiler as a library. compile is one ES module with TypeScript declarations, and it runs the same on Node and in the browser.

compile takes the files it compiles and never reads a disk. Keys are absolute POSIX-style paths, and entryPath names the program to compile.

import { compile } from "@falseinput/expressive";

const result = compile(
  {
    "/colors.exp": `{ "water": std.hsl(194, 98, 50) }`,
    "/style.exp": `colors = import "./colors.exp"\n{ "version": 8, "layers": [] }`,
  },
  "/style.exp",
);

if (result.ok) {
  console.log(result.json);
} else {
  console.error(result.errorDetails);
}

The map is the whole file system the compiler sees. Imports resolve inside the entry file's directory and cannot escape it, so the caller decides what a style can read by deciding what goes in the map.

On Node, readStyle fills that map from a directory. It collects .exp and .json files, keys them by their path below the directory, and skips symbolic links, node_modules and dot-directories, so nothing outside the directory reaches the map.

import { compile } from "@falseinput/expressive";
import { readStyle } from "@falseinput/expressive/fs";

compile(readStyle("./styles/bright"), "/style.light.exp");

compile returns { ok: true, json }, or { ok: false, errorDetails } where each error carries file, line, col, message and srcLine.

Language server

Expressive comes with Expressive Language Support extension for Visual Studio Code.

Extension helps you catch errors like mismatched types and provides autocomplete for all standard library functions and expressions.

Features

Expressive aims to provide everything you may need for creating complex map styles, without being overwhelming.

Imports

Imported files are interpreted as Expressive. When an import ends with .json, the file is parsed as JSON. import can be assigned to a variable or used inside objects.

typography = import "./typography.exp"

By convention, Expressive files have an .exp extension.

import evaluates to the last statement in the referenced file. To import multiple properties, you can put them in an object.

Expression syntax

The default expression syntax was made for computers. Expressive fixes that.

// Write expressions like normal functions
zoom(); // -> ["zoom"]

// Use math operators: *, /, +, -
get("road_width") * 0.3; // -> ["*", ["get", "road_width"], 0.3]

// Math operators eagerly reduce arguments if possible
2 * 3 + 1; // -> 7

Color functions

Use color functions to manipulate and mix colors.

// Define colors using safe constructors
base = std.hsl(210, 80, 60);
semi = std.hsla(210, 80, 60, 0.5);

// Manipulate colors
lighter = std.lighten(base, 20);
darker = std.darken(base, 10);
vivid = std.saturate(base, 30);
muted = std.desaturate(base, 15);
shifted = std.adjustHue(base, 30);

// Mix colors
blend = std.mix(base, std.hsl(0, 90, 50), 0.5);

// Return black or white for maximum contrast (WCAG)
label_color = std.colorContrast(base);

Types

Expressive supports strings, numbers, booleans, arrays, and objects.

// string
variant = "light"

// number
default_font_size = 12

// boolean
is_beta = true

// array
default_fontstack = ["Noto-Sans", "sans-serif"]

// object
typography = {
    "sizes": {
        "s": default_font_size,
        "m": default_font_size * 1.2,
        "l": default_font_size * 1.4
    },
    "base_font": when {
        // A comment
        is_beta -> ["Arial", "sans-serif"], // Inline comment
        true -> default_fontstack
    }
}

Conditionals

Expressive handles conditional logic with a when expression. when can be used to control program flow and as a replacement for the match MapLibre expression.

variant = "dark"
when {
    variant == "light" -> "white",
    variant == "dark" -> "black",
    true -> "white"
}
// Evaluates to:
// "black"

When the subject or condition is a MapLibre expression (like get() or zoom()), when evaluates to a match expression.

when (get("road_category")) {
    "motorway" -> 14,
    "trunk" -> 12,
    "primary" -> 10,
    else -> 7
}
// Evaluates to:
[
    "match",
    ["get", "road_category"],
    "motorway",
    14,
    "trunk",
    12,
    "primary",
    10,
    7
]

Evaluation

Expressive evaluates to JSON. The last statement in a file is the program result.

Limitations

Expressive is in an ALPHA state. Some of the things that you might expect to work are not yet implemented; some will never be.

No support:

  • Logical operators (and, or, not)
  • No type checks for layers and sources

Limited support:

  • Type inference - it's done on a best-effort basis, in many cases types are not inferred, falling back to an "unknown" type that does not raise type error.

Not planned:

  • Fetching data.
  • Support for editors other than VSC.

Support

Expressive is built after hours. If you like what you see here, you can star this repo and spread the word.

If you are considering supporting development of Expressive financially, you can do it through:

Thank you! <3

License

Copyright (c) 2026 Zbigniew Matysek

See full license in LICENSE.