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

@domainlang/language

v0.13.0

Published

Core language library for DomainLang - parse, validate, and query Domain-Driven Design models programmatically

Readme

@domainlang/language

npm version License

Parse, validate, and query Domain-Driven Design models written in the .dlang language. This package is the foundation that the CLI and VS Code extension are built on — and you can build on it too.

Install

npm install @domainlang/language

Quick start

import { loadModelFromText } from '@domainlang/language/sdk';

const { query } = await loadModelFromText(`
  Domain Sales {
    vision: "Enable seamless commerce"
  }

  Team SalesTeam
  Classification Core

  bc OrderContext for Sales as Core by SalesTeam {
    description: "Handles the order lifecycle"
  }
`);

const coreContexts = query.boundedContexts()
  .withClassification('Core')
  .toArray();

console.log(coreContexts.map(ctx => ctx.name)); // ['OrderContext']

That's it — five lines to parse a model and start querying. The SDK works in the browser, in Node.js, and inside Langium LSP integrations.

What you can do with it

Validate models programmatically. Run the same validation the VS Code extension uses, from Node.js scripts or CI pipelines.

Query anything in the model. The fluent query builder lets you filter bounded contexts by team, classification, or domain — with lazy evaluation and full type safety.

Build custom automation. Generate architecture reports, enforce naming conventions, sync models to wikis, or feed model data into dashboards.

API at a glance

| Function | Runtime | Purpose | | --- | --- | --- | | loadModelFromText(text) | Browser + Node.js | Parse DomainLang text in memory | | loadModel(path, options?) | Node.js | Load and parse .dlang files | | validateFile(path, options?) | Node.js | Validate a single file | | validateWorkspace(dir) | Node.js | Validate an entire workspace | | fromModel(model) | Browser + Node.js | Wrap an existing AST with query methods | | fromDocument(document) | Browser + Node.js | Zero-copy wrapping for Langium documents |

Query examples

// Find all Core bounded contexts owned by a specific team
const contexts = query.boundedContexts()
  .withTeam('PaymentsTeam')
  .withClassification('Core')
  .toArray();

// Find context maps that include a specific bounded context
const maps = query.contextMaps()
  .containing('OrderContext')
  .toArray();

Node.js file loading and validation

import { loadModel, validateFile } from '@domainlang/language/sdk';

const { query } = await loadModel('./model.dlang', { workspaceDir: process.cwd() });
const result = await validateFile('./model.dlang', { workspaceDir: process.cwd() });

if (!result.valid) {
  for (const err of result.errors) {
    console.error(`${err.file}:${err.line}: ${err.message}`);
  }
  process.exit(1);
}

Documentation

Related packages

License

Apache-2.0