llp-script
raw JSON → 0.5.0 verified Fri May 01 auth: no javascript
A simple and safe JavaScript subset transpiler designed for LLP (Low-Latency Platform) customization, currently at version 0.5.0. The project appears to be in early development with a single commit on GitHub. It provides a transpiler that converts a restricted subset of JavaScript to compatible code, focusing on safety and simplicity for embedded customization scenarios. Compared to more comprehensive transpilers like Babel or TypeScript, llp-script is minimal and targeted. The release cadence is unknown; the latest version is 0.5.0, and there is no recent activity.
Common errors
error Error: Cannot find module 'acorn' ↓
cause Missing dependency acorn is not installed.
fix
Run npm install acorn
error TypeError: transpile is not a function ↓
cause Incorrect import: using default import instead of named import.
fix
Use import { transpile } from 'llp-script'
error SyntaxError: Unexpected token => ↓
cause Input code uses arrow functions which are not in the supported subset.
fix
Rewrite arrow function as a regular function expression.
Warnings
breaking Version 0.5.0 changed the API from synchronous to callback-based for transpile. ↓
fix Update calls to transpile to use callback or promise: transpile(code, callback)
deprecated The default export was deprecated in 0.4.0; use named export transpile instead. ↓
fix Replace default import with named import: import { transpile } from 'llp-script'
gotcha Transpiler does not support ES6+ syntax like arrow functions or let; use only var and function declarations. ↓
fix Ensure input code uses only the supported subset: var, function, if, while, for, etc.
Install
npm install llp-script yarn add llp-script pnpm add llp-script Imports
- transpile wrong
const transpile = require('llp-script').transpilecorrectimport { transpile } from 'llp-script' - parse wrong
import { parse } from 'llp-script/parse'correctimport { parse } from 'llp-script' - default wrong
import * as llp from 'llp-script'correctimport llp from 'llp-script'
Quickstart
import { transpile } from 'llp-script';
import { readFileSync } from 'fs';
const code = readFileSync('./script.llp', 'utf8');
try {
const result = transpile(code, { comments: false });
console.log(result.code);
} catch (err) {
console.error('Transpilation failed:', err);
}