🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@nowline/core

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nowline/core

Reads and checks the Nowline roadmap language — the parser and validator every Nowline tool builds on.

latest
npmnpm
Version
0.8.5
Version published
Maintainers
1
Created
Source

@nowline/core

Parser, typed AST, and validator for the Nowline DSL. Pure TypeScript, built on Langium, no DOM or Node-specific APIs in the hot path. This package is the foundation everything else in the toolchain (@nowline/layout, @nowline/renderer, @nowline/cli, @nowline/lsp) is built against.

Install

pnpm add @nowline/core

Usage

Parse and validate from a file

import { createNowlineServices, resolveIncludes } from '@nowline/core';
import { URI } from 'langium';
import { readFile } from 'node:fs/promises';

const { shared, Nowline } = createNowlineServices();
const text = await readFile('roadmap.nowline', 'utf-8');
const doc = shared.workspace.LangiumDocumentFactory.fromString(
  text,
  URI.file('/absolute/path/to/roadmap.nowline'),
);
await shared.workspace.DocumentBuilder.build([doc], { validation: true });

const ast = doc.parseResult.value;          // typed AST root: NowlineFile
const parserErrors = doc.parseResult.parserErrors;
const diagnostics = doc.diagnostics ?? [];  // validation errors/warnings

const resolved = await resolveIncludes(ast, '/absolute/path/to/roadmap.nowline', {
  services: Nowline,
});

resolved.config.styles;        // Map<string, StyleDeclaration>
resolved.content.swimlanes;    // Map<string, SwimlaneDeclaration>
resolved.content.isolatedRegions;
resolved.diagnostics;          // Array<ResolveDiagnostic>

Parse from in-memory text

For embedding in editors or one-shot validation against a string:

import { createNowlineServices } from '@nowline/core';
import { URI } from 'langium';

const { shared } = createNowlineServices();
const doc = shared.workspace.LangiumDocumentFactory.fromString(
  text,
  URI.parse('memory:///roadmap.nowline'),
);
await shared.workspace.DocumentBuilder.build([doc], { validation: true });

const ast = doc.parseResult.value;

What's included

  • Grammar: src/language/nowline.langium (Langium, indentation-aware).
  • AST: generated into src/generated/ast.ts — use isItemDeclaration, isSwimlaneDeclaration, etc. as type guards.
  • Validator: 32 validation rules covering file structure, identifiers, property values, include semantics, parallel/group constraints, and more.
  • Include resolver: multi-file resolution with merge/ignore/isolate modes, circular-include detection, diamond deduplication.

Regenerate AST

After editing the grammar, regenerate:

pnpm run langium:generate

Test

pnpm test           # one-shot
pnpm test:watch     # watch mode

License

Apache 2.0.

FAQs

Package last updated on 20 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts