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

@likec4/language-services

v1.49.0

Published

LikeC4 Language Services

Readme

@likec4/language-services

This package provides initialization of language services from given workspace directory, or in-memory from sources.

It is designed to be browser-compatible and bundled within the main likec4 package.

[!WARNING] This package is intended for internal use within other LikeC4 packages.

Please use the main likec4 package instead.

Features

  • Browser and Node.js Support - Dual runtime compatibility with separate entry points
  • Source Parsing - Parse LikeC4 DSL from strings or workspace directories
  • Model Building - Build and validate architecture models from parsed sources
  • View Computation - Compute views with predicates and element filtering
  • Layout Engine - Graphviz-based automatic layout for diagrams
  • Multi-project Support - Handle multiple LikeC4 projects in a workspace

Installation

npm install @likec4/language-services
# or
pnpm add @likec4/language-services

Usage

Browser Environment

import { fromSource, fromSources } from '@likec4/language-services/browser'

// From a single source string
const likec4 = await fromSource(`
  model {
    customer = person 'Customer'
    system = softwareSystem 'System'

    customer -> system 'uses'
  }
`)

// From multiple source files
const likec4 = await fromSources({
  'model.c4': 'model { ... }',
  'views.c4': 'views { ... }',
  /**
   * Optional, but allows to inject project config
   * with theme customization
   */
  'likec4.config.json': '{ "name": "project-name" }',
})

// Get computed model
const model = await likec4.computedModel()

// Get layouted diagrams
const diagrams = await likec4.diagrams()

Node.js Environment

import { fromWorkdir, fromWorkspace } from '@likec4/language-services/node'

// From a workspace directory
const likec4 = await fromWorkspace('./architecture')

// From current working directory
const likec4 = await fromWorkdir()

// Get layouted model
const model = await likec4.layoutedModel()

// Get all projects
const projects = likec4.projects()

[!NOTE] There is a separate entry point for node.js environment without MCP support: @likec4/language-services/node/without-mcp

Useful to reduce bundle size

API

Factory Functions

Browser

  • fromSource(source: string): Promise<LikeC4> - Create from a single source string
  • fromSources(sources: Record<string, string>): Promise<LikeC4> - Create from multiple source files

[!NOTE] fromSource and fromSources are available in both browser and node.js environments.

Node.js

  • fromWorkspace(path: string, options?: FromWorkspaceOptions): Promise<LikeC4> - Create from a workspace directory
  • fromWorkdir(options?: FromWorkspaceOptions): Promise<LikeC4> - Create from current working directory
  • fromSources(sources: Record<string, string>, options?: InitOptions): Promise<LikeC4> - Create from multiple source files
  • fromSource(source: string, options?: InitOptions): Promise<LikeC4> - Create from a single source string

LikeC4 Class

  • computedModel(project?: ProjectId): Promise<LikeC4Model.Computed> - Build model with computed views (no layout)
  • layoutedModel(project?: ProjectId): Promise<LikeC4Model.Layouted> - Build model with layout applied
  • diagrams(project?: ProjectId): Promise<LayoutedView[]> - Get all layouted diagrams
  • projects(): NonEmptyArray<ProjectId> - Get all project IDs
  • validate(): Promise<ValidationResult> - Validate all documents
  • export(format: ExportFormat): Promise<string> - Export to various formats

Runtime Compatibility

The package provides conditional exports for browser and Node.js environments:

  • Browser: Uses in-memory workspace, no filesystem access
  • Node.js: Full filesystem support, workspace scanning, and file watching

The appropriate version is automatically selected based on your environment.

Getting help

We are always happy to help you get started:

Contributors

Become a contributor

Support development

LikeC4 is a MIT-licensed open source project with its ongoing development made possible entirely by your support.
If you like the project, please consider contributing financially to help grow and improve it.
You can support us via OpenCollective or GitHub Sponsors.

License

This project is released under the MIT License