Lexius Transpiler
raw JSON → 1.1.0 verified Fri May 01 auth: no javascript
Lexius Transpiler is a web-based transpiler for the Lexius language, designed for safe and isolated code transformation. Current stable version is 1.1.0, with frequent releases. It operates in a resource-limited, language-agnostic manner, ensuring no compromise to the host environment. Key differentiators include sandboxed execution, cross-platform support, and a focus on security.
Common errors
error TypeError: lexius_transpiler__WEBPACK_IMPORTED_MODULE_0__.lexiusTranspile is not a function ↓
cause Incorrect import: default import instead of named import.
fix
Use
import { lexiusTranspile } from 'lexius-transpiler' error Cannot find module 'lexius-transpiler' ↓
cause Package not installed or npm install failed.
fix
Run
npm install lexius-transpiler and ensure package.json is present. Warnings
breaking v1.1.0 renamed `transpile()` to `lexiusTranspile()`. ↓
fix Update imports and calls: replace `transpile` with `lexiusTranspile`.
deprecated Constructor `LexiusTranspiler(options)` is deprecated in v1.1.0; use factory function `lexiusTranspile` instead. ↓
fix Replace `new LexiusTranspiler(options)` with `lexiusTranspile(code, options)`.
gotcha Passing `format: 'esm'` may produce invalid code if targets are not supported. ↓
fix Ensure `target` is at least 'es2022' when using `format: 'esm'`.
Install
npm install lexius-transpiler yarn add lexius-transpiler pnpm add lexius-transpiler Imports
- lexiusTranspile wrong
const lexiusTranspile = require('lexius-transpiler')correctimport { lexiusTranspile } from 'lexius-transpiler' - LexiusTranspiler wrong
import LexiusTranspiler from 'lexius-transpiler'correctimport { LexiusTranspiler } from 'lexius-transpiler' - TranspileOptions wrong
import { TranspileOptions } from 'lexius-transpiler'correctimport type { TranspileOptions } from 'lexius-transpiler'
Quickstart
import { lexiusTranspile, LexiusTranspiler } from 'lexius-transpiler';
const code = 'x = 5';
const options = { target: 'es2020', format: 'cjs' };
// Using the function
try {
const result = lexiusTranspile(code, options);
console.log(result);
} catch (err) {
console.error(err);
}
// Using the class
const transpiler = new LexiusTranspiler(options);
const transpiled = transpiler.transform(code);
console.log(transpiled);