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.

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.
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.
npm install llp-script
yarn add llp-script
pnpm add llp-script

Shows basic usage of transpiling a file from llp-script subset to JavaScript, with error handling.

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);
}