Registry / serialization / lisan-compiler

lisan-compiler

JSON →
library0.1.1jsnpmunverified

Lisan Compiler v0.1.1 compiles Translation objects into Dictionary objects for the Lisan i18n library. It provides functions like parseLisanLiteral, parse, and generate. Designed as a build-time tool (devDependency) to precompile translations, reducing runtime overhead. The library is TypeScript-friendly, ships type definitions, and supports UMD browser usage via CDN. Lisan focuses on minimal bundle size and performance. Compiler handles Lisan Literal syntax and converts it to optimized dictionary format.

npm install lisan-compiler
INSTALL
IMPORT
SIG · LISAN-COMPILER
L
lisan-compiler
serializationjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parseLisanLiteral
import { parseLisanLiteral } from 'lisan-compiler';
const parseLisanLiteral = require('lisan-compiler').parseLisanLiteral;
ESM import preferred. The package is tree-shakeable.
parse
import { parse } from 'lisan-compiler';
import parse from 'lisan-compiler';
parse is a named export, not default.
generate
import { generate } from 'lisan-compiler';
const generate = require('lisan-compiler').generate;
ESM style; CJS require also works but may not benefit from tree-shaking.

Compiles a translations object into a Lisan dictionary using parse and generate.

import { parse, generate } from 'lisan-compiler'; const translations = { greeting: 'Hello, {name}!', farewell: { default: 'Goodbye', evening: 'Good night' }, }; const dictionary = generate(parse(translations)); console.log(dictionary); // Output: // { // greeting: { t: 'Hello, {name}!', p: ['name'] }, // farewell: { t: { default: 'Goodbye', evening: 'Good night' }, p: [] } // }
Debug
Known issues
gotchaparse and generate are separate steps; calling generate on raw translations will throw.
fix
Always call parse() first, then generate().
affects: >=0.1.0
deprecatedThe UMD global is lisanCompiler, not lisanCompiler. Default export behavior differs between builds.
fix
Access named exports via window.lisanCompiler in UMD.
affects: 0.1.0-0.1.1
gotchaparseLisanLiteral expects a single Lisan Literal string, not full translations object.
fix
Use parse() for objects, parseLisanLiteral() for individual literals.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: translations.map is not a function
Passing a single translation object without an array where an array is expected.
fix
Wrap the object in an array: parse([translations]) instead of parse(translations).
Cannot find module 'lisan-compiler'
Installed as devDependency but trying to use in runtime code.
fix
Move lisan-compiler to dependencies if needed, or use it in build scripts only.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lisan-compiler — npm install lisan-compiler · libregistry