Core parser, lexer, and transpiler for the UXL (User eXperience Lab / UXer eXperiment Language) framework. Current stable version 0.1.2. Designed for defining UI screens, data bindings, i18n, A/B tests, and component trees in a declarative DSL. The library provides an indentation-aware lexer (with configurable tab width and strict indentation enforcement), a Nearley-based parser that converts UXL source into an AST, and a transpiler that converts the AST into a stable contract.json format for downstream renderers. Unlike full-stack frameworks, uxl-core focuses on the parsing layer; multi-file project resolution and CLI are handled by the companion package uxl-kit. It is ESM-only and requires Node.js 18+.
npm install uxl-coreNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses UXL source and transpiles to contract.json.
Use import syntax or dynamic import().
const lexer = makeLexer({ baseIndent: 4 });Use uxl-kit to resolve multi-file projects before transpiling.
Set trace: false or omit.
Set strictIndent: false or ensure consistent indentation.
Change to import syntax: import { parse } from 'uxl-core';Adjust makeLexer({ baseIndent: <actual_indent> }) or fix indentation in the UXL file.Use import { transpile } from 'uxl-core';Ensure the source string contains valid UXL syntax with at least one top-level definition.