Registry / devops / lichenscript

lichenscript

JSON →
library0.6.3jsnpmunverified

LichenScript is a statically typed language compiler that targets JavaScript and C, version 0.6.3. It offers modern syntax similar to TypeScript/JavaScript, pattern matching, and AOT compilation to C for fast cold start and portability (WebAssembly/Mobile). Its JavaScript target produces readable code with small overhead. It is designed for easy integration with the web ecosystem, providing a lightweight alternative to TypeScript for isolated environments. Active development with monthly releases.

npm install lichenscript
INSTALL
IMPORT
SIG · LICHENSCRIPT
L
lichenscript
devopsjavascriptv0.6.3
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.

default
import lichenscript from 'lichenscript'
const lichenscript = require('lichenscript')
ESM-only since v0.6; no CommonJS support.
compile
import { compile } from 'lichenscript'
import compile from 'lichenscript/lib/compile'
Named export; do not use relative paths.
LichenScript
import { LichenScript } from 'lichenscript'
import { LichenScript } from 'lichenscript/lib/core'
Type is exported; use from main entry.
TokenKind
import { TokenKind } from 'lichenscript'
import { TokenKind } from 'lichenscript/dist/types'
Type export available from root.

Compiles a simple LichenScript program with a function and prints the generated JavaScript code.

import { compile } from 'lichenscript'; const code = ` let greet = (name: string) => { print('Hello, ' + name); }; greet('World'); `; const result = compile(code, { target: 'js' }); console.log(result.code); // Output: "const greet = (name) => { console.log('Hello, ' + name); }; greet('World');"
Debug
Known issues
breakingVersion 0.6.0 dropped CommonJS support (require) in favor of ESM only.
fix
Use import syntax instead of require(). Ensure your runtime supports ES modules.
affects: >=0.6.0
deprecatedThe 'output' option in compile() has been deprecated; use 'target' instead.
fix
Replace { output: 'js' } with { target: 'js' }.
affects: >=0.5.0
gotchaString interpolation uses backticks but with single quotes? Actually, LichenScript uses '+' for concatenation, not template literals.
fix
Use the '+' operator to concatenate strings.
affects: >=0.1.0
gotchaThe C target requires a separate C compiler (e.g., gcc) to produce executables; the compile() function only outputs C source code.
fix
Install a C compiler and run it on the generated .c file.
affects: >=0.1.0
breakingBefore v0.4.0, the function signature for compile was (code, options) but options.target accepted 'javascript' and 'c' strings; changed to 'js' and 'c'.
fix
Update target values from 'javascript' to 'js'.
affects: <0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'lichenscript'
Package not installed or incorrect import path.
fix
Run 'npm install lichenscript' and ensure you are using an ESM project.
TypeError: lichenscript.compile is not a function
Using default import instead of named import for compile.
fix
Use 'import { compile } from 'lichenscript'' instead of 'import lichenscript from 'lichenscript''.
SyntaxError: Unexpected token 'export'
Trying to use ESM import in a CommonJS module.
fix
Set 'type': 'module' in package.json or use .mjs file extension.
Error: Unknown target 'javascript'
Using deprecated target value.
fix
Replace 'javascript' with 'js' in options.target.
Error: Option 'output' is deprecated. Use 'target' instead.
Using deprecated output option.
fix
Use compile(code, { target: 'js' }) instead of compile(code, { output: 'js' }).
Upgrade
Version history
0.6.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lichenscript — npm install lichenscript · libregistry